{"version":3,"sources":["node_modules/@turf/turf/turf.min.js","node_modules/moment/moment.js","node_modules/proj4/lib/global.js","node_modules/proj4/lib/constants/values.js","node_modules/proj4/lib/constants/PrimeMeridian.js","node_modules/proj4/lib/constants/units.js","node_modules/proj4/lib/match.js","node_modules/proj4/lib/projString.js","node_modules/wkt-parser/parser.js","node_modules/wkt-parser/process.js","node_modules/wkt-parser/index.js","node_modules/proj4/lib/defs.js","node_modules/proj4/lib/parseCode.js","node_modules/proj4/lib/extend.js","node_modules/proj4/lib/common/msfnz.js","node_modules/proj4/lib/common/sign.js","node_modules/proj4/lib/common/adjust_lon.js","node_modules/proj4/lib/common/tsfnz.js","node_modules/proj4/lib/common/phi2z.js","node_modules/proj4/lib/projections/merc.js","node_modules/proj4/lib/projections/longlat.js","node_modules/proj4/lib/projections.js","node_modules/proj4/lib/constants/Ellipsoid.js","node_modules/proj4/lib/deriveConstants.js","node_modules/proj4/lib/constants/Datum.js","node_modules/proj4/lib/datum.js","node_modules/proj4/lib/nadgrid.js","node_modules/proj4/lib/Proj.js","node_modules/proj4/lib/datumUtils.js","node_modules/proj4/lib/datum_transform.js","node_modules/proj4/lib/adjust_axis.js","node_modules/proj4/lib/common/toPoint.js","node_modules/proj4/lib/checkSanity.js","node_modules/proj4/lib/transform.js","node_modules/proj4/lib/core.js","node_modules/mgrs/mgrs.js","node_modules/proj4/lib/Point.js","node_modules/proj4/lib/common/pj_enfn.js","node_modules/proj4/lib/common/pj_mlfn.js","node_modules/proj4/lib/common/pj_inv_mlfn.js","node_modules/proj4/lib/projections/tmerc.js","node_modules/proj4/lib/common/sinh.js","node_modules/proj4/lib/common/hypot.js","node_modules/proj4/lib/common/log1py.js","node_modules/proj4/lib/common/asinhy.js","node_modules/proj4/lib/common/gatg.js","node_modules/proj4/lib/common/clens.js","node_modules/proj4/lib/common/cosh.js","node_modules/proj4/lib/common/clens_cmplx.js","node_modules/proj4/lib/projections/etmerc.js","node_modules/proj4/lib/common/adjust_zone.js","node_modules/proj4/lib/projections/utm.js","node_modules/proj4/lib/common/srat.js","node_modules/proj4/lib/projections/gauss.js","node_modules/proj4/lib/projections/sterea.js","node_modules/proj4/lib/projections/stere.js","node_modules/proj4/lib/projections/somerc.js","node_modules/proj4/lib/projections/omerc.js","node_modules/proj4/lib/projections/lcc.js","node_modules/proj4/lib/projections/krovak.js","node_modules/proj4/lib/common/mlfn.js","node_modules/proj4/lib/common/e0fn.js","node_modules/proj4/lib/common/e1fn.js","node_modules/proj4/lib/common/e2fn.js","node_modules/proj4/lib/common/e3fn.js","node_modules/proj4/lib/common/gN.js","node_modules/proj4/lib/common/adjust_lat.js","node_modules/proj4/lib/common/imlfn.js","node_modules/proj4/lib/projections/cass.js","node_modules/proj4/lib/common/qsfnz.js","node_modules/proj4/lib/projections/laea.js","node_modules/proj4/lib/common/asinz.js","node_modules/proj4/lib/projections/aea.js","node_modules/proj4/lib/projections/gnom.js","node_modules/proj4/lib/common/iqsfnz.js","node_modules/proj4/lib/projections/cea.js","node_modules/proj4/lib/projections/eqc.js","node_modules/proj4/lib/projections/poly.js","node_modules/proj4/lib/projections/nzmg.js","node_modules/proj4/lib/projections/mill.js","node_modules/proj4/lib/projections/sinu.js","node_modules/proj4/lib/projections/moll.js","node_modules/proj4/lib/projections/eqdc.js","node_modules/proj4/lib/projections/vandg.js","node_modules/proj4/lib/projections/aeqd.js","node_modules/proj4/lib/projections/ortho.js","node_modules/proj4/lib/projections/qsc.js","node_modules/proj4/lib/projections/robin.js","node_modules/proj4/lib/projections/geocent.js","node_modules/proj4/lib/projections/tpers.js","node_modules/proj4/lib/projections/geos.js","node_modules/proj4/lib/projections/eqearth.js","node_modules/proj4/projs.js","node_modules/proj4/lib/index.js","node_modules/shpjs/node_modules/jszip/lib/base64.js","node_modules/shpjs/node_modules/jszip/lib/support.js","node_modules/pako/lib/utils/common.js","node_modules/pako/lib/zlib/trees.js","node_modules/pako/lib/zlib/adler32.js","node_modules/pako/lib/zlib/crc32.js","node_modules/pako/lib/zlib/messages.js","node_modules/pako/lib/zlib/deflate.js","node_modules/pako/lib/utils/strings.js","node_modules/pako/lib/zlib/zstream.js","node_modules/pako/lib/deflate.js","node_modules/pako/lib/zlib/inffast.js","node_modules/pako/lib/zlib/inftrees.js","node_modules/pako/lib/zlib/inflate.js","node_modules/pako/lib/zlib/constants.js","node_modules/pako/lib/zlib/gzheader.js","node_modules/pako/lib/inflate.js","node_modules/pako/index.js","node_modules/shpjs/node_modules/jszip/lib/flate.js","node_modules/shpjs/node_modules/jszip/lib/compressions.js","node_modules/shpjs/node_modules/jszip/lib/nodeBuffer.js","node_modules/shpjs/node_modules/jszip/lib/utils.js","node_modules/shpjs/node_modules/jszip/lib/crc32.js","node_modules/shpjs/node_modules/jszip/lib/signature.js","node_modules/shpjs/node_modules/jszip/lib/defaults.js","node_modules/shpjs/node_modules/jszip/lib/compressedObject.js","node_modules/shpjs/node_modules/jszip/lib/utf8.js","node_modules/shpjs/node_modules/jszip/lib/stringWriter.js","node_modules/shpjs/node_modules/jszip/lib/uint8ArrayWriter.js","node_modules/shpjs/node_modules/jszip/lib/object.js","node_modules/shpjs/node_modules/jszip/lib/dataReader.js","node_modules/shpjs/node_modules/jszip/lib/stringReader.js","node_modules/shpjs/node_modules/jszip/lib/arrayReader.js","node_modules/shpjs/node_modules/jszip/lib/uint8ArrayReader.js","node_modules/shpjs/node_modules/jszip/lib/nodeBufferReader.js","node_modules/shpjs/node_modules/jszip/lib/zipEntry.js","node_modules/shpjs/node_modules/jszip/lib/zipEntries.js","node_modules/shpjs/node_modules/jszip/lib/load.js","node_modules/shpjs/node_modules/jszip/lib/deprecatedPublicUtils.js","node_modules/shpjs/node_modules/jszip/lib/index.js","node_modules/shpjs/lib/unzip.js","node_modules/immediate/lib/browser.js","node_modules/lie/lib/browser.js","node_modules/base64-js/index.js","node_modules/ieee754/index.js","node_modules/buffer/index.js","node_modules/shpjs/lib/binaryajax-browser.js","node_modules/shpjs/lib/binaryajax-fetch.js","node_modules/shpjs/lib/parseShp.js","node_modules/text-encoding-polyfill/lib/encoding-indexes.js","node_modules/text-encoding-polyfill/lib/encoding.js","node_modules/text-encoding-polyfill/index.js","node_modules/safe-buffer/index.js","node_modules/string_decoder/lib/string_decoder.js","node_modules/parsedbf/decoder-browser.js","node_modules/parsedbf/index.js","node_modules/shpjs/node_modules/lru-cache/lib/lru-cache.js","node_modules/shpjs/lib/index.js","node_modules/xml-name-validator/lib/xml-name-validator.js","node_modules/papaparse/papaparse.min.js","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/scheduler/animationFrameProvider.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/util/Immediate.js","node_modules/rxjs/dist/esm/internal/scheduler/immediateProvider.js","node_modules/rxjs/dist/esm/internal/scheduler/AsapAction.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/AsapScheduler.js","node_modules/rxjs/dist/esm/internal/scheduler/asap.js","node_modules/rxjs/dist/esm/internal/scheduler/async.js","node_modules/rxjs/dist/esm/internal/scheduler/AnimationFrameAction.js","node_modules/rxjs/dist/esm/internal/scheduler/AnimationFrameScheduler.js","node_modules/rxjs/dist/esm/internal/scheduler/animationFrame.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/lastValueFrom.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/util/argsOrArgArray.js","node_modules/rxjs/dist/esm/internal/operators/filter.js","node_modules/rxjs/dist/esm/internal/observable/zip.js","node_modules/rxjs/dist/esm/internal/operators/audit.js","node_modules/rxjs/dist/esm/internal/operators/auditTime.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/reduce.js","node_modules/rxjs/dist/esm/internal/operators/toArray.js","node_modules/rxjs/dist/esm/internal/operators/concatMap.js","node_modules/rxjs/dist/esm/internal/operators/debounce.js","node_modules/rxjs/dist/esm/internal/operators/debounceTime.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/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/flatMap.js","node_modules/rxjs/dist/esm/internal/operators/pairwise.js","node_modules/rxjs/dist/esm/internal/operators/retryWhen.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/skipWhile.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/takeWhile.js","node_modules/rxjs/dist/esm/internal/operators/tap.js","node_modules/@angular/core/fesm2022/core.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/cdk/fesm2022/coercion.mjs","node_modules/@angular/cdk/fesm2022/platform.mjs","node_modules/@angular/cdk/fesm2022/bidi.mjs","node_modules/@angular/cdk/fesm2022/collections.mjs","node_modules/@angular/cdk/fesm2022/scrolling.mjs","node_modules/@angular/cdk/fesm2022/portal.mjs","node_modules/@angular/cdk/fesm2022/keycodes.mjs","node_modules/@angular/cdk/fesm2022/overlay.mjs","node_modules/@angular/common/locales/de.mjs","node_modules/@angular/common/locales/fr.mjs","node_modules/@angular/common/locales/nb.mjs","node_modules/@angular/common/locales/nl.mjs","node_modules/@angular/common/locales/sv.mjs","node_modules/@angular/forms/fesm2022/forms.mjs","node_modules/@angular/cdk/fesm2022/observers.mjs","node_modules/@angular/cdk/fesm2022/layout.mjs","node_modules/@angular/cdk/fesm2022/a11y.mjs","node_modules/@angular/material/fesm2022/core.mjs","node_modules/@angular/material/fesm2022/button.mjs","node_modules/@angular/cdk/fesm2022/observers/private.mjs","node_modules/@angular/animations/fesm2022/animations.mjs","node_modules/@angular/material/fesm2022/form-field.mjs","node_modules/@angular/material/fesm2022/select.mjs","node_modules/@angular/material/fesm2022/tooltip.mjs","node_modules/@angular/material/fesm2022/paginator.mjs","node_modules/@angular/animations/fesm2022/browser.mjs","node_modules/@angular/platform-browser/fesm2022/animations.mjs","node_modules/@angular/router/fesm2022/router.mjs","src/environments/environment.prod.ts","node_modules/ngx-drag-scroll/fesm2020/ngx-drag-scroll.mjs","src/app/services/client.service.ts","src/app/models/importStatusGroup.model.ts","node_modules/@ngrx/signals/fesm2022/ngrx-signals.mjs","node_modules/@angular/material/fesm2022/icon.mjs","node_modules/@dvm/components/fesm2022/dvm-components.mjs","node_modules/@angular/cdk/fesm2022/text-field.mjs","node_modules/@angular/material/fesm2022/input.mjs","node_modules/@angular/material/fesm2022/datepicker.mjs","node_modules/@angular/cdk/fesm2022/stepper.mjs","node_modules/@angular/cdk/fesm2022/table.mjs","node_modules/@angular/cdk/fesm2022/dialog.mjs","node_modules/@angular/material/fesm2022/progress-spinner.mjs","node_modules/@azure/msal-browser/dist/utils/BrowserUtils.mjs","node_modules/@azure/msal-common/dist/account/AuthToken.mjs","node_modules/@azure/msal-common/dist/utils/Constants.mjs","node_modules/@azure/msal-common/dist/error/AuthErrorCodes.mjs","node_modules/@azure/msal-common/dist/error/AuthError.mjs","node_modules/@azure/msal-common/dist/error/ClientAuthErrorCodes.mjs","node_modules/@azure/msal-common/dist/error/ClientAuthError.mjs","node_modules/@azure/msal-common/dist/authority/AuthorityFactory.mjs","node_modules/@azure/msal-common/dist/authority/AuthorityType.mjs","node_modules/@azure/msal-common/dist/authority/OpenIdConfigResponse.mjs","node_modules/@azure/msal-common/dist/error/ClientConfigurationErrorCodes.mjs","node_modules/@azure/msal-common/dist/error/ClientConfigurationError.mjs","node_modules/@azure/msal-common/dist/utils/StringUtils.mjs","node_modules/@azure/msal-common/dist/utils/UrlUtils.mjs","node_modules/@azure/msal-common/dist/url/UrlString.mjs","node_modules/@azure/msal-common/dist/authority/AuthorityMetadata.mjs","node_modules/@azure/msal-common/dist/authority/ProtocolMode.mjs","node_modules/@azure/msal-common/dist/authority/AuthorityOptions.mjs","node_modules/@azure/msal-common/dist/authority/CloudInstanceDiscoveryResponse.mjs","node_modules/@azure/msal-common/dist/authority/CloudInstanceDiscoveryErrorResponse.mjs","node_modules/@azure/msal-common/dist/telemetry/performance/PerformanceEvent.mjs","node_modules/@azure/msal-common/dist/utils/FunctionWrappers.mjs","node_modules/@azure/msal-common/dist/authority/RegionDiscovery.mjs","node_modules/@azure/msal-common/dist/cache/utils/CacheHelpers.mjs","node_modules/@azure/msal-common/dist/utils/TimeUtils.mjs","node_modules/@azure/msal-common/dist/authority/Authority.mjs","node_modules/@azure/msal-common/dist/utils/ClientAssertionUtils.mjs","node_modules/@azure/msal-common/dist/constants/AADServerParamKeys.mjs","node_modules/@azure/msal-common/dist/crypto/ICrypto.mjs","node_modules/@azure/msal-common/dist/logger/Logger.mjs","node_modules/@azure/msal-common/dist/packageMetadata.mjs","node_modules/@azure/msal-common/dist/request/ScopeSet.mjs","node_modules/@azure/msal-common/dist/account/ClientInfo.mjs","node_modules/@azure/msal-common/dist/account/AccountInfo.mjs","node_modules/@azure/msal-common/dist/account/TokenClaims.mjs","node_modules/@azure/msal-common/dist/cache/entities/AccountEntity.mjs","node_modules/@azure/msal-common/dist/error/CacheErrorCodes.mjs","node_modules/@azure/msal-common/dist/error/CacheError.mjs","node_modules/@azure/msal-common/dist/cache/CacheManager.mjs","node_modules/@azure/msal-common/dist/config/ClientConfiguration.mjs","node_modules/@azure/msal-common/dist/error/ServerError.mjs","node_modules/@azure/msal-common/dist/network/ThrottlingUtils.mjs","node_modules/@azure/msal-common/dist/network/NetworkManager.mjs","node_modules/@azure/msal-common/dist/account/CcsCredential.mjs","node_modules/@azure/msal-common/dist/request/RequestValidator.mjs","node_modules/@azure/msal-common/dist/request/RequestParameterBuilder.mjs","node_modules/@azure/msal-common/dist/client/BaseClient.mjs","node_modules/@azure/msal-common/dist/error/InteractionRequiredAuthErrorCodes.mjs","node_modules/@azure/msal-common/dist/error/InteractionRequiredAuthError.mjs","node_modules/@azure/msal-common/dist/utils/ProtocolUtils.mjs","node_modules/@azure/msal-common/dist/crypto/PopTokenGenerator.mjs","node_modules/@azure/msal-common/dist/cache/persistence/TokenCacheContext.mjs","node_modules/@azure/msal-common/dist/response/ResponseHandler.mjs","node_modules/@azure/msal-common/dist/client/AuthorizationCodeClient.mjs","node_modules/@azure/msal-common/dist/client/RefreshTokenClient.mjs","node_modules/@azure/msal-common/dist/client/SilentFlowClient.mjs","node_modules/@azure/msal-common/dist/network/INetworkModule.mjs","node_modules/@azure/msal-common/dist/error/JoseHeaderErrorCodes.mjs","node_modules/@azure/msal-common/dist/error/JoseHeaderError.mjs","node_modules/@azure/msal-common/dist/crypto/JoseHeader.mjs","node_modules/@azure/msal-common/dist/telemetry/server/ServerTelemetryManager.mjs","node_modules/@azure/msal-common/dist/telemetry/performance/StubPerformanceClient.mjs","node_modules/@azure/msal-browser/dist/error/BrowserAuthErrorCodes.mjs","node_modules/@azure/msal-browser/dist/error/BrowserAuthError.mjs","node_modules/@azure/msal-browser/dist/utils/BrowserConstants.mjs","node_modules/@azure/msal-browser/dist/encode/Base64Encode.mjs","node_modules/@azure/msal-browser/dist/crypto/BrowserCrypto.mjs","node_modules/@azure/msal-browser/dist/error/BrowserConfigurationAuthErrorCodes.mjs","node_modules/@azure/msal-browser/dist/error/BrowserConfigurationAuthError.mjs","node_modules/@azure/msal-browser/dist/navigation/NavigationClient.mjs","node_modules/@azure/msal-browser/dist/network/FetchClient.mjs","node_modules/@azure/msal-browser/dist/config/Configuration.mjs","node_modules/@azure/msal-browser/dist/packageMetadata.mjs","node_modules/@azure/msal-browser/dist/operatingcontext/BaseOperatingContext.mjs","node_modules/@azure/msal-browser/dist/operatingcontext/StandardOperatingContext.mjs","node_modules/@azure/msal-browser/dist/encode/Base64Decode.mjs","node_modules/@azure/msal-browser/dist/cache/DatabaseStorage.mjs","node_modules/@azure/msal-browser/dist/cache/MemoryStorage.mjs","node_modules/@azure/msal-browser/dist/cache/AsyncMemoryStorage.mjs","node_modules/@azure/msal-browser/dist/crypto/CryptoOps.mjs","node_modules/@azure/msal-browser/dist/cache/BrowserStorage.mjs","node_modules/@azure/msal-browser/dist/utils/BrowserProtocolUtils.mjs","node_modules/@azure/msal-browser/dist/cache/BrowserCacheManager.mjs","node_modules/@azure/msal-browser/dist/cache/AccountManager.mjs","node_modules/@azure/msal-browser/dist/event/EventType.mjs","node_modules/@azure/msal-browser/dist/event/EventHandler.mjs","node_modules/@azure/msal-browser/dist/interaction_client/BaseInteractionClient.mjs","node_modules/@azure/msal-browser/dist/crypto/PkceGenerator.mjs","node_modules/@azure/msal-browser/dist/request/RequestHelpers.mjs","node_modules/@azure/msal-browser/dist/interaction_client/StandardInteractionClient.mjs","node_modules/@azure/msal-browser/dist/error/NativeAuthErrorCodes.mjs","node_modules/@azure/msal-browser/dist/broker/nativeBroker/NativeStatusCodes.mjs","node_modules/@azure/msal-browser/dist/error/NativeAuthError.mjs","node_modules/@azure/msal-browser/dist/interaction_client/SilentCacheClient.mjs","node_modules/@azure/msal-browser/dist/interaction_client/NativeInteractionClient.mjs","node_modules/@azure/msal-browser/dist/broker/nativeBroker/NativeMessageHandler.mjs","node_modules/@azure/msal-browser/dist/interaction_handler/InteractionHandler.mjs","node_modules/@azure/msal-browser/dist/response/ResponseHandler.mjs","node_modules/@azure/msal-browser/dist/interaction_client/PopupClient.mjs","node_modules/@azure/msal-browser/dist/interaction_handler/RedirectHandler.mjs","node_modules/@azure/msal-browser/dist/interaction_client/RedirectClient.mjs","node_modules/@azure/msal-browser/dist/interaction_handler/SilentHandler.mjs","node_modules/@azure/msal-browser/dist/interaction_client/SilentIframeClient.mjs","node_modules/@azure/msal-browser/dist/interaction_client/SilentRefreshClient.mjs","node_modules/@azure/msal-browser/dist/cache/TokenCache.mjs","node_modules/@azure/msal-browser/dist/interaction_client/HybridSpaAuthorizationCodeClient.mjs","node_modules/@azure/msal-browser/dist/interaction_client/SilentAuthCodeClient.mjs","node_modules/@azure/msal-browser/dist/controllers/StandardController.mjs","node_modules/@azure/msal-browser/dist/controllers/ControllerFactory.mjs","node_modules/@azure/msal-browser/dist/app/PublicClientApplication.mjs","node_modules/@azure/msal-browser/dist/event/EventMessage.mjs","node_modules/@azure/msal-angular/fesm2020/azure-msal-angular.mjs","node_modules/@dv/toolbar-msal/fesm2022/dv-toolbar-msal.mjs","src/app/pipes/pipe/trim-system-folder.pipe.ts","node_modules/@angular/material/fesm2022/dialog.mjs","src/app/about/about.component.ts","src/app/about/about.component.html","src/app/app.types.ts","src/app/app.component.ts","src/app/app.component.html","src/app/bruk-enh-dialog/bruk-enh-dialog.component.ts","src/app/bruk-enh-dialog/bruk-enh-dialog.component.html","node_modules/@angular/material/fesm2022/badge.mjs","src/app/types/featureflags.types.ts","src/app/services/site.service.ts","src/app/components/insufficient-rights-dialog/insufficient-rights-dialog.component.ts","src/app/components/insufficient-rights-dialog/insufficient-rights-dialog.component.html","src/app/components/layer-dialog/layer-dialog.component.ts","src/app/components/layer-dialog/layer-dialog.component.html","src/app/models/layertype.model.ts","src/app/services/map-state.service.ts","src/app/components/map/map.service.ts","src/app/components/mapping-view/mapping-wizard/mapping-wizard.service.ts","node_modules/@angular/material/fesm2022/progress-bar.mjs","src/app/components/dialog/content/dialog.component.ts","src/app/components/dialog/content/dialog.component.html","node_modules/@angular/material/fesm2022/divider.mjs","src/app/components/import-view/import-done/import-done.component.ts","src/app/components/import-view/import-done/import-done.component.html","src/app/models/import.model.ts","node_modules/@angular/material/fesm2022/stepper.mjs","node_modules/@angular/material/fesm2022/chips.mjs","src/app/directives/filedrop.directive.ts","src/app/components/import-view/fileupload/fileupload.component.ts","src/app/components/import-view/fileupload/fileupload.component.html","src/app/components/import-view/asapplied/asapplied.component.ts","src/app/components/import-view/asapplied/asapplied.component.html","src/app/components/import-view/common/common.component.ts","src/app/components/import-view/common/common.component.html","src/app/components/import-view/field-boundary/field-boundary.component.ts","src/app/components/import-view/field-boundary/field-boundary.component.html","node_modules/@angular/material/fesm2022/snack-bar.mjs","src/app/components/import-view/logdata/logdata.component.ts","src/app/components/import-view/logdata/logdata.component.html","src/app/components/import-view/metadata-prompt/metadata-prompt.component.ts","src/app/components/import-view/metadata-prompt/metadata-prompt.component.html","src/app/models/geodata.model.ts","src/app/components/import-view/prescription/prescription.component.ts","src/app/components/import-view/prescription/prescription.component.html","src/app/components/import-view/sensordata/sensordata.component.ts","src/app/components/import-view/sensordata/sensordata.component.html","src/app/components/import-view/soilsampling/soilsampling.component.ts","src/app/components/import-view/soilsampling/soilsampling.component.html","src/app/components/import-view/soilsampling/soilsampling.types.ts","node_modules/ngx-papaparse/node_modules/tslib/tslib.es6.js","node_modules/ngx-papaparse/fesm2015/ngx-papaparse.js","src/app/services/data-filter.service.ts","src/app/components/dialog/confirm/confirm.component.ts","src/app/components/dialog/confirm/confirm.component.html","src/app/components/dialog/prompt/prompt.component.ts","src/app/components/dialog/prompt/prompt.component.html","src/app/components/dialog/note/note.component.ts","src/app/components/dialog/note/note.component.html","src/app/components/dialog/dialog.service.ts","node_modules/@microsoft/signalr/dist/esm/Errors.js","node_modules/@microsoft/signalr/dist/esm/HttpClient.js","node_modules/@microsoft/signalr/dist/esm/ILogger.js","node_modules/@microsoft/signalr/dist/esm/Loggers.js","node_modules/@microsoft/signalr/dist/esm/Utils.js","node_modules/@microsoft/signalr/dist/esm/NodeHttpClient.js","node_modules/@microsoft/signalr/dist/esm/XhrHttpClient.js","node_modules/@microsoft/signalr/dist/esm/DefaultHttpClient.js","node_modules/@microsoft/signalr/dist/esm/TextMessageFormat.js","node_modules/@microsoft/signalr/dist/esm/HandshakeProtocol.js","node_modules/@microsoft/signalr/dist/esm/IHubProtocol.js","node_modules/@microsoft/signalr/dist/esm/Subject.js","node_modules/@microsoft/signalr/dist/esm/HubConnection.js","node_modules/@microsoft/signalr/dist/esm/DefaultReconnectPolicy.js","node_modules/@microsoft/signalr/dist/esm/ITransport.js","node_modules/@microsoft/signalr/dist/esm/AbortController.js","node_modules/@microsoft/signalr/dist/esm/LongPollingTransport.js","node_modules/@microsoft/signalr/dist/esm/ServerSentEventsTransport.js","node_modules/@microsoft/signalr/dist/esm/WebSocketTransport.js","node_modules/@microsoft/signalr/dist/esm/HttpConnection.js","node_modules/@microsoft/signalr/dist/esm/JsonHubProtocol.js","node_modules/@microsoft/signalr/dist/esm/HubConnectionBuilder.js","src/app/services/messages.service.ts","src/app/services/data-file.service.ts","node_modules/@angular/material/fesm2022/checkbox.mjs","src/app/components/import-view/veris/veris.component.ts","src/app/components/import-view/veris/veris.component.html","src/app/components/import-view/yield/yield.component.ts","src/app/components/import-view/yield/yield.component.html","src/app/components/import-view/import-view.component.ts","src/app/components/import-view/import-view.component.html","src/app/components/import-view/import.service.ts","node_modules/@angular/material/fesm2022/menu.mjs","src/app/components/menu/menu.component.ts","src/app/components/menu/menu.component.html","src/app/components/client/client.component.ts","src/app/components/client/client.component.html","node_modules/@angular/cdk/fesm2022/clipboard.mjs","node_modules/@angular/material/fesm2022/bottom-sheet.mjs","node_modules/@angular/material/fesm2022/button-toggle.mjs","node_modules/@angular/material/fesm2022/card.mjs","node_modules/@angular/cdk/fesm2022/accordion.mjs","node_modules/@angular/material/fesm2022/expansion.mjs","node_modules/@angular/material/fesm2022/list.mjs","node_modules/@angular/material/fesm2022/radio.mjs","node_modules/@angular/material/fesm2022/sidenav.mjs","node_modules/@angular/material/fesm2022/slide-toggle.mjs","node_modules/@angular/material/fesm2022/slider.mjs","node_modules/@angular/material/fesm2022/sort.mjs","node_modules/@angular/material/fesm2022/table.mjs","node_modules/@angular/material/fesm2022/tabs.mjs","node_modules/@angular/cdk/fesm2022/tree.mjs","node_modules/@angular/material/fesm2022/tree.mjs","src/app/material.module.ts","src/app/components/dialog/dialog.module.ts","src/app/components/drag-container/drag-container.component.ts","src/app/components/drag-container/drag-container.component.html","src/app/components/field-tool/field-tool.component.ts","src/app/components/field-tool/field-tool.component.html","src/app/field-list-page/add-crop/add-crop.component.ts","src/app/field-list-page/add-crop/add-crop.component.html","src/app/components/svg.component.ts","src/app/components/map/feature-data/feature-data.service.ts","src/app/components/field-view/field-view.service.ts","src/app/models/filestatus.model.ts","src/app/components/import-view/import-progress/import-progress.component.ts","src/app/components/import-view/import-progress/import-progress.component.html","src/app/components/new-year/new-year.component.ts","src/app/components/new-year/new-year.component.html","src/app/components/login-prompt/login-prompt.component.ts","src/app/components/login-prompt/login-prompt.component.html","src/app/components/map/map.component.ts","src/app/components/map/map.component.html","src/app/components/map/tools/draw/draw.component.ts","src/app/components/map/tools/draw/draw.component.html","src/app/components/map/tools/map-tool.ts","src/app/components/map/overlay/TextOverlay.ts","src/app/components/map/overlay/FeatureTextOverlay.ts","src/app/pipes/pipe/area-unit.pipe.ts","src/app/components/map/tools/map-field-part/map-field-part.component.ts","src/app/components/map/tools/map-field-part/map-field-part.component.html","src/app/components/map/tools/connect/map-connect.component.ts","src/app/components/map/tools/connect/map-connect.component.html","src/app/components/map/tools/block/map-block.component.ts","src/app/components/map/tools/block/map-block.component.html","src/app/components/map/tools/connect-skifte/map-connect-field.component.ts","src/app/components/map/tools/connect-skifte/map-connect-field.component.html","src/app/components/map/tools/connect-norge/map-connect-norge.component.ts","src/app/components/map/tools/connect-norge/map-connect-norge.component.html","src/app/services/utility.service.ts","src/app/components/searchable-select/Injector.ts","src/app/components/searchable-select/searchable-select.service.ts","src/app/components/searchable-select/searchable-select-overlay.component.ts","src/app/components/searchable-select/searchable-select-overlay.component.html","src/app/components/searchable-select/searchable-select.component.ts","src/app/components/searchable-select/searchable-select.component.html","src/app/components/map/tools/map-split-area/map-split-area.component.ts","src/app/components/map/tools/map-split-area/map-split-area.component.html","src/app/components/map/tools/map-split/map-split.component.ts","src/app/components/map/tools/map-split/map-split.component.html","src/app/components/map/tools/merge/merge.component.ts","src/app/components/map/tools/merge/merge.component.html","src/app/components/map/tools/vandteg/vandteg.component.ts","src/app/components/map/tools/vandteg/vandteg.component.html","src/app/field-list-page/edit-field-map/edit-field-map.component.ts","src/app/field-list-page/edit-field-map/edit-field-map.component.html","src/app/components/map/map-menu/map-menu.component.ts","src/app/components/map/map-menu/map-menu.component.html","src/app/components/map/measure/measure.component.ts","src/app/components/map/measure/measure.component.html","src/app/components/map-view/map-view.component.ts","src/app/components/map-view/map-view.component.html","src/app/components/map/coordinate/coordinate.component.ts","src/app/components/map/coordinate/coordinate.component.html","src/app/components/map/components/map-background/map-background.component.ts","src/app/components/map/components/map-background/map-background.component.html","src/app/components/map/components/map-zoom/map-zoom.component.ts","src/app/components/map/components/map-zoom/map-zoom.component.html","src/app/components/map/components/map-search/map-search.component.ts","src/app/components/map/components/map-search/map-search.component.html","src/app/components/map/components/map-loader/map-loader.component.ts","src/app/components/map/components/map-loader/map-loader.component.html","src/app/components/map/map.module.ts","src/app/components/map/tools/draw-direct/draw-direct.component.ts","src/app/components/map/tools/draw-direct/draw-direct.component.html","src/app/models/file.model.ts","src/app/services/field-interpolation.service.ts","src/app/components/mapping-view/cropsat-legend/cropsat-legend.component.ts","src/app/components/mapping-view/cropsat-legend/cropsat-legend.component.html","src/app/components/mapping-view/cropsat-index/cropsat-index.component.ts","src/app/components/mapping-view/cropsat-index/cropsat-index.component.html","src/app/components/mapping-view/legend/legend.component.ts","src/app/components/mapping-view/legend/legend.component.html","src/app/components/mapping-view/mapping-wizard/wizard-table/dialog/dialog.component.ts","src/app/components/mapping-view/mapping-wizard/wizard-table/dialog/dialog.component.html","src/app/components/mapping-view/mapping-wizard/wizard-table/marking-detail-view/marking-detail-view.component.ts","src/app/components/mapping-view/mapping-wizard/wizard-table/marking-detail-view/marking-detail-view.component.html","src/app/components/mapping-view/mapping-wizard/wizard-table/table-expanded-row/table-expanded-row.component.ts","src/app/components/mapping-view/mapping-wizard/wizard-table/table-expanded-row/table-expanded-row.component.html","src/app/components/mapping-view/mapping-wizard/wizard-table/tables/table-utils.ts","src/app/components/poi/poi.types.ts","src/app/components/poi/poi.service.ts","src/app/components/mapping-view/mapping-wizard/wizard-table/tables/table-markings/table-markings.component.ts","src/app/components/mapping-view/mapping-wizard/wizard-table/tables/table-markings/table-markings.component.html","src/app/components/mapping-view/mapping-wizard/wizard-table/tables/table-skifte/table-skifte.component.ts","src/app/components/mapping-view/mapping-wizard/wizard-table/tables/table-skifte/table-skifte.component.html","src/app/field-page/field-page.component.ts","src/app/field-page/field-page.component.html","src/app/components/mapping-view/field/field.types.ts","src/app/components/mapping-view/field/interpolation-groups/interpolation-groups.component.ts","src/app/components/mapping-view/field/interpolation-groups/interpolation-groups.component.html","src/app/components/mapping-view/mapping-wizard/wizard-table/wizard-table.component.ts","src/app/components/mapping-view/mapping-wizard/wizard-table/wizard-table.component.html","src/app/components/poi/poi-add/poi-add.component.ts","src/app/components/poi/poi-add/poi-add.component.html","src/app/components/poi/poi-categorys/poi-categorys.component.ts","src/app/components/poi/poi-categorys/poi-categorys.component.html","src/app/components/poi/poi-detail/poi-detail.component.ts","src/app/components/poi/poi-detail/poi-detail.component.html","src/app/components/poi/poi-toolbar/poi-toolbar.component.ts","src/app/components/poi/poi-toolbar/poi-toolbar.component.html","src/app/components/poi/poi.component.ts","src/app/components/poi/poi.component.html","src/app/components/prescription-view/basis-legend/basis-legend.component.ts","src/app/components/prescription-view/basis-legend/basis-legend.component.html","src/app/components/prescription-view/prescription-export/prescription-export.types.ts","src/app/components/prescription-view/prescription-export/prescription-export.service.ts","src/app/components/prescription-view/prescription-export/machine-connection-dialog/machine-connection.service.ts","src/app/components/prescription-view/prescription-export/machine-connection-dialog/machine-connection.types.ts","src/app/util/error_utils.ts","src/app/components/prescription-view/prescription-export/machine-connection-dialog/components/machine-connection-actions/machine-connection-actions.component.ts","src/app/components/prescription-view/prescription-export/machine-connection-dialog/components/machine-connection-actions/machine-connection-actions.component.html","src/app/components/prescription-view/prescription-export/machine-connection-dialog/components/machine-connection-header/machine-connection-header.component.ts","src/app/components/prescription-view/prescription-export/machine-connection-dialog/components/machine-connection-header/machine-connection-header.component.html","src/app/components/prescription-view/prescription-export/machine-connection-dialog/machine-connection-dialog.component.ts","src/app/components/prescription-view/prescription-export/machine-connection-dialog/machine-connection-dialog.component.html","src/app/components/prescription-view/prescription-export/connected-farm-redirect/connected-farm-redirect.component.ts","src/app/components/prescription-view/prescription-export/connected-farm-redirect/connected-farm-redirect.component.html","src/app/components/prescription-view/prescription-export/prescription-file.service.ts","src/app/components/prescription-view/prescription-export/prescription-button/prescription-button.component.ts","src/app/components/prescription-view/prescription-export/prescription-button/prescription-button.component.html","src/app/components/prescription-view/prescription-export/prescription-export.component.ts","src/app/components/prescription-view/prescription-export/prescription-export.component.html","src/app/models/prescriptiongrid.model.ts","src/app/services/prescription.service.ts","src/app/components/prescription-view/prescription-buckets/prescription-buckets.component.ts","src/app/components/prescription-view/prescription-buckets/prescription-buckets.component.html","src/app/components/prescription-view/prescription-legend/prescription-legend.component.ts","src/app/components/prescription-view/prescription-legend/prescription-legend.component.html","src/app/components/prescription-view/prescription-view.component.ts","src/app/components/prescription-view/prescription-view.component.html","src/app/field-list-page/edit-farms/edit-farms.component.ts","src/app/field-list-page/edit-farms/edit-farms.component.html","src/app/field-list-page/field-list-page.component.ts","src/app/field-list-page/field-list-page.component.html","src/app/components/data/data-table.types.ts","src/app/components/data/expandable-row.animation.ts","src/app/share-page/share/share.component.ts","src/app/share-page/share/share.component.html","src/app/services/share.service.ts","src/app/components/data/fileset/fileset-list/fileset-list-share-dialog/fileset-list-share-dialog.component.ts","src/app/components/data/fileset/fileset-list/fileset-list-share-dialog/fileset-list-share-dialog.component.html","src/app/components/data/file-status/file-status.component.ts","src/app/components/data/file-status/file-status.component.html","src/app/components/data/sort-arrows/sort-arrows.component.ts","src/app/components/data/sort-arrows/sort-arrows.component.html","src/app/components/data/fileset/fileset-list/fileset-list.component.ts","src/app/components/data/fileset/fileset-list/fileset-list.component.html","src/app/components/data/geodata/geodata-list/geodata-list-share-dialog/geodata-list-share-dialog.component.ts","src/app/components/data/geodata/geodata-list/geodata-list-share-dialog/geodata-list-share-dialog.component.html","src/app/components/data/geodata/geodata-list/geodata-list-detail/geodata-list-detail.component.ts","src/app/components/data/geodata/geodata-list/geodata-list-detail/geodata-list-detail.component.html","src/app/components/data/geodata/geodata-list/geodata-list.component.ts","src/app/components/data/geodata/geodata-list/geodata-list.component.html","src/app/components/data/filter-grow.animation.ts","src/app/data-page/empty-search-result/empty-search-result.component.ts","src/app/data-page/empty-search-result/empty-search-result.component.html","src/app/components/data/fileset/fileset-list-detail/fileset-list-detail.types.ts","src/app/components/file-status-log/file-status-log.component.ts","src/app/components/file-status-log/file-status-log.component.html","src/app/data-page/filter-section/filter-section.component.ts","src/app/data-page/filter-section/filter-section.component.html","src/app/components/data/fileset/fileset-list-detail/fileset-list-detail.component.ts","src/app/components/data/fileset/fileset-list-detail/fileset-list-detail.component.html","src/app/data-page/no-data/no-data.component.ts","src/app/data-page/no-data/no-data.component.html","src/app/data-page/data-page.component.ts","src/app/data-page/data-page.component.html","src/app/login-page/login-page.component.ts","src/app/login-page/login-page.component.html","src/app/components/map/map-page.base.ts","node_modules/@google/markerclusterer/dist/markerclusterer.esm.js","src/app/services/map-util.service.ts","src/app/components/mapping-view/clay-content/clay-content.component.ts","src/app/components/mapping-view/clay-content/clay-content.component.html","src/app/models/analyze-field.model.ts","src/app/services/analyze.service.ts","src/app/components/mapping-view/field/interpolation-basis/interpolation-basis-preview/interpolation-basis-preview.component.ts","src/app/components/mapping-view/field/interpolation-basis/interpolation-basis-preview/interpolation-basis-preview.component.html","src/app/components/mapping-view/field/interpolation-basis/interpolation-basis.component.ts","src/app/components/mapping-view/field/interpolation-basis/interpolation-basis.component.html","src/app/components/yield-disclaimer/yield-disclaimer.component.ts","src/app/components/yield-disclaimer/yield-disclaimer.component.html","src/app/components/mapping-view/field/interpolation-settings/interpolation-settings.component.ts","src/app/components/mapping-view/field/interpolation-settings/interpolation-settings.component.html","src/app/components/mapping-view/field/interpolation/field-interpolation.component.ts","src/app/components/mapping-view/field/interpolation/field-interpolation.component.html","src/app/components/mapping-view/field/base-fields.component.ts","src/app/components/mapping-view/field/base-fields.component.html","src/app/map-page/map-page.component.ts","src/app/map-page/map-page.component.html","src/app/map-split-page/map-split-field-pick/map-split-field-pick-page.component.ts","src/app/map-split-page/map-split-field-pick/map-split-field-pick-page.component.html","src/app/map-split-page/map-split-mode/map-split-mode.component.ts","src/app/map-split-page/map-split-mode/map-split-mode.component.html","src/app/map-split-page/map-split-marker-mode/map-split-marker-mode.component.ts","src/app/map-split-page/map-split-marker-mode/map-split-marker-mode.component.html","src/app/map-split-page/map-split-prop-picker/map-split-prop-picker.types.ts","src/app/map-split-page/map-split-prop-picker/map-split-prop-picker.component.ts","src/app/map-split-page/map-split-prop-picker/map-split-prop-picker.component.html","src/app/map-split-page/map-split-page.component.ts","src/app/map-split-page/map-split-page.component.html","src/app/mat-paginator-Intl.ts","src/app/pipes/pipe/per-area-unit.pipe.ts","src/app/pipes/number-decimal/number-decimal.pipe.ts","src/app/pipes/pipe/pipe.module.ts","src/app/prescription-page/prescription-page.component.ts","src/app/prescription-page/prescription-page.component.html","src/app/share-page/share-page.component.ts","src/app/share-page/share-page.component.html","src/app/components/data/geodata/geodata-file-preview/geodata-file-preview.component.ts","src/app/components/data/geodata/geodata-file-preview/geodata-file-preview.component.html","src/app/components/data/geodata/geodata-file-details/geodata-file-details.component.ts","src/app/components/data/geodata/geodata-file-details/geodata-file-details.component.html","src/app/components/data/geodata/geodata-interpolation/geodata-interpolation-types.ts","src/app/components/data/geodata/geodata-interpolation/geodata-interpolation.component.ts","src/app/components/data/geodata/geodata-interpolation/geodata-interpolation.component.html","src/app/data-page/geodata-detail/geodata-detail.component.ts","src/app/data-page/geodata-detail/geodata-detail.component.html","src/app/views/prescription-wizard-page/prescription-wizard.types.ts","src/app/views/prescription-wizard-page/components/step-settings/step-settings.types.ts","src/app/views/prescription-wizard-page/components/step-adjust/step-adjust.types.ts","src/app/views/prescription-wizard-page/prescription-wizard.service.ts","src/app/views/prescription-wizard-page/services/perscription-wizard-interpolation.service.ts","src/app/views/prescription-wizard-page/components/step-adjust/components/adjustments-legend/adjustments-legend.types.ts","src/app/views/prescription-wizard-page/components/step-adjust/components/adjustments-legend/adjustments-legend.component.ts","src/app/views/prescription-wizard-page/components/step-adjust/components/adjustments-legend/adjustments-legend.component.html","src/app/views/prescription-wizard-page/components/settings-map-bar/settings-map-bar.component.ts","src/app/views/prescription-wizard-page/components/settings-map-bar/settings-map-bar.component.html","src/app/views/prescription-wizard-page/components/step-adjust/components/adjustments-dialog/adjustments-dialog.component.ts","src/app/views/prescription-wizard-page/components/step-adjust/components/adjustments-dialog/adjustments-dialog.component.html","src/app/views/prescription-wizard-page/components/step-adjust/components/manual-draw-pane/manual-draw.service.ts","src/app/views/prescription-wizard-page/components/sliding-pane/sliding-pane.component.ts","src/app/views/prescription-wizard-page/components/sliding-pane/sliding-pane.component.html","src/app/views/prescription-wizard-page/components/step-adjust/components/grid-cell-detail-pane/grid-cell-detail-pane.component.ts","src/app/views/prescription-wizard-page/components/step-adjust/components/grid-cell-detail-pane/grid-cell-detail-pane.component.html","src/app/views/prescription-wizard-page/components/step-adjust/components/grid-select-info-card/grid-select-info-card.component.ts","src/app/views/prescription-wizard-page/components/step-adjust/components/grid-select-info-card/grid-select-info-card.component.html","src/app/views/prescription-wizard-page/components/step-adjust/components/manual-draw-pane/components/adjustments-manual-draw/adjustments-manual-draw.component.ts","src/app/views/prescription-wizard-page/components/step-adjust/components/manual-draw-pane/components/adjustments-manual-draw/adjustments-manual-draw.component.html","src/app/views/prescription-wizard-page/components/step-adjust/components/manual-draw-pane/manual-draw-pane.component.ts","src/app/views/prescription-wizard-page/components/step-adjust/components/manual-draw-pane/manual-draw-pane.component.html","src/app/views/prescription-wizard-page/components/step-adjust/components/prescription-saved-notice/prescription-saved-notice.component.ts","src/app/views/prescription-wizard-page/components/step-adjust/components/prescription-saved-notice/prescription-saved-notice.component.html","src/app/views/prescription-wizard-page/components/step-adjust/components/step-adjust-no-data/step-adjust-no-data.component.ts","src/app/views/prescription-wizard-page/components/step-adjust/components/step-adjust-no-data/step-adjust-no-data.component.html","src/app/views/prescription-wizard-page/components/step-adjust/step-adjust.component.ts","src/app/views/prescription-wizard-page/components/step-adjust/step-adjust.component.html","src/app/views/prescription-wizard-page/components/step-field/step-field.component.ts","src/app/views/prescription-wizard-page/components/step-field/step-field.component.html","src/app/views/prescription-wizard-page/components/step-function/components/selectable-card/selectable-card.component.ts","src/app/views/prescription-wizard-page/components/step-function/components/selectable-card/selectable-card.component.html","src/app/views/prescription-wizard-page/components/step-function/step-function.component.ts","src/app/views/prescription-wizard-page/components/step-function/step-function.component.html","src/app/views/prescription-wizard-page/components/stepper-header/stepper-header.component.ts","src/app/views/prescription-wizard-page/components/stepper-header/stepper-header.component.html","src/app/views/prescription-wizard-page/components/step-settings/step-settings.service.ts","src/app/views/prescription-wizard-page/components/step-settings/components/file-section/components/base-geo-data-content/base-geo-data-content.ts","src/app/views/prescription-wizard-page/components/step-settings/components/file-section/components/geo-data-header/geo-data-header.component.ts","src/app/views/prescription-wizard-page/components/step-settings/components/file-section/components/geo-data-header/geo-data-header.component.html","src/app/views/prescription-wizard-page/components/step-settings/components/file-section/components/file-preview-list/file-preview-list.component.ts","src/app/views/prescription-wizard-page/components/step-settings/components/file-section/components/file-preview-list/file-preview-list.component.html","src/app/views/prescription-wizard-page/components/step-settings/components/file-section/components/geo-data-content/geo-data-content.component.ts","src/app/views/prescription-wizard-page/components/step-settings/components/file-section/components/geo-data-content/geo-data-content.component.html","src/app/views/prescription-wizard-page/components/step-settings/components/file-section/components/nested-geo-data-content/components/nested-preview-list/components/nested-item/nested-item.component.ts","src/app/views/prescription-wizard-page/components/step-settings/components/file-section/components/nested-geo-data-content/components/nested-preview-list/components/nested-item/nested-item.component.html","src/app/views/prescription-wizard-page/components/step-settings/components/file-section/components/nested-geo-data-content/components/nested-preview-list/components/nested-list-item/nested-list-item.component.ts","src/app/views/prescription-wizard-page/components/step-settings/components/file-section/components/nested-geo-data-content/components/nested-preview-list/components/nested-list-item/nested-list-item.component.html","src/app/views/prescription-wizard-page/components/step-settings/components/file-section/components/nested-geo-data-content/components/nested-preview-list/nested-preview-list.component.ts","src/app/views/prescription-wizard-page/components/step-settings/components/file-section/components/nested-geo-data-content/components/nested-preview-list/nested-preview-list.component.html","src/app/views/prescription-wizard-page/components/step-settings/components/file-section/components/nested-geo-data-content/nested-geo-data-content.component.ts","src/app/views/prescription-wizard-page/components/step-settings/components/file-section/components/nested-geo-data-content/nested-geo-data-content.component.html","src/app/views/prescription-wizard-page/components/step-settings/components/file-section/file-section.component.ts","src/app/views/prescription-wizard-page/components/step-settings/components/file-section/file-section.component.html","src/app/views/prescription-wizard-page/components/step-settings/components/input-section/components/ph-input/ph-input.component.ts","src/app/views/prescription-wizard-page/components/step-settings/components/input-section/components/ph-input/ph-input.component.html","src/app/views/prescription-wizard-page/components/step-settings/components/input-section/input-section.component.ts","src/app/views/prescription-wizard-page/components/step-settings/components/input-section/input-section.component.html","src/app/views/prescription-wizard-page/components/step-settings/components/settings-pane/settings-pane.component.ts","src/app/views/prescription-wizard-page/components/step-settings/components/settings-pane/settings-pane.component.html","src/app/views/prescription-wizard-page/components/step-settings/step-settings.component.ts","src/app/views/prescription-wizard-page/components/step-settings/step-settings.component.html","src/app/views/prescription-wizard-page/prescription-wizard-page.component.ts","src/app/views/prescription-wizard-page/prescription-wizard-page.component.html","src/app/guards/auth/auth.guard.ts","src/app/views/redirect/redirectfrommarkkartering.component.ts","src/app/app.routes.ts","src/app/app.module.ts","src/main.ts"],"sourcesContent":["!function (t, e) {\n \"object\" == typeof exports && \"undefined\" != typeof module ? e(exports) : \"function\" == typeof define && define.amd ? define([\"exports\"], e) : e(t.turf = {});\n}(this, function (t) {\n \"use strict\";\n\n function e(t, e, n) {\n if (n = n || {}, !I(n)) throw new Error(\"options is invalid\");\n var r = n.bbox,\n i = n.id;\n if (void 0 === t) throw new Error(\"geometry is required\");\n if (e && e.constructor !== Object) throw new Error(\"properties must be an Object\");\n r && N(r), i && C(i);\n var o = {\n type: \"Feature\"\n };\n return i && (o.id = i), r && (o.bbox = r), o.properties = e || {}, o.geometry = t, o;\n }\n function n(t, e, n) {\n if (n = n || {}, !I(n)) throw new Error(\"options is invalid\");\n var i = n.bbox;\n if (!t) throw new Error(\"type is required\");\n if (!e) throw new Error(\"coordinates is required\");\n if (!Array.isArray(e)) throw new Error(\"coordinates must be an Array\");\n i && N(i);\n var s;\n switch (t) {\n case \"Point\":\n s = r(e).geometry;\n break;\n case \"LineString\":\n s = a(e).geometry;\n break;\n case \"Polygon\":\n s = o(e).geometry;\n break;\n case \"MultiPoint\":\n s = l(e).geometry;\n break;\n case \"MultiLineString\":\n s = h(e).geometry;\n break;\n case \"MultiPolygon\":\n s = p(e).geometry;\n break;\n default:\n throw new Error(t + \" is invalid\");\n }\n return i && (s.bbox = i), s;\n }\n function r(t, n, r) {\n if (!t) throw new Error(\"coordinates is required\");\n if (!Array.isArray(t)) throw new Error(\"coordinates must be an Array\");\n if (t.length < 2) throw new Error(\"coordinates must be at least 2 numbers long\");\n if (!b(t[0]) || !b(t[1])) throw new Error(\"coordinates must contain numbers\");\n return e({\n type: \"Point\",\n coordinates: t\n }, n, r);\n }\n function i(t, e, n) {\n if (!t) throw new Error(\"coordinates is required\");\n if (!Array.isArray(t)) throw new Error(\"coordinates must be an Array\");\n return c(t.map(function (t) {\n return r(t, e);\n }), n);\n }\n function o(t, n, r) {\n if (!t) throw new Error(\"coordinates is required\");\n for (var i = 0; i < t.length; i++) {\n var o = t[i];\n if (o.length < 4) throw new Error(\"Each LinearRing of a Polygon must have 4 or more Positions.\");\n for (var s = 0; s < o[o.length - 1].length; s++) {\n if (0 === i && 0 === s && !b(o[0][0]) || !b(o[0][1])) throw new Error(\"coordinates must contain numbers\");\n if (o[o.length - 1][s] !== o[0][s]) throw new Error(\"First and last Position are not equivalent.\");\n }\n }\n return e({\n type: \"Polygon\",\n coordinates: t\n }, n, r);\n }\n function s(t, e, n) {\n if (!t) throw new Error(\"coordinates is required\");\n if (!Array.isArray(t)) throw new Error(\"coordinates must be an Array\");\n return c(t.map(function (t) {\n return o(t, e);\n }), n);\n }\n function a(t, n, r) {\n if (!t) throw new Error(\"coordinates is required\");\n if (t.length < 2) throw new Error(\"coordinates must be an array of two or more positions\");\n if (!b(t[0][1]) || !b(t[0][1])) throw new Error(\"coordinates must contain numbers\");\n return e({\n type: \"LineString\",\n coordinates: t\n }, n, r);\n }\n function u(t, e, n) {\n if (!t) throw new Error(\"coordinates is required\");\n if (!Array.isArray(t)) throw new Error(\"coordinates must be an Array\");\n return c(t.map(function (t) {\n return a(t, e);\n }), n);\n }\n function c(t, e) {\n if (e = e || {}, !I(e)) throw new Error(\"options is invalid\");\n var n = e.bbox,\n r = e.id;\n if (!t) throw new Error(\"No features passed\");\n if (!Array.isArray(t)) throw new Error(\"features must be an Array\");\n n && N(n), r && C(r);\n var i = {\n type: \"FeatureCollection\"\n };\n return r && (i.id = r), n && (i.bbox = n), i.features = t, i;\n }\n function h(t, n, r) {\n if (!t) throw new Error(\"coordinates is required\");\n return e({\n type: \"MultiLineString\",\n coordinates: t\n }, n, r);\n }\n function l(t, n, r) {\n if (!t) throw new Error(\"coordinates is required\");\n return e({\n type: \"MultiPoint\",\n coordinates: t\n }, n, r);\n }\n function p(t, n, r) {\n if (!t) throw new Error(\"coordinates is required\");\n return e({\n type: \"MultiPolygon\",\n coordinates: t\n }, n, r);\n }\n function f(t, n, r) {\n if (!t) throw new Error(\"geometries is required\");\n if (!Array.isArray(t)) throw new Error(\"geometries must be an Array\");\n return e({\n type: \"GeometryCollection\",\n geometries: t\n }, n, r);\n }\n function g(t, e) {\n if (void 0 === t || null === t || isNaN(t)) throw new Error(\"num is required\");\n if (e && !(e >= 0)) throw new Error(\"precision must be a positive number\");\n var n = Math.pow(10, e || 0);\n return Math.round(t * n) / n;\n }\n function d(t, e) {\n if (void 0 === t || null === t) throw new Error(\"radians is required\");\n if (e && \"string\" != typeof e) throw new Error(\"units must be a string\");\n var n = qo[e || \"kilometers\"];\n if (!n) throw new Error(e + \" units is invalid\");\n return t * n;\n }\n function y(t, e) {\n if (void 0 === t || null === t) throw new Error(\"distance is required\");\n if (e && \"string\" != typeof e) throw new Error(\"units must be a string\");\n var n = qo[e || \"kilometers\"];\n if (!n) throw new Error(e + \" units is invalid\");\n return t / n;\n }\n function _(t, e) {\n return v(y(t, e));\n }\n function m(t) {\n if (null === t || void 0 === t) throw new Error(\"bearing is required\");\n var e = t % 360;\n return e < 0 && (e += 360), e;\n }\n function v(t) {\n if (null === t || void 0 === t) throw new Error(\"radians is required\");\n return 180 * (t % (2 * Math.PI)) / Math.PI;\n }\n function x(t) {\n if (null === t || void 0 === t) throw new Error(\"degrees is required\");\n return t % 360 * Math.PI / 180;\n }\n function E(t, e, n) {\n if (null === t || void 0 === t) throw new Error(\"length is required\");\n if (!(t >= 0)) throw new Error(\"length must be a positive number\");\n return d(y(t, e), n || \"kilometers\");\n }\n function w(t, e, n) {\n if (null === t || void 0 === t) throw new Error(\"area is required\");\n if (!(t >= 0)) throw new Error(\"area must be a positive number\");\n var r = Bo[e || \"meters\"];\n if (!r) throw new Error(\"invalid original units\");\n var i = Bo[n || \"kilometers\"];\n if (!i) throw new Error(\"invalid final units\");\n return t / r * i;\n }\n function b(t) {\n return !isNaN(t) && null !== t && !Array.isArray(t);\n }\n function I(t) {\n return !!t && t.constructor === Object;\n }\n function N(t) {\n if (!t) throw new Error(\"bbox is required\");\n if (!Array.isArray(t)) throw new Error(\"bbox must be an Array\");\n if (4 !== t.length && 6 !== t.length) throw new Error(\"bbox must be an Array of 4 or 6 numbers\");\n t.forEach(function (t) {\n if (!b(t)) throw new Error(\"bbox must only contain numbers\");\n });\n }\n function C(t) {\n if (!t) throw new Error(\"id is required\");\n if (-1 === [\"string\", \"number\"].indexOf(typeof t)) throw new Error(\"id must be a number or a string\");\n }\n function S(t, e, n) {\n if (null !== t) for (var r, i, o, s, a, u, c, h, l = 0, p = 0, f = t.type, g = \"FeatureCollection\" === f, d = \"Feature\" === f, y = g ? t.features.length : 1, _ = 0; _ < y; _++) {\n a = (h = !!(c = g ? t.features[_].geometry : d ? t.geometry : t) && \"GeometryCollection\" === c.type) ? c.geometries.length : 1;\n for (var m = 0; m < a; m++) {\n var v = 0,\n x = 0;\n if (null !== (s = h ? c.geometries[m] : c)) {\n u = s.coordinates;\n var E = s.type;\n switch (l = !n || \"Polygon\" !== E && \"MultiPolygon\" !== E ? 0 : 1, E) {\n case null:\n break;\n case \"Point\":\n e(u, p, _, v, x), p++, v++;\n break;\n case \"LineString\":\n case \"MultiPoint\":\n for (r = 0; r < u.length; r++) e(u[r], p, _, v, x), p++, \"MultiPoint\" === E && v++;\n \"LineString\" === E && v++;\n break;\n case \"Polygon\":\n case \"MultiLineString\":\n for (r = 0; r < u.length; r++) {\n for (i = 0; i < u[r].length - l; i++) e(u[r][i], p, _, v, x), p++;\n \"MultiLineString\" === E && v++, \"Polygon\" === E && x++;\n }\n \"Polygon\" === E && v++;\n break;\n case \"MultiPolygon\":\n for (r = 0; r < u.length; r++) {\n for (\"MultiPolygon\" === E && (x = 0), i = 0; i < u[r].length; i++) {\n for (o = 0; o < u[r][i].length - l; o++) e(u[r][i][o], p, _, v, x), p++;\n x++;\n }\n v++;\n }\n break;\n case \"GeometryCollection\":\n for (r = 0; r < s.geometries.length; r++) S(s.geometries[r], e, n);\n break;\n default:\n throw new Error(\"Unknown Geometry Type\");\n }\n }\n }\n }\n }\n function M(t, e, n, r) {\n var i = n;\n return S(t, function (t, r, o, s, a) {\n i = 0 === r && void 0 === n ? t : e(i, t, r, o, s, a);\n }, r), i;\n }\n function L(t, e) {\n var n;\n switch (t.type) {\n case \"FeatureCollection\":\n for (n = 0; n < t.features.length; n++) e(t.features[n].properties, n);\n break;\n case \"Feature\":\n e(t.properties, 0);\n }\n }\n function P(t, e, n) {\n var r = n;\n return L(t, function (t, i) {\n r = 0 === i && void 0 === n ? t : e(r, t, i);\n }), r;\n }\n function O(t, e) {\n if (\"Feature\" === t.type) e(t, 0);else if (\"FeatureCollection\" === t.type) for (var n = 0; n < t.features.length; n++) e(t.features[n], n);\n }\n function R(t, e, n) {\n var r = n;\n return O(t, function (t, i) {\n r = 0 === i && void 0 === n ? t : e(r, t, i);\n }), r;\n }\n function T(t) {\n var e = [];\n return S(t, function (t) {\n e.push(t);\n }), e;\n }\n function A(t, e) {\n var n,\n r,\n i,\n o,\n s,\n a,\n u,\n c,\n h,\n l,\n p = 0,\n f = \"FeatureCollection\" === t.type,\n g = \"Feature\" === t.type,\n d = f ? t.features.length : 1;\n for (n = 0; n < d; n++) {\n for (a = f ? t.features[n].geometry : g ? t.geometry : t, c = f ? t.features[n].properties : g ? t.properties : {}, h = f ? t.features[n].bbox : g ? t.bbox : void 0, l = f ? t.features[n].id : g ? t.id : void 0, s = (u = !!a && \"GeometryCollection\" === a.type) ? a.geometries.length : 1, i = 0; i < s; i++) if (null !== (o = u ? a.geometries[i] : a)) switch (o.type) {\n case \"Point\":\n case \"LineString\":\n case \"MultiPoint\":\n case \"Polygon\":\n case \"MultiLineString\":\n case \"MultiPolygon\":\n e(o, p, c, h, l);\n break;\n case \"GeometryCollection\":\n for (r = 0; r < o.geometries.length; r++) e(o.geometries[r], p, c, h, l);\n break;\n default:\n throw new Error(\"Unknown Geometry Type\");\n } else e(null, p, c, h, l);\n p++;\n }\n }\n function D(t, e, n) {\n var r = n;\n return A(t, function (t, i, o, s, a) {\n r = 0 === i && void 0 === n ? t : e(r, t, i, o, s, a);\n }), r;\n }\n function F(t, n) {\n A(t, function (t, r, i, o, s) {\n var a = null === t ? null : t.type;\n switch (a) {\n case null:\n case \"Point\":\n case \"LineString\":\n case \"Polygon\":\n return void n(e(t, i, {\n bbox: o,\n id: s\n }), r, 0);\n }\n var u;\n switch (a) {\n case \"MultiPoint\":\n u = \"Point\";\n break;\n case \"MultiLineString\":\n u = \"LineString\";\n break;\n case \"MultiPolygon\":\n u = \"Polygon\";\n }\n t.coordinates.forEach(function (t, o) {\n n(e({\n type: u,\n coordinates: t\n }, i), r, o);\n });\n });\n }\n function q(t, e, n) {\n var r = n;\n return F(t, function (t, i, o) {\n r = 0 === i && 0 === o && void 0 === n ? t : e(r, t, i, o);\n }), r;\n }\n function G(t, e) {\n F(t, function (t, n, r) {\n var i = 0;\n if (t.geometry) {\n var o = t.geometry.type;\n \"Point\" !== o && \"MultiPoint\" !== o && M(t, function (o, s, u, c, h, l) {\n var p = a([o, s], t.properties);\n return e(p, n, r, l, i), i++, s;\n });\n }\n });\n }\n function B(t, e, n) {\n var r = n,\n i = !1;\n return G(t, function (t, o, s, a, u) {\n r = !1 === i && void 0 === n ? t : e(r, t, o, s, a, u), i = !0;\n }), r;\n }\n function k(t, e) {\n if (!t) throw new Error(\"geojson is required\");\n F(t, function (t, n, r) {\n if (null !== t.geometry) {\n var i = t.geometry.type,\n o = t.geometry.coordinates;\n switch (i) {\n case \"LineString\":\n e(t, n, r, 0, 0);\n break;\n case \"Polygon\":\n for (var s = 0; s < o.length; s++) e(a(o[s], t.properties), n, r, s);\n }\n }\n });\n }\n function z(t, e, n) {\n var r = n;\n return k(t, function (t, i, o, s) {\n r = 0 === i && void 0 === n ? t : e(r, t, i, o, s);\n }), r;\n }\n function j(t) {\n var e = [1 / 0, 1 / 0, -1 / 0, -1 / 0];\n return S(t, function (t) {\n e[0] > t[0] && (e[0] = t[0]), e[1] > t[1] && (e[1] = t[1]), e[2] < t[0] && (e[2] = t[0]), e[3] < t[1] && (e[3] = t[1]);\n }), e;\n }\n function X(t) {\n if (!t) throw new Error(\"obj is required\");\n var e = U(t);\n if (e.length > 1 && b(e[0]) && b(e[1])) return e;\n throw new Error(\"Coordinate is not a valid Point\");\n }\n function U(t) {\n if (!t) throw new Error(\"obj is required\");\n var e;\n if (t.length ? e = t : t.coordinates ? e = t.coordinates : t.geometry && t.geometry.coordinates && (e = t.geometry.coordinates), e) return Y(e), e;\n throw new Error(\"No valid coordinates\");\n }\n function Y(t) {\n if (t.length > 1 && b(t[0]) && b(t[1])) return !0;\n if (Array.isArray(t[0]) && t[0].length) return Y(t[0]);\n throw new Error(\"coordinates must only contain numbers\");\n }\n function V(t, e, n) {\n if (!e || !n) throw new Error(\"type and name required\");\n if (!t || t.type !== e) throw new Error(\"Invalid input to \" + n + \": must be a \" + e + \", given \" + t.type);\n }\n function H(t, e, n) {\n if (!t) throw new Error(\"No feature passed\");\n if (!n) throw new Error(\".featureOf() requires a name\");\n if (!t || \"Feature\" !== t.type || !t.geometry) throw new Error(\"Invalid input to \" + n + \", Feature with geometry required\");\n if (!t.geometry || t.geometry.type !== e) throw new Error(\"Invalid input to \" + n + \": must be a \" + e + \", given \" + t.geometry.type);\n }\n function W(t, e, n) {\n if (!t) throw new Error(\"No featureCollection passed\");\n if (!n) throw new Error(\".collectionOf() requires a name\");\n if (!t || \"FeatureCollection\" !== t.type) throw new Error(\"Invalid input to \" + n + \", FeatureCollection required\");\n for (var r = 0; r < t.features.length; r++) {\n var i = t.features[r];\n if (!i || \"Feature\" !== i.type || !i.geometry) throw new Error(\"Invalid input to \" + n + \", Feature with geometry required\");\n if (!i.geometry || i.geometry.type !== e) throw new Error(\"Invalid input to \" + n + \": must be a \" + e + \", given \" + i.geometry.type);\n }\n }\n function J(t) {\n if (!t) throw new Error(\"geojson is required\");\n if (void 0 !== t.geometry) return t.geometry;\n if (t.coordinates || t.geometries) return t;\n throw new Error(\"geojson must be a valid Feature or Geometry Object\");\n }\n function Z() {\n throw new Error(\"invariant.getGeomType has been deprecated in v5.0 in favor of invariant.getType\");\n }\n function K(t, e) {\n if (!t) throw new Error((e || \"geojson\") + \" is required\");\n if (t.geometry && t.geometry.type) return t.geometry.type;\n if (t.type) return t.type;\n throw new Error((e || \"geojson\") + \" is invalid\");\n }\n function Q(t, e, n) {\n n = n || {};\n for (var r = Object.keys(Xo), i = 0; i < r.length; i++) {\n var o = r[i],\n s = n[o];\n s = void 0 !== s && null !== s ? s : Xo[o], Uo[o] = s;\n }\n Uo.verbose && console.log(\"MarchingSquaresJS-isoContours: computing isocontour for \" + e);\n var a = function (t) {\n var e = [],\n n = 0;\n t.rows, t.cols;\n return t.cells.forEach(function (r, i) {\n r.forEach(function (r, o) {\n if (void 0 !== r && !function (t) {\n return 5 === t.cval || 10 === t.cval;\n }(r) && !tt(r)) {\n var s = function (t, e, n) {\n var r,\n i,\n o,\n s = t.length,\n a = [],\n u = [0, 0, 1, 1, 0, 0, 0, 0, -1, 0, 1, 1, -1, 0, -1, 0],\n c = [0, -1, 0, 0, 1, 1, 1, 1, 0, -1, 0, 0, 0, -1, 0, 0],\n h = [\"none\", \"bottom\", \"right\", \"right\", \"top\", \"top\", \"top\", \"top\", \"left\", \"bottom\", \"right\", \"right\", \"left\", \"bottom\", \"left\", \"none\"],\n l = (t[e][n], t[e][n]),\n p = l.cval,\n f = nt(l, o = [\"none\", \"left\", \"bottom\", \"left\", \"right\", \"none\", \"bottom\", \"left\", \"top\", \"top\", \"none\", \"top\", \"right\", \"right\", \"bottom\", \"none\"][p]);\n a.push([n + f[0], e + f[1]]), f = nt(l, o = h[p]), a.push([n + f[0], e + f[1]]), et(l);\n for (var g = n + u[p], d = e + c[p], y = p; g >= 0 && d >= 0 && d < s && (g != n || d != e) && void 0 !== (l = t[d][g]);) {\n if (0 === (p = l.cval) || 15 === p) return {\n path: a,\n info: \"mergeable\"\n };\n o = h[p], r = u[p], i = c[p], 5 !== p && 10 !== p || (5 === p ? l.flipped ? -1 === c[y] ? (o = \"left\", r = -1, i = 0) : (o = \"right\", r = 1, i = 0) : -1 === u[y] && (o = \"bottom\", r = 0, i = -1) : 10 === p && (l.flipped ? -1 === u[y] ? (o = \"top\", r = 0, i = 1) : (o = \"bottom\", r = 0, i = -1) : 1 === c[y] && (o = \"left\", r = -1, i = 0))), f = nt(l, o), a.push([g + f[0], d + f[1]]), et(l), g += r, d += i, y = p;\n }\n return {\n path: a,\n info: \"closed\"\n };\n }(t.cells, i, o),\n a = !1;\n if (\"mergeable\" === s.info) for (var u = s.path[s.path.length - 1][0], c = s.path[s.path.length - 1][1], h = n - 1; h >= 0; h--) if (Math.abs(e[h][0][0] - u) <= 1e-7 && Math.abs(e[h][0][1] - c) <= 1e-7) {\n for (var l = s.path.length - 2; l >= 0; --l) e[h].unshift(s.path[l]);\n a = !0;\n break;\n }\n a || (e[n++] = s.path);\n }\n });\n }), e;\n }(function (t, e) {\n for (var n = t.length - 1, r = t[0].length - 1, i = {\n rows: n,\n cols: r,\n cells: []\n }, o = 0; o < n; ++o) {\n i.cells[o] = [];\n for (var s = 0; s < r; ++s) {\n var a = 0,\n u = t[o + 1][s],\n c = t[o + 1][s + 1],\n h = t[o][s + 1],\n l = t[o][s];\n if (!(isNaN(u) || isNaN(c) || isNaN(h) || isNaN(l))) {\n a |= u >= e ? 8 : 0, a |= c >= e ? 4 : 0, a |= h >= e ? 2 : 0;\n var p = !1;\n if (5 === (a |= l >= e ? 1 : 0) || 10 === a) {\n var f = (u + c + h + l) / 4;\n 5 === a && f < e ? (a = 10, p = !0) : 10 === a && f < e && (a = 5, p = !0);\n }\n if (0 !== a && 15 !== a) {\n var g, d, y, _;\n g = d = y = _ = .5, 1 === a ? (y = 1 - $(e, u, l), d = 1 - $(e, h, l)) : 2 === a ? (d = $(e, l, h), _ = 1 - $(e, c, h)) : 3 === a ? (y = 1 - $(e, u, l), _ = 1 - $(e, c, h)) : 4 === a ? (g = $(e, u, c), _ = $(e, h, c)) : 5 === a ? (g = $(e, u, c), _ = $(e, h, c), d = 1 - $(e, h, l), y = 1 - $(e, u, l)) : 6 === a ? (d = $(e, l, h), g = $(e, u, c)) : 7 === a ? (y = 1 - $(e, u, l), g = $(e, u, c)) : 8 === a ? (y = $(e, l, u), g = 1 - $(e, c, u)) : 9 === a ? (d = 1 - $(e, h, l), g = 1 - $(e, c, u)) : 10 === a ? (g = 1 - $(e, c, u), _ = 1 - $(e, c, h), d = $(e, l, h), y = $(e, l, u)) : 11 === a ? (g = 1 - $(e, c, u), _ = 1 - $(e, c, h)) : 12 === a ? (y = $(e, l, u), _ = $(e, h, c)) : 13 === a ? (d = 1 - $(e, h, l), _ = $(e, h, c)) : 14 === a ? (y = $(e, l, u), d = $(e, l, h)) : console.log(\"MarchingSquaresJS-isoContours: Illegal cval detected: \" + a), i.cells[o][s] = {\n cval: a,\n flipped: p,\n top: g,\n right: _,\n bottom: d,\n left: y\n };\n }\n }\n }\n }\n return i;\n }(t, e));\n return \"function\" == typeof Uo.successCallback && Uo.successCallback(a), a;\n }\n function $(t, e, n) {\n return (t - e) / (n - e);\n }\n function tt(t) {\n return 0 === t.cval || 15 === t.cval;\n }\n function et(t) {\n tt(t) || 5 === t.cval || 10 === t.cval || (t.cval = 15);\n }\n function nt(t, e) {\n return \"top\" === e ? [t.top, 1] : \"bottom\" === e ? [t.bottom, 0] : \"right\" === e ? [1, t.right] : \"left\" === e ? [0, t.left] : void 0;\n }\n function rt(t, e) {\n if (e = e || {}, !I(e)) throw new Error(\"options is invalid\");\n var n = e.zProperty || \"elevation\",\n r = e.flip,\n i = e.flags;\n W(t, \"Point\", \"input must contain Points\");\n for (var o = function (t, e) {\n var n = {};\n O(t, function (t) {\n var e = U(t)[1];\n n[e] || (n[e] = []), n[e].push(t);\n });\n return Object.keys(n).map(function (t) {\n var e = n[t],\n r = e.sort(function (t, e) {\n return U(t)[0] - U(e)[0];\n });\n return r;\n }).sort(function (t, n) {\n return e ? U(t[0])[1] - U(n[0])[1] : U(n[0])[1] - U(t[0])[1];\n });\n }(t, r), s = [], a = 0; a < o.length; a++) {\n for (var u = o[a], c = [], h = 0; h < u.length; h++) {\n var l = u[h];\n l.properties[n] ? c.push(l.properties[n]) : c.push(0), !0 === i && (l.properties.matrixPosition = [a, h]);\n }\n s.push(c);\n }\n return s;\n }\n function it(t, e, n, r, i) {\n for (n = n || 0, r = r || t.length - 1, i = i || function (t, e) {\n return t < e ? -1 : t > e ? 1 : 0;\n }; r > n;) {\n if (r - n > 600) {\n var o = r - n + 1,\n s = e - n + 1,\n a = Math.log(o),\n u = .5 * Math.exp(2 * a / 3),\n c = .5 * Math.sqrt(a * u * (o - u) / o) * (s - o / 2 < 0 ? -1 : 1);\n it(t, e, Math.max(n, Math.floor(e - s * u / o + c)), Math.min(r, Math.floor(e + (o - s) * u / o + c)), i);\n }\n var h = t[e],\n l = n,\n p = r;\n for (ot(t, n, e), i(t[r], h) > 0 && ot(t, n, r); l < p;) {\n for (ot(t, l, p), l++, p--; i(t[l], h) < 0;) l++;\n for (; i(t[p], h) > 0;) p--;\n }\n 0 === i(t[n], h) ? ot(t, n, p) : ot(t, ++p, r), p <= e && (n = p + 1), e <= p && (r = p - 1);\n }\n }\n function ot(t, e, n) {\n var r = t[e];\n t[e] = t[n], t[n] = r;\n }\n function st(t, e) {\n if (!(this instanceof st)) return new st(t, e);\n this._maxEntries = Math.max(4, t || 9), this._minEntries = Math.max(2, Math.ceil(.4 * this._maxEntries)), e && this._initFormat(e), this.clear();\n }\n function at(t, e) {\n ut(t, 0, t.children.length, e, t);\n }\n function ut(t, e, n, r, i) {\n i || (i = yt(null)), i.minX = 1 / 0, i.minY = 1 / 0, i.maxX = -1 / 0, i.maxY = -1 / 0;\n for (var o, s = e; s < n; s++) o = t.children[s], ct(i, t.leaf ? r(o) : o);\n return i;\n }\n function ct(t, e) {\n return t.minX = Math.min(t.minX, e.minX), t.minY = Math.min(t.minY, e.minY), t.maxX = Math.max(t.maxX, e.maxX), t.maxY = Math.max(t.maxY, e.maxY), t;\n }\n function ht(t, e) {\n return t.minX - e.minX;\n }\n function lt(t, e) {\n return t.minY - e.minY;\n }\n function pt(t) {\n return (t.maxX - t.minX) * (t.maxY - t.minY);\n }\n function ft(t) {\n return t.maxX - t.minX + (t.maxY - t.minY);\n }\n function gt(t, e) {\n return t.minX <= e.minX && t.minY <= e.minY && e.maxX <= t.maxX && e.maxY <= t.maxY;\n }\n function dt(t, e) {\n return e.minX <= t.maxX && e.minY <= t.maxY && e.maxX >= t.minX && e.maxY >= t.minY;\n }\n function yt(t) {\n return {\n children: t,\n height: 1,\n leaf: !0,\n minX: 1 / 0,\n minY: 1 / 0,\n maxX: -1 / 0,\n maxY: -1 / 0\n };\n }\n function _t(t, e, n, r, i) {\n for (var o, s = [e, n]; s.length;) (n = s.pop()) - (e = s.pop()) <= r || (o = e + Math.ceil((n - e) / r / 2) * r, Yo(t, o, e, n, i), s.push(e, o, o, n));\n }\n function mt(t, e) {\n return e = {\n exports: {}\n }, t(e, e.exports), e.exports;\n }\n function vt(t, e) {\n if (!(this instanceof vt)) return new vt(t, e);\n if (this.data = t || [], this.length = this.data.length, this.compare = e || function (t, e) {\n return t < e ? -1 : t > e ? 1 : 0;\n }, this.length > 0) for (var n = (this.length >> 1) - 1; n >= 0; n--) this._down(n);\n }\n function xt(t, e, n) {\n e = Math.max(0, void 0 === e ? 2 : e), n = n || 0;\n for (var r, i = function (t) {\n for (var e = t[0], n = t[0], r = t[0], i = t[0], o = 0; o < t.length; o++) {\n var s = t[o];\n s[0] < e[0] && (e = s), s[0] > r[0] && (r = s), s[1] < n[1] && (n = s), s[1] > i[1] && (i = s);\n }\n var a = [e, n, r, i],\n u = a.slice();\n for (o = 0; o < t.length; o++) is(t[o], a) || u.push(t[o]);\n var c = ts(u),\n h = [];\n for (o = 0; o < c.length; o++) h.push(u[c[o]]);\n return h;\n }(t), o = Vo(16, [\"[0]\", \"[1]\", \"[0]\", \"[1]\"]).load(t), s = [], a = 0; a < i.length; a++) {\n var u = i[a];\n o.remove(u), r = Nt(u, r), s.push(r);\n }\n var c = Vo(16);\n for (a = 0; a < s.length; a++) c.insert(It(s[a]));\n for (var h = e * e, l = n * n; s.length;) {\n var p = s.shift(),\n f = p.p,\n g = p.next.p,\n d = Ct(f, g);\n if (!(d < l)) {\n var y = d / h;\n (u = function (t, e, n, r, i, o, s) {\n var a = new ns(null, Et),\n u = t.data;\n for (; u;) {\n for (var c = 0; c < u.children.length; c++) {\n var h = u.children[c],\n l = u.leaf ? St(h, n, r) : function (t, e, n) {\n if (wt(t, n) || wt(e, n)) return 0;\n var r = Mt(t[0], t[1], e[0], e[1], n.minX, n.minY, n.maxX, n.minY);\n if (0 === r) return 0;\n var i = Mt(t[0], t[1], e[0], e[1], n.minX, n.minY, n.minX, n.maxY);\n if (0 === i) return 0;\n var o = Mt(t[0], t[1], e[0], e[1], n.maxX, n.minY, n.maxX, n.maxY);\n if (0 === o) return 0;\n var s = Mt(t[0], t[1], e[0], e[1], n.minX, n.maxY, n.maxX, n.maxY);\n return 0 === s ? 0 : Math.min(r, i, o, s);\n }(n, r, h);\n l > o || a.push({\n node: h,\n dist: l\n });\n }\n for (; a.length && !a.peek().node.children;) {\n var p = a.pop(),\n f = p.node,\n g = St(f, e, n),\n d = St(f, r, i);\n if (p.dist < g && p.dist < d && bt(n, f, s) && bt(r, f, s)) return f;\n }\n (u = a.pop()) && (u = u.node);\n }\n return null;\n }(o, p.prev.p, f, g, p.next.next.p, y, c)) && Math.min(Ct(u, f), Ct(u, g)) <= y && (s.push(p), s.push(Nt(u, p)), o.remove(u), c.remove(p), c.insert(It(p)), c.insert(It(p.next)));\n }\n }\n p = r;\n var _ = [];\n do {\n _.push(p.p), p = p.next;\n } while (p !== r);\n return _.push(p.p), _;\n }\n function Et(t, e) {\n return t.dist - e.dist;\n }\n function wt(t, e) {\n return t[0] >= e.minX && t[0] <= e.maxX && t[1] >= e.minY && t[1] <= e.maxY;\n }\n function bt(t, e, n) {\n for (var r = Math.min(t[0], e[0]), i = Math.min(t[1], e[1]), o = Math.max(t[0], e[0]), s = Math.max(t[1], e[1]), a = n.search({\n minX: r,\n minY: i,\n maxX: o,\n maxY: s\n }), u = 0; u < a.length; u++) if (function (t, e, n, r) {\n return t !== r && e !== n && os(t, e, n) > 0 != os(t, e, r) > 0 && os(n, r, t) > 0 != os(n, r, e) > 0;\n }(a[u].p, a[u].next.p, t, e)) return !1;\n return !0;\n }\n function It(t) {\n var e = t.p,\n n = t.next.p;\n return t.minX = Math.min(e[0], n[0]), t.minY = Math.min(e[1], n[1]), t.maxX = Math.max(e[0], n[0]), t.maxY = Math.max(e[1], n[1]), t;\n }\n function Nt(t, e) {\n var n = {\n p: t,\n prev: null,\n next: null,\n minX: 0,\n minY: 0,\n maxX: 0,\n maxY: 0\n };\n return e ? (n.next = e.next, n.prev = e, e.next.prev = n, e.next = n) : (n.prev = n, n.next = n), n;\n }\n function Ct(t, e) {\n var n = t[0] - e[0],\n r = t[1] - e[1];\n return n * n + r * r;\n }\n function St(t, e, n) {\n var r = e[0],\n i = e[1],\n o = n[0] - r,\n s = n[1] - i;\n if (0 !== o || 0 !== s) {\n var a = ((t[0] - r) * o + (t[1] - i) * s) / (o * o + s * s);\n a > 1 ? (r = n[0], i = n[1]) : a > 0 && (r += o * a, i += s * a);\n }\n return o = t[0] - r, s = t[1] - i, o * o + s * s;\n }\n function Mt(t, e, n, r, i, o, s, a) {\n var u,\n c,\n h,\n l,\n p = n - t,\n f = r - e,\n g = s - i,\n d = a - o,\n y = t - i,\n _ = e - o,\n m = p * p + f * f,\n v = p * g + f * d,\n x = g * g + d * d,\n E = p * y + f * _,\n w = g * y + d * _,\n b = m * x - v * v,\n I = b,\n N = b;\n 0 === b ? (c = 0, I = 1, l = w, N = x) : (l = m * w - v * E, (c = v * w - x * E) < 0 ? (c = 0, l = w, N = x) : c > I && (c = I, l = w + v, N = x)), l < 0 ? (l = 0, -E < 0 ? c = 0 : -E > m ? c = I : (c = -E, I = m)) : l > N && (l = N, -E + v < 0 ? c = 0 : -E + v > m ? c = I : (c = -E + v, I = m)), u = 0 === c ? 0 : c / I;\n var C = (1 - (h = 0 === l ? 0 : l / N)) * i + h * s - ((1 - u) * t + u * n),\n S = (1 - h) * o + h * a - ((1 - u) * e + u * r);\n return C * C + S * S;\n }\n function Lt(t, e) {\n if (e = e || {}, !I(e)) throw new Error(\"options is invalid\");\n var n = e.concavity || 1 / 0,\n r = [];\n if (S(t, function (t) {\n r.push([t[0], t[1]]);\n }), !r.length) return null;\n var i = ss(r, n);\n return i.length > 3 ? o([i]) : null;\n }\n function Pt(t, e, n) {\n if (\"object\" != typeof (n = n || {})) throw new Error(\"options is invalid\");\n var r = n.ignoreBoundary;\n if (!t) throw new Error(\"point is required\");\n if (!e) throw new Error(\"polygon is required\");\n var i = X(t),\n o = U(e),\n s = e.geometry ? e.geometry.type : e.type,\n a = e.bbox;\n if (a && !1 === function (t, e) {\n return e[0] <= t[0] && e[1] <= t[1] && e[2] >= t[0] && e[3] >= t[1];\n }(i, a)) return !1;\n \"Polygon\" === s && (o = [o]);\n for (var u = 0, c = !1; u < o.length && !c; u++) if (Ot(i, o[u][0], r)) {\n for (var h = !1, l = 1; l < o[u].length && !h;) Ot(i, o[u][l], !r) && (h = !0), l++;\n h || (c = !0);\n }\n return c;\n }\n function Ot(t, e, n) {\n var r = !1;\n e[0][0] === e[e.length - 1][0] && e[0][1] === e[e.length - 1][1] && (e = e.slice(0, e.length - 1));\n for (var i = 0, o = e.length - 1; i < e.length; o = i++) {\n var s = e[i][0],\n a = e[i][1],\n u = e[o][0],\n c = e[o][1];\n if (t[1] * (s - u) + a * (u - t[0]) + c * (t[0] - s) == 0 && (s - t[0]) * (u - t[0]) <= 0 && (a - t[1]) * (c - t[1]) <= 0) return !n;\n a > t[1] != c > t[1] && t[0] < (u - s) * (t[1] - a) / (c - a) + s && (r = !r);\n }\n return r;\n }\n function Rt(t, e) {\n var n = [];\n return A(e, function (e) {\n O(t, function (t) {\n Pt(t, e) && n.push(t);\n });\n }), c(n);\n }\n function Tt(t, e) {\n if (\"FeatureCollection\" !== t.type) throw new Error(\"points must be a FeatureCollection\");\n var n = !1;\n return c(function (t) {\n if (t.length < 3) return [];\n t.sort(Dt);\n var e,\n n,\n r,\n i,\n o,\n s,\n a = t.length - 1,\n u = t[a].x,\n c = t[0].x,\n h = t[a].y,\n l = h;\n for (; a--;) t[a].y < h && (h = t[a].y), t[a].y > l && (l = t[a].y);\n var p,\n f = c - u,\n g = l - h,\n d = f > g ? f : g,\n y = .5 * (c + u),\n _ = .5 * (l + h),\n m = [new At({\n x: y - 20 * d,\n y: _ - d,\n __sentinel: !0\n }, {\n x: y,\n y: _ + 20 * d,\n __sentinel: !0\n }, {\n x: y + 20 * d,\n y: _ - d,\n __sentinel: !0\n })],\n v = [],\n x = [];\n a = t.length;\n for (; a--;) {\n for (x.length = 0, p = m.length; p--;) (f = t[a].x - m[p].x) > 0 && f * f > m[p].r ? (v.push(m[p]), m.splice(p, 1)) : (g = t[a].y - m[p].y, f * f + g * g > m[p].r || (x.push(m[p].a, m[p].b, m[p].b, m[p].c, m[p].c, m[p].a), m.splice(p, 1)));\n for (Ft(x), p = x.length; p;) n = x[--p], e = x[--p], r = t[a], i = n.x - e.x, o = n.y - e.y, s = 2 * (i * (r.y - n.y) - o * (r.x - n.x)), Math.abs(s) > 1e-12 && m.push(new At(e, n, r));\n }\n Array.prototype.push.apply(v, m), a = v.length;\n for (; a--;) (v[a].a.__sentinel || v[a].b.__sentinel || v[a].c.__sentinel) && v.splice(a, 1);\n return v;\n }(t.features.map(function (t) {\n var r = {\n x: t.geometry.coordinates[0],\n y: t.geometry.coordinates[1]\n };\n return e ? r.z = t.properties[e] : 3 === t.geometry.coordinates.length && (n = !0, r.z = t.geometry.coordinates[2]), r;\n })).map(function (t) {\n var e = [t.a.x, t.a.y],\n r = [t.b.x, t.b.y],\n i = [t.c.x, t.c.y],\n s = {};\n return n ? (e.push(t.a.z), r.push(t.b.z), i.push(t.c.z)) : s = {\n a: t.a.z,\n b: t.b.z,\n c: t.c.z\n }, o([[e, r, i, e]], s);\n }));\n }\n function At(t, e, n) {\n this.a = t, this.b = e, this.c = n;\n var r,\n i,\n o = e.x - t.x,\n s = e.y - t.y,\n a = n.x - t.x,\n u = n.y - t.y,\n c = o * (t.x + e.x) + s * (t.y + e.y),\n h = a * (t.x + n.x) + u * (t.y + n.y),\n l = 2 * (o * (n.y - e.y) - s * (n.x - e.x));\n this.x = (u * c - s * h) / l, this.y = (o * h - a * c) / l, r = this.x - t.x, i = this.y - t.y, this.r = r * r + i * i;\n }\n function Dt(t, e) {\n return e.x - t.x;\n }\n function Ft(t) {\n var e,\n n,\n r,\n i,\n o,\n s = t.length;\n t: for (; s;) for (n = t[--s], e = t[--s], r = s; r;) if (o = t[--r], i = t[--r], e === i && n === o || e === o && n === i) {\n t.splice(s, 2), t.splice(r, 2), s -= 2;\n continue t;\n }\n }\n function qt(t, e, n) {\n if (n = n || {}, !I(n)) throw new Error(\"options is invalid\");\n var r = n.units,\n i = X(t),\n o = X(e),\n s = x(o[1] - i[1]),\n a = x(o[0] - i[0]),\n u = x(i[1]),\n c = x(o[1]),\n h = Math.pow(Math.sin(s / 2), 2) + Math.pow(Math.sin(a / 2), 2) * Math.cos(u) * Math.cos(c);\n return d(2 * Math.atan2(Math.sqrt(h), Math.sqrt(1 - h)), r);\n }\n function Gt(t) {\n if (!t) throw new Error(\"geojson is required\");\n switch (t.type) {\n case \"Feature\":\n return Bt(t);\n case \"FeatureCollection\":\n return function (t) {\n var e = {\n type: \"FeatureCollection\"\n };\n return Object.keys(t).forEach(function (n) {\n switch (n) {\n case \"type\":\n case \"features\":\n return;\n default:\n e[n] = t[n];\n }\n }), e.features = t.features.map(function (t) {\n return Bt(t);\n }), e;\n }(t);\n case \"Point\":\n case \"LineString\":\n case \"Polygon\":\n case \"MultiPoint\":\n case \"MultiLineString\":\n case \"MultiPolygon\":\n case \"GeometryCollection\":\n return zt(t);\n default:\n throw new Error(\"unknown GeoJSON type\");\n }\n }\n function Bt(t) {\n var e = {\n type: \"Feature\"\n };\n return Object.keys(t).forEach(function (n) {\n switch (n) {\n case \"type\":\n case \"properties\":\n case \"geometry\":\n return;\n default:\n e[n] = t[n];\n }\n }), e.properties = kt(t.properties), e.geometry = zt(t.geometry), e;\n }\n function kt(t) {\n var e = {};\n return t ? (Object.keys(t).forEach(function (n) {\n var r = t[n];\n \"object\" == typeof r ? null === r ? e[n] = null : r.length ? e[n] = r.map(function (t) {\n return t;\n }) : e[n] = kt(r) : e[n] = r;\n }), e) : e;\n }\n function zt(t) {\n var e = {\n type: t.type\n };\n return t.bbox && (e.bbox = t.bbox), \"GeometryCollection\" === t.type ? (e.geometries = t.geometries.map(function (t) {\n return zt(t);\n }), e) : (e.coordinates = jt(t.coordinates), e);\n }\n function jt(t) {\n return \"object\" != typeof t[0] ? t.slice() : t.map(function (t) {\n return jt(t);\n });\n }\n function Xt(t, e) {\n function n(t, e) {\n e.length && e.pop();\n for (var n = c[t < 0 ? ~t : t], r = 0, i = n.length; r < i; ++r) e.push(u(n[r], r));\n t < 0 && hs(e, i);\n }\n function r(t) {\n return u(t);\n }\n function i(t) {\n for (var e = [], r = 0, i = t.length; r < i; ++r) n(t[r], e);\n return e.length < 2 && e.push(e[0]), e;\n }\n function o(t) {\n for (var e = i(t); e.length < 4;) e.push(e[0]);\n return e;\n }\n function s(t) {\n return t.map(o);\n }\n function a(t) {\n var e,\n n = t.type;\n switch (n) {\n case \"GeometryCollection\":\n return {\n type: n,\n geometries: t.geometries.map(a)\n };\n case \"Point\":\n e = r(t.coordinates);\n break;\n case \"MultiPoint\":\n e = t.coordinates.map(r);\n break;\n case \"LineString\":\n e = i(t.arcs);\n break;\n case \"MultiLineString\":\n e = t.arcs.map(i);\n break;\n case \"Polygon\":\n e = s(t.arcs);\n break;\n case \"MultiPolygon\":\n e = t.arcs.map(s);\n break;\n default:\n return null;\n }\n return {\n type: n,\n coordinates: e\n };\n }\n var u = cs(t.transform),\n c = t.arcs;\n return a(e);\n }\n function Ut(t, e) {\n function n(t) {\n switch (t.type) {\n case \"GeometryCollection\":\n t.geometries.forEach(n);\n break;\n case \"Polygon\":\n r(t.arcs);\n break;\n case \"MultiPolygon\":\n t.arcs.forEach(r);\n }\n }\n function r(t) {\n t.forEach(function (e) {\n e.forEach(function (e) {\n (o[e = e < 0 ? ~e : e] || (o[e] = [])).push(t);\n });\n }), s.push(t);\n }\n function i(e) {\n return function (t) {\n for (var e, n = -1, r = t.length, i = t[r - 1], o = 0; ++n < r;) e = i, i = t[n], o += e[0] * i[1] - e[1] * i[0];\n return Math.abs(o);\n }(Xt(t, {\n type: \"Polygon\",\n arcs: [e]\n }).coordinates[0]);\n }\n var o = {},\n s = [],\n a = [];\n return e.forEach(n), s.forEach(function (t) {\n if (!t._) {\n var e = [],\n n = [t];\n for (t._ = 1, a.push(e); t = n.pop();) e.push(t), t.forEach(function (t) {\n t.forEach(function (t) {\n o[t < 0 ? ~t : t].forEach(function (t) {\n t._ || (t._ = 1, n.push(t));\n });\n });\n });\n }\n }), s.forEach(function (t) {\n delete t._;\n }), {\n type: \"MultiPolygon\",\n arcs: a.map(function (e) {\n var n,\n r = [];\n if (e.forEach(function (t) {\n t.forEach(function (t) {\n t.forEach(function (t) {\n o[t < 0 ? ~t : t].length < 2 && r.push(t);\n });\n });\n }), r = ls(t, r), (n = r.length) > 1) for (var s, a, u = 1, c = i(r[0]); u < n; ++u) (s = i(r[u])) > c && (a = r[0], r[0] = r[u], r[u] = a, c = s);\n return r;\n })\n };\n }\n function Yt(t, e, n) {\n for (var r, i = e + (n-- - e >> 1); e < i; ++e, --n) r = t[e], t[e] = t[n], t[n] = r;\n }\n function Vt(t) {\n return null == t ? {\n type: null\n } : (\"FeatureCollection\" === t.type ? function (t) {\n var e = {\n type: \"GeometryCollection\",\n geometries: t.features.map(Ht)\n };\n null != t.bbox && (e.bbox = t.bbox);\n return e;\n } : \"Feature\" === t.type ? Ht : Wt)(t);\n }\n function Ht(t) {\n var e,\n n = Wt(t.geometry);\n null != t.id && (n.id = t.id), null != t.bbox && (n.bbox = t.bbox);\n for (e in t.properties) {\n n.properties = t.properties;\n break;\n }\n return n;\n }\n function Wt(t) {\n if (null == t) return {\n type: null\n };\n var e = \"GeometryCollection\" === t.type ? {\n type: \"GeometryCollection\",\n geometries: t.geometries.map(Wt)\n } : \"Point\" === t.type || \"MultiPoint\" === t.type ? {\n type: t.type,\n coordinates: t.coordinates\n } : {\n type: t.type,\n arcs: t.coordinates\n };\n return null != t.bbox && (e.bbox = t.bbox), e;\n }\n function Jt(t) {\n var e,\n n = t[0],\n r = t[1];\n return r < n && (e = n, n = r, r = e), n + 31 * r;\n }\n function Zt(t, e) {\n var n,\n r = t[0],\n i = t[1],\n o = e[0],\n s = e[1];\n return i < r && (n = r, r = i, i = n), s < o && (n = o, o = s, s = n), r === o && i === s;\n }\n function Kt(t, e) {\n if (e = e || {}, !I(e)) throw new Error(\"options is invalid\");\n var n = e.mutate;\n if (\"FeatureCollection\" !== K(t)) throw new Error(\"geojson must be a FeatureCollection\");\n if (!t.features.length) throw new Error(\"geojson is empty\");\n !1 !== n && void 0 !== n || (t = Gt(t));\n var r = [],\n i = z(t, function (t, e) {\n var n = function (t, e) {\n var n,\n r = t.geometry.coordinates,\n i = e.geometry.coordinates,\n o = Qt(r[0]),\n s = Qt(r[r.length - 1]),\n u = Qt(i[0]),\n c = Qt(i[i.length - 1]);\n if (o === c) n = i.concat(r.slice(1));else if (u === s) n = r.concat(i.slice(1));else if (o === u) n = r.slice(1).reverse().concat(i);else {\n if (s !== c) return null;\n n = r.concat(i.reverse().slice(1));\n }\n return a(n);\n }(t, e);\n return n || (r.push(t), e);\n });\n return i && r.push(i), r.length ? 1 === r.length ? r[0] : h(r.map(function (t) {\n return t.coordinates;\n })) : null;\n }\n function Qt(t) {\n return t[0].toString() + \",\" + t[1].toString();\n }\n function $t(t, e) {\n if (e = e || {}, !I(e)) throw new Error(\"options is invalid\");\n var n = e.mutate;\n if (\"FeatureCollection\" !== K(t)) throw new Error(\"geojson must be a FeatureCollection\");\n if (!t.features.length) throw new Error(\"geojson is empty\");\n !1 !== n && void 0 !== n || (t = Gt(t));\n var r = function (t) {\n var e = {};\n F(t, function (t) {\n e[t.geometry.type] = !0;\n });\n var n = Object.keys(e);\n return 1 === n.length ? n[0] : null;\n }(t);\n if (!r) throw new Error(\"geojson must be homogenous\");\n switch (r) {\n case \"LineString\":\n return Kt(t, e);\n case \"Polygon\":\n return function (t, e) {\n if (e = e || {}, !I(e)) throw new Error(\"options is invalid\");\n var n = e.mutate;\n if (\"FeatureCollection\" !== K(t)) throw new Error(\"geojson must be a FeatureCollection\");\n if (!t.features.length) throw new Error(\"geojson is empty\");\n !1 !== n && void 0 !== n || (t = Gt(t));\n var r = [];\n F(t, function (t) {\n r.push(t.geometry);\n });\n var i = ws({\n geoms: f(r).geometry\n });\n return ps(i, i.objects.geoms.geometries);\n }(t, e);\n default:\n throw new Error(r + \" is not supported\");\n }\n }\n function te(t, n) {\n var r = \"object\" == typeof n ? n.mutate : n;\n if (!t) throw new Error(\"geojson is required\");\n var i = K(t),\n o = [];\n switch (i) {\n case \"LineString\":\n o = ee(t);\n break;\n case \"MultiLineString\":\n case \"Polygon\":\n U(t).forEach(function (t) {\n o.push(ee(t));\n });\n break;\n case \"MultiPolygon\":\n U(t).forEach(function (t) {\n var e = [];\n t.forEach(function (t) {\n e.push(ee(t));\n }), o.push(e);\n });\n break;\n case \"Point\":\n return t;\n case \"MultiPoint\":\n var s = {};\n U(t).forEach(function (t) {\n var e = t.join(\"-\");\n s.hasOwnProperty(e) || (o.push(t), s[e] = !0);\n });\n break;\n default:\n throw new Error(i + \" geometry not supported\");\n }\n return t.coordinates ? !0 === r ? (t.coordinates = o, t) : {\n type: i,\n coordinates: o\n } : !0 === r ? (t.geometry.coordinates = o, t) : e({\n type: i,\n coordinates: o\n }, t.properties, t.bbox, t.id);\n }\n function ee(t) {\n var e = U(t);\n if (2 === e.length && !function (t, e) {\n return t[0] === e[0] && t[1] === e[1];\n }(e[0], e[1])) return e;\n var n,\n r,\n i,\n o = [],\n s = e.length - 1;\n o.push(e[0]);\n for (var a = 1; a < s; a++) n = e[a - 1], r = e[a], function (t, e, n) {\n var r = n[0],\n i = n[1],\n o = t[0],\n s = t[1],\n a = e[0],\n u = e[1],\n c = a - o,\n h = u - s;\n return (r - o) * h - (i - s) * c == 0 && (Math.abs(c) >= Math.abs(h) ? c > 0 ? o <= r && r <= a : a <= r && r <= o : h > 0 ? s <= i && i <= u : u <= i && i <= s);\n }(n, i = e[a + 1], r) || o.push(r);\n return o.push(i), o;\n }\n function ne(t, e) {\n var n = t.x - e.x,\n r = t.y - e.y;\n return n * n + r * r;\n }\n function re(t, e, n) {\n var r = e.x,\n i = e.y,\n o = n.x - r,\n s = n.y - i;\n if (0 !== o || 0 !== s) {\n var a = ((t.x - r) * o + (t.y - i) * s) / (o * o + s * s);\n a > 1 ? (r = n.x, i = n.y) : a > 0 && (r += o * a, i += s * a);\n }\n return o = t.x - r, s = t.y - i, o * o + s * s;\n }\n function ie(t, e, n, r, i) {\n for (var o, s = r, a = e + 1; a < n; a++) {\n var u = re(t[a], t[e], t[n]);\n u > s && (o = a, s = u);\n }\n s > r && (o - e > 1 && ie(t, e, o, r, i), i.push(t[o]), n - o > 1 && ie(t, o, n, r, i));\n }\n function oe(t, e, n) {\n if (t.length <= 2) return t;\n var r = void 0 !== e ? e * e : 1;\n return t = n ? t : function (t, e) {\n for (var n, r = t[0], i = [r], o = 1, s = t.length; o < s; o++) ne(n = t[o], r) > e && (i.push(n), r = n);\n return r !== n && i.push(n), i;\n }(t, r), t = function (t, e) {\n var n = t.length - 1,\n r = [t[0]];\n return ie(t, 0, n, e, r), r.push(t[n]), r;\n }(t, r);\n }\n function se(t, e, n) {\n return oe(t.map(function (t) {\n return {\n x: t[0],\n y: t[1],\n z: t[2]\n };\n }), e, n).map(function (t) {\n return t.z ? [t.x, t.y, t.z] : [t.x, t.y];\n });\n }\n function ae(t, e, n) {\n return t.map(function (t) {\n var r = t.map(function (t) {\n return {\n x: t[0],\n y: t[1]\n };\n });\n if (r.length < 4) throw new Error(\"invalid polygon\");\n for (var i = oe(r, e, n).map(function (t) {\n return [t.x, t.y];\n }); !function (t) {\n return !(t.length < 3 || 3 === t.length && t[2][0] === t[0][0] && t[2][1] === t[0][1]);\n }(i);) i = oe(r, e -= .01 * e, n).map(function (t) {\n return [t.x, t.y];\n });\n return i[i.length - 1][0] === i[0][0] && i[i.length - 1][1] === i[0][1] || i.push(i[0]), i;\n });\n }\n function ue(t, e) {\n if (e = e || {}, !I(e)) throw new Error(\"options is invalid\");\n var n = e.resolution || 1e4,\n r = e.sharpness || .85;\n if (!t) throw new Error(\"line is required\");\n if (!b(n)) throw new Error(\"resolution must be an number\");\n if (!b(r)) throw new Error(\"sharpness must be an number\");\n for (var i = [], o = new bs({\n points: J(t).coordinates.map(function (t) {\n return {\n x: t[0],\n y: t[1]\n };\n }),\n duration: n,\n sharpness: r\n }), s = 0; s < o.duration; s += 10) {\n var u = o.pos(s);\n Math.floor(s / 100) % 2 == 0 && i.push([u.x, u.y]);\n }\n return a(i, t.properties);\n }\n function ce(t) {\n N(t);\n var e = Number(t[0]),\n n = Number(t[1]),\n r = Number(t[2]),\n i = Number(t[3]);\n if (6 === t.length) throw new Error(\"@turf/bbox-polygon does not support BBox with 6 positions\");\n var s = [e, n];\n return o([[s, [r, n], [r, i], [e, i], s]]);\n }\n function he(t) {\n return ce(j(t));\n }\n function le(t) {\n var e = t[0],\n n = t[1],\n r = t[2],\n i = t[3];\n if (qt(t.slice(0, 2), [r, n]) >= qt(t.slice(0, 2), [e, i])) {\n var o = (n + i) / 2;\n return [e, o - (r - e) / 2, r, o + (r - e) / 2];\n }\n var s = (e + r) / 2;\n return [s - (i - n) / 2, n, s + (i - n) / 2, i];\n }\n function pe(t, e, n, i) {\n if (i = i || {}, !I(i)) throw new Error(\"options is invalid\");\n var o = i.units,\n s = i.properties,\n a = X(t),\n u = x(a[0]),\n c = x(a[1]),\n h = x(n),\n l = y(e, o),\n p = Math.asin(Math.sin(c) * Math.cos(l) + Math.cos(c) * Math.sin(l) * Math.cos(h));\n return r([v(u + Math.atan2(Math.sin(h) * Math.sin(l) * Math.cos(c), Math.cos(l) - Math.sin(c) * Math.sin(p))), v(p)], s);\n }\n function fe(t, e, n) {\n var r = (n = n || {}).steps || 64,\n i = n.properties;\n if (!t) throw new Error(\"center is required\");\n if (!e) throw new Error(\"radius is required\");\n if (\"object\" != typeof n) throw new Error(\"options must be an object\");\n if (\"number\" != typeof r) throw new Error(\"steps must be a number\");\n r = r || 64, i = i || t.properties || {};\n for (var s = [], a = 0; a < r; a++) s.push(pe(t, e, -360 * a / r, n).geometry.coordinates);\n return s.push(s[0]), o([s], i);\n }\n function ge(t, e, n) {\n if (n = n || {}, !I(n)) throw new Error(\"options is invalid\");\n if (!0 === n.final) return function (t, e) {\n var n = ge(e, t);\n return n = (n + 180) % 360;\n }(t, e);\n var r = X(t),\n i = X(e),\n o = x(r[0]),\n s = x(i[0]),\n a = x(r[1]),\n u = x(i[1]),\n c = Math.sin(s - o) * Math.cos(u),\n h = Math.cos(a) * Math.sin(u) - Math.sin(a) * Math.cos(u) * Math.cos(s - o);\n return v(Math.atan2(c, h));\n }\n function de(t, e) {\n if (e = e || {}, !I(e)) throw new Error(\"options is invalid\");\n var n = e.properties;\n if (!t) throw new Error(\"geojson is required\");\n var i = j(t);\n return r([(i[0] + i[2]) / 2, (i[1] + i[3]) / 2], n);\n }\n function ye(t, e) {\n var n = 0,\n i = 0,\n o = 0;\n return S(t, function (t) {\n n += t[0], i += t[1], o++;\n }, !0), r([n / o, i / o], e);\n }\n function _e(t, e) {\n switch (K(t)) {\n case \"Point\":\n return t;\n case \"Polygon\":\n var n = [];\n S(t, function (t) {\n n.push(t);\n });\n var i,\n o,\n s,\n a,\n u,\n c,\n h,\n l,\n p = ye(t, e),\n f = p.geometry.coordinates,\n g = 0,\n d = 0,\n y = 0,\n _ = n.map(function (t) {\n return [t[0] - f[0], t[1] - f[1]];\n });\n for (i = 0; i < n.length - 1; i++) a = (o = _[i])[0], c = o[1], u = (s = _[i + 1])[0], y += l = a * (h = s[1]) - u * c, g += (a + u) * l, d += (c + h) * l;\n if (0 === y) return p;\n var m = 1 / (6 * (.5 * y));\n return r([f[0] + m * g, f[1] + m * d], e);\n default:\n var v = Lt(t);\n return v ? _e(v, e) : ye(t, e);\n }\n }\n function me(t) {\n var e = [];\n return \"FeatureCollection\" === t.type ? O(t, function (t) {\n S(t, function (n) {\n e.push(r(n, t.properties));\n });\n }) : S(t, function (n) {\n e.push(r(n, t.properties));\n }), c(e);\n }\n function ve(t, e, n) {\n n = n || 2;\n var r = e && e.length,\n i = r ? e[0] * n : t.length,\n o = xe(t, 0, i, n, !0),\n s = [];\n if (!o) return s;\n var a, u, c, h, l, p, f;\n if (r && (o = function (t, e, n, r) {\n var i,\n o,\n s,\n a,\n u,\n c = [];\n for (i = 0, o = e.length; i < o; i++) s = e[i] * r, a = i < o - 1 ? e[i + 1] * r : t.length, (u = xe(t, s, a, r, !1)) === u.next && (u.steiner = !0), c.push(function (t) {\n var e = t,\n n = t;\n do {\n e.x < n.x && (n = e), e = e.next;\n } while (e !== t);\n return n;\n }(u));\n for (c.sort(be), i = 0; i < c.length; i++) !function (t, e) {\n if (e = function (t, e) {\n var n,\n r = e,\n i = t.x,\n o = t.y,\n s = -1 / 0;\n do {\n if (o <= r.y && o >= r.next.y && r.next.y !== r.y) {\n var a = r.x + (o - r.y) * (r.next.x - r.x) / (r.next.y - r.y);\n if (a <= i && a > s) {\n if (s = a, a === i) {\n if (o === r.y) return r;\n if (o === r.next.y) return r.next;\n }\n n = r.x < r.next.x ? r : r.next;\n }\n }\n r = r.next;\n } while (r !== e);\n if (!n) return null;\n if (i === s) return n.prev;\n var u,\n c = n,\n h = n.x,\n l = n.y,\n p = 1 / 0;\n for (r = n.next; r !== c;) i >= r.x && r.x >= h && i !== r.x && Ne(o < l ? i : s, o, h, l, o < l ? s : i, o, r.x, r.y) && ((u = Math.abs(o - r.y) / (i - r.x)) < p || u === p && r.x > n.x) && Le(r, t) && (n = r, p = u), r = r.next;\n return n;\n }(t, e)) {\n var n = Pe(e, t);\n Ee(n, n.next);\n }\n }(c[i], n), n = Ee(n, n.next);\n return n;\n }(t, e, o, n)), t.length > 80 * n) {\n a = c = t[0], u = h = t[1];\n for (var g = n; g < i; g += n) l = t[g], p = t[g + 1], l < a && (a = l), p < u && (u = p), l > c && (c = l), p > h && (h = p);\n f = 0 !== (f = Math.max(c - a, h - u)) ? 1 / f : 0;\n }\n return we(o, s, n, a, u, f), s;\n }\n function xe(t, e, n, r, i) {\n var o, s;\n if (i === Ae(t, e, n, r) > 0) for (o = e; o < n; o += r) s = Oe(o, t[o], t[o + 1], s);else for (o = n - r; o >= e; o -= r) s = Oe(o, t[o], t[o + 1], s);\n return s && Se(s, s.next) && (Re(s), s = s.next), s;\n }\n function Ee(t, e) {\n if (!t) return t;\n e || (e = t);\n var n,\n r = t;\n do {\n if (n = !1, r.steiner || !Se(r, r.next) && 0 !== Ce(r.prev, r, r.next)) r = r.next;else {\n if (Re(r), (r = e = r.prev) === r.next) break;\n n = !0;\n }\n } while (n || r !== e);\n return e;\n }\n function we(t, e, n, r, i, o, s) {\n if (t) {\n !s && o && function (t, e, n, r) {\n var i = t;\n do {\n null === i.z && (i.z = Ie(i.x, i.y, e, n, r)), i.prevZ = i.prev, i.nextZ = i.next, i = i.next;\n } while (i !== t);\n i.prevZ.nextZ = null, i.prevZ = null, function (t) {\n var e,\n n,\n r,\n i,\n o,\n s,\n a,\n u,\n c = 1;\n do {\n for (n = t, t = null, o = null, s = 0; n;) {\n for (s++, r = n, a = 0, e = 0; e < c && (a++, r = r.nextZ); e++);\n for (u = c; a > 0 || u > 0 && r;) 0 !== a && (0 === u || !r || n.z <= r.z) ? (i = n, n = n.nextZ, a--) : (i = r, r = r.nextZ, u--), o ? o.nextZ = i : t = i, i.prevZ = o, o = i;\n n = r;\n }\n o.nextZ = null, c *= 2;\n } while (s > 1);\n }(i);\n }(t, r, i, o);\n for (var a, u, c = t; t.prev !== t.next;) if (a = t.prev, u = t.next, o ? function (t, e, n, r) {\n var i = t.prev,\n o = t,\n s = t.next;\n if (Ce(i, o, s) >= 0) return !1;\n var a = i.x < o.x ? i.x < s.x ? i.x : s.x : o.x < s.x ? o.x : s.x,\n u = i.y < o.y ? i.y < s.y ? i.y : s.y : o.y < s.y ? o.y : s.y,\n c = i.x > o.x ? i.x > s.x ? i.x : s.x : o.x > s.x ? o.x : s.x,\n h = i.y > o.y ? i.y > s.y ? i.y : s.y : o.y > s.y ? o.y : s.y,\n l = Ie(a, u, e, n, r),\n p = Ie(c, h, e, n, r),\n f = t.nextZ;\n for (; f && f.z <= p;) {\n if (f !== t.prev && f !== t.next && Ne(i.x, i.y, o.x, o.y, s.x, s.y, f.x, f.y) && Ce(f.prev, f, f.next) >= 0) return !1;\n f = f.nextZ;\n }\n f = t.prevZ;\n for (; f && f.z >= l;) {\n if (f !== t.prev && f !== t.next && Ne(i.x, i.y, o.x, o.y, s.x, s.y, f.x, f.y) && Ce(f.prev, f, f.next) >= 0) return !1;\n f = f.prevZ;\n }\n return !0;\n }(t, r, i, o) : function (t) {\n var e = t.prev,\n n = t,\n r = t.next;\n if (Ce(e, n, r) >= 0) return !1;\n var i = t.next.next;\n for (; i !== t.prev;) {\n if (Ne(e.x, e.y, n.x, n.y, r.x, r.y, i.x, i.y) && Ce(i.prev, i, i.next) >= 0) return !1;\n i = i.next;\n }\n return !0;\n }(t)) e.push(a.i / n), e.push(t.i / n), e.push(u.i / n), Re(t), t = u.next, c = u.next;else if ((t = u) === c) {\n s ? 1 === s ? we(t = function (t, e, n) {\n var r = t;\n do {\n var i = r.prev,\n o = r.next.next;\n !Se(i, o) && Me(i, r, r.next, o) && Le(i, o) && Le(o, i) && (e.push(i.i / n), e.push(r.i / n), e.push(o.i / n), Re(r), Re(r.next), r = t = o), r = r.next;\n } while (r !== t);\n return r;\n }(t, e, n), e, n, r, i, o, 2) : 2 === s && function (t, e, n, r, i, o) {\n var s = t;\n do {\n for (var a = s.next.next; a !== s.prev;) {\n if (s.i !== a.i && function (t, e) {\n return t.next.i !== e.i && t.prev.i !== e.i && !function (t, e) {\n var n = t;\n do {\n if (n.i !== t.i && n.next.i !== t.i && n.i !== e.i && n.next.i !== e.i && Me(n, n.next, t, e)) return !0;\n n = n.next;\n } while (n !== t);\n return !1;\n }(t, e) && Le(t, e) && Le(e, t) && function (t, e) {\n var n = t,\n r = !1,\n i = (t.x + e.x) / 2,\n o = (t.y + e.y) / 2;\n do {\n n.y > o != n.next.y > o && n.next.y !== n.y && i < (n.next.x - n.x) * (o - n.y) / (n.next.y - n.y) + n.x && (r = !r), n = n.next;\n } while (n !== t);\n return r;\n }(t, e);\n }(s, a)) {\n var u = Pe(s, a);\n return s = Ee(s, s.next), u = Ee(u, u.next), we(s, e, n, r, i, o), void we(u, e, n, r, i, o);\n }\n a = a.next;\n }\n s = s.next;\n } while (s !== t);\n }(t, e, n, r, i, o) : we(Ee(t), e, n, r, i, o, 1);\n break;\n }\n }\n }\n function be(t, e) {\n return t.x - e.x;\n }\n function Ie(t, e, n, r, i) {\n return t = 32767 * (t - n) * i, e = 32767 * (e - r) * i, t = 16711935 & (t | t << 8), t = 252645135 & (t | t << 4), t = 858993459 & (t | t << 2), t = 1431655765 & (t | t << 1), e = 16711935 & (e | e << 8), e = 252645135 & (e | e << 4), e = 858993459 & (e | e << 2), e = 1431655765 & (e | e << 1), t | e << 1;\n }\n function Ne(t, e, n, r, i, o, s, a) {\n return (i - s) * (e - a) - (t - s) * (o - a) >= 0 && (t - s) * (r - a) - (n - s) * (e - a) >= 0 && (n - s) * (o - a) - (i - s) * (r - a) >= 0;\n }\n function Ce(t, e, n) {\n return (e.y - t.y) * (n.x - e.x) - (e.x - t.x) * (n.y - e.y);\n }\n function Se(t, e) {\n return t.x === e.x && t.y === e.y;\n }\n function Me(t, e, n, r) {\n return !!(Se(t, e) && Se(n, r) || Se(t, r) && Se(n, e)) || Ce(t, e, n) > 0 != Ce(t, e, r) > 0 && Ce(n, r, t) > 0 != Ce(n, r, e) > 0;\n }\n function Le(t, e) {\n return Ce(t.prev, t, t.next) < 0 ? Ce(t, e, t.next) >= 0 && Ce(t, t.prev, e) >= 0 : Ce(t, e, t.prev) < 0 || Ce(t, t.next, e) < 0;\n }\n function Pe(t, e) {\n var n = new Te(t.i, t.x, t.y),\n r = new Te(e.i, e.x, e.y),\n i = t.next,\n o = e.prev;\n return t.next = e, e.prev = t, n.next = i, i.prev = n, r.next = n, n.prev = r, o.next = r, r.prev = o, r;\n }\n function Oe(t, e, n, r) {\n var i = new Te(t, e, n);\n return r ? (i.next = r.next, i.prev = r, r.next.prev = i, r.next = i) : (i.prev = i, i.next = i), i;\n }\n function Re(t) {\n t.next.prev = t.prev, t.prev.next = t.next, t.prevZ && (t.prevZ.nextZ = t.nextZ), t.nextZ && (t.nextZ.prevZ = t.prevZ);\n }\n function Te(t, e, n) {\n this.i = t, this.x = e, this.y = n, this.prev = null, this.next = null, this.z = null, this.prevZ = null, this.nextZ = null, this.steiner = !1;\n }\n function Ae(t, e, n, r) {\n for (var i = 0, o = e, s = n - r; o < n; o += r) i += (t[s] - t[o]) * (t[o + 1] + t[s + 1]), s = o;\n return i;\n }\n function De(t) {\n var e = function (t) {\n for (var e = t[0][0].length, n = {\n vertices: [],\n holes: [],\n dimensions: e\n }, r = 0, i = 0; i < t.length; i++) {\n for (var o = 0; o < t[i].length; o++) for (var s = 0; s < e; s++) n.vertices.push(t[i][o][s]);\n i > 0 && (r += t[i - 1].length, n.holes.push(r));\n }\n return n;\n }(t),\n n = Is(e.vertices, e.holes, 2),\n r = [],\n i = [];\n n.forEach(function (t, r) {\n var o = n[r];\n i.push([e.vertices[2 * o], e.vertices[2 * o + 1]]);\n });\n for (var s = 0; s < i.length; s += 3) {\n var a = i.slice(s, s + 3);\n a.push(i[s]), r.push(o([a]));\n }\n return r;\n }\n function Fe(t, e) {\n if (!t) throw new Error(\"targetPoint is required\");\n if (!e) throw new Error(\"points is required\");\n var n,\n r = 1 / 0;\n return O(e, function (e, i) {\n var o = qt(t, e);\n o < r && ((n = Gt(e)).properties.featureIndex = i, n.properties.distanceToPoint = o, r = o);\n }), n;\n }\n function qe(t, e, n, r, i) {\n Ge(t, e, n || 0, r || t.length - 1, i || function (t, e) {\n return t < e ? -1 : t > e ? 1 : 0;\n });\n }\n function Ge(t, e, n, r, i) {\n for (; r > n;) {\n if (r - n > 600) {\n var o = r - n + 1,\n s = e - n + 1,\n a = Math.log(o),\n u = .5 * Math.exp(2 * a / 3),\n c = .5 * Math.sqrt(a * u * (o - u) / o) * (s - o / 2 < 0 ? -1 : 1);\n Ge(t, e, Math.max(n, Math.floor(e - s * u / o + c)), Math.min(r, Math.floor(e + (o - s) * u / o + c)), i);\n }\n var h = t[e],\n l = n,\n p = r;\n for (Be(t, n, e), i(t[r], h) > 0 && Be(t, n, r); l < p;) {\n for (Be(t, l, p), l++, p--; i(t[l], h) < 0;) l++;\n for (; i(t[p], h) > 0;) p--;\n }\n 0 === i(t[n], h) ? Be(t, n, p) : Be(t, ++p, r), p <= e && (n = p + 1), e <= p && (r = p - 1);\n }\n }\n function Be(t, e, n) {\n var r = t[e];\n t[e] = t[n], t[n] = r;\n }\n function ke(t, e) {\n if (!(this instanceof ke)) return new ke(t, e);\n this._maxEntries = Math.max(4, t || 9), this._minEntries = Math.max(2, Math.ceil(.4 * this._maxEntries)), e && this._initFormat(e), this.clear();\n }\n function ze(t, e) {\n je(t, 0, t.children.length, e, t);\n }\n function je(t, e, n, r, i) {\n i || (i = Ze(null)), i.minX = 1 / 0, i.minY = 1 / 0, i.maxX = -1 / 0, i.maxY = -1 / 0;\n for (var o, s = e; s < n; s++) o = t.children[s], Xe(i, t.leaf ? r(o) : o);\n return i;\n }\n function Xe(t, e) {\n return t.minX = Math.min(t.minX, e.minX), t.minY = Math.min(t.minY, e.minY), t.maxX = Math.max(t.maxX, e.maxX), t.maxY = Math.max(t.maxY, e.maxY), t;\n }\n function Ue(t, e) {\n return t.minX - e.minX;\n }\n function Ye(t, e) {\n return t.minY - e.minY;\n }\n function Ve(t) {\n return (t.maxX - t.minX) * (t.maxY - t.minY);\n }\n function He(t) {\n return t.maxX - t.minX + (t.maxY - t.minY);\n }\n function We(t, e) {\n return t.minX <= e.minX && t.minY <= e.minY && e.maxX <= t.maxX && e.maxY <= t.maxY;\n }\n function Je(t, e) {\n return e.minX <= t.maxX && e.minY <= t.maxY && e.maxX >= t.minX && e.maxY >= t.minY;\n }\n function Ze(t) {\n return {\n children: t,\n height: 1,\n leaf: !0,\n minX: 1 / 0,\n minY: 1 / 0,\n maxX: -1 / 0,\n maxY: -1 / 0\n };\n }\n function Ke(t, e, n, r, i) {\n for (var o, s = [e, n]; s.length;) (n = s.pop()) - (e = s.pop()) <= r || (qe(t, o = e + Math.ceil((n - e) / r / 2) * r, e, n, i), s.push(e, o, o, n));\n }\n function Qe(t) {\n var e = ke(t);\n return e.insert = function (t) {\n if (Array.isArray(t)) {\n var e = t;\n (t = $e(e)).bbox = e;\n } else t.bbox = t.bbox ? t.bbox : tn(t);\n return ke.prototype.insert.call(this, t);\n }, e.load = function (t) {\n var e = [];\n return Array.isArray(t) ? t.forEach(function (t) {\n var n = $e(t);\n n.bbox = t, e.push(n);\n }) : O(t, function (t) {\n t.bbox = t.bbox ? t.bbox : tn(t), e.push(t);\n }), ke.prototype.load.call(this, e);\n }, e.remove = function (t) {\n if (Array.isArray(t)) {\n var e = t;\n (t = $e(e)).bbox = e;\n }\n return ke.prototype.remove.call(this, t);\n }, e.clear = function () {\n return ke.prototype.clear.call(this);\n }, e.search = function (t) {\n return {\n type: \"FeatureCollection\",\n features: ke.prototype.search.call(this, this.toBBox(t))\n };\n }, e.collides = function (t) {\n return ke.prototype.collides.call(this, this.toBBox(t));\n }, e.all = function () {\n return {\n type: \"FeatureCollection\",\n features: ke.prototype.all.call(this)\n };\n }, e.toJSON = function () {\n return ke.prototype.toJSON.call(this);\n }, e.fromJSON = function (t) {\n return ke.prototype.fromJSON.call(this, t);\n }, e.toBBox = function (t) {\n var e;\n return e = t.bbox ? t.bbox : Array.isArray(t) && 4 === t.length ? t : tn(t), {\n minX: e[0],\n minY: e[1],\n maxX: e[2],\n maxY: e[3]\n };\n }, e;\n }\n function $e(t) {\n var e = [t[0], t[1]],\n n = [t[0], t[3]],\n r = [t[2], t[3]];\n return {\n type: \"Feature\",\n bbox: t,\n properties: {},\n geometry: {\n type: \"Polygon\",\n coordinates: [[e, [t[2], t[1]], r, n, e]]\n }\n };\n }\n function tn(t) {\n var e = [1 / 0, 1 / 0, -1 / 0, -1 / 0];\n return S(t, function (t) {\n e[0] > t[0] && (e[0] = t[0]), e[1] > t[1] && (e[1] = t[1]), e[2] < t[0] && (e[2] = t[0]), e[3] < t[1] && (e[3] = t[1]);\n }), e;\n }\n function en(t) {\n if (!t) throw new Error(\"geojson is required\");\n var e = [];\n return F(t, function (t) {\n !function (t, e) {\n var n = [],\n r = t.geometry;\n switch (r.type) {\n case \"Polygon\":\n n = U(r);\n break;\n case \"LineString\":\n n = [U(r)];\n }\n n.forEach(function (n) {\n var r = function (t, e) {\n var n = [];\n return t.reduce(function (t, r) {\n var i = a([t, r], e);\n return i.bbox = function (t, e) {\n var n = t[0],\n r = t[1],\n i = e[0],\n o = e[1];\n return [n < i ? n : i, r < o ? r : o, n > i ? n : i, r > o ? r : o];\n }(t, r), n.push(i), r;\n }), n;\n }(n, t.properties);\n r.forEach(function (t) {\n t.id = e.length, e.push(t);\n });\n });\n }(t, e);\n }), c(e);\n }\n function nn(t, n) {\n var r = {},\n i = [];\n if (\"LineString\" === t.type && (t = e(t)), \"LineString\" === n.type && (n = e(n)), \"Feature\" === t.type && \"Feature\" === n.type && \"LineString\" === t.geometry.type && \"LineString\" === n.geometry.type && 2 === t.geometry.coordinates.length && 2 === n.geometry.coordinates.length) {\n var o = rn(t, n);\n return o && i.push(o), c(i);\n }\n var s = Qe();\n return s.load(en(n)), O(en(t), function (t) {\n O(s.search(t), function (e) {\n var n = rn(t, e);\n if (n) {\n var o = U(n).join(\",\");\n r[o] || (r[o] = !0, i.push(n));\n }\n });\n }), c(i);\n }\n function rn(t, e) {\n var n = U(t),\n i = U(e);\n if (2 !== n.length) throw new Error(\" line1 must only contain 2 coordinates\");\n if (2 !== i.length) throw new Error(\" line2 must only contain 2 coordinates\");\n var o = n[0][0],\n s = n[0][1],\n a = n[1][0],\n u = n[1][1],\n c = i[0][0],\n h = i[0][1],\n l = i[1][0],\n p = i[1][1],\n f = (p - h) * (a - o) - (l - c) * (u - s),\n g = (l - c) * (s - h) - (p - h) * (o - c),\n d = (a - o) * (s - h) - (u - s) * (o - c);\n if (0 === f) return null;\n var y = g / f,\n _ = d / f;\n if (y >= 0 && y <= 1 && _ >= 0 && _ <= 1) {\n return r([o + y * (a - o), s + y * (u - s)]);\n }\n return null;\n }\n function on(t, e, n) {\n if (n = n || {}, !I(n)) throw new Error(\"options is invalid\");\n var i = t.geometry ? t.geometry.type : t.type;\n if (\"LineString\" !== i && \"MultiLineString\" !== i) throw new Error(\"lines must be LineString or MultiLineString\");\n var o = r([1 / 0, 1 / 0], {\n dist: 1 / 0\n }),\n s = 0;\n return F(t, function (t) {\n for (var i = U(t), u = 0; u < i.length - 1; u++) {\n var c = r(i[u]);\n c.properties.dist = qt(e, c, n);\n var h = r(i[u + 1]);\n h.properties.dist = qt(e, h, n);\n var l = qt(c, h, n),\n p = Math.max(c.properties.dist, h.properties.dist),\n f = ge(c, h),\n g = pe(e, p, f + 90, n),\n d = pe(e, p, f - 90, n),\n y = nn(a([g.geometry.coordinates, d.geometry.coordinates]), a([c.geometry.coordinates, h.geometry.coordinates])),\n _ = null;\n y.features.length > 0 && ((_ = y.features[0]).properties.dist = qt(e, _, n), _.properties.location = s + qt(c, _, n)), c.properties.dist < o.properties.dist && ((o = c).properties.index = u, o.properties.location = s), h.properties.dist < o.properties.dist && ((o = h).properties.index = u + 1, o.properties.location = s + l), _ && _.properties.dist < o.properties.dist && ((o = _).properties.index = u), s += l;\n }\n }), o;\n }\n function sn(t, e, n) {\n if (n = n || {}, !I(n)) throw new Error(\"options is invalid\");\n var r = n.final;\n if (!t) throw new Error(\"start point is required\");\n if (!e) throw new Error(\"end point is required\");\n var i;\n return (i = r ? an(X(e), X(t)) : an(X(t), X(e))) > 180 ? -(360 - i) : i;\n }\n function an(t, e) {\n var n = x(t[1]),\n r = x(e[1]),\n i = x(e[0] - t[0]);\n i > Math.PI && (i -= 2 * Math.PI), i < -Math.PI && (i += 2 * Math.PI);\n var o = Math.log(Math.tan(r / 2 + Math.PI / 4) / Math.tan(n / 2 + Math.PI / 4));\n return (v(Math.atan2(i, o)) + 360) % 360;\n }\n function un(t, e, n) {\n if (n = n || {}, !I(n)) throw new Error(\"options is invalid\");\n var r = n.units;\n if (!t) throw new Error(\"from point is required\");\n if (!e) throw new Error(\"to point is required\");\n var i = X(t),\n o = X(e);\n o[0] += o[0] - i[0] > 180 ? -360 : i[0] - o[0] > 180 ? 360 : 0;\n return E(function (t, e, n) {\n var r = n = void 0 === n ? Fo : Number(n),\n i = t[1] * Math.PI / 180,\n o = e[1] * Math.PI / 180,\n s = o - i,\n a = Math.abs(e[0] - t[0]) * Math.PI / 180;\n a > Math.PI && (a -= 2 * Math.PI);\n var u = Math.log(Math.tan(o / 2 + Math.PI / 4) / Math.tan(i / 2 + Math.PI / 4)),\n c = Math.abs(u) > 1e-11 ? s / u : Math.cos(i);\n return Math.sqrt(s * s + c * c * a * a) * r;\n }(i, o), \"meters\", r);\n }\n function cn(t, e) {\n return ln(t, \"mercator\", e);\n }\n function hn(t, e) {\n return ln(t, \"wgs84\", e);\n }\n function ln(t, e, n) {\n if (n = n || {}, !I(n)) throw new Error(\"options is invalid\");\n var r = n.mutate;\n if (!t) throw new Error(\"geojson is required\");\n return Array.isArray(t) && b(t[0]) ? t = \"mercator\" === e ? pn(t) : fn(t) : (!0 !== r && (t = Gt(t)), S(t, function (t) {\n var n = \"mercator\" === e ? pn(t) : fn(t);\n t[0] = n[0], t[1] = n[1];\n })), t;\n }\n function pn(t) {\n var e = Math.PI / 180,\n n = 20037508.342789244,\n r = [6378137 * (Math.abs(t[0]) <= 180 ? t[0] : t[0] - 360 * function (t) {\n return t < 0 ? -1 : t > 0 ? 1 : 0;\n }(t[0])) * e, 6378137 * Math.log(Math.tan(.25 * Math.PI + .5 * t[1] * e))];\n return r[0] > n && (r[0] = n), r[0] < -n && (r[0] = -n), r[1] > n && (r[1] = n), r[1] < -n && (r[1] = -n), r;\n }\n function fn(t) {\n var e = 180 / Math.PI;\n return [t[0] * e / 6378137, (.5 * Math.PI - 2 * Math.atan(Math.exp(-t[1] / 6378137))) * e];\n }\n function gn(t, n, i) {\n if (i = i || {}, !I(i)) throw new Error(\"options is invalid\");\n if (!t) throw new Error(\"pt is required\");\n if (Array.isArray(t) ? t = r(t) : \"Point\" === t.type ? t = e(t) : H(t, \"Point\", \"point\"), !n) throw new Error(\"line is required\");\n Array.isArray(n) ? n = a(n) : \"LineString\" === n.type ? n = e(n) : H(n, \"LineString\", \"line\");\n var o = 1 / 0,\n s = t.geometry.coordinates;\n return G(n, function (t) {\n var e = t.geometry.coordinates[0],\n n = t.geometry.coordinates[1],\n a = function (t, e, n, i) {\n var o = i.mercator,\n s = !0 !== o ? qt(e, t, i) : dn(e, t, i),\n a = m(!0 !== o ? ge(e, t) : sn(e, t)),\n u = m(!0 !== o ? ge(e, n) : sn(e, n)),\n c = Math.abs(a - u);\n if (c > 90) return s;\n var h = (u + 180) % 360,\n l = m(!0 !== o ? ge(n, t) : sn(n, t)),\n p = Math.abs(l - h);\n p > 180 && (p = Math.abs(p - 360));\n return p > 90 ? !0 !== o ? qt(t, n, i) : dn(t, n, i) : !0 !== o ? s * Math.sin(x(c)) : function (t, e, n, i) {\n var o = 0;\n (Math.abs(t[0]) >= 180 || Math.abs(e[0]) >= 180 || Math.abs(n[0]) >= 180) && (o = t[0] > 0 || e[0] > 0 || n[0] > 0 ? -180 : 180);\n var s = r(n),\n a = cn([t[0] + o, t[1]]),\n u = cn([e[0] + o, e[1]]),\n c = cn([n[0] + o, n[1]]),\n h = hn(function (t, e, n) {\n var r = t[0],\n i = t[1],\n o = e[0],\n s = e[1],\n a = n[0],\n u = n[1],\n c = o - r,\n h = s - i,\n l = ((a - r) * c + (u - i) * h) / (c * c + h * h);\n return [r + l * c, i + l * h];\n }(a, u, c));\n return 0 !== o && (h[0] -= o), un(s, h, i);\n }(e, n, t, i);\n }(s, e, n, i);\n o > a && (o = a);\n }), o;\n }\n function dn(t, e, n) {\n var r = n.units,\n i = 0;\n Math.abs(t[0]) >= 180 && (i = t[0] > 0 ? -180 : 180), Math.abs(e[0]) >= 180 && (i = e[0] > 0 ? -180 : 180);\n var o = cn([t[0] + i, t[1]]),\n s = cn([e[0] + i, e[1]]),\n a = function (t) {\n return t * t;\n },\n u = a(o[0] - s[0]) + a(o[1] - s[1]);\n return E(Math.sqrt(u), \"meters\", r);\n }\n function yn(t) {\n for (var n = function (t) {\n if (\"FeatureCollection\" !== t.type) return \"Feature\" !== t.type ? c([e(t)]) : c([t]);\n return t;\n }(t), i = de(n), o = !1, s = 0; !o && s < n.features.length;) {\n var a,\n u = n.features[s].geometry,\n h = !1;\n if (\"Point\" === u.type) i.geometry.coordinates[0] === u.coordinates[0] && i.geometry.coordinates[1] === u.coordinates[1] && (o = !0);else if (\"MultiPoint\" === u.type) {\n var l = !1;\n for (a = 0; !l && a < u.coordinates.length;) i.geometry.coordinates[0] === u.coordinates[a][0] && i.geometry.coordinates[1] === u.coordinates[a][1] && (o = !0, l = !0), a++;\n } else if (\"LineString\" === u.type) for (a = 0; !h && a < u.coordinates.length - 1;) _n(i.geometry.coordinates[0], i.geometry.coordinates[1], u.coordinates[a][0], u.coordinates[a][1], u.coordinates[a + 1][0], u.coordinates[a + 1][1]) && (h = !0, o = !0), a++;else if (\"MultiLineString\" === u.type) for (var p = 0; p < u.coordinates.length;) {\n h = !1, a = 0;\n for (var f = u.coordinates[p]; !h && a < f.length - 1;) _n(i.geometry.coordinates[0], i.geometry.coordinates[1], f[a][0], f[a][1], f[a + 1][0], f[a + 1][1]) && (h = !0, o = !0), a++;\n p++;\n } else \"Polygon\" !== u.type && \"MultiPolygon\" !== u.type || Pt(i, u) && (o = !0);\n s++;\n }\n if (o) return i;\n var g = c([]);\n for (s = 0; s < n.features.length; s++) g.features = g.features.concat(me(n.features[s]).features);\n return r(Fe(i, g).geometry.coordinates);\n }\n function _n(t, e, n, r, i, o) {\n return Math.sqrt((i - n) * (i - n) + (o - r) * (o - r)) === Math.sqrt((t - n) * (t - n) + (e - r) * (e - r)) + Math.sqrt((i - t) * (i - t) + (o - e) * (o - e));\n }\n function mn(t) {\n return D(t, function (t, e) {\n return t + vn(e);\n }, 0);\n }\n function vn(t) {\n var e,\n n = 0;\n switch (t.type) {\n case \"Polygon\":\n return xn(t.coordinates);\n case \"MultiPolygon\":\n for (e = 0; e < t.coordinates.length; e++) n += xn(t.coordinates[e]);\n return n;\n case \"Point\":\n case \"MultiPoint\":\n case \"LineString\":\n case \"MultiLineString\":\n return 0;\n case \"GeometryCollection\":\n for (e = 0; e < t.geometries.length; e++) n += vn(t.geometries[e]);\n return n;\n }\n }\n function xn(t) {\n var e = 0;\n if (t && t.length > 0) {\n e += Math.abs(En(t[0]));\n for (var n = 1; n < t.length; n++) e -= Math.abs(En(t[n]));\n }\n return e;\n }\n function En(t) {\n var e,\n n,\n r,\n i,\n o,\n s,\n a = 0,\n u = t.length;\n if (u > 2) {\n for (s = 0; s < u; s++) s === u - 2 ? (r = u - 2, i = u - 1, o = 0) : s === u - 1 ? (r = u - 1, i = 0, o = 1) : (r = s, i = s + 1, o = s + 2), e = t[r], n = t[i], a += (wn(t[o][0]) - wn(e[0])) * Math.sin(wn(n[1]));\n a = a * Ss * Ss / 2;\n }\n return a;\n }\n function wn(t) {\n return t * Math.PI / 180;\n }\n function bn(t, e) {\n if (e = e || {}, !I(e)) throw new Error(\"options is invalid\");\n if (!t) throw new Error(\"geojson is required\");\n return B(t, function (t, n) {\n var r = n.geometry.coordinates;\n return t + qt(r[0], r[1], e);\n }, 0);\n }\n function In(t, e, n, r) {\n if (r = r || {}, !I(r)) throw new Error(\"options is invalid\");\n var i,\n o = [];\n if (\"Feature\" === t.type) i = t.geometry.coordinates;else {\n if (\"LineString\" !== t.type) throw new Error(\"input must be a LineString Feature or Geometry\");\n i = t.coordinates;\n }\n for (var s, u, c, h = 0, l = 0; l < i.length && !(e >= h && l === i.length - 1); l++) {\n if (h > e && 0 === o.length) {\n if (!(s = e - h)) return o.push(i[l]), a(o);\n u = ge(i[l], i[l - 1]) - 180, c = pe(i[l], s, u, r), o.push(c.geometry.coordinates);\n }\n if (h >= n) return (s = n - h) ? (u = ge(i[l], i[l - 1]) - 180, c = pe(i[l], s, u, r), o.push(c.geometry.coordinates), a(o)) : (o.push(i[l]), a(o));\n if (h >= e && o.push(i[l]), l === i.length - 1) return a(o);\n h += qt(i[l], i[l + 1], r);\n }\n return a(i[i.length - 1]);\n }\n function Nn(t, e, n) {\n var r = (n = n || {}).ignoreEndVertices;\n if (!I(n)) throw new Error(\"invalid options\");\n if (!t) throw new Error(\"pt is required\");\n if (!e) throw new Error(\"line is required\");\n for (var i = X(t), o = U(e), s = 0; s < o.length - 1; s++) {\n var a = !1;\n if (r && (0 === s && (a = \"start\"), s === o.length - 2 && (a = \"end\"), 0 === s && s + 1 === o.length - 1 && (a = \"both\")), function (t, e, n, r) {\n var i = n[0],\n o = n[1],\n s = t[0],\n a = t[1],\n u = e[0],\n c = e[1],\n h = n[0] - s,\n l = n[1] - a,\n p = u - s,\n f = c - a;\n if (h * f - l * p != 0) return !1;\n {\n if (!r) return Math.abs(p) >= Math.abs(f) ? p > 0 ? s <= i && i <= u : u <= i && i <= s : f > 0 ? a <= o && o <= c : c <= o && o <= a;\n if (\"start\" === r) return Math.abs(p) >= Math.abs(f) ? p > 0 ? s < i && i <= u : u <= i && i < s : f > 0 ? a < o && o <= c : c <= o && o < a;\n if (\"end\" === r) return Math.abs(p) >= Math.abs(f) ? p > 0 ? s <= i && i < u : u < i && i <= s : f > 0 ? a <= o && o < c : c < o && o <= a;\n if (\"both\" === r) return Math.abs(p) >= Math.abs(f) ? p > 0 ? s < i && i < u : u < i && i < s : f > 0 ? a < o && o < c : c < o && o < a;\n }\n }(o[s], o[s + 1], i, a)) return !0;\n }\n return !1;\n }\n function Cn(t, e) {\n var n = K(t),\n r = K(e),\n i = J(t),\n o = J(e);\n switch (n) {\n case \"Point\":\n switch (r) {\n case \"MultiPoint\":\n return function (t, e) {\n var n,\n r = !1;\n for (n = 0; n < e.coordinates.length; n++) if (Mn(e.coordinates[n], t.coordinates)) {\n r = !0;\n break;\n }\n return r;\n }(i, o);\n case \"LineString\":\n return Nn(i, o, {\n ignoreEndVertices: !0\n });\n case \"Polygon\":\n return Pt(i, o, {\n ignoreBoundary: !0\n });\n default:\n throw new Error(\"feature2 \" + r + \" geometry not supported\");\n }\n case \"MultiPoint\":\n switch (r) {\n case \"MultiPoint\":\n return function (t, e) {\n for (var n = 0; n < t.coordinates.length; n++) {\n for (var r = !1, i = 0; i < e.coordinates.length; i++) Mn(t.coordinates[n], e.coordinates[i]) && (r = !0);\n if (!r) return !1;\n }\n return !0;\n }(i, o);\n case \"LineString\":\n return function (t, e) {\n for (var n = !1, r = 0; r < t.coordinates.length; r++) {\n if (!Nn(t.coordinates[r], e)) return !1;\n n || (n = Nn(t.coordinates[r], e, {\n ignoreEndVertices: !0\n }));\n }\n return n;\n }(i, o);\n case \"Polygon\":\n return function (t, e) {\n for (var n = !0, r = 0; r < t.coordinates.length; r++) {\n var i = Pt(t.coordinates[1], e);\n if (!i) {\n n = !1;\n break;\n }\n i = Pt(t.coordinates[1], e, {\n ignoreBoundary: !0\n });\n }\n return n && i;\n }(i, o);\n default:\n throw new Error(\"feature2 \" + r + \" geometry not supported\");\n }\n case \"LineString\":\n switch (r) {\n case \"LineString\":\n return function (t, e) {\n for (var n = 0; n < t.coordinates.length; n++) if (!Nn(t.coordinates[n], e)) return !1;\n return !0;\n }(i, o);\n case \"Polygon\":\n return function (t, e) {\n var n = j(e),\n r = j(t);\n if (!Sn(n, r)) return !1;\n for (var i = !1, o = 0; o < t.coordinates.length - 1; o++) {\n if (!Pt(t.coordinates[o], e)) return !1;\n if (i || (i = Pt(t.coordinates[o], e, {\n ignoreBoundary: !0\n })), !i) {\n var s = function (t, e) {\n return [(t[0] + e[0]) / 2, (t[1] + e[1]) / 2];\n }(t.coordinates[o], t.coordinates[o + 1]);\n i = Pt(s, e, {\n ignoreBoundary: !0\n });\n }\n }\n return i;\n }(i, o);\n default:\n throw new Error(\"feature2 \" + r + \" geometry not supported\");\n }\n case \"Polygon\":\n switch (r) {\n case \"Polygon\":\n return function (t, e) {\n var n = j(t);\n if (!Sn(j(e), n)) return !1;\n for (var r = 0; r < t.coordinates[0].length; r++) if (!Pt(t.coordinates[0][r], e)) return !1;\n return !0;\n }(i, o);\n default:\n throw new Error(\"feature2 \" + r + \" geometry not supported\");\n }\n default:\n throw new Error(\"feature1 \" + n + \" geometry not supported\");\n }\n }\n function Sn(t, e) {\n return !(t[0] > e[0]) && !(t[2] < e[2]) && !(t[1] > e[1]) && !(t[3] < e[3]);\n }\n function Mn(t, e) {\n return t[0] === e[0] && t[1] === e[1];\n }\n function Ln(t, e, n) {\n if (n = n || {}, !I(n)) throw new Error(\"options is invalid\");\n var i = n.mask,\n o = n.properties,\n s = [];\n if (null === e || void 0 === e) throw new Error(\"cellSide is required\");\n if (!b(e)) throw new Error(\"cellSide is invalid\");\n if (!t) throw new Error(\"bbox is required\");\n if (!Array.isArray(t)) throw new Error(\"bbox must be array\");\n if (4 !== t.length) throw new Error(\"bbox must contain 4 numbers\");\n if (i && -1 === [\"Polygon\", \"MultiPolygon\"].indexOf(K(i))) throw new Error(\"options.mask must be a (Multi)Polygon\");\n for (var a = t[0], u = t[1], h = t[2], l = t[3], p = e / qt([a, u], [h, u], n) * (h - a), f = e / qt([a, u], [a, l], n) * (l - u), g = h - a, d = l - u, y = Math.floor(g / p), _ = (d - Math.floor(d / f) * f) / 2, m = a + (g - y * p) / 2; m <= h;) {\n for (var v = u + _; v <= l;) {\n var x = r([m, v], o);\n i ? Cn(x, i) && s.push(x) : s.push(x), v += f;\n }\n m += p;\n }\n return c(s);\n }\n function Pn(t, e) {\n if (e = e || {}, !I(e)) throw new Error(\"options is invalid\");\n var n = e.precision,\n r = e.coordinates,\n i = e.mutate;\n if (n = void 0 === n || null === n || isNaN(n) ? 6 : n, r = void 0 === r || null === r || isNaN(r) ? 3 : r, !t) throw new Error(\" is required\");\n if (\"number\" != typeof n) throw new Error(\" must be a number\");\n if (\"number\" != typeof r) throw new Error(\" must be a number\");\n !1 !== i && void 0 !== i || (t = JSON.parse(JSON.stringify(t)));\n var o = Math.pow(10, n);\n return S(t, function (t) {\n !function (t, e, n) {\n t.length > n && t.splice(n, t.length);\n for (var r = 0; r < t.length; r++) t[r] = Math.round(t[r] * e) / e;\n }(t, o, r);\n }), t;\n }\n function On(t, e) {\n if (!t || !e) return !1;\n if (t.length !== e.length) return !1;\n for (var n = 0, r = t.length; n < r; n++) if (t[n] instanceof Array && e[n] instanceof Array) {\n if (!On(t[n], e[n])) return !1;\n } else if (t[n] !== e[n]) return !1;\n return !0;\n }\n function Rn(t, e) {\n if (void 0 === e && (e = !0), 3 != t.length) throw new Error(\"This function requires an array of three points [x,y]\");\n return (t[1][0] - t[0][0]) * (t[2][1] - t[0][1]) - (t[1][1] - t[0][1]) * (t[2][0] - t[0][0]) >= 0 == e;\n }\n function Tn(t, e) {\n if (!t || !e) return !1;\n if (t.length != e.length) return !1;\n for (var n = 0, r = t.length; n < r; n++) if (t[n] instanceof Array && e[n] instanceof Array) {\n if (!Tn(t[n], e[n])) return !1;\n } else if (t[n] != e[n]) return !1;\n return !0;\n }\n function An(t, e) {\n var n = [],\n r = Qe();\n return F(e, function (e) {\n if (n.forEach(function (t, e) {\n t.id = e;\n }), n.length) {\n var i = r.search(e);\n if (i.features.length) {\n var o = Fn(e, i);\n n = n.filter(function (t) {\n return t.id !== o.id;\n }), r.remove(o), O(Dn(o, e), function (t) {\n n.push(t), r.insert(t);\n });\n }\n } else (n = Dn(t, e).features).forEach(function (t) {\n t.bbox || (t.bbox = le(j(t)));\n }), r.load(c(n));\n }), c(n);\n }\n function Dn(t, e) {\n var n = [],\n r = U(t)[0],\n i = U(t)[t.geometry.coordinates.length - 1];\n if (qn(r, X(e)) || qn(i, X(e))) return c([t]);\n var o = Qe(),\n s = en(t);\n o.load(s);\n var u = o.search(e);\n if (!u.features.length) return c([t]);\n var h = Fn(e, u),\n l = R(s, function (t, r, i) {\n var o = U(r)[1],\n s = X(e);\n return i === h.id ? (t.push(s), n.push(a(t)), qn(s, o) ? [s] : [s, o]) : (t.push(o), t);\n }, [r]);\n return l.length > 1 && n.push(a(l)), c(n);\n }\n function Fn(t, e) {\n if (!e.features.length) throw new Error(\"lines must contain features\");\n if (1 === e.features.length) return e.features[0];\n var n,\n r = 1 / 0;\n return O(e, function (e) {\n var i = on(e, t).properties.dist;\n i < r && (n = e, r = i);\n }), n;\n }\n function qn(t, e) {\n return t[0] === e[0] && t[1] === e[1];\n }\n function Gn(t, e, n, r, i) {\n if (i = i || {}, !I(i)) throw new Error(\"options is invalid\");\n var o = i.steps,\n s = i.units;\n if (!t) throw new Error(\"center is required\");\n if (!e) throw new Error(\"radius is required\");\n if (void 0 === n || null === n) throw new Error(\"bearing1 is required\");\n if (void 0 === r || null === r) throw new Error(\"bearing2 is required\");\n if (\"object\" != typeof i) throw new Error(\"options must be an object\");\n o = o || 64;\n var u = Bn(n),\n c = Bn(r),\n h = t.properties;\n if (u === c) return a(fe(t, e, i).geometry.coordinates[0], h);\n for (var l = u, p = u < c ? c : c + 360, f = l, g = [], d = 0; f < p;) g.push(pe(t, e, f, s).geometry.coordinates), f = l + 360 * ++d / o;\n return f > p && g.push(pe(t, e, p, s).geometry.coordinates), a(g, h);\n }\n function Bn(t) {\n var e = t % 360;\n return e < 0 && (e += 360), e;\n }\n function kn(t, e) {\n if (e = e || {}, !I(e)) throw new Error(\"options is invalid\");\n var n = e.properties,\n r = K(t),\n i = U(t);\n if (n = n || t.properties || {}, !i.length) throw new Error(\"polygon must contain coordinates\");\n switch (r) {\n case \"Polygon\":\n return zn(i, n);\n case \"MultiPolygon\":\n var o = [];\n return i.forEach(function (t) {\n o.push(zn(t, n));\n }), c(o);\n default:\n throw new Error(\"geom \" + r + \" not supported\");\n }\n }\n function zn(t, e) {\n return t.length > 1 ? h(t, e) : a(t[0], e);\n }\n function jn(t, e) {\n if (e = e || {}, !I(e)) throw new Error(\"options is invalid\");\n var n = e.properties,\n r = e.autoComplete,\n i = e.orderCoords;\n if (!t) throw new Error(\"lines is required\");\n r = void 0 === r || r, i = void 0 === i || i;\n switch (K(t)) {\n case \"FeatureCollection\":\n case \"GeometryCollection\":\n var o = [];\n return (t.features ? t.features : t.geometries).forEach(function (t) {\n o.push(U(Xn(t, {}, r, i)));\n }), p(o, n);\n }\n return Xn(t, n, r, i);\n }\n function Xn(t, e, n, r) {\n e = e || t.properties || {};\n var i = U(t),\n s = K(t);\n if (!i.length) throw new Error(\"line must contain coordinates\");\n switch (s) {\n case \"LineString\":\n return n && (i = Un(i)), o([i], e);\n case \"MultiLineString\":\n var u = [],\n c = 0;\n return i.forEach(function (t) {\n if (n && (t = Un(t)), r) {\n var e = function (t) {\n var e = t[0],\n n = t[1],\n r = t[2],\n i = t[3];\n return Math.abs(e - r) * Math.abs(n - i);\n }(j(a(t)));\n e > c ? (u.unshift(t), c = e) : u.push(t);\n } else u.push(t);\n }), o(u, e);\n default:\n throw new Error(\"geometry type \" + s + \" is not supported\");\n }\n }\n function Un(t) {\n var e = t[0],\n n = e[0],\n r = e[1],\n i = t[t.length - 1],\n o = i[0],\n s = i[1];\n return n === o && r === s || t.push(e), t;\n }\n function Yn(t, e, n) {\n var r,\n i,\n o,\n s,\n a,\n u = t.length,\n c = Hn(t[0], e),\n h = [];\n for (n || (n = []), r = 1; r < u; r++) {\n for (i = t[r - 1], s = a = Hn(o = t[r], e);;) {\n if (!(c | s)) {\n h.push(i), s !== a ? (h.push(o), r < u - 1 && (n.push(h), h = [])) : r === u - 1 && h.push(o);\n break;\n }\n if (c & s) break;\n c ? c = Hn(i = Vn(i, o, c, e), e) : s = Hn(o = Vn(i, o, s, e), e);\n }\n c = a;\n }\n return h.length && n.push(h), n;\n }\n function Vn(t, e, n, r) {\n return 8 & n ? [t[0] + (e[0] - t[0]) * (r[3] - t[1]) / (e[1] - t[1]), r[3]] : 4 & n ? [t[0] + (e[0] - t[0]) * (r[1] - t[1]) / (e[1] - t[1]), r[1]] : 2 & n ? [r[2], t[1] + (e[1] - t[1]) * (r[2] - t[0]) / (e[0] - t[0])] : 1 & n ? [r[0], t[1] + (e[1] - t[1]) * (r[0] - t[0]) / (e[0] - t[0])] : null;\n }\n function Hn(t, e) {\n var n = 0;\n return t[0] < e[0] ? n |= 1 : t[0] > e[2] && (n |= 2), t[1] < e[1] ? n |= 4 : t[1] > e[3] && (n |= 8), n;\n }\n function Wn(t, e) {\n for (var n = [], r = 0; r < t.length; r++) {\n var i = Gs.polygon(t[r], e);\n i.length > 0 && (i[0][0] === i[i.length - 1][0] && i[0][1] === i[i.length - 1][1] || i.push(i[0]), i.length >= 4 && n.push(i));\n }\n return n;\n }\n function Jn(t) {\n return \"[object Arguments]\" === Object.prototype.toString.call(t);\n }\n function Zn(t, e, n) {\n return n || (n = {}), t === e || (t instanceof Date && e instanceof Date ? t.getTime() === e.getTime() : !t || !e || \"object\" != typeof t && \"object\" != typeof e ? (n.strict, t === e) : function (t, e, n) {\n var r, i;\n if (Kn(t) || Kn(e)) return !1;\n if (t.prototype !== e.prototype) return !1;\n if (Jn(t)) return !!Jn(e) && (t = Bs.call(t), e = Bs.call(e), Zn(t, e, n));\n if (Qn(t)) {\n if (!Qn(e)) return !1;\n if (t.length !== e.length) return !1;\n for (r = 0; r < t.length; r++) if (t[r] !== e[r]) return !1;\n return !0;\n }\n try {\n var o = Object.keys(t),\n s = Object.keys(e);\n } catch (t) {\n return !1;\n }\n if (o.length !== s.length) return !1;\n for (o.sort(), s.sort(), r = o.length - 1; r >= 0; r--) if (o[r] !== s[r]) return !1;\n for (r = o.length - 1; r >= 0; r--) if (i = o[r], !Zn(t[i], e[i], n)) return !1;\n return typeof t == typeof e;\n }(t, e, n));\n }\n function Kn(t) {\n return null === t || void 0 === t;\n }\n function Qn(t) {\n return !(!t || \"object\" != typeof t || \"number\" != typeof t.length) && \"function\" == typeof t.copy && \"function\" == typeof t.slice && !(t.length > 0 && \"number\" != typeof t[0]);\n }\n function $n(t, e, n) {\n if (n = n || {}, !I(n)) throw new Error(\"options is invalid\");\n var r = n.tolerance || 0,\n i = [],\n o = Qe();\n o.load(en(t));\n var s;\n return G(e, function (t) {\n var e = !1;\n O(o.search(t), function (n) {\n if (!1 === e) {\n var i = U(t).sort(),\n o = U(n).sort();\n Zn(i, o) ? (e = !0, s = s ? tr(s, t) : t) : (0 === r ? Nn(i[0], n) && Nn(i[1], n) : on(n, i[0]).properties.dist <= r && on(n, i[1]).properties.dist <= r) ? (e = !0, s = s ? tr(s, t) : t) : (0 === r ? Nn(o[0], t) && Nn(o[1], t) : on(t, o[0]).properties.dist <= r && on(t, o[1]).properties.dist <= r) && (s = s ? tr(s, n) : n);\n }\n }), !1 === e && s && (i.push(s), s = void 0);\n }), s && i.push(s), c(i);\n }\n function tr(t, e) {\n var n = U(e),\n r = U(t),\n i = r[0],\n o = r[r.length - 1],\n s = t.geometry.coordinates;\n return Zn(n[0], i) ? s.unshift(n[1]) : Zn(n[0], o) ? s.push(n[1]) : Zn(n[1], i) ? s.unshift(n[0]) : Zn(n[1], o) && s.push(n[0]), t;\n }\n function er(t) {\n var e = t % 360;\n return e < 0 && (e += 360), e;\n }\n function nr(t, e, n, i) {\n if (i = i || {}, !I(i)) throw new Error(\"options is invalid\");\n var o = i.units,\n s = i.properties;\n if (!t) throw new Error(\"origin is required\");\n if (void 0 === e || null === e) throw new Error(\"distance is required\");\n if (void 0 === n || null === n) throw new Error(\"bearing is required\");\n if (!(e >= 0)) throw new Error(\"distance must be greater than 0\");\n var a = E(e, o, \"meters\"),\n u = X(t),\n c = function (t, e, n, r) {\n r = void 0 === r ? Fo : Number(r);\n var i = e / r,\n o = t[0] * Math.PI / 180,\n s = x(t[1]),\n a = x(n),\n u = i * Math.cos(a),\n c = s + u;\n Math.abs(c) > Math.PI / 2 && (c = c > 0 ? Math.PI - c : -Math.PI - c);\n var h = Math.log(Math.tan(c / 2 + Math.PI / 4) / Math.tan(s / 2 + Math.PI / 4)),\n l = Math.abs(h) > 1e-11 ? u / h : Math.cos(s),\n p = i * Math.sin(a) / l;\n return [(180 * (o + p) / Math.PI + 540) % 360 - 180, 180 * c / Math.PI];\n }(u, a, n);\n return c[0] += c[0] - u[0] > 180 ? -360 : u[0] - c[0] > 180 ? 360 : 0, r(c, s);\n }\n function rr(t, e, n, r, i, o) {\n for (var s = 0; s < t.length; s++) {\n var a = t[s],\n u = t[s + 1];\n s === t.length - 1 && (u = t[0]), r = ir(a, u, e), n <= 0 && r > 0 ? function (t, e, n) {\n return ir(t, e, n) < 0;\n }(e, a, i) || (i = a) : n > 0 && r <= 0 && (function (t, e, n) {\n return ir(t, e, n) > 0;\n }(e, a, o) || (o = a)), n = r;\n }\n return [i, o];\n }\n function ir(t, e, n) {\n return (e[0] - t[0]) * (n[1] - t[1]) - (n[0] - t[0]) * (e[1] - t[1]);\n }\n function or(t) {\n if (!t) throw new Error(\"line is required\");\n var e = t.geometry ? t.geometry.type : t.type;\n if (!Array.isArray(t) && \"LineString\" !== e) throw new Error(\"geometry must be a LineString\");\n for (var n, r, i = U(t), o = 0, s = 1; s < i.length;) n = r || i[0], o += ((r = i[s])[0] - n[0]) * (r[1] + n[1]), s++;\n return o > 0;\n }\n function sr(t, e) {\n switch (\"Feature\" === t.type ? t.geometry.type : t.type) {\n case \"GeometryCollection\":\n return A(t, function (t) {\n sr(t, e);\n }), t;\n case \"LineString\":\n return ar(U(t), e), t;\n case \"Polygon\":\n return ur(U(t), e), t;\n case \"MultiLineString\":\n return U(t).forEach(function (t) {\n ar(t, e);\n }), t;\n case \"MultiPolygon\":\n return U(t).forEach(function (t) {\n ur(t, e);\n }), t;\n case \"Point\":\n case \"MultiPoint\":\n return t;\n }\n }\n function ar(t, e) {\n or(t) === e && t.reverse();\n }\n function ur(t, e) {\n or(t[0]) !== e && t[0].reverse();\n for (var n = 1; n < t.length; n++) or(t[n]) === e && t[n].reverse();\n }\n function cr(t, e) {\n if (e = e || {}, !I(e)) throw new Error(\"options is invalid\");\n var n = e.zProperty || \"elevation\",\n r = e.flip,\n i = e.flags;\n W(t, \"Point\", \"input must contain Points\");\n for (var o = function (t, e) {\n var n = {};\n O(t, function (t) {\n var e = U(t)[1];\n n[e] || (n[e] = []), n[e].push(t);\n });\n return Object.keys(n).map(function (t) {\n var e = n[t],\n r = e.sort(function (t, e) {\n return U(t)[0] - U(e)[0];\n });\n return r;\n }).sort(function (t, n) {\n return e ? U(t[0])[1] - U(n[0])[1] : U(n[0])[1] - U(t[0])[1];\n });\n }(t, r), s = [], a = 0; a < o.length; a++) {\n for (var u = o[a], c = [], h = 0; h < u.length; h++) {\n var l = u[h];\n l.properties[n] ? c.push(l.properties[n]) : c.push(0), !0 === i && (l.properties.matrixPosition = [a, h]);\n }\n s.push(c);\n }\n return s;\n }\n function hr(t, e, n, r) {\n r = r || {};\n for (var i = Object.keys(ks), o = 0; o < i.length; o++) {\n var s = i[o],\n a = r[s];\n a = void 0 !== a && null !== a ? a : ks[s], zs[s] = a;\n }\n zs.verbose && console.log(\"MarchingSquaresJS-isoBands: computing isobands for [\" + e + \":\" + (e + n) + \"]\");\n var u,\n c = function (t, e, n) {\n for (var r = t.length - 1, i = t[0].length - 1, o = {\n rows: r,\n cols: i,\n cells: []\n }, s = e + Math.abs(n), a = 0; a < r; ++a) {\n o.cells[a] = [];\n for (var u = 0; u < i; ++u) {\n var c = 0,\n h = t[a + 1][u],\n l = t[a + 1][u + 1],\n p = t[a][u + 1],\n f = t[a][u];\n if (!(isNaN(h) || isNaN(l) || isNaN(p) || isNaN(f))) {\n c |= h < e ? 0 : h > s ? 128 : 64, c |= l < e ? 0 : l > s ? 32 : 16, c |= p < e ? 0 : p > s ? 8 : 4;\n var g = +(c |= f < e ? 0 : f > s ? 2 : 1),\n d = 0;\n if (17 === c || 18 === c || 33 === c || 34 === c || 38 === c || 68 === c || 72 === c || 98 === c || 102 === c || 132 === c || 136 === c || 137 === c || 152 === c || 153 === c) {\n var y = (h + l + p + f) / 4;\n d = y > s ? 2 : y < e ? 0 : 1, 34 === c ? 1 === d ? c = 35 : 0 === d && (c = 136) : 136 === c ? 1 === d ? (c = 35, d = 4) : 0 === d && (c = 34) : 17 === c ? 1 === d ? (c = 155, d = 4) : 0 === d && (c = 153) : 68 === c ? 1 === d ? (c = 103, d = 4) : 0 === d && (c = 102) : 153 === c ? 1 === d && (c = 155) : 102 === c ? 1 === d && (c = 103) : 152 === c ? d < 2 && (c = 156, d = 1) : 137 === c ? d < 2 && (c = 139, d = 1) : 98 === c ? d < 2 && (c = 99, d = 1) : 38 === c ? d < 2 && (c = 39, d = 1) : 18 === c ? d > 0 ? (c = 156, d = 4) : c = 152 : 33 === c ? d > 0 ? (c = 139, d = 4) : c = 137 : 72 === c ? d > 0 ? (c = 99, d = 4) : c = 98 : 132 === c && (d > 0 ? (c = 39, d = 4) : c = 38);\n }\n if (0 != c && 170 != c) {\n var _, m, v, x, E, w, b, I;\n _ = m = v = x = E = w = b = I = .5;\n var N = [];\n 1 === c ? (v = 1 - lr(e, p, f), I = 1 - lr(e, h, f), N.push(Sa[c])) : 169 === c ? (v = lr(s, f, p), I = lr(s, f, h), N.push(Sa[c])) : 4 === c ? (w = 1 - lr(e, l, p), x = lr(e, f, p), N.push(Na[c])) : 166 === c ? (w = lr(s, p, l), x = 1 - lr(s, p, f), N.push(Na[c])) : 16 === c ? (E = lr(e, p, l), m = lr(e, h, l), N.push(Ia[c])) : 154 === c ? (E = 1 - lr(s, l, p), m = 1 - lr(s, l, h), N.push(Ia[c])) : 64 === c ? (b = lr(e, f, h), _ = 1 - lr(e, l, h), N.push(La[c])) : 106 === c ? (b = 1 - lr(s, h, f), _ = lr(s, h, l), N.push(La[c])) : 168 === c ? (x = lr(s, f, p), v = lr(e, f, p), I = lr(e, f, h), b = lr(s, f, h), N.push(Ca[c]), N.push(Sa[c])) : 2 === c ? (x = 1 - lr(e, p, f), v = 1 - lr(s, p, f), I = 1 - lr(s, h, f), b = 1 - lr(e, h, f), N.push(Ca[c]), N.push(Sa[c])) : 162 === c ? (E = lr(s, p, l), w = lr(e, p, l), x = 1 - lr(e, p, f), v = 1 - lr(s, p, f), N.push(Ca[c]), N.push(Sa[c])) : 8 === c ? (E = 1 - lr(e, l, p), w = 1 - lr(s, l, p), x = lr(s, f, p), v = lr(e, f, p), N.push(Ia[c]), N.push(Na[c])) : 138 === c ? (E = 1 - lr(e, l, p), w = 1 - lr(s, l, p), _ = 1 - lr(s, l, h), m = 1 - lr(e, l, h), N.push(Ia[c]), N.push(Na[c])) : 32 === c ? (E = lr(s, p, l), w = lr(e, p, l), _ = lr(e, h, l), m = lr(s, h, l), N.push(Ia[c]), N.push(Na[c])) : 42 === c ? (I = 1 - lr(s, h, f), b = 1 - lr(e, h, f), _ = lr(e, h, l), m = lr(s, h, l), N.push(Ma[c]), N.push(La[c])) : 128 === c && (I = lr(e, f, h), b = lr(s, f, h), _ = 1 - lr(s, l, h), m = 1 - lr(e, l, h), N.push(Ma[c]), N.push(La[c])), 5 === c ? (w = 1 - lr(e, l, p), I = 1 - lr(e, h, f), N.push(Na[c])) : 165 === c ? (w = lr(s, p, l), I = lr(s, f, h), N.push(Na[c])) : 20 === c ? (x = lr(e, f, p), m = lr(e, h, l), N.push(Ca[c])) : 150 === c ? (x = 1 - lr(s, p, f), m = 1 - lr(s, l, h), N.push(Ca[c])) : 80 === c ? (E = lr(e, p, l), b = lr(e, f, h), N.push(Ia[c])) : 90 === c ? (E = 1 - lr(s, l, p), b = 1 - lr(s, h, f), N.push(Ia[c])) : 65 === c ? (v = 1 - lr(e, p, f), _ = 1 - lr(e, l, h), N.push(Sa[c])) : 105 === c ? (v = lr(s, f, p), _ = lr(s, h, l), N.push(Sa[c])) : 160 === c ? (E = lr(s, p, l), w = lr(e, p, l), I = lr(e, f, h), b = lr(s, f, h), N.push(Ia[c]), N.push(Na[c])) : 10 === c ? (E = 1 - lr(e, l, p), w = 1 - lr(s, l, p), I = 1 - lr(s, h, f), b = 1 - lr(e, h, f), N.push(Ia[c]), N.push(Na[c])) : 130 === c ? (x = 1 - lr(e, p, f), v = 1 - lr(s, p, f), _ = 1 - lr(s, l, h), m = 1 - lr(e, l, h), N.push(Ca[c]), N.push(Sa[c])) : 40 === c ? (x = lr(s, f, p), v = lr(e, f, p), _ = lr(e, h, l), m = lr(s, h, l), N.push(Ca[c]), N.push(Sa[c])) : 101 === c ? (w = lr(s, p, l), _ = lr(s, h, l), N.push(Na[c])) : 69 === c ? (w = 1 - lr(e, l, p), _ = 1 - lr(e, l, h), N.push(Na[c])) : 149 === c ? (I = lr(s, f, h), m = 1 - lr(s, l, h), N.push(Ma[c])) : 21 === c ? (I = 1 - lr(e, h, f), m = lr(e, h, l), N.push(Ma[c])) : 86 === c ? (x = 1 - lr(s, p, f), b = 1 - lr(s, h, f), N.push(Ca[c])) : 84 === c ? (x = lr(e, f, p), b = lr(e, f, h), N.push(Ca[c])) : 89 === c ? (E = 1 - lr(s, l, p), v = lr(s, f, p), N.push(Sa[c])) : 81 === c ? (E = lr(e, p, l), v = 1 - lr(e, p, f), N.push(Sa[c])) : 96 === c ? (E = lr(s, p, l), w = lr(e, p, l), b = lr(e, f, h), _ = lr(s, h, l), N.push(Ia[c]), N.push(Na[c])) : 74 === c ? (E = 1 - lr(e, l, p), w = 1 - lr(s, l, p), b = 1 - lr(s, h, f), _ = 1 - lr(e, l, h), N.push(Ia[c]), N.push(Na[c])) : 24 === c ? (E = 1 - lr(s, l, p), x = lr(s, f, p), v = lr(e, f, p), m = lr(e, h, l), N.push(Ia[c]), N.push(Sa[c])) : 146 === c ? (E = lr(e, p, l), x = 1 - lr(e, p, f), v = 1 - lr(s, p, f), m = 1 - lr(s, l, h), N.push(Ia[c]), N.push(Sa[c])) : 6 === c ? (w = 1 - lr(e, l, p), x = 1 - lr(s, p, f), I = 1 - lr(s, h, f), b = 1 - lr(e, h, f), N.push(Na[c]), N.push(Ca[c])) : 164 === c ? (w = lr(s, p, l), x = lr(e, f, p), I = lr(e, f, h), b = lr(s, f, h), N.push(Na[c]), N.push(Ca[c])) : 129 === c ? (v = 1 - lr(e, p, f), I = lr(s, f, h), _ = 1 - lr(s, l, h), m = 1 - lr(e, l, h), N.push(Sa[c]), N.push(Ma[c])) : 41 === c ? (v = lr(s, f, p), I = 1 - lr(e, h, f), _ = lr(e, h, l), m = lr(s, h, l), N.push(Sa[c]), N.push(Ma[c])) : 66 === c ? (x = 1 - lr(e, p, f), v = 1 - lr(s, p, f), b = 1 - lr(s, h, f), _ = 1 - lr(e, l, h), N.push(Ca[c]), N.push(Sa[c])) : 104 === c ? (x = lr(s, f, p), v = lr(e, f, p), b = lr(e, f, h), _ = lr(s, h, l), N.push(Sa[c]), N.push(Pa[c])) : 144 === c ? (E = lr(e, p, l), I = lr(e, f, h), b = lr(s, f, h), m = 1 - lr(s, l, h), N.push(Ia[c]), N.push(La[c])) : 26 === c ? (E = 1 - lr(s, l, p), I = 1 - lr(s, h, f), b = 1 - lr(e, h, f), m = lr(e, h, l), N.push(Ia[c]), N.push(La[c])) : 36 === c ? (w = lr(s, p, l), x = lr(e, f, p), _ = lr(e, h, l), m = lr(s, h, l), N.push(Na[c]), N.push(Ca[c])) : 134 === c ? (w = 1 - lr(e, l, p), x = 1 - lr(s, p, f), _ = 1 - lr(s, l, h), m = 1 - lr(e, l, h), N.push(Na[c]), N.push(Ca[c])) : 9 === c ? (E = 1 - lr(e, l, p), w = 1 - lr(s, l, p), v = lr(s, f, p), I = 1 - lr(e, h, f), N.push(Ia[c]), N.push(Na[c])) : 161 === c ? (E = lr(s, p, l), w = lr(e, p, l), v = 1 - lr(e, p, f), I = lr(s, f, h), N.push(Ia[c]), N.push(Na[c])) : 37 === c ? (w = lr(s, p, l), I = 1 - lr(e, h, f), _ = lr(e, h, l), m = lr(s, h, l), N.push(Na[c]), N.push(Ma[c])) : 133 === c ? (w = 1 - lr(e, l, p), I = lr(s, f, h), _ = 1 - lr(s, l, h), m = 1 - lr(e, l, h), N.push(Na[c]), N.push(Ma[c])) : 148 === c ? (x = lr(e, f, p), I = lr(e, f, h), b = lr(s, f, h), m = 1 - lr(s, l, h), N.push(Ca[c]), N.push(La[c])) : 22 === c ? (x = 1 - lr(s, p, f), I = 1 - lr(s, h, f), b = 1 - lr(e, h, f), m = lr(e, h, l), N.push(Ca[c]), N.push(La[c])) : 82 === c ? (E = lr(e, p, l), x = 1 - lr(e, p, f), v = 1 - lr(s, p, f), b = 1 - lr(s, h, f), N.push(Ia[c]), N.push(Sa[c])) : 88 === c ? (E = 1 - lr(s, l, p), x = lr(s, f, p), v = lr(e, f, p), b = lr(e, f, h), N.push(Ia[c]), N.push(Sa[c])) : 73 === c ? (E = 1 - lr(e, l, p), w = 1 - lr(s, l, p), v = lr(s, f, p), _ = 1 - lr(e, l, h), N.push(Ia[c]), N.push(Na[c])) : 97 === c ? (E = lr(s, p, l), w = lr(e, p, l), v = 1 - lr(e, p, f), _ = lr(s, h, l), N.push(Ia[c]), N.push(Na[c])) : 145 === c ? (E = lr(e, p, l), v = 1 - lr(e, p, f), I = lr(s, f, h), m = 1 - lr(s, l, h), N.push(Ia[c]), N.push(Ma[c])) : 25 === c ? (E = 1 - lr(s, l, p), v = lr(s, f, p), I = 1 - lr(e, h, f), m = lr(e, h, l), N.push(Ia[c]), N.push(Ma[c])) : 70 === c ? (w = 1 - lr(e, l, p), x = 1 - lr(s, p, f), b = 1 - lr(s, h, f), _ = 1 - lr(e, l, h), N.push(Na[c]), N.push(Ca[c])) : 100 === c ? (w = lr(s, p, l), x = lr(e, f, p), b = lr(e, f, h), _ = lr(s, h, l), N.push(Na[c]), N.push(Ca[c])) : 34 === c ? (0 === d ? (E = 1 - lr(e, l, p), w = 1 - lr(s, l, p), x = lr(s, f, p), v = lr(e, f, p), I = lr(e, f, h), b = lr(s, f, h), _ = 1 - lr(s, l, h), m = 1 - lr(e, l, h)) : (E = lr(s, p, l), w = lr(e, p, l), x = 1 - lr(e, p, f), v = 1 - lr(s, p, f), I = 1 - lr(s, h, f), b = 1 - lr(e, h, f), _ = lr(e, h, l), m = lr(s, h, l)), N.push(Ia[c]), N.push(Na[c]), N.push(Ma[c]), N.push(La[c])) : 35 === c ? (4 === d ? (E = 1 - lr(e, l, p), w = 1 - lr(s, l, p), x = lr(s, f, p), v = lr(e, f, p), I = lr(e, f, h), b = lr(s, f, h), _ = 1 - lr(s, l, h), m = 1 - lr(e, l, h)) : (E = lr(s, p, l), w = lr(e, p, l), x = 1 - lr(e, p, f), v = 1 - lr(s, p, f), I = 1 - lr(s, h, f), b = 1 - lr(e, h, f), _ = lr(e, h, l), m = lr(s, h, l)), N.push(Ia[c]), N.push(Na[c]), N.push(Sa[c]), N.push(La[c])) : 136 === c ? (0 === d ? (E = lr(s, p, l), w = lr(e, p, l), x = 1 - lr(e, p, f), v = 1 - lr(s, p, f), I = 1 - lr(s, h, f), b = 1 - lr(e, h, f), _ = lr(e, h, l), m = lr(s, h, l)) : (E = 1 - lr(e, l, p), w = 1 - lr(s, l, p), x = lr(s, f, p), v = lr(e, f, p), I = lr(e, f, h), b = lr(s, f, h), _ = 1 - lr(s, l, h), m = 1 - lr(e, l, h)), N.push(Ia[c]), N.push(Na[c]), N.push(Ma[c]), N.push(La[c])) : 153 === c ? (0 === d ? (E = lr(e, p, l), v = 1 - lr(e, p, f), I = 1 - lr(e, h, f), m = lr(e, h, l)) : (E = 1 - lr(s, l, p), v = lr(s, f, p), I = lr(s, f, h), m = 1 - lr(s, l, h)), N.push(Ia[c]), N.push(Sa[c])) : 102 === c ? (0 === d ? (w = 1 - lr(e, l, p), x = lr(e, f, p), b = lr(e, f, h), _ = 1 - lr(e, l, h)) : (w = lr(s, p, l), x = 1 - lr(s, p, f), b = 1 - lr(s, h, f), _ = lr(s, h, l)), N.push(Na[c]), N.push(La[c])) : 155 === c ? (4 === d ? (E = lr(e, p, l), v = 1 - lr(e, p, f), I = 1 - lr(e, h, f), m = lr(e, h, l)) : (E = 1 - lr(s, l, p), v = lr(s, f, p), I = lr(s, f, h), m = 1 - lr(s, l, h)), N.push(Ia[c]), N.push(Ma[c])) : 103 === c ? (4 === d ? (w = 1 - lr(e, l, p), x = lr(e, f, p), b = lr(e, f, h), _ = 1 - lr(e, l, h)) : (w = lr(s, p, l), x = 1 - lr(s, p, f), b = 1 - lr(s, h, f), _ = lr(s, h, l)), N.push(Na[c]), N.push(Ca[c])) : 152 === c ? (0 === d ? (E = lr(e, p, l), x = 1 - lr(e, p, f), v = 1 - lr(s, p, f), I = 1 - lr(s, h, f), b = 1 - lr(e, h, f), m = lr(e, h, l)) : (E = 1 - lr(s, l, p), x = lr(s, f, p), v = lr(e, f, p), I = lr(e, f, h), b = lr(s, f, h), m = 1 - lr(s, l, h)), N.push(Ia[c]), N.push(Ca[c]), N.push(Sa[c])) : 156 === c ? (4 === d ? (E = lr(e, p, l), x = 1 - lr(e, p, f), v = 1 - lr(s, p, f), I = 1 - lr(s, h, f), b = 1 - lr(e, h, f), m = lr(e, h, l)) : (E = 1 - lr(s, l, p), x = lr(s, f, p), v = lr(e, f, p), I = lr(e, f, h), b = lr(s, f, h), m = 1 - lr(s, l, h)), N.push(Ia[c]), N.push(Sa[c]), N.push(La[c])) : 137 === c ? (0 === d ? (E = lr(s, p, l), w = lr(e, p, l), v = 1 - lr(e, p, f), I = 1 - lr(e, h, f), _ = lr(e, h, l), m = lr(s, h, l)) : (E = 1 - lr(e, l, p), w = 1 - lr(s, l, p), v = lr(s, f, p), I = lr(s, f, h), _ = 1 - lr(s, l, h), m = 1 - lr(e, l, h)), N.push(Ia[c]), N.push(Na[c]), N.push(Sa[c])) : 139 === c ? (4 === d ? (E = lr(s, p, l), w = lr(e, p, l), v = 1 - lr(e, p, f), I = 1 - lr(e, h, f), _ = lr(e, h, l), m = lr(s, h, l)) : (E = 1 - lr(e, l, p), w = 1 - lr(s, l, p), v = lr(s, f, p), I = lr(s, f, h), _ = 1 - lr(s, l, h), m = 1 - lr(e, l, h)), N.push(Ia[c]), N.push(Na[c]), N.push(Ma[c])) : 98 === c ? (0 === d ? (E = 1 - lr(e, l, p), w = 1 - lr(s, l, p), x = lr(s, f, p), v = lr(e, f, p), b = lr(e, f, h), _ = 1 - lr(e, l, h)) : (E = lr(s, p, l), w = lr(e, p, l), x = 1 - lr(e, p, f), v = 1 - lr(s, p, f), b = 1 - lr(s, h, f), _ = lr(s, h, l)), N.push(Ia[c]), N.push(Na[c]), N.push(La[c])) : 99 === c ? (4 === d ? (E = 1 - lr(e, l, p), w = 1 - lr(s, l, p), x = lr(s, f, p), v = lr(e, f, p), b = lr(e, f, h), _ = 1 - lr(e, l, h)) : (E = lr(s, p, l), w = lr(e, p, l), x = 1 - lr(e, p, f), v = 1 - lr(s, p, f), b = 1 - lr(s, h, f), _ = lr(s, h, l)), N.push(Ia[c]), N.push(Na[c]), N.push(Sa[c])) : 38 === c ? (0 === d ? (w = 1 - lr(e, l, p), x = lr(e, f, p), I = lr(e, f, h), b = lr(s, f, h), _ = 1 - lr(s, l, h), m = 1 - lr(e, l, h)) : (w = lr(s, p, l), x = 1 - lr(s, p, f), I = 1 - lr(s, h, f), b = 1 - lr(e, h, f), _ = lr(e, h, l), m = lr(s, h, l)), N.push(Na[c]), N.push(Ma[c]), N.push(La[c])) : 39 === c ? (4 === d ? (w = 1 - lr(e, l, p), x = lr(e, f, p), I = lr(e, f, h), b = lr(s, f, h), _ = 1 - lr(s, l, h), m = 1 - lr(e, l, h)) : (w = lr(s, p, l), x = 1 - lr(s, p, f), I = 1 - lr(s, h, f), b = 1 - lr(e, h, f), _ = lr(e, h, l), m = lr(s, h, l)), N.push(Na[c]), N.push(Ca[c]), N.push(La[c])) : 85 === c && (E = 1, w = 0, x = 1, v = 0, I = 0, b = 1, _ = 0, m = 1), (_ < 0 || _ > 1 || m < 0 || m > 1 || E < 0 || E > 1 || x < 0 || x > 1 || I < 0 || I > 1 || b < 0 || b > 1) && console.log(\"MarchingSquaresJS-isoBands: \" + c + \" \" + g + \" \" + h + \",\" + l + \",\" + p + \",\" + f + \" \" + d + \" \" + _ + \" \" + m + \" \" + E + \" \" + w + \" \" + x + \" \" + v + \" \" + I + \" \" + b), o.cells[a][u] = {\n cval: c,\n cval_real: g,\n flipped: d,\n topleft: _,\n topright: m,\n righttop: E,\n rightbottom: w,\n bottomright: x,\n bottomleft: v,\n leftbottom: I,\n lefttop: b,\n edges: N\n };\n }\n }\n }\n }\n return o;\n }(t, e, n);\n return zs.polygons ? (zs.verbose && console.log(\"MarchingSquaresJS-isoBands: returning single polygons for each grid cell\"), u = function (t) {\n var e = [],\n n = 0;\n return t.cells.forEach(function (t, r) {\n t.forEach(function (t, i) {\n if (void 0 !== t) {\n var o = Ra[t.cval](t);\n \"object\" == typeof o && pr(o) ? \"object\" == typeof o[0] && pr(o[0]) ? \"object\" == typeof o[0][0] && pr(o[0][0]) ? o.forEach(function (t) {\n t.forEach(function (t) {\n t[0] += i, t[1] += r;\n }), e[n++] = t;\n }) : (o.forEach(function (t) {\n t[0] += i, t[1] += r;\n }), e[n++] = o) : console.log(\"MarchingSquaresJS-isoBands: bandcell polygon with malformed coordinates\") : console.log(\"MarchingSquaresJS-isoBands: bandcell polygon with null coordinates\");\n }\n });\n }), e;\n }(c)) : (zs.verbose && console.log(\"MarchingSquaresJS-isoBands: returning polygon paths for entire data grid\"), u = function (t) {\n for (var e = [], n = t.rows, r = t.cols, i = [], o = 0; o < n; o++) for (var s = 0; s < r; s++) if (void 0 !== t.cells[o][s] && t.cells[o][s].edges.length > 0) {\n var a = t.cells[o][s],\n u = function (t) {\n if (t.edges.length > 0) {\n var e = t.edges[t.edges.length - 1],\n n = t.cval_real;\n switch (e) {\n case 0:\n return n & Xs ? {\n p: [1, t.righttop],\n x: -1,\n y: 0,\n o: 1\n } : {\n p: [t.topleft, 1],\n x: 0,\n y: -1,\n o: 0\n };\n case 1:\n return n & Us ? {\n p: [t.topleft, 1],\n x: 0,\n y: -1,\n o: 0\n } : {\n p: [1, t.rightbottom],\n x: -1,\n y: 0,\n o: 0\n };\n case 2:\n return n & Us ? {\n p: [t.bottomright, 0],\n x: 0,\n y: 1,\n o: 1\n } : {\n p: [t.topleft, 1],\n x: 0,\n y: -1,\n o: 0\n };\n case 3:\n return n & Ys ? {\n p: [t.topleft, 1],\n x: 0,\n y: -1,\n o: 0\n } : {\n p: [t.bottomleft, 0],\n x: 0,\n y: 1,\n o: 0\n };\n case 4:\n return n & Xs ? {\n p: [1, t.righttop],\n x: -1,\n y: 0,\n o: 1\n } : {\n p: [t.topright, 1],\n x: 0,\n y: -1,\n o: 1\n };\n case 5:\n return n & Us ? {\n p: [t.topright, 1],\n x: 0,\n y: -1,\n o: 1\n } : {\n p: [1, t.rightbottom],\n x: -1,\n y: 0,\n o: 0\n };\n case 6:\n return n & Us ? {\n p: [t.bottomright, 0],\n x: 0,\n y: 1,\n o: 1\n } : {\n p: [t.topright, 1],\n x: 0,\n y: -1,\n o: 1\n };\n case 7:\n return n & Ys ? {\n p: [t.topright, 1],\n x: 0,\n y: -1,\n o: 1\n } : {\n p: [t.bottomleft, 0],\n x: 0,\n y: 1,\n o: 0\n };\n case 8:\n return n & Us ? {\n p: [t.bottomright, 0],\n x: 0,\n y: 1,\n o: 1\n } : {\n p: [1, t.righttop],\n x: -1,\n y: 0,\n o: 1\n };\n case 9:\n return n & Ys ? {\n p: [1, t.righttop],\n x: -1,\n y: 0,\n o: 1\n } : {\n p: [t.bottomleft, 0],\n x: 0,\n y: 1,\n o: 0\n };\n case 10:\n return n & Ys ? {\n p: [0, t.leftbottom],\n x: 1,\n y: 0,\n o: 0\n } : {\n p: [1, t.righttop],\n x: -1,\n y: 0,\n o: 1\n };\n case 11:\n return n & js ? {\n p: [1, t.righttop],\n x: -1,\n y: 0,\n o: 1\n } : {\n p: [0, t.lefttop],\n x: 1,\n y: 0,\n o: 1\n };\n case 12:\n return n & Us ? {\n p: [t.bottomright, 0],\n x: 0,\n y: 1,\n o: 1\n } : {\n p: [1, t.rightbottom],\n x: -1,\n y: 0,\n o: 0\n };\n case 13:\n return n & Ys ? {\n p: [1, t.rightbottom],\n x: -1,\n y: 0,\n o: 0\n } : {\n p: [t.bottomleft, 0],\n x: 0,\n y: 1,\n o: 0\n };\n case 14:\n return n & Ys ? {\n p: [0, t.leftbottom],\n x: 1,\n y: 0,\n o: 0\n } : {\n p: [1, t.rightbottom],\n x: -1,\n y: 0,\n o: 0\n };\n case 15:\n return n & js ? {\n p: [1, t.rightbottom],\n x: -1,\n y: 0,\n o: 0\n } : {\n p: [0, t.lefttop],\n x: 1,\n y: 0,\n o: 1\n };\n case 16:\n return n & Us ? {\n p: [t.bottomright, 0],\n x: 0,\n y: 1,\n o: 1\n } : {\n p: [0, t.leftbottom],\n x: 1,\n y: 0,\n o: 0\n };\n case 17:\n return n & js ? {\n p: [t.bottomright, 0],\n x: 0,\n y: 1,\n o: 1\n } : {\n p: [0, t.lefttop],\n x: 1,\n y: 0,\n o: 1\n };\n case 18:\n return n & Ys ? {\n p: [0, t.leftbottom],\n x: 1,\n y: 0,\n o: 0\n } : {\n p: [t.bottomleft, 0],\n x: 0,\n y: 1,\n o: 0\n };\n case 19:\n return n & js ? {\n p: [t.bottomleft, 0],\n x: 0,\n y: 1,\n o: 0\n } : {\n p: [0, t.lefttop],\n x: 1,\n y: 0,\n o: 1\n };\n case 20:\n return n & js ? {\n p: [t.topleft, 1],\n x: 0,\n y: -1,\n o: 0\n } : {\n p: [0, t.leftbottom],\n x: 1,\n y: 0,\n o: 0\n };\n case 21:\n return n & Xs ? {\n p: [0, t.leftbottom],\n x: 1,\n y: 0,\n o: 0\n } : {\n p: [t.topright, 1],\n x: 0,\n y: -1,\n o: 1\n };\n case 22:\n return n & js ? {\n p: [t.topleft, 1],\n x: 0,\n y: -1,\n o: 0\n } : {\n p: [0, t.lefttop],\n x: 1,\n y: 0,\n o: 1\n };\n case 23:\n return n & Xs ? {\n p: [0, t.lefttop],\n x: 1,\n y: 0,\n o: 1\n } : {\n p: [t.topright, 1],\n x: 0,\n y: -1,\n o: 1\n };\n default:\n console.log(\"MarchingSquaresJS-isoBands: edge index out of range!\"), console.log(t);\n }\n }\n return null;\n }(a),\n c = null,\n h = s,\n l = o;\n null !== u && i.push([u.p[0] + h, u.p[1] + l]);\n do {\n if (null === (c = function (t, e, n, r) {\n var i,\n o,\n s,\n a,\n u,\n c = t.cval;\n switch (e) {\n case -1:\n switch (r) {\n case 0:\n i = Na[c], s = ea[c], a = na[c], u = ra[c];\n break;\n default:\n i = Ia[c], s = Qs[c], a = $s[c], u = ta[c];\n }\n break;\n case 1:\n switch (r) {\n case 0:\n i = Ma[c], s = fa[c], a = ga[c], u = da[c];\n break;\n default:\n i = La[c], s = ha[c], a = la[c], u = pa[c];\n }\n break;\n default:\n switch (n) {\n case -1:\n switch (r) {\n case 0:\n i = Pa[c], s = Vs[c], a = Hs[c], u = Ws[c];\n break;\n default:\n i = Oa[c], s = Js[c], a = Zs[c], u = Ks[c];\n }\n break;\n case 1:\n switch (r) {\n case 0:\n i = Sa[c], s = ia[c], a = oa[c], u = sa[c];\n break;\n default:\n i = Ca[c], s = aa[c], a = ua[c], u = ca[c];\n }\n }\n }\n {\n if (o = t.edges.indexOf(i), void 0 === t.edges[o]) return null;\n !function (t, e) {\n delete t.edges[e];\n for (var n = e + 1; n < t.edges.length; n++) t.edges[n - 1] = t.edges[n];\n t.edges.pop();\n }(t, o);\n }\n switch (c = t.cval_real, i) {\n case 0:\n c & Xs ? (e = t.topleft, n = 1) : (e = 1, n = t.righttop);\n break;\n case 1:\n c & Us ? (e = 1, n = t.rightbottom) : (e = t.topleft, n = 1);\n break;\n case 2:\n c & Us ? (e = t.topleft, n = 1) : (e = t.bottomright, n = 0);\n break;\n case 3:\n c & Ys ? (e = t.bottomleft, n = 0) : (e = t.topleft, n = 1);\n break;\n case 4:\n c & Xs ? (e = t.topright, n = 1) : (e = 1, n = t.righttop);\n break;\n case 5:\n c & Us ? (e = 1, n = t.rightbottom) : (e = t.topright, n = 1);\n break;\n case 6:\n c & Us ? (e = t.topright, n = 1) : (e = t.bottomright, n = 0);\n break;\n case 7:\n c & Ys ? (e = t.bottomleft, n = 0) : (e = t.topright, n = 1);\n break;\n case 8:\n c & Us ? (e = 1, n = t.righttop) : (e = t.bottomright, n = 0);\n break;\n case 9:\n c & Ys ? (e = t.bottomleft, n = 0) : (e = 1, n = t.righttop);\n break;\n case 10:\n c & Ys ? (e = 1, n = t.righttop) : (e = 0, n = t.leftbottom);\n break;\n case 11:\n c & js ? (e = 0, n = t.lefttop) : (e = 1, n = t.righttop);\n break;\n case 12:\n c & Us ? (e = 1, n = t.rightbottom) : (e = t.bottomright, n = 0);\n break;\n case 13:\n c & Ys ? (e = t.bottomleft, n = 0) : (e = 1, n = t.rightbottom);\n break;\n case 14:\n c & Ys ? (e = 1, n = t.rightbottom) : (e = 0, n = t.leftbottom);\n break;\n case 15:\n c & js ? (e = 0, n = t.lefttop) : (e = 1, n = t.rightbottom);\n break;\n case 16:\n c & Us ? (e = 0, n = t.leftbottom) : (e = t.bottomright, n = 0);\n break;\n case 17:\n c & js ? (e = 0, n = t.lefttop) : (e = t.bottomright, n = 0);\n break;\n case 18:\n c & Ys ? (e = t.bottomleft, n = 0) : (e = 0, n = t.leftbottom);\n break;\n case 19:\n c & js ? (e = 0, n = t.lefttop) : (e = t.bottomleft, n = 0);\n break;\n case 20:\n c & js ? (e = 0, n = t.leftbottom) : (e = t.topleft, n = 1);\n break;\n case 21:\n c & Xs ? (e = t.topright, n = 1) : (e = 0, n = t.leftbottom);\n break;\n case 22:\n c & js ? (e = 0, n = t.lefttop) : (e = t.topleft, n = 1);\n break;\n case 23:\n c & Xs ? (e = t.topright, n = 1) : (e = 0, n = t.lefttop);\n break;\n default:\n return console.log(\"MarchingSquaresJS-isoBands: edge index out of range!\"), console.log(t), null;\n }\n void 0 !== e && void 0 !== n && void 0 !== s && void 0 !== a && void 0 !== u || (console.log(\"MarchingSquaresJS-isoBands: undefined value!\"), console.log(t), console.log(e + \" \" + n + \" \" + s + \" \" + a + \" \" + u));\n return {\n p: [e, n],\n x: s,\n y: a,\n o: u\n };\n }(t.cells[l][h], u.x, u.y, u.o))) break;\n if (i.push([c.p[0] + h, c.p[1] + l]), h += c.x, l += c.y, u = c, l < 0 || l >= n || h < 0 || h >= r || void 0 === t.cells[l][h]) {\n h -= c.x, l -= c.y;\n var p = function (t, e, n, r, i, o) {\n var s = t.cells[n][e],\n a = s.cval_real,\n u = e + r,\n c = n + i,\n h = [],\n l = !1;\n for (; !l;) {\n if (void 0 === t.cells[c] || void 0 === t.cells[c][u]) {\n if (c -= i, u -= r, s = t.cells[c][u], a = s.cval_real, -1 === i) {\n if (0 === o) {\n if (a & Ys) h.push([u, c]), r = -1, i = 0, o = 0;else {\n if (!(a & Us)) {\n h.push([u + s.bottomright, c]), r = 0, i = 1, o = 1, l = !0;\n break;\n }\n h.push([u + 1, c]), r = 1, i = 0, o = 0;\n }\n } else {\n if (!(a & Ys)) {\n if (a & Us) {\n h.push([u + s.bottomright, c]), r = 0, i = 1, o = 1, l = !0;\n break;\n }\n h.push([u + s.bottomleft, c]), r = 0, i = 1, o = 0, l = !0;\n break;\n }\n h.push([u, c]), r = -1, i = 0, o = 0;\n }\n } else if (1 === i) {\n if (0 === o) {\n if (!(a & Xs)) {\n if (a & js) {\n h.push([u + s.topleft, c + 1]), r = 0, i = -1, o = 0, l = !0;\n break;\n }\n h.push([u + s.topright, c + 1]), r = 0, i = -1, o = 1, l = !0;\n break;\n }\n h.push([u + 1, c + 1]), r = 1, i = 0, o = 1;\n } else h.push([u + 1, c + 1]), r = 1, i = 0, o = 1;\n } else if (-1 === r) {\n if (0 === o) {\n if (!(a & js)) {\n if (a & Ys) {\n h.push([u, c + s.leftbottom]), r = 1, i = 0, o = 0, l = !0;\n break;\n }\n h.push([u, c + s.lefttop]), r = 1, i = 0, o = 1, l = !0;\n break;\n }\n h.push([u, c + 1]), r = 0, i = 1, o = 0;\n } else {\n if (!(a & js)) {\n console.log(\"MarchingSquaresJS-isoBands: wtf\");\n break;\n }\n h.push([u, c + 1]), r = 0, i = 1, o = 0;\n }\n } else {\n if (1 !== r) {\n console.log(\"MarchingSquaresJS-isoBands: we came from nowhere!\");\n break;\n }\n if (0 === o) {\n if (!(a & Us)) {\n h.push([u + 1, c + s.rightbottom]), r = -1, i = 0, o = 0, l = !0;\n break;\n }\n h.push([u + 1, c]), r = 0, i = -1, o = 1;\n } else {\n if (!(a & Us)) {\n if (a & Xs) {\n h.push([u + 1, c + s.righttop]), r = -1, i = 0, o = 1;\n break;\n }\n h.push([u + 1, c + s.rightbottom]), r = -1, i = 0, o = 0, l = !0;\n break;\n }\n h.push([u + 1, c]), r = 0, i = -1, o = 1;\n }\n }\n } else if (s = t.cells[c][u], a = s.cval_real, -1 === r) {\n if (0 === o) {\n if (void 0 !== t.cells[c - 1] && void 0 !== t.cells[c - 1][u]) r = 0, i = -1, o = 1;else {\n if (!(a & Ys)) {\n h.push([u + s.bottomright, c]), r = 0, i = 1, o = 1, l = !0;\n break;\n }\n h.push([u, c]);\n }\n } else {\n if (!(a & js)) {\n console.log(\"MarchingSquaresJS-isoBands: found entry from top at \" + u + \",\" + c);\n break;\n }\n console.log(\"MarchingSquaresJS-isoBands: proceeding in x-direction!\");\n }\n } else if (1 === r) {\n if (0 === o) {\n console.log(\"MarchingSquaresJS-isoBands: wtf\");\n break;\n }\n if (void 0 !== t.cells[c + 1] && void 0 !== t.cells[c + 1][u]) r = 0, i = 1, o = 0;else {\n if (!(a & Xs)) {\n h.push([u + s.topleft, c + 1]), r = 0, i = -1, o = 0, l = !0;\n break;\n }\n h.push([u + 1, c + 1]), r = 1, i = 0, o = 1;\n }\n } else if (-1 === i) {\n if (1 !== o) {\n console.log(\"MarchingSquaresJS-isoBands: wtf\");\n break;\n }\n if (void 0 !== t.cells[c][u + 1]) r = 1, i = 0, o = 1;else {\n if (!(a & Us)) {\n h.push([u + 1, c + s.righttop]), r = -1, i = 0, o = 1, l = !0;\n break;\n }\n h.push([u + 1, c]), r = 0, i = -1, o = 1;\n }\n } else {\n if (1 !== i) {\n console.log(\"MarchingSquaresJS-isoBands: where did we came from???\");\n break;\n }\n if (0 !== o) {\n console.log(\"MarchingSquaresJS-isoBands: wtf\");\n break;\n }\n if (void 0 !== t.cells[c][u - 1]) r = -1, i = 0, o = 0;else {\n if (!(a & js)) {\n h.push([u, c + s.leftbottom]), r = 1, i = 0, o = 0, l = !0;\n break;\n }\n h.push([u, c + 1]), r = 0, i = 1, o = 0;\n }\n }\n if (u += r, c += i, u === e && c === n) break;\n }\n return {\n path: h,\n i: u,\n j: c,\n x: r,\n y: i,\n o: o\n };\n }(t, h, l, c.x, c.y, c.o);\n if (null === p) break;\n p.path.forEach(function (t) {\n i.push(t);\n }), h = p.i, l = p.j, u = p;\n }\n } while (void 0 !== t.cells[l][h] && t.cells[l][h].edges.length > 0);\n e.push(i), i = [], t.cells[o][s].edges.length > 0 && s--;\n }\n return e;\n }(c)), \"function\" == typeof zs.successCallback && zs.successCallback(u), u;\n }\n function lr(t, e, n) {\n return (t - e) / (n - e);\n }\n function pr(t) {\n return t.constructor.toString().indexOf(\"Array\") > -1;\n }\n function fr(t, e, n) {\n if (n = n || {}, !I(n)) throw new Error(\"options is invalid\");\n var r = n.pivot,\n i = n.mutate;\n if (!t) throw new Error(\"geojson is required\");\n if (void 0 === e || null === e || isNaN(e)) throw new Error(\"angle is required\");\n return 0 === e ? t : (r || (r = ye(t)), !1 !== i && void 0 !== i || (t = Gt(t)), S(t, function (t) {\n var n = sn(r, t) + e,\n i = un(r, t),\n o = U(nr(r, i, n));\n t[0] = o[0], t[1] = o[1];\n }), t);\n }\n function gr(t, e, n) {\n if (n = n || {}, !I(n)) throw new Error(\"options is invalid\");\n var r = n.origin,\n i = n.mutate;\n if (!t) throw new Error(\"geojson required\");\n if (\"number\" != typeof e || 0 === e) throw new Error(\"invalid factor\");\n var o = Array.isArray(r) || \"object\" == typeof r;\n return !0 !== i && (t = Gt(t)), \"FeatureCollection\" !== t.type || o ? dr(t, e, r) : (O(t, function (n, i) {\n t.features[i] = dr(n, e, r);\n }), t);\n }\n function dr(t, e, n) {\n var i = \"Point\" === K(t);\n return n = function (t, e) {\n void 0 !== e && null !== e || (e = \"centroid\");\n if (Array.isArray(e) || \"object\" == typeof e) return X(e);\n var n = t.bbox ? t.bbox : j(t),\n i = n[0],\n o = n[1],\n s = n[2],\n a = n[3];\n switch (e) {\n case \"sw\":\n case \"southwest\":\n case \"westsouth\":\n case \"bottomleft\":\n return r([i, o]);\n case \"se\":\n case \"southeast\":\n case \"eastsouth\":\n case \"bottomright\":\n return r([s, o]);\n case \"nw\":\n case \"northwest\":\n case \"westnorth\":\n case \"topleft\":\n return r([i, a]);\n case \"ne\":\n case \"northeast\":\n case \"eastnorth\":\n case \"topright\":\n return r([s, a]);\n case \"center\":\n return de(t);\n case void 0:\n case null:\n case \"centroid\":\n return ye(t);\n default:\n throw new Error(\"invalid origin\");\n }\n }(t, n), 1 === e || i ? t : (S(t, function (t) {\n var r = un(n, t),\n i = sn(n, t),\n o = U(nr(n, r * e, i));\n t[0] = o[0], t[1] = o[1], 3 === t.length && (t[2] *= e);\n }), t);\n }\n function yr(t) {\n var e = t[0],\n n = t[1];\n return [n[0] - e[0], n[1] - e[1]];\n }\n function _r(t, e) {\n return t[0] * e[1] - e[0] * t[1];\n }\n function mr(t, e) {\n return !function (t, e) {\n return 0 === _r(yr(t), yr(e));\n }(t, e) && function (t, e) {\n var n = t[0],\n r = yr(t),\n i = e[0],\n o = yr(e),\n s = _r(r, o);\n return function (t, e) {\n return [t[0] + e[0], t[1] + e[1]];\n }(n, function (t, e) {\n return [t * e[0], t * e[1]];\n }(_r(function (t, e) {\n return [t[0] - e[0], t[1] - e[1]];\n }(i, n), o) / s, r));\n }(t, e);\n }\n function vr(t, e, n) {\n var r = [],\n i = _(e, n),\n o = U(t),\n s = [];\n return o.forEach(function (t, e) {\n if (e !== o.length - 1) {\n var n = function (t, e, n) {\n var r = Math.sqrt((t[0] - e[0]) * (t[0] - e[0]) + (t[1] - e[1]) * (t[1] - e[1])),\n i = t[0] + n * (e[1] - t[1]) / r,\n o = e[0] + n * (e[1] - t[1]) / r,\n s = t[1] + n * (t[0] - e[0]) / r,\n a = e[1] + n * (t[0] - e[0]) / r;\n return [[i, s], [o, a]];\n }(t, o[e + 1], i);\n if (r.push(n), e > 0) {\n var a = r[e - 1],\n u = mr(n, a);\n !1 !== u && (a[1] = u, n[0] = u), s.push(a[0]), e === o.length - 2 && (s.push(n[0]), s.push(n[1]));\n }\n 2 === o.length && (s.push(n[0]), s.push(n[1]));\n }\n }), a(s, t.properties);\n }\n function xr(t, e, n) {\n var r = e[0] - t[0],\n i = e[1] - t[1],\n o = n[0] - e[0],\n s = n[1] - e[1];\n return Math.sign(r * s - o * i);\n }\n function Er(t, e) {\n return e.geometry.coordinates[0].every(function (e) {\n return Pt(r(e), t);\n });\n }\n function wr(t, e) {\n for (var n = 0; n < t.coordinates.length - 1; n++) if (function (t, e, n) {\n var r = n[0] - t[0],\n i = n[1] - t[1],\n o = e[0] - t[0],\n s = e[1] - t[1];\n if (r * s - i * o != 0) return !1;\n return Math.abs(o) >= Math.abs(s) ? o > 0 ? t[0] <= n[0] && n[0] <= e[0] : e[0] <= n[0] && n[0] <= t[0] : s > 0 ? t[1] <= n[1] && n[1] <= e[1] : e[1] <= n[1] && n[1] <= t[1];\n }(t.coordinates[n], t.coordinates[n + 1], e.coordinates)) return !0;\n return !1;\n }\n function br(t, e) {\n return nn(e, kn(t)).features.length > 0;\n }\n function Ir(t, e) {\n return !(t[0] > e[0]) && !(t[2] < e[2]) && !(t[1] > e[1]) && !(t[3] < e[3]);\n }\n function Nr(t, e) {\n return t[0] === e[0] && t[1] === e[1];\n }\n function Cr(t, e) {\n for (var n = !1, r = !1, i = t.coordinates.length, o = 0; o < i && !n && !r;) {\n for (var s = 0; s < e.coordinates.length - 1; s++) {\n var a = !0;\n 0 !== s && s !== e.coordinates.length - 2 || (a = !1), Lr(e.coordinates[s], e.coordinates[s + 1], t.coordinates[o], a) ? n = !0 : r = !0;\n }\n o++;\n }\n return n && r;\n }\n function Sr(t, e) {\n return nn(t, kn(e)).features.length > 0;\n }\n function Mr(t, e) {\n for (var n = !1, i = !1, o = t.coordinates[0].length, s = 0; s < o && n && i;) Pt(r(t.coordinates[0][s]), e) ? n = !0 : i = !0, s++;\n return i && i;\n }\n function Lr(t, e, n, r) {\n var i = n[0] - t[0],\n o = n[1] - t[1],\n s = e[0] - t[0],\n a = e[1] - t[1];\n return 0 == i * a - o * s && (r ? Math.abs(s) >= Math.abs(a) ? s > 0 ? t[0] <= n[0] && n[0] <= e[0] : e[0] <= n[0] && n[0] <= t[0] : a > 0 ? t[1] <= n[1] && n[1] <= e[1] : e[1] <= n[1] && n[1] <= t[1] : Math.abs(s) >= Math.abs(a) ? s > 0 ? t[0] < n[0] && n[0] < e[0] : e[0] < n[0] && n[0] < t[0] : a > 0 ? t[1] < n[1] && n[1] < e[1] : e[1] < n[1] && n[1] < t[1]);\n }\n function Pr(t) {\n return t.coordinates.map(function (e) {\n return {\n type: t.type.replace(\"Multi\", \"\"),\n coordinates: e\n };\n });\n }\n function Or(t, e) {\n return t.hasOwnProperty(\"coordinates\") ? t.coordinates.length === e.coordinates.length : t.length === e.length;\n }\n function Rr(t, e) {\n return ka(t, e, {\n strict: !0\n });\n }\n function Tr(t, e) {\n if (!t) throw new Error(\"feature1 is required\");\n if (!e) throw new Error(\"feature2 is required\");\n var n = K(t);\n if (n !== K(e)) throw new Error(\"features must be of the same type\");\n if (\"Point\" === n) throw new Error(\"Point geometry not supported\");\n if (new ja({\n precision: 6\n }).compare(t, e)) return !1;\n var r = 0;\n switch (n) {\n case \"MultiPoint\":\n var i = T(t),\n o = T(e);\n i.forEach(function (t) {\n o.forEach(function (e) {\n t[0] === e[0] && t[1] === e[1] && r++;\n });\n });\n break;\n case \"LineString\":\n case \"MultiLineString\":\n G(t, function (t) {\n G(e, function (e) {\n $n(t, e).features.length && r++;\n });\n });\n break;\n case \"Polygon\":\n case \"MultiPolygon\":\n G(t, function (t) {\n G(e, function (e) {\n nn(t, e).features.length && r++;\n });\n });\n }\n return r > 0;\n }\n function Ar(t, e, n) {\n n = n || [];\n for (var r = 0; r < t; r++) n[r] = e;\n return n;\n }\n function Dr(t, e) {\n if (t.geometry && t.geometry.type) return t.geometry.type;\n if (t.type) return t.type;\n throw new Error(\"Invalid GeoJSON object for \" + e);\n }\n function Fr(t) {\n for (var e = t, n = []; e.parent;) n.unshift(e), e = e.parent;\n return n;\n }\n function qr(t, e) {\n e = e || {}, this.nodes = [], this.diagonal = !!e.diagonal, this.grid = [];\n for (var n = 0; n < t.length; n++) {\n this.grid[n] = [];\n for (var r = 0, i = t[n]; r < i.length; r++) {\n var o = new Gr(n, r, i[r]);\n this.grid[n][r] = o, this.nodes.push(o);\n }\n }\n this.init();\n }\n function Gr(t, e, n) {\n this.x = t, this.y = e, this.weight = n;\n }\n function Br(t) {\n this.content = [], this.scoreFunction = t;\n }\n function kr(t) {\n return t[0];\n }\n function zr(t) {\n return t[1];\n }\n function jr() {\n this._ = null;\n }\n function Xr(t) {\n t.U = t.C = t.L = t.R = t.P = t.N = null;\n }\n function Ur(t, e) {\n var n = e,\n r = e.R,\n i = n.U;\n i ? i.L === n ? i.L = r : i.R = r : t._ = r, r.U = i, n.U = r, n.R = r.L, n.R && (n.R.U = n), r.L = n;\n }\n function Yr(t, e) {\n var n = e,\n r = e.L,\n i = n.U;\n i ? i.L === n ? i.L = r : i.R = r : t._ = r, r.U = i, n.U = r, n.L = r.R, n.L && (n.L.U = n), r.R = n;\n }\n function Vr(t) {\n for (; t.L;) t = t.L;\n return t;\n }\n function Hr(t, e, n, r) {\n var i = [null, null],\n o = uu.push(i) - 1;\n return i.left = t, i.right = e, n && Jr(i, t, e, n), r && Jr(i, e, t, r), su[t.index].halfedges.push(o), su[e.index].halfedges.push(o), i;\n }\n function Wr(t, e, n) {\n var r = [e, n];\n return r.left = t, r;\n }\n function Jr(t, e, n, r) {\n t[0] || t[1] ? t.left === n ? t[1] = r : t[0] = r : (t[0] = r, t.left = e, t.right = n);\n }\n function Zr(t, e, n, r, i) {\n var o,\n s = t[0],\n a = t[1],\n u = s[0],\n c = s[1],\n h = 0,\n l = 1,\n p = a[0] - u,\n f = a[1] - c;\n if (o = e - u, p || !(o > 0)) {\n if (o /= p, p < 0) {\n if (o < h) return;\n o < l && (l = o);\n } else if (p > 0) {\n if (o > l) return;\n o > h && (h = o);\n }\n if (o = r - u, p || !(o < 0)) {\n if (o /= p, p < 0) {\n if (o > l) return;\n o > h && (h = o);\n } else if (p > 0) {\n if (o < h) return;\n o < l && (l = o);\n }\n if (o = n - c, f || !(o > 0)) {\n if (o /= f, f < 0) {\n if (o < h) return;\n o < l && (l = o);\n } else if (f > 0) {\n if (o > l) return;\n o > h && (h = o);\n }\n if (o = i - c, f || !(o < 0)) {\n if (o /= f, f < 0) {\n if (o > l) return;\n o > h && (h = o);\n } else if (f > 0) {\n if (o < h) return;\n o < l && (l = o);\n }\n return !(h > 0 || l < 1) || (h > 0 && (t[0] = [u + h * p, c + h * f]), l < 1 && (t[1] = [u + l * p, c + l * f]), !0);\n }\n }\n }\n }\n }\n function Kr(t, e, n, r, i) {\n var o = t[1];\n if (o) return !0;\n var s,\n a,\n u = t[0],\n c = t.left,\n h = t.right,\n l = c[0],\n p = c[1],\n f = h[0],\n g = h[1],\n d = (l + f) / 2,\n y = (p + g) / 2;\n if (g === p) {\n if (d < e || d >= r) return;\n if (l > f) {\n if (u) {\n if (u[1] >= i) return;\n } else u = [d, n];\n o = [d, i];\n } else {\n if (u) {\n if (u[1] < n) return;\n } else u = [d, i];\n o = [d, n];\n }\n } else if (s = (l - f) / (g - p), a = y - s * d, s < -1 || s > 1) {\n if (l > f) {\n if (u) {\n if (u[1] >= i) return;\n } else u = [(n - a) / s, n];\n o = [(i - a) / s, i];\n } else {\n if (u) {\n if (u[1] < n) return;\n } else u = [(i - a) / s, i];\n o = [(n - a) / s, n];\n }\n } else if (p < g) {\n if (u) {\n if (u[0] >= r) return;\n } else u = [e, s * e + a];\n o = [r, s * r + a];\n } else {\n if (u) {\n if (u[0] < e) return;\n } else u = [r, s * r + a];\n o = [e, s * e + a];\n }\n return t[0] = u, t[1] = o, !0;\n }\n function Qr(t, e) {\n var n = t.site,\n r = e.left,\n i = e.right;\n return n === i && (i = r, r = n), i ? Math.atan2(i[1] - r[1], i[0] - r[0]) : (n === r ? (r = e[1], i = e[0]) : (r = e[0], i = e[1]), Math.atan2(r[0] - i[0], i[1] - r[1]));\n }\n function $r(t, e) {\n return e[+(e.left !== t.site)];\n }\n function ti(t, e) {\n return e[+(e.left === t.site)];\n }\n function ei(t) {\n var e = t.P,\n n = t.N;\n if (e && n) {\n var r = e.site,\n i = t.site,\n o = n.site;\n if (r !== o) {\n var s = i[0],\n a = i[1],\n u = r[0] - s,\n c = r[1] - a,\n h = o[0] - s,\n l = o[1] - a,\n p = 2 * (u * l - c * h);\n if (!(p >= -pu)) {\n var f = u * u + c * c,\n g = h * h + l * l,\n d = (l * f - c * g) / p,\n y = (u * g - h * f) / p,\n _ = cu.pop() || new function () {\n Xr(this), this.x = this.y = this.arc = this.site = this.cy = null;\n }();\n _.arc = t, _.site = i, _.x = d + s, _.y = (_.cy = y + a) + Math.sqrt(d * d + y * y), t.circle = _;\n for (var m = null, v = au._; v;) if (_.y < v.y || _.y === v.y && _.x <= v.x) {\n if (!v.L) {\n m = v.P;\n break;\n }\n v = v.L;\n } else {\n if (!v.R) {\n m = v;\n break;\n }\n v = v.R;\n }\n au.insert(m, _), m || (iu = _);\n }\n }\n }\n }\n function ni(t) {\n var e = t.circle;\n e && (e.P || (iu = e.N), au.remove(e), cu.push(e), Xr(e), t.circle = null);\n }\n function ri(t) {\n var e = hu.pop() || new function () {\n Xr(this), this.edge = this.site = this.circle = null;\n }();\n return e.site = t, e;\n }\n function ii(t) {\n ni(t), ou.remove(t), hu.push(t), Xr(t);\n }\n function oi(t) {\n var e = t.circle,\n n = e.x,\n r = e.cy,\n i = [n, r],\n o = t.P,\n s = t.N,\n a = [t];\n ii(t);\n for (var u = o; u.circle && Math.abs(n - u.circle.x) < lu && Math.abs(r - u.circle.cy) < lu;) o = u.P, a.unshift(u), ii(u), u = o;\n a.unshift(u), ni(u);\n for (var c = s; c.circle && Math.abs(n - c.circle.x) < lu && Math.abs(r - c.circle.cy) < lu;) s = c.N, a.push(c), ii(c), c = s;\n a.push(c), ni(c);\n var h,\n l = a.length;\n for (h = 1; h < l; ++h) c = a[h], u = a[h - 1], Jr(c.edge, u.site, c.site, i);\n u = a[0], (c = a[l - 1]).edge = Hr(u.site, c.site, null, i), ei(u), ei(c);\n }\n function si(t) {\n for (var e, n, r, i, o = t[0], s = t[1], a = ou._; a;) if ((r = ai(a, s) - o) > lu) a = a.L;else {\n if (!((i = o - function (t, e) {\n var n = t.N;\n if (n) return ai(n, e);\n var r = t.site;\n return r[1] === e ? r[0] : 1 / 0;\n }(a, s)) > lu)) {\n r > -lu ? (e = a.P, n = a) : i > -lu ? (e = a, n = a.N) : e = n = a;\n break;\n }\n if (!a.R) {\n e = a;\n break;\n }\n a = a.R;\n }\n !function (t) {\n su[t.index] = {\n site: t,\n halfedges: []\n };\n }(t);\n var u = ri(t);\n if (ou.insert(e, u), e || n) {\n if (e === n) return ni(e), n = ri(e.site), ou.insert(u, n), u.edge = n.edge = Hr(e.site, u.site), ei(e), void ei(n);\n if (n) {\n ni(e), ni(n);\n var c = e.site,\n h = c[0],\n l = c[1],\n p = t[0] - h,\n f = t[1] - l,\n g = n.site,\n d = g[0] - h,\n y = g[1] - l,\n _ = 2 * (p * y - f * d),\n m = p * p + f * f,\n v = d * d + y * y,\n x = [(y * m - f * v) / _ + h, (p * v - d * m) / _ + l];\n Jr(n.edge, c, g, x), u.edge = Hr(c, t, null, x), n.edge = Hr(t, g, null, x), ei(e), ei(n);\n } else u.edge = Hr(e.site, u.site);\n }\n }\n function ai(t, e) {\n var n = t.site,\n r = n[0],\n i = n[1],\n o = i - e;\n if (!o) return r;\n var s = t.P;\n if (!s) return -1 / 0;\n var a = (n = s.site)[0],\n u = n[1],\n c = u - e;\n if (!c) return a;\n var h = a - r,\n l = 1 / o - 1 / c,\n p = h / c;\n return l ? (-p + Math.sqrt(p * p - 2 * l * (h * h / (-2 * c) - u + c / 2 + i - o / 2))) / l + r : (r + a) / 2;\n }\n function ui(t, e, n) {\n return (t[0] - n[0]) * (e[1] - t[1]) - (t[0] - e[0]) * (n[1] - t[1]);\n }\n function ci(t, e) {\n return e[1] - t[1] || e[0] - t[0];\n }\n function hi(t, e) {\n var n,\n r,\n i,\n o = t.sort(ci).pop();\n for (uu = [], su = new Array(t.length), ou = new jr(), au = new jr();;) if (i = iu, o && (!i || o[1] < i.y || o[1] === i.y && o[0] < i.x)) o[0] === n && o[1] === r || (si(o), n = o[0], r = o[1]), o = t.pop();else {\n if (!i) break;\n oi(i.arc);\n }\n if (function () {\n for (var t, e, n, r, i = 0, o = su.length; i < o; ++i) if ((t = su[i]) && (r = (e = t.halfedges).length)) {\n var s = new Array(r),\n a = new Array(r);\n for (n = 0; n < r; ++n) s[n] = n, a[n] = Qr(t, uu[e[n]]);\n for (s.sort(function (t, e) {\n return a[e] - a[t];\n }), n = 0; n < r; ++n) a[n] = e[s[n]];\n for (n = 0; n < r; ++n) e[n] = a[n];\n }\n }(), e) {\n var s = +e[0][0],\n a = +e[0][1],\n u = +e[1][0],\n c = +e[1][1];\n !function (t, e, n, r) {\n for (var i, o = uu.length; o--;) Kr(i = uu[o], t, e, n, r) && Zr(i, t, e, n, r) && (Math.abs(i[0][0] - i[1][0]) > lu || Math.abs(i[0][1] - i[1][1]) > lu) || delete uu[o];\n }(s, a, u, c), function (t, e, n, r) {\n var i,\n o,\n s,\n a,\n u,\n c,\n h,\n l,\n p,\n f,\n g,\n d,\n y = su.length,\n _ = !0;\n for (i = 0; i < y; ++i) if (o = su[i]) {\n for (s = o.site, a = (u = o.halfedges).length; a--;) uu[u[a]] || u.splice(a, 1);\n for (a = 0, c = u.length; a < c;) g = (f = ti(o, uu[u[a]]))[0], d = f[1], l = (h = $r(o, uu[u[++a % c]]))[0], p = h[1], (Math.abs(g - l) > lu || Math.abs(d - p) > lu) && (u.splice(a, 0, uu.push(Wr(s, f, Math.abs(g - t) < lu && r - d > lu ? [t, Math.abs(l - t) < lu ? p : r] : Math.abs(d - r) < lu && n - g > lu ? [Math.abs(p - r) < lu ? l : n, r] : Math.abs(g - n) < lu && d - e > lu ? [n, Math.abs(l - n) < lu ? p : e] : Math.abs(d - e) < lu && g - t > lu ? [Math.abs(p - e) < lu ? l : t, e] : null)) - 1), ++c);\n c && (_ = !1);\n }\n if (_) {\n var m,\n v,\n x,\n E = 1 / 0;\n for (i = 0, _ = null; i < y; ++i) (o = su[i]) && (x = (m = (s = o.site)[0] - t) * m + (v = s[1] - e) * v) < E && (E = x, _ = o);\n if (_) {\n var w = [t, e],\n b = [t, r],\n I = [n, r],\n N = [n, e];\n _.halfedges.push(uu.push(Wr(s = _.site, w, b)) - 1, uu.push(Wr(s, b, I)) - 1, uu.push(Wr(s, I, N)) - 1, uu.push(Wr(s, N, w)) - 1);\n }\n }\n for (i = 0; i < y; ++i) (o = su[i]) && (o.halfedges.length || delete su[i]);\n }(s, a, u, c);\n }\n this.edges = uu, this.cells = su, ou = au = uu = su = null;\n }\n function li(t) {\n return (t = t.slice()).push(t[0]), o([t]);\n }\n function pi(t, e, n, r) {\n var i = (r = r || {}).steps || 64,\n s = r.units || \"kilometers\",\n a = r.angle || 0,\n u = r.pivot || t,\n c = r.properties || t.properties || {};\n if (!t) throw new Error(\"center is required\");\n if (!e) throw new Error(\"xSemiAxis is required\");\n if (!n) throw new Error(\"ySemiAxis is required\");\n if (!I(r)) throw new Error(\"options must be an object\");\n if (!b(i)) throw new Error(\"steps must be a number\");\n if (!b(a)) throw new Error(\"angle must be a number\");\n var h = X(t);\n if (\"degrees\" === s) var l = x(a);else e = nr(t, e, 90, {\n units: s\n }), n = nr(t, n, 0, {\n units: s\n }), e = X(e)[0] - h[0], n = X(n)[1] - h[1];\n for (var p = [], f = 0; f < i; f += 1) {\n var g = -360 * f / i,\n d = e * n / Math.sqrt(Math.pow(n, 2) + Math.pow(e, 2) * Math.pow(fi(g), 2)),\n y = e * n / Math.sqrt(Math.pow(e, 2) + Math.pow(n, 2) / Math.pow(fi(g), 2));\n if (g < -90 && g >= -270 && (d = -d), g < -180 && g >= -360 && (y = -y), \"degrees\" === s) {\n var _ = d * Math.cos(l) + y * Math.sin(l),\n m = y * Math.cos(l) - d * Math.sin(l);\n d = _, y = m;\n }\n p.push([d + h[0], y + h[1]]);\n }\n return p.push(p[0]), \"degrees\" === s ? o([p], c) : fr(o([p], c), a, {\n pivot: u\n });\n }\n function fi(t) {\n var e = t * Math.PI / 180;\n return Math.tan(e);\n }\n function gi(t, e) {\n if (e = e || {}, !I(e)) throw new Error(\"options is invalid\");\n var n = e.properties,\n i = e.weight;\n if (!t) throw new Error(\"geojson is required\");\n var o = 0,\n s = 0,\n a = 0;\n return A(t, function (t, e, n) {\n var r = n[i];\n if (r = void 0 === r || null === r ? 1 : r, !b(r)) throw new Error(\"weight value must be a number for feature index \" + e);\n (r = Number(r)) > 0 && S(t, function (t) {\n o += t[0] * r, s += t[1] * r, a += r;\n });\n }), r([o / a, s / a], n);\n }\n function di(t, e, n, i) {\n var o = n.properties.tolerance || .001,\n s = 0,\n a = 0,\n u = 0,\n c = 0;\n if (O(n, function (e) {\n var n = e.properties.weight,\n r = void 0 === n || null === n ? 1 : n;\n if (r = Number(r), !b(r)) throw new Error(\"weight value must be a number\");\n if (r > 0) {\n c += 1;\n var i = r * qt(e, t);\n 0 === i && (i = 1);\n var o = r / i;\n s += e.geometry.coordinates[0] * o, a += e.geometry.coordinates[1] * o, u += o;\n }\n }), c < 1) throw new Error(\"no features to measure\");\n var h = s / u,\n l = a / u;\n return 1 === c || 0 === i || Math.abs(h - e[0]) < o && Math.abs(l - e[1]) < o ? r([h, l], {\n medianCandidates: n.properties.medianCandidates\n }) : (n.properties.medianCandidates.push([h, l]), di([h, l], t, n, i - 1));\n }\n function yi(t, e) {\n return {\n x: t[0] - e[0],\n y: t[1] - e[1]\n };\n }\n function _i(t) {\n if (I(t) && (t = t.bbox), t && !Array.isArray(t)) throw new Error(\"bbox is invalid\");\n return t ? function (t) {\n return [Math.random() * (t[2] - t[0]) + t[0], Math.random() * (t[3] - t[1]) + t[1]];\n }(t) : [360 * Ei(), 180 * Ei()];\n }\n function mi(t, e) {\n if (e = e || {}, !I(e)) throw new Error(\"options is invalid\");\n var n = e.bbox;\n void 0 !== t && null !== t || (t = 1);\n for (var i = [], o = 0; o < t; o++) i.push(r(_i(n)));\n return c(i);\n }\n function vi(t, e) {\n if (e = e || {}, !I(e)) throw new Error(\"options is invalid\");\n var n = e.bbox,\n r = e.num_vertices,\n i = e.max_radial_length;\n void 0 !== t && null !== t || (t = 1), b(r) || (r = 10), b(i) || (i = 10);\n for (var s = [], a = 0; a < t; a++) {\n var u = [],\n h = Array.apply(null, new Array(r + 1)).map(Math.random);\n h.forEach(function (t, e, n) {\n n[e] = e > 0 ? t + n[e - 1] : t;\n }), h.forEach(function (t) {\n t = 2 * t * Math.PI / h[h.length - 1];\n var e = Math.random();\n u.push([e * i * Math.sin(t), e * i * Math.cos(t)]);\n }), u[u.length - 1] = u[0], u = u.map(function (t) {\n return function (e) {\n return [e[0] + t[0], e[1] + t[1]];\n };\n }(_i(n))), s.push(o([u]));\n }\n return c(s);\n }\n function xi(t, e) {\n if (e = e || {}, !I(e)) throw new Error(\"options is invalid\");\n var n = e.bbox,\n r = e.num_vertices,\n i = e.max_length,\n o = e.max_rotation;\n void 0 !== t && null !== t || (t = 1), (!b(r) || r < 2) && (r = 10), b(i) || (i = 1e-4), b(o) || (o = Math.PI / 8);\n for (var s = [], u = 0; u < t; u++) {\n for (var h = [_i(n)], l = 0; l < r - 1; l++) {\n var p = (0 === l ? 2 * Math.random() * Math.PI : Math.tan((h[l][1] - h[l - 1][1]) / (h[l][0] - h[l - 1][0]))) + (Math.random() - .5) * o * 2,\n f = Math.random() * i;\n h.push([h[l][0] + f * Math.cos(p), h[l][1] + f * Math.sin(p)]);\n }\n s.push(a(h));\n }\n return c(s);\n }\n function Ei() {\n return Math.random() - .5;\n }\n function wi(t, e) {\n if (!t) throw new Error(\"geojson is required\");\n if (\"FeatureCollection\" !== t.type) throw new Error(\"geojson must be a FeatureCollection\");\n if (void 0 === e || null === e) throw new Error(\"filter is required\");\n var n = [];\n return O(t, function (t) {\n Ci(t.properties, e) && n.push(t);\n }), c(n);\n }\n function bi(t, e, n) {\n if (!t) throw new Error(\"geojson is required\");\n if (\"FeatureCollection\" !== t.type) throw new Error(\"geojson must be a FeatureCollection\");\n if (void 0 === e || null === e) throw new Error(\"property is required\");\n for (var r = Ni(t, e), i = Object.keys(r), o = 0; o < i.length; o++) {\n for (var s = i[o], a = r[s], u = [], h = 0; h < a.length; h++) u.push(t.features[a[h]]);\n n(c(u), s, o);\n }\n }\n function Ii(t, e, n, r) {\n var i = r;\n return bi(t, e, function (t, e, o) {\n i = 0 === o && void 0 === r ? t : n(i, t, e, o);\n }), i;\n }\n function Ni(t, e) {\n var n = {};\n return O(t, function (t, r) {\n var i = t.properties || {};\n if (i.hasOwnProperty(e)) {\n var o = i[e];\n n.hasOwnProperty(o) ? n[o].push(r) : n[o] = [r];\n }\n }), n;\n }\n function Ci(t, e) {\n if (void 0 === t) return !1;\n var n = typeof e;\n if (\"number\" === n || \"string\" === n) return t.hasOwnProperty(e);\n if (Array.isArray(e)) {\n for (var r = 0; r < e.length; r++) if (!Ci(t, e[r])) return !1;\n return !0;\n }\n return Si(t, e);\n }\n function Si(t, e) {\n for (var n = Object.keys(e), r = 0; r < n.length; r++) {\n var i = n[r];\n if (t[i] !== e[i]) return !1;\n }\n return !0;\n }\n function Mi(t, e) {\n if (!e) return {};\n if (!e.length) return {};\n for (var n = {}, r = 0; r < e.length; r++) {\n var i = e[r];\n t.hasOwnProperty(i) && (n[i] = t[i]);\n }\n return n;\n }\n function Li() {}\n function Pi(t) {\n this.message = t || \"\";\n }\n function Oi(t) {\n this.message = t || \"\";\n }\n function Ri() {}\n function Ti(t) {\n return null === t ? Ac : t.color;\n }\n function Ai(t) {\n return null === t ? null : t.parent;\n }\n function Di(t, e) {\n null !== t && (t.color = e);\n }\n function Fi(t) {\n return null === t ? null : t.left;\n }\n function qi(t) {\n return null === t ? null : t.right;\n }\n function Gi() {\n this.root_ = null, this.size_ = 0;\n }\n function Bi() {}\n function ki() {\n this.array_ = [], arguments[0] instanceof vc && this.addAll(arguments[0]);\n }\n function zi() {}\n function ji(t) {\n this.message = t || \"\";\n }\n function Xi() {\n this.array_ = [];\n }\n function Ui(t) {\n switch (t.type) {\n case \"Polygon\":\n return mn(t) > 1 ? t : null;\n case \"MultiPolygon\":\n var e = [];\n if (F(t, function (t) {\n mn(t) > 1 && e.push(t.geometry.coordinates);\n }), e.length) return {\n type: \"MultiPolygon\",\n coordinates: e\n };\n }\n }\n function Yi() {\n this.reset();\n }\n function Vi(t, e, n) {\n var r = t.s = e + n,\n i = r - e,\n o = r - i;\n t.t = e - o + (n - i);\n }\n function Hi(t) {\n return t > 1 ? kf : t < -1 ? -kf : Math.asin(t);\n }\n function Wi() {}\n function Ji(t, e) {\n t && eg.hasOwnProperty(t.type) && eg[t.type](t, e);\n }\n function Zi(t, e, n) {\n var r,\n i = -1,\n o = t.length - n;\n for (e.lineStart(); ++i < o;) r = t[i], e.point(r[0], r[1], r[2]);\n e.lineEnd();\n }\n function Ki(t, e) {\n var n = -1,\n r = t.length;\n for (e.polygonStart(); ++n < r;) Zi(t[n], e, 1);\n e.polygonEnd();\n }\n function Qi(t) {\n return [Hf(t[1], t[0]), Hi(t[2])];\n }\n function $i(t) {\n var e = t[0],\n n = t[1],\n r = Wf(n);\n return [r * Wf(e), r * Kf(e), Kf(n)];\n }\n function to(t, e) {\n return t[0] * e[0] + t[1] * e[1] + t[2] * e[2];\n }\n function eo(t, e) {\n return [t[1] * e[2] - t[2] * e[1], t[2] * e[0] - t[0] * e[2], t[0] * e[1] - t[1] * e[0]];\n }\n function no(t, e) {\n t[0] += e[0], t[1] += e[1], t[2] += e[2];\n }\n function ro(t, e) {\n return [t[0] * e, t[1] * e, t[2] * e];\n }\n function io(t) {\n var e = Qf(t[0] * t[0] + t[1] * t[1] + t[2] * t[2]);\n t[0] /= e, t[1] /= e, t[2] /= e;\n }\n function oo(t, e) {\n return [t > Bf ? t - jf : t < -Bf ? t + jf : t, e];\n }\n function so(t, e, n) {\n return (t %= jf) ? e || n ? rg(uo(t), co(e, n)) : uo(t) : e || n ? co(e, n) : oo;\n }\n function ao(t) {\n return function (e, n) {\n return e += t, [e > Bf ? e - jf : e < -Bf ? e + jf : e, n];\n };\n }\n function uo(t) {\n var e = ao(t);\n return e.invert = ao(-t), e;\n }\n function co(t, e) {\n function n(t, e) {\n var n = Wf(e),\n a = Wf(t) * n,\n u = Kf(t) * n,\n c = Kf(e),\n h = c * r + a * i;\n return [Hf(u * o - h * s, a * r - c * i), Hi(h * o + u * s)];\n }\n var r = Wf(t),\n i = Kf(t),\n o = Wf(e),\n s = Kf(e);\n return n.invert = function (t, e) {\n var n = Wf(e),\n a = Wf(t) * n,\n u = Kf(t) * n,\n c = Kf(e),\n h = c * o - u * s;\n return [Hf(u * o + c * s, a * r + h * i), Hi(h * r - a * i)];\n }, n;\n }\n function ho(t, e) {\n (e = $i(e))[0] -= t, io(e);\n var n = function (t) {\n return t > 1 ? 0 : t < -1 ? Bf : Math.acos(t);\n }(-e[1]);\n return ((-e[2] < 0 ? -n : n) + jf - Gf) % jf;\n }\n function lo(t, e, n, r) {\n this.x = t, this.z = e, this.o = n, this.e = r, this.v = !1, this.n = this.p = null;\n }\n function po(t) {\n if (e = t.length) {\n for (var e, n, r = 0, i = t[0]; ++r < e;) i.n = n = t[r], n.p = i, i = n;\n i.n = n = t[0], n.p = i;\n }\n }\n function fo(t, e, n, r) {\n function i(i, o) {\n return t <= i && i <= n && e <= o && o <= r;\n }\n function o(i, o, a, c) {\n var h = 0,\n l = 0;\n if (null == i || (h = s(i, a)) !== (l = s(o, a)) || u(i, o) < 0 ^ a > 0) do {\n c.point(0 === h || 3 === h ? t : n, h > 1 ? r : e);\n } while ((h = (h + a + 4) % 4) !== l);else c.point(o[0], o[1]);\n }\n function s(r, i) {\n return Yf(r[0] - t) < Gf ? i > 0 ? 0 : 3 : Yf(r[0] - n) < Gf ? i > 0 ? 2 : 1 : Yf(r[1] - e) < Gf ? i > 0 ? 1 : 0 : i > 0 ? 3 : 2;\n }\n function a(t, e) {\n return u(t.x, e.x);\n }\n function u(t, e) {\n var n = s(t, 1),\n r = s(e, 1);\n return n !== r ? n - r : 0 === n ? e[1] - t[1] : 1 === n ? t[0] - e[0] : 2 === n ? t[1] - e[1] : e[0] - t[0];\n }\n return function (s) {\n function u(t, e) {\n i(t, e) && E.point(t, e);\n }\n function c(o, s) {\n var a = i(o, s);\n if (l && p.push([o, s]), v) f = o, g = s, d = a, v = !1, a && (E.lineStart(), E.point(o, s));else if (a && m) E.point(o, s);else {\n var u = [y = Math.max(pg, Math.min(lg, y)), _ = Math.max(pg, Math.min(lg, _))],\n c = [o = Math.max(pg, Math.min(lg, o)), s = Math.max(pg, Math.min(lg, s))];\n sg(u, c, t, e, n, r) ? (m || (E.lineStart(), E.point(u[0], u[1])), E.point(c[0], c[1]), a || E.lineEnd(), x = !1) : a && (E.lineStart(), E.point(o, s), x = !1);\n }\n y = o, _ = s, m = a;\n }\n var h,\n l,\n p,\n f,\n g,\n d,\n y,\n _,\n m,\n v,\n x,\n E = s,\n w = og(),\n b = {\n point: u,\n lineStart: function () {\n b.point = c, l && l.push(p = []), v = !0, m = !1, y = _ = NaN;\n },\n lineEnd: function () {\n h && (c(f, g), d && m && w.rejoin(), h.push(w.result())), b.point = u, m && E.lineEnd();\n },\n polygonStart: function () {\n E = w, h = [], l = [], x = !0;\n },\n polygonEnd: function () {\n var e = function () {\n for (var e = 0, n = 0, i = l.length; n < i; ++n) for (var o, s, a = l[n], u = 1, c = a.length, h = a[0], p = h[0], f = h[1]; u < c; ++u) o = p, s = f, p = (h = a[u])[0], f = h[1], s <= r ? f > r && (p - o) * (r - s) > (f - s) * (t - o) && ++e : f <= r && (p - o) * (r - s) < (f - s) * (t - o) && --e;\n return e;\n }(),\n n = x && e,\n i = (h = hg(h)).length;\n (n || i) && (s.polygonStart(), n && (s.lineStart(), o(null, null, 1, s), s.lineEnd()), i && ug(h, a, e, o, s), s.polygonEnd()), E = s, h = l = p = null;\n }\n };\n return b;\n };\n }\n function go(t) {\n return t.length > 1;\n }\n function yo(t, e) {\n return ((t = t.x)[0] < 0 ? t[1] - kf - Gf : kf - t[1]) - ((e = e.x)[0] < 0 ? e[1] - kf - Gf : kf - e[1]);\n }\n function _o(t) {\n return function (e) {\n var n = new mo();\n for (var r in t) n[r] = t[r];\n return n.stream = e, n;\n };\n }\n function mo() {}\n function vo(t, e, n) {\n var r = e[1][0] - e[0][0],\n i = e[1][1] - e[0][1],\n o = t.clipExtent && t.clipExtent();\n t.scale(150).translate([0, 0]), null != o && t.clipExtent(null), ng(n, t.stream(vg));\n var s = vg.result(),\n a = Math.min(r / (s[1][0] - s[0][0]), i / (s[1][1] - s[0][1])),\n u = +e[0][0] + (r - a * (s[1][0] + s[0][0])) / 2,\n c = +e[0][1] + (i - a * (s[1][1] + s[0][1])) / 2;\n return null != o && t.clipExtent(o), t.scale(150 * a).translate([u, c]);\n }\n function xo(t) {\n return function (t) {\n function e(t) {\n return t = c(t[0] * Uf, t[1] * Uf), [t[0] * d + s, a - t[1] * d];\n }\n function n(t, e) {\n return t = o(t, e), [t[0] * d + s, a - t[1] * d];\n }\n function r() {\n c = rg(u = so(x, E, w), o);\n var t = o(m, v);\n return s = y - t[0] * d, a = _ + t[1] * d, i();\n }\n function i() {\n return f = g = null, e;\n }\n var o,\n s,\n a,\n u,\n c,\n h,\n l,\n p,\n f,\n g,\n d = 150,\n y = 480,\n _ = 250,\n m = 0,\n v = 0,\n x = 0,\n E = 0,\n w = 0,\n b = null,\n I = Eg,\n N = null,\n C = gg,\n S = .5,\n M = Ng(n, S);\n e.stream = function (t) {\n return f && g === t ? f : f = Cg(I(u, M(C(g = t))));\n }, e.clipAngle = function (t) {\n return arguments.length ? (I = +t ? wg(b = t * Uf, 6 * Uf) : (b = null, Eg), i()) : b * Xf;\n }, e.clipExtent = function (t) {\n return arguments.length ? (C = null == t ? (N = h = l = p = null, gg) : fo(N = +t[0][0], h = +t[0][1], l = +t[1][0], p = +t[1][1]), i()) : null == N ? null : [[N, h], [l, p]];\n }, e.scale = function (t) {\n return arguments.length ? (d = +t, r()) : d;\n }, e.translate = function (t) {\n return arguments.length ? (y = +t[0], _ = +t[1], r()) : [y, _];\n }, e.center = function (t) {\n return arguments.length ? (m = t[0] % 360 * Uf, v = t[1] % 360 * Uf, r()) : [m * Xf, v * Xf];\n }, e.rotate = function (t) {\n return arguments.length ? (x = t[0] % 360 * Uf, E = t[1] % 360 * Uf, w = t.length > 2 ? t[2] % 360 * Uf : 0, r()) : [x * Xf, E * Xf, w * Xf];\n }, e.precision = function (t) {\n return arguments.length ? (M = Ng(n, S = t * t), i()) : Qf(S);\n }, e.fitExtent = function (t, n) {\n return vo(e, t, n);\n }, e.fitSize = function (t, n) {\n return function (t, e, n) {\n return vo(t, [[0, 0], e], n);\n }(e, t, n);\n };\n return function () {\n return o = t.apply(this, arguments), e.invert = o.invert && function (t) {\n return (t = c.invert((t[0] - s) / d, (a - t[1]) / d)) && [t[0] * Xf, t[1] * Xf];\n }, r();\n };\n }(function () {\n return t;\n })();\n }\n function Eo(t, e) {\n return [t, Zf($f((kf + e) / 2))];\n }\n function wo(t, e) {\n return [Zf($f((kf + e) / 2)), -t];\n }\n function bo(t, n, r, i) {\n var o = t.properties || {},\n s = \"Feature\" === t.type ? t.geometry : t;\n if (\"GeometryCollection\" === s.type) {\n var a = [];\n return A(t, function (t) {\n var e = bo(t, n, r, i);\n e && a.push(e);\n }), c(a);\n }\n var u,\n h = j(t),\n l = h[1] > 50 && h[3] > 50;\n u = l ? {\n type: s.type,\n coordinates: No(s.coordinates, So(s))\n } : cn(s);\n var p = new bh().read(u),\n f = d(y(n, r), \"meters\"),\n g = gp.bufferOp(p, f);\n if (g = new Ih().write(g), !Io(g.coordinates)) {\n var _;\n return (_ = l ? {\n type: g.type,\n coordinates: Co(g.coordinates, So(s))\n } : hn(g)).geometry ? _ : e(_, o);\n }\n }\n function Io(t) {\n return Array.isArray(t[0]) ? Io(t[0]) : isNaN(t[0]);\n }\n function No(t, e) {\n return \"object\" != typeof t[0] ? e(t) : t.map(function (t) {\n return No(t, e);\n });\n }\n function Co(t, e) {\n return \"object\" != typeof t[0] ? e.invert(t) : t.map(function (t) {\n return Co(t, e);\n });\n }\n function So(t) {\n var e = de(t).geometry.coordinates.reverse(),\n n = e.map(function (t) {\n return -t;\n });\n return Sg().center(e).rotate(n).scale(Fo);\n }\n function Mo() {\n for (var t = new bh(), e = t.read(JSON.stringify(arguments[0].geometry)), n = 1; n < arguments.length; n++) e = Df.union(e, t.read(JSON.stringify(arguments[n].geometry)));\n return e = new Ih().write(e), {\n type: \"Feature\",\n geometry: e,\n properties: arguments[0].properties\n };\n }\n function Lo(t, n) {\n var r = J(t),\n i = J(n);\n if (te(Pn(i, {\n precision: 4\n })).coordinates[0].length < 4) return null;\n if (te(Pn(r, {\n precision: 4\n })).coordinates[0].length < 4) return null;\n var o = new bh(),\n s = o.read(Pn(r)),\n a = o.read(Pn(i)),\n u = Cf.intersection(s, a);\n if (u.isEmpty()) return null;\n return e(new Ih().write(u));\n }\n function Po(t, e) {\n return function (t, e, n) {\n var r, i;\n if (!Array.isArray(e)) throw new Error(\"Get closest expects an array as second argument\");\n return e.forEach(function (e, o) {\n var s = n(e, t);\n s >= 0 && (void 0 === i || s < i) && (i = s, r = o);\n }), r;\n }(t, e, function (t, e) {\n return t - e;\n });\n }\n function Oo(t, e, n) {\n if (n = n || {}, !I(n)) throw new Error(\"options is invalid\");\n var r = n.properties || {},\n i = n.triangles,\n s = n.mask;\n if (null === e || void 0 === e) throw new Error(\"cellSide is required\");\n if (!b(e)) throw new Error(\"cellSide is invalid\");\n if (!t) throw new Error(\"bbox is required\");\n if (!Array.isArray(t)) throw new Error(\"bbox must be array\");\n if (4 !== t.length) throw new Error(\"bbox must contain 4 numbers\");\n if (s && -1 === [\"Polygon\", \"MultiPolygon\"].indexOf(K(s))) throw new Error(\"options.mask must be a (Multi)Polygon\");\n var a = t[0],\n u = t[1],\n h = t[2],\n l = t[3],\n p = (u + l) / 2,\n f = (a + h) / 2,\n g = 2 * e / qt([a, p], [h, p], n) * (h - a),\n d = 2 * e / qt([f, u], [f, l], n) * (l - u),\n y = g / 2,\n _ = 2 * y,\n m = Math.sqrt(3) / 2 * d,\n v = h - a,\n x = l - u,\n E = .75 * _,\n w = m,\n N = (v - _) / (_ - y / 2),\n C = Math.floor(N),\n S = (C * E - y / 2 - v) / 2 - y / 2 + E / 2,\n M = Math.floor((x - m) / m),\n L = (x - M * m) / 2,\n P = M * m - x > m / 2;\n P && (L -= m / 4);\n for (var O = [], R = [], T = 0; T < 6; T++) {\n var A = 2 * Math.PI / 6 * T;\n O.push(Math.cos(A)), R.push(Math.sin(A));\n }\n for (var D = [], F = 0; F <= C; F++) for (var q = 0; q <= M; q++) {\n var G = F % 2 == 1;\n if ((0 !== q || !G) && (0 !== q || !P)) {\n var B = F * E + a - S,\n k = q * w + u + L;\n if (G && (k -= m / 2), !0 === i) (function (t, e, n, r, i, s) {\n for (var a = [], u = 0; u < 6; u++) {\n var c = [];\n c.push(t), c.push([t[0] + e * i[u], t[1] + n * s[u]]), c.push([t[0] + e * i[(u + 1) % 6], t[1] + n * s[(u + 1) % 6]]), c.push(t), a.push(o([c], r));\n }\n return a;\n })([B, k], g / 2, d / 2, r, O, R).forEach(function (t) {\n s ? Lo(s, t) && D.push(t) : D.push(t);\n });else {\n var z = function (t, e, n, r, i, s) {\n for (var a = [], u = 0; u < 6; u++) {\n var c = t[0] + e * i[u],\n h = t[1] + n * s[u];\n a.push([c, h]);\n }\n return a.push(a[0].slice()), o([a], r);\n }([B, k], g / 2, d / 2, r, O, R);\n s ? Lo(s, z) && D.push(z) : D.push(z);\n }\n }\n }\n return c(D);\n }\n function Ro(t) {\n if (t.features.length <= 1) return t;\n var e = function (t) {\n var e = Vo(),\n n = [];\n return F(t, function (t, e) {\n var r = j(t);\n n.push({\n minX: r[0],\n minY: r[1],\n maxX: r[2],\n maxY: r[3],\n geojson: t,\n index: e\n });\n }), e.load(n), e;\n }(t),\n n = [],\n r = {};\n return F(t, function (t, i) {\n if (r[i]) return !0;\n for (e.remove({\n index: i\n }, To), r[i] = !0;;) {\n var o = j(t),\n s = e.search({\n minX: o[0],\n minY: o[1],\n maxX: o[2],\n maxY: o[3]\n });\n if (s.length > 0) {\n var a = s.map(function (t) {\n return r[t.index] = !0, e.remove({\n index: t.index\n }, To), t.geojson;\n });\n a.push(t), t = Mo.apply(this, a);\n }\n if (0 === s.length) break;\n }\n n.push(t);\n }), c(n);\n }\n function To(t, e) {\n return t.index === e.index;\n }\n function Ao(t, e, n) {\n if (n = n || {}, !I(n)) throw new Error(\"options is invalid\");\n var r = n.properties,\n i = n.mask,\n s = [];\n if (null === e || void 0 === e) throw new Error(\"cellSide is required\");\n if (!b(e)) throw new Error(\"cellSide is invalid\");\n if (!t) throw new Error(\"bbox is required\");\n if (!Array.isArray(t)) throw new Error(\"bbox must be array\");\n if (4 !== t.length) throw new Error(\"bbox must contain 4 numbers\");\n if (i && -1 === [\"Polygon\", \"MultiPolygon\"].indexOf(K(i))) throw new Error(\"options.mask must be a (Multi)Polygon\");\n for (var a = t[0], u = t[1], h = t[2], l = t[3], p = e / qt([a, u], [h, u], n) * (h - a), f = e / qt([a, u], [a, l], n) * (l - u), g = h - a, d = l - u, y = Math.floor(g / p), _ = Math.floor(d / f), m = (d - _ * f) / 2, v = a + (g - y * p) / 2, x = 0; x < y; x++) {\n for (var E = u + m, w = 0; w < _; w++) {\n var N = o([[[v, E], [v, E + f], [v + p, E + f], [v + p, E], [v, E]]], r);\n i ? Lo(i, N) && s.push(N) : s.push(N), E += f;\n }\n v += p;\n }\n return c(s);\n }\n function Do(t, e, n) {\n if (n = n || {}, !I(n)) throw new Error(\"options is invalid\");\n var r = n.properties,\n i = n.mask,\n s = [];\n if (null === e || void 0 === e) throw new Error(\"cellSide is required\");\n if (!b(e)) throw new Error(\"cellSide is invalid\");\n if (!t) throw new Error(\"bbox is required\");\n if (!Array.isArray(t)) throw new Error(\"bbox must be array\");\n if (4 !== t.length) throw new Error(\"bbox must contain 4 numbers\");\n if (i && -1 === [\"Polygon\", \"MultiPolygon\"].indexOf(K(i))) throw new Error(\"options.mask must be a (Multi)Polygon\");\n for (var a = e / qt([t[0], t[1]], [t[2], t[1]], n) * (t[2] - t[0]), u = e / qt([t[0], t[1]], [t[0], t[3]], n) * (t[3] - t[1]), h = 0, l = t[0]; l <= t[2];) {\n for (var p = 0, f = t[1]; f <= t[3];) {\n var g = null,\n d = null;\n h % 2 == 0 && p % 2 == 0 ? (g = o([[[l, f], [l, f + u], [l + a, f], [l, f]]], r), d = o([[[l, f + u], [l + a, f + u], [l + a, f], [l, f + u]]], r)) : h % 2 == 0 && p % 2 == 1 ? (g = o([[[l, f], [l + a, f + u], [l + a, f], [l, f]]], r), d = o([[[l, f], [l, f + u], [l + a, f + u], [l, f]]], r)) : p % 2 == 0 && h % 2 == 1 ? (g = o([[[l, f], [l, f + u], [l + a, f + u], [l, f]]], r), d = o([[[l, f], [l + a, f + u], [l + a, f], [l, f]]], r)) : p % 2 == 1 && h % 2 == 1 && (g = o([[[l, f], [l, f + u], [l + a, f], [l, f]]], r), d = o([[[l, f + u], [l + a, f + u], [l + a, f], [l, f + u]]], r)), i ? (Lo(i, g) && s.push(g), Lo(i, d) && s.push(d)) : (s.push(g), s.push(d)), f += u, p++;\n }\n h++, l += a;\n }\n return c(s);\n }\n var Fo = 6371008.8,\n qo = {\n meters: Fo,\n metres: Fo,\n millimeters: 1e3 * Fo,\n millimetres: 1e3 * Fo,\n centimeters: 100 * Fo,\n centimetres: 100 * Fo,\n kilometers: Fo / 1e3,\n kilometres: Fo / 1e3,\n miles: Fo / 1609.344,\n nauticalmiles: Fo / 1852,\n inches: 39.37 * Fo,\n yards: Fo / 1.0936,\n feet: 3.28084 * Fo,\n radians: 1,\n degrees: Fo / 111325\n },\n Go = {\n meters: 1,\n metres: 1,\n millimeters: 1e3,\n millimetres: 1e3,\n centimeters: 100,\n centimetres: 100,\n kilometers: .001,\n kilometres: .001,\n miles: 1 / 1609.344,\n nauticalmiles: 1 / 1852,\n inches: 39.37,\n yards: 1 / 1.0936,\n feet: 3.28084,\n radians: 1 / Fo,\n degrees: 1 / 111325\n },\n Bo = {\n meters: 1,\n metres: 1,\n millimeters: 1e6,\n millimetres: 1e6,\n centimeters: 1e4,\n centimetres: 1e4,\n kilometers: 1e-6,\n kilometres: 1e-6,\n acres: 247105e-9,\n miles: 3.86e-7,\n yards: 1.195990046,\n feet: 10.763910417,\n inches: 1550.003100006\n },\n ko = Object.freeze({\n earthRadius: Fo,\n factors: qo,\n unitsFactors: Go,\n areaFactors: Bo,\n feature: e,\n geometry: n,\n point: r,\n points: i,\n polygon: o,\n polygons: s,\n lineString: a,\n lineStrings: u,\n featureCollection: c,\n multiLineString: h,\n multiPoint: l,\n multiPolygon: p,\n geometryCollection: f,\n round: g,\n radiansToLength: d,\n lengthToRadians: y,\n lengthToDegrees: _,\n bearingToAzimuth: m,\n radiansToDegrees: v,\n degreesToRadians: x,\n convertLength: E,\n convertArea: w,\n isNumber: b,\n isObject: I,\n validateBBox: N,\n validateId: C,\n radians2degrees: function () {\n throw new Error(\"method has been renamed to `radiansToDegrees`\");\n },\n degrees2radians: function () {\n throw new Error(\"method has been renamed to `degreesToRadians`\");\n },\n distanceToDegrees: function () {\n throw new Error(\"method has been renamed to `lengthToDegrees`\");\n },\n distanceToRadians: function () {\n throw new Error(\"method has been renamed to `lengthToRadians`\");\n },\n radiansToDistance: function () {\n throw new Error(\"method has been renamed to `radiansToLength`\");\n },\n bearingToAngle: function () {\n throw new Error(\"method has been renamed to `bearingToAzimuth`\");\n },\n convertDistance: function () {\n throw new Error(\"method has been renamed to `convertLength`\");\n }\n }),\n zo = Object.freeze({\n coordEach: S,\n coordReduce: M,\n propEach: L,\n propReduce: P,\n featureEach: O,\n featureReduce: R,\n coordAll: T,\n geomEach: A,\n geomReduce: D,\n flattenEach: F,\n flattenReduce: q,\n segmentEach: G,\n segmentReduce: B,\n lineEach: k,\n lineReduce: z\n }),\n jo = Object.freeze({\n getCoord: X,\n getCoords: U,\n containsNumber: Y,\n geojsonType: V,\n featureOf: H,\n collectionOf: W,\n getGeom: J,\n getGeomType: Z,\n getType: K\n }),\n Xo = {\n successCallback: null,\n verbose: !1\n },\n Uo = {},\n Yo = it,\n Vo = st;\n st.prototype = {\n all: function () {\n return this._all(this.data, []);\n },\n search: function (t) {\n var e = this.data,\n n = [],\n r = this.toBBox;\n if (!dt(t, e)) return n;\n for (var i, o, s, a, u = []; e;) {\n for (i = 0, o = e.children.length; i < o; i++) s = e.children[i], dt(t, a = e.leaf ? r(s) : s) && (e.leaf ? n.push(s) : gt(t, a) ? this._all(s, n) : u.push(s));\n e = u.pop();\n }\n return n;\n },\n collides: function (t) {\n var e = this.data,\n n = this.toBBox;\n if (!dt(t, e)) return !1;\n for (var r, i, o, s, a = []; e;) {\n for (r = 0, i = e.children.length; r < i; r++) if (o = e.children[r], s = e.leaf ? n(o) : o, dt(t, s)) {\n if (e.leaf || gt(t, s)) return !0;\n a.push(o);\n }\n e = a.pop();\n }\n return !1;\n },\n load: function (t) {\n if (!t || !t.length) return this;\n if (t.length < this._minEntries) {\n for (var e = 0, n = t.length; e < n; e++) this.insert(t[e]);\n return this;\n }\n var r = this._build(t.slice(), 0, t.length - 1, 0);\n if (this.data.children.length) {\n if (this.data.height === r.height) this._splitRoot(this.data, r);else {\n if (this.data.height < r.height) {\n var i = this.data;\n this.data = r, r = i;\n }\n this._insert(r, this.data.height - r.height - 1, !0);\n }\n } else this.data = r;\n return this;\n },\n insert: function (t) {\n return t && this._insert(t, this.data.height - 1), this;\n },\n clear: function () {\n return this.data = yt([]), this;\n },\n remove: function (t, e) {\n if (!t) return this;\n for (var n, r, i, o, s = this.data, a = this.toBBox(t), u = [], c = []; s || u.length;) {\n if (s || (s = u.pop(), r = u[u.length - 1], n = c.pop(), o = !0), s.leaf && -1 !== (i = function (t, e, n) {\n if (!n) return e.indexOf(t);\n for (var r = 0; r < e.length; r++) if (n(t, e[r])) return r;\n return -1;\n }(t, s.children, e))) return s.children.splice(i, 1), u.push(s), this._condense(u), this;\n o || s.leaf || !gt(s, a) ? r ? (n++, s = r.children[n], o = !1) : s = null : (u.push(s), c.push(n), n = 0, r = s, s = s.children[0]);\n }\n return this;\n },\n toBBox: function (t) {\n return t;\n },\n compareMinX: ht,\n compareMinY: lt,\n toJSON: function () {\n return this.data;\n },\n fromJSON: function (t) {\n return this.data = t, this;\n },\n _all: function (t, e) {\n for (var n = []; t;) t.leaf ? e.push.apply(e, t.children) : n.push.apply(n, t.children), t = n.pop();\n return e;\n },\n _build: function (t, e, n, r) {\n var i,\n o = n - e + 1,\n s = this._maxEntries;\n if (o <= s) return i = yt(t.slice(e, n + 1)), at(i, this.toBBox), i;\n r || (r = Math.ceil(Math.log(o) / Math.log(s)), s = Math.ceil(o / Math.pow(s, r - 1))), (i = yt([])).leaf = !1, i.height = r;\n var a,\n u,\n c,\n h,\n l = Math.ceil(o / s),\n p = l * Math.ceil(Math.sqrt(s));\n for (_t(t, e, n, p, this.compareMinX), a = e; a <= n; a += p) for (_t(t, a, c = Math.min(a + p - 1, n), l, this.compareMinY), u = a; u <= c; u += l) h = Math.min(u + l - 1, c), i.children.push(this._build(t, u, h, r - 1));\n return at(i, this.toBBox), i;\n },\n _chooseSubtree: function (t, e, n, r) {\n for (var i, o, s, a, u, c, h, l; r.push(e), !e.leaf && r.length - 1 !== n;) {\n for (h = l = 1 / 0, i = 0, o = e.children.length; i < o; i++) u = pt(s = e.children[i]), (c = function (t, e) {\n return (Math.max(e.maxX, t.maxX) - Math.min(e.minX, t.minX)) * (Math.max(e.maxY, t.maxY) - Math.min(e.minY, t.minY));\n }(t, s) - u) < l ? (l = c, h = u < h ? u : h, a = s) : c === l && u < h && (h = u, a = s);\n e = a || e.children[0];\n }\n return e;\n },\n _insert: function (t, e, n) {\n var r = this.toBBox,\n i = n ? t : r(t),\n o = [],\n s = this._chooseSubtree(i, this.data, e, o);\n for (s.children.push(t), ct(s, i); e >= 0 && o[e].children.length > this._maxEntries;) this._split(o, e), e--;\n this._adjustParentBBoxes(i, o, e);\n },\n _split: function (t, e) {\n var n = t[e],\n r = n.children.length,\n i = this._minEntries;\n this._chooseSplitAxis(n, i, r);\n var o = this._chooseSplitIndex(n, i, r),\n s = yt(n.children.splice(o, n.children.length - o));\n s.height = n.height, s.leaf = n.leaf, at(n, this.toBBox), at(s, this.toBBox), e ? t[e - 1].children.push(s) : this._splitRoot(n, s);\n },\n _splitRoot: function (t, e) {\n this.data = yt([t, e]), this.data.height = t.height + 1, this.data.leaf = !1, at(this.data, this.toBBox);\n },\n _chooseSplitIndex: function (t, e, n) {\n var r, i, o, s, a, u, c, h;\n for (u = c = 1 / 0, r = e; r <= n - e; r++) s = function (t, e) {\n var n = Math.max(t.minX, e.minX),\n r = Math.max(t.minY, e.minY),\n i = Math.min(t.maxX, e.maxX),\n o = Math.min(t.maxY, e.maxY);\n return Math.max(0, i - n) * Math.max(0, o - r);\n }(i = ut(t, 0, r, this.toBBox), o = ut(t, r, n, this.toBBox)), a = pt(i) + pt(o), s < u ? (u = s, h = r, c = a < c ? a : c) : s === u && a < c && (c = a, h = r);\n return h;\n },\n _chooseSplitAxis: function (t, e, n) {\n var r = t.leaf ? this.compareMinX : ht,\n i = t.leaf ? this.compareMinY : lt;\n this._allDistMargin(t, e, n, r) < this._allDistMargin(t, e, n, i) && t.children.sort(r);\n },\n _allDistMargin: function (t, e, n, r) {\n t.children.sort(r);\n var i,\n o,\n s = this.toBBox,\n a = ut(t, 0, e, s),\n u = ut(t, n - e, n, s),\n c = ft(a) + ft(u);\n for (i = e; i < n - e; i++) o = t.children[i], ct(a, t.leaf ? s(o) : o), c += ft(a);\n for (i = n - e - 1; i >= e; i--) o = t.children[i], ct(u, t.leaf ? s(o) : o), c += ft(u);\n return c;\n },\n _adjustParentBBoxes: function (t, e, n) {\n for (var r = n; r >= 0; r--) ct(e[r], t);\n },\n _condense: function (t) {\n for (var e, n = t.length - 1; n >= 0; n--) 0 === t[n].children.length ? n > 0 ? (e = t[n - 1].children).splice(e.indexOf(t[n]), 1) : this.clear() : at(t[n], this.toBBox);\n },\n _initFormat: function (t) {\n var e = [\"return a\", \" - b\", \";\"];\n this.compareMinX = new Function(\"a\", \"b\", e.join(t[0])), this.compareMinY = new Function(\"a\", \"b\", e.join(t[1])), this.toBBox = new Function(\"a\", \"return {minX: a\" + t[0] + \", minY: a\" + t[1] + \", maxX: a\" + t[2] + \", maxY: a\" + t[3] + \"};\");\n }\n };\n var Ho = function (t, e, n) {\n var r = t * e,\n i = Wo * t,\n o = i - (i - t),\n s = t - o,\n a = Wo * e,\n u = a - (a - e),\n c = e - u,\n h = s * c - (r - o * u - s * u - o * c);\n return n ? (n[0] = h, n[1] = r, n) : [h, r];\n },\n Wo = +(Math.pow(2, 27) + 1),\n Jo = function (t, e) {\n var n = 0 | t.length,\n r = 0 | e.length;\n if (1 === n && 1 === r) return function (t, e) {\n var n = t + e,\n r = n - t,\n i = t - (n - r) + (e - r);\n return i ? [i, n] : [n];\n }(t[0], e[0]);\n var i,\n o,\n s = n + r,\n a = new Array(s),\n u = 0,\n c = 0,\n h = 0,\n l = Math.abs,\n p = t[c],\n f = l(p),\n g = e[h],\n d = l(g);\n f < d ? (o = p, (c += 1) < n && (f = l(p = t[c]))) : (o = g, (h += 1) < r && (d = l(g = e[h]))), c < n && f < d || h >= r ? (i = p, (c += 1) < n && (f = l(p = t[c]))) : (i = g, (h += 1) < r && (d = l(g = e[h])));\n for (var y, _, m = i + o, v = m - i, x = o - v, E = x, w = m; c < n && h < r;) f < d ? (i = p, (c += 1) < n && (f = l(p = t[c]))) : (i = g, (h += 1) < r && (d = l(g = e[h]))), (x = (o = E) - (v = (m = i + o) - i)) && (a[u++] = x), E = w - ((y = w + m) - (_ = y - w)) + (m - _), w = y;\n for (; c < n;) (x = (o = E) - (v = (m = (i = p) + o) - i)) && (a[u++] = x), E = w - ((y = w + m) - (_ = y - w)) + (m - _), w = y, (c += 1) < n && (p = t[c]);\n for (; h < r;) (x = (o = E) - (v = (m = (i = g) + o) - i)) && (a[u++] = x), E = w - ((y = w + m) - (_ = y - w)) + (m - _), w = y, (h += 1) < r && (g = e[h]);\n return E && (a[u++] = E), w && (a[u++] = w), u || (a[u++] = 0), a.length = u, a;\n },\n Zo = function (t, e, n) {\n var r = t + e,\n i = r - t,\n o = e - i,\n s = t - (r - i);\n return n ? (n[0] = s + o, n[1] = r, n) : [s + o, r];\n },\n Ko = function (t, e) {\n var n = t.length;\n if (1 === n) {\n var r = Ho(t[0], e);\n return r[0] ? r : [r[1]];\n }\n var i = new Array(2 * n),\n o = [.1, .1],\n s = [.1, .1],\n a = 0;\n Ho(t[0], e, o), o[0] && (i[a++] = o[0]);\n for (var u = 1; u < n; ++u) {\n Ho(t[u], e, s);\n var c = o[1];\n Zo(c, s[0], o), o[0] && (i[a++] = o[0]);\n var h = s[1],\n l = o[1],\n p = h + l,\n f = l - (p - h);\n o[1] = p, f && (i[a++] = f);\n }\n return o[1] && (i[a++] = o[1]), 0 === a && (i[a++] = 0), i.length = a, i;\n },\n Qo = function (t, e) {\n var n = 0 | t.length,\n r = 0 | e.length;\n if (1 === n && 1 === r) return function (t, e) {\n var n = t + e,\n r = n - t,\n i = t - (n - r) + (e - r);\n return i ? [i, n] : [n];\n }(t[0], -e[0]);\n var i,\n o,\n s = n + r,\n a = new Array(s),\n u = 0,\n c = 0,\n h = 0,\n l = Math.abs,\n p = t[c],\n f = l(p),\n g = -e[h],\n d = l(g);\n f < d ? (o = p, (c += 1) < n && (f = l(p = t[c]))) : (o = g, (h += 1) < r && (d = l(g = -e[h]))), c < n && f < d || h >= r ? (i = p, (c += 1) < n && (f = l(p = t[c]))) : (i = g, (h += 1) < r && (d = l(g = -e[h])));\n for (var y, _, m = i + o, v = m - i, x = o - v, E = x, w = m; c < n && h < r;) f < d ? (i = p, (c += 1) < n && (f = l(p = t[c]))) : (i = g, (h += 1) < r && (d = l(g = -e[h]))), (x = (o = E) - (v = (m = i + o) - i)) && (a[u++] = x), E = w - ((y = w + m) - (_ = y - w)) + (m - _), w = y;\n for (; c < n;) (x = (o = E) - (v = (m = (i = p) + o) - i)) && (a[u++] = x), E = w - ((y = w + m) - (_ = y - w)) + (m - _), w = y, (c += 1) < n && (p = t[c]);\n for (; h < r;) (x = (o = E) - (v = (m = (i = g) + o) - i)) && (a[u++] = x), E = w - ((y = w + m) - (_ = y - w)) + (m - _), w = y, (h += 1) < r && (g = -e[h]);\n return E && (a[u++] = E), w && (a[u++] = w), u || (a[u++] = 0), a.length = u, a;\n },\n $o = mt(function (t) {\n function e(t, e) {\n for (var n = new Array(t.length - 1), r = 1; r < t.length; ++r) for (var i = n[r - 1] = new Array(t.length - 1), o = 0, s = 0; o < t.length; ++o) o !== e && (i[s++] = t[r][o]);\n return n;\n }\n function n(t) {\n return 1 & t ? \"-\" : \"\";\n }\n function r(t) {\n if (1 === t.length) return t[0];\n if (2 === t.length) return [\"sum(\", t[0], \",\", t[1], \")\"].join(\"\");\n var e = t.length >> 1;\n return [\"sum(\", r(t.slice(0, e)), \",\", r(t.slice(e)), \")\"].join(\"\");\n }\n function i(t) {\n if (2 === t.length) return [[\"sum(prod(\", t[0][0], \",\", t[1][1], \"),prod(-\", t[0][1], \",\", t[1][0], \"))\"].join(\"\")];\n for (var o = [], s = 0; s < t.length; ++s) o.push([\"scale(\", r(i(e(t, s))), \",\", n(s), t[0][s], \")\"].join(\"\"));\n return o;\n }\n function o(t) {\n for (var n = [], o = [], s = function (t) {\n for (var e = new Array(t), n = 0; n < t; ++n) {\n e[n] = new Array(t);\n for (var r = 0; r < t; ++r) e[n][r] = [\"m\", r, \"[\", t - n - 1, \"]\"].join(\"\");\n }\n return e;\n }(t), a = [], u = 0; u < t; ++u) 0 == (1 & u) ? n.push.apply(n, i(e(s, u))) : o.push.apply(o, i(e(s, u))), a.push(\"m\" + u);\n var c = r(n),\n h = r(o),\n l = \"orientation\" + t + \"Exact\",\n p = [\"function \", l, \"(\", a.join(), \"){var p=\", c, \",n=\", h, \",d=sub(p,n);return d[d.length-1];};return \", l].join(\"\");\n return new Function(\"sum\", \"prod\", \"scale\", \"sub\", p)(Jo, Ho, Ko, Qo);\n }\n var s = 5,\n a = o(3),\n u = o(4),\n c = [function () {\n return 0;\n }, function () {\n return 0;\n }, function (t, e) {\n return e[0] - t[0];\n }, function (t, e, n) {\n var r,\n i = (t[1] - n[1]) * (e[0] - n[0]),\n o = (t[0] - n[0]) * (e[1] - n[1]),\n s = i - o;\n if (i > 0) {\n if (o <= 0) return s;\n r = i + o;\n } else {\n if (!(i < 0)) return s;\n if (o >= 0) return s;\n r = -(i + o);\n }\n var u = 3.3306690738754716e-16 * r;\n return s >= u || s <= -u ? s : a(t, e, n);\n }, function (t, e, n, r) {\n var i = t[0] - r[0],\n o = e[0] - r[0],\n s = n[0] - r[0],\n a = t[1] - r[1],\n c = e[1] - r[1],\n h = n[1] - r[1],\n l = t[2] - r[2],\n p = e[2] - r[2],\n f = n[2] - r[2],\n g = o * h,\n d = s * c,\n y = s * a,\n _ = i * h,\n m = i * c,\n v = o * a,\n x = l * (g - d) + p * (y - _) + f * (m - v),\n E = 7.771561172376103e-16 * ((Math.abs(g) + Math.abs(d)) * Math.abs(l) + (Math.abs(y) + Math.abs(_)) * Math.abs(p) + (Math.abs(m) + Math.abs(v)) * Math.abs(f));\n return x > E || -x > E ? x : u(t, e, n, r);\n }];\n !function () {\n for (; c.length <= s;) c.push(o(c.length));\n for (var e = [], n = [\"slow\"], r = 0; r <= s; ++r) e.push(\"a\" + r), n.push(\"o\" + r);\n var i = [\"function getOrientation(\", e.join(), \"){switch(arguments.length){case 0:case 1:return 0;\"];\n for (r = 2; r <= s; ++r) i.push(\"case \", r, \":return o\", r, \"(\", e.slice(0, r).join(), \");\");\n i.push(\"}var s=new Array(arguments.length);for(var i=0;i 1 && es(t[o[c - 2]], t[o[c - 1]], u) <= 0;) c -= 1, o.pop();\n for (o.push(a), c = s.length; c > 1 && es(t[s[c - 2]], t[s[c - 1]], u) >= 0;) c -= 1, s.pop();\n s.push(a);\n }\n n = new Array(s.length + o.length - 2);\n for (var h = 0, l = (r = 0, o.length); r < l; ++r) n[h++] = o[r];\n for (var p = s.length - 2; p > 0; --p) n[h++] = s[p];\n return n;\n },\n es = $o[3],\n ns = vt,\n rs = vt;\n vt.prototype = {\n push: function (t) {\n this.data.push(t), this.length++, this._up(this.length - 1);\n },\n pop: function () {\n if (0 !== this.length) {\n var t = this.data[0];\n return this.length--, this.length > 0 && (this.data[0] = this.data[this.length], this._down(0)), this.data.pop(), t;\n }\n },\n peek: function () {\n return this.data[0];\n },\n _up: function (t) {\n for (var e = this.data, n = this.compare, r = e[t]; t > 0;) {\n var i = t - 1 >> 1,\n o = e[i];\n if (n(r, o) >= 0) break;\n e[t] = o, t = i;\n }\n e[t] = r;\n },\n _down: function (t) {\n for (var e = this.data, n = this.compare, r = this.length >> 1, i = e[t]; t < r;) {\n var o = 1 + (t << 1),\n s = o + 1,\n a = e[o];\n if (s < this.length && n(e[s], a) < 0 && (o = s, a = e[s]), n(a, i) >= 0) break;\n e[t] = a, t = o;\n }\n e[t] = i;\n }\n }, ns.default = rs;\n var is = function (t, e) {\n for (var n = t[0], r = t[1], i = !1, o = 0, s = e.length - 1; o < e.length; s = o++) {\n var a = e[o][0],\n u = e[o][1],\n c = e[s][0],\n h = e[s][1];\n u > r != h > r && n < (c - a) * (r - u) / (h - u) + a && (i = !i);\n }\n return i;\n },\n os = $o[3],\n ss = xt,\n as = xt;\n ss.default = as;\n var us = function (t) {\n return t;\n },\n cs = function (t) {\n if (null == t) return us;\n var e,\n n,\n r = t.scale[0],\n i = t.scale[1],\n o = t.translate[0],\n s = t.translate[1];\n return function (t, a) {\n a || (e = n = 0);\n var u = 2,\n c = t.length,\n h = new Array(c);\n for (h[0] = (e += t[0]) * r + o, h[1] = (n += t[1]) * i + s; u < c;) h[u] = t[u], ++u;\n return h;\n };\n },\n hs = function (t, e) {\n for (var n, r = t.length, i = r - e; i < --r;) n = t[i], t[i++] = t[r], t[r] = n;\n },\n ls = function (t, e) {\n function n(t, e) {\n for (var n in t) {\n var i = t[n];\n delete e[i.start], delete i.start, delete i.end, i.forEach(function (t) {\n r[t < 0 ? ~t : t] = 1;\n }), s.push(i);\n }\n }\n var r = {},\n i = {},\n o = {},\n s = [],\n a = -1;\n return e.forEach(function (n, r) {\n var i,\n o = t.arcs[n < 0 ? ~n : n];\n o.length < 3 && !o[1][0] && !o[1][1] && (i = e[++a], e[a] = n, e[r] = i);\n }), e.forEach(function (e) {\n var n,\n r,\n s = function (e) {\n var n,\n r = t.arcs[e < 0 ? ~e : e],\n i = r[0];\n return t.transform ? (n = [0, 0], r.forEach(function (t) {\n n[0] += t[0], n[1] += t[1];\n })) : n = r[r.length - 1], e < 0 ? [n, i] : [i, n];\n }(e),\n a = s[0],\n u = s[1];\n if (n = o[a]) {\n if (delete o[n.end], n.push(e), n.end = u, r = i[u]) {\n delete i[r.start];\n var c = r === n ? n : n.concat(r);\n i[c.start = n.start] = o[c.end = r.end] = c;\n } else i[n.start] = o[n.end] = n;\n } else if (n = i[u]) {\n if (delete i[n.start], n.unshift(e), n.start = a, r = o[a]) {\n delete o[r.end];\n var h = r === n ? n : r.concat(n);\n i[h.start = r.start] = o[h.end = n.end] = h;\n } else i[n.start] = o[n.end] = n;\n } else i[(n = [e]).start = a] = o[n.end = u] = n;\n }), n(o, i), n(i, o), e.forEach(function (t) {\n r[t < 0 ? ~t : t] || s.push([t]);\n }), s;\n },\n ps = function (t) {\n return Xt(t, Ut.apply(this, arguments));\n },\n fs = function (t, e, n, r, i, o) {\n 3 === arguments.length && (r = o = Array, i = null);\n for (var s = new r(t = 1 << Math.max(4, Math.ceil(Math.log(t) / Math.LN2))), a = new o(t), u = t - 1, c = 0; c < t; ++c) s[c] = i;\n return {\n set: function (r, o) {\n for (var c = e(r) & u, h = s[c], l = 0; h != i;) {\n if (n(h, r)) return a[c] = o;\n if (++l >= t) throw new Error(\"full hashmap\");\n h = s[c = c + 1 & u];\n }\n return s[c] = r, a[c] = o, o;\n },\n maybeSet: function (r, o) {\n for (var c = e(r) & u, h = s[c], l = 0; h != i;) {\n if (n(h, r)) return a[c];\n if (++l >= t) throw new Error(\"full hashmap\");\n h = s[c = c + 1 & u];\n }\n return s[c] = r, a[c] = o, o;\n },\n get: function (r, o) {\n for (var c = e(r) & u, h = s[c], l = 0; h != i;) {\n if (n(h, r)) return a[c];\n if (++l >= t) break;\n h = s[c = c + 1 & u];\n }\n return o;\n },\n keys: function () {\n for (var t = [], e = 0, n = s.length; e < n; ++e) {\n var r = s[e];\n r != i && t.push(r);\n }\n return t;\n }\n };\n },\n gs = function (t, e) {\n return t[0] === e[0] && t[1] === e[1];\n },\n ds = new ArrayBuffer(16),\n ys = new Float64Array(ds),\n _s = new Uint32Array(ds),\n ms = function (t) {\n ys[0] = t[0], ys[1] = t[1];\n var e = _s[0] ^ _s[1];\n return 2147483647 & (e = e << 5 ^ e >> 7 ^ _s[2] ^ _s[3]);\n },\n vs = function (t) {\n function e(t, e, n, r) {\n if (p[n] !== t) {\n p[n] = t;\n var i = f[n];\n if (i >= 0) {\n var o = g[n];\n i === e && o === r || i === r && o === e || (++y, d[n] = 1);\n } else f[n] = e, g[n] = r;\n }\n }\n function n(t) {\n return ms(u[t]);\n }\n function r(t, e) {\n return gs(u[t], u[e]);\n }\n var i,\n o,\n s,\n a,\n u = t.coordinates,\n c = t.lines,\n h = t.rings,\n l = function () {\n for (var t = fs(1.4 * u.length, n, r, Int32Array, -1, Int32Array), e = new Int32Array(u.length), i = 0, o = u.length; i < o; ++i) e[i] = t.maybeSet(i, i);\n return e;\n }(),\n p = new Int32Array(u.length),\n f = new Int32Array(u.length),\n g = new Int32Array(u.length),\n d = new Int8Array(u.length),\n y = 0;\n for (i = 0, o = u.length; i < o; ++i) p[i] = f[i] = g[i] = -1;\n for (i = 0, o = c.length; i < o; ++i) {\n var _ = c[i],\n m = _[0],\n v = _[1];\n for (s = l[m], a = l[++m], ++y, d[s] = 1; ++m <= v;) e(i, s, s = a, a = l[m]);\n ++y, d[a] = 1;\n }\n for (i = 0, o = u.length; i < o; ++i) p[i] = -1;\n for (i = 0, o = h.length; i < o; ++i) {\n var x = h[i],\n E = x[0] + 1,\n w = x[1];\n for (e(i, l[w - 1], s = l[E - 1], a = l[E]); ++E <= w;) e(i, s, s = a, a = l[E]);\n }\n p = f = g = null;\n var b,\n I = function (t, e, n, r, i) {\n 3 === arguments.length && (r = Array, i = null);\n for (var o = new r(t = 1 << Math.max(4, Math.ceil(Math.log(t) / Math.LN2))), s = t - 1, a = 0; a < t; ++a) o[a] = i;\n return {\n add: function (r) {\n for (var a = e(r) & s, u = o[a], c = 0; u != i;) {\n if (n(u, r)) return !0;\n if (++c >= t) throw new Error(\"full hashset\");\n u = o[a = a + 1 & s];\n }\n return o[a] = r, !0;\n },\n has: function (r) {\n for (var a = e(r) & s, u = o[a], c = 0; u != i;) {\n if (n(u, r)) return !0;\n if (++c >= t) break;\n u = o[a = a + 1 & s];\n }\n return !1;\n },\n values: function () {\n for (var t = [], e = 0, n = o.length; e < n; ++e) {\n var r = o[e];\n r != i && t.push(r);\n }\n return t;\n }\n };\n }(1.4 * y, ms, gs);\n for (i = 0, o = u.length; i < o; ++i) d[b = l[i]] && I.add(u[b]);\n return I;\n },\n xs = function (t) {\n var e,\n n,\n r,\n i = vs(t),\n o = t.coordinates,\n s = t.lines,\n a = t.rings;\n for (n = 0, r = s.length; n < r; ++n) for (var u = s[n], c = u[0], h = u[1]; ++c < h;) i.has(o[c]) && (e = {\n 0: c,\n 1: u[1]\n }, u[1] = c, u = u.next = e);\n for (n = 0, r = a.length; n < r; ++n) for (var l = a[n], p = l[0], f = p, g = l[1], d = i.has(o[p]); ++f < g;) i.has(o[f]) && (d ? (e = {\n 0: f,\n 1: l[1]\n }, l[1] = f, l = l.next = e) : (!function (t, e, n, r) {\n Yt(t, e, n), Yt(t, e, e + r), Yt(t, e + r, n);\n }(o, p, g, g - f), o[g] = o[p], d = !0, f = p));\n return t;\n },\n Es = function (t) {\n function e(t) {\n var e, n, r, i, o, s, a, u;\n if (r = f.get(e = c[t[0]])) for (a = 0, u = r.length; a < u; ++a) if (i = r[a], function (t, e) {\n var n = t[0],\n r = e[0],\n i = t[1],\n o = e[1];\n if (n - i != r - o) return !1;\n for (; n <= i; ++n, ++r) if (!gs(c[n], c[r])) return !1;\n return !0;\n }(i, t)) return t[0] = i[0], void (t[1] = i[1]);\n if (o = f.get(n = c[t[1]])) for (a = 0, u = o.length; a < u; ++a) if (s = o[a], function (t, e) {\n var n = t[0],\n r = e[0],\n i = t[1],\n o = e[1];\n if (n - i != r - o) return !1;\n for (; n <= i; ++n, --o) if (!gs(c[n], c[o])) return !1;\n return !0;\n }(s, t)) return t[1] = s[0], void (t[0] = s[1]);\n r ? r.push(t) : f.set(e, [t]), o ? o.push(t) : f.set(n, [t]), g.push(t);\n }\n function n(t, e) {\n var n = t[0],\n r = e[0],\n o = t[1] - n;\n if (o !== e[1] - r) return !1;\n for (var s = i(t), a = i(e), u = 0; u < o; ++u) if (!gs(c[n + (u + s) % o], c[r + (u + a) % o])) return !1;\n return !0;\n }\n function r(t, e) {\n var n = t[0],\n r = e[0],\n o = t[1],\n s = e[1],\n a = o - n;\n if (a !== s - r) return !1;\n for (var u = i(t), h = a - i(e), l = 0; l < a; ++l) if (!gs(c[n + (l + u) % a], c[s - (l + h) % a])) return !1;\n return !0;\n }\n function i(t) {\n for (var e = t[0], n = t[1], r = e, i = r, o = c[r]; ++r < n;) {\n var s = c[r];\n (s[0] < o[0] || s[0] === o[0] && s[1] < o[1]) && (i = r, o = s);\n }\n return i - e;\n }\n var o,\n s,\n a,\n u,\n c = t.coordinates,\n h = t.lines,\n l = t.rings,\n p = h.length + l.length;\n for (delete t.lines, delete t.rings, a = 0, u = h.length; a < u; ++a) for (o = h[a]; o = o.next;) ++p;\n for (a = 0, u = l.length; a < u; ++a) for (s = l[a]; s = s.next;) ++p;\n var f = fs(2 * p * 1.4, ms, gs),\n g = t.arcs = [];\n for (a = 0, u = h.length; a < u; ++a) {\n o = h[a];\n do {\n e(o);\n } while (o = o.next);\n }\n for (a = 0, u = l.length; a < u; ++a) if ((s = l[a]).next) do {\n e(s);\n } while (s = s.next);else !function (t) {\n var e, o, s, a, u;\n if (o = f.get(e = c[t[0]])) for (a = 0, u = o.length; a < u; ++a) {\n if (s = o[a], n(s, t)) return t[0] = s[0], void (t[1] = s[1]);\n if (r(s, t)) return t[0] = s[1], void (t[1] = s[0]);\n }\n if (o = f.get(e = c[t[0] + i(t)])) for (a = 0, u = o.length; a < u; ++a) {\n if (s = o[a], n(s, t)) return t[0] = s[0], void (t[1] = s[1]);\n if (r(s, t)) return t[0] = s[1], void (t[1] = s[0]);\n }\n o ? o.push(t) : f.set(e, [t]), g.push(t);\n }(s);\n return t;\n },\n ws = function (t, e) {\n function n(t) {\n t && h.hasOwnProperty(t.type) && h[t.type](t);\n }\n function r(t) {\n var e = [];\n do {\n var n = c.get(t);\n e.push(t[0] < t[1] ? n : ~n);\n } while (t = t.next);\n return e;\n }\n function i(t) {\n return t.map(r);\n }\n var o = function (t) {\n function e(t) {\n null != t && c.hasOwnProperty(t.type) && c[t.type](t);\n }\n function n(t) {\n var e = t[0],\n n = t[1];\n e < o && (o = e), e > a && (a = e), n < s && (s = n), n > u && (u = n);\n }\n function r(t) {\n t.forEach(n);\n }\n function i(t) {\n t.forEach(r);\n }\n var o = 1 / 0,\n s = 1 / 0,\n a = -1 / 0,\n u = -1 / 0,\n c = {\n GeometryCollection: function (t) {\n t.geometries.forEach(e);\n },\n Point: function (t) {\n n(t.coordinates);\n },\n MultiPoint: function (t) {\n t.coordinates.forEach(n);\n },\n LineString: function (t) {\n r(t.arcs);\n },\n MultiLineString: function (t) {\n t.arcs.forEach(r);\n },\n Polygon: function (t) {\n t.arcs.forEach(r);\n },\n MultiPolygon: function (t) {\n t.arcs.forEach(i);\n }\n };\n for (var h in t) e(t[h]);\n return a >= o && u >= s ? [o, s, a, u] : void 0;\n }(t = function (t) {\n var e,\n n = {};\n for (e in t) n[e] = Vt(t[e]);\n return n;\n }(t)),\n s = e > 0 && o && function (t, e, n) {\n function r(t) {\n return [Math.round((t[0] - c) * f), Math.round((t[1] - h) * g)];\n }\n function i(t, e) {\n for (var n, r, i, o, s, a = -1, u = 0, l = t.length, p = new Array(l); ++a < l;) n = t[a], o = Math.round((n[0] - c) * f), s = Math.round((n[1] - h) * g), o === r && s === i || (p[u++] = [r = o, i = s]);\n for (p.length = u; u < e;) u = p.push([p[0][0], p[0][1]]);\n return p;\n }\n function o(t) {\n return i(t, 2);\n }\n function s(t) {\n return i(t, 4);\n }\n function a(t) {\n return t.map(s);\n }\n function u(t) {\n null != t && d.hasOwnProperty(t.type) && d[t.type](t);\n }\n var c = e[0],\n h = e[1],\n l = e[2],\n p = e[3],\n f = l - c ? (n - 1) / (l - c) : 1,\n g = p - h ? (n - 1) / (p - h) : 1,\n d = {\n GeometryCollection: function (t) {\n t.geometries.forEach(u);\n },\n Point: function (t) {\n t.coordinates = r(t.coordinates);\n },\n MultiPoint: function (t) {\n t.coordinates = t.coordinates.map(r);\n },\n LineString: function (t) {\n t.arcs = o(t.arcs);\n },\n MultiLineString: function (t) {\n t.arcs = t.arcs.map(o);\n },\n Polygon: function (t) {\n t.arcs = a(t.arcs);\n },\n MultiPolygon: function (t) {\n t.arcs = t.arcs.map(a);\n }\n };\n for (var y in t) u(t[y]);\n return {\n scale: [1 / f, 1 / g],\n translate: [c, h]\n };\n }(t, o, e),\n a = Es(xs(function (t) {\n function e(t) {\n t && c.hasOwnProperty(t.type) && c[t.type](t);\n }\n function n(t) {\n for (var e = 0, n = t.length; e < n; ++e) u[++o] = t[e];\n var r = {\n 0: o - n + 1,\n 1: o\n };\n return s.push(r), r;\n }\n function r(t) {\n for (var e = 0, n = t.length; e < n; ++e) u[++o] = t[e];\n var r = {\n 0: o - n + 1,\n 1: o\n };\n return a.push(r), r;\n }\n function i(t) {\n return t.map(r);\n }\n var o = -1,\n s = [],\n a = [],\n u = [],\n c = {\n GeometryCollection: function (t) {\n t.geometries.forEach(e);\n },\n LineString: function (t) {\n t.arcs = n(t.arcs);\n },\n MultiLineString: function (t) {\n t.arcs = t.arcs.map(n);\n },\n Polygon: function (t) {\n t.arcs = t.arcs.map(r);\n },\n MultiPolygon: function (t) {\n t.arcs = t.arcs.map(i);\n }\n };\n for (var h in t) e(t[h]);\n return {\n type: \"Topology\",\n coordinates: u,\n lines: s,\n rings: a,\n objects: t\n };\n }(t))),\n u = a.coordinates,\n c = fs(1.4 * a.arcs.length, Jt, Zt);\n t = a.objects, a.bbox = o, a.arcs = a.arcs.map(function (t, e) {\n return c.set(t, e), u.slice(t[0], t[1] + 1);\n }), delete a.coordinates, u = null;\n var h = {\n GeometryCollection: function (t) {\n t.geometries.forEach(n);\n },\n LineString: function (t) {\n t.arcs = r(t.arcs);\n },\n MultiLineString: function (t) {\n t.arcs = t.arcs.map(r);\n },\n Polygon: function (t) {\n t.arcs = t.arcs.map(r);\n },\n MultiPolygon: function (t) {\n t.arcs = t.arcs.map(i);\n }\n };\n for (var l in t) n(t[l]);\n return s && (a.transform = s, a.arcs = function (t) {\n for (var e = -1, n = t.length; ++e < n;) {\n for (var r, i, o = t[e], s = 0, a = 1, u = o.length, c = o[0], h = c[0], l = c[1]; ++s < u;) r = (c = o[s])[0], i = c[1], r === h && i === l || (o[a++] = [r - h, i - l], h = r, l = i);\n 1 === a && (o[a++] = [0, 0]), o.length = a;\n }\n return t;\n }(a.arcs)), a;\n },\n bs = function (t) {\n this.points = t.points || [], this.duration = t.duration || 1e4, this.sharpness = t.sharpness || .85, this.centers = [], this.controls = [], this.stepLength = t.stepLength || 60, this.length = this.points.length, this.delay = 0;\n for (var e = 0; e < this.length; e++) this.points[e].z = this.points[e].z || 0;\n for (e = 0; e < this.length - 1; e++) {\n var n = this.points[e],\n r = this.points[e + 1];\n this.centers.push({\n x: (n.x + r.x) / 2,\n y: (n.y + r.y) / 2,\n z: (n.z + r.z) / 2\n });\n }\n this.controls.push([this.points[0], this.points[0]]);\n for (e = 0; e < this.centers.length - 1; e++) {\n n = this.centers[e], r = this.centers[e + 1];\n var i = this.points[e + 1].x - (this.centers[e].x + this.centers[e + 1].x) / 2,\n o = this.points[e + 1].y - (this.centers[e].y + this.centers[e + 1].y) / 2,\n s = this.points[e + 1].z - (this.centers[e].y + this.centers[e + 1].z) / 2;\n this.controls.push([{\n x: (1 - this.sharpness) * this.points[e + 1].x + this.sharpness * (this.centers[e].x + i),\n y: (1 - this.sharpness) * this.points[e + 1].y + this.sharpness * (this.centers[e].y + o),\n z: (1 - this.sharpness) * this.points[e + 1].z + this.sharpness * (this.centers[e].z + s)\n }, {\n x: (1 - this.sharpness) * this.points[e + 1].x + this.sharpness * (this.centers[e + 1].x + i),\n y: (1 - this.sharpness) * this.points[e + 1].y + this.sharpness * (this.centers[e + 1].y + o),\n z: (1 - this.sharpness) * this.points[e + 1].z + this.sharpness * (this.centers[e + 1].z + s)\n }]);\n }\n return this.controls.push([this.points[this.length - 1], this.points[this.length - 1]]), this.steps = this.cacheSteps(this.stepLength), this;\n };\n bs.prototype.cacheSteps = function (t) {\n var e = [],\n n = this.pos(0);\n e.push(0);\n for (var r = 0; r < this.duration; r += 10) {\n var i = this.pos(r);\n Math.sqrt((i.x - n.x) * (i.x - n.x) + (i.y - n.y) * (i.y - n.y) + (i.z - n.z) * (i.z - n.z)) > t && (e.push(r), n = i);\n }\n return e;\n }, bs.prototype.vector = function (t) {\n var e = this.pos(t + 10),\n n = this.pos(t - 10);\n return {\n angle: 180 * Math.atan2(e.y - n.y, e.x - n.x) / 3.14,\n speed: Math.sqrt((n.x - e.x) * (n.x - e.x) + (n.y - e.y) * (n.y - e.y) + (n.z - e.z) * (n.z - e.z))\n };\n }, bs.prototype.pos = function (t) {\n var e = t - this.delay;\n e < 0 && (e = 0), e > this.duration && (e = this.duration - 1);\n var n = e / this.duration;\n if (n >= 1) return this.points[this.length - 1];\n var r = Math.floor((this.points.length - 1) * n);\n return function (t, e, n, r, i) {\n var o = function (t) {\n var e = t * t;\n return [e * t, 3 * e * (1 - t), 3 * t * (1 - t) * (1 - t), (1 - t) * (1 - t) * (1 - t)];\n }(t);\n return {\n x: i.x * o[0] + r.x * o[1] + n.x * o[2] + e.x * o[3],\n y: i.y * o[0] + r.y * o[1] + n.y * o[2] + e.y * o[3],\n z: i.z * o[0] + r.z * o[1] + n.z * o[2] + e.z * o[3]\n };\n }((this.length - 1) * n - r, this.points[r], this.controls[r][1], this.controls[r + 1][0], this.points[r + 1]);\n };\n var Is = ve,\n Ns = ve;\n ve.deviation = function (t, e, n, r) {\n var i = e && e.length,\n o = i ? e[0] * n : t.length,\n s = Math.abs(Ae(t, 0, o, n));\n if (i) for (var a = 0, u = e.length; a < u; a++) {\n var c = e[a] * n,\n h = a < u - 1 ? e[a + 1] * n : t.length;\n s -= Math.abs(Ae(t, c, h, n));\n }\n var l = 0;\n for (a = 0; a < r.length; a += 3) {\n var p = r[a] * n,\n f = r[a + 1] * n,\n g = r[a + 2] * n;\n l += Math.abs((t[p] - t[g]) * (t[f + 1] - t[p + 1]) - (t[p] - t[f]) * (t[g + 1] - t[p + 1]));\n }\n return 0 === s && 0 === l ? 0 : Math.abs((l - s) / s);\n }, ve.flatten = function (t) {\n for (var e = t[0][0].length, n = {\n vertices: [],\n holes: [],\n dimensions: e\n }, r = 0, i = 0; i < t.length; i++) {\n for (var o = 0; o < t[i].length; o++) for (var s = 0; s < e; s++) n.vertices.push(t[i][o][s]);\n i > 0 && (r += t[i - 1].length, n.holes.push(r));\n }\n return n;\n }, Is.default = Ns, ke.prototype = {\n all: function () {\n return this._all(this.data, []);\n },\n search: function (t) {\n var e = this.data,\n n = [],\n r = this.toBBox;\n if (!Je(t, e)) return n;\n for (var i, o, s, a, u = []; e;) {\n for (i = 0, o = e.children.length; i < o; i++) s = e.children[i], Je(t, a = e.leaf ? r(s) : s) && (e.leaf ? n.push(s) : We(t, a) ? this._all(s, n) : u.push(s));\n e = u.pop();\n }\n return n;\n },\n collides: function (t) {\n var e = this.data,\n n = this.toBBox;\n if (!Je(t, e)) return !1;\n for (var r, i, o, s, a = []; e;) {\n for (r = 0, i = e.children.length; r < i; r++) if (o = e.children[r], s = e.leaf ? n(o) : o, Je(t, s)) {\n if (e.leaf || We(t, s)) return !0;\n a.push(o);\n }\n e = a.pop();\n }\n return !1;\n },\n load: function (t) {\n if (!t || !t.length) return this;\n if (t.length < this._minEntries) {\n for (var e = 0, n = t.length; e < n; e++) this.insert(t[e]);\n return this;\n }\n var r = this._build(t.slice(), 0, t.length - 1, 0);\n if (this.data.children.length) {\n if (this.data.height === r.height) this._splitRoot(this.data, r);else {\n if (this.data.height < r.height) {\n var i = this.data;\n this.data = r, r = i;\n }\n this._insert(r, this.data.height - r.height - 1, !0);\n }\n } else this.data = r;\n return this;\n },\n insert: function (t) {\n return t && this._insert(t, this.data.height - 1), this;\n },\n clear: function () {\n return this.data = Ze([]), this;\n },\n remove: function (t, e) {\n if (!t) return this;\n for (var n, r, i, o, s = this.data, a = this.toBBox(t), u = [], c = []; s || u.length;) {\n if (s || (s = u.pop(), r = u[u.length - 1], n = c.pop(), o = !0), s.leaf && -1 !== (i = function (t, e, n) {\n if (!n) return e.indexOf(t);\n for (var r = 0; r < e.length; r++) if (n(t, e[r])) return r;\n return -1;\n }(t, s.children, e))) return s.children.splice(i, 1), u.push(s), this._condense(u), this;\n o || s.leaf || !We(s, a) ? r ? (n++, s = r.children[n], o = !1) : s = null : (u.push(s), c.push(n), n = 0, r = s, s = s.children[0]);\n }\n return this;\n },\n toBBox: function (t) {\n return t;\n },\n compareMinX: Ue,\n compareMinY: Ye,\n toJSON: function () {\n return this.data;\n },\n fromJSON: function (t) {\n return this.data = t, this;\n },\n _all: function (t, e) {\n for (var n = []; t;) t.leaf ? e.push.apply(e, t.children) : n.push.apply(n, t.children), t = n.pop();\n return e;\n },\n _build: function (t, e, n, r) {\n var i,\n o = n - e + 1,\n s = this._maxEntries;\n if (o <= s) return i = Ze(t.slice(e, n + 1)), ze(i, this.toBBox), i;\n r || (r = Math.ceil(Math.log(o) / Math.log(s)), s = Math.ceil(o / Math.pow(s, r - 1))), (i = Ze([])).leaf = !1, i.height = r;\n var a,\n u,\n c,\n h,\n l = Math.ceil(o / s),\n p = l * Math.ceil(Math.sqrt(s));\n for (Ke(t, e, n, p, this.compareMinX), a = e; a <= n; a += p) for (Ke(t, a, c = Math.min(a + p - 1, n), l, this.compareMinY), u = a; u <= c; u += l) h = Math.min(u + l - 1, c), i.children.push(this._build(t, u, h, r - 1));\n return ze(i, this.toBBox), i;\n },\n _chooseSubtree: function (t, e, n, r) {\n for (var i, o, s, a, u, c, h, l; r.push(e), !e.leaf && r.length - 1 !== n;) {\n for (h = l = 1 / 0, i = 0, o = e.children.length; i < o; i++) u = Ve(s = e.children[i]), (c = function (t, e) {\n return (Math.max(e.maxX, t.maxX) - Math.min(e.minX, t.minX)) * (Math.max(e.maxY, t.maxY) - Math.min(e.minY, t.minY));\n }(t, s) - u) < l ? (l = c, h = u < h ? u : h, a = s) : c === l && u < h && (h = u, a = s);\n e = a || e.children[0];\n }\n return e;\n },\n _insert: function (t, e, n) {\n var r = this.toBBox,\n i = n ? t : r(t),\n o = [],\n s = this._chooseSubtree(i, this.data, e, o);\n for (s.children.push(t), Xe(s, i); e >= 0 && o[e].children.length > this._maxEntries;) this._split(o, e), e--;\n this._adjustParentBBoxes(i, o, e);\n },\n _split: function (t, e) {\n var n = t[e],\n r = n.children.length,\n i = this._minEntries;\n this._chooseSplitAxis(n, i, r);\n var o = this._chooseSplitIndex(n, i, r),\n s = Ze(n.children.splice(o, n.children.length - o));\n s.height = n.height, s.leaf = n.leaf, ze(n, this.toBBox), ze(s, this.toBBox), e ? t[e - 1].children.push(s) : this._splitRoot(n, s);\n },\n _splitRoot: function (t, e) {\n this.data = Ze([t, e]), this.data.height = t.height + 1, this.data.leaf = !1, ze(this.data, this.toBBox);\n },\n _chooseSplitIndex: function (t, e, n) {\n var r, i, o, s, a, u, c, h;\n for (u = c = 1 / 0, r = e; r <= n - e; r++) s = function (t, e) {\n var n = Math.max(t.minX, e.minX),\n r = Math.max(t.minY, e.minY),\n i = Math.min(t.maxX, e.maxX),\n o = Math.min(t.maxY, e.maxY);\n return Math.max(0, i - n) * Math.max(0, o - r);\n }(i = je(t, 0, r, this.toBBox), o = je(t, r, n, this.toBBox)), a = Ve(i) + Ve(o), s < u ? (u = s, h = r, c = a < c ? a : c) : s === u && a < c && (c = a, h = r);\n return h;\n },\n _chooseSplitAxis: function (t, e, n) {\n var r = t.leaf ? this.compareMinX : Ue,\n i = t.leaf ? this.compareMinY : Ye;\n this._allDistMargin(t, e, n, r) < this._allDistMargin(t, e, n, i) && t.children.sort(r);\n },\n _allDistMargin: function (t, e, n, r) {\n t.children.sort(r);\n var i,\n o,\n s = this.toBBox,\n a = je(t, 0, e, s),\n u = je(t, n - e, n, s),\n c = He(a) + He(u);\n for (i = e; i < n - e; i++) o = t.children[i], Xe(a, t.leaf ? s(o) : o), c += He(a);\n for (i = n - e - 1; i >= e; i--) o = t.children[i], Xe(u, t.leaf ? s(o) : o), c += He(u);\n return c;\n },\n _adjustParentBBoxes: function (t, e, n) {\n for (var r = n; r >= 0; r--) Xe(e[r], t);\n },\n _condense: function (t) {\n for (var e, n = t.length - 1; n >= 0; n--) 0 === t[n].children.length ? n > 0 ? (e = t[n - 1].children).splice(e.indexOf(t[n]), 1) : this.clear() : ze(t[n], this.toBBox);\n },\n _initFormat: function (t) {\n var e = [\"return a\", \" - b\", \";\"];\n this.compareMinX = new Function(\"a\", \"b\", e.join(t[0])), this.compareMinY = new Function(\"a\", \"b\", e.join(t[1])), this.toBBox = new Function(\"a\", \"return {minX: a\" + t[0] + \", minY: a\" + t[1] + \", maxX: a\" + t[2] + \", maxY: a\" + t[3] + \"};\");\n }\n };\n var Cs = Object.freeze({\n toMercator: cn,\n toWgs84: hn\n }),\n Ss = 6378137,\n Ms = function (t, e, n) {\n function r(t, n, r, i) {\n var u = o[t][n],\n c = o[t][n + 1],\n h = o[r][i],\n l = o[r][i + 1],\n p = function (t, e, n, r) {\n if (On(t, n) || On(t, r) || On(e, n) || On(r, n)) return null;\n var i = t[0],\n o = t[1],\n s = e[0],\n a = e[1],\n u = n[0],\n c = n[1],\n h = r[0],\n l = r[1],\n p = (i - s) * (c - l) - (o - a) * (u - h);\n return 0 === p ? null : [((i * a - o * s) * (u - h) - (i - s) * (u * l - c * h)) / p, ((i * a - o * s) * (c - l) - (o - a) * (u * l - c * h)) / p];\n }(u, c, h, l);\n if (null !== p) {\n var f, g;\n if (f = c[0] !== u[0] ? (p[0] - u[0]) / (c[0] - u[0]) : (p[1] - u[1]) / (c[1] - u[1]), g = l[0] !== h[0] ? (p[0] - h[0]) / (l[0] - h[0]) : (p[1] - h[1]) / (l[1] - h[1]), !(f >= 1 || f <= 0 || g >= 1 || g <= 0)) {\n var d = p,\n y = !a[d];\n y && (a[d] = !0), e ? s.push(e(p, t, n, u, c, f, r, i, h, l, g, y)) : s.push(p);\n }\n }\n }\n function i(t, e) {\n var n,\n r,\n i,\n s,\n a = o[t][e],\n u = o[t][e + 1];\n return a[0] < u[0] ? (n = a[0], r = u[0]) : (n = u[0], r = a[0]), a[1] < u[1] ? (i = a[1], s = u[1]) : (i = u[1], s = a[1]), {\n minX: n,\n minY: i,\n maxX: r,\n maxY: s,\n ring: t,\n edge: e\n };\n }\n if (\"Polygon\" !== t.geometry.type) throw new Error(\"The input feature must be a Polygon\");\n void 0 === n && (n = 1);\n var o = t.geometry.coordinates,\n s = [],\n a = {};\n if (n) {\n for (var u = [], c = 0; c < o.length; c++) for (var h = 0; h < o[c].length - 1; h++) u.push(i(c, h));\n var l = Vo();\n l.load(u);\n }\n for (var p = 0; p < o.length; p++) for (var f = 0; f < o[p].length - 1; f++) if (n) {\n l.search(i(p, f)).forEach(function (t) {\n var e = t.ring,\n n = t.edge;\n r(p, f, e, n);\n });\n } else for (var g = 0; g < o.length; g++) for (var d = 0; d < o[g].length - 1; d++) r(p, f, g, d);\n return e || (s = {\n type: \"Feature\",\n geometry: {\n type: \"MultiPoint\",\n coordinates: s\n }\n }), s;\n },\n Ls = function (t) {\n function e() {\n for (var t = [], e = 0; e < g.features.length; e++) -1 == g.features[e].properties.parent && t.push(e);\n if (t.length > 1) for (e = 0; e < t.length; e++) {\n for (var n = -1, r = 0; r < g.features.length; r++) t[e] != r && Pt(g.features[t[e]].geometry.coordinates[0][0], g.features[r], {\n ignoreBoundary: !0\n }) && mn(g.features[r]) < 1 / 0 && (n = r);\n g.features[t[e]].properties.parent = n;\n }\n }\n function n() {\n for (var t = 0; t < g.features.length; t++) if (-1 == g.features[t].properties.parent) {\n var e = g.features[t].properties.winding;\n g.features[t].properties.netWinding = e, r(t, e);\n }\n }\n function r(t, e) {\n for (var n = 0; n < g.features.length; n++) if (g.features[n].properties.parent == t) {\n var i = e + g.features[n].properties.winding;\n g.features[n].properties.netWinding = i, r(n, i);\n }\n }\n if (\"Feature\" != t.type) throw new Error(\"The input must a geojson object of type Feature\");\n if (void 0 === t.geometry || null == t.geometry) throw new Error(\"The input must a geojson object with a non-empty geometry\");\n if (\"Polygon\" != t.geometry.type) throw new Error(\"The input must be a geojson Polygon\");\n for (var i = t.geometry.coordinates.length, s = [], a = 0; a < i; a++) {\n var u = t.geometry.coordinates[a];\n Tn(u[0], u[u.length - 1]) || u.push(u[0]), s.push.apply(s, u.slice(0, u.length - 1));\n }\n if (!function (t) {\n for (var e = {}, n = 1, r = 0, i = t.length; r < i; ++r) {\n if (e.hasOwnProperty(t[r])) {\n n = 0;\n break;\n }\n e[t[r]] = 1;\n }\n return n;\n }(s)) throw new Error(\"The input polygon may not have duplicate vertices (except for the first and last vertex of each ring)\");\n var h = s.length,\n l = Ms(t, function (t, e, n, r, i, o, s, a, u, c, h, l) {\n return [t, e, n, r, i, o, s, a, u, c, h, l];\n }),\n p = l.length;\n if (0 == p) {\n var f = [];\n for (a = 0; a < i; a++) f.push(o([t.geometry.coordinates[a]], {\n parent: -1,\n winding: function (t) {\n for (var e = 0, n = 0; n < t.length - 1; n++) t[n][0] < t[e][0] && (e = n);\n if (Rn([t[(e - 1).modulo(t.length - 1)], t[e], t[(e + 1).modulo(t.length - 1)]], !0)) var r = 1;else r = -1;\n return r;\n }(t.geometry.coordinates[a])\n }));\n var g = c(f);\n return e(), n(), g;\n }\n var d = [],\n y = [];\n for (a = 0; a < i; a++) {\n d.push([]);\n for (var _ = 0; _ < t.geometry.coordinates[a].length - 1; _++) d[a].push([new Ps(t.geometry.coordinates[a][(_ + 1).modulo(t.geometry.coordinates[a].length - 1)], 1, [a, _], [a, (_ + 1).modulo(t.geometry.coordinates[a].length - 1)], void 0)]), y.push(new Os(t.geometry.coordinates[a][_], [a, (_ - 1).modulo(t.geometry.coordinates[a].length - 1)], [a, _], void 0, void 0, !1, !0));\n }\n for (a = 0; a < p; a++) d[l[a][1]][l[a][2]].push(new Ps(l[a][0], l[a][5], [l[a][1], l[a][2]], [l[a][6], l[a][7]], void 0)), l[a][11] && y.push(new Os(l[a][0], [l[a][1], l[a][2]], [l[a][6], l[a][7]], void 0, void 0, !0, !0));\n var m = y.length;\n for (a = 0; a < d.length; a++) for (_ = 0; _ < d[a].length; _++) d[a][_].sort(function (t, e) {\n return t.param < e.param ? -1 : 1;\n });\n var v = [];\n for (a = 0; a < m; a++) v.push({\n minX: y[a].coord[0],\n minY: y[a].coord[1],\n maxX: y[a].coord[0],\n maxY: y[a].coord[1],\n index: a\n });\n var x = Vo();\n x.load(v);\n for (a = 0; a < d.length; a++) for (_ = 0; _ < d[a].length; _++) for (var E = 0; E < d[a][_].length; E++) {\n b = E == d[a][_].length - 1 ? d[a][(_ + 1).modulo(t.geometry.coordinates[a].length - 1)][0].coord : d[a][_][E + 1].coord;\n var w = x.search({\n minX: b[0],\n minY: b[1],\n maxX: b[0],\n maxY: b[1]\n })[0];\n d[a][_][E].nxtIsectAlongEdgeIn = w.index;\n }\n for (a = 0; a < d.length; a++) for (_ = 0; _ < d[a].length; _++) for (E = 0; E < d[a][_].length; E++) {\n var b = d[a][_][E].coord,\n I = (w = x.search({\n minX: b[0],\n minY: b[1],\n maxX: b[0],\n maxY: b[1]\n })[0]).index;\n I < h ? y[I].nxtIsectAlongRingAndEdge2 = d[a][_][E].nxtIsectAlongEdgeIn : Tn(y[I].ringAndEdge1, d[a][_][E].ringAndEdgeIn) ? y[I].nxtIsectAlongRingAndEdge1 = d[a][_][E].nxtIsectAlongEdgeIn : y[I].nxtIsectAlongRingAndEdge2 = d[a][_][E].nxtIsectAlongEdgeIn;\n }\n var N = [];\n for (a = 0, _ = 0; _ < i; _++) {\n var C = a;\n for (E = 0; E < t.geometry.coordinates[_].length - 1; E++) y[a].coord[0] < y[C].coord[0] && (C = a), a++;\n var S = y[C].nxtIsectAlongRingAndEdge2;\n for (E = 0; E < y.length; E++) if (y[E].nxtIsectAlongRingAndEdge1 == C || y[E].nxtIsectAlongRingAndEdge2 == C) {\n var M = E;\n break;\n }\n var L = Rn([y[M].coord, y[C].coord, y[S].coord], !0) ? 1 : -1;\n N.push({\n isect: C,\n parent: -1,\n winding: L\n });\n }\n N.sort(function (t, e) {\n return y[t.isect].coord > y[e.isect].coord ? -1 : 1;\n });\n for (f = []; N.length > 0;) {\n var P = N.pop(),\n O = P.isect,\n R = P.parent,\n T = P.winding,\n A = f.length,\n D = [y[O].coord],\n F = O;\n if (y[O].ringAndEdge1Walkable) var q = y[O].ringAndEdge1,\n G = y[O].nxtIsectAlongRingAndEdge1;else q = y[O].ringAndEdge2, G = y[O].nxtIsectAlongRingAndEdge2;\n for (; !Tn(y[O].coord, y[G].coord);) {\n D.push(y[G].coord);\n var B = void 0;\n for (a = 0; a < N.length; a++) if (N[a].isect == G) {\n B = a;\n break;\n }\n if (void 0 != B && N.splice(B, 1), Tn(q, y[G].ringAndEdge1)) {\n if (q = y[G].ringAndEdge2, y[G].ringAndEdge2Walkable = !1, y[G].ringAndEdge1Walkable) {\n var k = {\n isect: G\n };\n Rn([y[F].coord, y[G].coord, y[y[G].nxtIsectAlongRingAndEdge2].coord], 1 == T) ? (k.parent = R, k.winding = -T) : (k.parent = A, k.winding = T), N.push(k);\n }\n F = G, G = y[G].nxtIsectAlongRingAndEdge2;\n } else {\n if (q = y[G].ringAndEdge1, y[G].ringAndEdge1Walkable = !1, y[G].ringAndEdge2Walkable) {\n k = {\n isect: G\n };\n Rn([y[F].coord, y[G].coord, y[y[G].nxtIsectAlongRingAndEdge1].coord], 1 == T) ? (k.parent = R, k.winding = -T) : (k.parent = A, k.winding = T), N.push(k);\n }\n F = G, G = y[G].nxtIsectAlongRingAndEdge1;\n }\n }\n D.push(y[G].coord), f.push(o([D], {\n index: A,\n parent: R,\n winding: T,\n netWinding: void 0\n }));\n }\n g = c(f);\n return e(), n(), g;\n },\n Ps = function (t, e, n, r, i) {\n this.coord = t, this.param = e, this.ringAndEdgeIn = n, this.ringAndEdgeOut = r, this.nxtIsectAlongEdgeIn = i;\n },\n Os = function (t, e, n, r, i, o, s) {\n this.coord = t, this.ringAndEdge1 = e, this.ringAndEdge2 = n, this.nxtIsectAlongRingAndEdge1 = r, this.nxtIsectAlongRingAndEdge2 = i, this.ringAndEdge1Walkable = o, this.ringAndEdge2Walkable = s;\n };\n Number.prototype.modulo = function (t) {\n return (this % t + t) % t;\n };\n var Rs = Math.PI / 180,\n Ts = 180 / Math.PI,\n As = function (t, e) {\n this.lon = t, this.lat = e, this.x = Rs * t, this.y = Rs * e;\n };\n As.prototype.view = function () {\n return String(this.lon).slice(0, 4) + \",\" + String(this.lat).slice(0, 4);\n }, As.prototype.antipode = function () {\n var t = -1 * this.lat,\n e = this.lon < 0 ? 180 + this.lon : -1 * (180 - this.lon);\n return new As(e, t);\n };\n var Ds = function () {\n this.coords = [], this.length = 0;\n };\n Ds.prototype.move_to = function (t) {\n this.length++, this.coords.push(t);\n };\n var Fs = function (t) {\n this.properties = t || {}, this.geometries = [];\n };\n Fs.prototype.json = function () {\n if (this.geometries.length <= 0) return {\n geometry: {\n type: \"LineString\",\n coordinates: null\n },\n type: \"Feature\",\n properties: this.properties\n };\n if (1 === this.geometries.length) return {\n geometry: {\n type: \"LineString\",\n coordinates: this.geometries[0].coords\n },\n type: \"Feature\",\n properties: this.properties\n };\n for (var t = [], e = 0; e < this.geometries.length; e++) t.push(this.geometries[e].coords);\n return {\n geometry: {\n type: \"MultiLineString\",\n coordinates: t\n },\n type: \"Feature\",\n properties: this.properties\n };\n }, Fs.prototype.wkt = function () {\n for (var t = \"\", e = \"LINESTRING(\", n = function (t) {\n e += t[0] + \" \" + t[1] + \",\";\n }, r = 0; r < this.geometries.length; r++) {\n if (0 === this.geometries[r].coords.length) return \"LINESTRING(empty)\";\n this.geometries[r].coords.forEach(n), t += e.substring(0, e.length - 1) + \")\";\n }\n return t;\n };\n var qs = function (t, e, n) {\n if (!t || void 0 === t.x || void 0 === t.y) throw new Error(\"GreatCircle constructor expects two args: start and end objects with x and y properties\");\n if (!e || void 0 === e.x || void 0 === e.y) throw new Error(\"GreatCircle constructor expects two args: start and end objects with x and y properties\");\n this.start = new As(t.x, t.y), this.end = new As(e.x, e.y), this.properties = n || {};\n var r = this.start.x - this.end.x,\n i = this.start.y - this.end.y,\n o = Math.pow(Math.sin(i / 2), 2) + Math.cos(this.start.y) * Math.cos(this.end.y) * Math.pow(Math.sin(r / 2), 2);\n if (this.g = 2 * Math.asin(Math.sqrt(o)), this.g === Math.PI) throw new Error(\"it appears \" + t.view() + \" and \" + e.view() + \" are 'antipodal', e.g diametrically opposite, thus there is no single route but rather infinite\");\n if (isNaN(this.g)) throw new Error(\"could not calculate great circle between \" + t + \" and \" + e);\n };\n qs.prototype.interpolate = function (t) {\n var e = Math.sin((1 - t) * this.g) / Math.sin(this.g),\n n = Math.sin(t * this.g) / Math.sin(this.g),\n r = e * Math.cos(this.start.y) * Math.cos(this.start.x) + n * Math.cos(this.end.y) * Math.cos(this.end.x),\n i = e * Math.cos(this.start.y) * Math.sin(this.start.x) + n * Math.cos(this.end.y) * Math.sin(this.end.x),\n o = e * Math.sin(this.start.y) + n * Math.sin(this.end.y),\n s = Ts * Math.atan2(o, Math.sqrt(Math.pow(r, 2) + Math.pow(i, 2)));\n return [Ts * Math.atan2(i, r), s];\n }, qs.prototype.Arc = function (t, e) {\n var n = [];\n if (!t || t <= 2) n.push([this.start.lon, this.start.lat]), n.push([this.end.lon, this.end.lat]);else for (var r = 1 / (t - 1), i = 0; i < t; ++i) {\n var o = r * i,\n s = this.interpolate(o);\n n.push(s);\n }\n for (var a = !1, u = 0, c = e && e.offset ? e.offset : 10, h = 180 - c, l = -180 + c, p = 360 - c, f = 1; f < n.length; ++f) {\n var g = n[f - 1][0],\n d = n[f][0],\n y = Math.abs(d - g);\n y > p && (d > h && g < l || g > h && d < l) ? a = !0 : y > u && (u = y);\n }\n var _ = [];\n if (a && u < c) {\n var m = [];\n _.push(m);\n for (var v = 0; v < n.length; ++v) {\n var x = parseFloat(n[v][0]);\n if (v > 0 && Math.abs(x - n[v - 1][0]) > p) {\n var E = parseFloat(n[v - 1][0]),\n w = parseFloat(n[v - 1][1]),\n b = parseFloat(n[v][0]),\n I = parseFloat(n[v][1]);\n if (E > -180 && E < l && 180 === b && v + 1 < n.length && n[v - 1][0] > -180 && n[v - 1][0] < l) {\n m.push([-180, n[v][1]]), v++, m.push([n[v][0], n[v][1]]);\n continue;\n }\n if (E > h && E < 180 && -180 === b && v + 1 < n.length && n[v - 1][0] > h && n[v - 1][0] < 180) {\n m.push([180, n[v][1]]), v++, m.push([n[v][0], n[v][1]]);\n continue;\n }\n if (E < l && b > h) {\n var N = E;\n E = b, b = N;\n var C = w;\n w = I, I = C;\n }\n if (E > h && b < l && (b += 360), E <= 180 && b >= 180 && E < b) {\n var S = (180 - E) / (b - E),\n M = S * I + (1 - S) * w;\n m.push([n[v - 1][0] > h ? 180 : -180, M]), (m = []).push([n[v - 1][0] > h ? -180 : 180, M]), _.push(m);\n } else m = [], _.push(m);\n m.push([x, n[v][1]]);\n } else m.push([n[v][0], n[v][1]]);\n }\n } else {\n var L = [];\n _.push(L);\n for (var P = 0; P < n.length; ++P) L.push([n[P][0], n[P][1]]);\n }\n for (var O = new Fs(this.properties), R = 0; R < _.length; ++R) {\n var T = new Ds();\n O.geometries.push(T);\n for (var A = _[R], D = 0; D < A.length; ++D) T.move_to(A[D]);\n }\n return O;\n };\n var Gs = Yn;\n Yn.polyline = Yn, Yn.polygon = function (t, e) {\n var n, r, i, o, s, a, u;\n for (r = 1; r <= 8; r *= 2) {\n for (n = [], o = !(Hn(i = t[t.length - 1], e) & r), s = 0; s < t.length; s++) (u = !(Hn(a = t[s], e) & r)) !== o && n.push(Vn(i, a, r, e)), u && n.push(a), i = a, o = u;\n if (!(t = n).length) break;\n }\n return n;\n };\n var Bs = Array.prototype.slice,\n ks = {\n successCallback: null,\n verbose: !1,\n polygons: !1\n },\n zs = {},\n js = 64,\n Xs = 16,\n Us = 4,\n Ys = 1,\n Vs = [],\n Hs = [],\n Ws = [],\n Js = [],\n Zs = [],\n Ks = [],\n Qs = [],\n $s = [],\n ta = [],\n ea = [],\n na = [],\n ra = [],\n ia = [],\n oa = [],\n sa = [],\n aa = [],\n ua = [],\n ca = [],\n ha = [],\n la = [],\n pa = [],\n fa = [],\n ga = [],\n da = [];\n Qs[85] = ea[85] = -1, $s[85] = na[85] = 0, ta[85] = ra[85] = 1, ha[85] = fa[85] = 1, la[85] = ga[85] = 0, pa[85] = da[85] = 1, Vs[85] = Js[85] = 0, Hs[85] = Zs[85] = -1, Ws[85] = sa[85] = 0, aa[85] = ia[85] = 0, ua[85] = oa[85] = 1, Ks[85] = ca[85] = 1, fa[1] = fa[169] = 0, ga[1] = ga[169] = -1, da[1] = da[169] = 0, ia[1] = ia[169] = -1, oa[1] = oa[169] = 0, sa[1] = sa[169] = 0, ea[4] = ea[166] = 0, na[4] = na[166] = -1, ra[4] = ra[166] = 1, aa[4] = aa[166] = 1, ua[4] = ua[166] = 0, ca[4] = ca[166] = 0, Qs[16] = Qs[154] = 0, $s[16] = $s[154] = 1, ta[16] = ta[154] = 1, Js[16] = Js[154] = 1, Zs[16] = Zs[154] = 0, Ks[16] = Ks[154] = 1, ha[64] = ha[106] = 0, la[64] = la[106] = 1, pa[64] = pa[106] = 0, Vs[64] = Vs[106] = -1, Hs[64] = Hs[106] = 0, Ws[64] = Ws[106] = 1, ha[2] = ha[168] = 0, la[2] = la[168] = -1, pa[2] = pa[168] = 1, fa[2] = fa[168] = 0, ga[2] = ga[168] = -1, da[2] = da[168] = 0, ia[2] = ia[168] = -1, oa[2] = oa[168] = 0, sa[2] = sa[168] = 0, aa[2] = aa[168] = -1, ua[2] = ua[168] = 0, ca[2] = ca[168] = 1, Qs[8] = Qs[162] = 0, $s[8] = $s[162] = -1, ta[8] = ta[162] = 0, ea[8] = ea[162] = 0, na[8] = na[162] = -1, ra[8] = ra[162] = 1, ia[8] = ia[162] = 1, oa[8] = oa[162] = 0, sa[8] = sa[162] = 1, aa[8] = aa[162] = 1, ua[8] = ua[162] = 0, ca[8] = ca[162] = 0, Qs[32] = Qs[138] = 0, $s[32] = $s[138] = 1, ta[32] = ta[138] = 1, ea[32] = ea[138] = 0, na[32] = na[138] = 1, ra[32] = ra[138] = 0, Vs[32] = Vs[138] = 1, Hs[32] = Hs[138] = 0, Ws[32] = Ws[138] = 0, Js[32] = Js[138] = 1, Zs[32] = Zs[138] = 0, Ks[32] = Ks[138] = 1, fa[128] = fa[42] = 0, ga[128] = ga[42] = 1, da[128] = da[42] = 1, ha[128] = ha[42] = 0, la[128] = la[42] = 1, pa[128] = pa[42] = 0, Vs[128] = Vs[42] = -1, Hs[128] = Hs[42] = 0, Ws[128] = Ws[42] = 1, Js[128] = Js[42] = -1, Zs[128] = Zs[42] = 0, Ks[128] = Ks[42] = 0, ea[5] = ea[165] = -1, na[5] = na[165] = 0, ra[5] = ra[165] = 0, fa[5] = fa[165] = 1, ga[5] = ga[165] = 0, da[5] = da[165] = 0, aa[20] = aa[150] = 0, ua[20] = ua[150] = 1, ca[20] = ca[150] = 1, Js[20] = Js[150] = 0, Zs[20] = Zs[150] = -1, Ks[20] = Ks[150] = 1, Qs[80] = Qs[90] = -1, $s[80] = $s[90] = 0, ta[80] = ta[90] = 1, ha[80] = ha[90] = 1, la[80] = la[90] = 0, pa[80] = pa[90] = 1, ia[65] = ia[105] = 0, oa[65] = oa[105] = 1, sa[65] = sa[105] = 0, Vs[65] = Vs[105] = 0, Hs[65] = Hs[105] = -1, Ws[65] = Ws[105] = 0, Qs[160] = Qs[10] = -1, $s[160] = $s[10] = 0, ta[160] = ta[10] = 1, ea[160] = ea[10] = -1, na[160] = na[10] = 0, ra[160] = ra[10] = 0, fa[160] = fa[10] = 1, ga[160] = ga[10] = 0, da[160] = da[10] = 0, ha[160] = ha[10] = 1, la[160] = la[10] = 0, pa[160] = pa[10] = 1, aa[130] = aa[40] = 0, ua[130] = ua[40] = 1, ca[130] = ca[40] = 1, ia[130] = ia[40] = 0, oa[130] = oa[40] = 1, sa[130] = sa[40] = 0, Vs[130] = Vs[40] = 0, Hs[130] = Hs[40] = -1, Ws[130] = Ws[40] = 0, Js[130] = Js[40] = 0, Zs[130] = Zs[40] = -1, Ks[130] = Ks[40] = 1, ea[37] = ea[133] = 0, na[37] = na[133] = 1, ra[37] = ra[133] = 1, fa[37] = fa[133] = 0, ga[37] = ga[133] = 1, da[37] = da[133] = 0, Vs[37] = Vs[133] = -1, Hs[37] = Hs[133] = 0, Ws[37] = Ws[133] = 0, Js[37] = Js[133] = 1, Zs[37] = Zs[133] = 0, Ks[37] = Ks[133] = 0, aa[148] = aa[22] = -1, ua[148] = ua[22] = 0, ca[148] = ca[22] = 0, fa[148] = fa[22] = 0, ga[148] = ga[22] = -1, da[148] = da[22] = 1, ha[148] = ha[22] = 0, la[148] = la[22] = 1, pa[148] = pa[22] = 1, Js[148] = Js[22] = -1, Zs[148] = Zs[22] = 0, Ks[148] = Ks[22] = 1, Qs[82] = Qs[88] = 0, $s[82] = $s[88] = -1, ta[82] = ta[88] = 1, aa[82] = aa[88] = 1, ua[82] = ua[88] = 0, ca[82] = ca[88] = 1, ia[82] = ia[88] = -1, oa[82] = oa[88] = 0, sa[82] = sa[88] = 1, ha[82] = ha[88] = 0, la[82] = la[88] = -1, pa[82] = pa[88] = 0, Qs[73] = Qs[97] = 0, $s[73] = $s[97] = 1, ta[73] = ta[97] = 0, ea[73] = ea[97] = 0, na[73] = na[97] = -1, ra[73] = ra[97] = 0, ia[73] = ia[97] = 1, oa[73] = oa[97] = 0, sa[73] = sa[97] = 0, Vs[73] = Vs[97] = 1, Hs[73] = Hs[97] = 0, Ws[73] = Ws[97] = 1, Qs[145] = Qs[25] = 0, $s[145] = $s[25] = -1, ta[145] = ta[25] = 0, ia[145] = ia[25] = 1, oa[145] = oa[25] = 0, sa[145] = sa[25] = 1, fa[145] = fa[25] = 0, ga[145] = ga[25] = 1, da[145] = da[25] = 1, Js[145] = Js[25] = -1, Zs[145] = Zs[25] = 0, Ks[145] = Ks[25] = 0, ea[70] = ea[100] = 0, na[70] = na[100] = 1, ra[70] = ra[100] = 0, aa[70] = aa[100] = -1, ua[70] = ua[100] = 0, ca[70] = ca[100] = 1, ha[70] = ha[100] = 0, la[70] = la[100] = -1, pa[70] = pa[100] = 1, Vs[70] = Vs[100] = 1, Hs[70] = Hs[100] = 0, Ws[70] = Ws[100] = 0, ea[101] = ea[69] = 0, na[101] = na[69] = 1, ra[101] = ra[69] = 0, Vs[101] = Vs[69] = 1, Hs[101] = Hs[69] = 0, Ws[101] = Ws[69] = 0, fa[149] = fa[21] = 0, ga[149] = ga[21] = 1, da[149] = da[21] = 1, Js[149] = Js[21] = -1, Zs[149] = Zs[21] = 0, Ks[149] = Ks[21] = 0, aa[86] = aa[84] = -1, ua[86] = ua[84] = 0, ca[86] = ca[84] = 1, ha[86] = ha[84] = 0, la[86] = la[84] = -1, pa[86] = pa[84] = 1, Qs[89] = Qs[81] = 0, $s[89] = $s[81] = -1, ta[89] = ta[81] = 0, ia[89] = ia[81] = 1, oa[89] = oa[81] = 0, sa[89] = sa[81] = 1, Qs[96] = Qs[74] = 0, $s[96] = $s[74] = 1, ta[96] = ta[74] = 0, ea[96] = ea[74] = -1, na[96] = na[74] = 0, ra[96] = ra[74] = 1, ha[96] = ha[74] = 1, la[96] = la[74] = 0, pa[96] = pa[74] = 0, Vs[96] = Vs[74] = 1, Hs[96] = Hs[74] = 0, Ws[96] = Ws[74] = 1, Qs[24] = Qs[146] = 0, $s[24] = $s[146] = -1, ta[24] = ta[146] = 1, aa[24] = aa[146] = 1, ua[24] = ua[146] = 0, ca[24] = ca[146] = 1, ia[24] = ia[146] = 0, oa[24] = oa[146] = 1, sa[24] = sa[146] = 1, Js[24] = Js[146] = 0, Zs[24] = Zs[146] = -1, Ks[24] = Ks[146] = 0, ea[6] = ea[164] = -1, na[6] = na[164] = 0, ra[6] = ra[164] = 1, aa[6] = aa[164] = -1, ua[6] = ua[164] = 0, ca[6] = ca[164] = 0, fa[6] = fa[164] = 0, ga[6] = ga[164] = -1, da[6] = da[164] = 1, ha[6] = ha[164] = 1, la[6] = la[164] = 0, pa[6] = pa[164] = 0, ia[129] = ia[41] = 0, oa[129] = oa[41] = 1, sa[129] = sa[41] = 1, fa[129] = fa[41] = 0, ga[129] = ga[41] = 1, da[129] = da[41] = 0, Vs[129] = Vs[41] = -1, Hs[129] = Hs[41] = 0, Ws[129] = Ws[41] = 0, Js[129] = Js[41] = 0, Zs[129] = Zs[41] = -1, Ks[129] = Ks[41] = 0, aa[66] = aa[104] = 0, ua[66] = ua[104] = 1, ca[66] = ca[104] = 0, ia[66] = ia[104] = -1, oa[66] = oa[104] = 0, sa[66] = sa[104] = 1, ha[66] = ha[104] = 0, la[66] = la[104] = -1, pa[66] = pa[104] = 0, Vs[66] = Vs[104] = 0, Hs[66] = Hs[104] = -1, Ws[66] = Ws[104] = 1, Qs[144] = Qs[26] = -1, $s[144] = $s[26] = 0, ta[144] = ta[26] = 0, fa[144] = fa[26] = 1, ga[144] = ga[26] = 0, da[144] = da[26] = 1, ha[144] = ha[26] = 0, la[144] = la[26] = 1, pa[144] = pa[26] = 1, Js[144] = Js[26] = -1, Zs[144] = Zs[26] = 0, Ks[144] = Ks[26] = 1, ea[36] = ea[134] = 0, na[36] = na[134] = 1, ra[36] = ra[134] = 1, aa[36] = aa[134] = 0, ua[36] = ua[134] = 1, ca[36] = ca[134] = 0, Vs[36] = Vs[134] = 0, Hs[36] = Hs[134] = -1, Ws[36] = Ws[134] = 1, Js[36] = Js[134] = 1, Zs[36] = Zs[134] = 0, Ks[36] = Ks[134] = 0, Qs[9] = Qs[161] = -1, $s[9] = $s[161] = 0, ta[9] = ta[161] = 0, ea[9] = ea[161] = 0, na[9] = na[161] = -1, ra[9] = ra[161] = 0, ia[9] = ia[161] = 1, oa[9] = oa[161] = 0, sa[9] = sa[161] = 0, fa[9] = fa[161] = 1, ga[9] = ga[161] = 0, da[9] = da[161] = 1, Qs[136] = 0, $s[136] = 1, ta[136] = 1, ea[136] = 0, na[136] = 1, ra[136] = 0, aa[136] = -1, ua[136] = 0, ca[136] = 1, ia[136] = -1, oa[136] = 0, sa[136] = 0, fa[136] = 0, ga[136] = -1, da[136] = 0, ha[136] = 0, la[136] = -1, pa[136] = 1, Vs[136] = 1, Hs[136] = 0, Ws[136] = 0, Js[136] = 1, Zs[136] = 0, Ks[136] = 1, Qs[34] = 0, $s[34] = -1, ta[34] = 0, ea[34] = 0, na[34] = -1, ra[34] = 1, aa[34] = 1, ua[34] = 0, ca[34] = 0, ia[34] = 1, oa[34] = 0, sa[34] = 1, fa[34] = 0, ga[34] = 1, da[34] = 1, ha[34] = 0, la[34] = 1, pa[34] = 0, Vs[34] = -1, Hs[34] = 0, Ws[34] = 1, Js[34] = -1, Zs[34] = 0, Ks[34] = 0, Qs[35] = 0, $s[35] = 1, ta[35] = 1, ea[35] = 0, na[35] = -1, ra[35] = 1, aa[35] = 1, ua[35] = 0, ca[35] = 0, ia[35] = -1, oa[35] = 0, sa[35] = 0, fa[35] = 0, ga[35] = -1, da[35] = 0, ha[35] = 0, la[35] = 1, pa[35] = 0, Vs[35] = -1, Hs[35] = 0, Ws[35] = 1, Js[35] = 1, Zs[35] = 0, Ks[35] = 1, Qs[153] = 0, $s[153] = 1, ta[153] = 1, ia[153] = -1, oa[153] = 0, sa[153] = 0, fa[153] = 0, ga[153] = -1, da[153] = 0, Js[153] = 1, Zs[153] = 0, Ks[153] = 1, ea[102] = 0, na[102] = -1, ra[102] = 1, aa[102] = 1, ua[102] = 0, ca[102] = 0, ha[102] = 0, la[102] = 1, pa[102] = 0, Vs[102] = -1, Hs[102] = 0, Ws[102] = 1, Qs[155] = 0, $s[155] = -1, ta[155] = 0, ia[155] = 1, oa[155] = 0, sa[155] = 1, fa[155] = 0, ga[155] = 1, da[155] = 1, Js[155] = -1, Zs[155] = 0, Ks[155] = 0, ea[103] = 0, na[103] = 1, ra[103] = 0, aa[103] = -1, ua[103] = 0, ca[103] = 1, ha[103] = 0, la[103] = -1, pa[103] = 1, Vs[103] = 1, Hs[103] = 0, Ws[103] = 0, Qs[152] = 0, $s[152] = 1, ta[152] = 1, aa[152] = -1, ua[152] = 0, ca[152] = 1, ia[152] = -1, oa[152] = 0, sa[152] = 0, fa[152] = 0, ga[152] = -1, da[152] = 0, ha[152] = 0, la[152] = -1, pa[152] = 1, Js[152] = 1, Zs[152] = 0, Ks[152] = 1, Qs[156] = 0, $s[156] = -1, ta[156] = 1, aa[156] = 1, ua[156] = 0, ca[156] = 1, ia[156] = -1, oa[156] = 0, sa[156] = 0, fa[156] = 0, ga[156] = -1, da[156] = 0, ha[156] = 0, la[156] = 1, pa[156] = 1, Js[156] = -1, Zs[156] = 0, Ks[156] = 1, Qs[137] = 0, $s[137] = 1, ta[137] = 1, ea[137] = 0, na[137] = 1, ra[137] = 0, ia[137] = -1, oa[137] = 0, sa[137] = 0, fa[137] = 0, ga[137] = -1, da[137] = 0, Vs[137] = 1, Hs[137] = 0, Ws[137] = 0, Js[137] = 1, Zs[137] = 0, Ks[137] = 1, Qs[139] = 0, $s[139] = 1, ta[139] = 1, ea[139] = 0, na[139] = -1, ra[139] = 0, ia[139] = 1, oa[139] = 0, sa[139] = 0, fa[139] = 0, ga[139] = 1, da[139] = 0, Vs[139] = -1, Hs[139] = 0, Ws[139] = 0, Js[139] = 1, Zs[139] = 0, Ks[139] = 1, Qs[98] = 0, $s[98] = -1, ta[98] = 0, ea[98] = 0, na[98] = -1, ra[98] = 1, aa[98] = 1, ua[98] = 0, ca[98] = 0, ia[98] = 1, oa[98] = 0, sa[98] = 1, ha[98] = 0, la[98] = 1, pa[98] = 0, Vs[98] = -1, Hs[98] = 0, Ws[98] = 1, Qs[99] = 0, $s[99] = 1, ta[99] = 0, ea[99] = 0, na[99] = -1, ra[99] = 1, aa[99] = 1, ua[99] = 0, ca[99] = 0, ia[99] = -1, oa[99] = 0, sa[99] = 1, ha[99] = 0, la[99] = -1, pa[99] = 0, Vs[99] = 1, Hs[99] = 0, Ws[99] = 1, ea[38] = 0, na[38] = -1, ra[38] = 1, aa[38] = 1, ua[38] = 0, ca[38] = 0, fa[38] = 0, ga[38] = 1, da[38] = 1, ha[38] = 0, la[38] = 1, pa[38] = 0, Vs[38] = -1, Hs[38] = 0, Ws[38] = 1, Js[38] = -1, Zs[38] = 0, Ks[38] = 0, ea[39] = 0, na[39] = 1, ra[39] = 1, aa[39] = -1, ua[39] = 0, ca[39] = 0, fa[39] = 0, ga[39] = -1, da[39] = 1, ha[39] = 0, la[39] = 1, pa[39] = 0, Vs[39] = -1, Hs[39] = 0, Ws[39] = 1, Js[39] = 1, Zs[39] = 0, Ks[39] = 0;\n var ya = function (t) {\n return [[t.bottomleft, 0], [0, 0], [0, t.leftbottom]];\n },\n _a = function (t) {\n return [[1, t.rightbottom], [1, 0], [t.bottomright, 0]];\n },\n ma = function (t) {\n return [[t.topright, 1], [1, 1], [1, t.righttop]];\n },\n va = function (t) {\n return [[0, t.lefttop], [0, 1], [t.topleft, 1]];\n },\n xa = function (t) {\n return [[t.bottomright, 0], [t.bottomleft, 0], [0, t.leftbottom], [0, t.lefttop]];\n },\n Ea = function (t) {\n return [[t.bottomright, 0], [t.bottomleft, 0], [1, t.righttop], [1, t.rightbottom]];\n },\n wa = function (t) {\n return [[1, t.righttop], [1, t.rightbottom], [t.topleft, 1], [t.topright, 1]];\n },\n ba = function (t) {\n return [[0, t.leftbottom], [0, t.lefttop], [t.topleft, 1], [t.topright, 1]];\n },\n Ia = [],\n Na = [],\n Ca = [],\n Sa = [],\n Ma = [],\n La = [],\n Pa = [],\n Oa = [];\n Sa[1] = Ma[1] = 18, Sa[169] = Ma[169] = 18, Ca[4] = Na[4] = 12, Ca[166] = Na[166] = 12, Ia[16] = Oa[16] = 4, Ia[154] = Oa[154] = 4, La[64] = Pa[64] = 22, La[106] = Pa[106] = 22, Ca[2] = La[2] = 17, Sa[2] = Ma[2] = 18, Ca[168] = La[168] = 17, Sa[168] = Ma[168] = 18, Ia[8] = Sa[8] = 9, Na[8] = Ca[8] = 12, Ia[162] = Sa[162] = 9, Na[162] = Ca[162] = 12, Ia[32] = Oa[32] = 4, Na[32] = Pa[32] = 1, Ia[138] = Oa[138] = 4, Na[138] = Pa[138] = 1, Ma[128] = Oa[128] = 21, La[128] = Pa[128] = 22, Ma[42] = Oa[42] = 21, La[42] = Pa[42] = 22, Na[5] = Ma[5] = 14, Na[165] = Ma[165] = 14, Ca[20] = Oa[20] = 6, Ca[150] = Oa[150] = 6, Ia[80] = La[80] = 11, Ia[90] = La[90] = 11, Sa[65] = Pa[65] = 3, Sa[105] = Pa[105] = 3, Ia[160] = La[160] = 11, Na[160] = Ma[160] = 14, Ia[10] = La[10] = 11, Na[10] = Ma[10] = 14, Ca[130] = Oa[130] = 6, Sa[130] = Pa[130] = 3, Ca[40] = Oa[40] = 6, Sa[40] = Pa[40] = 3, Na[101] = Pa[101] = 1, Na[69] = Pa[69] = 1, Ma[149] = Oa[149] = 21, Ma[21] = Oa[21] = 21, Ca[86] = La[86] = 17, Ca[84] = La[84] = 17, Ia[89] = Sa[89] = 9, Ia[81] = Sa[81] = 9, Ia[96] = Pa[96] = 0, Na[96] = La[96] = 15, Ia[74] = Pa[74] = 0, Na[74] = La[74] = 15, Ia[24] = Ca[24] = 8, Sa[24] = Oa[24] = 7, Ia[146] = Ca[146] = 8, Sa[146] = Oa[146] = 7, Na[6] = La[6] = 15, Ca[6] = Ma[6] = 16, Na[164] = La[164] = 15, Ca[164] = Ma[164] = 16, Sa[129] = Oa[129] = 7, Ma[129] = Pa[129] = 20, Sa[41] = Oa[41] = 7, Ma[41] = Pa[41] = 20, Ca[66] = Pa[66] = 2, Sa[66] = La[66] = 19, Ca[104] = Pa[104] = 2, Sa[104] = La[104] = 19, Ia[144] = Ma[144] = 10, La[144] = Oa[144] = 23, Ia[26] = Ma[26] = 10, La[26] = Oa[26] = 23, Na[36] = Oa[36] = 5, Ca[36] = Pa[36] = 2, Na[134] = Oa[134] = 5, Ca[134] = Pa[134] = 2, Ia[9] = Ma[9] = 10, Na[9] = Sa[9] = 13, Ia[161] = Ma[161] = 10, Na[161] = Sa[161] = 13, Na[37] = Oa[37] = 5, Ma[37] = Pa[37] = 20, Na[133] = Oa[133] = 5, Ma[133] = Pa[133] = 20, Ca[148] = Ma[148] = 16, La[148] = Oa[148] = 23, Ca[22] = Ma[22] = 16, La[22] = Oa[22] = 23, Ia[82] = Ca[82] = 8, Sa[82] = La[82] = 19, Ia[88] = Ca[88] = 8, Sa[88] = La[88] = 19, Ia[73] = Pa[73] = 0, Na[73] = Sa[73] = 13, Ia[97] = Pa[97] = 0, Na[97] = Sa[97] = 13, Ia[145] = Sa[145] = 9, Ma[145] = Oa[145] = 21, Ia[25] = Sa[25] = 9, Ma[25] = Oa[25] = 21, Na[70] = Pa[70] = 1, Ca[70] = La[70] = 17, Na[100] = Pa[100] = 1, Ca[100] = La[100] = 17, Ia[34] = Sa[34] = 9, Na[34] = Ca[34] = 12, Ma[34] = Oa[34] = 21, La[34] = Pa[34] = 22, Ia[136] = Oa[136] = 4, Na[136] = Pa[136] = 1, Ca[136] = La[136] = 17, Sa[136] = Ma[136] = 18, Ia[35] = Oa[35] = 4, Na[35] = Ca[35] = 12, Sa[35] = Ma[35] = 18, La[35] = Pa[35] = 22, Ia[153] = Oa[153] = 4, Sa[153] = Ma[153] = 18, Na[102] = Ca[102] = 12, La[102] = Pa[102] = 22, Ia[155] = Sa[155] = 9, Ma[155] = Oa[155] = 23, Na[103] = Pa[103] = 1, Ca[103] = La[103] = 17, Ia[152] = Oa[152] = 4, Ca[152] = La[152] = 17, Sa[152] = Ma[152] = 18, Ia[156] = Ca[156] = 8, Sa[156] = Ma[156] = 18, La[156] = Oa[156] = 23, Ia[137] = Oa[137] = 4, Na[137] = Pa[137] = 1, Sa[137] = Ma[137] = 18, Ia[139] = Oa[139] = 4, Na[139] = Sa[139] = 13, Ma[139] = Pa[139] = 20, Ia[98] = Sa[98] = 9, Na[98] = Ca[98] = 12, La[98] = Pa[98] = 22, Ia[99] = Pa[99] = 0, Na[99] = Ca[99] = 12, Sa[99] = La[99] = 19, Na[38] = Ca[38] = 12, Ma[38] = Oa[38] = 21, La[38] = Pa[38] = 22, Na[39] = Oa[39] = 5, Ca[39] = Ma[39] = 16, La[39] = Pa[39] = 22;\n var Ra = [];\n Ra[1] = Ra[169] = ya, Ra[4] = Ra[166] = _a, Ra[16] = Ra[154] = ma, Ra[64] = Ra[106] = va, Ra[168] = Ra[2] = xa, Ra[162] = Ra[8] = Ea, Ra[138] = Ra[32] = wa, Ra[42] = Ra[128] = ba, Ra[5] = Ra[165] = function (t) {\n return [[0, 0], [0, t.leftbottom], [1, t.rightbottom], [1, 0]];\n }, Ra[20] = Ra[150] = function (t) {\n return [[1, 0], [t.bottomright, 0], [t.topright, 1], [1, 1]];\n }, Ra[80] = Ra[90] = function (t) {\n return [[1, 1], [1, t.righttop], [0, t.lefttop], [0, 1]];\n }, Ra[65] = Ra[105] = function (t) {\n return [[t.bottomleft, 0], [0, 0], [0, 1], [t.topleft, 1]];\n }, Ra[160] = Ra[10] = function (t) {\n return [[1, t.righttop], [1, t.rightbottom], [0, t.leftbottom], [0, t.lefttop]];\n }, Ra[130] = Ra[40] = function (t) {\n return [[t.topleft, 1], [t.topright, 1], [t.bottomright, 0], [t.bottomleft, 0]];\n }, Ra[85] = function () {\n return [[0, 0], [0, 1], [1, 1], [1, 0]];\n }, Ra[101] = Ra[69] = function (t) {\n return [[1, t.rightbottom], [1, 0], [0, 0], [0, 1], [t.topleft, 1]];\n }, Ra[149] = Ra[21] = function (t) {\n return [[t.topright, 1], [1, 1], [1, 0], [0, 0], [0, t.leftbottom]];\n }, Ra[86] = Ra[84] = function (t) {\n return [[1, 0], [t.bottomright, 0], [0, t.lefttop], [0, 1], [1, 1]];\n }, Ra[89] = Ra[81] = function (t) {\n return [[1, 1], [1, t.righttop], [t.bottomleft, 0], [0, 0], [0, 1]];\n }, Ra[96] = Ra[74] = function (t) {\n return [[1, t.righttop], [1, t.rightbottom], [0, t.lefttop], [0, 1], [t.topleft, 1]];\n }, Ra[24] = Ra[146] = function (t) {\n return [[1, 1], [1, t.righttop], [t.bottomright, 0], [t.bottomleft, 0], [t.topright, 1]];\n }, Ra[6] = Ra[164] = function (t) {\n return [[1, t.rightbottom], [1, 0], [t.bottomright, 0], [0, t.leftbottom], [0, t.lefttop]];\n }, Ra[129] = Ra[41] = function (t) {\n return [[t.topright, 1], [t.bottomleft, 0], [0, 0], [0, t.leftbottom], [t.topleft, 1]];\n }, Ra[66] = Ra[104] = function (t) {\n return [[t.bottomright, 0], [t.bottomleft, 0], [0, t.lefttop], [0, 1], [t.topleft, 1]];\n }, Ra[144] = Ra[26] = function (t) {\n return [[1, 1], [1, t.righttop], [0, t.leftbottom], [0, t.lefttop], [t.topright, 1]];\n }, Ra[36] = Ra[134] = function (t) {\n return [[1, t.rightbottom], [1, 0], [t.bottomright, 0], [t.topleft, 1], [t.topright, 1]];\n }, Ra[9] = Ra[161] = function (t) {\n return [[1, t.righttop], [1, t.rightbottom], [t.bottomleft, 0], [0, 0], [0, t.leftbottom]];\n }, Ra[37] = Ra[133] = function (t) {\n return [[1, t.rightbottom], [1, 0], [0, 0], [0, t.leftbottom], [t.topleft, 1], [t.topright, 1]];\n }, Ra[148] = Ra[22] = function (t) {\n return [[1, 1], [1, 0], [t.bottomright, 0], [0, t.leftbottom], [0, t.lefttop], [t.topright, 1]];\n }, Ra[82] = Ra[88] = function (t) {\n return [[1, 1], [1, t.righttop], [t.bottomright, 0], [t.bottomleft, 0], [0, t.lefttop], [0, 1]];\n }, Ra[73] = Ra[97] = function (t) {\n return [[1, t.righttop], [1, t.rightbottom], [t.bottomleft, 0], [0, 0], [0, 1], [t.topleft, 1]];\n }, Ra[145] = Ra[25] = function (t) {\n return [[1, 1], [1, t.righttop], [t.bottomleft, 0], [0, 0], [0, t.leftbottom], [t.topright, 1]];\n }, Ra[70] = Ra[100] = function (t) {\n return [[1, t.rightbottom], [1, 0], [t.bottomright, 0], [0, t.lefttop], [0, 1], [t.topleft, 1]];\n }, Ra[34] = function (t) {\n return [ba(t), Ea(t)];\n }, Ra[35] = function (t) {\n return [[1, t.righttop], [1, t.rightbottom], [t.bottomright, 0], [t.bottomleft, 0], [0, t.leftbottom], [0, t.lefttop], [t.topleft, 1], [t.topright, 1]];\n }, Ra[136] = function (t) {\n return [wa(t), xa(t)];\n }, Ra[153] = function (t) {\n return [ma(t), ya(t)];\n }, Ra[102] = function (t) {\n return [_a(t), va(t)];\n }, Ra[155] = function (t) {\n return [[1, 1], [1, t.righttop], [t.bottomleft, 0], [0, 0], [0, t.leftbottom], [t.topright, 1]];\n }, Ra[103] = function (t) {\n return [[1, t.rightbottom], [1, 0], [t.bottomright, 0], [0, t.lefttop], [0, 1], [t.topleft, 1]];\n }, Ra[152] = function (t) {\n return [ma(t), xa(t)];\n }, Ra[156] = function (t) {\n return [[1, 1], [1, t.righttop], [t.bottomright, 0], [t.bottomleft, 0], [0, t.leftbottom], [0, t.lefttop], [t.topright, 1]];\n }, Ra[137] = function (t) {\n return [wa(t), ya(t)];\n }, Ra[139] = function (t) {\n return [[1, t.righttop], [1, t.rightbottom], [t.bottomleft, 0], [0, 0], [0, t.leftbottom], [t.topleft, 1], [t.topright, 1]];\n }, Ra[98] = function (t) {\n return [Ea(t), va(t)];\n }, Ra[99] = function (t) {\n return [[1, t.righttop], [1, t.rightbottom], [t.bottomright, 0], [t.bottomleft, 0], [0, t.lefttop], [0, 1], [t.topleft, 1]];\n }, Ra[38] = function (t) {\n return [_a(t), ba(t)];\n }, Ra[39] = function (t) {\n return [[1, t.rightbottom], [1, 0], [t.bottomright, 0], [0, t.leftbottom], [0, t.lefttop], [t.topleft, 1], [t.topright, 1]];\n };\n var Ta = function t(e) {\n this.id = t.buildId(e), this.coordinates = e, this.innerEdges = [], this.outerEdges = [], this.outerEdgesSorted = !1;\n };\n Ta.buildId = function (t) {\n return t.join(\",\");\n }, Ta.prototype.removeInnerEdge = function (t) {\n this.innerEdges = this.innerEdges.filter(function (e) {\n return e.from.id !== t.from.id;\n });\n }, Ta.prototype.removeOuterEdge = function (t) {\n this.outerEdges = this.outerEdges.filter(function (e) {\n return e.to.id !== t.to.id;\n });\n }, Ta.prototype.addOuterEdge = function (t) {\n this.outerEdges.push(t), this.outerEdgesSorted = !1;\n }, Ta.prototype.sortOuterEdges = function () {\n var t = this;\n this.outerEdgesSorted || (this.outerEdges.sort(function (e, n) {\n var r = e.to,\n i = n.to;\n if (r.coordinates[0] - t.coordinates[0] >= 0 && i.coordinates[0] - t.coordinates[0] < 0) return 1;\n if (r.coordinates[0] - t.coordinates[0] < 0 && i.coordinates[0] - t.coordinates[0] >= 0) return -1;\n if (r.coordinates[0] - t.coordinates[0] == 0 && i.coordinates[0] - t.coordinates[0] == 0) return r.coordinates[1] - t.coordinates[1] >= 0 || i.coordinates[1] - t.coordinates[1] >= 0 ? r.coordinates[1] - i.coordinates[1] : i.coordinates[1] - r.coordinates[1];\n var o = xr(t.coordinates, r.coordinates, i.coordinates);\n if (o < 0) return 1;\n if (o > 0) return -1;\n return Math.pow(r.coordinates[0] - t.coordinates[0], 2) + Math.pow(r.coordinates[1] - t.coordinates[1], 2) - (Math.pow(i.coordinates[0] - t.coordinates[0], 2) + Math.pow(i.coordinates[1] - t.coordinates[1], 2));\n }), this.outerEdgesSorted = !0);\n }, Ta.prototype.getOuterEdges = function () {\n return this.sortOuterEdges(), this.outerEdges;\n }, Ta.prototype.getOuterEdge = function (t) {\n return this.sortOuterEdges(), this.outerEdges[t];\n }, Ta.prototype.addInnerEdge = function (t) {\n this.innerEdges.push(t);\n };\n var Aa = function (t, e) {\n this.from = t, this.to = e, this.next = void 0, this.label = void 0, this.symetric = void 0, this.ring = void 0, this.from.addOuterEdge(this), this.to.addInnerEdge(this);\n };\n Aa.prototype.getSymetric = function () {\n return this.symetric || (this.symetric = new Aa(this.to, this.from), this.symetric.symetric = this), this.symetric;\n }, Aa.prototype.deleteEdge = function () {\n this.from.removeOuterEdge(this), this.to.removeInnerEdge(this);\n }, Aa.prototype.isEqual = function (t) {\n return this.from.id === t.from.id && this.to.id === t.to.id;\n }, Aa.prototype.toString = function () {\n return \"Edge { \" + this.from.id + \" -> \" + this.to.id + \" }\";\n }, Aa.prototype.toLineString = function () {\n return a([this.from.coordinates, this.to.coordinates]);\n }, Aa.prototype.compareTo = function (t) {\n return xr(t.from.coordinates, t.to.coordinates, this.to.coordinates);\n };\n var Da = function () {\n this.edges = [], this.polygon = void 0, this.envelope = void 0;\n },\n Fa = {\n length: {\n configurable: !0\n }\n };\n Da.prototype.push = function (t) {\n this[this.edges.length] = t, this.edges.push(t), this.polygon = this.envelope = void 0;\n }, Da.prototype.get = function (t) {\n return this.edges[t];\n }, Fa.length.get = function () {\n return this.edges.length;\n }, Da.prototype.forEach = function (t) {\n this.edges.forEach(t);\n }, Da.prototype.map = function (t) {\n return this.edges.map(t);\n }, Da.prototype.some = function (t) {\n return this.edges.some(t);\n }, Da.prototype.isValid = function () {\n return !0;\n }, Da.prototype.isHole = function () {\n var t = this,\n e = this.edges.reduce(function (e, n, r) {\n return n.from.coordinates[1] > t.edges[e].from.coordinates[1] && (e = r), e;\n }, 0),\n n = (0 === e ? this.length : e) - 1,\n r = (e + 1) % this.length,\n i = xr(this.edges[n].from.coordinates, this.edges[e].from.coordinates, this.edges[r].from.coordinates);\n return 0 === i ? this.edges[n].from.coordinates[0] > this.edges[r].from.coordinates[0] : i > 0;\n }, Da.prototype.toMultiPoint = function () {\n return l(this.edges.map(function (t) {\n return t.from.coordinates;\n }));\n }, Da.prototype.toPolygon = function () {\n if (this.polygon) return this.polygon;\n var t = this.edges.map(function (t) {\n return t.from.coordinates;\n });\n return t.push(this.edges[0].from.coordinates), this.polygon = o([t]);\n }, Da.prototype.getEnvelope = function () {\n return this.envelope ? this.envelope : this.envelope = he(this.toPolygon());\n }, Da.findEdgeRingContaining = function (t, e) {\n var n,\n i,\n o = t.getEnvelope();\n return e.forEach(function (e) {\n var s = e.getEnvelope();\n if (i && (n = i.getEnvelope()), !function (t, e) {\n var n = t.geometry.coordinates.map(function (t) {\n return t[0];\n }),\n r = t.geometry.coordinates.map(function (t) {\n return t[1];\n }),\n i = e.geometry.coordinates.map(function (t) {\n return t[0];\n }),\n o = e.geometry.coordinates.map(function (t) {\n return t[1];\n });\n return Math.max(null, n) === Math.max(null, i) && Math.max(null, r) === Math.max(null, o) && Math.min(null, n) === Math.min(null, i) && Math.min(null, r) === Math.min(null, o);\n }(s, o) && Er(s, o)) {\n var a = t.map(function (t) {\n return t.from.coordinates;\n }).find(function (t) {\n return !e.some(function (e) {\n return function (t, e) {\n return t[0] === e[0] && t[1] === e[1];\n }(t, e.from.coordinates);\n });\n });\n a && e.inside(r(a)) && (i && !Er(n, s) || (i = e));\n }\n }), i;\n }, Da.prototype.inside = function (t) {\n return Pt(t, this.toPolygon());\n }, Object.defineProperties(Da.prototype, Fa);\n var qa = function () {\n this.edges = [], this.nodes = {};\n };\n qa.fromGeoJson = function (t) {\n !function (t) {\n if (!t) throw new Error(\"No geojson passed\");\n if (\"FeatureCollection\" !== t.type && \"GeometryCollection\" !== t.type && \"MultiLineString\" !== t.type && \"LineString\" !== t.type && \"Feature\" !== t.type) throw new Error(\"Invalid input type '\" + t.type + \"'. Geojson must be FeatureCollection, GeometryCollection, LineString, MultiLineString or Feature\");\n }(t);\n var e = new qa();\n return F(t, function (t) {\n H(t, \"LineString\", \"Graph::fromGeoJson\"), M(t, function (t, n) {\n if (t) {\n var r = e.getNode(t),\n i = e.getNode(n);\n e.addEdge(r, i);\n }\n return n;\n });\n }), e;\n }, qa.prototype.getNode = function (t) {\n var e = Ta.buildId(t),\n n = this.nodes[e];\n return n || (n = this.nodes[e] = new Ta(t)), n;\n }, qa.prototype.addEdge = function (t, e) {\n var n = new Aa(t, e),\n r = n.getSymetric();\n this.edges.push(n), this.edges.push(r);\n }, qa.prototype.deleteDangles = function () {\n var t = this;\n Object.keys(this.nodes).map(function (e) {\n return t.nodes[e];\n }).forEach(function (e) {\n return t._removeIfDangle(e);\n });\n }, qa.prototype._removeIfDangle = function (t) {\n var e = this;\n if (t.innerEdges.length <= 1) {\n var n = t.getOuterEdges().map(function (t) {\n return t.to;\n });\n this.removeNode(t), n.forEach(function (t) {\n return e._removeIfDangle(t);\n });\n }\n }, qa.prototype.deleteCutEdges = function () {\n var t = this;\n this._computeNextCWEdges(), this._findLabeledEdgeRings(), this.edges.forEach(function (e) {\n e.label === e.symetric.label && (t.removeEdge(e.symetric), t.removeEdge(e));\n });\n }, qa.prototype._computeNextCWEdges = function (t) {\n var e = this;\n void 0 === t ? Object.keys(this.nodes).forEach(function (t) {\n return e._computeNextCWEdges(e.nodes[t]);\n }) : t.getOuterEdges().forEach(function (e, n) {\n t.getOuterEdge((0 === n ? t.getOuterEdges().length : n) - 1).symetric.next = e;\n });\n }, qa.prototype._computeNextCCWEdges = function (t, e) {\n for (var n, r, i = t.getOuterEdges(), o = i.length - 1; o >= 0; --o) {\n var s = i[o],\n a = s.symetric,\n u = void 0,\n c = void 0;\n s.label === e && (u = s), a.label === e && (c = a), u && c && (c && (r = c), u && (r && (r.next = u, r = void 0), n || (n = u)));\n }\n r && (r.next = n);\n }, qa.prototype._findLabeledEdgeRings = function () {\n var t = [],\n e = 0;\n return this.edges.forEach(function (n) {\n if (!(n.label >= 0)) {\n t.push(n);\n var r = n;\n do {\n r.label = e, r = r.next;\n } while (!n.isEqual(r));\n e++;\n }\n }), t;\n }, qa.prototype.getEdgeRings = function () {\n var t = this;\n this._computeNextCWEdges(), this.edges.forEach(function (t) {\n t.label = void 0;\n }), this._findLabeledEdgeRings().forEach(function (e) {\n t._findIntersectionNodes(e).forEach(function (n) {\n t._computeNextCCWEdges(n, e.label);\n });\n });\n var e = [];\n return this.edges.forEach(function (n) {\n n.ring || e.push(t._findEdgeRing(n));\n }), e;\n }, qa.prototype._findIntersectionNodes = function (t) {\n var e = [],\n n = t,\n r = function () {\n var r = 0;\n n.from.getOuterEdges().forEach(function (e) {\n e.label === t.label && ++r;\n }), r > 1 && e.push(n.from), n = n.next;\n };\n do {\n r();\n } while (!t.isEqual(n));\n return e;\n }, qa.prototype._findEdgeRing = function (t) {\n var e = t,\n n = new Da();\n do {\n n.push(e), e.ring = n, e = e.next;\n } while (!t.isEqual(e));\n return n;\n }, qa.prototype.removeNode = function (t) {\n var e = this;\n t.getOuterEdges().forEach(function (t) {\n return e.removeEdge(t);\n }), t.innerEdges.forEach(function (t) {\n return e.removeEdge(t);\n }), delete this.nodes[t.id];\n }, qa.prototype.removeEdge = function (t) {\n this.edges = this.edges.filter(function (e) {\n return !e.isEqual(t);\n }), t.deleteEdge();\n };\n var Ga = mt(function (t, e) {\n function n(t) {\n var e = [];\n for (var n in t) e.push(n);\n return e;\n }\n (t.exports = \"function\" == typeof Object.keys ? Object.keys : n).shim = n;\n }),\n Ba = (Ga.shim, mt(function (t, e) {\n function n(t) {\n return \"[object Arguments]\" == Object.prototype.toString.call(t);\n }\n function r(t) {\n return t && \"object\" == typeof t && \"number\" == typeof t.length && Object.prototype.hasOwnProperty.call(t, \"callee\") && !Object.prototype.propertyIsEnumerable.call(t, \"callee\") || !1;\n }\n var i = \"[object Arguments]\" == function () {\n return Object.prototype.toString.call(arguments);\n }();\n (e = t.exports = i ? n : r).supported = n, e.unsupported = r;\n })),\n ka = (Ba.supported, Ba.unsupported, mt(function (t) {\n function e(t) {\n return null === t || void 0 === t;\n }\n function n(t) {\n return !(!t || \"object\" != typeof t || \"number\" != typeof t.length) && \"function\" == typeof t.copy && \"function\" == typeof t.slice && !(t.length > 0 && \"number\" != typeof t[0]);\n }\n var r = Array.prototype.slice,\n i = t.exports = function (t, o, s) {\n return s || (s = {}), t === o || (t instanceof Date && o instanceof Date ? t.getTime() === o.getTime() : !t || !o || \"object\" != typeof t && \"object\" != typeof o ? s.strict ? t === o : t == o : function (t, o, s) {\n var a, u;\n if (e(t) || e(o)) return !1;\n if (t.prototype !== o.prototype) return !1;\n if (Ba(t)) return !!Ba(o) && (t = r.call(t), o = r.call(o), i(t, o, s));\n if (n(t)) {\n if (!n(o)) return !1;\n if (t.length !== o.length) return !1;\n for (a = 0; a < t.length; a++) if (t[a] !== o[a]) return !1;\n return !0;\n }\n try {\n var c = Ga(t),\n h = Ga(o);\n } catch (t) {\n return !1;\n }\n if (c.length != h.length) return !1;\n for (c.sort(), h.sort(), a = c.length - 1; a >= 0; a--) if (c[a] != h[a]) return !1;\n for (a = c.length - 1; a >= 0; a--) if (u = c[a], !i(t[u], o[u], s)) return !1;\n return typeof t == typeof o;\n }(t, o, s));\n };\n })),\n za = function (t) {\n this.precision = t && t.precision ? t.precision : 17, this.direction = !(!t || !t.direction) && t.direction, this.pseudoNode = !(!t || !t.pseudoNode) && t.pseudoNode, this.objectComparator = t && t.objectComparator ? t.objectComparator : Rr;\n };\n za.prototype.compare = function (t, e) {\n if (t.type !== e.type || !Or(t, e)) return !1;\n switch (t.type) {\n case \"Point\":\n return this.compareCoord(t.coordinates, e.coordinates);\n case \"LineString\":\n return this.compareLine(t.coordinates, e.coordinates, 0, !1);\n case \"Polygon\":\n return this.comparePolygon(t, e);\n case \"Feature\":\n return this.compareFeature(t, e);\n default:\n if (0 === t.type.indexOf(\"Multi\")) {\n var n = this,\n r = Pr(t),\n i = Pr(e);\n return r.every(function (t) {\n return this.some(function (e) {\n return n.compare(t, e);\n });\n }, i);\n }\n }\n return !1;\n }, za.prototype.compareCoord = function (t, e) {\n if (t.length !== e.length) return !1;\n for (var n = 0; n < t.length; n++) if (t[n].toFixed(this.precision) !== e[n].toFixed(this.precision)) return !1;\n return !0;\n }, za.prototype.compareLine = function (t, e, n, r) {\n if (!Or(t, e)) return !1;\n var i = this.pseudoNode ? t : this.removePseudo(t),\n o = this.pseudoNode ? e : this.removePseudo(e);\n if (!r || this.compareCoord(i[0], o[0]) || (o = this.fixStartIndex(o, i))) {\n var s = this.compareCoord(i[n], o[n]);\n return this.direction || s ? this.comparePath(i, o) : !!this.compareCoord(i[n], o[o.length - (1 + n)]) && this.comparePath(i.slice().reverse(), o);\n }\n }, za.prototype.fixStartIndex = function (t, e) {\n for (var n, r = -1, i = 0; i < t.length; i++) if (this.compareCoord(t[i], e[0])) {\n r = i;\n break;\n }\n return r >= 0 && (n = [].concat(t.slice(r, t.length), t.slice(1, r + 1))), n;\n }, za.prototype.comparePath = function (t, e) {\n var n = this;\n return t.every(function (t, e) {\n return n.compareCoord(t, this[e]);\n }, e);\n }, za.prototype.comparePolygon = function (t, e) {\n if (this.compareLine(t.coordinates[0], e.coordinates[0], 1, !0)) {\n var n = t.coordinates.slice(1, t.coordinates.length),\n r = e.coordinates.slice(1, e.coordinates.length),\n i = this;\n return n.every(function (t) {\n return this.some(function (e) {\n return i.compareLine(t, e, 1, !0);\n });\n }, r);\n }\n return !1;\n }, za.prototype.compareFeature = function (t, e) {\n return !(t.id !== e.id || !this.objectComparator(t.properties, e.properties) || !this.compareBBox(t, e)) && this.compare(t.geometry, e.geometry);\n }, za.prototype.compareBBox = function (t, e) {\n return !!(!t.bbox && !e.bbox || t.bbox && e.bbox && this.compareCoord(t.bbox, e.bbox));\n }, za.prototype.removePseudo = function (t) {\n return t;\n };\n var ja = za,\n Xa = mt(function (t) {\n function e(t, e, n, r) {\n this.dataset = [], this.epsilon = 1, this.minPts = 2, this.distance = this._euclideanDistance, this.clusters = [], this.noise = [], this._visited = [], this._assigned = [], this._datasetLength = 0, this._init(t, e, n, r);\n }\n e.prototype.run = function (t, e, n, r) {\n this._init(t, e, n, r);\n for (var i = 0; i < this._datasetLength; i++) if (1 !== this._visited[i]) {\n this._visited[i] = 1;\n var o = this._regionQuery(i);\n if (o.length < this.minPts) this.noise.push(i);else {\n var s = this.clusters.length;\n this.clusters.push([]), this._addToCluster(i, s), this._expandCluster(s, o);\n }\n }\n return this.clusters;\n }, e.prototype._init = function (t, e, n, r) {\n if (t) {\n if (!(t instanceof Array)) throw Error(\"Dataset must be of type array, \" + typeof t + \" given\");\n this.dataset = t, this.clusters = [], this.noise = [], this._datasetLength = t.length, this._visited = new Array(this._datasetLength), this._assigned = new Array(this._datasetLength);\n }\n e && (this.epsilon = e), n && (this.minPts = n), r && (this.distance = r);\n }, e.prototype._expandCluster = function (t, e) {\n for (var n = 0; n < e.length; n++) {\n var r = e[n];\n if (1 !== this._visited[r]) {\n this._visited[r] = 1;\n var i = this._regionQuery(r);\n i.length >= this.minPts && (e = this._mergeArrays(e, i));\n }\n 1 !== this._assigned[r] && this._addToCluster(r, t);\n }\n }, e.prototype._addToCluster = function (t, e) {\n this.clusters[e].push(t), this._assigned[t] = 1;\n }, e.prototype._regionQuery = function (t) {\n for (var e = [], n = 0; n < this._datasetLength; n++) {\n this.distance(this.dataset[t], this.dataset[n]) < this.epsilon && e.push(n);\n }\n return e;\n }, e.prototype._mergeArrays = function (t, e) {\n for (var n = e.length, r = 0; r < n; r++) {\n var i = e[r];\n t.indexOf(i) < 0 && t.push(i);\n }\n return t;\n }, e.prototype._euclideanDistance = function (t, e) {\n for (var n = 0, r = Math.min(t.length, e.length); r--;) n += (t[r] - e[r]) * (t[r] - e[r]);\n return Math.sqrt(n);\n }, t.exports && (t.exports = e);\n }),\n Ua = mt(function (t) {\n function e(t, e, n) {\n this.k = 3, this.dataset = [], this.assignments = [], this.centroids = [], this.init(t, e, n);\n }\n e.prototype.init = function (t, e, n) {\n this.assignments = [], this.centroids = [], void 0 !== t && (this.dataset = t), void 0 !== e && (this.k = e), void 0 !== n && (this.distance = n);\n }, e.prototype.run = function (t, e) {\n this.init(t, e);\n for (var n = this.dataset.length, r = 0; r < this.k; r++) this.centroids[r] = this.randomCentroid();\n for (var i = !0; i;) {\n i = this.assign();\n for (var o = 0; o < this.k; o++) {\n for (var s = new Array(h), a = 0, u = 0; u < h; u++) s[u] = 0;\n for (var c = 0; c < n; c++) {\n var h = this.dataset[c].length;\n if (o === this.assignments[c]) {\n for (u = 0; u < h; u++) s[u] += this.dataset[c][u];\n a++;\n }\n }\n if (a > 0) {\n for (u = 0; u < h; u++) s[u] /= a;\n this.centroids[o] = s;\n } else this.centroids[o] = this.randomCentroid(), i = !0;\n }\n }\n return this.getClusters();\n }, e.prototype.randomCentroid = function () {\n var t,\n e,\n n = this.dataset.length - 1;\n do {\n e = Math.round(Math.random() * n), t = this.dataset[e];\n } while (this.centroids.indexOf(t) >= 0);\n return t;\n }, e.prototype.assign = function () {\n for (var t, e = !1, n = this.dataset.length, r = 0; r < n; r++) (t = this.argmin(this.dataset[r], this.centroids, this.distance)) != this.assignments[r] && (this.assignments[r] = t, e = !0);\n return e;\n }, e.prototype.getClusters = function () {\n for (var t, e = new Array(this.k), n = 0; n < this.assignments.length; n++) void 0 === e[t = this.assignments[n]] && (e[t] = []), e[t].push(n);\n return e;\n }, e.prototype.argmin = function (t, e, n) {\n for (var r, i = Number.MAX_VALUE, o = 0, s = e.length, a = 0; a < s; a++) (r = n(t, e[a])) < i && (i = r, o = a);\n return o;\n }, e.prototype.distance = function (t, e) {\n for (var n = 0, r = Math.min(t.length, e.length); r--;) {\n var i = t[r] - e[r];\n n += i * i;\n }\n return Math.sqrt(n);\n }, t.exports && (t.exports = e);\n }),\n Ya = mt(function (t) {\n function e(t, e, n) {\n this._queue = [], this._priorities = [], this._sorting = \"desc\", this._init(t, e, n);\n }\n e.prototype.insert = function (t, e) {\n for (var n = this._queue.length, r = n; r--;) {\n var i = this._priorities[r];\n \"desc\" === this._sorting ? e > i && (n = r) : e < i && (n = r);\n }\n this._insertAt(t, e, n);\n }, e.prototype.remove = function (t) {\n for (var e = this._queue.length; e--;) {\n if (t === this._queue[e]) {\n this._queue.splice(e, 1), this._priorities.splice(e, 1);\n break;\n }\n }\n }, e.prototype.forEach = function (t) {\n this._queue.forEach(t);\n }, e.prototype.getElements = function () {\n return this._queue;\n }, e.prototype.getElementPriority = function (t) {\n return this._priorities[t];\n }, e.prototype.getPriorities = function () {\n return this._priorities;\n }, e.prototype.getElementsWithPriorities = function () {\n for (var t = [], e = 0, n = this._queue.length; e < n; e++) t.push([this._queue[e], this._priorities[e]]);\n return t;\n }, e.prototype._init = function (t, e, n) {\n if (t && e) {\n if (this._queue = [], this._priorities = [], t.length !== e.length) throw new Error(\"Arrays must have the same length\");\n for (var r = 0; r < t.length; r++) this.insert(t[r], e[r]);\n }\n n && (this._sorting = n);\n }, e.prototype._insertAt = function (t, e, n) {\n this._queue.length === n ? (this._queue.push(t), this._priorities.push(e)) : (this._queue.splice(n, 0, t), this._priorities.splice(n, 0, e));\n }, t.exports && (t.exports = e);\n }),\n Va = mt(function (t) {\n function e(t, e, n, r) {\n this.epsilon = 1, this.minPts = 1, this.distance = this._euclideanDistance, this._reachability = [], this._processed = [], this._coreDistance = 0, this._orderedList = [], this._init(t, e, n, r);\n }\n if (t.exports) var n = Ya;\n e.prototype.run = function (t, e, r, i) {\n this._init(t, e, r, i);\n for (var o = 0, s = this.dataset.length; o < s; o++) if (1 !== this._processed[o]) {\n this._processed[o] = 1, this.clusters.push([o]);\n var a = this.clusters.length - 1;\n this._orderedList.push(o);\n var u = new n(null, null, \"asc\"),\n c = this._regionQuery(o);\n void 0 !== this._distanceToCore(o) && (this._updateQueue(o, c, u), this._expandCluster(a, u));\n }\n return this.clusters;\n }, e.prototype.getReachabilityPlot = function () {\n for (var t = [], e = 0, n = this._orderedList.length; e < n; e++) {\n var r = this._orderedList[e],\n i = this._reachability[r];\n t.push([r, i]);\n }\n return t;\n }, e.prototype._init = function (t, e, n, r) {\n if (t) {\n if (!(t instanceof Array)) throw Error(\"Dataset must be of type array, \" + typeof t + \" given\");\n this.dataset = t, this.clusters = [], this._reachability = new Array(this.dataset.length), this._processed = new Array(this.dataset.length), this._coreDistance = 0, this._orderedList = [];\n }\n e && (this.epsilon = e), n && (this.minPts = n), r && (this.distance = r);\n }, e.prototype._updateQueue = function (t, e, n) {\n var r = this;\n this._coreDistance = this._distanceToCore(t), e.forEach(function (e) {\n if (void 0 === r._processed[e]) {\n var i = r.distance(r.dataset[t], r.dataset[e]),\n o = Math.max(r._coreDistance, i);\n void 0 === r._reachability[e] ? (r._reachability[e] = o, n.insert(e, o)) : o < r._reachability[e] && (r._reachability[e] = o, n.remove(e), n.insert(e, o));\n }\n });\n }, e.prototype._expandCluster = function (t, e) {\n for (var n = e.getElements(), r = 0, i = n.length; r < i; r++) {\n var o = n[r];\n if (void 0 === this._processed[o]) {\n var s = this._regionQuery(o);\n this._processed[o] = 1, this.clusters[t].push(o), this._orderedList.push(o), void 0 !== this._distanceToCore(o) && (this._updateQueue(o, s, e), this._expandCluster(t, e));\n }\n }\n }, e.prototype._distanceToCore = function (t) {\n for (var e = this.epsilon, n = 0; n < e; n++) {\n if (this._regionQuery(t, n).length >= this.minPts) return n;\n }\n }, e.prototype._regionQuery = function (t, e) {\n e = e || this.epsilon;\n for (var n = [], r = 0, i = this.dataset.length; r < i; r++) this.distance(this.dataset[t], this.dataset[r]) < e && n.push(r);\n return n;\n }, e.prototype._euclideanDistance = function (t, e) {\n for (var n = 0, r = Math.min(t.length, e.length); r--;) n += (t[r] - e[r]) * (t[r] - e[r]);\n return Math.sqrt(n);\n }, t.exports && (t.exports = e);\n }),\n Ha = mt(function (t) {\n t.exports && (t.exports = {\n DBSCAN: Xa,\n KMEANS: Ua,\n OPTICS: Va,\n PriorityQueue: Ya\n });\n }),\n Wa = (Ha.DBSCAN, Ha.KMEANS, Ha.OPTICS, Ha.PriorityQueue, function (t, e, n) {\n for (var r = t.length, i = 0, o = 0; o < r; o++) {\n var s = (t[o] || 0) - (e[o] || 0);\n i += s * s;\n }\n return n ? Math.sqrt(i) : i;\n }),\n Ja = Wa,\n Za = function (t, e, n) {\n var r = Math.abs(t - e);\n return n ? r : r * r;\n },\n Ka = Wa,\n Qa = function (t, e) {\n for (var n = {}, r = [], i = e << 2, o = t.length, s = t[0].length > 0; r.length < e && i-- > 0;) {\n var a = t[Math.floor(Math.random() * o)],\n u = s ? a.join(\"_\") : \"\" + a;\n n[u] || (n[u] = !0, r.push(a));\n }\n if (r.length < e) throw new Error(\"Error initializating clusters\");\n return r;\n },\n $a = function (t, e) {\n var n = t[0].length ? Ja : Za,\n r = [],\n i = t.length,\n o = t[0].length > 0,\n s = t[Math.floor(Math.random() * i)];\n o && s.join(\"_\");\n for (r.push(s); r.length < e;) {\n for (var a = [], u = r.length, c = 0, h = [], l = 0; l < i; l++) {\n for (var p = 1 / 0, f = 0; f < u; f++) {\n var g = n(t[l], r[f]);\n g <= p && (p = g);\n }\n a[l] = p;\n }\n for (var d = 0; d < i; d++) c += a[d];\n for (var y = 0; y < i; y++) h[y] = {\n i: y,\n v: t[y],\n pr: a[y] / c,\n cs: 0\n };\n h.sort(function (t, e) {\n return t.pr - e.pr;\n }), h[0].cs = h[0].pr;\n for (var _ = 1; _ < i; _++) h[_].cs = h[_ - 1].cs + h[_].pr;\n for (var m = Math.random(), v = 0; v < i - 1 && h[v++].cs < m;);\n r.push(h[v - 1].v);\n }\n return r;\n },\n tu = 1e4,\n eu = function (t, e, n, r) {\n var i = [],\n o = [],\n s = [],\n a = [],\n u = !1,\n c = r || tu,\n h = t.length,\n l = t[0].length,\n p = l > 0,\n f = [];\n if (n) i = \"kmrand\" == n ? Qa(t, e) : \"kmpp\" == n ? $a(t, e) : n;else for (var g = {}; i.length < e;) {\n var d = Math.floor(Math.random() * h);\n g[d] || (g[d] = !0, i.push(t[d]));\n }\n do {\n Ar(e, 0, f);\n for (var y = 0; y < h; y++) {\n for (var _ = 1 / 0, m = 0, v = 0; v < e; v++) (a = p ? Ka(t[y], i[v]) : Math.abs(t[y] - i[v])) <= _ && (_ = a, m = v);\n s[y] = m, f[m]++;\n }\n for (var x = [], E = (o = [], 0); E < e; E++) x[E] = p ? Ar(l, 0, x[E]) : 0, o[E] = i[E];\n if (p) {\n for (var w = 0; w < e; w++) i[w] = [];\n for (var b = 0; b < h; b++) for (var I = x[s[b]], N = t[b], C = 0; C < l; C++) I[C] += N[C];\n u = !0;\n for (var S = 0; S < e; S++) {\n for (var M = i[S], L = x[S], P = o[S], O = f[S], R = 0; R < l; R++) M[R] = L[R] / O || 0;\n if (u) for (var T = 0; T < l; T++) if (P[T] != M[T]) {\n u = !1;\n break;\n }\n }\n } else {\n for (var A = 0; A < h; A++) x[s[A]] += t[A];\n for (var D = 0; D < e; D++) i[D] = x[D] / f[D] || 0;\n u = !0;\n for (var F = 0; F < e; F++) if (o[F] != i[F]) {\n u = !1;\n break;\n }\n }\n u = u || --c <= 0;\n } while (!u);\n return {\n it: tu - c,\n k: e,\n idxs: s,\n centroids: i\n };\n },\n nu = {\n search: function (t, e, n, r) {\n t.cleanDirty();\n var i = (r = r || {}).heuristic || nu.heuristics.manhattan,\n o = r.closest || !1,\n s = new Br(function (t) {\n return t.f;\n }),\n a = e;\n for (e.h = i(e, n), s.push(e); s.size() > 0;) {\n var u = s.pop();\n if (u === n) return Fr(u);\n u.closed = !0;\n for (var c = t.neighbors(u), h = 0, l = c.length; h < l; ++h) {\n var p = c[h];\n if (!p.closed && !p.isWall()) {\n var f = u.g + p.getCost(u),\n g = p.visited;\n (!g || f < p.g) && (p.visited = !0, p.parent = u, p.h = p.h || i(p, n), p.g = f, p.f = p.g + p.h, t.markDirty(p), o && (p.h < a.h || p.h === a.h && p.g < a.g) && (a = p), g ? s.rescoreElement(p) : s.push(p));\n }\n }\n }\n return o ? Fr(a) : [];\n },\n heuristics: {\n manhattan: function (t, e) {\n return Math.abs(e.x - t.x) + Math.abs(e.y - t.y);\n },\n diagonal: function (t, e) {\n var n = Math.sqrt(2),\n r = Math.abs(e.x - t.x),\n i = Math.abs(e.y - t.y);\n return 1 * (r + i) + (n - 2) * Math.min(r, i);\n }\n },\n cleanNode: function (t) {\n t.f = 0, t.g = 0, t.h = 0, t.visited = !1, t.closed = !1, t.parent = null;\n }\n };\n qr.prototype.init = function () {\n this.dirtyNodes = [];\n for (var t = 0; t < this.nodes.length; t++) nu.cleanNode(this.nodes[t]);\n }, qr.prototype.cleanDirty = function () {\n for (var t = 0; t < this.dirtyNodes.length; t++) nu.cleanNode(this.dirtyNodes[t]);\n this.dirtyNodes = [];\n }, qr.prototype.markDirty = function (t) {\n this.dirtyNodes.push(t);\n }, qr.prototype.neighbors = function (t) {\n var e = [],\n n = t.x,\n r = t.y,\n i = this.grid;\n return i[n - 1] && i[n - 1][r] && e.push(i[n - 1][r]), i[n + 1] && i[n + 1][r] && e.push(i[n + 1][r]), i[n] && i[n][r - 1] && e.push(i[n][r - 1]), i[n] && i[n][r + 1] && e.push(i[n][r + 1]), this.diagonal && (i[n - 1] && i[n - 1][r - 1] && e.push(i[n - 1][r - 1]), i[n + 1] && i[n + 1][r - 1] && e.push(i[n + 1][r - 1]), i[n - 1] && i[n - 1][r + 1] && e.push(i[n - 1][r + 1]), i[n + 1] && i[n + 1][r + 1] && e.push(i[n + 1][r + 1])), e;\n }, qr.prototype.toString = function () {\n for (var t, e, n, r, i = [], o = this.grid, s = 0, a = o.length; s < a; s++) {\n for (t = [], n = 0, r = (e = o[s]).length; n < r; n++) t.push(e[n].weight);\n i.push(t.join(\" \"));\n }\n return i.join(\"\\n\");\n }, Gr.prototype.toString = function () {\n return \"[\" + this.x + \" \" + this.y + \"]\";\n }, Gr.prototype.getCost = function (t) {\n return t && t.x !== this.x && t.y !== this.y ? 1.41421 * this.weight : this.weight;\n }, Gr.prototype.isWall = function () {\n return 0 === this.weight;\n }, Br.prototype = {\n push: function (t) {\n this.content.push(t), this.sinkDown(this.content.length - 1);\n },\n pop: function () {\n var t = this.content[0],\n e = this.content.pop();\n return this.content.length > 0 && (this.content[0] = e, this.bubbleUp(0)), t;\n },\n remove: function (t) {\n var e = this.content.indexOf(t),\n n = this.content.pop();\n e !== this.content.length - 1 && (this.content[e] = n, this.scoreFunction(n) < this.scoreFunction(t) ? this.sinkDown(e) : this.bubbleUp(e));\n },\n size: function () {\n return this.content.length;\n },\n rescoreElement: function (t) {\n this.sinkDown(this.content.indexOf(t));\n },\n sinkDown: function (t) {\n for (var e = this.content[t]; t > 0;) {\n var n = (t + 1 >> 1) - 1,\n r = this.content[n];\n if (!(this.scoreFunction(e) < this.scoreFunction(r))) break;\n this.content[n] = e, this.content[t] = r, t = n;\n }\n },\n bubbleUp: function (t) {\n for (var e = this.content.length, n = this.content[t], r = this.scoreFunction(n);;) {\n var i,\n o = t + 1 << 1,\n s = o - 1,\n a = null;\n if (s < e) {\n var u = this.content[s];\n (i = this.scoreFunction(u)) < r && (a = s);\n }\n if (o < e) {\n var c = this.content[o];\n this.scoreFunction(c) < (null === a ? r : i) && (a = o);\n }\n if (null === a) break;\n this.content[t] = this.content[a], this.content[a] = n, t = a;\n }\n }\n };\n var ru = function (t) {\n return function () {\n return t;\n };\n };\n jr.prototype = {\n constructor: jr,\n insert: function (t, e) {\n var n, r, i;\n if (t) {\n if (e.P = t, e.N = t.N, t.N && (t.N.P = e), t.N = e, t.R) {\n for (t = t.R; t.L;) t = t.L;\n t.L = e;\n } else t.R = e;\n n = t;\n } else this._ ? (t = Vr(this._), e.P = null, e.N = t, t.P = t.L = e, n = t) : (e.P = e.N = null, this._ = e, n = null);\n for (e.L = e.R = null, e.U = n, e.C = !0, t = e; n && n.C;) n === (r = n.U).L ? (i = r.R) && i.C ? (n.C = i.C = !1, r.C = !0, t = r) : (t === n.R && (Ur(this, n), n = (t = n).U), n.C = !1, r.C = !0, Yr(this, r)) : (i = r.L) && i.C ? (n.C = i.C = !1, r.C = !0, t = r) : (t === n.L && (Yr(this, n), n = (t = n).U), n.C = !1, r.C = !0, Ur(this, r)), n = t.U;\n this._.C = !1;\n },\n remove: function (t) {\n t.N && (t.N.P = t.P), t.P && (t.P.N = t.N), t.N = t.P = null;\n var e,\n n,\n r,\n i = t.U,\n o = t.L,\n s = t.R;\n if (n = o ? s ? Vr(s) : o : s, i ? i.L === t ? i.L = n : i.R = n : this._ = n, o && s ? (r = n.C, n.C = t.C, n.L = o, o.U = n, n !== s ? (i = n.U, n.U = t.U, t = n.R, i.L = t, n.R = s, s.U = n) : (n.U = i, i = n, t = n.R)) : (r = t.C, t = n), t && (t.U = i), !r) if (t && t.C) t.C = !1;else {\n do {\n if (t === this._) break;\n if (t === i.L) {\n if ((e = i.R).C && (e.C = !1, i.C = !0, Ur(this, i), e = i.R), e.L && e.L.C || e.R && e.R.C) {\n e.R && e.R.C || (e.L.C = !1, e.C = !0, Yr(this, e), e = i.R), e.C = i.C, i.C = e.R.C = !1, Ur(this, i), t = this._;\n break;\n }\n } else if ((e = i.L).C && (e.C = !1, i.C = !0, Yr(this, i), e = i.L), e.L && e.L.C || e.R && e.R.C) {\n e.L && e.L.C || (e.R.C = !1, e.C = !0, Ur(this, e), e = i.L), e.C = i.C, i.C = e.L.C = !1, Yr(this, i), t = this._;\n break;\n }\n e.C = !0, t = i, i = i.U;\n } while (!t.C);\n t && (t.C = !1);\n }\n }\n };\n var iu,\n ou,\n su,\n au,\n uu,\n cu = [],\n hu = [],\n lu = 1e-6,\n pu = 1e-12;\n hi.prototype = {\n constructor: hi,\n polygons: function () {\n var t = this.edges;\n return this.cells.map(function (e) {\n var n = e.halfedges.map(function (n) {\n return $r(e, t[n]);\n });\n return n.data = e.site.data, n;\n });\n },\n triangles: function () {\n var t = [],\n e = this.edges;\n return this.cells.forEach(function (n, r) {\n if (o = (i = n.halfedges).length) for (var i, o, s, a = n.site, u = -1, c = e[i[o - 1]], h = c.left === a ? c.right : c.left; ++u < o;) s = h, h = (c = e[i[u]]).left === a ? c.right : c.left, s && h && r < s.index && r < h.index && ui(a, s, h) < 0 && t.push([a.data, s.data, h.data]);\n }), t;\n },\n links: function () {\n return this.edges.filter(function (t) {\n return t.right;\n }).map(function (t) {\n return {\n source: t.left.data,\n target: t.right.data\n };\n });\n },\n find: function (t, e, n) {\n for (var r, i, o = this, s = o._found || 0, a = o.cells.length; !(i = o.cells[s]);) if (++s >= a) return null;\n var u = t - i.site[0],\n c = e - i.site[1],\n h = u * u + c * c;\n do {\n i = o.cells[r = s], s = null, i.halfedges.forEach(function (n) {\n var r = o.edges[n],\n a = r.left;\n if (a !== i.site && a || (a = r.right)) {\n var u = t - a[0],\n c = e - a[1],\n l = u * u + c * c;\n l < h && (h = l, s = a.index);\n }\n });\n } while (null !== s);\n return o._found = r, null == n || h <= n * n ? i.site : null;\n }\n };\n var fu = function () {\n function t(t) {\n return new hi(t.map(function (r, i) {\n var o = [Math.round(e(r, i, t) / lu) * lu, Math.round(n(r, i, t) / lu) * lu];\n return o.index = i, o.data = r, o;\n }), r);\n }\n var e = kr,\n n = zr,\n r = null;\n return t.polygons = function (e) {\n return t(e).polygons();\n }, t.links = function (e) {\n return t(e).links();\n }, t.triangles = function (e) {\n return t(e).triangles();\n }, t.x = function (n) {\n return arguments.length ? (e = \"function\" == typeof n ? n : ru(+n), t) : e;\n }, t.y = function (e) {\n return arguments.length ? (n = \"function\" == typeof e ? e : ru(+e), t) : n;\n }, t.extent = function (e) {\n return arguments.length ? (r = null == e ? null : [[+e[0][0], +e[0][1]], [+e[1][0], +e[1][1]]], t) : r && [[r[0][0], r[0][1]], [r[1][0], r[1][1]]];\n }, t.size = function (e) {\n return arguments.length ? (r = null == e ? null : [[0, 0], [+e[0], +e[1]]], t) : r && [r[1][0] - r[0][0], r[1][1] - r[0][1]];\n }, t;\n },\n gu = Object.freeze({\n randomPosition: _i,\n randomPoint: mi,\n randomPolygon: vi,\n randomLineString: xi\n }),\n du = Object.freeze({\n getCluster: wi,\n clusterEach: bi,\n clusterReduce: Ii,\n createBins: Ni,\n applyFilter: Ci,\n propertiesContainsFilter: Si,\n filterProperties: Mi\n });\n \"fill\" in Array.prototype || Object.defineProperty(Array.prototype, \"fill\", {\n configurable: !0,\n value: function (t) {\n if (void 0 === this || null === this) throw new TypeError(this + \" is not an object\");\n var e = Object(this),\n n = Math.max(Math.min(e.length, 9007199254740991), 0) || 0,\n r = 1 in arguments ? parseInt(Number(arguments[1]), 10) || 0 : 0;\n r = r < 0 ? Math.max(n + r, 0) : Math.min(r, n);\n var i = 2 in arguments && void 0 !== arguments[2] ? parseInt(Number(arguments[2]), 10) || 0 : n;\n for (i = i < 0 ? Math.max(n + arguments[2], 0) : Math.min(i, n); r < i;) e[r] = t, ++r;\n return e;\n },\n writable: !0\n }), Number.isFinite = Number.isFinite || function (t) {\n return \"number\" == typeof t && isFinite(t);\n }, Number.isInteger = Number.isInteger || function (t) {\n return \"number\" == typeof t && isFinite(t) && Math.floor(t) === t;\n }, Number.parseFloat = Number.parseFloat || parseFloat, Number.isNaN = Number.isNaN || function (t) {\n return t != t;\n }, Math.trunc = Math.trunc || function (t) {\n return t < 0 ? Math.ceil(t) : Math.floor(t);\n };\n var yu = function () {};\n yu.prototype.interfaces_ = function () {\n return [];\n }, yu.prototype.getClass = function () {\n return yu;\n }, yu.prototype.equalsWithTolerance = function (t, e, n) {\n return Math.abs(t - e) <= n;\n };\n var _u = function () {},\n mu = function () {},\n vu = {\n MAX_VALUE: {\n configurable: !0\n }\n };\n mu.isNaN = function (t) {\n return Number.isNaN(t);\n }, mu.doubleToLongBits = function (t) {\n return t;\n }, mu.longBitsToDouble = function (t) {\n return t;\n }, mu.isInfinite = function (t) {\n return !Number.isFinite(t);\n }, vu.MAX_VALUE.get = function () {\n return Number.MAX_VALUE;\n }, Object.defineProperties(mu, vu);\n var xu = function () {},\n Eu = function () {},\n wu = function () {},\n bu = function t() {\n if (this.x = null, this.y = null, this.z = null, 0 === arguments.length) this.x = 0, this.y = 0, this.z = t.NULL_ORDINATE;else if (1 === arguments.length) {\n var e = arguments[0];\n this.x = e.x, this.y = e.y, this.z = e.z;\n } else 2 === arguments.length ? (this.x = arguments[0], this.y = arguments[1], this.z = t.NULL_ORDINATE) : 3 === arguments.length && (this.x = arguments[0], this.y = arguments[1], this.z = arguments[2]);\n },\n Iu = {\n DimensionalComparator: {\n configurable: !0\n },\n serialVersionUID: {\n configurable: !0\n },\n NULL_ORDINATE: {\n configurable: !0\n },\n X: {\n configurable: !0\n },\n Y: {\n configurable: !0\n },\n Z: {\n configurable: !0\n }\n };\n bu.prototype.setOrdinate = function (t, e) {\n switch (t) {\n case bu.X:\n this.x = e;\n break;\n case bu.Y:\n this.y = e;\n break;\n case bu.Z:\n this.z = e;\n break;\n default:\n throw new _u(\"Invalid ordinate index: \" + t);\n }\n }, bu.prototype.equals2D = function () {\n if (1 === arguments.length) {\n var t = arguments[0];\n return this.x === t.x && this.y === t.y;\n }\n if (2 === arguments.length) {\n var e = arguments[0],\n n = arguments[1];\n return !!yu.equalsWithTolerance(this.x, e.x, n) && !!yu.equalsWithTolerance(this.y, e.y, n);\n }\n }, bu.prototype.getOrdinate = function (t) {\n switch (t) {\n case bu.X:\n return this.x;\n case bu.Y:\n return this.y;\n case bu.Z:\n return this.z;\n }\n throw new _u(\"Invalid ordinate index: \" + t);\n }, bu.prototype.equals3D = function (t) {\n return this.x === t.x && this.y === t.y && (this.z === t.z || mu.isNaN(this.z)) && mu.isNaN(t.z);\n }, bu.prototype.equals = function (t) {\n return t instanceof bu && this.equals2D(t);\n }, bu.prototype.equalInZ = function (t, e) {\n return yu.equalsWithTolerance(this.z, t.z, e);\n }, bu.prototype.compareTo = function (t) {\n var e = t;\n return this.x < e.x ? -1 : this.x > e.x ? 1 : this.y < e.y ? -1 : this.y > e.y ? 1 : 0;\n }, bu.prototype.clone = function () {}, bu.prototype.copy = function () {\n return new bu(this);\n }, bu.prototype.toString = function () {\n return \"(\" + this.x + \", \" + this.y + \", \" + this.z + \")\";\n }, bu.prototype.distance3D = function (t) {\n var e = this.x - t.x,\n n = this.y - t.y,\n r = this.z - t.z;\n return Math.sqrt(e * e + n * n + r * r);\n }, bu.prototype.distance = function (t) {\n var e = this.x - t.x,\n n = this.y - t.y;\n return Math.sqrt(e * e + n * n);\n }, bu.prototype.hashCode = function () {\n var t = 17;\n return t = 37 * t + bu.hashCode(this.x), t = 37 * t + bu.hashCode(this.y);\n }, bu.prototype.setCoordinate = function (t) {\n this.x = t.x, this.y = t.y, this.z = t.z;\n }, bu.prototype.interfaces_ = function () {\n return [xu, Eu, Li];\n }, bu.prototype.getClass = function () {\n return bu;\n }, bu.hashCode = function () {\n if (1 === arguments.length) {\n var t = arguments[0],\n e = mu.doubleToLongBits(t);\n return Math.trunc((e ^ e) >>> 32);\n }\n }, Iu.DimensionalComparator.get = function () {\n return Nu;\n }, Iu.serialVersionUID.get = function () {\n return 0x5cbf2c235c7e5800;\n }, Iu.NULL_ORDINATE.get = function () {\n return mu.NaN;\n }, Iu.X.get = function () {\n return 0;\n }, Iu.Y.get = function () {\n return 1;\n }, Iu.Z.get = function () {\n return 2;\n }, Object.defineProperties(bu, Iu);\n var Nu = function (t) {\n if (this._dimensionsToTest = 2, 0 === arguments.length) ;else if (1 === arguments.length) {\n var e = arguments[0];\n if (2 !== e && 3 !== e) throw new _u(\"only 2 or 3 dimensions may be specified\");\n this._dimensionsToTest = e;\n }\n };\n Nu.prototype.compare = function (t, e) {\n var n = t,\n r = e,\n i = Nu.compare(n.x, r.x);\n if (0 !== i) return i;\n var o = Nu.compare(n.y, r.y);\n if (0 !== o) return o;\n if (this._dimensionsToTest <= 2) return 0;\n return Nu.compare(n.z, r.z);\n }, Nu.prototype.interfaces_ = function () {\n return [wu];\n }, Nu.prototype.getClass = function () {\n return Nu;\n }, Nu.compare = function (t, e) {\n return t < e ? -1 : t > e ? 1 : mu.isNaN(t) ? mu.isNaN(e) ? 0 : -1 : mu.isNaN(e) ? 1 : 0;\n };\n var Cu = function () {};\n Cu.prototype.create = function () {}, Cu.prototype.interfaces_ = function () {\n return [];\n }, Cu.prototype.getClass = function () {\n return Cu;\n };\n var Su = function () {},\n Mu = {\n INTERIOR: {\n configurable: !0\n },\n BOUNDARY: {\n configurable: !0\n },\n EXTERIOR: {\n configurable: !0\n },\n NONE: {\n configurable: !0\n }\n };\n Su.prototype.interfaces_ = function () {\n return [];\n }, Su.prototype.getClass = function () {\n return Su;\n }, Su.toLocationSymbol = function (t) {\n switch (t) {\n case Su.EXTERIOR:\n return \"e\";\n case Su.BOUNDARY:\n return \"b\";\n case Su.INTERIOR:\n return \"i\";\n case Su.NONE:\n return \"-\";\n }\n throw new _u(\"Unknown location value: \" + t);\n }, Mu.INTERIOR.get = function () {\n return 0;\n }, Mu.BOUNDARY.get = function () {\n return 1;\n }, Mu.EXTERIOR.get = function () {\n return 2;\n }, Mu.NONE.get = function () {\n return -1;\n }, Object.defineProperties(Su, Mu);\n var Lu = function (t, e) {\n return t.interfaces_ && t.interfaces_().indexOf(e) > -1;\n },\n Pu = function () {},\n Ou = {\n LOG_10: {\n configurable: !0\n }\n };\n Pu.prototype.interfaces_ = function () {\n return [];\n }, Pu.prototype.getClass = function () {\n return Pu;\n }, Pu.log10 = function (t) {\n var e = Math.log(t);\n return mu.isInfinite(e) ? e : mu.isNaN(e) ? e : e / Pu.LOG_10;\n }, Pu.min = function (t, e, n, r) {\n var i = t;\n return e < i && (i = e), n < i && (i = n), r < i && (i = r), i;\n }, Pu.clamp = function () {\n if (\"number\" == typeof arguments[2] && \"number\" == typeof arguments[0] && \"number\" == typeof arguments[1]) {\n var t = arguments[0],\n e = arguments[1],\n n = arguments[2];\n return t < e ? e : t > n ? n : t;\n }\n if (Number.isInteger(arguments[2]) && Number.isInteger(arguments[0]) && Number.isInteger(arguments[1])) {\n var r = arguments[0],\n i = arguments[1],\n o = arguments[2];\n return r < i ? i : r > o ? o : r;\n }\n }, Pu.wrap = function (t, e) {\n return t < 0 ? e - -t % e : t % e;\n }, Pu.max = function () {\n if (3 === arguments.length) {\n var t = arguments[0],\n e = arguments[1],\n n = arguments[2],\n r = t;\n return e > r && (r = e), n > r && (r = n), r;\n }\n if (4 === arguments.length) {\n var i = arguments[0],\n o = arguments[1],\n s = arguments[2],\n a = arguments[3],\n u = i;\n return o > u && (u = o), s > u && (u = s), a > u && (u = a), u;\n }\n }, Pu.average = function (t, e) {\n return (t + e) / 2;\n }, Ou.LOG_10.get = function () {\n return Math.log(10);\n }, Object.defineProperties(Pu, Ou);\n var Ru = function (t) {\n this.str = t;\n };\n Ru.prototype.append = function (t) {\n this.str += t;\n }, Ru.prototype.setCharAt = function (t, e) {\n this.str = this.str.substr(0, t) + e + this.str.substr(t + 1);\n }, Ru.prototype.toString = function (t) {\n return this.str;\n };\n var Tu = function (t) {\n this.value = t;\n };\n Tu.prototype.intValue = function () {\n return this.value;\n }, Tu.prototype.compareTo = function (t) {\n return this.value < t ? -1 : this.value > t ? 1 : 0;\n }, Tu.isNaN = function (t) {\n return Number.isNaN(t);\n };\n var Au = function () {};\n Au.isWhitespace = function (t) {\n return t <= 32 && t >= 0 || 127 === t;\n }, Au.toUpperCase = function (t) {\n return t.toUpperCase();\n };\n var Du = function t() {\n if (this._hi = 0, this._lo = 0, 0 === arguments.length) this.init(0);else if (1 === arguments.length) {\n if (\"number\" == typeof arguments[0]) {\n var e = arguments[0];\n this.init(e);\n } else if (arguments[0] instanceof t) {\n var n = arguments[0];\n this.init(n);\n } else if (\"string\" == typeof arguments[0]) {\n var r = arguments[0];\n t.call(this, t.parse(r));\n }\n } else if (2 === arguments.length) {\n var i = arguments[0],\n o = arguments[1];\n this.init(i, o);\n }\n },\n Fu = {\n PI: {\n configurable: !0\n },\n TWO_PI: {\n configurable: !0\n },\n PI_2: {\n configurable: !0\n },\n E: {\n configurable: !0\n },\n NaN: {\n configurable: !0\n },\n EPS: {\n configurable: !0\n },\n SPLIT: {\n configurable: !0\n },\n MAX_PRINT_DIGITS: {\n configurable: !0\n },\n TEN: {\n configurable: !0\n },\n ONE: {\n configurable: !0\n },\n SCI_NOT_EXPONENT_CHAR: {\n configurable: !0\n },\n SCI_NOT_ZERO: {\n configurable: !0\n }\n };\n Du.prototype.le = function (t) {\n return (this._hi < t._hi || this._hi === t._hi) && this._lo <= t._lo;\n }, Du.prototype.extractSignificantDigits = function (t, e) {\n var n = this.abs(),\n r = Du.magnitude(n._hi),\n i = Du.TEN.pow(r);\n (n = n.divide(i)).gt(Du.TEN) ? (n = n.divide(Du.TEN), r += 1) : n.lt(Du.ONE) && (n = n.multiply(Du.TEN), r -= 1);\n for (var o = r + 1, s = new Ru(), a = Du.MAX_PRINT_DIGITS - 1, u = 0; u <= a; u++) {\n t && u === o && s.append(\".\");\n var c = Math.trunc(n._hi);\n if (c < 0) break;\n var h = !1,\n l = 0;\n c > 9 ? (h = !0, l = \"9\") : l = \"0\" + c, s.append(l), n = n.subtract(Du.valueOf(c)).multiply(Du.TEN), h && n.selfAdd(Du.TEN);\n var p = !0,\n f = Du.magnitude(n._hi);\n if (f < 0 && Math.abs(f) >= a - u && (p = !1), !p) break;\n }\n return e[0] = r, s.toString();\n }, Du.prototype.sqr = function () {\n return this.multiply(this);\n }, Du.prototype.doubleValue = function () {\n return this._hi + this._lo;\n }, Du.prototype.subtract = function () {\n if (arguments[0] instanceof Du) {\n var t = arguments[0];\n return this.add(t.negate());\n }\n if (\"number\" == typeof arguments[0]) {\n var e = arguments[0];\n return this.add(-e);\n }\n }, Du.prototype.equals = function () {\n if (1 === arguments.length) {\n var t = arguments[0];\n return this._hi === t._hi && this._lo === t._lo;\n }\n }, Du.prototype.isZero = function () {\n return 0 === this._hi && 0 === this._lo;\n }, Du.prototype.selfSubtract = function () {\n if (arguments[0] instanceof Du) {\n var t = arguments[0];\n return this.isNaN() ? this : this.selfAdd(-t._hi, -t._lo);\n }\n if (\"number\" == typeof arguments[0]) {\n var e = arguments[0];\n return this.isNaN() ? this : this.selfAdd(-e, 0);\n }\n }, Du.prototype.getSpecialNumberString = function () {\n return this.isZero() ? \"0.0\" : this.isNaN() ? \"NaN \" : null;\n }, Du.prototype.min = function (t) {\n return this.le(t) ? this : t;\n }, Du.prototype.selfDivide = function () {\n if (1 === arguments.length) {\n if (arguments[0] instanceof Du) {\n var t = arguments[0];\n return this.selfDivide(t._hi, t._lo);\n }\n if (\"number\" == typeof arguments[0]) {\n var e = arguments[0];\n return this.selfDivide(e, 0);\n }\n } else if (2 === arguments.length) {\n var n = arguments[0],\n r = arguments[1],\n i = null,\n o = null,\n s = null,\n a = null,\n u = null,\n c = null,\n h = null,\n l = null;\n return u = this._hi / n, c = Du.SPLIT * u, i = c - u, l = Du.SPLIT * n, i = c - i, o = u - i, s = l - n, h = u * n, s = l - s, a = n - s, l = i * s - h + i * a + o * s + o * a, c = (this._hi - h - l + this._lo - u * r) / n, l = u + c, this._hi = l, this._lo = u - l + c, this;\n }\n }, Du.prototype.dump = function () {\n return \"DD<\" + this._hi + \", \" + this._lo + \">\";\n }, Du.prototype.divide = function () {\n if (arguments[0] instanceof Du) {\n var t = arguments[0],\n e = null,\n n = null,\n r = null,\n i = null,\n o = null,\n s = null,\n a = null,\n u = null;\n n = (o = this._hi / t._hi) - (e = (s = Du.SPLIT * o) - (e = s - o)), u = e * (r = (u = Du.SPLIT * t._hi) - (r = u - t._hi)) - (a = o * t._hi) + e * (i = t._hi - r) + n * r + n * i, s = (this._hi - a - u + this._lo - o * t._lo) / t._hi;\n return new Du(u = o + s, o - u + s);\n }\n if (\"number\" == typeof arguments[0]) {\n var c = arguments[0];\n return mu.isNaN(c) ? Du.createNaN() : Du.copy(this).selfDivide(c, 0);\n }\n }, Du.prototype.ge = function (t) {\n return (this._hi > t._hi || this._hi === t._hi) && this._lo >= t._lo;\n }, Du.prototype.pow = function (t) {\n if (0 === t) return Du.valueOf(1);\n var e = new Du(this),\n n = Du.valueOf(1),\n r = Math.abs(t);\n if (r > 1) for (; r > 0;) r % 2 == 1 && n.selfMultiply(e), (r /= 2) > 0 && (e = e.sqr());else n = e;\n return t < 0 ? n.reciprocal() : n;\n }, Du.prototype.ceil = function () {\n if (this.isNaN()) return Du.NaN;\n var t = Math.ceil(this._hi),\n e = 0;\n return t === this._hi && (e = Math.ceil(this._lo)), new Du(t, e);\n }, Du.prototype.compareTo = function (t) {\n var e = t;\n return this._hi < e._hi ? -1 : this._hi > e._hi ? 1 : this._lo < e._lo ? -1 : this._lo > e._lo ? 1 : 0;\n }, Du.prototype.rint = function () {\n if (this.isNaN()) return this;\n return this.add(.5).floor();\n }, Du.prototype.setValue = function () {\n if (arguments[0] instanceof Du) {\n var t = arguments[0];\n return this.init(t), this;\n }\n if (\"number\" == typeof arguments[0]) {\n var e = arguments[0];\n return this.init(e), this;\n }\n }, Du.prototype.max = function (t) {\n return this.ge(t) ? this : t;\n }, Du.prototype.sqrt = function () {\n if (this.isZero()) return Du.valueOf(0);\n if (this.isNegative()) return Du.NaN;\n var t = 1 / Math.sqrt(this._hi),\n e = this._hi * t,\n n = Du.valueOf(e),\n r = this.subtract(n.sqr())._hi * (.5 * t);\n return n.add(r);\n }, Du.prototype.selfAdd = function () {\n if (1 === arguments.length) {\n if (arguments[0] instanceof Du) {\n var t = arguments[0];\n return this.selfAdd(t._hi, t._lo);\n }\n if (\"number\" == typeof arguments[0]) {\n var e = arguments[0],\n n = null,\n r = null,\n i = null,\n o = null,\n s = null,\n a = null;\n return i = this._hi + e, s = i - this._hi, o = i - s, o = e - s + (this._hi - o), a = o + this._lo, n = i + a, r = a + (i - n), this._hi = n + r, this._lo = r + (n - this._hi), this;\n }\n } else if (2 === arguments.length) {\n var u = arguments[0],\n c = arguments[1],\n h = null,\n l = null,\n p = null,\n f = null,\n g = null,\n d = null,\n y = null;\n f = this._hi + u, l = this._lo + c, g = f - (d = f - this._hi), p = l - (y = l - this._lo);\n var _ = (h = f + (d = (g = u - d + (this._hi - g)) + l)) + (d = (p = c - y + (this._lo - p)) + (d + (f - h))),\n m = d + (h - _);\n return this._hi = _, this._lo = m, this;\n }\n }, Du.prototype.selfMultiply = function () {\n if (1 === arguments.length) {\n if (arguments[0] instanceof Du) {\n var t = arguments[0];\n return this.selfMultiply(t._hi, t._lo);\n }\n if (\"number\" == typeof arguments[0]) {\n var e = arguments[0];\n return this.selfMultiply(e, 0);\n }\n } else if (2 === arguments.length) {\n var n = arguments[0],\n r = arguments[1],\n i = null,\n o = null,\n s = null,\n a = null,\n u = null,\n c = null;\n i = (u = Du.SPLIT * this._hi) - this._hi, c = Du.SPLIT * n, i = u - i, o = this._hi - i, s = c - n;\n var h = (u = this._hi * n) + (c = i * (s = c - s) - u + i * (a = n - s) + o * s + o * a + (this._hi * r + this._lo * n)),\n l = c + (i = u - h);\n return this._hi = h, this._lo = l, this;\n }\n }, Du.prototype.selfSqr = function () {\n return this.selfMultiply(this);\n }, Du.prototype.floor = function () {\n if (this.isNaN()) return Du.NaN;\n var t = Math.floor(this._hi),\n e = 0;\n return t === this._hi && (e = Math.floor(this._lo)), new Du(t, e);\n }, Du.prototype.negate = function () {\n return this.isNaN() ? this : new Du(-this._hi, -this._lo);\n }, Du.prototype.clone = function () {}, Du.prototype.multiply = function () {\n if (arguments[0] instanceof Du) {\n var t = arguments[0];\n return t.isNaN() ? Du.createNaN() : Du.copy(this).selfMultiply(t);\n }\n if (\"number\" == typeof arguments[0]) {\n var e = arguments[0];\n return mu.isNaN(e) ? Du.createNaN() : Du.copy(this).selfMultiply(e, 0);\n }\n }, Du.prototype.isNaN = function () {\n return mu.isNaN(this._hi);\n }, Du.prototype.intValue = function () {\n return Math.trunc(this._hi);\n }, Du.prototype.toString = function () {\n var t = Du.magnitude(this._hi);\n return t >= -3 && t <= 20 ? this.toStandardNotation() : this.toSciNotation();\n }, Du.prototype.toStandardNotation = function () {\n var t = this.getSpecialNumberString();\n if (null !== t) return t;\n var e = new Array(1).fill(null),\n n = this.extractSignificantDigits(!0, e),\n r = e[0] + 1,\n i = n;\n if (\".\" === n.charAt(0)) i = \"0\" + n;else if (r < 0) i = \"0.\" + Du.stringOfChar(\"0\", -r) + n;else if (-1 === n.indexOf(\".\")) {\n var o = r - n.length;\n i = n + Du.stringOfChar(\"0\", o) + \".0\";\n }\n return this.isNegative() ? \"-\" + i : i;\n }, Du.prototype.reciprocal = function () {\n var t = null,\n e = null,\n n = null,\n r = null,\n i = null,\n o = null,\n s = null,\n a = null;\n e = (i = 1 / this._hi) - (t = (o = Du.SPLIT * i) - (t = o - i)), n = (a = Du.SPLIT * this._hi) - this._hi;\n var u = i + (o = (1 - (s = i * this._hi) - (a = t * (n = a - n) - s + t * (r = this._hi - n) + e * n + e * r) - i * this._lo) / this._hi);\n return new Du(u, i - u + o);\n }, Du.prototype.toSciNotation = function () {\n if (this.isZero()) return Du.SCI_NOT_ZERO;\n var t = this.getSpecialNumberString();\n if (null !== t) return t;\n var e = new Array(1).fill(null),\n n = this.extractSignificantDigits(!1, e),\n r = Du.SCI_NOT_EXPONENT_CHAR + e[0];\n if (\"0\" === n.charAt(0)) throw new Error(\"Found leading zero: \" + n);\n var i = \"\";\n n.length > 1 && (i = n.substring(1));\n var o = n.charAt(0) + \".\" + i;\n return this.isNegative() ? \"-\" + o + r : o + r;\n }, Du.prototype.abs = function () {\n return this.isNaN() ? Du.NaN : this.isNegative() ? this.negate() : new Du(this);\n }, Du.prototype.isPositive = function () {\n return (this._hi > 0 || 0 === this._hi) && this._lo > 0;\n }, Du.prototype.lt = function (t) {\n return (this._hi < t._hi || this._hi === t._hi) && this._lo < t._lo;\n }, Du.prototype.add = function () {\n if (arguments[0] instanceof Du) {\n var t = arguments[0];\n return Du.copy(this).selfAdd(t);\n }\n if (\"number\" == typeof arguments[0]) {\n var e = arguments[0];\n return Du.copy(this).selfAdd(e);\n }\n }, Du.prototype.init = function () {\n if (1 === arguments.length) {\n if (\"number\" == typeof arguments[0]) {\n var t = arguments[0];\n this._hi = t, this._lo = 0;\n } else if (arguments[0] instanceof Du) {\n var e = arguments[0];\n this._hi = e._hi, this._lo = e._lo;\n }\n } else if (2 === arguments.length) {\n var n = arguments[0],\n r = arguments[1];\n this._hi = n, this._lo = r;\n }\n }, Du.prototype.gt = function (t) {\n return (this._hi > t._hi || this._hi === t._hi) && this._lo > t._lo;\n }, Du.prototype.isNegative = function () {\n return (this._hi < 0 || 0 === this._hi) && this._lo < 0;\n }, Du.prototype.trunc = function () {\n return this.isNaN() ? Du.NaN : this.isPositive() ? this.floor() : this.ceil();\n }, Du.prototype.signum = function () {\n return this._hi > 0 ? 1 : this._hi < 0 ? -1 : this._lo > 0 ? 1 : this._lo < 0 ? -1 : 0;\n }, Du.prototype.interfaces_ = function () {\n return [Li, xu, Eu];\n }, Du.prototype.getClass = function () {\n return Du;\n }, Du.sqr = function (t) {\n return Du.valueOf(t).selfMultiply(t);\n }, Du.valueOf = function () {\n if (\"string\" == typeof arguments[0]) {\n var t = arguments[0];\n return Du.parse(t);\n }\n if (\"number\" == typeof arguments[0]) {\n var e = arguments[0];\n return new Du(e);\n }\n }, Du.sqrt = function (t) {\n return Du.valueOf(t).sqrt();\n }, Du.parse = function (t) {\n for (var e = 0, n = t.length; Au.isWhitespace(t.charAt(e));) e++;\n var r = !1;\n if (e < n) {\n var i = t.charAt(e);\n \"-\" !== i && \"+\" !== i || (e++, \"-\" === i && (r = !0));\n }\n for (var o = new Du(), s = 0, a = 0, u = 0; !(e >= n);) {\n var c = t.charAt(e);\n if (e++, Au.isDigit(c)) {\n var h = c - \"0\";\n o.selfMultiply(Du.TEN), o.selfAdd(h), s++;\n } else {\n if (\".\" !== c) {\n if (\"e\" === c || \"E\" === c) {\n var l = t.substring(e);\n try {\n u = Tu.parseInt(l);\n } catch (e) {\n throw e instanceof Error ? new Error(\"Invalid exponent \" + l + \" in string \" + t) : e;\n }\n break;\n }\n throw new Error(\"Unexpected character '\" + c + \"' at position \" + e + \" in string \" + t);\n }\n a = s;\n }\n }\n var p = o,\n f = s - a - u;\n if (0 === f) p = o;else if (f > 0) {\n var g = Du.TEN.pow(f);\n p = o.divide(g);\n } else if (f < 0) {\n var d = Du.TEN.pow(-f);\n p = o.multiply(d);\n }\n return r ? p.negate() : p;\n }, Du.createNaN = function () {\n return new Du(mu.NaN, mu.NaN);\n }, Du.copy = function (t) {\n return new Du(t);\n }, Du.magnitude = function (t) {\n var e = Math.abs(t),\n n = Math.log(e) / Math.log(10),\n r = Math.trunc(Math.floor(n));\n return 10 * Math.pow(10, r) <= e && (r += 1), r;\n }, Du.stringOfChar = function (t, e) {\n for (var n = new Ru(), r = 0; r < e; r++) n.append(t);\n return n.toString();\n }, Fu.PI.get = function () {\n return new Du(3.141592653589793, 1.2246467991473532e-16);\n }, Fu.TWO_PI.get = function () {\n return new Du(6.283185307179586, 2.4492935982947064e-16);\n }, Fu.PI_2.get = function () {\n return new Du(1.5707963267948966, 6.123233995736766e-17);\n }, Fu.E.get = function () {\n return new Du(2.718281828459045, 1.4456468917292502e-16);\n }, Fu.NaN.get = function () {\n return new Du(mu.NaN, mu.NaN);\n }, Fu.EPS.get = function () {\n return 1.23259516440783e-32;\n }, Fu.SPLIT.get = function () {\n return 134217729;\n }, Fu.MAX_PRINT_DIGITS.get = function () {\n return 32;\n }, Fu.TEN.get = function () {\n return Du.valueOf(10);\n }, Fu.ONE.get = function () {\n return Du.valueOf(1);\n }, Fu.SCI_NOT_EXPONENT_CHAR.get = function () {\n return \"E\";\n }, Fu.SCI_NOT_ZERO.get = function () {\n return \"0.0E0\";\n }, Object.defineProperties(Du, Fu);\n var qu = function () {},\n Gu = {\n DP_SAFE_EPSILON: {\n configurable: !0\n }\n };\n qu.prototype.interfaces_ = function () {\n return [];\n }, qu.prototype.getClass = function () {\n return qu;\n }, qu.orientationIndex = function (t, e, n) {\n var r = qu.orientationIndexFilter(t, e, n);\n if (r <= 1) return r;\n var i = Du.valueOf(e.x).selfAdd(-t.x),\n o = Du.valueOf(e.y).selfAdd(-t.y),\n s = Du.valueOf(n.x).selfAdd(-e.x),\n a = Du.valueOf(n.y).selfAdd(-e.y);\n return i.selfMultiply(a).selfSubtract(o.selfMultiply(s)).signum();\n }, qu.signOfDet2x2 = function (t, e, n, r) {\n return t.multiply(r).selfSubtract(e.multiply(n)).signum();\n }, qu.intersection = function (t, e, n, r) {\n var i = Du.valueOf(r.y).selfSubtract(n.y).selfMultiply(Du.valueOf(e.x).selfSubtract(t.x)),\n o = Du.valueOf(r.x).selfSubtract(n.x).selfMultiply(Du.valueOf(e.y).selfSubtract(t.y)),\n s = i.subtract(o),\n a = Du.valueOf(r.x).selfSubtract(n.x).selfMultiply(Du.valueOf(t.y).selfSubtract(n.y)),\n u = Du.valueOf(r.y).selfSubtract(n.y).selfMultiply(Du.valueOf(t.x).selfSubtract(n.x)),\n c = a.subtract(u).selfDivide(s).doubleValue(),\n h = Du.valueOf(t.x).selfAdd(Du.valueOf(e.x).selfSubtract(t.x).selfMultiply(c)).doubleValue(),\n l = Du.valueOf(e.x).selfSubtract(t.x).selfMultiply(Du.valueOf(t.y).selfSubtract(n.y)),\n p = Du.valueOf(e.y).selfSubtract(t.y).selfMultiply(Du.valueOf(t.x).selfSubtract(n.x)),\n f = l.subtract(p).selfDivide(s).doubleValue(),\n g = Du.valueOf(n.y).selfAdd(Du.valueOf(r.y).selfSubtract(n.y).selfMultiply(f)).doubleValue();\n return new bu(h, g);\n }, qu.orientationIndexFilter = function (t, e, n) {\n var r = null,\n i = (t.x - n.x) * (e.y - n.y),\n o = (t.y - n.y) * (e.x - n.x),\n s = i - o;\n if (i > 0) {\n if (o <= 0) return qu.signum(s);\n r = i + o;\n } else {\n if (!(i < 0)) return qu.signum(s);\n if (o >= 0) return qu.signum(s);\n r = -i - o;\n }\n var a = qu.DP_SAFE_EPSILON * r;\n return s >= a || -s >= a ? qu.signum(s) : 2;\n }, qu.signum = function (t) {\n return t > 0 ? 1 : t < 0 ? -1 : 0;\n }, Gu.DP_SAFE_EPSILON.get = function () {\n return 1e-15;\n }, Object.defineProperties(qu, Gu);\n var Bu = function () {},\n ku = {\n X: {\n configurable: !0\n },\n Y: {\n configurable: !0\n },\n Z: {\n configurable: !0\n },\n M: {\n configurable: !0\n }\n };\n ku.X.get = function () {\n return 0;\n }, ku.Y.get = function () {\n return 1;\n }, ku.Z.get = function () {\n return 2;\n }, ku.M.get = function () {\n return 3;\n }, Bu.prototype.setOrdinate = function (t, e, n) {}, Bu.prototype.size = function () {}, Bu.prototype.getOrdinate = function (t, e) {}, Bu.prototype.getCoordinate = function () {}, Bu.prototype.getCoordinateCopy = function (t) {}, Bu.prototype.getDimension = function () {}, Bu.prototype.getX = function (t) {}, Bu.prototype.clone = function () {}, Bu.prototype.expandEnvelope = function (t) {}, Bu.prototype.copy = function () {}, Bu.prototype.getY = function (t) {}, Bu.prototype.toCoordinateArray = function () {}, Bu.prototype.interfaces_ = function () {\n return [Eu];\n }, Bu.prototype.getClass = function () {\n return Bu;\n }, Object.defineProperties(Bu, ku);\n var zu = function () {},\n ju = function (t) {\n function e() {\n t.call(this, \"Projective point not representable on the Cartesian plane.\");\n }\n return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.interfaces_ = function () {\n return [];\n }, e.prototype.getClass = function () {\n return e;\n }, e;\n }(zu),\n Xu = function () {};\n Xu.arraycopy = function (t, e, n, r, i) {\n for (var o = 0, s = e; s < e + i; s++) n[r + o] = t[s], o++;\n }, Xu.getProperty = function (t) {\n return {\n \"line.separator\": \"\\n\"\n }[t];\n };\n var Uu = function t() {\n if (this.x = null, this.y = null, this.w = null, 0 === arguments.length) this.x = 0, this.y = 0, this.w = 1;else if (1 === arguments.length) {\n var e = arguments[0];\n this.x = e.x, this.y = e.y, this.w = 1;\n } else if (2 === arguments.length) {\n if (\"number\" == typeof arguments[0] && \"number\" == typeof arguments[1]) {\n var n = arguments[0],\n r = arguments[1];\n this.x = n, this.y = r, this.w = 1;\n } else if (arguments[0] instanceof t && arguments[1] instanceof t) {\n var i = arguments[0],\n o = arguments[1];\n this.x = i.y * o.w - o.y * i.w, this.y = o.x * i.w - i.x * o.w, this.w = i.x * o.y - o.x * i.y;\n } else if (arguments[0] instanceof bu && arguments[1] instanceof bu) {\n var s = arguments[0],\n a = arguments[1];\n this.x = s.y - a.y, this.y = a.x - s.x, this.w = s.x * a.y - a.x * s.y;\n }\n } else if (3 === arguments.length) {\n var u = arguments[0],\n c = arguments[1],\n h = arguments[2];\n this.x = u, this.y = c, this.w = h;\n } else if (4 === arguments.length) {\n var l = arguments[0],\n p = arguments[1],\n f = arguments[2],\n g = arguments[3],\n d = l.y - p.y,\n y = p.x - l.x,\n _ = l.x * p.y - p.x * l.y,\n m = f.y - g.y,\n v = g.x - f.x,\n x = f.x * g.y - g.x * f.y;\n this.x = y * x - v * _, this.y = m * _ - d * x, this.w = d * v - m * y;\n }\n };\n Uu.prototype.getY = function () {\n var t = this.y / this.w;\n if (mu.isNaN(t) || mu.isInfinite(t)) throw new ju();\n return t;\n }, Uu.prototype.getX = function () {\n var t = this.x / this.w;\n if (mu.isNaN(t) || mu.isInfinite(t)) throw new ju();\n return t;\n }, Uu.prototype.getCoordinate = function () {\n var t = new bu();\n return t.x = this.getX(), t.y = this.getY(), t;\n }, Uu.prototype.interfaces_ = function () {\n return [];\n }, Uu.prototype.getClass = function () {\n return Uu;\n }, Uu.intersection = function (t, e, n, r) {\n var i = t.y - e.y,\n o = e.x - t.x,\n s = t.x * e.y - e.x * t.y,\n a = n.y - r.y,\n u = r.x - n.x,\n c = n.x * r.y - r.x * n.y,\n h = i * u - a * o,\n l = (o * c - u * s) / h,\n p = (a * s - i * c) / h;\n if (mu.isNaN(l) || mu.isInfinite(l) || mu.isNaN(p) || mu.isInfinite(p)) throw new ju();\n return new bu(l, p);\n };\n var Yu = function t() {\n if (this._minx = null, this._maxx = null, this._miny = null, this._maxy = null, 0 === arguments.length) this.init();else if (1 === arguments.length) {\n if (arguments[0] instanceof bu) {\n var e = arguments[0];\n this.init(e.x, e.x, e.y, e.y);\n } else if (arguments[0] instanceof t) {\n var n = arguments[0];\n this.init(n);\n }\n } else if (2 === arguments.length) {\n var r = arguments[0],\n i = arguments[1];\n this.init(r.x, i.x, r.y, i.y);\n } else if (4 === arguments.length) {\n var o = arguments[0],\n s = arguments[1],\n a = arguments[2],\n u = arguments[3];\n this.init(o, s, a, u);\n }\n },\n Vu = {\n serialVersionUID: {\n configurable: !0\n }\n };\n Yu.prototype.getArea = function () {\n return this.getWidth() * this.getHeight();\n }, Yu.prototype.equals = function (t) {\n if (!(t instanceof Yu)) return !1;\n var e = t;\n return this.isNull() ? e.isNull() : this._maxx === e.getMaxX() && this._maxy === e.getMaxY() && this._minx === e.getMinX() && this._miny === e.getMinY();\n }, Yu.prototype.intersection = function (t) {\n if (this.isNull() || t.isNull() || !this.intersects(t)) return new Yu();\n var e = this._minx > t._minx ? this._minx : t._minx,\n n = this._miny > t._miny ? this._miny : t._miny,\n r = this._maxx < t._maxx ? this._maxx : t._maxx,\n i = this._maxy < t._maxy ? this._maxy : t._maxy;\n return new Yu(e, r, n, i);\n }, Yu.prototype.isNull = function () {\n return this._maxx < this._minx;\n }, Yu.prototype.getMaxX = function () {\n return this._maxx;\n }, Yu.prototype.covers = function () {\n if (1 === arguments.length) {\n if (arguments[0] instanceof bu) {\n var t = arguments[0];\n return this.covers(t.x, t.y);\n }\n if (arguments[0] instanceof Yu) {\n var e = arguments[0];\n return !this.isNull() && !e.isNull() && e.getMinX() >= this._minx && e.getMaxX() <= this._maxx && e.getMinY() >= this._miny && e.getMaxY() <= this._maxy;\n }\n } else if (2 === arguments.length) {\n var n = arguments[0],\n r = arguments[1];\n return !this.isNull() && n >= this._minx && n <= this._maxx && r >= this._miny && r <= this._maxy;\n }\n }, Yu.prototype.intersects = function () {\n if (1 === arguments.length) {\n if (arguments[0] instanceof Yu) {\n var t = arguments[0];\n return !this.isNull() && !t.isNull() && !(t._minx > this._maxx || t._maxx < this._minx || t._miny > this._maxy || t._maxy < this._miny);\n }\n if (arguments[0] instanceof bu) {\n var e = arguments[0];\n return this.intersects(e.x, e.y);\n }\n } else if (2 === arguments.length) {\n var n = arguments[0],\n r = arguments[1];\n return !this.isNull() && !(n > this._maxx || n < this._minx || r > this._maxy || r < this._miny);\n }\n }, Yu.prototype.getMinY = function () {\n return this._miny;\n }, Yu.prototype.getMinX = function () {\n return this._minx;\n }, Yu.prototype.expandToInclude = function () {\n if (1 === arguments.length) {\n if (arguments[0] instanceof bu) {\n var t = arguments[0];\n this.expandToInclude(t.x, t.y);\n } else if (arguments[0] instanceof Yu) {\n var e = arguments[0];\n if (e.isNull()) return null;\n this.isNull() ? (this._minx = e.getMinX(), this._maxx = e.getMaxX(), this._miny = e.getMinY(), this._maxy = e.getMaxY()) : (e._minx < this._minx && (this._minx = e._minx), e._maxx > this._maxx && (this._maxx = e._maxx), e._miny < this._miny && (this._miny = e._miny), e._maxy > this._maxy && (this._maxy = e._maxy));\n }\n } else if (2 === arguments.length) {\n var n = arguments[0],\n r = arguments[1];\n this.isNull() ? (this._minx = n, this._maxx = n, this._miny = r, this._maxy = r) : (n < this._minx && (this._minx = n), n > this._maxx && (this._maxx = n), r < this._miny && (this._miny = r), r > this._maxy && (this._maxy = r));\n }\n }, Yu.prototype.minExtent = function () {\n if (this.isNull()) return 0;\n var t = this.getWidth(),\n e = this.getHeight();\n return t < e ? t : e;\n }, Yu.prototype.getWidth = function () {\n return this.isNull() ? 0 : this._maxx - this._minx;\n }, Yu.prototype.compareTo = function (t) {\n var e = t;\n return this.isNull() ? e.isNull() ? 0 : -1 : e.isNull() ? 1 : this._minx < e._minx ? -1 : this._minx > e._minx ? 1 : this._miny < e._miny ? -1 : this._miny > e._miny ? 1 : this._maxx < e._maxx ? -1 : this._maxx > e._maxx ? 1 : this._maxy < e._maxy ? -1 : this._maxy > e._maxy ? 1 : 0;\n }, Yu.prototype.translate = function (t, e) {\n if (this.isNull()) return null;\n this.init(this.getMinX() + t, this.getMaxX() + t, this.getMinY() + e, this.getMaxY() + e);\n }, Yu.prototype.toString = function () {\n return \"Env[\" + this._minx + \" : \" + this._maxx + \", \" + this._miny + \" : \" + this._maxy + \"]\";\n }, Yu.prototype.setToNull = function () {\n this._minx = 0, this._maxx = -1, this._miny = 0, this._maxy = -1;\n }, Yu.prototype.getHeight = function () {\n return this.isNull() ? 0 : this._maxy - this._miny;\n }, Yu.prototype.maxExtent = function () {\n if (this.isNull()) return 0;\n var t = this.getWidth(),\n e = this.getHeight();\n return t > e ? t : e;\n }, Yu.prototype.expandBy = function () {\n if (1 === arguments.length) {\n var t = arguments[0];\n this.expandBy(t, t);\n } else if (2 === arguments.length) {\n var e = arguments[0],\n n = arguments[1];\n if (this.isNull()) return null;\n this._minx -= e, this._maxx += e, this._miny -= n, this._maxy += n, (this._minx > this._maxx || this._miny > this._maxy) && this.setToNull();\n }\n }, Yu.prototype.contains = function () {\n if (1 === arguments.length) {\n if (arguments[0] instanceof Yu) {\n var t = arguments[0];\n return this.covers(t);\n }\n if (arguments[0] instanceof bu) {\n var e = arguments[0];\n return this.covers(e);\n }\n } else if (2 === arguments.length) {\n var n = arguments[0],\n r = arguments[1];\n return this.covers(n, r);\n }\n }, Yu.prototype.centre = function () {\n return this.isNull() ? null : new bu((this.getMinX() + this.getMaxX()) / 2, (this.getMinY() + this.getMaxY()) / 2);\n }, Yu.prototype.init = function () {\n if (0 === arguments.length) this.setToNull();else if (1 === arguments.length) {\n if (arguments[0] instanceof bu) {\n var t = arguments[0];\n this.init(t.x, t.x, t.y, t.y);\n } else if (arguments[0] instanceof Yu) {\n var e = arguments[0];\n this._minx = e._minx, this._maxx = e._maxx, this._miny = e._miny, this._maxy = e._maxy;\n }\n } else if (2 === arguments.length) {\n var n = arguments[0],\n r = arguments[1];\n this.init(n.x, r.x, n.y, r.y);\n } else if (4 === arguments.length) {\n var i = arguments[0],\n o = arguments[1],\n s = arguments[2],\n a = arguments[3];\n i < o ? (this._minx = i, this._maxx = o) : (this._minx = o, this._maxx = i), s < a ? (this._miny = s, this._maxy = a) : (this._miny = a, this._maxy = s);\n }\n }, Yu.prototype.getMaxY = function () {\n return this._maxy;\n }, Yu.prototype.distance = function (t) {\n if (this.intersects(t)) return 0;\n var e = 0;\n this._maxx < t._minx ? e = t._minx - this._maxx : this._minx > t._maxx && (e = this._minx - t._maxx);\n var n = 0;\n return this._maxy < t._miny ? n = t._miny - this._maxy : this._miny > t._maxy && (n = this._miny - t._maxy), 0 === e ? n : 0 === n ? e : Math.sqrt(e * e + n * n);\n }, Yu.prototype.hashCode = function () {\n var t = 17;\n return t = 37 * t + bu.hashCode(this._minx), t = 37 * t + bu.hashCode(this._maxx), t = 37 * t + bu.hashCode(this._miny), t = 37 * t + bu.hashCode(this._maxy);\n }, Yu.prototype.interfaces_ = function () {\n return [xu, Li];\n }, Yu.prototype.getClass = function () {\n return Yu;\n }, Yu.intersects = function () {\n if (3 === arguments.length) {\n var t = arguments[0],\n e = arguments[1],\n n = arguments[2];\n return n.x >= (t.x < e.x ? t.x : e.x) && n.x <= (t.x > e.x ? t.x : e.x) && n.y >= (t.y < e.y ? t.y : e.y) && n.y <= (t.y > e.y ? t.y : e.y);\n }\n if (4 === arguments.length) {\n var r = arguments[0],\n i = arguments[1],\n o = arguments[2],\n s = arguments[3],\n a = Math.min(o.x, s.x),\n u = Math.max(o.x, s.x),\n c = Math.min(r.x, i.x),\n h = Math.max(r.x, i.x);\n return !(c > u) && !(h < a) && (a = Math.min(o.y, s.y), u = Math.max(o.y, s.y), c = Math.min(r.y, i.y), h = Math.max(r.y, i.y), !(c > u) && !(h < a));\n }\n }, Vu.serialVersionUID.get = function () {\n return 0x51845cd552189800;\n }, Object.defineProperties(Yu, Vu);\n var Hu = {\n typeStr: /^\\s*(\\w+)\\s*\\(\\s*(.*)\\s*\\)\\s*$/,\n emptyTypeStr: /^\\s*(\\w+)\\s*EMPTY\\s*$/,\n spaces: /\\s+/,\n parenComma: /\\)\\s*,\\s*\\(/,\n doubleParenComma: /\\)\\s*\\)\\s*,\\s*\\(\\s*\\(/,\n trimParens: /^\\s*\\(?(.*?)\\)?\\s*$/\n },\n Wu = function (t) {\n this.geometryFactory = t || new _h();\n };\n Wu.prototype.read = function (t) {\n var e, n, r;\n t = t.replace(/[\\n\\r]/g, \" \");\n var i = Hu.typeStr.exec(t);\n if (-1 !== t.search(\"EMPTY\") && ((i = Hu.emptyTypeStr.exec(t))[2] = void 0), i && (n = i[1].toLowerCase(), r = i[2], Zu[n] && (e = Zu[n].apply(this, [r]))), void 0 === e) throw new Error(\"Could not parse WKT \" + t);\n return e;\n }, Wu.prototype.write = function (t) {\n return this.extractGeometry(t);\n }, Wu.prototype.extractGeometry = function (t) {\n var e = t.getGeometryType().toLowerCase();\n if (!Ju[e]) return null;\n var n = e.toUpperCase();\n return t.isEmpty() ? n + \" EMPTY\" : n + \"(\" + Ju[e].apply(this, [t]) + \")\";\n };\n var Ju = {\n coordinate: function (t) {\n return t.x + \" \" + t.y;\n },\n point: function (t) {\n return Ju.coordinate.call(this, t._coordinates._coordinates[0]);\n },\n multipoint: function (t) {\n for (var e = [], n = 0, r = t._geometries.length; n < r; ++n) e.push(\"(\" + Ju.point.apply(this, [t._geometries[n]]) + \")\");\n return e.join(\",\");\n },\n linestring: function (t) {\n for (var e = [], n = 0, r = t._points._coordinates.length; n < r; ++n) e.push(Ju.coordinate.apply(this, [t._points._coordinates[n]]));\n return e.join(\",\");\n },\n linearring: function (t) {\n for (var e = [], n = 0, r = t._points._coordinates.length; n < r; ++n) e.push(Ju.coordinate.apply(this, [t._points._coordinates[n]]));\n return e.join(\",\");\n },\n multilinestring: function (t) {\n for (var e = [], n = 0, r = t._geometries.length; n < r; ++n) e.push(\"(\" + Ju.linestring.apply(this, [t._geometries[n]]) + \")\");\n return e.join(\",\");\n },\n polygon: function (t) {\n var e = [];\n e.push(\"(\" + Ju.linestring.apply(this, [t._shell]) + \")\");\n for (var n = 0, r = t._holes.length; n < r; ++n) e.push(\"(\" + Ju.linestring.apply(this, [t._holes[n]]) + \")\");\n return e.join(\",\");\n },\n multipolygon: function (t) {\n for (var e = [], n = 0, r = t._geometries.length; n < r; ++n) e.push(\"(\" + Ju.polygon.apply(this, [t._geometries[n]]) + \")\");\n return e.join(\",\");\n },\n geometrycollection: function (t) {\n for (var e = [], n = 0, r = t._geometries.length; n < r; ++n) e.push(this.extractGeometry(t._geometries[n]));\n return e.join(\",\");\n }\n },\n Zu = {\n point: function (t) {\n if (void 0 === t) return this.geometryFactory.createPoint();\n var e = t.trim().split(Hu.spaces);\n return this.geometryFactory.createPoint(new bu(Number.parseFloat(e[0]), Number.parseFloat(e[1])));\n },\n multipoint: function (t) {\n if (void 0 === t) return this.geometryFactory.createMultiPoint();\n for (var e, n = t.trim().split(\",\"), r = [], i = 0, o = n.length; i < o; ++i) e = n[i].replace(Hu.trimParens, \"$1\"), r.push(Zu.point.apply(this, [e]));\n return this.geometryFactory.createMultiPoint(r);\n },\n linestring: function (t) {\n if (void 0 === t) return this.geometryFactory.createLineString();\n for (var e, n = t.trim().split(\",\"), r = [], i = 0, o = n.length; i < o; ++i) e = n[i].trim().split(Hu.spaces), r.push(new bu(Number.parseFloat(e[0]), Number.parseFloat(e[1])));\n return this.geometryFactory.createLineString(r);\n },\n linearring: function (t) {\n if (void 0 === t) return this.geometryFactory.createLinearRing();\n for (var e, n = t.trim().split(\",\"), r = [], i = 0, o = n.length; i < o; ++i) e = n[i].trim().split(Hu.spaces), r.push(new bu(Number.parseFloat(e[0]), Number.parseFloat(e[1])));\n return this.geometryFactory.createLinearRing(r);\n },\n multilinestring: function (t) {\n if (void 0 === t) return this.geometryFactory.createMultiLineString();\n for (var e, n = t.trim().split(Hu.parenComma), r = [], i = 0, o = n.length; i < o; ++i) e = n[i].replace(Hu.trimParens, \"$1\"), r.push(Zu.linestring.apply(this, [e]));\n return this.geometryFactory.createMultiLineString(r);\n },\n polygon: function (t) {\n if (void 0 === t) return this.geometryFactory.createPolygon();\n for (var e, n, r, i, o = t.trim().split(Hu.parenComma), s = [], a = 0, u = o.length; a < u; ++a) e = o[a].replace(Hu.trimParens, \"$1\"), n = Zu.linestring.apply(this, [e]), r = this.geometryFactory.createLinearRing(n._points), 0 === a ? i = r : s.push(r);\n return this.geometryFactory.createPolygon(i, s);\n },\n multipolygon: function (t) {\n if (void 0 === t) return this.geometryFactory.createMultiPolygon();\n for (var e, n = t.trim().split(Hu.doubleParenComma), r = [], i = 0, o = n.length; i < o; ++i) e = n[i].replace(Hu.trimParens, \"$1\"), r.push(Zu.polygon.apply(this, [e]));\n return this.geometryFactory.createMultiPolygon(r);\n },\n geometrycollection: function (t) {\n if (void 0 === t) return this.geometryFactory.createGeometryCollection();\n for (var e = (t = t.replace(/,\\s*([A-Za-z])/g, \"|$1\")).trim().split(\"|\"), n = [], r = 0, i = e.length; r < i; ++r) n.push(this.read(e[r]));\n return this.geometryFactory.createGeometryCollection(n);\n }\n },\n Ku = function (t) {\n this.parser = new Wu(t);\n };\n Ku.prototype.write = function (t) {\n return this.parser.write(t);\n }, Ku.toLineString = function (t, e) {\n if (2 !== arguments.length) throw new Error(\"Not implemented\");\n return \"LINESTRING ( \" + t.x + \" \" + t.y + \", \" + e.x + \" \" + e.y + \" )\";\n };\n var Qu = function (t) {\n function e(e) {\n t.call(this, e), this.name = \"RuntimeException\", this.message = e, this.stack = new t().stack;\n }\n return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e;\n }(Error),\n $u = function (t) {\n function e() {\n if (t.call(this), 0 === arguments.length) t.call(this);else if (1 === arguments.length) {\n var e = arguments[0];\n t.call(this, e);\n }\n }\n return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.interfaces_ = function () {\n return [];\n }, e.prototype.getClass = function () {\n return e;\n }, e;\n }(Qu),\n tc = function () {};\n tc.prototype.interfaces_ = function () {\n return [];\n }, tc.prototype.getClass = function () {\n return tc;\n }, tc.shouldNeverReachHere = function () {\n if (0 === arguments.length) tc.shouldNeverReachHere(null);else if (1 === arguments.length) {\n var t = arguments[0];\n throw new $u(\"Should never reach here\" + (null !== t ? \": \" + t : \"\"));\n }\n }, tc.isTrue = function () {\n var t, e;\n if (1 === arguments.length) t = arguments[0], tc.isTrue(t, null);else if (2 === arguments.length && (t = arguments[0], e = arguments[1], !t)) throw null === e ? new $u() : new $u(e);\n }, tc.equals = function () {\n var t, e, n;\n if (2 === arguments.length) t = arguments[0], e = arguments[1], tc.equals(t, e, null);else if (3 === arguments.length && (t = arguments[0], e = arguments[1], n = arguments[2], !e.equals(t))) throw new $u(\"Expected \" + t + \" but encountered \" + e + (null !== n ? \": \" + n : \"\"));\n };\n var ec = function () {\n this._result = null, this._inputLines = Array(2).fill().map(function () {\n return Array(2);\n }), this._intPt = new Array(2).fill(null), this._intLineIndex = null, this._isProper = null, this._pa = null, this._pb = null, this._precisionModel = null, this._intPt[0] = new bu(), this._intPt[1] = new bu(), this._pa = this._intPt[0], this._pb = this._intPt[1], this._result = 0;\n },\n nc = {\n DONT_INTERSECT: {\n configurable: !0\n },\n DO_INTERSECT: {\n configurable: !0\n },\n COLLINEAR: {\n configurable: !0\n },\n NO_INTERSECTION: {\n configurable: !0\n },\n POINT_INTERSECTION: {\n configurable: !0\n },\n COLLINEAR_INTERSECTION: {\n configurable: !0\n }\n };\n ec.prototype.getIndexAlongSegment = function (t, e) {\n return this.computeIntLineIndex(), this._intLineIndex[t][e];\n }, ec.prototype.getTopologySummary = function () {\n var t = new Ru();\n return this.isEndPoint() && t.append(\" endpoint\"), this._isProper && t.append(\" proper\"), this.isCollinear() && t.append(\" collinear\"), t.toString();\n }, ec.prototype.computeIntersection = function (t, e, n, r) {\n this._inputLines[0][0] = t, this._inputLines[0][1] = e, this._inputLines[1][0] = n, this._inputLines[1][1] = r, this._result = this.computeIntersect(t, e, n, r);\n }, ec.prototype.getIntersectionNum = function () {\n return this._result;\n }, ec.prototype.computeIntLineIndex = function () {\n if (0 === arguments.length) null === this._intLineIndex && (this._intLineIndex = Array(2).fill().map(function () {\n return Array(2);\n }), this.computeIntLineIndex(0), this.computeIntLineIndex(1));else if (1 === arguments.length) {\n var t = arguments[0];\n this.getEdgeDistance(t, 0) > this.getEdgeDistance(t, 1) ? (this._intLineIndex[t][0] = 0, this._intLineIndex[t][1] = 1) : (this._intLineIndex[t][0] = 1, this._intLineIndex[t][1] = 0);\n }\n }, ec.prototype.isProper = function () {\n return this.hasIntersection() && this._isProper;\n }, ec.prototype.setPrecisionModel = function (t) {\n this._precisionModel = t;\n }, ec.prototype.isInteriorIntersection = function () {\n if (0 === arguments.length) return !!this.isInteriorIntersection(0) || !!this.isInteriorIntersection(1);\n if (1 === arguments.length) {\n for (var t = arguments[0], e = 0; e < this._result; e++) if (!this._intPt[e].equals2D(this._inputLines[t][0]) && !this._intPt[e].equals2D(this._inputLines[t][1])) return !0;\n return !1;\n }\n }, ec.prototype.getIntersection = function (t) {\n return this._intPt[t];\n }, ec.prototype.isEndPoint = function () {\n return this.hasIntersection() && !this._isProper;\n }, ec.prototype.hasIntersection = function () {\n return this._result !== ec.NO_INTERSECTION;\n }, ec.prototype.getEdgeDistance = function (t, e) {\n return ec.computeEdgeDistance(this._intPt[e], this._inputLines[t][0], this._inputLines[t][1]);\n }, ec.prototype.isCollinear = function () {\n return this._result === ec.COLLINEAR_INTERSECTION;\n }, ec.prototype.toString = function () {\n return Ku.toLineString(this._inputLines[0][0], this._inputLines[0][1]) + \" - \" + Ku.toLineString(this._inputLines[1][0], this._inputLines[1][1]) + this.getTopologySummary();\n }, ec.prototype.getEndpoint = function (t, e) {\n return this._inputLines[t][e];\n }, ec.prototype.isIntersection = function (t) {\n for (var e = 0; e < this._result; e++) if (this._intPt[e].equals2D(t)) return !0;\n return !1;\n }, ec.prototype.getIntersectionAlongSegment = function (t, e) {\n return this.computeIntLineIndex(), this._intPt[this._intLineIndex[t][e]];\n }, ec.prototype.interfaces_ = function () {\n return [];\n }, ec.prototype.getClass = function () {\n return ec;\n }, ec.computeEdgeDistance = function (t, e, n) {\n var r = Math.abs(n.x - e.x),\n i = Math.abs(n.y - e.y),\n o = -1;\n if (t.equals(e)) o = 0;else if (t.equals(n)) o = r > i ? r : i;else {\n var s = Math.abs(t.x - e.x),\n a = Math.abs(t.y - e.y);\n 0 !== (o = r > i ? s : a) || t.equals(e) || (o = Math.max(s, a));\n }\n return tc.isTrue(!(0 === o && !t.equals(e)), \"Bad distance calculation\"), o;\n }, ec.nonRobustComputeEdgeDistance = function (t, e, n) {\n var r = t.x - e.x,\n i = t.y - e.y,\n o = Math.sqrt(r * r + i * i);\n return tc.isTrue(!(0 === o && !t.equals(e)), \"Invalid distance calculation\"), o;\n }, nc.DONT_INTERSECT.get = function () {\n return 0;\n }, nc.DO_INTERSECT.get = function () {\n return 1;\n }, nc.COLLINEAR.get = function () {\n return 2;\n }, nc.NO_INTERSECTION.get = function () {\n return 0;\n }, nc.POINT_INTERSECTION.get = function () {\n return 1;\n }, nc.COLLINEAR_INTERSECTION.get = function () {\n return 2;\n }, Object.defineProperties(ec, nc);\n var rc = function (t) {\n function e() {\n t.apply(this, arguments);\n }\n return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.isInSegmentEnvelopes = function (t) {\n var e = new Yu(this._inputLines[0][0], this._inputLines[0][1]),\n n = new Yu(this._inputLines[1][0], this._inputLines[1][1]);\n return e.contains(t) && n.contains(t);\n }, e.prototype.computeIntersection = function () {\n if (3 !== arguments.length) return t.prototype.computeIntersection.apply(this, arguments);\n var e = arguments[0],\n n = arguments[1],\n r = arguments[2];\n if (this._isProper = !1, Yu.intersects(n, r, e) && 0 === sc.orientationIndex(n, r, e) && 0 === sc.orientationIndex(r, n, e)) return this._isProper = !0, (e.equals(n) || e.equals(r)) && (this._isProper = !1), this._result = t.POINT_INTERSECTION, null;\n this._result = t.NO_INTERSECTION;\n }, e.prototype.normalizeToMinimum = function (t, e, n, r, i) {\n i.x = this.smallestInAbsValue(t.x, e.x, n.x, r.x), i.y = this.smallestInAbsValue(t.y, e.y, n.y, r.y), t.x -= i.x, t.y -= i.y, e.x -= i.x, e.y -= i.y, n.x -= i.x, n.y -= i.y, r.x -= i.x, r.y -= i.y;\n }, e.prototype.safeHCoordinateIntersection = function (t, n, r, i) {\n var o = null;\n try {\n o = Uu.intersection(t, n, r, i);\n } catch (s) {\n if (!(s instanceof ju)) throw s;\n o = e.nearestEndpoint(t, n, r, i);\n }\n return o;\n }, e.prototype.intersection = function (t, n, r, i) {\n var o = this.intersectionWithNormalization(t, n, r, i);\n return this.isInSegmentEnvelopes(o) || (o = new bu(e.nearestEndpoint(t, n, r, i))), null !== this._precisionModel && this._precisionModel.makePrecise(o), o;\n }, e.prototype.smallestInAbsValue = function (t, e, n, r) {\n var i = t,\n o = Math.abs(i);\n return Math.abs(e) < o && (i = e, o = Math.abs(e)), Math.abs(n) < o && (i = n, o = Math.abs(n)), Math.abs(r) < o && (i = r), i;\n }, e.prototype.checkDD = function (t, e, n, r, i) {\n var o = qu.intersection(t, e, n, r),\n s = this.isInSegmentEnvelopes(o);\n Xu.out.println(\"DD in env = \" + s + \" --------------------- \" + o), i.distance(o) > 1e-4 && Xu.out.println(\"Distance = \" + i.distance(o));\n }, e.prototype.intersectionWithNormalization = function (t, e, n, r) {\n var i = new bu(t),\n o = new bu(e),\n s = new bu(n),\n a = new bu(r),\n u = new bu();\n this.normalizeToEnvCentre(i, o, s, a, u);\n var c = this.safeHCoordinateIntersection(i, o, s, a);\n return c.x += u.x, c.y += u.y, c;\n }, e.prototype.computeCollinearIntersection = function (e, n, r, i) {\n var o = Yu.intersects(e, n, r),\n s = Yu.intersects(e, n, i),\n a = Yu.intersects(r, i, e),\n u = Yu.intersects(r, i, n);\n return o && s ? (this._intPt[0] = r, this._intPt[1] = i, t.COLLINEAR_INTERSECTION) : a && u ? (this._intPt[0] = e, this._intPt[1] = n, t.COLLINEAR_INTERSECTION) : o && a ? (this._intPt[0] = r, this._intPt[1] = e, !r.equals(e) || s || u ? t.COLLINEAR_INTERSECTION : t.POINT_INTERSECTION) : o && u ? (this._intPt[0] = r, this._intPt[1] = n, !r.equals(n) || s || a ? t.COLLINEAR_INTERSECTION : t.POINT_INTERSECTION) : s && a ? (this._intPt[0] = i, this._intPt[1] = e, !i.equals(e) || o || u ? t.COLLINEAR_INTERSECTION : t.POINT_INTERSECTION) : s && u ? (this._intPt[0] = i, this._intPt[1] = n, !i.equals(n) || o || a ? t.COLLINEAR_INTERSECTION : t.POINT_INTERSECTION) : t.NO_INTERSECTION;\n }, e.prototype.normalizeToEnvCentre = function (t, e, n, r, i) {\n var o = t.x < e.x ? t.x : e.x,\n s = t.y < e.y ? t.y : e.y,\n a = t.x > e.x ? t.x : e.x,\n u = t.y > e.y ? t.y : e.y,\n c = n.x < r.x ? n.x : r.x,\n h = n.y < r.y ? n.y : r.y,\n l = n.x > r.x ? n.x : r.x,\n p = n.y > r.y ? n.y : r.y,\n f = ((o > c ? o : c) + (a < l ? a : l)) / 2,\n g = ((s > h ? s : h) + (u < p ? u : p)) / 2;\n i.x = f, i.y = g, t.x -= i.x, t.y -= i.y, e.x -= i.x, e.y -= i.y, n.x -= i.x, n.y -= i.y, r.x -= i.x, r.y -= i.y;\n }, e.prototype.computeIntersect = function (e, n, r, i) {\n if (this._isProper = !1, !Yu.intersects(e, n, r, i)) return t.NO_INTERSECTION;\n var o = sc.orientationIndex(e, n, r),\n s = sc.orientationIndex(e, n, i);\n if (o > 0 && s > 0 || o < 0 && s < 0) return t.NO_INTERSECTION;\n var a = sc.orientationIndex(r, i, e),\n u = sc.orientationIndex(r, i, n);\n if (a > 0 && u > 0 || a < 0 && u < 0) return t.NO_INTERSECTION;\n return 0 === o && 0 === s && 0 === a && 0 === u ? this.computeCollinearIntersection(e, n, r, i) : (0 === o || 0 === s || 0 === a || 0 === u ? (this._isProper = !1, e.equals2D(r) || e.equals2D(i) ? this._intPt[0] = e : n.equals2D(r) || n.equals2D(i) ? this._intPt[0] = n : 0 === o ? this._intPt[0] = new bu(r) : 0 === s ? this._intPt[0] = new bu(i) : 0 === a ? this._intPt[0] = new bu(e) : 0 === u && (this._intPt[0] = new bu(n))) : (this._isProper = !0, this._intPt[0] = this.intersection(e, n, r, i)), t.POINT_INTERSECTION);\n }, e.prototype.interfaces_ = function () {\n return [];\n }, e.prototype.getClass = function () {\n return e;\n }, e.nearestEndpoint = function (t, e, n, r) {\n var i = t,\n o = sc.distancePointLine(t, n, r),\n s = sc.distancePointLine(e, n, r);\n return s < o && (o = s, i = e), (s = sc.distancePointLine(n, t, e)) < o && (o = s, i = n), (s = sc.distancePointLine(r, t, e)) < o && (o = s, i = r), i;\n }, e;\n }(ec),\n ic = function () {};\n ic.prototype.interfaces_ = function () {\n return [];\n }, ic.prototype.getClass = function () {\n return ic;\n }, ic.orientationIndex = function (t, e, n) {\n var r = e.x - t.x,\n i = e.y - t.y,\n o = n.x - e.x,\n s = n.y - e.y;\n return ic.signOfDet2x2(r, i, o, s);\n }, ic.signOfDet2x2 = function (t, e, n, r) {\n var i = null,\n o = null,\n s = null;\n if (i = 1, 0 === t || 0 === r) return 0 === e || 0 === n ? 0 : e > 0 ? n > 0 ? -i : i : n > 0 ? i : -i;\n if (0 === e || 0 === n) return r > 0 ? t > 0 ? i : -i : t > 0 ? -i : i;\n if (e > 0 ? r > 0 ? e <= r || (i = -i, o = t, t = n, n = o, o = e, e = r, r = o) : e <= -r ? (i = -i, n = -n, r = -r) : (o = t, t = -n, n = o, o = e, e = -r, r = o) : r > 0 ? -e <= r ? (i = -i, t = -t, e = -e) : (o = -t, t = n, n = o, o = -e, e = r, r = o) : e >= r ? (t = -t, e = -e, n = -n, r = -r) : (i = -i, o = -t, t = -n, n = o, o = -e, e = -r, r = o), t > 0) {\n if (!(n > 0)) return i;\n if (!(t <= n)) return i;\n } else {\n if (n > 0) return -i;\n if (!(t >= n)) return -i;\n i = -i, t = -t, n = -n;\n }\n for (;;) {\n if (s = Math.floor(n / t), n -= s * t, (r -= s * e) < 0) return -i;\n if (r > e) return i;\n if (t > n + n) {\n if (e < r + r) return i;\n } else {\n if (e > r + r) return -i;\n n = t - n, r = e - r, i = -i;\n }\n if (0 === r) return 0 === n ? 0 : -i;\n if (0 === n) return i;\n if (s = Math.floor(t / n), t -= s * n, (e -= s * r) < 0) return i;\n if (e > r) return -i;\n if (n > t + t) {\n if (r < e + e) return -i;\n } else {\n if (r > e + e) return i;\n t = n - t, e = r - e, i = -i;\n }\n if (0 === e) return 0 === t ? 0 : i;\n if (0 === t) return -i;\n }\n };\n var oc = function () {\n this._p = null, this._crossingCount = 0, this._isPointOnSegment = !1;\n var t = arguments[0];\n this._p = t;\n };\n oc.prototype.countSegment = function (t, e) {\n if (t.x < this._p.x && e.x < this._p.x) return null;\n if (this._p.x === e.x && this._p.y === e.y) return this._isPointOnSegment = !0, null;\n if (t.y === this._p.y && e.y === this._p.y) {\n var n = t.x,\n r = e.x;\n return n > r && (n = e.x, r = t.x), this._p.x >= n && this._p.x <= r && (this._isPointOnSegment = !0), null;\n }\n if (t.y > this._p.y && e.y <= this._p.y || e.y > this._p.y && t.y <= this._p.y) {\n var i = t.x - this._p.x,\n o = t.y - this._p.y,\n s = e.x - this._p.x,\n a = e.y - this._p.y,\n u = ic.signOfDet2x2(i, o, s, a);\n if (0 === u) return this._isPointOnSegment = !0, null;\n a < o && (u = -u), u > 0 && this._crossingCount++;\n }\n }, oc.prototype.isPointInPolygon = function () {\n return this.getLocation() !== Su.EXTERIOR;\n }, oc.prototype.getLocation = function () {\n return this._isPointOnSegment ? Su.BOUNDARY : this._crossingCount % 2 == 1 ? Su.INTERIOR : Su.EXTERIOR;\n }, oc.prototype.isOnSegment = function () {\n return this._isPointOnSegment;\n }, oc.prototype.interfaces_ = function () {\n return [];\n }, oc.prototype.getClass = function () {\n return oc;\n }, oc.locatePointInRing = function () {\n if (arguments[0] instanceof bu && Lu(arguments[1], Bu)) {\n for (var t = arguments[0], e = arguments[1], n = new oc(t), r = new bu(), i = new bu(), o = 1; o < e.size(); o++) if (e.getCoordinate(o, r), e.getCoordinate(o - 1, i), n.countSegment(r, i), n.isOnSegment()) return n.getLocation();\n return n.getLocation();\n }\n if (arguments[0] instanceof bu && arguments[1] instanceof Array) {\n for (var s = arguments[0], a = arguments[1], u = new oc(s), c = 1; c < a.length; c++) {\n var h = a[c],\n l = a[c - 1];\n if (u.countSegment(h, l), u.isOnSegment()) return u.getLocation();\n }\n return u.getLocation();\n }\n };\n var sc = function () {},\n ac = {\n CLOCKWISE: {\n configurable: !0\n },\n RIGHT: {\n configurable: !0\n },\n COUNTERCLOCKWISE: {\n configurable: !0\n },\n LEFT: {\n configurable: !0\n },\n COLLINEAR: {\n configurable: !0\n },\n STRAIGHT: {\n configurable: !0\n }\n };\n sc.prototype.interfaces_ = function () {\n return [];\n }, sc.prototype.getClass = function () {\n return sc;\n }, sc.orientationIndex = function (t, e, n) {\n return qu.orientationIndex(t, e, n);\n }, sc.signedArea = function () {\n if (arguments[0] instanceof Array) {\n var t = arguments[0];\n if (t.length < 3) return 0;\n for (var e = 0, n = t[0].x, r = 1; r < t.length - 1; r++) {\n var i = t[r].x - n,\n o = t[r + 1].y;\n e += i * (t[r - 1].y - o);\n }\n return e / 2;\n }\n if (Lu(arguments[0], Bu)) {\n var s = arguments[0],\n a = s.size();\n if (a < 3) return 0;\n var u = new bu(),\n c = new bu(),\n h = new bu();\n s.getCoordinate(0, c), s.getCoordinate(1, h);\n var l = c.x;\n h.x -= l;\n for (var p = 0, f = 1; f < a - 1; f++) u.y = c.y, c.x = h.x, c.y = h.y, s.getCoordinate(f + 1, h), h.x -= l, p += c.x * (u.y - h.y);\n return p / 2;\n }\n }, sc.distanceLineLine = function (t, e, n, r) {\n if (t.equals(e)) return sc.distancePointLine(t, n, r);\n if (n.equals(r)) return sc.distancePointLine(r, t, e);\n var i = !1;\n if (Yu.intersects(t, e, n, r)) {\n var o = (e.x - t.x) * (r.y - n.y) - (e.y - t.y) * (r.x - n.x);\n if (0 === o) i = !0;else {\n var s = (t.y - n.y) * (r.x - n.x) - (t.x - n.x) * (r.y - n.y),\n a = ((t.y - n.y) * (e.x - t.x) - (t.x - n.x) * (e.y - t.y)) / o,\n u = s / o;\n (u < 0 || u > 1 || a < 0 || a > 1) && (i = !0);\n }\n } else i = !0;\n return i ? Pu.min(sc.distancePointLine(t, n, r), sc.distancePointLine(e, n, r), sc.distancePointLine(n, t, e), sc.distancePointLine(r, t, e)) : 0;\n }, sc.isPointInRing = function (t, e) {\n return sc.locatePointInRing(t, e) !== Su.EXTERIOR;\n }, sc.computeLength = function (t) {\n var e = t.size();\n if (e <= 1) return 0;\n var n = 0,\n r = new bu();\n t.getCoordinate(0, r);\n for (var i = r.x, o = r.y, s = 1; s < e; s++) {\n t.getCoordinate(s, r);\n var a = r.x,\n u = r.y,\n c = a - i,\n h = u - o;\n n += Math.sqrt(c * c + h * h), i = a, o = u;\n }\n return n;\n }, sc.isCCW = function (t) {\n var e = t.length - 1;\n if (e < 3) throw new _u(\"Ring has fewer than 4 points, so orientation cannot be determined\");\n for (var n = t[0], r = 0, i = 1; i <= e; i++) {\n var o = t[i];\n o.y > n.y && (n = o, r = i);\n }\n var s = r;\n do {\n (s -= 1) < 0 && (s = e);\n } while (t[s].equals2D(n) && s !== r);\n var a = r;\n do {\n a = (a + 1) % e;\n } while (t[a].equals2D(n) && a !== r);\n var u = t[s],\n c = t[a];\n if (u.equals2D(n) || c.equals2D(n) || u.equals2D(c)) return !1;\n var h = sc.computeOrientation(u, n, c),\n l = !1;\n return l = 0 === h ? u.x > c.x : h > 0, l;\n }, sc.locatePointInRing = function (t, e) {\n return oc.locatePointInRing(t, e);\n }, sc.distancePointLinePerpendicular = function (t, e, n) {\n var r = (n.x - e.x) * (n.x - e.x) + (n.y - e.y) * (n.y - e.y),\n i = ((e.y - t.y) * (n.x - e.x) - (e.x - t.x) * (n.y - e.y)) / r;\n return Math.abs(i) * Math.sqrt(r);\n }, sc.computeOrientation = function (t, e, n) {\n return sc.orientationIndex(t, e, n);\n }, sc.distancePointLine = function () {\n if (2 === arguments.length) {\n var t = arguments[0],\n e = arguments[1];\n if (0 === e.length) throw new _u(\"Line array must contain at least one vertex\");\n for (var n = t.distance(e[0]), r = 0; r < e.length - 1; r++) {\n var i = sc.distancePointLine(t, e[r], e[r + 1]);\n i < n && (n = i);\n }\n return n;\n }\n if (3 === arguments.length) {\n var o = arguments[0],\n s = arguments[1],\n a = arguments[2];\n if (s.x === a.x && s.y === a.y) return o.distance(s);\n var u = (a.x - s.x) * (a.x - s.x) + (a.y - s.y) * (a.y - s.y),\n c = ((o.x - s.x) * (a.x - s.x) + (o.y - s.y) * (a.y - s.y)) / u;\n if (c <= 0) return o.distance(s);\n if (c >= 1) return o.distance(a);\n var h = ((s.y - o.y) * (a.x - s.x) - (s.x - o.x) * (a.y - s.y)) / u;\n return Math.abs(h) * Math.sqrt(u);\n }\n }, sc.isOnLine = function (t, e) {\n for (var n = new rc(), r = 1; r < e.length; r++) {\n var i = e[r - 1],\n o = e[r];\n if (n.computeIntersection(t, i, o), n.hasIntersection()) return !0;\n }\n return !1;\n }, ac.CLOCKWISE.get = function () {\n return -1;\n }, ac.RIGHT.get = function () {\n return sc.CLOCKWISE;\n }, ac.COUNTERCLOCKWISE.get = function () {\n return 1;\n }, ac.LEFT.get = function () {\n return sc.COUNTERCLOCKWISE;\n }, ac.COLLINEAR.get = function () {\n return 0;\n }, ac.STRAIGHT.get = function () {\n return sc.COLLINEAR;\n }, Object.defineProperties(sc, ac);\n var uc = function () {};\n uc.prototype.filter = function (t) {}, uc.prototype.interfaces_ = function () {\n return [];\n }, uc.prototype.getClass = function () {\n return uc;\n };\n var cc = function () {\n var t = arguments[0];\n this._envelope = null, this._factory = null, this._SRID = null, this._userData = null, this._factory = t, this._SRID = t.getSRID();\n },\n hc = {\n serialVersionUID: {\n configurable: !0\n },\n SORTINDEX_POINT: {\n configurable: !0\n },\n SORTINDEX_MULTIPOINT: {\n configurable: !0\n },\n SORTINDEX_LINESTRING: {\n configurable: !0\n },\n SORTINDEX_LINEARRING: {\n configurable: !0\n },\n SORTINDEX_MULTILINESTRING: {\n configurable: !0\n },\n SORTINDEX_POLYGON: {\n configurable: !0\n },\n SORTINDEX_MULTIPOLYGON: {\n configurable: !0\n },\n SORTINDEX_GEOMETRYCOLLECTION: {\n configurable: !0\n },\n geometryChangedFilter: {\n configurable: !0\n }\n };\n cc.prototype.isGeometryCollection = function () {\n return this.getSortIndex() === cc.SORTINDEX_GEOMETRYCOLLECTION;\n }, cc.prototype.getFactory = function () {\n return this._factory;\n }, cc.prototype.getGeometryN = function (t) {\n return this;\n }, cc.prototype.getArea = function () {\n return 0;\n }, cc.prototype.isRectangle = function () {\n return !1;\n }, cc.prototype.equals = function () {\n if (arguments[0] instanceof cc) {\n var t = arguments[0];\n return null !== t && this.equalsTopo(t);\n }\n if (arguments[0] instanceof Object) {\n var e = arguments[0];\n if (!(e instanceof cc)) return !1;\n var n = e;\n return this.equalsExact(n);\n }\n }, cc.prototype.equalsExact = function (t) {\n return this === t || this.equalsExact(t, 0);\n }, cc.prototype.geometryChanged = function () {\n this.apply(cc.geometryChangedFilter);\n }, cc.prototype.geometryChangedAction = function () {\n this._envelope = null;\n }, cc.prototype.equalsNorm = function (t) {\n return null !== t && this.norm().equalsExact(t.norm());\n }, cc.prototype.getLength = function () {\n return 0;\n }, cc.prototype.getNumGeometries = function () {\n return 1;\n }, cc.prototype.compareTo = function () {\n if (1 === arguments.length) {\n var t = arguments[0],\n e = t;\n return this.getSortIndex() !== e.getSortIndex() ? this.getSortIndex() - e.getSortIndex() : this.isEmpty() && e.isEmpty() ? 0 : this.isEmpty() ? -1 : e.isEmpty() ? 1 : this.compareToSameClass(t);\n }\n if (2 === arguments.length) {\n var n = arguments[0],\n r = arguments[1];\n return this.getSortIndex() !== n.getSortIndex() ? this.getSortIndex() - n.getSortIndex() : this.isEmpty() && n.isEmpty() ? 0 : this.isEmpty() ? -1 : n.isEmpty() ? 1 : this.compareToSameClass(n, r);\n }\n }, cc.prototype.getUserData = function () {\n return this._userData;\n }, cc.prototype.getSRID = function () {\n return this._SRID;\n }, cc.prototype.getEnvelope = function () {\n return this.getFactory().toGeometry(this.getEnvelopeInternal());\n }, cc.prototype.checkNotGeometryCollection = function (t) {\n if (t.getSortIndex() === cc.SORTINDEX_GEOMETRYCOLLECTION) throw new _u(\"This method does not support GeometryCollection arguments\");\n }, cc.prototype.equal = function (t, e, n) {\n return 0 === n ? t.equals(e) : t.distance(e) <= n;\n }, cc.prototype.norm = function () {\n var t = this.copy();\n return t.normalize(), t;\n }, cc.prototype.getPrecisionModel = function () {\n return this._factory.getPrecisionModel();\n }, cc.prototype.getEnvelopeInternal = function () {\n return null === this._envelope && (this._envelope = this.computeEnvelopeInternal()), new Yu(this._envelope);\n }, cc.prototype.setSRID = function (t) {\n this._SRID = t;\n }, cc.prototype.setUserData = function (t) {\n this._userData = t;\n }, cc.prototype.compare = function (t, e) {\n for (var n = t.iterator(), r = e.iterator(); n.hasNext() && r.hasNext();) {\n var i = n.next(),\n o = r.next(),\n s = i.compareTo(o);\n if (0 !== s) return s;\n }\n return n.hasNext() ? 1 : r.hasNext() ? -1 : 0;\n }, cc.prototype.hashCode = function () {\n return this.getEnvelopeInternal().hashCode();\n }, cc.prototype.isGeometryCollectionOrDerived = function () {\n return this.getSortIndex() === cc.SORTINDEX_GEOMETRYCOLLECTION || this.getSortIndex() === cc.SORTINDEX_MULTIPOINT || this.getSortIndex() === cc.SORTINDEX_MULTILINESTRING || this.getSortIndex() === cc.SORTINDEX_MULTIPOLYGON;\n }, cc.prototype.interfaces_ = function () {\n return [Eu, xu, Li];\n }, cc.prototype.getClass = function () {\n return cc;\n }, cc.hasNonEmptyElements = function (t) {\n for (var e = 0; e < t.length; e++) if (!t[e].isEmpty()) return !0;\n return !1;\n }, cc.hasNullElements = function (t) {\n for (var e = 0; e < t.length; e++) if (null === t[e]) return !0;\n return !1;\n }, hc.serialVersionUID.get = function () {\n return 0x799ea46522854c00;\n }, hc.SORTINDEX_POINT.get = function () {\n return 0;\n }, hc.SORTINDEX_MULTIPOINT.get = function () {\n return 1;\n }, hc.SORTINDEX_LINESTRING.get = function () {\n return 2;\n }, hc.SORTINDEX_LINEARRING.get = function () {\n return 3;\n }, hc.SORTINDEX_MULTILINESTRING.get = function () {\n return 4;\n }, hc.SORTINDEX_POLYGON.get = function () {\n return 5;\n }, hc.SORTINDEX_MULTIPOLYGON.get = function () {\n return 6;\n }, hc.SORTINDEX_GEOMETRYCOLLECTION.get = function () {\n return 7;\n }, hc.geometryChangedFilter.get = function () {\n return lc;\n }, Object.defineProperties(cc, hc);\n var lc = function () {};\n lc.interfaces_ = function () {\n return [uc];\n }, lc.filter = function (t) {\n t.geometryChangedAction();\n };\n var pc = function () {};\n pc.prototype.filter = function (t) {}, pc.prototype.interfaces_ = function () {\n return [];\n }, pc.prototype.getClass = function () {\n return pc;\n };\n var fc = function () {},\n gc = {\n Mod2BoundaryNodeRule: {\n configurable: !0\n },\n EndPointBoundaryNodeRule: {\n configurable: !0\n },\n MultiValentEndPointBoundaryNodeRule: {\n configurable: !0\n },\n MonoValentEndPointBoundaryNodeRule: {\n configurable: !0\n },\n MOD2_BOUNDARY_RULE: {\n configurable: !0\n },\n ENDPOINT_BOUNDARY_RULE: {\n configurable: !0\n },\n MULTIVALENT_ENDPOINT_BOUNDARY_RULE: {\n configurable: !0\n },\n MONOVALENT_ENDPOINT_BOUNDARY_RULE: {\n configurable: !0\n },\n OGC_SFS_BOUNDARY_RULE: {\n configurable: !0\n }\n };\n fc.prototype.isInBoundary = function (t) {}, fc.prototype.interfaces_ = function () {\n return [];\n }, fc.prototype.getClass = function () {\n return fc;\n }, gc.Mod2BoundaryNodeRule.get = function () {\n return dc;\n }, gc.EndPointBoundaryNodeRule.get = function () {\n return yc;\n }, gc.MultiValentEndPointBoundaryNodeRule.get = function () {\n return _c;\n }, gc.MonoValentEndPointBoundaryNodeRule.get = function () {\n return mc;\n }, gc.MOD2_BOUNDARY_RULE.get = function () {\n return new dc();\n }, gc.ENDPOINT_BOUNDARY_RULE.get = function () {\n return new yc();\n }, gc.MULTIVALENT_ENDPOINT_BOUNDARY_RULE.get = function () {\n return new _c();\n }, gc.MONOVALENT_ENDPOINT_BOUNDARY_RULE.get = function () {\n return new mc();\n }, gc.OGC_SFS_BOUNDARY_RULE.get = function () {\n return fc.MOD2_BOUNDARY_RULE;\n }, Object.defineProperties(fc, gc);\n var dc = function () {};\n dc.prototype.isInBoundary = function (t) {\n return t % 2 == 1;\n }, dc.prototype.interfaces_ = function () {\n return [fc];\n }, dc.prototype.getClass = function () {\n return dc;\n };\n var yc = function () {};\n yc.prototype.isInBoundary = function (t) {\n return t > 0;\n }, yc.prototype.interfaces_ = function () {\n return [fc];\n }, yc.prototype.getClass = function () {\n return yc;\n };\n var _c = function () {};\n _c.prototype.isInBoundary = function (t) {\n return t > 1;\n }, _c.prototype.interfaces_ = function () {\n return [fc];\n }, _c.prototype.getClass = function () {\n return _c;\n };\n var mc = function () {};\n mc.prototype.isInBoundary = function (t) {\n return 1 === t;\n }, mc.prototype.interfaces_ = function () {\n return [fc];\n }, mc.prototype.getClass = function () {\n return mc;\n };\n var vc = function () {};\n vc.prototype.add = function () {}, vc.prototype.addAll = function () {}, vc.prototype.isEmpty = function () {}, vc.prototype.iterator = function () {}, vc.prototype.size = function () {}, vc.prototype.toArray = function () {}, vc.prototype.remove = function () {};\n var xc = function (t) {\n function e(e) {\n t.call(this), this.message = e || \"\";\n }\n t && (e.__proto__ = t), (e.prototype = Object.create(t && t.prototype)).constructor = e;\n var n = {\n name: {\n configurable: !0\n }\n };\n return n.name.get = function () {\n return \"IndexOutOfBoundsException\";\n }, Object.defineProperties(e, n), e;\n }(Error),\n Ec = function () {};\n Ec.prototype.hasNext = function () {}, Ec.prototype.next = function () {}, Ec.prototype.remove = function () {};\n var wc = function (t) {\n function e() {\n t.apply(this, arguments);\n }\n return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.get = function () {}, e.prototype.set = function () {}, e.prototype.isEmpty = function () {}, e;\n }(vc);\n (Pi.prototype = new Error()).name = \"NoSuchElementException\";\n var bc = function (t) {\n function e() {\n t.call(this), this.array_ = [], arguments[0] instanceof vc && this.addAll(arguments[0]);\n }\n return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.ensureCapacity = function () {}, e.prototype.interfaces_ = function () {\n return [t, vc];\n }, e.prototype.add = function (t) {\n return 1 === arguments.length ? this.array_.push(t) : this.array_.splice(arguments[0], arguments[1]), !0;\n }, e.prototype.clear = function () {\n this.array_ = [];\n }, e.prototype.addAll = function (t) {\n for (var e = t.iterator(); e.hasNext();) this.add(e.next());\n return !0;\n }, e.prototype.set = function (t, e) {\n var n = this.array_[t];\n return this.array_[t] = e, n;\n }, e.prototype.iterator = function () {\n return new Ic(this);\n }, e.prototype.get = function (t) {\n if (t < 0 || t >= this.size()) throw new xc();\n return this.array_[t];\n }, e.prototype.isEmpty = function () {\n return 0 === this.array_.length;\n }, e.prototype.size = function () {\n return this.array_.length;\n }, e.prototype.toArray = function () {\n for (var t = [], e = 0, n = this.array_.length; e < n; e++) t.push(this.array_[e]);\n return t;\n }, e.prototype.remove = function (t) {\n for (var e = !1, n = 0, r = this.array_.length; n < r; n++) if (this.array_[n] === t) {\n this.array_.splice(n, 1), e = !0;\n break;\n }\n return e;\n }, e;\n }(wc),\n Ic = function (t) {\n function e(e) {\n t.call(this), this.arrayList_ = e, this.position_ = 0;\n }\n return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.next = function () {\n if (this.position_ === this.arrayList_.size()) throw new Pi();\n return this.arrayList_.get(this.position_++);\n }, e.prototype.hasNext = function () {\n return this.position_ < this.arrayList_.size();\n }, e.prototype.set = function (t) {\n return this.arrayList_.set(this.position_ - 1, t);\n }, e.prototype.remove = function () {\n this.arrayList_.remove(this.arrayList_.get(this.position_));\n }, e;\n }(Ec),\n Nc = function (t) {\n function e() {\n if (t.call(this), 0 === arguments.length) ;else if (1 === arguments.length) {\n var e = arguments[0];\n this.ensureCapacity(e.length), this.add(e, !0);\n } else if (2 === arguments.length) {\n var n = arguments[0],\n r = arguments[1];\n this.ensureCapacity(n.length), this.add(n, r);\n }\n }\n t && (e.__proto__ = t), (e.prototype = Object.create(t && t.prototype)).constructor = e;\n var n = {\n coordArrayType: {\n configurable: !0\n }\n };\n return n.coordArrayType.get = function () {\n return new Array(0).fill(null);\n }, e.prototype.getCoordinate = function (t) {\n return this.get(t);\n }, e.prototype.addAll = function () {\n if (2 === arguments.length) {\n for (var e = arguments[0], n = arguments[1], r = !1, i = e.iterator(); i.hasNext();) this.add(i.next(), n), r = !0;\n return r;\n }\n return t.prototype.addAll.apply(this, arguments);\n }, e.prototype.clone = function () {\n for (var e = t.prototype.clone.call(this), n = 0; n < this.size(); n++) e.add(n, this.get(n).copy());\n return e;\n }, e.prototype.toCoordinateArray = function () {\n return this.toArray(e.coordArrayType);\n }, e.prototype.add = function () {\n if (1 === arguments.length) {\n var e = arguments[0];\n t.prototype.add.call(this, e);\n } else if (2 === arguments.length) {\n if (arguments[0] instanceof Array && \"boolean\" == typeof arguments[1]) {\n var n = arguments[0],\n r = arguments[1];\n return this.add(n, r, !0), !0;\n }\n if (arguments[0] instanceof bu && \"boolean\" == typeof arguments[1]) {\n var i = arguments[0];\n if (!arguments[1] && this.size() >= 1) {\n if (this.get(this.size() - 1).equals2D(i)) return null;\n }\n t.prototype.add.call(this, i);\n } else if (arguments[0] instanceof Object && \"boolean\" == typeof arguments[1]) {\n var o = arguments[0],\n s = arguments[1];\n return this.add(o, s), !0;\n }\n } else if (3 === arguments.length) {\n if (\"boolean\" == typeof arguments[2] && arguments[0] instanceof Array && \"boolean\" == typeof arguments[1]) {\n var a = arguments[0],\n u = arguments[1];\n if (arguments[2]) for (var c = 0; c < a.length; c++) this.add(a[c], u);else for (var h = a.length - 1; h >= 0; h--) this.add(a[h], u);\n return !0;\n }\n if (\"boolean\" == typeof arguments[2] && Number.isInteger(arguments[0]) && arguments[1] instanceof bu) {\n var l = arguments[0],\n p = arguments[1];\n if (!arguments[2]) {\n var f = this.size();\n if (f > 0) {\n if (l > 0) {\n if (this.get(l - 1).equals2D(p)) return null;\n }\n if (l < f) {\n if (this.get(l).equals2D(p)) return null;\n }\n }\n }\n t.prototype.add.call(this, l, p);\n }\n } else if (4 === arguments.length) {\n var g = arguments[0],\n d = arguments[1],\n y = arguments[2],\n _ = arguments[3],\n m = 1;\n y > _ && (m = -1);\n for (var v = y; v !== _; v += m) this.add(g[v], d);\n return !0;\n }\n }, e.prototype.closeRing = function () {\n this.size() > 0 && this.add(new bu(this.get(0)), !1);\n }, e.prototype.interfaces_ = function () {\n return [];\n }, e.prototype.getClass = function () {\n return e;\n }, Object.defineProperties(e, n), e;\n }(bc),\n Cc = function () {},\n Sc = {\n ForwardComparator: {\n configurable: !0\n },\n BidirectionalComparator: {\n configurable: !0\n },\n coordArrayType: {\n configurable: !0\n }\n };\n Sc.ForwardComparator.get = function () {\n return Mc;\n }, Sc.BidirectionalComparator.get = function () {\n return Lc;\n }, Sc.coordArrayType.get = function () {\n return new Array(0).fill(null);\n }, Cc.prototype.interfaces_ = function () {\n return [];\n }, Cc.prototype.getClass = function () {\n return Cc;\n }, Cc.isRing = function (t) {\n return !(t.length < 4) && !!t[0].equals2D(t[t.length - 1]);\n }, Cc.ptNotInList = function (t, e) {\n for (var n = 0; n < t.length; n++) {\n var r = t[n];\n if (Cc.indexOf(r, e) < 0) return r;\n }\n return null;\n }, Cc.scroll = function (t, e) {\n var n = Cc.indexOf(e, t);\n if (n < 0) return null;\n var r = new Array(t.length).fill(null);\n Xu.arraycopy(t, n, r, 0, t.length - n), Xu.arraycopy(t, 0, r, t.length - n, n), Xu.arraycopy(r, 0, t, 0, t.length);\n }, Cc.equals = function () {\n if (2 === arguments.length) {\n var t = arguments[0],\n e = arguments[1];\n if (t === e) return !0;\n if (null === t || null === e) return !1;\n if (t.length !== e.length) return !1;\n for (var n = 0; n < t.length; n++) if (!t[n].equals(e[n])) return !1;\n return !0;\n }\n if (3 === arguments.length) {\n var r = arguments[0],\n i = arguments[1],\n o = arguments[2];\n if (r === i) return !0;\n if (null === r || null === i) return !1;\n if (r.length !== i.length) return !1;\n for (var s = 0; s < r.length; s++) if (0 !== o.compare(r[s], i[s])) return !1;\n return !0;\n }\n }, Cc.intersection = function (t, e) {\n for (var n = new Nc(), r = 0; r < t.length; r++) e.intersects(t[r]) && n.add(t[r], !0);\n return n.toCoordinateArray();\n }, Cc.hasRepeatedPoints = function (t) {\n for (var e = 1; e < t.length; e++) if (t[e - 1].equals(t[e])) return !0;\n return !1;\n }, Cc.removeRepeatedPoints = function (t) {\n if (!Cc.hasRepeatedPoints(t)) return t;\n return new Nc(t, !1).toCoordinateArray();\n }, Cc.reverse = function (t) {\n for (var e = t.length - 1, n = Math.trunc(e / 2), r = 0; r <= n; r++) {\n var i = t[r];\n t[r] = t[e - r], t[e - r] = i;\n }\n }, Cc.removeNull = function (t) {\n for (var e = 0, n = 0; n < t.length; n++) null !== t[n] && e++;\n var r = new Array(e).fill(null);\n if (0 === e) return r;\n for (var i = 0, o = 0; o < t.length; o++) null !== t[o] && (r[i++] = t[o]);\n return r;\n }, Cc.copyDeep = function () {\n if (1 === arguments.length) {\n for (var t = arguments[0], e = new Array(t.length).fill(null), n = 0; n < t.length; n++) e[n] = new bu(t[n]);\n return e;\n }\n if (5 === arguments.length) for (var r = arguments[0], i = arguments[1], o = arguments[2], s = arguments[3], a = arguments[4], u = 0; u < a; u++) o[s + u] = new bu(r[i + u]);\n }, Cc.isEqualReversed = function (t, e) {\n for (var n = 0; n < t.length; n++) {\n var r = t[n],\n i = e[t.length - n - 1];\n if (0 !== r.compareTo(i)) return !1;\n }\n return !0;\n }, Cc.envelope = function (t) {\n for (var e = new Yu(), n = 0; n < t.length; n++) e.expandToInclude(t[n]);\n return e;\n }, Cc.toCoordinateArray = function (t) {\n return t.toArray(Cc.coordArrayType);\n }, Cc.atLeastNCoordinatesOrNothing = function (t, e) {\n return e.length >= t ? e : [];\n }, Cc.indexOf = function (t, e) {\n for (var n = 0; n < e.length; n++) if (t.equals(e[n])) return n;\n return -1;\n }, Cc.increasingDirection = function (t) {\n for (var e = 0; e < Math.trunc(t.length / 2); e++) {\n var n = t.length - 1 - e,\n r = t[e].compareTo(t[n]);\n if (0 !== r) return r;\n }\n return 1;\n }, Cc.compare = function (t, e) {\n for (var n = 0; n < t.length && n < e.length;) {\n var r = t[n].compareTo(e[n]);\n if (0 !== r) return r;\n n++;\n }\n return n < e.length ? -1 : n < t.length ? 1 : 0;\n }, Cc.minCoordinate = function (t) {\n for (var e = null, n = 0; n < t.length; n++) (null === e || e.compareTo(t[n]) > 0) && (e = t[n]);\n return e;\n }, Cc.extract = function (t, e, n) {\n e = Pu.clamp(e, 0, t.length);\n var r = (n = Pu.clamp(n, -1, t.length)) - e + 1;\n n < 0 && (r = 0), e >= t.length && (r = 0), n < e && (r = 0);\n var i = new Array(r).fill(null);\n if (0 === r) return i;\n for (var o = 0, s = e; s <= n; s++) i[o++] = t[s];\n return i;\n }, Object.defineProperties(Cc, Sc);\n var Mc = function () {};\n Mc.prototype.compare = function (t, e) {\n return Cc.compare(t, e);\n }, Mc.prototype.interfaces_ = function () {\n return [wu];\n }, Mc.prototype.getClass = function () {\n return Mc;\n };\n var Lc = function () {};\n Lc.prototype.compare = function (t, e) {\n var n = t,\n r = e;\n if (n.length < r.length) return -1;\n if (n.length > r.length) return 1;\n if (0 === n.length) return 0;\n var i = Cc.compare(n, r);\n return Cc.isEqualReversed(n, r) ? 0 : i;\n }, Lc.prototype.OLDcompare = function (t, e) {\n var n = t,\n r = e;\n if (n.length < r.length) return -1;\n if (n.length > r.length) return 1;\n if (0 === n.length) return 0;\n for (var i = Cc.increasingDirection(n), o = Cc.increasingDirection(r), s = i > 0 ? 0 : n.length - 1, a = o > 0 ? 0 : n.length - 1, u = 0; u < n.length; u++) {\n var c = n[s].compareTo(r[a]);\n if (0 !== c) return c;\n s += i, a += o;\n }\n return 0;\n }, Lc.prototype.interfaces_ = function () {\n return [wu];\n }, Lc.prototype.getClass = function () {\n return Lc;\n };\n var Pc = function () {};\n Pc.prototype.get = function () {}, Pc.prototype.put = function () {}, Pc.prototype.size = function () {}, Pc.prototype.values = function () {}, Pc.prototype.entrySet = function () {};\n var Oc = function (t) {\n function e() {\n t.apply(this, arguments);\n }\n return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e;\n }(Pc);\n (Oi.prototype = new Error()).name = \"OperationNotSupported\", (Ri.prototype = new vc()).contains = function () {};\n var Rc = function (t) {\n function e() {\n t.call(this), this.array_ = [], arguments[0] instanceof vc && this.addAll(arguments[0]);\n }\n return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.contains = function (t) {\n for (var e = 0, n = this.array_.length; e < n; e++) {\n if (this.array_[e] === t) return !0;\n }\n return !1;\n }, e.prototype.add = function (t) {\n return !this.contains(t) && (this.array_.push(t), !0);\n }, e.prototype.addAll = function (t) {\n for (var e = t.iterator(); e.hasNext();) this.add(e.next());\n return !0;\n }, e.prototype.remove = function (t) {\n throw new Error();\n }, e.prototype.size = function () {\n return this.array_.length;\n }, e.prototype.isEmpty = function () {\n return 0 === this.array_.length;\n }, e.prototype.toArray = function () {\n for (var t = [], e = 0, n = this.array_.length; e < n; e++) t.push(this.array_[e]);\n return t;\n }, e.prototype.iterator = function () {\n return new Tc(this);\n }, e;\n }(Ri),\n Tc = function (t) {\n function e(e) {\n t.call(this), this.hashSet_ = e, this.position_ = 0;\n }\n return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.next = function () {\n if (this.position_ === this.hashSet_.size()) throw new Pi();\n return this.hashSet_.array_[this.position_++];\n }, e.prototype.hasNext = function () {\n return this.position_ < this.hashSet_.size();\n }, e.prototype.remove = function () {\n throw new Oi();\n }, e;\n }(Ec),\n Ac = 0;\n (Gi.prototype = new Oc()).get = function (t) {\n for (var e = this.root_; null !== e;) {\n var n = t.compareTo(e.key);\n if (n < 0) e = e.left;else {\n if (!(n > 0)) return e.value;\n e = e.right;\n }\n }\n return null;\n }, Gi.prototype.put = function (t, e) {\n if (null === this.root_) return this.root_ = {\n key: t,\n value: e,\n left: null,\n right: null,\n parent: null,\n color: Ac,\n getValue: function () {\n return this.value;\n },\n getKey: function () {\n return this.key;\n }\n }, this.size_ = 1, null;\n var n,\n r,\n i = this.root_;\n do {\n if (n = i, (r = t.compareTo(i.key)) < 0) i = i.left;else {\n if (!(r > 0)) {\n var o = i.value;\n return i.value = e, o;\n }\n i = i.right;\n }\n } while (null !== i);\n var s = {\n key: t,\n left: null,\n right: null,\n value: e,\n parent: n,\n color: Ac,\n getValue: function () {\n return this.value;\n },\n getKey: function () {\n return this.key;\n }\n };\n return r < 0 ? n.left = s : n.right = s, this.fixAfterInsertion(s), this.size_++, null;\n }, Gi.prototype.fixAfterInsertion = function (t) {\n for (t.color = 1; null != t && t !== this.root_ && 1 === t.parent.color;) if (Ai(t) === Fi(Ai(Ai(t)))) {\n var e = qi(Ai(Ai(t)));\n 1 === Ti(e) ? (Di(Ai(t), Ac), Di(e, Ac), Di(Ai(Ai(t)), 1), t = Ai(Ai(t))) : (t === qi(Ai(t)) && (t = Ai(t), this.rotateLeft(t)), Di(Ai(t), Ac), Di(Ai(Ai(t)), 1), this.rotateRight(Ai(Ai(t))));\n } else {\n var n = Fi(Ai(Ai(t)));\n 1 === Ti(n) ? (Di(Ai(t), Ac), Di(n, Ac), Di(Ai(Ai(t)), 1), t = Ai(Ai(t))) : (t === Fi(Ai(t)) && (t = Ai(t), this.rotateRight(t)), Di(Ai(t), Ac), Di(Ai(Ai(t)), 1), this.rotateLeft(Ai(Ai(t))));\n }\n this.root_.color = Ac;\n }, Gi.prototype.values = function () {\n var t = new bc(),\n e = this.getFirstEntry();\n if (null !== e) for (t.add(e.value); null !== (e = Gi.successor(e));) t.add(e.value);\n return t;\n }, Gi.prototype.entrySet = function () {\n var t = new Rc(),\n e = this.getFirstEntry();\n if (null !== e) for (t.add(e); null !== (e = Gi.successor(e));) t.add(e);\n return t;\n }, Gi.prototype.rotateLeft = function (t) {\n if (null != t) {\n var e = t.right;\n t.right = e.left, null != e.left && (e.left.parent = t), e.parent = t.parent, null === t.parent ? this.root_ = e : t.parent.left === t ? t.parent.left = e : t.parent.right = e, e.left = t, t.parent = e;\n }\n }, Gi.prototype.rotateRight = function (t) {\n if (null != t) {\n var e = t.left;\n t.left = e.right, null != e.right && (e.right.parent = t), e.parent = t.parent, null === t.parent ? this.root_ = e : t.parent.right === t ? t.parent.right = e : t.parent.left = e, e.right = t, t.parent = e;\n }\n }, Gi.prototype.getFirstEntry = function () {\n var t = this.root_;\n if (null != t) for (; null != t.left;) t = t.left;\n return t;\n }, Gi.successor = function (t) {\n if (null === t) return null;\n if (null !== t.right) {\n for (var e = t.right; null !== e.left;) e = e.left;\n return e;\n }\n for (var n = t.parent, r = t; null !== n && r === n.right;) r = n, n = n.parent;\n return n;\n }, Gi.prototype.size = function () {\n return this.size_;\n };\n var Dc = function () {};\n Dc.prototype.interfaces_ = function () {\n return [];\n }, Dc.prototype.getClass = function () {\n return Dc;\n }, Bi.prototype = new Ri(), (ki.prototype = new Bi()).contains = function (t) {\n for (var e = 0, n = this.array_.length; e < n; e++) {\n if (0 === this.array_[e].compareTo(t)) return !0;\n }\n return !1;\n }, ki.prototype.add = function (t) {\n if (this.contains(t)) return !1;\n for (var e = 0, n = this.array_.length; e < n; e++) {\n if (1 === this.array_[e].compareTo(t)) return this.array_.splice(e, 0, t), !0;\n }\n return this.array_.push(t), !0;\n }, ki.prototype.addAll = function (t) {\n for (var e = t.iterator(); e.hasNext();) this.add(e.next());\n return !0;\n }, ki.prototype.remove = function (t) {\n throw new Oi();\n }, ki.prototype.size = function () {\n return this.array_.length;\n }, ki.prototype.isEmpty = function () {\n return 0 === this.array_.length;\n }, ki.prototype.toArray = function () {\n for (var t = [], e = 0, n = this.array_.length; e < n; e++) t.push(this.array_[e]);\n return t;\n }, ki.prototype.iterator = function () {\n return new Fc(this);\n };\n var Fc = function (t) {\n this.treeSet_ = t, this.position_ = 0;\n };\n Fc.prototype.next = function () {\n if (this.position_ === this.treeSet_.size()) throw new Pi();\n return this.treeSet_.array_[this.position_++];\n }, Fc.prototype.hasNext = function () {\n return this.position_ < this.treeSet_.size();\n }, Fc.prototype.remove = function () {\n throw new Oi();\n };\n var qc = function () {};\n qc.sort = function () {\n var t,\n e,\n n,\n r,\n i = arguments[0];\n if (1 === arguments.length) r = function (t, e) {\n return t.compareTo(e);\n }, i.sort(r);else if (2 === arguments.length) n = arguments[1], r = function (t, e) {\n return n.compare(t, e);\n }, i.sort(r);else if (3 === arguments.length) {\n (e = i.slice(arguments[1], arguments[2])).sort();\n var o = i.slice(0, arguments[1]).concat(e, i.slice(arguments[2], i.length));\n for (i.splice(0, i.length), t = 0; t < o.length; t++) i.push(o[t]);\n } else if (4 === arguments.length) for (e = i.slice(arguments[1], arguments[2]), n = arguments[3], r = function (t, e) {\n return n.compare(t, e);\n }, e.sort(r), o = i.slice(0, arguments[1]).concat(e, i.slice(arguments[2], i.length)), i.splice(0, i.length), t = 0; t < o.length; t++) i.push(o[t]);\n }, qc.asList = function (t) {\n for (var e = new bc(), n = 0, r = t.length; n < r; n++) e.add(t[n]);\n return e;\n };\n var Gc = function () {},\n Bc = {\n P: {\n configurable: !0\n },\n L: {\n configurable: !0\n },\n A: {\n configurable: !0\n },\n FALSE: {\n configurable: !0\n },\n TRUE: {\n configurable: !0\n },\n DONTCARE: {\n configurable: !0\n },\n SYM_FALSE: {\n configurable: !0\n },\n SYM_TRUE: {\n configurable: !0\n },\n SYM_DONTCARE: {\n configurable: !0\n },\n SYM_P: {\n configurable: !0\n },\n SYM_L: {\n configurable: !0\n },\n SYM_A: {\n configurable: !0\n }\n };\n Bc.P.get = function () {\n return 0;\n }, Bc.L.get = function () {\n return 1;\n }, Bc.A.get = function () {\n return 2;\n }, Bc.FALSE.get = function () {\n return -1;\n }, Bc.TRUE.get = function () {\n return -2;\n }, Bc.DONTCARE.get = function () {\n return -3;\n }, Bc.SYM_FALSE.get = function () {\n return \"F\";\n }, Bc.SYM_TRUE.get = function () {\n return \"T\";\n }, Bc.SYM_DONTCARE.get = function () {\n return \"*\";\n }, Bc.SYM_P.get = function () {\n return \"0\";\n }, Bc.SYM_L.get = function () {\n return \"1\";\n }, Bc.SYM_A.get = function () {\n return \"2\";\n }, Gc.prototype.interfaces_ = function () {\n return [];\n }, Gc.prototype.getClass = function () {\n return Gc;\n }, Gc.toDimensionSymbol = function (t) {\n switch (t) {\n case Gc.FALSE:\n return Gc.SYM_FALSE;\n case Gc.TRUE:\n return Gc.SYM_TRUE;\n case Gc.DONTCARE:\n return Gc.SYM_DONTCARE;\n case Gc.P:\n return Gc.SYM_P;\n case Gc.L:\n return Gc.SYM_L;\n case Gc.A:\n return Gc.SYM_A;\n }\n throw new _u(\"Unknown dimension value: \" + t);\n }, Gc.toDimensionValue = function (t) {\n switch (Au.toUpperCase(t)) {\n case Gc.SYM_FALSE:\n return Gc.FALSE;\n case Gc.SYM_TRUE:\n return Gc.TRUE;\n case Gc.SYM_DONTCARE:\n return Gc.DONTCARE;\n case Gc.SYM_P:\n return Gc.P;\n case Gc.SYM_L:\n return Gc.L;\n case Gc.SYM_A:\n return Gc.A;\n }\n throw new _u(\"Unknown dimension symbol: \" + t);\n }, Object.defineProperties(Gc, Bc);\n var kc = function () {};\n kc.prototype.filter = function (t) {}, kc.prototype.interfaces_ = function () {\n return [];\n }, kc.prototype.getClass = function () {\n return kc;\n };\n var zc = function () {};\n zc.prototype.filter = function (t, e) {}, zc.prototype.isDone = function () {}, zc.prototype.isGeometryChanged = function () {}, zc.prototype.interfaces_ = function () {\n return [];\n }, zc.prototype.getClass = function () {\n return zc;\n };\n var jc = function (t) {\n function e(e, n) {\n if (t.call(this, n), this._geometries = e || [], t.hasNullElements(this._geometries)) throw new _u(\"geometries must not contain null elements\");\n }\n t && (e.__proto__ = t), (e.prototype = Object.create(t && t.prototype)).constructor = e;\n var n = {\n serialVersionUID: {\n configurable: !0\n }\n };\n return e.prototype.computeEnvelopeInternal = function () {\n for (var t = new Yu(), e = 0; e < this._geometries.length; e++) t.expandToInclude(this._geometries[e].getEnvelopeInternal());\n return t;\n }, e.prototype.getGeometryN = function (t) {\n return this._geometries[t];\n }, e.prototype.getSortIndex = function () {\n return t.SORTINDEX_GEOMETRYCOLLECTION;\n }, e.prototype.getCoordinates = function () {\n for (var t = new Array(this.getNumPoints()).fill(null), e = -1, n = 0; n < this._geometries.length; n++) for (var r = this._geometries[n].getCoordinates(), i = 0; i < r.length; i++) t[++e] = r[i];\n return t;\n }, e.prototype.getArea = function () {\n for (var t = 0, e = 0; e < this._geometries.length; e++) t += this._geometries[e].getArea();\n return t;\n }, e.prototype.equalsExact = function () {\n if (2 === arguments.length) {\n var e = arguments[0],\n n = arguments[1];\n if (!this.isEquivalentClass(e)) return !1;\n var r = e;\n if (this._geometries.length !== r._geometries.length) return !1;\n for (var i = 0; i < this._geometries.length; i++) if (!this._geometries[i].equalsExact(r._geometries[i], n)) return !1;\n return !0;\n }\n return t.prototype.equalsExact.apply(this, arguments);\n }, e.prototype.normalize = function () {\n for (var t = 0; t < this._geometries.length; t++) this._geometries[t].normalize();\n qc.sort(this._geometries);\n }, e.prototype.getCoordinate = function () {\n return this.isEmpty() ? null : this._geometries[0].getCoordinate();\n }, e.prototype.getBoundaryDimension = function () {\n for (var t = Gc.FALSE, e = 0; e < this._geometries.length; e++) t = Math.max(t, this._geometries[e].getBoundaryDimension());\n return t;\n }, e.prototype.getDimension = function () {\n for (var t = Gc.FALSE, e = 0; e < this._geometries.length; e++) t = Math.max(t, this._geometries[e].getDimension());\n return t;\n }, e.prototype.getLength = function () {\n for (var t = 0, e = 0; e < this._geometries.length; e++) t += this._geometries[e].getLength();\n return t;\n }, e.prototype.getNumPoints = function () {\n for (var t = 0, e = 0; e < this._geometries.length; e++) t += this._geometries[e].getNumPoints();\n return t;\n }, e.prototype.getNumGeometries = function () {\n return this._geometries.length;\n }, e.prototype.reverse = function () {\n for (var t = this._geometries.length, e = new Array(t).fill(null), n = 0; n < this._geometries.length; n++) e[n] = this._geometries[n].reverse();\n return this.getFactory().createGeometryCollection(e);\n }, e.prototype.compareToSameClass = function () {\n if (1 === arguments.length) {\n var t = arguments[0],\n e = new ki(qc.asList(this._geometries)),\n n = new ki(qc.asList(t._geometries));\n return this.compare(e, n);\n }\n if (2 === arguments.length) {\n for (var r = arguments[0], i = arguments[1], o = r, s = this.getNumGeometries(), a = o.getNumGeometries(), u = 0; u < s && u < a;) {\n var c = this.getGeometryN(u),\n h = o.getGeometryN(u),\n l = c.compareToSameClass(h, i);\n if (0 !== l) return l;\n u++;\n }\n return u < s ? 1 : u < a ? -1 : 0;\n }\n }, e.prototype.apply = function () {\n if (Lu(arguments[0], pc)) for (var t = arguments[0], e = 0; e < this._geometries.length; e++) this._geometries[e].apply(t);else if (Lu(arguments[0], zc)) {\n var n = arguments[0];\n if (0 === this._geometries.length) return null;\n for (var r = 0; r < this._geometries.length && (this._geometries[r].apply(n), !n.isDone()); r++);\n n.isGeometryChanged() && this.geometryChanged();\n } else if (Lu(arguments[0], kc)) {\n var i = arguments[0];\n i.filter(this);\n for (var o = 0; o < this._geometries.length; o++) this._geometries[o].apply(i);\n } else if (Lu(arguments[0], uc)) {\n var s = arguments[0];\n s.filter(this);\n for (var a = 0; a < this._geometries.length; a++) this._geometries[a].apply(s);\n }\n }, e.prototype.getBoundary = function () {\n return this.checkNotGeometryCollection(this), tc.shouldNeverReachHere(), null;\n }, e.prototype.clone = function () {\n var e = t.prototype.clone.call(this);\n e._geometries = new Array(this._geometries.length).fill(null);\n for (var n = 0; n < this._geometries.length; n++) e._geometries[n] = this._geometries[n].clone();\n return e;\n }, e.prototype.getGeometryType = function () {\n return \"GeometryCollection\";\n }, e.prototype.copy = function () {\n for (var t = new Array(this._geometries.length).fill(null), n = 0; n < t.length; n++) t[n] = this._geometries[n].copy();\n return new e(t, this._factory);\n }, e.prototype.isEmpty = function () {\n for (var t = 0; t < this._geometries.length; t++) if (!this._geometries[t].isEmpty()) return !1;\n return !0;\n }, e.prototype.interfaces_ = function () {\n return [];\n }, e.prototype.getClass = function () {\n return e;\n }, n.serialVersionUID.get = function () {\n return -0x4f07bcb1f857d800;\n }, Object.defineProperties(e, n), e;\n }(cc),\n Xc = function (t) {\n function e() {\n t.apply(this, arguments);\n }\n t && (e.__proto__ = t), (e.prototype = Object.create(t && t.prototype)).constructor = e;\n var n = {\n serialVersionUID: {\n configurable: !0\n }\n };\n return e.prototype.getSortIndex = function () {\n return cc.SORTINDEX_MULTILINESTRING;\n }, e.prototype.equalsExact = function () {\n if (2 === arguments.length) {\n var e = arguments[0],\n n = arguments[1];\n return !!this.isEquivalentClass(e) && t.prototype.equalsExact.call(this, e, n);\n }\n return t.prototype.equalsExact.apply(this, arguments);\n }, e.prototype.getBoundaryDimension = function () {\n return this.isClosed() ? Gc.FALSE : 0;\n }, e.prototype.isClosed = function () {\n if (this.isEmpty()) return !1;\n for (var t = 0; t < this._geometries.length; t++) if (!this._geometries[t].isClosed()) return !1;\n return !0;\n }, e.prototype.getDimension = function () {\n return 1;\n }, e.prototype.reverse = function () {\n for (var t = this._geometries.length, e = new Array(t).fill(null), n = 0; n < this._geometries.length; n++) e[t - 1 - n] = this._geometries[n].reverse();\n return this.getFactory().createMultiLineString(e);\n }, e.prototype.getBoundary = function () {\n return new Uc(this).getBoundary();\n }, e.prototype.getGeometryType = function () {\n return \"MultiLineString\";\n }, e.prototype.copy = function () {\n for (var t = new Array(this._geometries.length).fill(null), n = 0; n < t.length; n++) t[n] = this._geometries[n].copy();\n return new e(t, this._factory);\n }, e.prototype.interfaces_ = function () {\n return [Dc];\n }, e.prototype.getClass = function () {\n return e;\n }, n.serialVersionUID.get = function () {\n return 0x7155d2ab4afa8000;\n }, Object.defineProperties(e, n), e;\n }(jc),\n Uc = function () {\n if (this._geom = null, this._geomFact = null, this._bnRule = null, this._endpointMap = null, 1 === arguments.length) {\n var t = arguments[0],\n e = fc.MOD2_BOUNDARY_RULE;\n this._geom = t, this._geomFact = t.getFactory(), this._bnRule = e;\n } else if (2 === arguments.length) {\n var n = arguments[0],\n r = arguments[1];\n this._geom = n, this._geomFact = n.getFactory(), this._bnRule = r;\n }\n };\n Uc.prototype.boundaryMultiLineString = function (t) {\n if (this._geom.isEmpty()) return this.getEmptyMultiPoint();\n var e = this.computeBoundaryCoordinates(t);\n return 1 === e.length ? this._geomFact.createPoint(e[0]) : this._geomFact.createMultiPointFromCoords(e);\n }, Uc.prototype.getBoundary = function () {\n return this._geom instanceof Jc ? this.boundaryLineString(this._geom) : this._geom instanceof Xc ? this.boundaryMultiLineString(this._geom) : this._geom.getBoundary();\n }, Uc.prototype.boundaryLineString = function (t) {\n if (this._geom.isEmpty()) return this.getEmptyMultiPoint();\n if (t.isClosed()) {\n return this._bnRule.isInBoundary(2) ? t.getStartPoint() : this._geomFact.createMultiPoint();\n }\n return this._geomFact.createMultiPoint([t.getStartPoint(), t.getEndPoint()]);\n }, Uc.prototype.getEmptyMultiPoint = function () {\n return this._geomFact.createMultiPoint();\n }, Uc.prototype.computeBoundaryCoordinates = function (t) {\n var e = new bc();\n this._endpointMap = new Gi();\n for (var n = 0; n < t.getNumGeometries(); n++) {\n var r = t.getGeometryN(n);\n 0 !== r.getNumPoints() && (this.addEndpoint(r.getCoordinateN(0)), this.addEndpoint(r.getCoordinateN(r.getNumPoints() - 1)));\n }\n for (var i = this._endpointMap.entrySet().iterator(); i.hasNext();) {\n var o = i.next(),\n s = o.getValue().count;\n this._bnRule.isInBoundary(s) && e.add(o.getKey());\n }\n return Cc.toCoordinateArray(e);\n }, Uc.prototype.addEndpoint = function (t) {\n var e = this._endpointMap.get(t);\n null === e && (e = new Yc(), this._endpointMap.put(t, e)), e.count++;\n }, Uc.prototype.interfaces_ = function () {\n return [];\n }, Uc.prototype.getClass = function () {\n return Uc;\n }, Uc.getBoundary = function () {\n if (1 === arguments.length) {\n var t = arguments[0];\n return new Uc(t).getBoundary();\n }\n if (2 === arguments.length) {\n var e = arguments[0],\n n = arguments[1];\n return new Uc(e, n).getBoundary();\n }\n };\n var Yc = function () {\n this.count = null;\n };\n Yc.prototype.interfaces_ = function () {\n return [];\n }, Yc.prototype.getClass = function () {\n return Yc;\n };\n var Vc = function () {},\n Hc = {\n NEWLINE: {\n configurable: !0\n },\n SIMPLE_ORDINATE_FORMAT: {\n configurable: !0\n }\n };\n Vc.prototype.interfaces_ = function () {\n return [];\n }, Vc.prototype.getClass = function () {\n return Vc;\n }, Vc.chars = function (t, e) {\n for (var n = new Array(e).fill(null), r = 0; r < e; r++) n[r] = t;\n return String(n);\n }, Vc.getStackTrace = function () {\n if (1 === arguments.length) {\n var t = arguments[0],\n e = new function () {}(),\n n = new function () {}(e);\n return t.printStackTrace(n), e.toString();\n }\n if (2 === arguments.length) {\n for (var r = arguments[0], i = arguments[1], o = \"\", s = new function () {}(new function () {}(Vc.getStackTrace(r))), a = 0; a < i; a++) try {\n o += s.readLine() + Vc.NEWLINE;\n } catch (t) {\n if (!(t instanceof zi)) throw t;\n tc.shouldNeverReachHere();\n }\n return o;\n }\n }, Vc.split = function (t, e) {\n for (var n = e.length, r = new bc(), i = \"\" + t, o = i.indexOf(e); o >= 0;) {\n var s = i.substring(0, o);\n r.add(s), o = (i = i.substring(o + n)).indexOf(e);\n }\n i.length > 0 && r.add(i);\n for (var a = new Array(r.size()).fill(null), u = 0; u < a.length; u++) a[u] = r.get(u);\n return a;\n }, Vc.toString = function () {\n if (1 === arguments.length) {\n var t = arguments[0];\n return Vc.SIMPLE_ORDINATE_FORMAT.format(t);\n }\n }, Vc.spaces = function (t) {\n return Vc.chars(\" \", t);\n }, Hc.NEWLINE.get = function () {\n return Xu.getProperty(\"line.separator\");\n }, Hc.SIMPLE_ORDINATE_FORMAT.get = function () {\n return new function () {}(\"0.#\");\n }, Object.defineProperties(Vc, Hc);\n var Wc = function () {};\n Wc.prototype.interfaces_ = function () {\n return [];\n }, Wc.prototype.getClass = function () {\n return Wc;\n }, Wc.copyCoord = function (t, e, n, r) {\n for (var i = Math.min(t.getDimension(), n.getDimension()), o = 0; o < i; o++) n.setOrdinate(r, o, t.getOrdinate(e, o));\n }, Wc.isRing = function (t) {\n var e = t.size();\n return 0 === e || !(e <= 3) && t.getOrdinate(0, Bu.X) === t.getOrdinate(e - 1, Bu.X) && t.getOrdinate(0, Bu.Y) === t.getOrdinate(e - 1, Bu.Y);\n }, Wc.isEqual = function (t, e) {\n var n = t.size();\n if (n !== e.size()) return !1;\n for (var r = Math.min(t.getDimension(), e.getDimension()), i = 0; i < n; i++) for (var o = 0; o < r; o++) {\n var s = t.getOrdinate(i, o),\n a = e.getOrdinate(i, o);\n if (t.getOrdinate(i, o) !== e.getOrdinate(i, o) && (!mu.isNaN(s) || !mu.isNaN(a))) return !1;\n }\n return !0;\n }, Wc.extend = function (t, e, n) {\n var r = t.create(n, e.getDimension()),\n i = e.size();\n if (Wc.copy(e, 0, r, 0, i), i > 0) for (var o = i; o < n; o++) Wc.copy(e, i - 1, r, o, 1);\n return r;\n }, Wc.reverse = function (t) {\n for (var e = t.size() - 1, n = Math.trunc(e / 2), r = 0; r <= n; r++) Wc.swap(t, r, e - r);\n }, Wc.swap = function (t, e, n) {\n if (e === n) return null;\n for (var r = 0; r < t.getDimension(); r++) {\n var i = t.getOrdinate(e, r);\n t.setOrdinate(e, r, t.getOrdinate(n, r)), t.setOrdinate(n, r, i);\n }\n }, Wc.copy = function (t, e, n, r, i) {\n for (var o = 0; o < i; o++) Wc.copyCoord(t, e + o, n, r + o);\n }, Wc.toString = function () {\n if (1 === arguments.length) {\n var t = arguments[0],\n e = t.size();\n if (0 === e) return \"()\";\n var n = t.getDimension(),\n r = new Ru();\n r.append(\"(\");\n for (var i = 0; i < e; i++) {\n i > 0 && r.append(\" \");\n for (var o = 0; o < n; o++) o > 0 && r.append(\",\"), r.append(Vc.toString(t.getOrdinate(i, o)));\n }\n return r.append(\")\"), r.toString();\n }\n }, Wc.ensureValidRing = function (t, e) {\n var n = e.size();\n if (0 === n) return e;\n if (n <= 3) return Wc.createClosedRing(t, e, 4);\n return e.getOrdinate(0, Bu.X) === e.getOrdinate(n - 1, Bu.X) && e.getOrdinate(0, Bu.Y) === e.getOrdinate(n - 1, Bu.Y) ? e : Wc.createClosedRing(t, e, n + 1);\n }, Wc.createClosedRing = function (t, e, n) {\n var r = t.create(n, e.getDimension()),\n i = e.size();\n Wc.copy(e, 0, r, 0, i);\n for (var o = i; o < n; o++) Wc.copy(e, 0, r, o, 1);\n return r;\n };\n var Jc = function (t) {\n function e(e, n) {\n t.call(this, n), this._points = null, this.init(e);\n }\n t && (e.__proto__ = t), (e.prototype = Object.create(t && t.prototype)).constructor = e;\n var n = {\n serialVersionUID: {\n configurable: !0\n }\n };\n return e.prototype.computeEnvelopeInternal = function () {\n return this.isEmpty() ? new Yu() : this._points.expandEnvelope(new Yu());\n }, e.prototype.isRing = function () {\n return this.isClosed() && this.isSimple();\n }, e.prototype.getSortIndex = function () {\n return t.SORTINDEX_LINESTRING;\n }, e.prototype.getCoordinates = function () {\n return this._points.toCoordinateArray();\n }, e.prototype.equalsExact = function () {\n if (2 === arguments.length) {\n var e = arguments[0],\n n = arguments[1];\n if (!this.isEquivalentClass(e)) return !1;\n var r = e;\n if (this._points.size() !== r._points.size()) return !1;\n for (var i = 0; i < this._points.size(); i++) if (!this.equal(this._points.getCoordinate(i), r._points.getCoordinate(i), n)) return !1;\n return !0;\n }\n return t.prototype.equalsExact.apply(this, arguments);\n }, e.prototype.normalize = function () {\n for (var t = 0; t < Math.trunc(this._points.size() / 2); t++) {\n var e = this._points.size() - 1 - t;\n if (!this._points.getCoordinate(t).equals(this._points.getCoordinate(e))) return this._points.getCoordinate(t).compareTo(this._points.getCoordinate(e)) > 0 && Wc.reverse(this._points), null;\n }\n }, e.prototype.getCoordinate = function () {\n return this.isEmpty() ? null : this._points.getCoordinate(0);\n }, e.prototype.getBoundaryDimension = function () {\n return this.isClosed() ? Gc.FALSE : 0;\n }, e.prototype.isClosed = function () {\n return !this.isEmpty() && this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints() - 1));\n }, e.prototype.getEndPoint = function () {\n return this.isEmpty() ? null : this.getPointN(this.getNumPoints() - 1);\n }, e.prototype.getDimension = function () {\n return 1;\n }, e.prototype.getLength = function () {\n return sc.computeLength(this._points);\n }, e.prototype.getNumPoints = function () {\n return this._points.size();\n }, e.prototype.reverse = function () {\n var t = this._points.copy();\n Wc.reverse(t);\n return this.getFactory().createLineString(t);\n }, e.prototype.compareToSameClass = function () {\n if (1 === arguments.length) {\n for (var t = arguments[0], e = 0, n = 0; e < this._points.size() && n < t._points.size();) {\n var r = this._points.getCoordinate(e).compareTo(t._points.getCoordinate(n));\n if (0 !== r) return r;\n e++, n++;\n }\n return e < this._points.size() ? 1 : n < t._points.size() ? -1 : 0;\n }\n if (2 === arguments.length) {\n var i = arguments[0];\n return arguments[1].compare(this._points, i._points);\n }\n }, e.prototype.apply = function () {\n if (Lu(arguments[0], pc)) for (var t = arguments[0], e = 0; e < this._points.size(); e++) t.filter(this._points.getCoordinate(e));else if (Lu(arguments[0], zc)) {\n var n = arguments[0];\n if (0 === this._points.size()) return null;\n for (var r = 0; r < this._points.size() && (n.filter(this._points, r), !n.isDone()); r++);\n n.isGeometryChanged() && this.geometryChanged();\n } else if (Lu(arguments[0], kc)) {\n arguments[0].filter(this);\n } else if (Lu(arguments[0], uc)) {\n arguments[0].filter(this);\n }\n }, e.prototype.getBoundary = function () {\n return new Uc(this).getBoundary();\n }, e.prototype.isEquivalentClass = function (t) {\n return t instanceof e;\n }, e.prototype.clone = function () {\n var e = t.prototype.clone.call(this);\n return e._points = this._points.clone(), e;\n }, e.prototype.getCoordinateN = function (t) {\n return this._points.getCoordinate(t);\n }, e.prototype.getGeometryType = function () {\n return \"LineString\";\n }, e.prototype.copy = function () {\n return new e(this._points.copy(), this._factory);\n }, e.prototype.getCoordinateSequence = function () {\n return this._points;\n }, e.prototype.isEmpty = function () {\n return 0 === this._points.size();\n }, e.prototype.init = function (t) {\n if (null === t && (t = this.getFactory().getCoordinateSequenceFactory().create([])), 1 === t.size()) throw new _u(\"Invalid number of points in LineString (found \" + t.size() + \" - must be 0 or >= 2)\");\n this._points = t;\n }, e.prototype.isCoordinate = function (t) {\n for (var e = 0; e < this._points.size(); e++) if (this._points.getCoordinate(e).equals(t)) return !0;\n return !1;\n }, e.prototype.getStartPoint = function () {\n return this.isEmpty() ? null : this.getPointN(0);\n }, e.prototype.getPointN = function (t) {\n return this.getFactory().createPoint(this._points.getCoordinate(t));\n }, e.prototype.interfaces_ = function () {\n return [Dc];\n }, e.prototype.getClass = function () {\n return e;\n }, n.serialVersionUID.get = function () {\n return 0x2b2b51ba435c8e00;\n }, Object.defineProperties(e, n), e;\n }(cc),\n Zc = function () {};\n Zc.prototype.interfaces_ = function () {\n return [];\n }, Zc.prototype.getClass = function () {\n return Zc;\n };\n var Kc = function (t) {\n function e(e, n) {\n t.call(this, n), this._coordinates = e || null, this.init(this._coordinates);\n }\n t && (e.__proto__ = t), (e.prototype = Object.create(t && t.prototype)).constructor = e;\n var n = {\n serialVersionUID: {\n configurable: !0\n }\n };\n return e.prototype.computeEnvelopeInternal = function () {\n if (this.isEmpty()) return new Yu();\n var t = new Yu();\n return t.expandToInclude(this._coordinates.getX(0), this._coordinates.getY(0)), t;\n }, e.prototype.getSortIndex = function () {\n return t.SORTINDEX_POINT;\n }, e.prototype.getCoordinates = function () {\n return this.isEmpty() ? [] : [this.getCoordinate()];\n }, e.prototype.equalsExact = function () {\n if (2 === arguments.length) {\n var e = arguments[0],\n n = arguments[1];\n return !!this.isEquivalentClass(e) && (!(!this.isEmpty() || !e.isEmpty()) || this.isEmpty() === e.isEmpty() && this.equal(e.getCoordinate(), this.getCoordinate(), n));\n }\n return t.prototype.equalsExact.apply(this, arguments);\n }, e.prototype.normalize = function () {}, e.prototype.getCoordinate = function () {\n return 0 !== this._coordinates.size() ? this._coordinates.getCoordinate(0) : null;\n }, e.prototype.getBoundaryDimension = function () {\n return Gc.FALSE;\n }, e.prototype.getDimension = function () {\n return 0;\n }, e.prototype.getNumPoints = function () {\n return this.isEmpty() ? 0 : 1;\n }, e.prototype.reverse = function () {\n return this.copy();\n }, e.prototype.getX = function () {\n if (null === this.getCoordinate()) throw new Error(\"getX called on empty Point\");\n return this.getCoordinate().x;\n }, e.prototype.compareToSameClass = function () {\n if (1 === arguments.length) {\n var t = arguments[0];\n return this.getCoordinate().compareTo(t.getCoordinate());\n }\n if (2 === arguments.length) {\n var e = arguments[0];\n return arguments[1].compare(this._coordinates, e._coordinates);\n }\n }, e.prototype.apply = function () {\n if (Lu(arguments[0], pc)) {\n var t = arguments[0];\n if (this.isEmpty()) return null;\n t.filter(this.getCoordinate());\n } else if (Lu(arguments[0], zc)) {\n var e = arguments[0];\n if (this.isEmpty()) return null;\n e.filter(this._coordinates, 0), e.isGeometryChanged() && this.geometryChanged();\n } else if (Lu(arguments[0], kc)) {\n arguments[0].filter(this);\n } else if (Lu(arguments[0], uc)) {\n arguments[0].filter(this);\n }\n }, e.prototype.getBoundary = function () {\n return this.getFactory().createGeometryCollection(null);\n }, e.prototype.clone = function () {\n var e = t.prototype.clone.call(this);\n return e._coordinates = this._coordinates.clone(), e;\n }, e.prototype.getGeometryType = function () {\n return \"Point\";\n }, e.prototype.copy = function () {\n return new e(this._coordinates.copy(), this._factory);\n }, e.prototype.getCoordinateSequence = function () {\n return this._coordinates;\n }, e.prototype.getY = function () {\n if (null === this.getCoordinate()) throw new Error(\"getY called on empty Point\");\n return this.getCoordinate().y;\n }, e.prototype.isEmpty = function () {\n return 0 === this._coordinates.size();\n }, e.prototype.init = function (t) {\n null === t && (t = this.getFactory().getCoordinateSequenceFactory().create([])), tc.isTrue(t.size() <= 1), this._coordinates = t;\n }, e.prototype.isSimple = function () {\n return !0;\n }, e.prototype.interfaces_ = function () {\n return [Zc];\n }, e.prototype.getClass = function () {\n return e;\n }, n.serialVersionUID.get = function () {\n return 0x44077bad161cbc00;\n }, Object.defineProperties(e, n), e;\n }(cc),\n Qc = function () {};\n Qc.prototype.interfaces_ = function () {\n return [];\n }, Qc.prototype.getClass = function () {\n return Qc;\n };\n var $c = function (t) {\n function e(e, n, r) {\n if (t.call(this, r), this._shell = null, this._holes = null, null === e && (e = this.getFactory().createLinearRing()), null === n && (n = []), t.hasNullElements(n)) throw new _u(\"holes must not contain null elements\");\n if (e.isEmpty() && t.hasNonEmptyElements(n)) throw new _u(\"shell is empty but holes are not\");\n this._shell = e, this._holes = n;\n }\n t && (e.__proto__ = t), (e.prototype = Object.create(t && t.prototype)).constructor = e;\n var n = {\n serialVersionUID: {\n configurable: !0\n }\n };\n return e.prototype.computeEnvelopeInternal = function () {\n return this._shell.getEnvelopeInternal();\n }, e.prototype.getSortIndex = function () {\n return t.SORTINDEX_POLYGON;\n }, e.prototype.getCoordinates = function () {\n if (this.isEmpty()) return [];\n for (var t = new Array(this.getNumPoints()).fill(null), e = -1, n = this._shell.getCoordinates(), r = 0; r < n.length; r++) t[++e] = n[r];\n for (var i = 0; i < this._holes.length; i++) for (var o = this._holes[i].getCoordinates(), s = 0; s < o.length; s++) t[++e] = o[s];\n return t;\n }, e.prototype.getArea = function () {\n var t = 0;\n t += Math.abs(sc.signedArea(this._shell.getCoordinateSequence()));\n for (var e = 0; e < this._holes.length; e++) t -= Math.abs(sc.signedArea(this._holes[e].getCoordinateSequence()));\n return t;\n }, e.prototype.isRectangle = function () {\n if (0 !== this.getNumInteriorRing()) return !1;\n if (null === this._shell) return !1;\n if (5 !== this._shell.getNumPoints()) return !1;\n for (var t = this._shell.getCoordinateSequence(), e = this.getEnvelopeInternal(), n = 0; n < 5; n++) {\n var r = t.getX(n);\n if (r !== e.getMinX() && r !== e.getMaxX()) return !1;\n var i = t.getY(n);\n if (i !== e.getMinY() && i !== e.getMaxY()) return !1;\n }\n for (var o = t.getX(0), s = t.getY(0), a = 1; a <= 4; a++) {\n var u = t.getX(a),\n c = t.getY(a);\n if (u !== o === (c !== s)) return !1;\n o = u, s = c;\n }\n return !0;\n }, e.prototype.equalsExact = function () {\n if (2 === arguments.length) {\n var e = arguments[0],\n n = arguments[1];\n if (!this.isEquivalentClass(e)) return !1;\n var r = e,\n i = this._shell,\n o = r._shell;\n if (!i.equalsExact(o, n)) return !1;\n if (this._holes.length !== r._holes.length) return !1;\n for (var s = 0; s < this._holes.length; s++) if (!this._holes[s].equalsExact(r._holes[s], n)) return !1;\n return !0;\n }\n return t.prototype.equalsExact.apply(this, arguments);\n }, e.prototype.normalize = function () {\n if (0 === arguments.length) {\n this.normalize(this._shell, !0);\n for (var t = 0; t < this._holes.length; t++) this.normalize(this._holes[t], !1);\n qc.sort(this._holes);\n } else if (2 === arguments.length) {\n var e = arguments[0],\n n = arguments[1];\n if (e.isEmpty()) return null;\n var r = new Array(e.getCoordinates().length - 1).fill(null);\n Xu.arraycopy(e.getCoordinates(), 0, r, 0, r.length);\n var i = Cc.minCoordinate(e.getCoordinates());\n Cc.scroll(r, i), Xu.arraycopy(r, 0, e.getCoordinates(), 0, r.length), e.getCoordinates()[r.length] = r[0], sc.isCCW(e.getCoordinates()) === n && Cc.reverse(e.getCoordinates());\n }\n }, e.prototype.getCoordinate = function () {\n return this._shell.getCoordinate();\n }, e.prototype.getNumInteriorRing = function () {\n return this._holes.length;\n }, e.prototype.getBoundaryDimension = function () {\n return 1;\n }, e.prototype.getDimension = function () {\n return 2;\n }, e.prototype.getLength = function () {\n var t = 0;\n t += this._shell.getLength();\n for (var e = 0; e < this._holes.length; e++) t += this._holes[e].getLength();\n return t;\n }, e.prototype.getNumPoints = function () {\n for (var t = this._shell.getNumPoints(), e = 0; e < this._holes.length; e++) t += this._holes[e].getNumPoints();\n return t;\n }, e.prototype.reverse = function () {\n var t = this.copy();\n t._shell = this._shell.copy().reverse(), t._holes = new Array(this._holes.length).fill(null);\n for (var e = 0; e < this._holes.length; e++) t._holes[e] = this._holes[e].copy().reverse();\n return t;\n }, e.prototype.convexHull = function () {\n return this.getExteriorRing().convexHull();\n }, e.prototype.compareToSameClass = function () {\n if (1 === arguments.length) {\n var t = arguments[0],\n e = this._shell,\n n = t._shell;\n return e.compareToSameClass(n);\n }\n if (2 === arguments.length) {\n var r = arguments[0],\n i = arguments[1],\n o = r,\n s = this._shell,\n a = o._shell,\n u = s.compareToSameClass(a, i);\n if (0 !== u) return u;\n for (var c = this.getNumInteriorRing(), h = o.getNumInteriorRing(), l = 0; l < c && l < h;) {\n var p = this.getInteriorRingN(l),\n f = o.getInteriorRingN(l),\n g = p.compareToSameClass(f, i);\n if (0 !== g) return g;\n l++;\n }\n return l < c ? 1 : l < h ? -1 : 0;\n }\n }, e.prototype.apply = function (t) {\n if (Lu(t, pc)) {\n this._shell.apply(t);\n for (var e = 0; e < this._holes.length; e++) this._holes[e].apply(t);\n } else if (Lu(t, zc)) {\n if (this._shell.apply(t), !t.isDone()) for (var n = 0; n < this._holes.length && (this._holes[n].apply(t), !t.isDone()); n++);\n t.isGeometryChanged() && this.geometryChanged();\n } else if (Lu(t, kc)) t.filter(this);else if (Lu(t, uc)) {\n t.filter(this), this._shell.apply(t);\n for (var r = 0; r < this._holes.length; r++) this._holes[r].apply(t);\n }\n }, e.prototype.getBoundary = function () {\n if (this.isEmpty()) return this.getFactory().createMultiLineString();\n var t = new Array(this._holes.length + 1).fill(null);\n t[0] = this._shell;\n for (var e = 0; e < this._holes.length; e++) t[e + 1] = this._holes[e];\n return t.length <= 1 ? this.getFactory().createLinearRing(t[0].getCoordinateSequence()) : this.getFactory().createMultiLineString(t);\n }, e.prototype.clone = function () {\n var e = t.prototype.clone.call(this);\n e._shell = this._shell.clone(), e._holes = new Array(this._holes.length).fill(null);\n for (var n = 0; n < this._holes.length; n++) e._holes[n] = this._holes[n].clone();\n return e;\n }, e.prototype.getGeometryType = function () {\n return \"Polygon\";\n }, e.prototype.copy = function () {\n for (var t = this._shell.copy(), n = new Array(this._holes.length).fill(null), r = 0; r < n.length; r++) n[r] = this._holes[r].copy();\n return new e(t, n, this._factory);\n }, e.prototype.getExteriorRing = function () {\n return this._shell;\n }, e.prototype.isEmpty = function () {\n return this._shell.isEmpty();\n }, e.prototype.getInteriorRingN = function (t) {\n return this._holes[t];\n }, e.prototype.interfaces_ = function () {\n return [Qc];\n }, e.prototype.getClass = function () {\n return e;\n }, n.serialVersionUID.get = function () {\n return -0x307ffefd8dc97200;\n }, Object.defineProperties(e, n), e;\n }(cc),\n th = function (t) {\n function e() {\n t.apply(this, arguments);\n }\n t && (e.__proto__ = t), (e.prototype = Object.create(t && t.prototype)).constructor = e;\n var n = {\n serialVersionUID: {\n configurable: !0\n }\n };\n return e.prototype.getSortIndex = function () {\n return cc.SORTINDEX_MULTIPOINT;\n }, e.prototype.isValid = function () {\n return !0;\n }, e.prototype.equalsExact = function () {\n if (2 === arguments.length) {\n var e = arguments[0],\n n = arguments[1];\n return !!this.isEquivalentClass(e) && t.prototype.equalsExact.call(this, e, n);\n }\n return t.prototype.equalsExact.apply(this, arguments);\n }, e.prototype.getCoordinate = function () {\n if (1 === arguments.length) {\n var e = arguments[0];\n return this._geometries[e].getCoordinate();\n }\n return t.prototype.getCoordinate.apply(this, arguments);\n }, e.prototype.getBoundaryDimension = function () {\n return Gc.FALSE;\n }, e.prototype.getDimension = function () {\n return 0;\n }, e.prototype.getBoundary = function () {\n return this.getFactory().createGeometryCollection(null);\n }, e.prototype.getGeometryType = function () {\n return \"MultiPoint\";\n }, e.prototype.copy = function () {\n for (var t = new Array(this._geometries.length).fill(null), n = 0; n < t.length; n++) t[n] = this._geometries[n].copy();\n return new e(t, this._factory);\n }, e.prototype.interfaces_ = function () {\n return [Zc];\n }, e.prototype.getClass = function () {\n return e;\n }, n.serialVersionUID.get = function () {\n return -0x6fb1ed4162e0fc00;\n }, Object.defineProperties(e, n), e;\n }(jc),\n eh = function (t) {\n function e(e, n) {\n e instanceof bu && n instanceof _h && (e = n.getCoordinateSequenceFactory().create(e)), t.call(this, e, n), this.validateConstruction();\n }\n t && (e.__proto__ = t), (e.prototype = Object.create(t && t.prototype)).constructor = e;\n var n = {\n MINIMUM_VALID_SIZE: {\n configurable: !0\n },\n serialVersionUID: {\n configurable: !0\n }\n };\n return e.prototype.getSortIndex = function () {\n return cc.SORTINDEX_LINEARRING;\n }, e.prototype.getBoundaryDimension = function () {\n return Gc.FALSE;\n }, e.prototype.isClosed = function () {\n return !!this.isEmpty() || t.prototype.isClosed.call(this);\n }, e.prototype.reverse = function () {\n var t = this._points.copy();\n Wc.reverse(t);\n return this.getFactory().createLinearRing(t);\n }, e.prototype.validateConstruction = function () {\n if (!this.isEmpty() && !t.prototype.isClosed.call(this)) throw new _u(\"Points of LinearRing do not form a closed linestring\");\n if (this.getCoordinateSequence().size() >= 1 && this.getCoordinateSequence().size() < e.MINIMUM_VALID_SIZE) throw new _u(\"Invalid number of points in LinearRing (found \" + this.getCoordinateSequence().size() + \" - must be 0 or >= 4)\");\n }, e.prototype.getGeometryType = function () {\n return \"LinearRing\";\n }, e.prototype.copy = function () {\n return new e(this._points.copy(), this._factory);\n }, e.prototype.interfaces_ = function () {\n return [];\n }, e.prototype.getClass = function () {\n return e;\n }, n.MINIMUM_VALID_SIZE.get = function () {\n return 4;\n }, n.serialVersionUID.get = function () {\n return -0x3b229e262367a600;\n }, Object.defineProperties(e, n), e;\n }(Jc),\n nh = function (t) {\n function e() {\n t.apply(this, arguments);\n }\n t && (e.__proto__ = t), (e.prototype = Object.create(t && t.prototype)).constructor = e;\n var n = {\n serialVersionUID: {\n configurable: !0\n }\n };\n return e.prototype.getSortIndex = function () {\n return cc.SORTINDEX_MULTIPOLYGON;\n }, e.prototype.equalsExact = function () {\n if (2 === arguments.length) {\n var e = arguments[0],\n n = arguments[1];\n return !!this.isEquivalentClass(e) && t.prototype.equalsExact.call(this, e, n);\n }\n return t.prototype.equalsExact.apply(this, arguments);\n }, e.prototype.getBoundaryDimension = function () {\n return 1;\n }, e.prototype.getDimension = function () {\n return 2;\n }, e.prototype.reverse = function () {\n for (var t = this._geometries.length, e = new Array(t).fill(null), n = 0; n < this._geometries.length; n++) e[n] = this._geometries[n].reverse();\n return this.getFactory().createMultiPolygon(e);\n }, e.prototype.getBoundary = function () {\n if (this.isEmpty()) return this.getFactory().createMultiLineString();\n for (var t = new bc(), e = 0; e < this._geometries.length; e++) for (var n = this._geometries[e].getBoundary(), r = 0; r < n.getNumGeometries(); r++) t.add(n.getGeometryN(r));\n var i = new Array(t.size()).fill(null);\n return this.getFactory().createMultiLineString(t.toArray(i));\n }, e.prototype.getGeometryType = function () {\n return \"MultiPolygon\";\n }, e.prototype.copy = function () {\n for (var t = new Array(this._geometries.length).fill(null), n = 0; n < t.length; n++) t[n] = this._geometries[n].copy();\n return new e(t, this._factory);\n }, e.prototype.interfaces_ = function () {\n return [Qc];\n }, e.prototype.getClass = function () {\n return e;\n }, n.serialVersionUID.get = function () {\n return -0x7a5aa1369171980;\n }, Object.defineProperties(e, n), e;\n }(jc),\n rh = function (t) {\n this._factory = t || null, this._isUserDataCopied = !1;\n },\n ih = {\n NoOpGeometryOperation: {\n configurable: !0\n },\n CoordinateOperation: {\n configurable: !0\n },\n CoordinateSequenceOperation: {\n configurable: !0\n }\n };\n rh.prototype.setCopyUserData = function (t) {\n this._isUserDataCopied = t;\n }, rh.prototype.edit = function (t, e) {\n if (null === t) return null;\n var n = this.editInternal(t, e);\n return this._isUserDataCopied && n.setUserData(t.getUserData()), n;\n }, rh.prototype.editInternal = function (t, e) {\n return null === this._factory && (this._factory = t.getFactory()), t instanceof jc ? this.editGeometryCollection(t, e) : t instanceof $c ? this.editPolygon(t, e) : t instanceof Kc ? e.edit(t, this._factory) : t instanceof Jc ? e.edit(t, this._factory) : (tc.shouldNeverReachHere(\"Unsupported Geometry class: \" + t.getClass().getName()), null);\n }, rh.prototype.editGeometryCollection = function (t, e) {\n for (var n = e.edit(t, this._factory), r = new bc(), i = 0; i < n.getNumGeometries(); i++) {\n var o = this.edit(n.getGeometryN(i), e);\n null === o || o.isEmpty() || r.add(o);\n }\n return n.getClass() === th ? this._factory.createMultiPoint(r.toArray([])) : n.getClass() === Xc ? this._factory.createMultiLineString(r.toArray([])) : n.getClass() === nh ? this._factory.createMultiPolygon(r.toArray([])) : this._factory.createGeometryCollection(r.toArray([]));\n }, rh.prototype.editPolygon = function (t, e) {\n var n = e.edit(t, this._factory);\n if (null === n && (n = this._factory.createPolygon(null)), n.isEmpty()) return n;\n var r = this.edit(n.getExteriorRing(), e);\n if (null === r || r.isEmpty()) return this._factory.createPolygon();\n for (var i = new bc(), o = 0; o < n.getNumInteriorRing(); o++) {\n var s = this.edit(n.getInteriorRingN(o), e);\n null === s || s.isEmpty() || i.add(s);\n }\n return this._factory.createPolygon(r, i.toArray([]));\n }, rh.prototype.interfaces_ = function () {\n return [];\n }, rh.prototype.getClass = function () {\n return rh;\n }, rh.GeometryEditorOperation = function () {}, ih.NoOpGeometryOperation.get = function () {\n return oh;\n }, ih.CoordinateOperation.get = function () {\n return sh;\n }, ih.CoordinateSequenceOperation.get = function () {\n return ah;\n }, Object.defineProperties(rh, ih);\n var oh = function () {};\n oh.prototype.edit = function (t, e) {\n return t;\n }, oh.prototype.interfaces_ = function () {\n return [rh.GeometryEditorOperation];\n }, oh.prototype.getClass = function () {\n return oh;\n };\n var sh = function () {};\n sh.prototype.edit = function (t, e) {\n var n = this.editCoordinates(t.getCoordinates(), t);\n return null === n ? t : t instanceof eh ? e.createLinearRing(n) : t instanceof Jc ? e.createLineString(n) : t instanceof Kc ? n.length > 0 ? e.createPoint(n[0]) : e.createPoint() : t;\n }, sh.prototype.interfaces_ = function () {\n return [rh.GeometryEditorOperation];\n }, sh.prototype.getClass = function () {\n return sh;\n };\n var ah = function () {};\n ah.prototype.edit = function (t, e) {\n return t instanceof eh ? e.createLinearRing(this.edit(t.getCoordinateSequence(), t)) : t instanceof Jc ? e.createLineString(this.edit(t.getCoordinateSequence(), t)) : t instanceof Kc ? e.createPoint(this.edit(t.getCoordinateSequence(), t)) : t;\n }, ah.prototype.interfaces_ = function () {\n return [rh.GeometryEditorOperation];\n }, ah.prototype.getClass = function () {\n return ah;\n };\n var uh = function () {\n if (this._dimension = 3, this._coordinates = null, 1 === arguments.length) {\n if (arguments[0] instanceof Array) this._coordinates = arguments[0], this._dimension = 3;else if (Number.isInteger(arguments[0])) {\n var t = arguments[0];\n this._coordinates = new Array(t).fill(null);\n for (var e = 0; e < t; e++) this._coordinates[e] = new bu();\n } else if (Lu(arguments[0], Bu)) {\n var n = arguments[0];\n if (null === n) return this._coordinates = new Array(0).fill(null), null;\n this._dimension = n.getDimension(), this._coordinates = new Array(n.size()).fill(null);\n for (var r = 0; r < this._coordinates.length; r++) this._coordinates[r] = n.getCoordinateCopy(r);\n }\n } else if (2 === arguments.length) if (arguments[0] instanceof Array && Number.isInteger(arguments[1])) {\n var i = arguments[0],\n o = arguments[1];\n this._coordinates = i, this._dimension = o, null === i && (this._coordinates = new Array(0).fill(null));\n } else if (Number.isInteger(arguments[0]) && Number.isInteger(arguments[1])) {\n var s = arguments[0],\n a = arguments[1];\n this._coordinates = new Array(s).fill(null), this._dimension = a;\n for (var u = 0; u < s; u++) this._coordinates[u] = new bu();\n }\n },\n ch = {\n serialVersionUID: {\n configurable: !0\n }\n };\n uh.prototype.setOrdinate = function (t, e, n) {\n switch (e) {\n case Bu.X:\n this._coordinates[t].x = n;\n break;\n case Bu.Y:\n this._coordinates[t].y = n;\n break;\n case Bu.Z:\n this._coordinates[t].z = n;\n break;\n default:\n throw new _u(\"invalid ordinateIndex\");\n }\n }, uh.prototype.size = function () {\n return this._coordinates.length;\n }, uh.prototype.getOrdinate = function (t, e) {\n switch (e) {\n case Bu.X:\n return this._coordinates[t].x;\n case Bu.Y:\n return this._coordinates[t].y;\n case Bu.Z:\n return this._coordinates[t].z;\n }\n return mu.NaN;\n }, uh.prototype.getCoordinate = function () {\n if (1 === arguments.length) {\n var t = arguments[0];\n return this._coordinates[t];\n }\n if (2 === arguments.length) {\n var e = arguments[0],\n n = arguments[1];\n n.x = this._coordinates[e].x, n.y = this._coordinates[e].y, n.z = this._coordinates[e].z;\n }\n }, uh.prototype.getCoordinateCopy = function (t) {\n return new bu(this._coordinates[t]);\n }, uh.prototype.getDimension = function () {\n return this._dimension;\n }, uh.prototype.getX = function (t) {\n return this._coordinates[t].x;\n }, uh.prototype.clone = function () {\n for (var t = new Array(this.size()).fill(null), e = 0; e < this._coordinates.length; e++) t[e] = this._coordinates[e].clone();\n return new uh(t, this._dimension);\n }, uh.prototype.expandEnvelope = function (t) {\n for (var e = 0; e < this._coordinates.length; e++) t.expandToInclude(this._coordinates[e]);\n return t;\n }, uh.prototype.copy = function () {\n for (var t = new Array(this.size()).fill(null), e = 0; e < this._coordinates.length; e++) t[e] = this._coordinates[e].copy();\n return new uh(t, this._dimension);\n }, uh.prototype.toString = function () {\n if (this._coordinates.length > 0) {\n var t = new Ru(17 * this._coordinates.length);\n t.append(\"(\"), t.append(this._coordinates[0]);\n for (var e = 1; e < this._coordinates.length; e++) t.append(\", \"), t.append(this._coordinates[e]);\n return t.append(\")\"), t.toString();\n }\n return \"()\";\n }, uh.prototype.getY = function (t) {\n return this._coordinates[t].y;\n }, uh.prototype.toCoordinateArray = function () {\n return this._coordinates;\n }, uh.prototype.interfaces_ = function () {\n return [Bu, Li];\n }, uh.prototype.getClass = function () {\n return uh;\n }, ch.serialVersionUID.get = function () {\n return -0xcb44a778db18e00;\n }, Object.defineProperties(uh, ch);\n var hh = function () {},\n lh = {\n serialVersionUID: {\n configurable: !0\n },\n instanceObject: {\n configurable: !0\n }\n };\n hh.prototype.readResolve = function () {\n return hh.instance();\n }, hh.prototype.create = function () {\n if (1 === arguments.length) {\n if (arguments[0] instanceof Array) {\n var t = arguments[0];\n return new uh(t);\n }\n if (Lu(arguments[0], Bu)) {\n var e = arguments[0];\n return new uh(e);\n }\n } else if (2 === arguments.length) {\n var n = arguments[0],\n r = arguments[1];\n return r > 3 && (r = 3), r < 2 ? new uh(n) : new uh(n, r);\n }\n }, hh.prototype.interfaces_ = function () {\n return [Cu, Li];\n }, hh.prototype.getClass = function () {\n return hh;\n }, hh.instance = function () {\n return hh.instanceObject;\n }, lh.serialVersionUID.get = function () {\n return -0x38e49fa6cf6f2e00;\n }, lh.instanceObject.get = function () {\n return new hh();\n }, Object.defineProperties(hh, lh);\n var ph = function (t) {\n function e() {\n t.call(this), this.map_ = new Map();\n }\n return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.get = function (t) {\n return this.map_.get(t) || null;\n }, e.prototype.put = function (t, e) {\n return this.map_.set(t, e), e;\n }, e.prototype.values = function () {\n for (var t = new bc(), e = this.map_.values(), n = e.next(); !n.done;) t.add(n.value), n = e.next();\n return t;\n }, e.prototype.entrySet = function () {\n var t = new Rc();\n return this.map_.entries().forEach(function (e) {\n return t.add(e);\n }), t;\n }, e.prototype.size = function () {\n return this.map_.size();\n }, e;\n }(Pc),\n fh = function t() {\n if (this._modelType = null, this._scale = null, 0 === arguments.length) this._modelType = t.FLOATING;else if (1 === arguments.length) if (arguments[0] instanceof dh) {\n var e = arguments[0];\n this._modelType = e, e === t.FIXED && this.setScale(1);\n } else if (\"number\" == typeof arguments[0]) {\n var n = arguments[0];\n this._modelType = t.FIXED, this.setScale(n);\n } else if (arguments[0] instanceof t) {\n var r = arguments[0];\n this._modelType = r._modelType, this._scale = r._scale;\n }\n },\n gh = {\n serialVersionUID: {\n configurable: !0\n },\n maximumPreciseValue: {\n configurable: !0\n }\n };\n fh.prototype.equals = function (t) {\n if (!(t instanceof fh)) return !1;\n var e = t;\n return this._modelType === e._modelType && this._scale === e._scale;\n }, fh.prototype.compareTo = function (t) {\n var e = t,\n n = this.getMaximumSignificantDigits(),\n r = e.getMaximumSignificantDigits();\n return new Tu(n).compareTo(new Tu(r));\n }, fh.prototype.getScale = function () {\n return this._scale;\n }, fh.prototype.isFloating = function () {\n return this._modelType === fh.FLOATING || this._modelType === fh.FLOATING_SINGLE;\n }, fh.prototype.getType = function () {\n return this._modelType;\n }, fh.prototype.toString = function () {\n var t = \"UNKNOWN\";\n return this._modelType === fh.FLOATING ? t = \"Floating\" : this._modelType === fh.FLOATING_SINGLE ? t = \"Floating-Single\" : this._modelType === fh.FIXED && (t = \"Fixed (Scale=\" + this.getScale() + \")\"), t;\n }, fh.prototype.makePrecise = function () {\n if (\"number\" == typeof arguments[0]) {\n var t = arguments[0];\n if (mu.isNaN(t)) return t;\n if (this._modelType === fh.FLOATING_SINGLE) {\n return t;\n }\n return this._modelType === fh.FIXED ? Math.round(t * this._scale) / this._scale : t;\n }\n if (arguments[0] instanceof bu) {\n var e = arguments[0];\n if (this._modelType === fh.FLOATING) return null;\n e.x = this.makePrecise(e.x), e.y = this.makePrecise(e.y);\n }\n }, fh.prototype.getMaximumSignificantDigits = function () {\n var t = 16;\n return this._modelType === fh.FLOATING ? t = 16 : this._modelType === fh.FLOATING_SINGLE ? t = 6 : this._modelType === fh.FIXED && (t = 1 + Math.trunc(Math.ceil(Math.log(this.getScale()) / Math.log(10)))), t;\n }, fh.prototype.setScale = function (t) {\n this._scale = Math.abs(t);\n }, fh.prototype.interfaces_ = function () {\n return [Li, xu];\n }, fh.prototype.getClass = function () {\n return fh;\n }, fh.mostPrecise = function (t, e) {\n return t.compareTo(e) >= 0 ? t : e;\n }, gh.serialVersionUID.get = function () {\n return 0x6bee6404e9a25c00;\n }, gh.maximumPreciseValue.get = function () {\n return 9007199254740992;\n }, Object.defineProperties(fh, gh);\n var dh = function t(e) {\n this._name = e || null, t.nameToTypeMap.put(e, this);\n },\n yh = {\n serialVersionUID: {\n configurable: !0\n },\n nameToTypeMap: {\n configurable: !0\n }\n };\n dh.prototype.readResolve = function () {\n return dh.nameToTypeMap.get(this._name);\n }, dh.prototype.toString = function () {\n return this._name;\n }, dh.prototype.interfaces_ = function () {\n return [Li];\n }, dh.prototype.getClass = function () {\n return dh;\n }, yh.serialVersionUID.get = function () {\n return -552860263173159e4;\n }, yh.nameToTypeMap.get = function () {\n return new ph();\n }, Object.defineProperties(dh, yh), fh.Type = dh, fh.FIXED = new dh(\"FIXED\"), fh.FLOATING = new dh(\"FLOATING\"), fh.FLOATING_SINGLE = new dh(\"FLOATING SINGLE\");\n var _h = function t() {\n this._precisionModel = new fh(), this._SRID = 0, this._coordinateSequenceFactory = t.getDefaultCoordinateSequenceFactory(), 0 === arguments.length || (1 === arguments.length ? Lu(arguments[0], Cu) ? this._coordinateSequenceFactory = arguments[0] : arguments[0] instanceof fh && (this._precisionModel = arguments[0]) : 2 === arguments.length ? (this._precisionModel = arguments[0], this._SRID = arguments[1]) : 3 === arguments.length && (this._precisionModel = arguments[0], this._SRID = arguments[1], this._coordinateSequenceFactory = arguments[2]));\n },\n mh = {\n serialVersionUID: {\n configurable: !0\n }\n };\n _h.prototype.toGeometry = function (t) {\n return t.isNull() ? this.createPoint(null) : t.getMinX() === t.getMaxX() && t.getMinY() === t.getMaxY() ? this.createPoint(new bu(t.getMinX(), t.getMinY())) : t.getMinX() === t.getMaxX() || t.getMinY() === t.getMaxY() ? this.createLineString([new bu(t.getMinX(), t.getMinY()), new bu(t.getMaxX(), t.getMaxY())]) : this.createPolygon(this.createLinearRing([new bu(t.getMinX(), t.getMinY()), new bu(t.getMinX(), t.getMaxY()), new bu(t.getMaxX(), t.getMaxY()), new bu(t.getMaxX(), t.getMinY()), new bu(t.getMinX(), t.getMinY())]), null);\n }, _h.prototype.createLineString = function (t) {\n return t ? t instanceof Array ? new Jc(this.getCoordinateSequenceFactory().create(t), this) : Lu(t, Bu) ? new Jc(t, this) : void 0 : new Jc(this.getCoordinateSequenceFactory().create([]), this);\n }, _h.prototype.createMultiLineString = function () {\n if (0 === arguments.length) return new Xc(null, this);\n if (1 === arguments.length) {\n var t = arguments[0];\n return new Xc(t, this);\n }\n }, _h.prototype.buildGeometry = function (t) {\n for (var e = null, n = !1, r = !1, i = t.iterator(); i.hasNext();) {\n var o = i.next(),\n s = o.getClass();\n null === e && (e = s), s !== e && (n = !0), o.isGeometryCollectionOrDerived() && (r = !0);\n }\n if (null === e) return this.createGeometryCollection();\n if (n || r) return this.createGeometryCollection(_h.toGeometryArray(t));\n var a = t.iterator().next();\n if (t.size() > 1) {\n if (a instanceof $c) return this.createMultiPolygon(_h.toPolygonArray(t));\n if (a instanceof Jc) return this.createMultiLineString(_h.toLineStringArray(t));\n if (a instanceof Kc) return this.createMultiPoint(_h.toPointArray(t));\n tc.shouldNeverReachHere(\"Unhandled class: \" + a.getClass().getName());\n }\n return a;\n }, _h.prototype.createMultiPointFromCoords = function (t) {\n return this.createMultiPoint(null !== t ? this.getCoordinateSequenceFactory().create(t) : null);\n }, _h.prototype.createPoint = function () {\n if (0 === arguments.length) return this.createPoint(this.getCoordinateSequenceFactory().create([]));\n if (1 === arguments.length) {\n if (arguments[0] instanceof bu) {\n var t = arguments[0];\n return this.createPoint(null !== t ? this.getCoordinateSequenceFactory().create([t]) : null);\n }\n if (Lu(arguments[0], Bu)) {\n var e = arguments[0];\n return new Kc(e, this);\n }\n }\n }, _h.prototype.getCoordinateSequenceFactory = function () {\n return this._coordinateSequenceFactory;\n }, _h.prototype.createPolygon = function () {\n if (0 === arguments.length) return new $c(null, null, this);\n if (1 === arguments.length) {\n if (Lu(arguments[0], Bu)) {\n var t = arguments[0];\n return this.createPolygon(this.createLinearRing(t));\n }\n if (arguments[0] instanceof Array) {\n var e = arguments[0];\n return this.createPolygon(this.createLinearRing(e));\n }\n if (arguments[0] instanceof eh) {\n var n = arguments[0];\n return this.createPolygon(n, null);\n }\n } else if (2 === arguments.length) {\n var r = arguments[0],\n i = arguments[1];\n return new $c(r, i, this);\n }\n }, _h.prototype.getSRID = function () {\n return this._SRID;\n }, _h.prototype.createGeometryCollection = function () {\n if (0 === arguments.length) return new jc(null, this);\n if (1 === arguments.length) {\n var t = arguments[0];\n return new jc(t, this);\n }\n }, _h.prototype.createGeometry = function (t) {\n return new rh(this).edit(t, {\n edit: function () {\n if (2 === arguments.length) {\n var t = arguments[0];\n return this._coordinateSequenceFactory.create(t);\n }\n }\n });\n }, _h.prototype.getPrecisionModel = function () {\n return this._precisionModel;\n }, _h.prototype.createLinearRing = function () {\n if (0 === arguments.length) return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));\n if (1 === arguments.length) {\n if (arguments[0] instanceof Array) {\n var t = arguments[0];\n return this.createLinearRing(null !== t ? this.getCoordinateSequenceFactory().create(t) : null);\n }\n if (Lu(arguments[0], Bu)) {\n var e = arguments[0];\n return new eh(e, this);\n }\n }\n }, _h.prototype.createMultiPolygon = function () {\n if (0 === arguments.length) return new nh(null, this);\n if (1 === arguments.length) {\n var t = arguments[0];\n return new nh(t, this);\n }\n }, _h.prototype.createMultiPoint = function () {\n if (0 === arguments.length) return new th(null, this);\n if (1 === arguments.length) {\n if (arguments[0] instanceof Array) {\n var t = arguments[0];\n return new th(t, this);\n }\n if (arguments[0] instanceof Array) {\n var e = arguments[0];\n return this.createMultiPoint(null !== e ? this.getCoordinateSequenceFactory().create(e) : null);\n }\n if (Lu(arguments[0], Bu)) {\n var n = arguments[0];\n if (null === n) return this.createMultiPoint(new Array(0).fill(null));\n for (var r = new Array(n.size()).fill(null), i = 0; i < n.size(); i++) {\n var o = this.getCoordinateSequenceFactory().create(1, n.getDimension());\n Wc.copy(n, i, o, 0, 1), r[i] = this.createPoint(o);\n }\n return this.createMultiPoint(r);\n }\n }\n }, _h.prototype.interfaces_ = function () {\n return [Li];\n }, _h.prototype.getClass = function () {\n return _h;\n }, _h.toMultiPolygonArray = function (t) {\n var e = new Array(t.size()).fill(null);\n return t.toArray(e);\n }, _h.toGeometryArray = function (t) {\n if (null === t) return null;\n var e = new Array(t.size()).fill(null);\n return t.toArray(e);\n }, _h.getDefaultCoordinateSequenceFactory = function () {\n return hh.instance();\n }, _h.toMultiLineStringArray = function (t) {\n var e = new Array(t.size()).fill(null);\n return t.toArray(e);\n }, _h.toLineStringArray = function (t) {\n var e = new Array(t.size()).fill(null);\n return t.toArray(e);\n }, _h.toMultiPointArray = function (t) {\n var e = new Array(t.size()).fill(null);\n return t.toArray(e);\n }, _h.toLinearRingArray = function (t) {\n var e = new Array(t.size()).fill(null);\n return t.toArray(e);\n }, _h.toPointArray = function (t) {\n var e = new Array(t.size()).fill(null);\n return t.toArray(e);\n }, _h.toPolygonArray = function (t) {\n var e = new Array(t.size()).fill(null);\n return t.toArray(e);\n }, _h.createPointFromInternalCoord = function (t, e) {\n return e.getPrecisionModel().makePrecise(t), e.getFactory().createPoint(t);\n }, mh.serialVersionUID.get = function () {\n return -0x5ea75f2051eeb400;\n }, Object.defineProperties(_h, mh);\n var vh = [\"Point\", \"MultiPoint\", \"LineString\", \"MultiLineString\", \"Polygon\", \"MultiPolygon\"],\n xh = function (t) {\n this.geometryFactory = t || new _h();\n };\n xh.prototype.read = function (t) {\n var e,\n n = (e = \"string\" == typeof t ? JSON.parse(t) : t).type;\n if (!Eh[n]) throw new Error(\"Unknown GeoJSON type: \" + e.type);\n return -1 !== vh.indexOf(n) ? Eh[n].apply(this, [e.coordinates]) : \"GeometryCollection\" === n ? Eh[n].apply(this, [e.geometries]) : Eh[n].apply(this, [e]);\n }, xh.prototype.write = function (t) {\n var e = t.getGeometryType();\n if (!wh[e]) throw new Error(\"Geometry is not supported\");\n return wh[e].apply(this, [t]);\n };\n var Eh = {\n Feature: function (t) {\n var e = {};\n for (var n in t) e[n] = t[n];\n if (t.geometry) {\n var r = t.geometry.type;\n if (!Eh[r]) throw new Error(\"Unknown GeoJSON type: \" + t.type);\n e.geometry = this.read(t.geometry);\n }\n return t.bbox && (e.bbox = Eh.bbox.apply(this, [t.bbox])), e;\n },\n FeatureCollection: function (t) {\n var e = {};\n if (t.features) {\n e.features = [];\n for (var n = 0; n < t.features.length; ++n) e.features.push(this.read(t.features[n]));\n }\n return t.bbox && (e.bbox = this.parse.bbox.apply(this, [t.bbox])), e;\n },\n coordinates: function (t) {\n for (var e = [], n = 0; n < t.length; ++n) {\n var r = t[n];\n e.push(new bu(r[0], r[1]));\n }\n return e;\n },\n bbox: function (t) {\n return this.geometryFactory.createLinearRing([new bu(t[0], t[1]), new bu(t[2], t[1]), new bu(t[2], t[3]), new bu(t[0], t[3]), new bu(t[0], t[1])]);\n },\n Point: function (t) {\n var e = new bu(t[0], t[1]);\n return this.geometryFactory.createPoint(e);\n },\n MultiPoint: function (t) {\n for (var e = [], n = 0; n < t.length; ++n) e.push(Eh.Point.apply(this, [t[n]]));\n return this.geometryFactory.createMultiPoint(e);\n },\n LineString: function (t) {\n var e = Eh.coordinates.apply(this, [t]);\n return this.geometryFactory.createLineString(e);\n },\n MultiLineString: function (t) {\n for (var e = [], n = 0; n < t.length; ++n) e.push(Eh.LineString.apply(this, [t[n]]));\n return this.geometryFactory.createMultiLineString(e);\n },\n Polygon: function (t) {\n for (var e = Eh.coordinates.apply(this, [t[0]]), n = this.geometryFactory.createLinearRing(e), r = [], i = 1; i < t.length; ++i) {\n var o = t[i],\n s = Eh.coordinates.apply(this, [o]),\n a = this.geometryFactory.createLinearRing(s);\n r.push(a);\n }\n return this.geometryFactory.createPolygon(n, r);\n },\n MultiPolygon: function (t) {\n for (var e = [], n = 0; n < t.length; ++n) {\n var r = t[n];\n e.push(Eh.Polygon.apply(this, [r]));\n }\n return this.geometryFactory.createMultiPolygon(e);\n },\n GeometryCollection: function (t) {\n for (var e = [], n = 0; n < t.length; ++n) {\n var r = t[n];\n e.push(this.read(r));\n }\n return this.geometryFactory.createGeometryCollection(e);\n }\n },\n wh = {\n coordinate: function (t) {\n return [t.x, t.y];\n },\n Point: function (t) {\n return {\n type: \"Point\",\n coordinates: wh.coordinate.apply(this, [t.getCoordinate()])\n };\n },\n MultiPoint: function (t) {\n for (var e = [], n = 0; n < t._geometries.length; ++n) {\n var r = t._geometries[n],\n i = wh.Point.apply(this, [r]);\n e.push(i.coordinates);\n }\n return {\n type: \"MultiPoint\",\n coordinates: e\n };\n },\n LineString: function (t) {\n for (var e = [], n = t.getCoordinates(), r = 0; r < n.length; ++r) {\n var i = n[r];\n e.push(wh.coordinate.apply(this, [i]));\n }\n return {\n type: \"LineString\",\n coordinates: e\n };\n },\n MultiLineString: function (t) {\n for (var e = [], n = 0; n < t._geometries.length; ++n) {\n var r = t._geometries[n],\n i = wh.LineString.apply(this, [r]);\n e.push(i.coordinates);\n }\n return {\n type: \"MultiLineString\",\n coordinates: e\n };\n },\n Polygon: function (t) {\n var e = [],\n n = wh.LineString.apply(this, [t._shell]);\n e.push(n.coordinates);\n for (var r = 0; r < t._holes.length; ++r) {\n var i = t._holes[r],\n o = wh.LineString.apply(this, [i]);\n e.push(o.coordinates);\n }\n return {\n type: \"Polygon\",\n coordinates: e\n };\n },\n MultiPolygon: function (t) {\n for (var e = [], n = 0; n < t._geometries.length; ++n) {\n var r = t._geometries[n],\n i = wh.Polygon.apply(this, [r]);\n e.push(i.coordinates);\n }\n return {\n type: \"MultiPolygon\",\n coordinates: e\n };\n },\n GeometryCollection: function (t) {\n for (var e = [], n = 0; n < t._geometries.length; ++n) {\n var r = t._geometries[n],\n i = r.getGeometryType();\n e.push(wh[i].apply(this, [r]));\n }\n return {\n type: \"GeometryCollection\",\n geometries: e\n };\n }\n },\n bh = function (t) {\n this.geometryFactory = t || new _h(), this.precisionModel = this.geometryFactory.getPrecisionModel(), this.parser = new xh(this.geometryFactory);\n };\n bh.prototype.read = function (t) {\n var e = this.parser.read(t);\n return this.precisionModel.getType() === fh.FIXED && this.reducePrecision(e), e;\n }, bh.prototype.reducePrecision = function (t) {\n var e, n;\n if (t.coordinate) this.precisionModel.makePrecise(t.coordinate);else if (t.points) for (e = 0, n = t.points.length; e < n; e++) this.precisionModel.makePrecise(t.points[e]);else if (t.geometries) for (e = 0, n = t.geometries.length; e < n; e++) this.reducePrecision(t.geometries[e]);\n };\n var Ih = function () {\n this.parser = new xh(this.geometryFactory);\n };\n Ih.prototype.write = function (t) {\n return this.parser.write(t);\n };\n var Nh = function () {},\n Ch = {\n ON: {\n configurable: !0\n },\n LEFT: {\n configurable: !0\n },\n RIGHT: {\n configurable: !0\n }\n };\n Nh.prototype.interfaces_ = function () {\n return [];\n }, Nh.prototype.getClass = function () {\n return Nh;\n }, Nh.opposite = function (t) {\n return t === Nh.LEFT ? Nh.RIGHT : t === Nh.RIGHT ? Nh.LEFT : t;\n }, Ch.ON.get = function () {\n return 0;\n }, Ch.LEFT.get = function () {\n return 1;\n }, Ch.RIGHT.get = function () {\n return 2;\n }, Object.defineProperties(Nh, Ch), (ji.prototype = new Error()).name = \"EmptyStackException\", (Xi.prototype = new wc()).add = function (t) {\n return this.array_.push(t), !0;\n }, Xi.prototype.get = function (t) {\n if (t < 0 || t >= this.size()) throw new Error();\n return this.array_[t];\n }, Xi.prototype.push = function (t) {\n return this.array_.push(t), t;\n }, Xi.prototype.pop = function (t) {\n if (0 === this.array_.length) throw new ji();\n return this.array_.pop();\n }, Xi.prototype.peek = function () {\n if (0 === this.array_.length) throw new ji();\n return this.array_[this.array_.length - 1];\n }, Xi.prototype.empty = function () {\n return 0 === this.array_.length;\n }, Xi.prototype.isEmpty = function () {\n return this.empty();\n }, Xi.prototype.search = function (t) {\n return this.array_.indexOf(t);\n }, Xi.prototype.size = function () {\n return this.array_.length;\n }, Xi.prototype.toArray = function () {\n for (var t = [], e = 0, n = this.array_.length; e < n; e++) t.push(this.array_[e]);\n return t;\n };\n var Sh = function () {\n this._minIndex = -1, this._minCoord = null, this._minDe = null, this._orientedDe = null;\n };\n Sh.prototype.getCoordinate = function () {\n return this._minCoord;\n }, Sh.prototype.getRightmostSide = function (t, e) {\n var n = this.getRightmostSideOfSegment(t, e);\n return n < 0 && (n = this.getRightmostSideOfSegment(t, e - 1)), n < 0 && (this._minCoord = null, this.checkForRightmostCoordinate(t)), n;\n }, Sh.prototype.findRightmostEdgeAtVertex = function () {\n var t = this._minDe.getEdge().getCoordinates();\n tc.isTrue(this._minIndex > 0 && this._minIndex < t.length, \"rightmost point expected to be interior vertex of edge\");\n var e = t[this._minIndex - 1],\n n = t[this._minIndex + 1],\n r = sc.computeOrientation(this._minCoord, n, e),\n i = !1;\n e.y < this._minCoord.y && n.y < this._minCoord.y && r === sc.COUNTERCLOCKWISE ? i = !0 : e.y > this._minCoord.y && n.y > this._minCoord.y && r === sc.CLOCKWISE && (i = !0), i && (this._minIndex = this._minIndex - 1);\n }, Sh.prototype.getRightmostSideOfSegment = function (t, e) {\n var n = t.getEdge().getCoordinates();\n if (e < 0 || e + 1 >= n.length) return -1;\n if (n[e].y === n[e + 1].y) return -1;\n var r = Nh.LEFT;\n return n[e].y < n[e + 1].y && (r = Nh.RIGHT), r;\n }, Sh.prototype.getEdge = function () {\n return this._orientedDe;\n }, Sh.prototype.checkForRightmostCoordinate = function (t) {\n for (var e = t.getEdge().getCoordinates(), n = 0; n < e.length - 1; n++) (null === this._minCoord || e[n].x > this._minCoord.x) && (this._minDe = t, this._minIndex = n, this._minCoord = e[n]);\n }, Sh.prototype.findRightmostEdgeAtNode = function () {\n var t = this._minDe.getNode().getEdges();\n this._minDe = t.getRightmostEdge(), this._minDe.isForward() || (this._minDe = this._minDe.getSym(), this._minIndex = this._minDe.getEdge().getCoordinates().length - 1);\n }, Sh.prototype.findEdge = function (t) {\n for (var e = t.iterator(); e.hasNext();) {\n var n = e.next();\n n.isForward() && this.checkForRightmostCoordinate(n);\n }\n tc.isTrue(0 !== this._minIndex || this._minCoord.equals(this._minDe.getCoordinate()), \"inconsistency in rightmost processing\"), 0 === this._minIndex ? this.findRightmostEdgeAtNode() : this.findRightmostEdgeAtVertex(), this._orientedDe = this._minDe;\n this.getRightmostSide(this._minDe, this._minIndex) === Nh.LEFT && (this._orientedDe = this._minDe.getSym());\n }, Sh.prototype.interfaces_ = function () {\n return [];\n }, Sh.prototype.getClass = function () {\n return Sh;\n };\n var Mh = function (t) {\n function e(n, r) {\n t.call(this, e.msgWithCoord(n, r)), this.pt = r ? new bu(r) : null, this.name = \"TopologyException\";\n }\n return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.getCoordinate = function () {\n return this.pt;\n }, e.prototype.interfaces_ = function () {\n return [];\n }, e.prototype.getClass = function () {\n return e;\n }, e.msgWithCoord = function (t, e) {\n return e ? t : t + \" [ \" + e + \" ]\";\n }, e;\n }(Qu),\n Lh = function () {\n this.array_ = [];\n };\n Lh.prototype.addLast = function (t) {\n this.array_.push(t);\n }, Lh.prototype.removeFirst = function () {\n return this.array_.shift();\n }, Lh.prototype.isEmpty = function () {\n return 0 === this.array_.length;\n };\n var Ph = function () {\n this._finder = null, this._dirEdgeList = new bc(), this._nodes = new bc(), this._rightMostCoord = null, this._env = null, this._finder = new Sh();\n };\n Ph.prototype.clearVisitedEdges = function () {\n for (var t = this._dirEdgeList.iterator(); t.hasNext();) {\n t.next().setVisited(!1);\n }\n }, Ph.prototype.getRightmostCoordinate = function () {\n return this._rightMostCoord;\n }, Ph.prototype.computeNodeDepth = function (t) {\n for (var e = null, n = t.getEdges().iterator(); n.hasNext();) {\n var r = n.next();\n if (r.isVisited() || r.getSym().isVisited()) {\n e = r;\n break;\n }\n }\n if (null === e) throw new Mh(\"unable to find edge to compute depths at \" + t.getCoordinate());\n t.getEdges().computeDepths(e);\n for (var i = t.getEdges().iterator(); i.hasNext();) {\n var o = i.next();\n o.setVisited(!0), this.copySymDepths(o);\n }\n }, Ph.prototype.computeDepth = function (t) {\n this.clearVisitedEdges();\n var e = this._finder.getEdge();\n e.setEdgeDepths(Nh.RIGHT, t), this.copySymDepths(e), this.computeDepths(e);\n }, Ph.prototype.create = function (t) {\n this.addReachable(t), this._finder.findEdge(this._dirEdgeList), this._rightMostCoord = this._finder.getCoordinate();\n }, Ph.prototype.findResultEdges = function () {\n for (var t = this._dirEdgeList.iterator(); t.hasNext();) {\n var e = t.next();\n e.getDepth(Nh.RIGHT) >= 1 && e.getDepth(Nh.LEFT) <= 0 && !e.isInteriorAreaEdge() && e.setInResult(!0);\n }\n }, Ph.prototype.computeDepths = function (t) {\n var e = new Rc(),\n n = new Lh(),\n r = t.getNode();\n for (n.addLast(r), e.add(r), t.setVisited(!0); !n.isEmpty();) {\n var i = n.removeFirst();\n e.add(i), this.computeNodeDepth(i);\n for (var o = i.getEdges().iterator(); o.hasNext();) {\n var s = o.next().getSym();\n if (!s.isVisited()) {\n var a = s.getNode();\n e.contains(a) || (n.addLast(a), e.add(a));\n }\n }\n }\n }, Ph.prototype.compareTo = function (t) {\n var e = t;\n return this._rightMostCoord.x < e._rightMostCoord.x ? -1 : this._rightMostCoord.x > e._rightMostCoord.x ? 1 : 0;\n }, Ph.prototype.getEnvelope = function () {\n if (null === this._env) {\n for (var t = new Yu(), e = this._dirEdgeList.iterator(); e.hasNext();) for (var n = e.next().getEdge().getCoordinates(), r = 0; r < n.length - 1; r++) t.expandToInclude(n[r]);\n this._env = t;\n }\n return this._env;\n }, Ph.prototype.addReachable = function (t) {\n var e = new Xi();\n for (e.add(t); !e.empty();) {\n var n = e.pop();\n this.add(n, e);\n }\n }, Ph.prototype.copySymDepths = function (t) {\n var e = t.getSym();\n e.setDepth(Nh.LEFT, t.getDepth(Nh.RIGHT)), e.setDepth(Nh.RIGHT, t.getDepth(Nh.LEFT));\n }, Ph.prototype.add = function (t, e) {\n t.setVisited(!0), this._nodes.add(t);\n for (var n = t.getEdges().iterator(); n.hasNext();) {\n var r = n.next();\n this._dirEdgeList.add(r);\n var i = r.getSym().getNode();\n i.isVisited() || e.push(i);\n }\n }, Ph.prototype.getNodes = function () {\n return this._nodes;\n }, Ph.prototype.getDirectedEdges = function () {\n return this._dirEdgeList;\n }, Ph.prototype.interfaces_ = function () {\n return [xu];\n }, Ph.prototype.getClass = function () {\n return Ph;\n };\n var Oh = function t() {\n if (this.location = null, 1 === arguments.length) {\n if (arguments[0] instanceof Array) {\n var e = arguments[0];\n this.init(e.length);\n } else if (Number.isInteger(arguments[0])) {\n var n = arguments[0];\n this.init(1), this.location[Nh.ON] = n;\n } else if (arguments[0] instanceof t) {\n var r = arguments[0];\n if (this.init(r.location.length), null !== r) for (var i = 0; i < this.location.length; i++) this.location[i] = r.location[i];\n }\n } else if (3 === arguments.length) {\n var o = arguments[0],\n s = arguments[1],\n a = arguments[2];\n this.init(3), this.location[Nh.ON] = o, this.location[Nh.LEFT] = s, this.location[Nh.RIGHT] = a;\n }\n };\n Oh.prototype.setAllLocations = function (t) {\n for (var e = 0; e < this.location.length; e++) this.location[e] = t;\n }, Oh.prototype.isNull = function () {\n for (var t = 0; t < this.location.length; t++) if (this.location[t] !== Su.NONE) return !1;\n return !0;\n }, Oh.prototype.setAllLocationsIfNull = function (t) {\n for (var e = 0; e < this.location.length; e++) this.location[e] === Su.NONE && (this.location[e] = t);\n }, Oh.prototype.isLine = function () {\n return 1 === this.location.length;\n }, Oh.prototype.merge = function (t) {\n if (t.location.length > this.location.length) {\n var e = new Array(3).fill(null);\n e[Nh.ON] = this.location[Nh.ON], e[Nh.LEFT] = Su.NONE, e[Nh.RIGHT] = Su.NONE, this.location = e;\n }\n for (var n = 0; n < this.location.length; n++) this.location[n] === Su.NONE && n < t.location.length && (this.location[n] = t.location[n]);\n }, Oh.prototype.getLocations = function () {\n return this.location;\n }, Oh.prototype.flip = function () {\n if (this.location.length <= 1) return null;\n var t = this.location[Nh.LEFT];\n this.location[Nh.LEFT] = this.location[Nh.RIGHT], this.location[Nh.RIGHT] = t;\n }, Oh.prototype.toString = function () {\n var t = new Ru();\n return this.location.length > 1 && t.append(Su.toLocationSymbol(this.location[Nh.LEFT])), t.append(Su.toLocationSymbol(this.location[Nh.ON])), this.location.length > 1 && t.append(Su.toLocationSymbol(this.location[Nh.RIGHT])), t.toString();\n }, Oh.prototype.setLocations = function (t, e, n) {\n this.location[Nh.ON] = t, this.location[Nh.LEFT] = e, this.location[Nh.RIGHT] = n;\n }, Oh.prototype.get = function (t) {\n return t < this.location.length ? this.location[t] : Su.NONE;\n }, Oh.prototype.isArea = function () {\n return this.location.length > 1;\n }, Oh.prototype.isAnyNull = function () {\n for (var t = 0; t < this.location.length; t++) if (this.location[t] === Su.NONE) return !0;\n return !1;\n }, Oh.prototype.setLocation = function () {\n if (1 === arguments.length) {\n var t = arguments[0];\n this.setLocation(Nh.ON, t);\n } else if (2 === arguments.length) {\n var e = arguments[0],\n n = arguments[1];\n this.location[e] = n;\n }\n }, Oh.prototype.init = function (t) {\n this.location = new Array(t).fill(null), this.setAllLocations(Su.NONE);\n }, Oh.prototype.isEqualOnSide = function (t, e) {\n return this.location[e] === t.location[e];\n }, Oh.prototype.allPositionsEqual = function (t) {\n for (var e = 0; e < this.location.length; e++) if (this.location[e] !== t) return !1;\n return !0;\n }, Oh.prototype.interfaces_ = function () {\n return [];\n }, Oh.prototype.getClass = function () {\n return Oh;\n };\n var Rh = function t() {\n if (this.elt = new Array(2).fill(null), 1 === arguments.length) {\n if (Number.isInteger(arguments[0])) {\n var e = arguments[0];\n this.elt[0] = new Oh(e), this.elt[1] = new Oh(e);\n } else if (arguments[0] instanceof t) {\n var n = arguments[0];\n this.elt[0] = new Oh(n.elt[0]), this.elt[1] = new Oh(n.elt[1]);\n }\n } else if (2 === arguments.length) {\n var r = arguments[0],\n i = arguments[1];\n this.elt[0] = new Oh(Su.NONE), this.elt[1] = new Oh(Su.NONE), this.elt[r].setLocation(i);\n } else if (3 === arguments.length) {\n var o = arguments[0],\n s = arguments[1],\n a = arguments[2];\n this.elt[0] = new Oh(o, s, a), this.elt[1] = new Oh(o, s, a);\n } else if (4 === arguments.length) {\n var u = arguments[0],\n c = arguments[1],\n h = arguments[2],\n l = arguments[3];\n this.elt[0] = new Oh(Su.NONE, Su.NONE, Su.NONE), this.elt[1] = new Oh(Su.NONE, Su.NONE, Su.NONE), this.elt[u].setLocations(c, h, l);\n }\n };\n Rh.prototype.getGeometryCount = function () {\n var t = 0;\n return this.elt[0].isNull() || t++, this.elt[1].isNull() || t++, t;\n }, Rh.prototype.setAllLocations = function (t, e) {\n this.elt[t].setAllLocations(e);\n }, Rh.prototype.isNull = function (t) {\n return this.elt[t].isNull();\n }, Rh.prototype.setAllLocationsIfNull = function () {\n if (1 === arguments.length) {\n var t = arguments[0];\n this.setAllLocationsIfNull(0, t), this.setAllLocationsIfNull(1, t);\n } else if (2 === arguments.length) {\n var e = arguments[0],\n n = arguments[1];\n this.elt[e].setAllLocationsIfNull(n);\n }\n }, Rh.prototype.isLine = function (t) {\n return this.elt[t].isLine();\n }, Rh.prototype.merge = function (t) {\n for (var e = 0; e < 2; e++) null === this.elt[e] && null !== t.elt[e] ? this.elt[e] = new Oh(t.elt[e]) : this.elt[e].merge(t.elt[e]);\n }, Rh.prototype.flip = function () {\n this.elt[0].flip(), this.elt[1].flip();\n }, Rh.prototype.getLocation = function () {\n if (1 === arguments.length) {\n var t = arguments[0];\n return this.elt[t].get(Nh.ON);\n }\n if (2 === arguments.length) {\n var e = arguments[0],\n n = arguments[1];\n return this.elt[e].get(n);\n }\n }, Rh.prototype.toString = function () {\n var t = new Ru();\n return null !== this.elt[0] && (t.append(\"A:\"), t.append(this.elt[0].toString())), null !== this.elt[1] && (t.append(\" B:\"), t.append(this.elt[1].toString())), t.toString();\n }, Rh.prototype.isArea = function () {\n if (0 === arguments.length) return this.elt[0].isArea() || this.elt[1].isArea();\n if (1 === arguments.length) {\n var t = arguments[0];\n return this.elt[t].isArea();\n }\n }, Rh.prototype.isAnyNull = function (t) {\n return this.elt[t].isAnyNull();\n }, Rh.prototype.setLocation = function () {\n if (2 === arguments.length) {\n var t = arguments[0],\n e = arguments[1];\n this.elt[t].setLocation(Nh.ON, e);\n } else if (3 === arguments.length) {\n var n = arguments[0],\n r = arguments[1],\n i = arguments[2];\n this.elt[n].setLocation(r, i);\n }\n }, Rh.prototype.isEqualOnSide = function (t, e) {\n return this.elt[0].isEqualOnSide(t.elt[0], e) && this.elt[1].isEqualOnSide(t.elt[1], e);\n }, Rh.prototype.allPositionsEqual = function (t, e) {\n return this.elt[t].allPositionsEqual(e);\n }, Rh.prototype.toLine = function (t) {\n this.elt[t].isArea() && (this.elt[t] = new Oh(this.elt[t].location[0]));\n }, Rh.prototype.interfaces_ = function () {\n return [];\n }, Rh.prototype.getClass = function () {\n return Rh;\n }, Rh.toLineLabel = function (t) {\n for (var e = new Rh(Su.NONE), n = 0; n < 2; n++) e.setLocation(n, t.getLocation(n));\n return e;\n };\n var Th = function () {\n this._startDe = null, this._maxNodeDegree = -1, this._edges = new bc(), this._pts = new bc(), this._label = new Rh(Su.NONE), this._ring = null, this._isHole = null, this._shell = null, this._holes = new bc(), this._geometryFactory = null;\n var t = arguments[0],\n e = arguments[1];\n this._geometryFactory = e, this.computePoints(t), this.computeRing();\n };\n Th.prototype.computeRing = function () {\n if (null !== this._ring) return null;\n for (var t = new Array(this._pts.size()).fill(null), e = 0; e < this._pts.size(); e++) t[e] = this._pts.get(e);\n this._ring = this._geometryFactory.createLinearRing(t), this._isHole = sc.isCCW(this._ring.getCoordinates());\n }, Th.prototype.isIsolated = function () {\n return 1 === this._label.getGeometryCount();\n }, Th.prototype.computePoints = function (t) {\n this._startDe = t;\n var e = t,\n n = !0;\n do {\n if (null === e) throw new Mh(\"Found null DirectedEdge\");\n if (e.getEdgeRing() === this) throw new Mh(\"Directed Edge visited twice during ring-building at \" + e.getCoordinate());\n this._edges.add(e);\n var r = e.getLabel();\n tc.isTrue(r.isArea()), this.mergeLabel(r), this.addPoints(e.getEdge(), e.isForward(), n), n = !1, this.setEdgeRing(e, this), e = this.getNext(e);\n } while (e !== this._startDe);\n }, Th.prototype.getLinearRing = function () {\n return this._ring;\n }, Th.prototype.getCoordinate = function (t) {\n return this._pts.get(t);\n }, Th.prototype.computeMaxNodeDegree = function () {\n this._maxNodeDegree = 0;\n var t = this._startDe;\n do {\n var e = t.getNode().getEdges().getOutgoingDegree(this);\n e > this._maxNodeDegree && (this._maxNodeDegree = e), t = this.getNext(t);\n } while (t !== this._startDe);\n this._maxNodeDegree *= 2;\n }, Th.prototype.addPoints = function (t, e, n) {\n var r = t.getCoordinates();\n if (e) {\n var i = 1;\n n && (i = 0);\n for (var o = i; o < r.length; o++) this._pts.add(r[o]);\n } else {\n var s = r.length - 2;\n n && (s = r.length - 1);\n for (var a = s; a >= 0; a--) this._pts.add(r[a]);\n }\n }, Th.prototype.isHole = function () {\n return this._isHole;\n }, Th.prototype.setInResult = function () {\n var t = this._startDe;\n do {\n t.getEdge().setInResult(!0), t = t.getNext();\n } while (t !== this._startDe);\n }, Th.prototype.containsPoint = function (t) {\n var e = this.getLinearRing();\n if (!e.getEnvelopeInternal().contains(t)) return !1;\n if (!sc.isPointInRing(t, e.getCoordinates())) return !1;\n for (var n = this._holes.iterator(); n.hasNext();) {\n if (n.next().containsPoint(t)) return !1;\n }\n return !0;\n }, Th.prototype.addHole = function (t) {\n this._holes.add(t);\n }, Th.prototype.isShell = function () {\n return null === this._shell;\n }, Th.prototype.getLabel = function () {\n return this._label;\n }, Th.prototype.getEdges = function () {\n return this._edges;\n }, Th.prototype.getMaxNodeDegree = function () {\n return this._maxNodeDegree < 0 && this.computeMaxNodeDegree(), this._maxNodeDegree;\n }, Th.prototype.getShell = function () {\n return this._shell;\n }, Th.prototype.mergeLabel = function () {\n if (1 === arguments.length) {\n var t = arguments[0];\n this.mergeLabel(t, 0), this.mergeLabel(t, 1);\n } else if (2 === arguments.length) {\n var e = arguments[0],\n n = arguments[1],\n r = e.getLocation(n, Nh.RIGHT);\n if (r === Su.NONE) return null;\n if (this._label.getLocation(n) === Su.NONE) return this._label.setLocation(n, r), null;\n }\n }, Th.prototype.setShell = function (t) {\n this._shell = t, null !== t && t.addHole(this);\n }, Th.prototype.toPolygon = function (t) {\n for (var e = new Array(this._holes.size()).fill(null), n = 0; n < this._holes.size(); n++) e[n] = this._holes.get(n).getLinearRing();\n return t.createPolygon(this.getLinearRing(), e);\n }, Th.prototype.interfaces_ = function () {\n return [];\n }, Th.prototype.getClass = function () {\n return Th;\n };\n var Ah = function (t) {\n function e() {\n var e = arguments[0],\n n = arguments[1];\n t.call(this, e, n);\n }\n return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.setEdgeRing = function (t, e) {\n t.setMinEdgeRing(e);\n }, e.prototype.getNext = function (t) {\n return t.getNextMin();\n }, e.prototype.interfaces_ = function () {\n return [];\n }, e.prototype.getClass = function () {\n return e;\n }, e;\n }(Th),\n Dh = function (t) {\n function e() {\n var e = arguments[0],\n n = arguments[1];\n t.call(this, e, n);\n }\n return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.buildMinimalRings = function () {\n var t = new bc(),\n e = this._startDe;\n do {\n if (null === e.getMinEdgeRing()) {\n var n = new Ah(e, this._geometryFactory);\n t.add(n);\n }\n e = e.getNext();\n } while (e !== this._startDe);\n return t;\n }, e.prototype.setEdgeRing = function (t, e) {\n t.setEdgeRing(e);\n }, e.prototype.linkDirectedEdgesForMinimalEdgeRings = function () {\n var t = this._startDe;\n do {\n t.getNode().getEdges().linkMinimalDirectedEdges(this), t = t.getNext();\n } while (t !== this._startDe);\n }, e.prototype.getNext = function (t) {\n return t.getNext();\n }, e.prototype.interfaces_ = function () {\n return [];\n }, e.prototype.getClass = function () {\n return e;\n }, e;\n }(Th),\n Fh = function () {\n if (this._label = null, this._isInResult = !1, this._isCovered = !1, this._isCoveredSet = !1, this._isVisited = !1, 0 === arguments.length) ;else if (1 === arguments.length) {\n var t = arguments[0];\n this._label = t;\n }\n };\n Fh.prototype.setVisited = function (t) {\n this._isVisited = t;\n }, Fh.prototype.setInResult = function (t) {\n this._isInResult = t;\n }, Fh.prototype.isCovered = function () {\n return this._isCovered;\n }, Fh.prototype.isCoveredSet = function () {\n return this._isCoveredSet;\n }, Fh.prototype.setLabel = function (t) {\n this._label = t;\n }, Fh.prototype.getLabel = function () {\n return this._label;\n }, Fh.prototype.setCovered = function (t) {\n this._isCovered = t, this._isCoveredSet = !0;\n }, Fh.prototype.updateIM = function (t) {\n tc.isTrue(this._label.getGeometryCount() >= 2, \"found partial label\"), this.computeIM(t);\n }, Fh.prototype.isInResult = function () {\n return this._isInResult;\n }, Fh.prototype.isVisited = function () {\n return this._isVisited;\n }, Fh.prototype.interfaces_ = function () {\n return [];\n }, Fh.prototype.getClass = function () {\n return Fh;\n };\n var qh = function (t) {\n function e() {\n t.call(this), this._coord = null, this._edges = null;\n var e = arguments[0],\n n = arguments[1];\n this._coord = e, this._edges = n, this._label = new Rh(0, Su.NONE);\n }\n return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.isIncidentEdgeInResult = function () {\n for (var t = this.getEdges().getEdges().iterator(); t.hasNext();) {\n if (t.next().getEdge().isInResult()) return !0;\n }\n return !1;\n }, e.prototype.isIsolated = function () {\n return 1 === this._label.getGeometryCount();\n }, e.prototype.getCoordinate = function () {\n return this._coord;\n }, e.prototype.print = function (t) {\n t.println(\"node \" + this._coord + \" lbl: \" + this._label);\n }, e.prototype.computeIM = function (t) {}, e.prototype.computeMergedLocation = function (t, e) {\n var n = Su.NONE;\n if (n = this._label.getLocation(e), !t.isNull(e)) {\n var r = t.getLocation(e);\n n !== Su.BOUNDARY && (n = r);\n }\n return n;\n }, e.prototype.setLabel = function () {\n if (2 !== arguments.length) return t.prototype.setLabel.apply(this, arguments);\n var e = arguments[0],\n n = arguments[1];\n null === this._label ? this._label = new Rh(e, n) : this._label.setLocation(e, n);\n }, e.prototype.getEdges = function () {\n return this._edges;\n }, e.prototype.mergeLabel = function () {\n if (arguments[0] instanceof e) {\n var t = arguments[0];\n this.mergeLabel(t._label);\n } else if (arguments[0] instanceof Rh) for (var n = arguments[0], r = 0; r < 2; r++) {\n var i = this.computeMergedLocation(n, r);\n this._label.getLocation(r) === Su.NONE && this._label.setLocation(r, i);\n }\n }, e.prototype.add = function (t) {\n this._edges.insert(t), t.setNode(this);\n }, e.prototype.setLabelBoundary = function (t) {\n if (null === this._label) return null;\n var e = Su.NONE;\n null !== this._label && (e = this._label.getLocation(t));\n var n = null;\n switch (e) {\n case Su.BOUNDARY:\n n = Su.INTERIOR;\n break;\n case Su.INTERIOR:\n default:\n n = Su.BOUNDARY;\n }\n this._label.setLocation(t, n);\n }, e.prototype.interfaces_ = function () {\n return [];\n }, e.prototype.getClass = function () {\n return e;\n }, e;\n }(Fh),\n Gh = function () {\n this.nodeMap = new Gi(), this.nodeFact = null;\n var t = arguments[0];\n this.nodeFact = t;\n };\n Gh.prototype.find = function (t) {\n return this.nodeMap.get(t);\n }, Gh.prototype.addNode = function () {\n if (arguments[0] instanceof bu) {\n var t = arguments[0],\n e = this.nodeMap.get(t);\n return null === e && (e = this.nodeFact.createNode(t), this.nodeMap.put(t, e)), e;\n }\n if (arguments[0] instanceof qh) {\n var n = arguments[0],\n r = this.nodeMap.get(n.getCoordinate());\n return null === r ? (this.nodeMap.put(n.getCoordinate(), n), n) : (r.mergeLabel(n), r);\n }\n }, Gh.prototype.print = function (t) {\n for (var e = this.iterator(); e.hasNext();) {\n e.next().print(t);\n }\n }, Gh.prototype.iterator = function () {\n return this.nodeMap.values().iterator();\n }, Gh.prototype.values = function () {\n return this.nodeMap.values();\n }, Gh.prototype.getBoundaryNodes = function (t) {\n for (var e = new bc(), n = this.iterator(); n.hasNext();) {\n var r = n.next();\n r.getLabel().getLocation(t) === Su.BOUNDARY && e.add(r);\n }\n return e;\n }, Gh.prototype.add = function (t) {\n var e = t.getCoordinate();\n this.addNode(e).add(t);\n }, Gh.prototype.interfaces_ = function () {\n return [];\n }, Gh.prototype.getClass = function () {\n return Gh;\n };\n var Bh = function () {},\n kh = {\n NE: {\n configurable: !0\n },\n NW: {\n configurable: !0\n },\n SW: {\n configurable: !0\n },\n SE: {\n configurable: !0\n }\n };\n Bh.prototype.interfaces_ = function () {\n return [];\n }, Bh.prototype.getClass = function () {\n return Bh;\n }, Bh.isNorthern = function (t) {\n return t === Bh.NE || t === Bh.NW;\n }, Bh.isOpposite = function (t, e) {\n if (t === e) return !1;\n return 2 === (t - e + 4) % 4;\n }, Bh.commonHalfPlane = function (t, e) {\n if (t === e) return t;\n if (2 === (t - e + 4) % 4) return -1;\n var n = t < e ? t : e;\n return 0 === n && 3 === (t > e ? t : e) ? 3 : n;\n }, Bh.isInHalfPlane = function (t, e) {\n return e === Bh.SE ? t === Bh.SE || t === Bh.SW : t === e || t === e + 1;\n }, Bh.quadrant = function () {\n if (\"number\" == typeof arguments[0] && \"number\" == typeof arguments[1]) {\n var t = arguments[0],\n e = arguments[1];\n if (0 === t && 0 === e) throw new _u(\"Cannot compute the quadrant for point ( \" + t + \", \" + e + \" )\");\n return t >= 0 ? e >= 0 ? Bh.NE : Bh.SE : e >= 0 ? Bh.NW : Bh.SW;\n }\n if (arguments[0] instanceof bu && arguments[1] instanceof bu) {\n var n = arguments[0],\n r = arguments[1];\n if (r.x === n.x && r.y === n.y) throw new _u(\"Cannot compute the quadrant for two identical points \" + n);\n return r.x >= n.x ? r.y >= n.y ? Bh.NE : Bh.SE : r.y >= n.y ? Bh.NW : Bh.SW;\n }\n }, kh.NE.get = function () {\n return 0;\n }, kh.NW.get = function () {\n return 1;\n }, kh.SW.get = function () {\n return 2;\n }, kh.SE.get = function () {\n return 3;\n }, Object.defineProperties(Bh, kh);\n var zh = function () {\n if (this._edge = null, this._label = null, this._node = null, this._p0 = null, this._p1 = null, this._dx = null, this._dy = null, this._quadrant = null, 1 === arguments.length) {\n var t = arguments[0];\n this._edge = t;\n } else if (3 === arguments.length) {\n var e = arguments[0],\n n = arguments[1],\n r = arguments[2];\n this._edge = e, this.init(n, r), this._label = null;\n } else if (4 === arguments.length) {\n var i = arguments[0],\n o = arguments[1],\n s = arguments[2],\n a = arguments[3];\n this._edge = i, this.init(o, s), this._label = a;\n }\n };\n zh.prototype.compareDirection = function (t) {\n return this._dx === t._dx && this._dy === t._dy ? 0 : this._quadrant > t._quadrant ? 1 : this._quadrant < t._quadrant ? -1 : sc.computeOrientation(t._p0, t._p1, this._p1);\n }, zh.prototype.getDy = function () {\n return this._dy;\n }, zh.prototype.getCoordinate = function () {\n return this._p0;\n }, zh.prototype.setNode = function (t) {\n this._node = t;\n }, zh.prototype.print = function (t) {\n var e = Math.atan2(this._dy, this._dx),\n n = this.getClass().getName(),\n r = n.lastIndexOf(\".\"),\n i = n.substring(r + 1);\n t.print(\" \" + i + \": \" + this._p0 + \" - \" + this._p1 + \" \" + this._quadrant + \":\" + e + \" \" + this._label);\n }, zh.prototype.compareTo = function (t) {\n var e = t;\n return this.compareDirection(e);\n }, zh.prototype.getDirectedCoordinate = function () {\n return this._p1;\n }, zh.prototype.getDx = function () {\n return this._dx;\n }, zh.prototype.getLabel = function () {\n return this._label;\n }, zh.prototype.getEdge = function () {\n return this._edge;\n }, zh.prototype.getQuadrant = function () {\n return this._quadrant;\n }, zh.prototype.getNode = function () {\n return this._node;\n }, zh.prototype.toString = function () {\n var t = Math.atan2(this._dy, this._dx),\n e = this.getClass().getName(),\n n = e.lastIndexOf(\".\");\n return \" \" + e.substring(n + 1) + \": \" + this._p0 + \" - \" + this._p1 + \" \" + this._quadrant + \":\" + t + \" \" + this._label;\n }, zh.prototype.computeLabel = function (t) {}, zh.prototype.init = function (t, e) {\n this._p0 = t, this._p1 = e, this._dx = e.x - t.x, this._dy = e.y - t.y, this._quadrant = Bh.quadrant(this._dx, this._dy), tc.isTrue(!(0 === this._dx && 0 === this._dy), \"EdgeEnd with identical endpoints found\");\n }, zh.prototype.interfaces_ = function () {\n return [xu];\n }, zh.prototype.getClass = function () {\n return zh;\n };\n var jh = function (t) {\n function e() {\n var e = arguments[0],\n n = arguments[1];\n if (t.call(this, e), this._isForward = null, this._isInResult = !1, this._isVisited = !1, this._sym = null, this._next = null, this._nextMin = null, this._edgeRing = null, this._minEdgeRing = null, this._depth = [0, -999, -999], this._isForward = n, n) this.init(e.getCoordinate(0), e.getCoordinate(1));else {\n var r = e.getNumPoints() - 1;\n this.init(e.getCoordinate(r), e.getCoordinate(r - 1));\n }\n this.computeDirectedLabel();\n }\n return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.getNextMin = function () {\n return this._nextMin;\n }, e.prototype.getDepth = function (t) {\n return this._depth[t];\n }, e.prototype.setVisited = function (t) {\n this._isVisited = t;\n }, e.prototype.computeDirectedLabel = function () {\n this._label = new Rh(this._edge.getLabel()), this._isForward || this._label.flip();\n }, e.prototype.getNext = function () {\n return this._next;\n }, e.prototype.setDepth = function (t, e) {\n if (-999 !== this._depth[t] && this._depth[t] !== e) throw new Mh(\"assigned depths do not match\", this.getCoordinate());\n this._depth[t] = e;\n }, e.prototype.isInteriorAreaEdge = function () {\n for (var t = !0, e = 0; e < 2; e++) this._label.isArea(e) && this._label.getLocation(e, Nh.LEFT) === Su.INTERIOR && this._label.getLocation(e, Nh.RIGHT) === Su.INTERIOR || (t = !1);\n return t;\n }, e.prototype.setNextMin = function (t) {\n this._nextMin = t;\n }, e.prototype.print = function (e) {\n t.prototype.print.call(this, e), e.print(\" \" + this._depth[Nh.LEFT] + \"/\" + this._depth[Nh.RIGHT]), e.print(\" (\" + this.getDepthDelta() + \")\"), this._isInResult && e.print(\" inResult\");\n }, e.prototype.setMinEdgeRing = function (t) {\n this._minEdgeRing = t;\n }, e.prototype.isLineEdge = function () {\n var t = this._label.isLine(0) || this._label.isLine(1),\n e = !this._label.isArea(0) || this._label.allPositionsEqual(0, Su.EXTERIOR),\n n = !this._label.isArea(1) || this._label.allPositionsEqual(1, Su.EXTERIOR);\n return t && e && n;\n }, e.prototype.setEdgeRing = function (t) {\n this._edgeRing = t;\n }, e.prototype.getMinEdgeRing = function () {\n return this._minEdgeRing;\n }, e.prototype.getDepthDelta = function () {\n var t = this._edge.getDepthDelta();\n return this._isForward || (t = -t), t;\n }, e.prototype.setInResult = function (t) {\n this._isInResult = t;\n }, e.prototype.getSym = function () {\n return this._sym;\n }, e.prototype.isForward = function () {\n return this._isForward;\n }, e.prototype.getEdge = function () {\n return this._edge;\n }, e.prototype.printEdge = function (t) {\n this.print(t), t.print(\" \"), this._isForward ? this._edge.print(t) : this._edge.printReverse(t);\n }, e.prototype.setSym = function (t) {\n this._sym = t;\n }, e.prototype.setVisitedEdge = function (t) {\n this.setVisited(t), this._sym.setVisited(t);\n }, e.prototype.setEdgeDepths = function (t, e) {\n var n = this.getEdge().getDepthDelta();\n this._isForward || (n = -n);\n var r = 1;\n t === Nh.LEFT && (r = -1);\n var i = Nh.opposite(t),\n o = e + n * r;\n this.setDepth(t, e), this.setDepth(i, o);\n }, e.prototype.getEdgeRing = function () {\n return this._edgeRing;\n }, e.prototype.isInResult = function () {\n return this._isInResult;\n }, e.prototype.setNext = function (t) {\n this._next = t;\n }, e.prototype.isVisited = function () {\n return this._isVisited;\n }, e.prototype.interfaces_ = function () {\n return [];\n }, e.prototype.getClass = function () {\n return e;\n }, e.depthFactor = function (t, e) {\n return t === Su.EXTERIOR && e === Su.INTERIOR ? 1 : t === Su.INTERIOR && e === Su.EXTERIOR ? -1 : 0;\n }, e;\n }(zh),\n Xh = function () {};\n Xh.prototype.createNode = function (t) {\n return new qh(t, null);\n }, Xh.prototype.interfaces_ = function () {\n return [];\n }, Xh.prototype.getClass = function () {\n return Xh;\n };\n var Uh = function () {\n if (this._edges = new bc(), this._nodes = null, this._edgeEndList = new bc(), 0 === arguments.length) this._nodes = new Gh(new Xh());else if (1 === arguments.length) {\n var t = arguments[0];\n this._nodes = new Gh(t);\n }\n };\n Uh.prototype.printEdges = function (t) {\n t.println(\"Edges:\");\n for (var e = 0; e < this._edges.size(); e++) {\n t.println(\"edge \" + e + \":\");\n var n = this._edges.get(e);\n n.print(t), n.eiList.print(t);\n }\n }, Uh.prototype.find = function (t) {\n return this._nodes.find(t);\n }, Uh.prototype.addNode = function () {\n if (arguments[0] instanceof qh) {\n var t = arguments[0];\n return this._nodes.addNode(t);\n }\n if (arguments[0] instanceof bu) {\n var e = arguments[0];\n return this._nodes.addNode(e);\n }\n }, Uh.prototype.getNodeIterator = function () {\n return this._nodes.iterator();\n }, Uh.prototype.linkResultDirectedEdges = function () {\n for (var t = this._nodes.iterator(); t.hasNext();) {\n t.next().getEdges().linkResultDirectedEdges();\n }\n }, Uh.prototype.debugPrintln = function (t) {\n Xu.out.println(t);\n }, Uh.prototype.isBoundaryNode = function (t, e) {\n var n = this._nodes.find(e);\n if (null === n) return !1;\n var r = n.getLabel();\n return null !== r && r.getLocation(t) === Su.BOUNDARY;\n }, Uh.prototype.linkAllDirectedEdges = function () {\n for (var t = this._nodes.iterator(); t.hasNext();) {\n t.next().getEdges().linkAllDirectedEdges();\n }\n }, Uh.prototype.matchInSameDirection = function (t, e, n, r) {\n return !!t.equals(n) && sc.computeOrientation(t, e, r) === sc.COLLINEAR && Bh.quadrant(t, e) === Bh.quadrant(n, r);\n }, Uh.prototype.getEdgeEnds = function () {\n return this._edgeEndList;\n }, Uh.prototype.debugPrint = function (t) {\n Xu.out.print(t);\n }, Uh.prototype.getEdgeIterator = function () {\n return this._edges.iterator();\n }, Uh.prototype.findEdgeInSameDirection = function (t, e) {\n for (var n = 0; n < this._edges.size(); n++) {\n var r = this._edges.get(n),\n i = r.getCoordinates();\n if (this.matchInSameDirection(t, e, i[0], i[1])) return r;\n if (this.matchInSameDirection(t, e, i[i.length - 1], i[i.length - 2])) return r;\n }\n return null;\n }, Uh.prototype.insertEdge = function (t) {\n this._edges.add(t);\n }, Uh.prototype.findEdgeEnd = function (t) {\n for (var e = this.getEdgeEnds().iterator(); e.hasNext();) {\n var n = e.next();\n if (n.getEdge() === t) return n;\n }\n return null;\n }, Uh.prototype.addEdges = function (t) {\n for (var e = t.iterator(); e.hasNext();) {\n var n = e.next();\n this._edges.add(n);\n var r = new jh(n, !0),\n i = new jh(n, !1);\n r.setSym(i), i.setSym(r), this.add(r), this.add(i);\n }\n }, Uh.prototype.add = function (t) {\n this._nodes.add(t), this._edgeEndList.add(t);\n }, Uh.prototype.getNodes = function () {\n return this._nodes.values();\n }, Uh.prototype.findEdge = function (t, e) {\n for (var n = 0; n < this._edges.size(); n++) {\n var r = this._edges.get(n),\n i = r.getCoordinates();\n if (t.equals(i[0]) && e.equals(i[1])) return r;\n }\n return null;\n }, Uh.prototype.interfaces_ = function () {\n return [];\n }, Uh.prototype.getClass = function () {\n return Uh;\n }, Uh.linkResultDirectedEdges = function (t) {\n for (var e = t.iterator(); e.hasNext();) {\n e.next().getEdges().linkResultDirectedEdges();\n }\n };\n var Yh = function () {\n this._geometryFactory = null, this._shellList = new bc();\n var t = arguments[0];\n this._geometryFactory = t;\n };\n Yh.prototype.sortShellsAndHoles = function (t, e, n) {\n for (var r = t.iterator(); r.hasNext();) {\n var i = r.next();\n i.isHole() ? n.add(i) : e.add(i);\n }\n }, Yh.prototype.computePolygons = function (t) {\n for (var e = new bc(), n = t.iterator(); n.hasNext();) {\n var r = n.next().toPolygon(this._geometryFactory);\n e.add(r);\n }\n return e;\n }, Yh.prototype.placeFreeHoles = function (t, e) {\n for (var n = e.iterator(); n.hasNext();) {\n var r = n.next();\n if (null === r.getShell()) {\n var i = this.findEdgeRingContaining(r, t);\n if (null === i) throw new Mh(\"unable to assign hole to a shell\", r.getCoordinate(0));\n r.setShell(i);\n }\n }\n }, Yh.prototype.buildMinimalEdgeRings = function (t, e, n) {\n for (var r = new bc(), i = t.iterator(); i.hasNext();) {\n var o = i.next();\n if (o.getMaxNodeDegree() > 2) {\n o.linkDirectedEdgesForMinimalEdgeRings();\n var s = o.buildMinimalRings(),\n a = this.findShell(s);\n null !== a ? (this.placePolygonHoles(a, s), e.add(a)) : n.addAll(s);\n } else r.add(o);\n }\n return r;\n }, Yh.prototype.containsPoint = function (t) {\n for (var e = this._shellList.iterator(); e.hasNext();) {\n if (e.next().containsPoint(t)) return !0;\n }\n return !1;\n }, Yh.prototype.buildMaximalEdgeRings = function (t) {\n for (var e = new bc(), n = t.iterator(); n.hasNext();) {\n var r = n.next();\n if (r.isInResult() && r.getLabel().isArea() && null === r.getEdgeRing()) {\n var i = new Dh(r, this._geometryFactory);\n e.add(i), i.setInResult();\n }\n }\n return e;\n }, Yh.prototype.placePolygonHoles = function (t, e) {\n for (var n = e.iterator(); n.hasNext();) {\n var r = n.next();\n r.isHole() && r.setShell(t);\n }\n }, Yh.prototype.getPolygons = function () {\n return this.computePolygons(this._shellList);\n }, Yh.prototype.findEdgeRingContaining = function (t, e) {\n for (var n = t.getLinearRing(), r = n.getEnvelopeInternal(), i = n.getCoordinateN(0), o = null, s = null, a = e.iterator(); a.hasNext();) {\n var u = a.next(),\n c = u.getLinearRing(),\n h = c.getEnvelopeInternal();\n null !== o && (s = o.getLinearRing().getEnvelopeInternal());\n var l = !1;\n h.contains(r) && sc.isPointInRing(i, c.getCoordinates()) && (l = !0), l && (null === o || s.contains(h)) && (o = u);\n }\n return o;\n }, Yh.prototype.findShell = function (t) {\n for (var e = 0, n = null, r = t.iterator(); r.hasNext();) {\n var i = r.next();\n i.isHole() || (n = i, e++);\n }\n return tc.isTrue(e <= 1, \"found two shells in MinimalEdgeRing list\"), n;\n }, Yh.prototype.add = function () {\n if (1 === arguments.length) {\n var t = arguments[0];\n this.add(t.getEdgeEnds(), t.getNodes());\n } else if (2 === arguments.length) {\n var e = arguments[0],\n n = arguments[1];\n Uh.linkResultDirectedEdges(n);\n var r = this.buildMaximalEdgeRings(e),\n i = new bc(),\n o = this.buildMinimalEdgeRings(r, this._shellList, i);\n this.sortShellsAndHoles(o, this._shellList, i), this.placeFreeHoles(this._shellList, i);\n }\n }, Yh.prototype.interfaces_ = function () {\n return [];\n }, Yh.prototype.getClass = function () {\n return Yh;\n };\n var Vh = function () {};\n Vh.prototype.getBounds = function () {}, Vh.prototype.interfaces_ = function () {\n return [];\n }, Vh.prototype.getClass = function () {\n return Vh;\n };\n var Hh = function () {\n this._bounds = null, this._item = null;\n var t = arguments[0],\n e = arguments[1];\n this._bounds = t, this._item = e;\n };\n Hh.prototype.getItem = function () {\n return this._item;\n }, Hh.prototype.getBounds = function () {\n return this._bounds;\n }, Hh.prototype.interfaces_ = function () {\n return [Vh, Li];\n }, Hh.prototype.getClass = function () {\n return Hh;\n };\n var Wh = function () {\n this._size = null, this._items = null, this._size = 0, this._items = new bc(), this._items.add(null);\n };\n Wh.prototype.poll = function () {\n if (this.isEmpty()) return null;\n var t = this._items.get(1);\n return this._items.set(1, this._items.get(this._size)), this._size -= 1, this.reorder(1), t;\n }, Wh.prototype.size = function () {\n return this._size;\n }, Wh.prototype.reorder = function (t) {\n for (var e = null, n = this._items.get(t); 2 * t <= this._size && ((e = 2 * t) !== this._size && this._items.get(e + 1).compareTo(this._items.get(e)) < 0 && e++, this._items.get(e).compareTo(n) < 0); t = e) this._items.set(t, this._items.get(e));\n this._items.set(t, n);\n }, Wh.prototype.clear = function () {\n this._size = 0, this._items.clear();\n }, Wh.prototype.isEmpty = function () {\n return 0 === this._size;\n }, Wh.prototype.add = function (t) {\n this._items.add(null), this._size += 1;\n var e = this._size;\n for (this._items.set(0, t); t.compareTo(this._items.get(Math.trunc(e / 2))) < 0; e /= 2) this._items.set(e, this._items.get(Math.trunc(e / 2)));\n this._items.set(e, t);\n }, Wh.prototype.interfaces_ = function () {\n return [];\n }, Wh.prototype.getClass = function () {\n return Wh;\n };\n var Jh = function () {};\n Jh.prototype.visitItem = function (t) {}, Jh.prototype.interfaces_ = function () {\n return [];\n }, Jh.prototype.getClass = function () {\n return Jh;\n };\n var Zh = function () {};\n Zh.prototype.insert = function (t, e) {}, Zh.prototype.remove = function (t, e) {}, Zh.prototype.query = function () {}, Zh.prototype.interfaces_ = function () {\n return [];\n }, Zh.prototype.getClass = function () {\n return Zh;\n };\n var Kh = function () {\n if (this._childBoundables = new bc(), this._bounds = null, this._level = null, 0 === arguments.length) ;else if (1 === arguments.length) {\n var t = arguments[0];\n this._level = t;\n }\n },\n Qh = {\n serialVersionUID: {\n configurable: !0\n }\n };\n Kh.prototype.getLevel = function () {\n return this._level;\n }, Kh.prototype.size = function () {\n return this._childBoundables.size();\n }, Kh.prototype.getChildBoundables = function () {\n return this._childBoundables;\n }, Kh.prototype.addChildBoundable = function (t) {\n tc.isTrue(null === this._bounds), this._childBoundables.add(t);\n }, Kh.prototype.isEmpty = function () {\n return this._childBoundables.isEmpty();\n }, Kh.prototype.getBounds = function () {\n return null === this._bounds && (this._bounds = this.computeBounds()), this._bounds;\n }, Kh.prototype.interfaces_ = function () {\n return [Vh, Li];\n }, Kh.prototype.getClass = function () {\n return Kh;\n }, Qh.serialVersionUID.get = function () {\n return 0x5a1e55ec41369800;\n }, Object.defineProperties(Kh, Qh);\n var $h = function () {};\n $h.reverseOrder = function () {\n return {\n compare: function (t, e) {\n return e.compareTo(t);\n }\n };\n }, $h.min = function (t) {\n return $h.sort(t), t.get(0);\n }, $h.sort = function (t, e) {\n var n = t.toArray();\n e ? qc.sort(n, e) : qc.sort(n);\n for (var r = t.iterator(), i = 0, o = n.length; i < o; i++) r.next(), r.set(n[i]);\n }, $h.singletonList = function (t) {\n var e = new bc();\n return e.add(t), e;\n };\n var tl = function () {\n this._boundable1 = null, this._boundable2 = null, this._distance = null, this._itemDistance = null;\n var t = arguments[0],\n e = arguments[1],\n n = arguments[2];\n this._boundable1 = t, this._boundable2 = e, this._itemDistance = n, this._distance = this.distance();\n };\n tl.prototype.expandToQueue = function (t, e) {\n var n = tl.isComposite(this._boundable1),\n r = tl.isComposite(this._boundable2);\n if (n && r) return tl.area(this._boundable1) > tl.area(this._boundable2) ? (this.expand(this._boundable1, this._boundable2, t, e), null) : (this.expand(this._boundable2, this._boundable1, t, e), null);\n if (n) return this.expand(this._boundable1, this._boundable2, t, e), null;\n if (r) return this.expand(this._boundable2, this._boundable1, t, e), null;\n throw new _u(\"neither boundable is composite\");\n }, tl.prototype.isLeaves = function () {\n return !(tl.isComposite(this._boundable1) || tl.isComposite(this._boundable2));\n }, tl.prototype.compareTo = function (t) {\n var e = t;\n return this._distance < e._distance ? -1 : this._distance > e._distance ? 1 : 0;\n }, tl.prototype.expand = function (t, e, n, r) {\n for (var i = t.getChildBoundables().iterator(); i.hasNext();) {\n var o = i.next(),\n s = new tl(o, e, this._itemDistance);\n s.getDistance() < r && n.add(s);\n }\n }, tl.prototype.getBoundable = function (t) {\n return 0 === t ? this._boundable1 : this._boundable2;\n }, tl.prototype.getDistance = function () {\n return this._distance;\n }, tl.prototype.distance = function () {\n return this.isLeaves() ? this._itemDistance.distance(this._boundable1, this._boundable2) : this._boundable1.getBounds().distance(this._boundable2.getBounds());\n }, tl.prototype.interfaces_ = function () {\n return [xu];\n }, tl.prototype.getClass = function () {\n return tl;\n }, tl.area = function (t) {\n return t.getBounds().getArea();\n }, tl.isComposite = function (t) {\n return t instanceof Kh;\n };\n var el = function t() {\n if (this._root = null, this._built = !1, this._itemBoundables = new bc(), this._nodeCapacity = null, 0 === arguments.length) {\n var e = t.DEFAULT_NODE_CAPACITY;\n this._nodeCapacity = e;\n } else if (1 === arguments.length) {\n var n = arguments[0];\n tc.isTrue(n > 1, \"Node capacity must be greater than 1\"), this._nodeCapacity = n;\n }\n },\n nl = {\n IntersectsOp: {\n configurable: !0\n },\n serialVersionUID: {\n configurable: !0\n },\n DEFAULT_NODE_CAPACITY: {\n configurable: !0\n }\n };\n el.prototype.getNodeCapacity = function () {\n return this._nodeCapacity;\n }, el.prototype.lastNode = function (t) {\n return t.get(t.size() - 1);\n }, el.prototype.size = function () {\n if (0 === arguments.length) return this.isEmpty() ? 0 : (this.build(), this.size(this._root));\n if (1 === arguments.length) {\n for (var t = 0, e = arguments[0].getChildBoundables().iterator(); e.hasNext();) {\n var n = e.next();\n n instanceof Kh ? t += this.size(n) : n instanceof Hh && (t += 1);\n }\n return t;\n }\n }, el.prototype.removeItem = function (t, e) {\n for (var n = null, r = t.getChildBoundables().iterator(); r.hasNext();) {\n var i = r.next();\n i instanceof Hh && i.getItem() === e && (n = i);\n }\n return null !== n && (t.getChildBoundables().remove(n), !0);\n }, el.prototype.itemsTree = function () {\n if (0 === arguments.length) {\n this.build();\n var t = this.itemsTree(this._root);\n return null === t ? new bc() : t;\n }\n if (1 === arguments.length) {\n for (var e = arguments[0], n = new bc(), r = e.getChildBoundables().iterator(); r.hasNext();) {\n var i = r.next();\n if (i instanceof Kh) {\n var o = this.itemsTree(i);\n null !== o && n.add(o);\n } else i instanceof Hh ? n.add(i.getItem()) : tc.shouldNeverReachHere();\n }\n return n.size() <= 0 ? null : n;\n }\n }, el.prototype.insert = function (t, e) {\n tc.isTrue(!this._built, \"Cannot insert items into an STR packed R-tree after it has been built.\"), this._itemBoundables.add(new Hh(t, e));\n }, el.prototype.boundablesAtLevel = function () {\n if (1 === arguments.length) {\n var t = arguments[0],\n e = new bc();\n return this.boundablesAtLevel(t, this._root, e), e;\n }\n if (3 === arguments.length) {\n var n = arguments[0],\n r = arguments[1],\n i = arguments[2];\n if (tc.isTrue(n > -2), r.getLevel() === n) return i.add(r), null;\n for (var o = r.getChildBoundables().iterator(); o.hasNext();) {\n var s = o.next();\n s instanceof Kh ? this.boundablesAtLevel(n, s, i) : (tc.isTrue(s instanceof Hh), -1 === n && i.add(s));\n }\n return null;\n }\n }, el.prototype.query = function () {\n if (1 === arguments.length) {\n var t = arguments[0];\n this.build();\n var e = new bc();\n return this.isEmpty() ? e : (this.getIntersectsOp().intersects(this._root.getBounds(), t) && this.query(t, this._root, e), e);\n }\n if (2 === arguments.length) {\n var n = arguments[0],\n r = arguments[1];\n if (this.build(), this.isEmpty()) return null;\n this.getIntersectsOp().intersects(this._root.getBounds(), n) && this.query(n, this._root, r);\n } else if (3 === arguments.length) if (Lu(arguments[2], Jh) && arguments[0] instanceof Object && arguments[1] instanceof Kh) for (var i = arguments[0], o = arguments[1], s = arguments[2], a = o.getChildBoundables(), u = 0; u < a.size(); u++) {\n var c = a.get(u);\n this.getIntersectsOp().intersects(c.getBounds(), i) && (c instanceof Kh ? this.query(i, c, s) : c instanceof Hh ? s.visitItem(c.getItem()) : tc.shouldNeverReachHere());\n } else if (Lu(arguments[2], wc) && arguments[0] instanceof Object && arguments[1] instanceof Kh) for (var h = arguments[0], l = arguments[1], p = arguments[2], f = l.getChildBoundables(), g = 0; g < f.size(); g++) {\n var d = f.get(g);\n this.getIntersectsOp().intersects(d.getBounds(), h) && (d instanceof Kh ? this.query(h, d, p) : d instanceof Hh ? p.add(d.getItem()) : tc.shouldNeverReachHere());\n }\n }, el.prototype.build = function () {\n if (this._built) return null;\n this._root = this._itemBoundables.isEmpty() ? this.createNode(0) : this.createHigherLevels(this._itemBoundables, -1), this._itemBoundables = null, this._built = !0;\n }, el.prototype.getRoot = function () {\n return this.build(), this._root;\n }, el.prototype.remove = function () {\n if (2 === arguments.length) {\n var t = arguments[0],\n e = arguments[1];\n return this.build(), !!this.getIntersectsOp().intersects(this._root.getBounds(), t) && this.remove(t, this._root, e);\n }\n if (3 === arguments.length) {\n var n = arguments[0],\n r = arguments[1],\n i = arguments[2],\n o = this.removeItem(r, i);\n if (o) return !0;\n for (var s = null, a = r.getChildBoundables().iterator(); a.hasNext();) {\n var u = a.next();\n if (this.getIntersectsOp().intersects(u.getBounds(), n) && u instanceof Kh && (o = this.remove(n, u, i))) {\n s = u;\n break;\n }\n }\n return null !== s && s.getChildBoundables().isEmpty() && r.getChildBoundables().remove(s), o;\n }\n }, el.prototype.createHigherLevels = function (t, e) {\n tc.isTrue(!t.isEmpty());\n var n = this.createParentBoundables(t, e + 1);\n return 1 === n.size() ? n.get(0) : this.createHigherLevels(n, e + 1);\n }, el.prototype.depth = function () {\n if (0 === arguments.length) return this.isEmpty() ? 0 : (this.build(), this.depth(this._root));\n if (1 === arguments.length) {\n for (var t = 0, e = arguments[0].getChildBoundables().iterator(); e.hasNext();) {\n var n = e.next();\n if (n instanceof Kh) {\n var r = this.depth(n);\n r > t && (t = r);\n }\n }\n return t + 1;\n }\n }, el.prototype.createParentBoundables = function (t, e) {\n tc.isTrue(!t.isEmpty());\n var n = new bc();\n n.add(this.createNode(e));\n var r = new bc(t);\n $h.sort(r, this.getComparator());\n for (var i = r.iterator(); i.hasNext();) {\n var o = i.next();\n this.lastNode(n).getChildBoundables().size() === this.getNodeCapacity() && n.add(this.createNode(e)), this.lastNode(n).addChildBoundable(o);\n }\n return n;\n }, el.prototype.isEmpty = function () {\n return this._built ? this._root.isEmpty() : this._itemBoundables.isEmpty();\n }, el.prototype.interfaces_ = function () {\n return [Li];\n }, el.prototype.getClass = function () {\n return el;\n }, el.compareDoubles = function (t, e) {\n return t > e ? 1 : t < e ? -1 : 0;\n }, nl.IntersectsOp.get = function () {\n return rl;\n }, nl.serialVersionUID.get = function () {\n return -0x35ef64c82d4c5400;\n }, nl.DEFAULT_NODE_CAPACITY.get = function () {\n return 10;\n }, Object.defineProperties(el, nl);\n var rl = function () {},\n il = function () {};\n il.prototype.distance = function (t, e) {}, il.prototype.interfaces_ = function () {\n return [];\n }, il.prototype.getClass = function () {\n return il;\n };\n var ol = function (t) {\n function e(n) {\n n = n || e.DEFAULT_NODE_CAPACITY, t.call(this, n);\n }\n t && (e.__proto__ = t), (e.prototype = Object.create(t && t.prototype)).constructor = e;\n var n = {\n STRtreeNode: {\n configurable: !0\n },\n serialVersionUID: {\n configurable: !0\n },\n xComparator: {\n configurable: !0\n },\n yComparator: {\n configurable: !0\n },\n intersectsOp: {\n configurable: !0\n },\n DEFAULT_NODE_CAPACITY: {\n configurable: !0\n }\n };\n return e.prototype.createParentBoundablesFromVerticalSlices = function (t, e) {\n tc.isTrue(t.length > 0);\n for (var n = new bc(), r = 0; r < t.length; r++) n.addAll(this.createParentBoundablesFromVerticalSlice(t[r], e));\n return n;\n }, e.prototype.createNode = function (t) {\n return new sl(t);\n }, e.prototype.size = function () {\n return 0 === arguments.length ? t.prototype.size.call(this) : t.prototype.size.apply(this, arguments);\n }, e.prototype.insert = function () {\n if (2 !== arguments.length) return t.prototype.insert.apply(this, arguments);\n var e = arguments[0],\n n = arguments[1];\n if (e.isNull()) return null;\n t.prototype.insert.call(this, e, n);\n }, e.prototype.getIntersectsOp = function () {\n return e.intersectsOp;\n }, e.prototype.verticalSlices = function (t, e) {\n for (var n = Math.trunc(Math.ceil(t.size() / e)), r = new Array(e).fill(null), i = t.iterator(), o = 0; o < e; o++) {\n r[o] = new bc();\n for (var s = 0; i.hasNext() && s < n;) {\n var a = i.next();\n r[o].add(a), s++;\n }\n }\n return r;\n }, e.prototype.query = function () {\n if (1 === arguments.length) {\n var e = arguments[0];\n return t.prototype.query.call(this, e);\n }\n if (2 === arguments.length) {\n var n = arguments[0],\n r = arguments[1];\n t.prototype.query.call(this, n, r);\n } else if (3 === arguments.length) if (Lu(arguments[2], Jh) && arguments[0] instanceof Object && arguments[1] instanceof Kh) {\n var i = arguments[0],\n o = arguments[1],\n s = arguments[2];\n t.prototype.query.call(this, i, o, s);\n } else if (Lu(arguments[2], wc) && arguments[0] instanceof Object && arguments[1] instanceof Kh) {\n var a = arguments[0],\n u = arguments[1],\n c = arguments[2];\n t.prototype.query.call(this, a, u, c);\n }\n }, e.prototype.getComparator = function () {\n return e.yComparator;\n }, e.prototype.createParentBoundablesFromVerticalSlice = function (e, n) {\n return t.prototype.createParentBoundables.call(this, e, n);\n }, e.prototype.remove = function () {\n if (2 === arguments.length) {\n var e = arguments[0],\n n = arguments[1];\n return t.prototype.remove.call(this, e, n);\n }\n return t.prototype.remove.apply(this, arguments);\n }, e.prototype.depth = function () {\n return 0 === arguments.length ? t.prototype.depth.call(this) : t.prototype.depth.apply(this, arguments);\n }, e.prototype.createParentBoundables = function (t, n) {\n tc.isTrue(!t.isEmpty());\n var r = Math.trunc(Math.ceil(t.size() / this.getNodeCapacity())),\n i = new bc(t);\n $h.sort(i, e.xComparator);\n var o = this.verticalSlices(i, Math.trunc(Math.ceil(Math.sqrt(r))));\n return this.createParentBoundablesFromVerticalSlices(o, n);\n }, e.prototype.nearestNeighbour = function () {\n if (1 === arguments.length) {\n if (Lu(arguments[0], il)) {\n var t = arguments[0],\n n = new tl(this.getRoot(), this.getRoot(), t);\n return this.nearestNeighbour(n);\n }\n if (arguments[0] instanceof tl) {\n var r = arguments[0];\n return this.nearestNeighbour(r, mu.POSITIVE_INFINITY);\n }\n } else if (2 === arguments.length) {\n if (arguments[0] instanceof e && Lu(arguments[1], il)) {\n var i = arguments[0],\n o = arguments[1],\n s = new tl(this.getRoot(), i.getRoot(), o);\n return this.nearestNeighbour(s);\n }\n if (arguments[0] instanceof tl && \"number\" == typeof arguments[1]) {\n var a = arguments[0],\n u = arguments[1],\n c = null,\n h = new Wh();\n for (h.add(a); !h.isEmpty() && u > 0;) {\n var l = h.poll(),\n p = l.getDistance();\n if (p >= u) break;\n l.isLeaves() ? (u = p, c = l) : l.expandToQueue(h, u);\n }\n return [c.getBoundable(0).getItem(), c.getBoundable(1).getItem()];\n }\n } else if (3 === arguments.length) {\n var f = arguments[0],\n g = arguments[1],\n d = arguments[2],\n y = new Hh(f, g),\n _ = new tl(this.getRoot(), y, d);\n return this.nearestNeighbour(_)[0];\n }\n }, e.prototype.interfaces_ = function () {\n return [Zh, Li];\n }, e.prototype.getClass = function () {\n return e;\n }, e.centreX = function (t) {\n return e.avg(t.getMinX(), t.getMaxX());\n }, e.avg = function (t, e) {\n return (t + e) / 2;\n }, e.centreY = function (t) {\n return e.avg(t.getMinY(), t.getMaxY());\n }, n.STRtreeNode.get = function () {\n return sl;\n }, n.serialVersionUID.get = function () {\n return 0x39920f7d5f261e0;\n }, n.xComparator.get = function () {\n return {\n interfaces_: function () {\n return [wu];\n },\n compare: function (n, r) {\n return t.compareDoubles(e.centreX(n.getBounds()), e.centreX(r.getBounds()));\n }\n };\n }, n.yComparator.get = function () {\n return {\n interfaces_: function () {\n return [wu];\n },\n compare: function (n, r) {\n return t.compareDoubles(e.centreY(n.getBounds()), e.centreY(r.getBounds()));\n }\n };\n }, n.intersectsOp.get = function () {\n return {\n interfaces_: function () {\n return [t.IntersectsOp];\n },\n intersects: function (t, e) {\n return t.intersects(e);\n }\n };\n }, n.DEFAULT_NODE_CAPACITY.get = function () {\n return 10;\n }, Object.defineProperties(e, n), e;\n }(el),\n sl = function (t) {\n function e() {\n var e = arguments[0];\n t.call(this, e);\n }\n return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.computeBounds = function () {\n for (var t = null, e = this.getChildBoundables().iterator(); e.hasNext();) {\n var n = e.next();\n null === t ? t = new Yu(n.getBounds()) : t.expandToInclude(n.getBounds());\n }\n return t;\n }, e.prototype.interfaces_ = function () {\n return [];\n }, e.prototype.getClass = function () {\n return e;\n }, e;\n }(Kh),\n al = function () {};\n al.prototype.interfaces_ = function () {\n return [];\n }, al.prototype.getClass = function () {\n return al;\n }, al.relativeSign = function (t, e) {\n return t < e ? -1 : t > e ? 1 : 0;\n }, al.compare = function (t, e, n) {\n if (e.equals2D(n)) return 0;\n var r = al.relativeSign(e.x, n.x),\n i = al.relativeSign(e.y, n.y);\n switch (t) {\n case 0:\n return al.compareValue(r, i);\n case 1:\n return al.compareValue(i, r);\n case 2:\n return al.compareValue(i, -r);\n case 3:\n return al.compareValue(-r, i);\n case 4:\n return al.compareValue(-r, -i);\n case 5:\n return al.compareValue(-i, -r);\n case 6:\n return al.compareValue(-i, r);\n case 7:\n return al.compareValue(r, -i);\n }\n return tc.shouldNeverReachHere(\"invalid octant value\"), 0;\n }, al.compareValue = function (t, e) {\n return t < 0 ? -1 : t > 0 ? 1 : e < 0 ? -1 : e > 0 ? 1 : 0;\n };\n var ul = function () {\n this._segString = null, this.coord = null, this.segmentIndex = null, this._segmentOctant = null, this._isInterior = null;\n var t = arguments[0],\n e = arguments[1],\n n = arguments[2],\n r = arguments[3];\n this._segString = t, this.coord = new bu(e), this.segmentIndex = n, this._segmentOctant = r, this._isInterior = !e.equals2D(t.getCoordinate(n));\n };\n ul.prototype.getCoordinate = function () {\n return this.coord;\n }, ul.prototype.print = function (t) {\n t.print(this.coord), t.print(\" seg # = \" + this.segmentIndex);\n }, ul.prototype.compareTo = function (t) {\n var e = t;\n return this.segmentIndex < e.segmentIndex ? -1 : this.segmentIndex > e.segmentIndex ? 1 : this.coord.equals2D(e.coord) ? 0 : al.compare(this._segmentOctant, this.coord, e.coord);\n }, ul.prototype.isEndPoint = function (t) {\n return 0 === this.segmentIndex && !this._isInterior || this.segmentIndex === t;\n }, ul.prototype.isInterior = function () {\n return this._isInterior;\n }, ul.prototype.interfaces_ = function () {\n return [xu];\n }, ul.prototype.getClass = function () {\n return ul;\n };\n var cl = function () {\n this._nodeMap = new Gi(), this._edge = null;\n var t = arguments[0];\n this._edge = t;\n };\n cl.prototype.getSplitCoordinates = function () {\n var t = new Nc();\n this.addEndpoints();\n for (var e = this.iterator(), n = e.next(); e.hasNext();) {\n var r = e.next();\n this.addEdgeCoordinates(n, r, t), n = r;\n }\n return t.toCoordinateArray();\n }, cl.prototype.addCollapsedNodes = function () {\n var t = new bc();\n this.findCollapsesFromInsertedNodes(t), this.findCollapsesFromExistingVertices(t);\n for (var e = t.iterator(); e.hasNext();) {\n var n = e.next().intValue();\n this.add(this._edge.getCoordinate(n), n);\n }\n }, cl.prototype.print = function (t) {\n t.println(\"Intersections:\");\n for (var e = this.iterator(); e.hasNext();) {\n e.next().print(t);\n }\n }, cl.prototype.findCollapsesFromExistingVertices = function (t) {\n for (var e = 0; e < this._edge.size() - 2; e++) {\n var n = this._edge.getCoordinate(e),\n r = this._edge.getCoordinate(e + 2);\n n.equals2D(r) && t.add(new Tu(e + 1));\n }\n }, cl.prototype.addEdgeCoordinates = function (t, e, n) {\n var r = this._edge.getCoordinate(e.segmentIndex),\n i = e.isInterior() || !e.coord.equals2D(r);\n n.add(new bu(t.coord), !1);\n for (var o = t.segmentIndex + 1; o <= e.segmentIndex; o++) n.add(this._edge.getCoordinate(o));\n i && n.add(new bu(e.coord));\n }, cl.prototype.iterator = function () {\n return this._nodeMap.values().iterator();\n }, cl.prototype.addSplitEdges = function (t) {\n this.addEndpoints(), this.addCollapsedNodes();\n for (var e = this.iterator(), n = e.next(); e.hasNext();) {\n var r = e.next(),\n i = this.createSplitEdge(n, r);\n t.add(i), n = r;\n }\n }, cl.prototype.findCollapseIndex = function (t, e, n) {\n if (!t.coord.equals2D(e.coord)) return !1;\n var r = e.segmentIndex - t.segmentIndex;\n return e.isInterior() || r--, 1 === r && (n[0] = t.segmentIndex + 1, !0);\n }, cl.prototype.findCollapsesFromInsertedNodes = function (t) {\n for (var e = new Array(1).fill(null), n = this.iterator(), r = n.next(); n.hasNext();) {\n var i = n.next();\n this.findCollapseIndex(r, i, e) && t.add(new Tu(e[0])), r = i;\n }\n }, cl.prototype.getEdge = function () {\n return this._edge;\n }, cl.prototype.addEndpoints = function () {\n var t = this._edge.size() - 1;\n this.add(this._edge.getCoordinate(0), 0), this.add(this._edge.getCoordinate(t), t);\n }, cl.prototype.createSplitEdge = function (t, e) {\n var n = e.segmentIndex - t.segmentIndex + 2,\n r = this._edge.getCoordinate(e.segmentIndex),\n i = e.isInterior() || !e.coord.equals2D(r);\n i || n--;\n var o = new Array(n).fill(null),\n s = 0;\n o[s++] = new bu(t.coord);\n for (var a = t.segmentIndex + 1; a <= e.segmentIndex; a++) o[s++] = this._edge.getCoordinate(a);\n return i && (o[s] = new bu(e.coord)), new fl(o, this._edge.getData());\n }, cl.prototype.add = function (t, e) {\n var n = new ul(this._edge, t, e, this._edge.getSegmentOctant(e)),\n r = this._nodeMap.get(n);\n return null !== r ? (tc.isTrue(r.coord.equals2D(t), \"Found equal nodes with different coordinates\"), r) : (this._nodeMap.put(n, n), n);\n }, cl.prototype.checkSplitEdgesCorrectness = function (t) {\n var e = this._edge.getCoordinates(),\n n = t.get(0).getCoordinate(0);\n if (!n.equals2D(e[0])) throw new Qu(\"bad split edge start point at \" + n);\n var r = t.get(t.size() - 1).getCoordinates(),\n i = r[r.length - 1];\n if (!i.equals2D(e[e.length - 1])) throw new Qu(\"bad split edge end point at \" + i);\n }, cl.prototype.interfaces_ = function () {\n return [];\n }, cl.prototype.getClass = function () {\n return cl;\n };\n var hl = function () {};\n hl.prototype.interfaces_ = function () {\n return [];\n }, hl.prototype.getClass = function () {\n return hl;\n }, hl.octant = function () {\n if (\"number\" == typeof arguments[0] && \"number\" == typeof arguments[1]) {\n var t = arguments[0],\n e = arguments[1];\n if (0 === t && 0 === e) throw new _u(\"Cannot compute the octant for point ( \" + t + \", \" + e + \" )\");\n var n = Math.abs(t),\n r = Math.abs(e);\n return t >= 0 ? e >= 0 ? n >= r ? 0 : 1 : n >= r ? 7 : 6 : e >= 0 ? n >= r ? 3 : 2 : n >= r ? 4 : 5;\n }\n if (arguments[0] instanceof bu && arguments[1] instanceof bu) {\n var i = arguments[0],\n o = arguments[1],\n s = o.x - i.x,\n a = o.y - i.y;\n if (0 === s && 0 === a) throw new _u(\"Cannot compute the octant for two identical points \" + i);\n return hl.octant(s, a);\n }\n };\n var ll = function () {};\n ll.prototype.getCoordinates = function () {}, ll.prototype.size = function () {}, ll.prototype.getCoordinate = function (t) {}, ll.prototype.isClosed = function () {}, ll.prototype.setData = function (t) {}, ll.prototype.getData = function () {}, ll.prototype.interfaces_ = function () {\n return [];\n }, ll.prototype.getClass = function () {\n return ll;\n };\n var pl = function () {};\n pl.prototype.addIntersection = function (t, e) {}, pl.prototype.interfaces_ = function () {\n return [ll];\n }, pl.prototype.getClass = function () {\n return pl;\n };\n var fl = function () {\n this._nodeList = new cl(this), this._pts = null, this._data = null;\n var t = arguments[0],\n e = arguments[1];\n this._pts = t, this._data = e;\n };\n fl.prototype.getCoordinates = function () {\n return this._pts;\n }, fl.prototype.size = function () {\n return this._pts.length;\n }, fl.prototype.getCoordinate = function (t) {\n return this._pts[t];\n }, fl.prototype.isClosed = function () {\n return this._pts[0].equals(this._pts[this._pts.length - 1]);\n }, fl.prototype.getSegmentOctant = function (t) {\n return t === this._pts.length - 1 ? -1 : this.safeOctant(this.getCoordinate(t), this.getCoordinate(t + 1));\n }, fl.prototype.setData = function (t) {\n this._data = t;\n }, fl.prototype.safeOctant = function (t, e) {\n return t.equals2D(e) ? 0 : hl.octant(t, e);\n }, fl.prototype.getData = function () {\n return this._data;\n }, fl.prototype.addIntersection = function () {\n if (2 === arguments.length) {\n var t = arguments[0],\n e = arguments[1];\n this.addIntersectionNode(t, e);\n } else if (4 === arguments.length) {\n var n = arguments[0],\n r = arguments[1],\n i = arguments[3],\n o = new bu(n.getIntersection(i));\n this.addIntersection(o, r);\n }\n }, fl.prototype.toString = function () {\n return Ku.toLineString(new uh(this._pts));\n }, fl.prototype.getNodeList = function () {\n return this._nodeList;\n }, fl.prototype.addIntersectionNode = function (t, e) {\n var n = e,\n r = n + 1;\n if (r < this._pts.length) {\n var i = this._pts[r];\n t.equals2D(i) && (n = r);\n }\n return this._nodeList.add(t, n);\n }, fl.prototype.addIntersections = function (t, e, n) {\n for (var r = 0; r < t.getIntersectionNum(); r++) this.addIntersection(t, e, n, r);\n }, fl.prototype.interfaces_ = function () {\n return [pl];\n }, fl.prototype.getClass = function () {\n return fl;\n }, fl.getNodedSubstrings = function () {\n if (1 === arguments.length) {\n var t = arguments[0],\n e = new bc();\n return fl.getNodedSubstrings(t, e), e;\n }\n if (2 === arguments.length) for (var n = arguments[0], r = arguments[1], i = n.iterator(); i.hasNext();) {\n i.next().getNodeList().addSplitEdges(r);\n }\n };\n var gl = function () {\n if (this.p0 = null, this.p1 = null, 0 === arguments.length) this.p0 = new bu(), this.p1 = new bu();else if (1 === arguments.length) {\n var t = arguments[0];\n this.p0 = new bu(t.p0), this.p1 = new bu(t.p1);\n } else if (2 === arguments.length) this.p0 = arguments[0], this.p1 = arguments[1];else if (4 === arguments.length) {\n var e = arguments[0],\n n = arguments[1],\n r = arguments[2],\n i = arguments[3];\n this.p0 = new bu(e, n), this.p1 = new bu(r, i);\n }\n },\n dl = {\n serialVersionUID: {\n configurable: !0\n }\n };\n gl.prototype.minX = function () {\n return Math.min(this.p0.x, this.p1.x);\n }, gl.prototype.orientationIndex = function () {\n if (arguments[0] instanceof gl) {\n var t = arguments[0],\n e = sc.orientationIndex(this.p0, this.p1, t.p0),\n n = sc.orientationIndex(this.p0, this.p1, t.p1);\n return e >= 0 && n >= 0 ? Math.max(e, n) : e <= 0 && n <= 0 ? Math.max(e, n) : 0;\n }\n if (arguments[0] instanceof bu) {\n var r = arguments[0];\n return sc.orientationIndex(this.p0, this.p1, r);\n }\n }, gl.prototype.toGeometry = function (t) {\n return t.createLineString([this.p0, this.p1]);\n }, gl.prototype.isVertical = function () {\n return this.p0.x === this.p1.x;\n }, gl.prototype.equals = function (t) {\n if (!(t instanceof gl)) return !1;\n var e = t;\n return this.p0.equals(e.p0) && this.p1.equals(e.p1);\n }, gl.prototype.intersection = function (t) {\n var e = new rc();\n return e.computeIntersection(this.p0, this.p1, t.p0, t.p1), e.hasIntersection() ? e.getIntersection(0) : null;\n }, gl.prototype.project = function () {\n if (arguments[0] instanceof bu) {\n var t = arguments[0];\n if (t.equals(this.p0) || t.equals(this.p1)) return new bu(t);\n var e = this.projectionFactor(t),\n n = new bu();\n return n.x = this.p0.x + e * (this.p1.x - this.p0.x), n.y = this.p0.y + e * (this.p1.y - this.p0.y), n;\n }\n if (arguments[0] instanceof gl) {\n var r = arguments[0],\n i = this.projectionFactor(r.p0),\n o = this.projectionFactor(r.p1);\n if (i >= 1 && o >= 1) return null;\n if (i <= 0 && o <= 0) return null;\n var s = this.project(r.p0);\n i < 0 && (s = this.p0), i > 1 && (s = this.p1);\n var a = this.project(r.p1);\n return o < 0 && (a = this.p0), o > 1 && (a = this.p1), new gl(s, a);\n }\n }, gl.prototype.normalize = function () {\n this.p1.compareTo(this.p0) < 0 && this.reverse();\n }, gl.prototype.angle = function () {\n return Math.atan2(this.p1.y - this.p0.y, this.p1.x - this.p0.x);\n }, gl.prototype.getCoordinate = function (t) {\n return 0 === t ? this.p0 : this.p1;\n }, gl.prototype.distancePerpendicular = function (t) {\n return sc.distancePointLinePerpendicular(t, this.p0, this.p1);\n }, gl.prototype.minY = function () {\n return Math.min(this.p0.y, this.p1.y);\n }, gl.prototype.midPoint = function () {\n return gl.midPoint(this.p0, this.p1);\n }, gl.prototype.projectionFactor = function (t) {\n if (t.equals(this.p0)) return 0;\n if (t.equals(this.p1)) return 1;\n var e = this.p1.x - this.p0.x,\n n = this.p1.y - this.p0.y,\n r = e * e + n * n;\n if (r <= 0) return mu.NaN;\n return ((t.x - this.p0.x) * e + (t.y - this.p0.y) * n) / r;\n }, gl.prototype.closestPoints = function (t) {\n var e = this.intersection(t);\n if (null !== e) return [e, e];\n var n = new Array(2).fill(null),\n r = mu.MAX_VALUE,\n i = null,\n o = this.closestPoint(t.p0);\n r = o.distance(t.p0), n[0] = o, n[1] = t.p0;\n var s = this.closestPoint(t.p1);\n (i = s.distance(t.p1)) < r && (r = i, n[0] = s, n[1] = t.p1);\n var a = t.closestPoint(this.p0);\n (i = a.distance(this.p0)) < r && (r = i, n[0] = this.p0, n[1] = a);\n var u = t.closestPoint(this.p1);\n return (i = u.distance(this.p1)) < r && (r = i, n[0] = this.p1, n[1] = u), n;\n }, gl.prototype.closestPoint = function (t) {\n var e = this.projectionFactor(t);\n if (e > 0 && e < 1) return this.project(t);\n return this.p0.distance(t) < this.p1.distance(t) ? this.p0 : this.p1;\n }, gl.prototype.maxX = function () {\n return Math.max(this.p0.x, this.p1.x);\n }, gl.prototype.getLength = function () {\n return this.p0.distance(this.p1);\n }, gl.prototype.compareTo = function (t) {\n var e = t,\n n = this.p0.compareTo(e.p0);\n return 0 !== n ? n : this.p1.compareTo(e.p1);\n }, gl.prototype.reverse = function () {\n var t = this.p0;\n this.p0 = this.p1, this.p1 = t;\n }, gl.prototype.equalsTopo = function (t) {\n return this.p0.equals(t.p0) && (this.p1.equals(t.p1) || this.p0.equals(t.p1)) && this.p1.equals(t.p0);\n }, gl.prototype.lineIntersection = function (t) {\n try {\n return Uu.intersection(this.p0, this.p1, t.p0, t.p1);\n } catch (t) {\n if (!(t instanceof ju)) throw t;\n }\n return null;\n }, gl.prototype.maxY = function () {\n return Math.max(this.p0.y, this.p1.y);\n }, gl.prototype.pointAlongOffset = function (t, e) {\n var n = this.p0.x + t * (this.p1.x - this.p0.x),\n r = this.p0.y + t * (this.p1.y - this.p0.y),\n i = this.p1.x - this.p0.x,\n o = this.p1.y - this.p0.y,\n s = Math.sqrt(i * i + o * o),\n a = 0,\n u = 0;\n if (0 !== e) {\n if (s <= 0) throw new Error(\"Cannot compute offset from zero-length line segment\");\n a = e * i / s, u = e * o / s;\n }\n return new bu(n - u, r + a);\n }, gl.prototype.setCoordinates = function () {\n if (1 === arguments.length) {\n var t = arguments[0];\n this.setCoordinates(t.p0, t.p1);\n } else if (2 === arguments.length) {\n var e = arguments[0],\n n = arguments[1];\n this.p0.x = e.x, this.p0.y = e.y, this.p1.x = n.x, this.p1.y = n.y;\n }\n }, gl.prototype.segmentFraction = function (t) {\n var e = this.projectionFactor(t);\n return e < 0 ? e = 0 : (e > 1 || mu.isNaN(e)) && (e = 1), e;\n }, gl.prototype.toString = function () {\n return \"LINESTRING( \" + this.p0.x + \" \" + this.p0.y + \", \" + this.p1.x + \" \" + this.p1.y + \")\";\n }, gl.prototype.isHorizontal = function () {\n return this.p0.y === this.p1.y;\n }, gl.prototype.distance = function () {\n if (arguments[0] instanceof gl) {\n var t = arguments[0];\n return sc.distanceLineLine(this.p0, this.p1, t.p0, t.p1);\n }\n if (arguments[0] instanceof bu) {\n var e = arguments[0];\n return sc.distancePointLine(e, this.p0, this.p1);\n }\n }, gl.prototype.pointAlong = function (t) {\n var e = new bu();\n return e.x = this.p0.x + t * (this.p1.x - this.p0.x), e.y = this.p0.y + t * (this.p1.y - this.p0.y), e;\n }, gl.prototype.hashCode = function () {\n var t = mu.doubleToLongBits(this.p0.x);\n t ^= 31 * mu.doubleToLongBits(this.p0.y);\n var e = Math.trunc(t) ^ Math.trunc(t >> 32),\n n = mu.doubleToLongBits(this.p1.x);\n n ^= 31 * mu.doubleToLongBits(this.p1.y);\n return e ^ (Math.trunc(n) ^ Math.trunc(n >> 32));\n }, gl.prototype.interfaces_ = function () {\n return [xu, Li];\n }, gl.prototype.getClass = function () {\n return gl;\n }, gl.midPoint = function (t, e) {\n return new bu((t.x + e.x) / 2, (t.y + e.y) / 2);\n }, dl.serialVersionUID.get = function () {\n return 0x2d2172135f411c00;\n }, Object.defineProperties(gl, dl);\n var yl = function () {\n this.tempEnv1 = new Yu(), this.tempEnv2 = new Yu(), this._overlapSeg1 = new gl(), this._overlapSeg2 = new gl();\n };\n yl.prototype.overlap = function () {\n if (2 === arguments.length) ;else if (4 === arguments.length) {\n var t = arguments[0],\n e = arguments[1],\n n = arguments[2],\n r = arguments[3];\n t.getLineSegment(e, this._overlapSeg1), n.getLineSegment(r, this._overlapSeg2), this.overlap(this._overlapSeg1, this._overlapSeg2);\n }\n }, yl.prototype.interfaces_ = function () {\n return [];\n }, yl.prototype.getClass = function () {\n return yl;\n };\n var _l = function () {\n this._pts = null, this._start = null, this._end = null, this._env = null, this._context = null, this._id = null;\n var t = arguments[0],\n e = arguments[1],\n n = arguments[2],\n r = arguments[3];\n this._pts = t, this._start = e, this._end = n, this._context = r;\n };\n _l.prototype.getLineSegment = function (t, e) {\n e.p0 = this._pts[t], e.p1 = this._pts[t + 1];\n }, _l.prototype.computeSelect = function (t, e, n, r) {\n var i = this._pts[e],\n o = this._pts[n];\n if (r.tempEnv1.init(i, o), n - e == 1) return r.select(this, e), null;\n if (!t.intersects(r.tempEnv1)) return null;\n var s = Math.trunc((e + n) / 2);\n e < s && this.computeSelect(t, e, s, r), s < n && this.computeSelect(t, s, n, r);\n }, _l.prototype.getCoordinates = function () {\n for (var t = new Array(this._end - this._start + 1).fill(null), e = 0, n = this._start; n <= this._end; n++) t[e++] = this._pts[n];\n return t;\n }, _l.prototype.computeOverlaps = function (t, e) {\n this.computeOverlapsInternal(this._start, this._end, t, t._start, t._end, e);\n }, _l.prototype.setId = function (t) {\n this._id = t;\n }, _l.prototype.select = function (t, e) {\n this.computeSelect(t, this._start, this._end, e);\n }, _l.prototype.getEnvelope = function () {\n if (null === this._env) {\n var t = this._pts[this._start],\n e = this._pts[this._end];\n this._env = new Yu(t, e);\n }\n return this._env;\n }, _l.prototype.getEndIndex = function () {\n return this._end;\n }, _l.prototype.getStartIndex = function () {\n return this._start;\n }, _l.prototype.getContext = function () {\n return this._context;\n }, _l.prototype.getId = function () {\n return this._id;\n }, _l.prototype.computeOverlapsInternal = function (t, e, n, r, i, o) {\n var s = this._pts[t],\n a = this._pts[e],\n u = n._pts[r],\n c = n._pts[i];\n if (e - t == 1 && i - r == 1) return o.overlap(this, t, n, r), null;\n if (o.tempEnv1.init(s, a), o.tempEnv2.init(u, c), !o.tempEnv1.intersects(o.tempEnv2)) return null;\n var h = Math.trunc((t + e) / 2),\n l = Math.trunc((r + i) / 2);\n t < h && (r < l && this.computeOverlapsInternal(t, h, n, r, l, o), l < i && this.computeOverlapsInternal(t, h, n, l, i, o)), h < e && (r < l && this.computeOverlapsInternal(h, e, n, r, l, o), l < i && this.computeOverlapsInternal(h, e, n, l, i, o));\n }, _l.prototype.interfaces_ = function () {\n return [];\n }, _l.prototype.getClass = function () {\n return _l;\n };\n var ml = function () {};\n ml.prototype.interfaces_ = function () {\n return [];\n }, ml.prototype.getClass = function () {\n return ml;\n }, ml.getChainStartIndices = function (t) {\n var e = 0,\n n = new bc();\n n.add(new Tu(e));\n do {\n var r = ml.findChainEnd(t, e);\n n.add(new Tu(r)), e = r;\n } while (e < t.length - 1);\n return ml.toIntArray(n);\n }, ml.findChainEnd = function (t, e) {\n for (var n = e; n < t.length - 1 && t[n].equals2D(t[n + 1]);) n++;\n if (n >= t.length - 1) return t.length - 1;\n for (var r = Bh.quadrant(t[n], t[n + 1]), i = e + 1; i < t.length;) {\n if (!t[i - 1].equals2D(t[i])) {\n if (Bh.quadrant(t[i - 1], t[i]) !== r) break;\n }\n i++;\n }\n return i - 1;\n }, ml.getChains = function () {\n if (1 === arguments.length) {\n var t = arguments[0];\n return ml.getChains(t, null);\n }\n if (2 === arguments.length) {\n for (var e = arguments[0], n = arguments[1], r = new bc(), i = ml.getChainStartIndices(e), o = 0; o < i.length - 1; o++) {\n var s = new _l(e, i[o], i[o + 1], n);\n r.add(s);\n }\n return r;\n }\n }, ml.toIntArray = function (t) {\n for (var e = new Array(t.size()).fill(null), n = 0; n < e.length; n++) e[n] = t.get(n).intValue();\n return e;\n };\n var vl = function () {};\n vl.prototype.computeNodes = function (t) {}, vl.prototype.getNodedSubstrings = function () {}, vl.prototype.interfaces_ = function () {\n return [];\n }, vl.prototype.getClass = function () {\n return vl;\n };\n var xl = function () {\n if (this._segInt = null, 0 === arguments.length) ;else if (1 === arguments.length) {\n var t = arguments[0];\n this.setSegmentIntersector(t);\n }\n };\n xl.prototype.setSegmentIntersector = function (t) {\n this._segInt = t;\n }, xl.prototype.interfaces_ = function () {\n return [vl];\n }, xl.prototype.getClass = function () {\n return xl;\n };\n var El = function (t) {\n function e(e) {\n e ? t.call(this, e) : t.call(this), this._monoChains = new bc(), this._index = new ol(), this._idCounter = 0, this._nodedSegStrings = null, this._nOverlaps = 0;\n }\n t && (e.__proto__ = t), (e.prototype = Object.create(t && t.prototype)).constructor = e;\n var n = {\n SegmentOverlapAction: {\n configurable: !0\n }\n };\n return e.prototype.getMonotoneChains = function () {\n return this._monoChains;\n }, e.prototype.getNodedSubstrings = function () {\n return fl.getNodedSubstrings(this._nodedSegStrings);\n }, e.prototype.getIndex = function () {\n return this._index;\n }, e.prototype.add = function (t) {\n for (var e = ml.getChains(t.getCoordinates(), t).iterator(); e.hasNext();) {\n var n = e.next();\n n.setId(this._idCounter++), this._index.insert(n.getEnvelope(), n), this._monoChains.add(n);\n }\n }, e.prototype.computeNodes = function (t) {\n this._nodedSegStrings = t;\n for (var e = t.iterator(); e.hasNext();) this.add(e.next());\n this.intersectChains();\n }, e.prototype.intersectChains = function () {\n for (var t = new wl(this._segInt), e = this._monoChains.iterator(); e.hasNext();) for (var n = e.next(), r = this._index.query(n.getEnvelope()).iterator(); r.hasNext();) {\n var i = r.next();\n if (i.getId() > n.getId() && (n.computeOverlaps(i, t), this._nOverlaps++), this._segInt.isDone()) return null;\n }\n }, e.prototype.interfaces_ = function () {\n return [];\n }, e.prototype.getClass = function () {\n return e;\n }, n.SegmentOverlapAction.get = function () {\n return wl;\n }, Object.defineProperties(e, n), e;\n }(xl),\n wl = function (t) {\n function e() {\n t.call(this), this._si = null;\n var e = arguments[0];\n this._si = e;\n }\n return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.overlap = function () {\n if (4 !== arguments.length) return t.prototype.overlap.apply(this, arguments);\n var e = arguments[0],\n n = arguments[1],\n r = arguments[2],\n i = arguments[3],\n o = e.getContext(),\n s = r.getContext();\n this._si.processIntersections(o, n, s, i);\n }, e.prototype.interfaces_ = function () {\n return [];\n }, e.prototype.getClass = function () {\n return e;\n }, e;\n }(yl),\n bl = function t() {\n if (this._quadrantSegments = t.DEFAULT_QUADRANT_SEGMENTS, this._endCapStyle = t.CAP_ROUND, this._joinStyle = t.JOIN_ROUND, this._mitreLimit = t.DEFAULT_MITRE_LIMIT, this._isSingleSided = !1, this._simplifyFactor = t.DEFAULT_SIMPLIFY_FACTOR, 0 === arguments.length) ;else if (1 === arguments.length) {\n var e = arguments[0];\n this.setQuadrantSegments(e);\n } else if (2 === arguments.length) {\n var n = arguments[0],\n r = arguments[1];\n this.setQuadrantSegments(n), this.setEndCapStyle(r);\n } else if (4 === arguments.length) {\n var i = arguments[0],\n o = arguments[1],\n s = arguments[2],\n a = arguments[3];\n this.setQuadrantSegments(i), this.setEndCapStyle(o), this.setJoinStyle(s), this.setMitreLimit(a);\n }\n },\n Il = {\n CAP_ROUND: {\n configurable: !0\n },\n CAP_FLAT: {\n configurable: !0\n },\n CAP_SQUARE: {\n configurable: !0\n },\n JOIN_ROUND: {\n configurable: !0\n },\n JOIN_MITRE: {\n configurable: !0\n },\n JOIN_BEVEL: {\n configurable: !0\n },\n DEFAULT_QUADRANT_SEGMENTS: {\n configurable: !0\n },\n DEFAULT_MITRE_LIMIT: {\n configurable: !0\n },\n DEFAULT_SIMPLIFY_FACTOR: {\n configurable: !0\n }\n };\n bl.prototype.getEndCapStyle = function () {\n return this._endCapStyle;\n }, bl.prototype.isSingleSided = function () {\n return this._isSingleSided;\n }, bl.prototype.setQuadrantSegments = function (t) {\n this._quadrantSegments = t, 0 === this._quadrantSegments && (this._joinStyle = bl.JOIN_BEVEL), this._quadrantSegments < 0 && (this._joinStyle = bl.JOIN_MITRE, this._mitreLimit = Math.abs(this._quadrantSegments)), t <= 0 && (this._quadrantSegments = 1), this._joinStyle !== bl.JOIN_ROUND && (this._quadrantSegments = bl.DEFAULT_QUADRANT_SEGMENTS);\n }, bl.prototype.getJoinStyle = function () {\n return this._joinStyle;\n }, bl.prototype.setJoinStyle = function (t) {\n this._joinStyle = t;\n }, bl.prototype.setSimplifyFactor = function (t) {\n this._simplifyFactor = t < 0 ? 0 : t;\n }, bl.prototype.getSimplifyFactor = function () {\n return this._simplifyFactor;\n }, bl.prototype.getQuadrantSegments = function () {\n return this._quadrantSegments;\n }, bl.prototype.setEndCapStyle = function (t) {\n this._endCapStyle = t;\n }, bl.prototype.getMitreLimit = function () {\n return this._mitreLimit;\n }, bl.prototype.setMitreLimit = function (t) {\n this._mitreLimit = t;\n }, bl.prototype.setSingleSided = function (t) {\n this._isSingleSided = t;\n }, bl.prototype.interfaces_ = function () {\n return [];\n }, bl.prototype.getClass = function () {\n return bl;\n }, bl.bufferDistanceError = function (t) {\n var e = Math.PI / 2 / t;\n return 1 - Math.cos(e / 2);\n }, Il.CAP_ROUND.get = function () {\n return 1;\n }, Il.CAP_FLAT.get = function () {\n return 2;\n }, Il.CAP_SQUARE.get = function () {\n return 3;\n }, Il.JOIN_ROUND.get = function () {\n return 1;\n }, Il.JOIN_MITRE.get = function () {\n return 2;\n }, Il.JOIN_BEVEL.get = function () {\n return 3;\n }, Il.DEFAULT_QUADRANT_SEGMENTS.get = function () {\n return 8;\n }, Il.DEFAULT_MITRE_LIMIT.get = function () {\n return 5;\n }, Il.DEFAULT_SIMPLIFY_FACTOR.get = function () {\n return .01;\n }, Object.defineProperties(bl, Il);\n var Nl = function (t) {\n this._distanceTol = null, this._isDeleted = null, this._angleOrientation = sc.COUNTERCLOCKWISE, this._inputLine = t || null;\n },\n Cl = {\n INIT: {\n configurable: !0\n },\n DELETE: {\n configurable: !0\n },\n KEEP: {\n configurable: !0\n },\n NUM_PTS_TO_CHECK: {\n configurable: !0\n }\n };\n Nl.prototype.isDeletable = function (t, e, n, r) {\n var i = this._inputLine[t],\n o = this._inputLine[e],\n s = this._inputLine[n];\n return !!this.isConcave(i, o, s) && !!this.isShallow(i, o, s, r) && this.isShallowSampled(i, o, t, n, r);\n }, Nl.prototype.deleteShallowConcavities = function () {\n for (var t = 1, e = this.findNextNonDeletedIndex(t), n = this.findNextNonDeletedIndex(e), r = !1; n < this._inputLine.length;) {\n var i = !1;\n this.isDeletable(t, e, n, this._distanceTol) && (this._isDeleted[e] = Nl.DELETE, i = !0, r = !0), t = i ? n : e, e = this.findNextNonDeletedIndex(t), n = this.findNextNonDeletedIndex(e);\n }\n return r;\n }, Nl.prototype.isShallowConcavity = function (t, e, n, r) {\n if (!(sc.computeOrientation(t, e, n) === this._angleOrientation)) return !1;\n return sc.distancePointLine(e, t, n) < r;\n }, Nl.prototype.isShallowSampled = function (t, e, n, r, i) {\n var o = Math.trunc((r - n) / Nl.NUM_PTS_TO_CHECK);\n o <= 0 && (o = 1);\n for (var s = n; s < r; s += o) if (!this.isShallow(t, e, this._inputLine[s], i)) return !1;\n return !0;\n }, Nl.prototype.isConcave = function (t, e, n) {\n var r = sc.computeOrientation(t, e, n) === this._angleOrientation;\n return r;\n }, Nl.prototype.simplify = function (t) {\n this._distanceTol = Math.abs(t), t < 0 && (this._angleOrientation = sc.CLOCKWISE), this._isDeleted = new Array(this._inputLine.length).fill(null);\n var e = !1;\n do {\n e = this.deleteShallowConcavities();\n } while (e);\n return this.collapseLine();\n }, Nl.prototype.findNextNonDeletedIndex = function (t) {\n for (var e = t + 1; e < this._inputLine.length && this._isDeleted[e] === Nl.DELETE;) e++;\n return e;\n }, Nl.prototype.isShallow = function (t, e, n, r) {\n return sc.distancePointLine(e, t, n) < r;\n }, Nl.prototype.collapseLine = function () {\n for (var t = new Nc(), e = 0; e < this._inputLine.length; e++) this._isDeleted[e] !== Nl.DELETE && t.add(this._inputLine[e]);\n return t.toCoordinateArray();\n }, Nl.prototype.interfaces_ = function () {\n return [];\n }, Nl.prototype.getClass = function () {\n return Nl;\n }, Nl.simplify = function (t, e) {\n return new Nl(t).simplify(e);\n }, Cl.INIT.get = function () {\n return 0;\n }, Cl.DELETE.get = function () {\n return 1;\n }, Cl.KEEP.get = function () {\n return 1;\n }, Cl.NUM_PTS_TO_CHECK.get = function () {\n return 10;\n }, Object.defineProperties(Nl, Cl);\n var Sl = function () {\n this._ptList = null, this._precisionModel = null, this._minimimVertexDistance = 0, this._ptList = new bc();\n },\n Ml = {\n COORDINATE_ARRAY_TYPE: {\n configurable: !0\n }\n };\n Sl.prototype.getCoordinates = function () {\n return this._ptList.toArray(Sl.COORDINATE_ARRAY_TYPE);\n }, Sl.prototype.setPrecisionModel = function (t) {\n this._precisionModel = t;\n }, Sl.prototype.addPt = function (t) {\n var e = new bu(t);\n if (this._precisionModel.makePrecise(e), this.isRedundant(e)) return null;\n this._ptList.add(e);\n }, Sl.prototype.revere = function () {}, Sl.prototype.addPts = function (t, e) {\n if (e) for (var n = 0; n < t.length; n++) this.addPt(t[n]);else for (var r = t.length - 1; r >= 0; r--) this.addPt(t[r]);\n }, Sl.prototype.isRedundant = function (t) {\n if (this._ptList.size() < 1) return !1;\n var e = this._ptList.get(this._ptList.size() - 1);\n return t.distance(e) < this._minimimVertexDistance;\n }, Sl.prototype.toString = function () {\n return new _h().createLineString(this.getCoordinates()).toString();\n }, Sl.prototype.closeRing = function () {\n if (this._ptList.size() < 1) return null;\n var t = new bu(this._ptList.get(0)),\n e = this._ptList.get(this._ptList.size() - 1);\n if (t.equals(e)) return null;\n this._ptList.add(t);\n }, Sl.prototype.setMinimumVertexDistance = function (t) {\n this._minimimVertexDistance = t;\n }, Sl.prototype.interfaces_ = function () {\n return [];\n }, Sl.prototype.getClass = function () {\n return Sl;\n }, Ml.COORDINATE_ARRAY_TYPE.get = function () {\n return new Array(0).fill(null);\n }, Object.defineProperties(Sl, Ml);\n var Ll = function () {},\n Pl = {\n PI_TIMES_2: {\n configurable: !0\n },\n PI_OVER_2: {\n configurable: !0\n },\n PI_OVER_4: {\n configurable: !0\n },\n COUNTERCLOCKWISE: {\n configurable: !0\n },\n CLOCKWISE: {\n configurable: !0\n },\n NONE: {\n configurable: !0\n }\n };\n Ll.prototype.interfaces_ = function () {\n return [];\n }, Ll.prototype.getClass = function () {\n return Ll;\n }, Ll.toDegrees = function (t) {\n return 180 * t / Math.PI;\n }, Ll.normalize = function (t) {\n for (; t > Math.PI;) t -= Ll.PI_TIMES_2;\n for (; t <= -Math.PI;) t += Ll.PI_TIMES_2;\n return t;\n }, Ll.angle = function () {\n if (1 === arguments.length) {\n var t = arguments[0];\n return Math.atan2(t.y, t.x);\n }\n if (2 === arguments.length) {\n var e = arguments[0],\n n = arguments[1],\n r = n.x - e.x,\n i = n.y - e.y;\n return Math.atan2(i, r);\n }\n }, Ll.isAcute = function (t, e, n) {\n var r = t.x - e.x,\n i = t.y - e.y;\n return r * (n.x - e.x) + i * (n.y - e.y) > 0;\n }, Ll.isObtuse = function (t, e, n) {\n var r = t.x - e.x,\n i = t.y - e.y;\n return r * (n.x - e.x) + i * (n.y - e.y) < 0;\n }, Ll.interiorAngle = function (t, e, n) {\n var r = Ll.angle(e, t),\n i = Ll.angle(e, n);\n return Math.abs(i - r);\n }, Ll.normalizePositive = function (t) {\n if (t < 0) {\n for (; t < 0;) t += Ll.PI_TIMES_2;\n t >= Ll.PI_TIMES_2 && (t = 0);\n } else {\n for (; t >= Ll.PI_TIMES_2;) t -= Ll.PI_TIMES_2;\n t < 0 && (t = 0);\n }\n return t;\n }, Ll.angleBetween = function (t, e, n) {\n var r = Ll.angle(e, t),\n i = Ll.angle(e, n);\n return Ll.diff(r, i);\n }, Ll.diff = function (t, e) {\n var n = null;\n return (n = t < e ? e - t : t - e) > Math.PI && (n = 2 * Math.PI - n), n;\n }, Ll.toRadians = function (t) {\n return t * Math.PI / 180;\n }, Ll.getTurn = function (t, e) {\n var n = Math.sin(e - t);\n return n > 0 ? Ll.COUNTERCLOCKWISE : n < 0 ? Ll.CLOCKWISE : Ll.NONE;\n }, Ll.angleBetweenOriented = function (t, e, n) {\n var r = Ll.angle(e, t),\n i = Ll.angle(e, n) - r;\n return i <= -Math.PI ? i + Ll.PI_TIMES_2 : i > Math.PI ? i - Ll.PI_TIMES_2 : i;\n }, Pl.PI_TIMES_2.get = function () {\n return 2 * Math.PI;\n }, Pl.PI_OVER_2.get = function () {\n return Math.PI / 2;\n }, Pl.PI_OVER_4.get = function () {\n return Math.PI / 4;\n }, Pl.COUNTERCLOCKWISE.get = function () {\n return sc.COUNTERCLOCKWISE;\n }, Pl.CLOCKWISE.get = function () {\n return sc.CLOCKWISE;\n }, Pl.NONE.get = function () {\n return sc.COLLINEAR;\n }, Object.defineProperties(Ll, Pl);\n var Ol = function t() {\n this._maxCurveSegmentError = 0, this._filletAngleQuantum = null, this._closingSegLengthFactor = 1, this._segList = null, this._distance = 0, this._precisionModel = null, this._bufParams = null, this._li = null, this._s0 = null, this._s1 = null, this._s2 = null, this._seg0 = new gl(), this._seg1 = new gl(), this._offset0 = new gl(), this._offset1 = new gl(), this._side = 0, this._hasNarrowConcaveAngle = !1;\n var e = arguments[0],\n n = arguments[1],\n r = arguments[2];\n this._precisionModel = e, this._bufParams = n, this._li = new rc(), this._filletAngleQuantum = Math.PI / 2 / n.getQuadrantSegments(), n.getQuadrantSegments() >= 8 && n.getJoinStyle() === bl.JOIN_ROUND && (this._closingSegLengthFactor = t.MAX_CLOSING_SEG_LEN_FACTOR), this.init(r);\n },\n Rl = {\n OFFSET_SEGMENT_SEPARATION_FACTOR: {\n configurable: !0\n },\n INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR: {\n configurable: !0\n },\n CURVE_VERTEX_SNAP_DISTANCE_FACTOR: {\n configurable: !0\n },\n MAX_CLOSING_SEG_LEN_FACTOR: {\n configurable: !0\n }\n };\n Ol.prototype.addNextSegment = function (t, e) {\n if (this._s0 = this._s1, this._s1 = this._s2, this._s2 = t, this._seg0.setCoordinates(this._s0, this._s1), this.computeOffsetSegment(this._seg0, this._side, this._distance, this._offset0), this._seg1.setCoordinates(this._s1, this._s2), this.computeOffsetSegment(this._seg1, this._side, this._distance, this._offset1), this._s1.equals(this._s2)) return null;\n var n = sc.computeOrientation(this._s0, this._s1, this._s2),\n r = n === sc.CLOCKWISE && this._side === Nh.LEFT || n === sc.COUNTERCLOCKWISE && this._side === Nh.RIGHT;\n 0 === n ? this.addCollinear(e) : r ? this.addOutsideTurn(n, e) : this.addInsideTurn(n, e);\n }, Ol.prototype.addLineEndCap = function (t, e) {\n var n = new gl(t, e),\n r = new gl();\n this.computeOffsetSegment(n, Nh.LEFT, this._distance, r);\n var i = new gl();\n this.computeOffsetSegment(n, Nh.RIGHT, this._distance, i);\n var o = e.x - t.x,\n s = e.y - t.y,\n a = Math.atan2(s, o);\n switch (this._bufParams.getEndCapStyle()) {\n case bl.CAP_ROUND:\n this._segList.addPt(r.p1), this.addFilletArc(e, a + Math.PI / 2, a - Math.PI / 2, sc.CLOCKWISE, this._distance), this._segList.addPt(i.p1);\n break;\n case bl.CAP_FLAT:\n this._segList.addPt(r.p1), this._segList.addPt(i.p1);\n break;\n case bl.CAP_SQUARE:\n var u = new bu();\n u.x = Math.abs(this._distance) * Math.cos(a), u.y = Math.abs(this._distance) * Math.sin(a);\n var c = new bu(r.p1.x + u.x, r.p1.y + u.y),\n h = new bu(i.p1.x + u.x, i.p1.y + u.y);\n this._segList.addPt(c), this._segList.addPt(h);\n }\n }, Ol.prototype.getCoordinates = function () {\n return this._segList.getCoordinates();\n }, Ol.prototype.addMitreJoin = function (t, e, n, r) {\n var i = !0,\n o = null;\n try {\n o = Uu.intersection(e.p0, e.p1, n.p0, n.p1);\n (r <= 0 ? 1 : o.distance(t) / Math.abs(r)) > this._bufParams.getMitreLimit() && (i = !1);\n } catch (t) {\n if (!(t instanceof ju)) throw t;\n o = new bu(0, 0), i = !1;\n }\n i ? this._segList.addPt(o) : this.addLimitedMitreJoin(e, n, r, this._bufParams.getMitreLimit());\n }, Ol.prototype.addFilletCorner = function (t, e, n, r, i) {\n var o = e.x - t.x,\n s = e.y - t.y,\n a = Math.atan2(s, o),\n u = n.x - t.x,\n c = n.y - t.y,\n h = Math.atan2(c, u);\n r === sc.CLOCKWISE ? a <= h && (a += 2 * Math.PI) : a >= h && (a -= 2 * Math.PI), this._segList.addPt(e), this.addFilletArc(t, a, h, r, i), this._segList.addPt(n);\n }, Ol.prototype.addOutsideTurn = function (t, e) {\n if (this._offset0.p1.distance(this._offset1.p0) < this._distance * Ol.OFFSET_SEGMENT_SEPARATION_FACTOR) return this._segList.addPt(this._offset0.p1), null;\n this._bufParams.getJoinStyle() === bl.JOIN_MITRE ? this.addMitreJoin(this._s1, this._offset0, this._offset1, this._distance) : this._bufParams.getJoinStyle() === bl.JOIN_BEVEL ? this.addBevelJoin(this._offset0, this._offset1) : (e && this._segList.addPt(this._offset0.p1), this.addFilletCorner(this._s1, this._offset0.p1, this._offset1.p0, t, this._distance), this._segList.addPt(this._offset1.p0));\n }, Ol.prototype.createSquare = function (t) {\n this._segList.addPt(new bu(t.x + this._distance, t.y + this._distance)), this._segList.addPt(new bu(t.x + this._distance, t.y - this._distance)), this._segList.addPt(new bu(t.x - this._distance, t.y - this._distance)), this._segList.addPt(new bu(t.x - this._distance, t.y + this._distance)), this._segList.closeRing();\n }, Ol.prototype.addSegments = function (t, e) {\n this._segList.addPts(t, e);\n }, Ol.prototype.addFirstSegment = function () {\n this._segList.addPt(this._offset1.p0);\n }, Ol.prototype.addLastSegment = function () {\n this._segList.addPt(this._offset1.p1);\n }, Ol.prototype.initSideSegments = function (t, e, n) {\n this._s1 = t, this._s2 = e, this._side = n, this._seg1.setCoordinates(t, e), this.computeOffsetSegment(this._seg1, n, this._distance, this._offset1);\n }, Ol.prototype.addLimitedMitreJoin = function (t, e, n, r) {\n var i = this._seg0.p1,\n o = Ll.angle(i, this._seg0.p0),\n s = Ll.angleBetweenOriented(this._seg0.p0, i, this._seg1.p1) / 2,\n a = Ll.normalize(o + s),\n u = Ll.normalize(a + Math.PI),\n c = r * n,\n h = n - c * Math.abs(Math.sin(s)),\n l = i.x + c * Math.cos(u),\n p = i.y + c * Math.sin(u),\n f = new bu(l, p),\n g = new gl(i, f),\n d = g.pointAlongOffset(1, h),\n y = g.pointAlongOffset(1, -h);\n this._side === Nh.LEFT ? (this._segList.addPt(d), this._segList.addPt(y)) : (this._segList.addPt(y), this._segList.addPt(d));\n }, Ol.prototype.computeOffsetSegment = function (t, e, n, r) {\n var i = e === Nh.LEFT ? 1 : -1,\n o = t.p1.x - t.p0.x,\n s = t.p1.y - t.p0.y,\n a = Math.sqrt(o * o + s * s),\n u = i * n * o / a,\n c = i * n * s / a;\n r.p0.x = t.p0.x - c, r.p0.y = t.p0.y + u, r.p1.x = t.p1.x - c, r.p1.y = t.p1.y + u;\n }, Ol.prototype.addFilletArc = function (t, e, n, r, i) {\n var o = r === sc.CLOCKWISE ? -1 : 1,\n s = Math.abs(e - n),\n a = Math.trunc(s / this._filletAngleQuantum + .5);\n if (a < 1) return null;\n for (var u = s / a, c = 0, h = new bu(); c < s;) {\n var l = e + o * c;\n h.x = t.x + i * Math.cos(l), h.y = t.y + i * Math.sin(l), this._segList.addPt(h), c += u;\n }\n }, Ol.prototype.addInsideTurn = function (t, e) {\n if (this._li.computeIntersection(this._offset0.p0, this._offset0.p1, this._offset1.p0, this._offset1.p1), this._li.hasIntersection()) this._segList.addPt(this._li.getIntersection(0));else if (this._hasNarrowConcaveAngle = !0, this._offset0.p1.distance(this._offset1.p0) < this._distance * Ol.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR) this._segList.addPt(this._offset0.p1);else {\n if (this._segList.addPt(this._offset0.p1), this._closingSegLengthFactor > 0) {\n var n = new bu((this._closingSegLengthFactor * this._offset0.p1.x + this._s1.x) / (this._closingSegLengthFactor + 1), (this._closingSegLengthFactor * this._offset0.p1.y + this._s1.y) / (this._closingSegLengthFactor + 1));\n this._segList.addPt(n);\n var r = new bu((this._closingSegLengthFactor * this._offset1.p0.x + this._s1.x) / (this._closingSegLengthFactor + 1), (this._closingSegLengthFactor * this._offset1.p0.y + this._s1.y) / (this._closingSegLengthFactor + 1));\n this._segList.addPt(r);\n } else this._segList.addPt(this._s1);\n this._segList.addPt(this._offset1.p0);\n }\n }, Ol.prototype.createCircle = function (t) {\n var e = new bu(t.x + this._distance, t.y);\n this._segList.addPt(e), this.addFilletArc(t, 0, 2 * Math.PI, -1, this._distance), this._segList.closeRing();\n }, Ol.prototype.addBevelJoin = function (t, e) {\n this._segList.addPt(t.p1), this._segList.addPt(e.p0);\n }, Ol.prototype.init = function (t) {\n this._distance = t, this._maxCurveSegmentError = t * (1 - Math.cos(this._filletAngleQuantum / 2)), this._segList = new Sl(), this._segList.setPrecisionModel(this._precisionModel), this._segList.setMinimumVertexDistance(t * Ol.CURVE_VERTEX_SNAP_DISTANCE_FACTOR);\n }, Ol.prototype.addCollinear = function (t) {\n this._li.computeIntersection(this._s0, this._s1, this._s1, this._s2);\n this._li.getIntersectionNum() >= 2 && (this._bufParams.getJoinStyle() === bl.JOIN_BEVEL || this._bufParams.getJoinStyle() === bl.JOIN_MITRE ? (t && this._segList.addPt(this._offset0.p1), this._segList.addPt(this._offset1.p0)) : this.addFilletCorner(this._s1, this._offset0.p1, this._offset1.p0, sc.CLOCKWISE, this._distance));\n }, Ol.prototype.closeRing = function () {\n this._segList.closeRing();\n }, Ol.prototype.hasNarrowConcaveAngle = function () {\n return this._hasNarrowConcaveAngle;\n }, Ol.prototype.interfaces_ = function () {\n return [];\n }, Ol.prototype.getClass = function () {\n return Ol;\n }, Rl.OFFSET_SEGMENT_SEPARATION_FACTOR.get = function () {\n return .001;\n }, Rl.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get = function () {\n return .001;\n }, Rl.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get = function () {\n return 1e-6;\n }, Rl.MAX_CLOSING_SEG_LEN_FACTOR.get = function () {\n return 80;\n }, Object.defineProperties(Ol, Rl);\n var Tl = function () {\n this._distance = 0, this._precisionModel = null, this._bufParams = null;\n var t = arguments[0],\n e = arguments[1];\n this._precisionModel = t, this._bufParams = e;\n };\n Tl.prototype.getOffsetCurve = function (t, e) {\n if (this._distance = e, 0 === e) return null;\n var n = e < 0,\n r = Math.abs(e),\n i = this.getSegGen(r);\n t.length <= 1 ? this.computePointCurve(t[0], i) : this.computeOffsetCurve(t, n, i);\n var o = i.getCoordinates();\n return n && Cc.reverse(o), o;\n }, Tl.prototype.computeSingleSidedBufferCurve = function (t, e, n) {\n var r = this.simplifyTolerance(this._distance);\n if (e) {\n n.addSegments(t, !0);\n var i = Nl.simplify(t, -r),\n o = i.length - 1;\n n.initSideSegments(i[o], i[o - 1], Nh.LEFT), n.addFirstSegment();\n for (var s = o - 2; s >= 0; s--) n.addNextSegment(i[s], !0);\n } else {\n n.addSegments(t, !1);\n var a = Nl.simplify(t, r),\n u = a.length - 1;\n n.initSideSegments(a[0], a[1], Nh.LEFT), n.addFirstSegment();\n for (var c = 2; c <= u; c++) n.addNextSegment(a[c], !0);\n }\n n.addLastSegment(), n.closeRing();\n }, Tl.prototype.computeRingBufferCurve = function (t, e, n) {\n var r = this.simplifyTolerance(this._distance);\n e === Nh.RIGHT && (r = -r);\n var i = Nl.simplify(t, r),\n o = i.length - 1;\n n.initSideSegments(i[o - 1], i[0], e);\n for (var s = 1; s <= o; s++) {\n var a = 1 !== s;\n n.addNextSegment(i[s], a);\n }\n n.closeRing();\n }, Tl.prototype.computeLineBufferCurve = function (t, e) {\n var n = this.simplifyTolerance(this._distance),\n r = Nl.simplify(t, n),\n i = r.length - 1;\n e.initSideSegments(r[0], r[1], Nh.LEFT);\n for (var o = 2; o <= i; o++) e.addNextSegment(r[o], !0);\n e.addLastSegment(), e.addLineEndCap(r[i - 1], r[i]);\n var s = Nl.simplify(t, -n),\n a = s.length - 1;\n e.initSideSegments(s[a], s[a - 1], Nh.LEFT);\n for (var u = a - 2; u >= 0; u--) e.addNextSegment(s[u], !0);\n e.addLastSegment(), e.addLineEndCap(s[1], s[0]), e.closeRing();\n }, Tl.prototype.computePointCurve = function (t, e) {\n switch (this._bufParams.getEndCapStyle()) {\n case bl.CAP_ROUND:\n e.createCircle(t);\n break;\n case bl.CAP_SQUARE:\n e.createSquare(t);\n }\n }, Tl.prototype.getLineCurve = function (t, e) {\n if (this._distance = e, e < 0 && !this._bufParams.isSingleSided()) return null;\n if (0 === e) return null;\n var n = Math.abs(e),\n r = this.getSegGen(n);\n if (t.length <= 1) this.computePointCurve(t[0], r);else if (this._bufParams.isSingleSided()) {\n var i = e < 0;\n this.computeSingleSidedBufferCurve(t, i, r);\n } else this.computeLineBufferCurve(t, r);\n return r.getCoordinates();\n }, Tl.prototype.getBufferParameters = function () {\n return this._bufParams;\n }, Tl.prototype.simplifyTolerance = function (t) {\n return t * this._bufParams.getSimplifyFactor();\n }, Tl.prototype.getRingCurve = function (t, e, n) {\n if (this._distance = n, t.length <= 2) return this.getLineCurve(t, n);\n if (0 === n) return Tl.copyCoordinates(t);\n var r = this.getSegGen(n);\n return this.computeRingBufferCurve(t, e, r), r.getCoordinates();\n }, Tl.prototype.computeOffsetCurve = function (t, e, n) {\n var r = this.simplifyTolerance(this._distance);\n if (e) {\n var i = Nl.simplify(t, -r),\n o = i.length - 1;\n n.initSideSegments(i[o], i[o - 1], Nh.LEFT), n.addFirstSegment();\n for (var s = o - 2; s >= 0; s--) n.addNextSegment(i[s], !0);\n } else {\n var a = Nl.simplify(t, r),\n u = a.length - 1;\n n.initSideSegments(a[0], a[1], Nh.LEFT), n.addFirstSegment();\n for (var c = 2; c <= u; c++) n.addNextSegment(a[c], !0);\n }\n n.addLastSegment();\n }, Tl.prototype.getSegGen = function (t) {\n return new Ol(this._precisionModel, this._bufParams, t);\n }, Tl.prototype.interfaces_ = function () {\n return [];\n }, Tl.prototype.getClass = function () {\n return Tl;\n }, Tl.copyCoordinates = function (t) {\n for (var e = new Array(t.length).fill(null), n = 0; n < e.length; n++) e[n] = new bu(t[n]);\n return e;\n };\n var Al = function () {\n this._subgraphs = null, this._seg = new gl(), this._cga = new sc();\n var t = arguments[0];\n this._subgraphs = t;\n },\n Dl = {\n DepthSegment: {\n configurable: !0\n }\n };\n Al.prototype.findStabbedSegments = function () {\n if (1 === arguments.length) {\n for (var t = arguments[0], e = new bc(), n = this._subgraphs.iterator(); n.hasNext();) {\n var r = n.next(),\n i = r.getEnvelope();\n t.y < i.getMinY() || t.y > i.getMaxY() || this.findStabbedSegments(t, r.getDirectedEdges(), e);\n }\n return e;\n }\n if (3 === arguments.length) if (Lu(arguments[2], wc) && arguments[0] instanceof bu && arguments[1] instanceof jh) for (var o = arguments[0], s = arguments[1], a = arguments[2], u = s.getEdge().getCoordinates(), c = 0; c < u.length - 1; c++) {\n this._seg.p0 = u[c], this._seg.p1 = u[c + 1], this._seg.p0.y > this._seg.p1.y && this._seg.reverse();\n if (!(Math.max(this._seg.p0.x, this._seg.p1.x) < o.x) && !(this._seg.isHorizontal() || o.y < this._seg.p0.y || o.y > this._seg.p1.y || sc.computeOrientation(this._seg.p0, this._seg.p1, o) === sc.RIGHT)) {\n var h = s.getDepth(Nh.LEFT);\n this._seg.p0.equals(u[c]) || (h = s.getDepth(Nh.RIGHT));\n var l = new Fl(this._seg, h);\n a.add(l);\n }\n } else if (Lu(arguments[2], wc) && arguments[0] instanceof bu && Lu(arguments[1], wc)) for (var p = arguments[0], f = arguments[1], g = arguments[2], d = f.iterator(); d.hasNext();) {\n var y = d.next();\n y.isForward() && this.findStabbedSegments(p, y, g);\n }\n }, Al.prototype.getDepth = function (t) {\n var e = this.findStabbedSegments(t);\n if (0 === e.size()) return 0;\n return $h.min(e)._leftDepth;\n }, Al.prototype.interfaces_ = function () {\n return [];\n }, Al.prototype.getClass = function () {\n return Al;\n }, Dl.DepthSegment.get = function () {\n return Fl;\n }, Object.defineProperties(Al, Dl);\n var Fl = function () {\n this._upwardSeg = null, this._leftDepth = null;\n var t = arguments[0],\n e = arguments[1];\n this._upwardSeg = new gl(t), this._leftDepth = e;\n };\n Fl.prototype.compareTo = function (t) {\n var e = t;\n if (this._upwardSeg.minX() >= e._upwardSeg.maxX()) return 1;\n if (this._upwardSeg.maxX() <= e._upwardSeg.minX()) return -1;\n var n = this._upwardSeg.orientationIndex(e._upwardSeg);\n return 0 !== n ? n : 0 != (n = -1 * e._upwardSeg.orientationIndex(this._upwardSeg)) ? n : this._upwardSeg.compareTo(e._upwardSeg);\n }, Fl.prototype.compareX = function (t, e) {\n var n = t.p0.compareTo(e.p0);\n return 0 !== n ? n : t.p1.compareTo(e.p1);\n }, Fl.prototype.toString = function () {\n return this._upwardSeg.toString();\n }, Fl.prototype.interfaces_ = function () {\n return [xu];\n }, Fl.prototype.getClass = function () {\n return Fl;\n };\n var ql = function (t, e, n) {\n this.p0 = t || null, this.p1 = e || null, this.p2 = n || null;\n };\n ql.prototype.area = function () {\n return ql.area(this.p0, this.p1, this.p2);\n }, ql.prototype.signedArea = function () {\n return ql.signedArea(this.p0, this.p1, this.p2);\n }, ql.prototype.interpolateZ = function (t) {\n if (null === t) throw new _u(\"Supplied point is null.\");\n return ql.interpolateZ(t, this.p0, this.p1, this.p2);\n }, ql.prototype.longestSideLength = function () {\n return ql.longestSideLength(this.p0, this.p1, this.p2);\n }, ql.prototype.isAcute = function () {\n return ql.isAcute(this.p0, this.p1, this.p2);\n }, ql.prototype.circumcentre = function () {\n return ql.circumcentre(this.p0, this.p1, this.p2);\n }, ql.prototype.area3D = function () {\n return ql.area3D(this.p0, this.p1, this.p2);\n }, ql.prototype.centroid = function () {\n return ql.centroid(this.p0, this.p1, this.p2);\n }, ql.prototype.inCentre = function () {\n return ql.inCentre(this.p0, this.p1, this.p2);\n }, ql.prototype.interfaces_ = function () {\n return [];\n }, ql.prototype.getClass = function () {\n return ql;\n }, ql.area = function (t, e, n) {\n return Math.abs(((n.x - t.x) * (e.y - t.y) - (e.x - t.x) * (n.y - t.y)) / 2);\n }, ql.signedArea = function (t, e, n) {\n return ((n.x - t.x) * (e.y - t.y) - (e.x - t.x) * (n.y - t.y)) / 2;\n }, ql.det = function (t, e, n, r) {\n return t * r - e * n;\n }, ql.interpolateZ = function (t, e, n, r) {\n var i = e.x,\n o = e.y,\n s = n.x - i,\n a = r.x - i,\n u = n.y - o,\n c = r.y - o,\n h = s * c - a * u,\n l = t.x - i,\n p = t.y - o,\n f = (c * l - a * p) / h,\n g = (-u * l + s * p) / h;\n return e.z + f * (n.z - e.z) + g * (r.z - e.z);\n }, ql.longestSideLength = function (t, e, n) {\n var r = t.distance(e),\n i = e.distance(n),\n o = n.distance(t),\n s = r;\n return i > s && (s = i), o > s && (s = o), s;\n }, ql.isAcute = function (t, e, n) {\n return !!Ll.isAcute(t, e, n) && !!Ll.isAcute(e, n, t) && !!Ll.isAcute(n, t, e);\n }, ql.circumcentre = function (t, e, n) {\n var r = n.x,\n i = n.y,\n o = t.x - r,\n s = t.y - i,\n a = e.x - r,\n u = e.y - i,\n c = 2 * ql.det(o, s, a, u),\n h = ql.det(s, o * o + s * s, u, a * a + u * u),\n l = ql.det(o, o * o + s * s, a, a * a + u * u);\n return new bu(r - h / c, i + l / c);\n }, ql.perpendicularBisector = function (t, e) {\n var n = e.x - t.x,\n r = e.y - t.y,\n i = new Uu(t.x + n / 2, t.y + r / 2, 1),\n o = new Uu(t.x - r + n / 2, t.y + n + r / 2, 1);\n return new Uu(i, o);\n }, ql.angleBisector = function (t, e, n) {\n var r = e.distance(t),\n i = r / (r + e.distance(n)),\n o = n.x - t.x,\n s = n.y - t.y;\n return new bu(t.x + i * o, t.y + i * s);\n }, ql.area3D = function (t, e, n) {\n var r = e.x - t.x,\n i = e.y - t.y,\n o = e.z - t.z,\n s = n.x - t.x,\n a = n.y - t.y,\n u = n.z - t.z,\n c = i * u - o * a,\n h = o * s - r * u,\n l = r * a - i * s,\n p = c * c + h * h + l * l,\n f = Math.sqrt(p) / 2;\n return f;\n }, ql.centroid = function (t, e, n) {\n var r = (t.x + e.x + n.x) / 3,\n i = (t.y + e.y + n.y) / 3;\n return new bu(r, i);\n }, ql.inCentre = function (t, e, n) {\n var r = e.distance(n),\n i = t.distance(n),\n o = t.distance(e),\n s = r + i + o,\n a = (r * t.x + i * e.x + o * n.x) / s,\n u = (r * t.y + i * e.y + o * n.y) / s;\n return new bu(a, u);\n };\n var Gl = function () {\n this._inputGeom = null, this._distance = null, this._curveBuilder = null, this._curveList = new bc();\n var t = arguments[0],\n e = arguments[1],\n n = arguments[2];\n this._inputGeom = t, this._distance = e, this._curveBuilder = n;\n };\n Gl.prototype.addPoint = function (t) {\n if (this._distance <= 0) return null;\n var e = t.getCoordinates(),\n n = this._curveBuilder.getLineCurve(e, this._distance);\n this.addCurve(n, Su.EXTERIOR, Su.INTERIOR);\n }, Gl.prototype.addPolygon = function (t) {\n var e = this._distance,\n n = Nh.LEFT;\n this._distance < 0 && (e = -this._distance, n = Nh.RIGHT);\n var r = t.getExteriorRing(),\n i = Cc.removeRepeatedPoints(r.getCoordinates());\n if (this._distance < 0 && this.isErodedCompletely(r, this._distance)) return null;\n if (this._distance <= 0 && i.length < 3) return null;\n this.addPolygonRing(i, e, n, Su.EXTERIOR, Su.INTERIOR);\n for (var o = 0; o < t.getNumInteriorRing(); o++) {\n var s = t.getInteriorRingN(o),\n a = Cc.removeRepeatedPoints(s.getCoordinates());\n this._distance > 0 && this.isErodedCompletely(s, -this._distance) || this.addPolygonRing(a, e, Nh.opposite(n), Su.INTERIOR, Su.EXTERIOR);\n }\n }, Gl.prototype.isTriangleErodedCompletely = function (t, e) {\n var n = new ql(t[0], t[1], t[2]),\n r = n.inCentre();\n return sc.distancePointLine(r, n.p0, n.p1) < Math.abs(e);\n }, Gl.prototype.addLineString = function (t) {\n if (this._distance <= 0 && !this._curveBuilder.getBufferParameters().isSingleSided()) return null;\n var e = Cc.removeRepeatedPoints(t.getCoordinates()),\n n = this._curveBuilder.getLineCurve(e, this._distance);\n this.addCurve(n, Su.EXTERIOR, Su.INTERIOR);\n }, Gl.prototype.addCurve = function (t, e, n) {\n if (null === t || t.length < 2) return null;\n var r = new fl(t, new Rh(0, Su.BOUNDARY, e, n));\n this._curveList.add(r);\n }, Gl.prototype.getCurves = function () {\n return this.add(this._inputGeom), this._curveList;\n }, Gl.prototype.addPolygonRing = function (t, e, n, r, i) {\n if (0 === e && t.length < eh.MINIMUM_VALID_SIZE) return null;\n var o = r,\n s = i;\n t.length >= eh.MINIMUM_VALID_SIZE && sc.isCCW(t) && (o = i, s = r, n = Nh.opposite(n));\n var a = this._curveBuilder.getRingCurve(t, n, e);\n this.addCurve(a, o, s);\n }, Gl.prototype.add = function (t) {\n if (t.isEmpty()) return null;\n t instanceof $c ? this.addPolygon(t) : t instanceof Jc ? this.addLineString(t) : t instanceof Kc ? this.addPoint(t) : t instanceof th ? this.addCollection(t) : t instanceof Xc ? this.addCollection(t) : t instanceof nh ? this.addCollection(t) : t instanceof jc && this.addCollection(t);\n }, Gl.prototype.isErodedCompletely = function (t, e) {\n var n = t.getCoordinates();\n if (n.length < 4) return e < 0;\n if (4 === n.length) return this.isTriangleErodedCompletely(n, e);\n var r = t.getEnvelopeInternal(),\n i = Math.min(r.getHeight(), r.getWidth());\n return e < 0 && 2 * Math.abs(e) > i;\n }, Gl.prototype.addCollection = function (t) {\n for (var e = 0; e < t.getNumGeometries(); e++) {\n var n = t.getGeometryN(e);\n this.add(n);\n }\n }, Gl.prototype.interfaces_ = function () {\n return [];\n }, Gl.prototype.getClass = function () {\n return Gl;\n };\n var Bl = function () {};\n Bl.prototype.locate = function (t) {}, Bl.prototype.interfaces_ = function () {\n return [];\n }, Bl.prototype.getClass = function () {\n return Bl;\n };\n var kl = function () {\n this._parent = null, this._atStart = null, this._max = null, this._index = null, this._subcollectionIterator = null;\n var t = arguments[0];\n this._parent = t, this._atStart = !0, this._index = 0, this._max = t.getNumGeometries();\n };\n kl.prototype.next = function () {\n if (this._atStart) return this._atStart = !1, kl.isAtomic(this._parent) && this._index++, this._parent;\n if (null !== this._subcollectionIterator) {\n if (this._subcollectionIterator.hasNext()) return this._subcollectionIterator.next();\n this._subcollectionIterator = null;\n }\n if (this._index >= this._max) throw new Pi();\n var t = this._parent.getGeometryN(this._index++);\n return t instanceof jc ? (this._subcollectionIterator = new kl(t), this._subcollectionIterator.next()) : t;\n }, kl.prototype.remove = function () {\n throw new Error(this.getClass().getName());\n }, kl.prototype.hasNext = function () {\n if (this._atStart) return !0;\n if (null !== this._subcollectionIterator) {\n if (this._subcollectionIterator.hasNext()) return !0;\n this._subcollectionIterator = null;\n }\n return !(this._index >= this._max);\n }, kl.prototype.interfaces_ = function () {\n return [Ec];\n }, kl.prototype.getClass = function () {\n return kl;\n }, kl.isAtomic = function (t) {\n return !(t instanceof jc);\n };\n var zl = function () {\n this._geom = null;\n var t = arguments[0];\n this._geom = t;\n };\n zl.prototype.locate = function (t) {\n return zl.locate(t, this._geom);\n }, zl.prototype.interfaces_ = function () {\n return [Bl];\n }, zl.prototype.getClass = function () {\n return zl;\n }, zl.isPointInRing = function (t, e) {\n return !!e.getEnvelopeInternal().intersects(t) && sc.isPointInRing(t, e.getCoordinates());\n }, zl.containsPointInPolygon = function (t, e) {\n if (e.isEmpty()) return !1;\n var n = e.getExteriorRing();\n if (!zl.isPointInRing(t, n)) return !1;\n for (var r = 0; r < e.getNumInteriorRing(); r++) {\n var i = e.getInteriorRingN(r);\n if (zl.isPointInRing(t, i)) return !1;\n }\n return !0;\n }, zl.containsPoint = function (t, e) {\n if (e instanceof $c) return zl.containsPointInPolygon(t, e);\n if (e instanceof jc) for (var n = new kl(e); n.hasNext();) {\n var r = n.next();\n if (r !== e && zl.containsPoint(t, r)) return !0;\n }\n return !1;\n }, zl.locate = function (t, e) {\n return e.isEmpty() ? Su.EXTERIOR : zl.containsPoint(t, e) ? Su.INTERIOR : Su.EXTERIOR;\n };\n var jl = function () {\n this._edgeMap = new Gi(), this._edgeList = null, this._ptInAreaLocation = [Su.NONE, Su.NONE];\n };\n jl.prototype.getNextCW = function (t) {\n this.getEdges();\n var e = this._edgeList.indexOf(t),\n n = e - 1;\n return 0 === e && (n = this._edgeList.size() - 1), this._edgeList.get(n);\n }, jl.prototype.propagateSideLabels = function (t) {\n for (var e = Su.NONE, n = this.iterator(); n.hasNext();) {\n var r = n.next().getLabel();\n r.isArea(t) && r.getLocation(t, Nh.LEFT) !== Su.NONE && (e = r.getLocation(t, Nh.LEFT));\n }\n if (e === Su.NONE) return null;\n for (var i = e, o = this.iterator(); o.hasNext();) {\n var s = o.next(),\n a = s.getLabel();\n if (a.getLocation(t, Nh.ON) === Su.NONE && a.setLocation(t, Nh.ON, i), a.isArea(t)) {\n var u = a.getLocation(t, Nh.LEFT),\n c = a.getLocation(t, Nh.RIGHT);\n if (c !== Su.NONE) {\n if (c !== i) throw new Mh(\"side location conflict\", s.getCoordinate());\n u === Su.NONE && tc.shouldNeverReachHere(\"found single null side (at \" + s.getCoordinate() + \")\"), i = u;\n } else tc.isTrue(a.getLocation(t, Nh.LEFT) === Su.NONE, \"found single null side\"), a.setLocation(t, Nh.RIGHT, i), a.setLocation(t, Nh.LEFT, i);\n }\n }\n }, jl.prototype.getCoordinate = function () {\n var t = this.iterator();\n if (!t.hasNext()) return null;\n return t.next().getCoordinate();\n }, jl.prototype.print = function (t) {\n Xu.out.println(\"EdgeEndStar: \" + this.getCoordinate());\n for (var e = this.iterator(); e.hasNext();) {\n e.next().print(t);\n }\n }, jl.prototype.isAreaLabelsConsistent = function (t) {\n return this.computeEdgeEndLabels(t.getBoundaryNodeRule()), this.checkAreaLabelsConsistent(0);\n }, jl.prototype.checkAreaLabelsConsistent = function (t) {\n var e = this.getEdges();\n if (e.size() <= 0) return !0;\n var n = e.size() - 1,\n r = e.get(n).getLabel().getLocation(t, Nh.LEFT);\n tc.isTrue(r !== Su.NONE, \"Found unlabelled area edge\");\n for (var i = r, o = this.iterator(); o.hasNext();) {\n var s = o.next().getLabel();\n tc.isTrue(s.isArea(t), \"Found non-area edge\");\n var a = s.getLocation(t, Nh.LEFT),\n u = s.getLocation(t, Nh.RIGHT);\n if (a === u) return !1;\n if (u !== i) return !1;\n i = a;\n }\n return !0;\n }, jl.prototype.findIndex = function (t) {\n this.iterator();\n for (var e = 0; e < this._edgeList.size(); e++) {\n if (this._edgeList.get(e) === t) return e;\n }\n return -1;\n }, jl.prototype.iterator = function () {\n return this.getEdges().iterator();\n }, jl.prototype.getEdges = function () {\n return null === this._edgeList && (this._edgeList = new bc(this._edgeMap.values())), this._edgeList;\n }, jl.prototype.getLocation = function (t, e, n) {\n return this._ptInAreaLocation[t] === Su.NONE && (this._ptInAreaLocation[t] = zl.locate(e, n[t].getGeometry())), this._ptInAreaLocation[t];\n }, jl.prototype.toString = function () {\n var t = new Ru();\n t.append(\"EdgeEndStar: \" + this.getCoordinate()), t.append(\"\\n\");\n for (var e = this.iterator(); e.hasNext();) {\n var n = e.next();\n t.append(n), t.append(\"\\n\");\n }\n return t.toString();\n }, jl.prototype.computeEdgeEndLabels = function (t) {\n for (var e = this.iterator(); e.hasNext();) {\n e.next().computeLabel(t);\n }\n }, jl.prototype.computeLabelling = function (t) {\n this.computeEdgeEndLabels(t[0].getBoundaryNodeRule()), this.propagateSideLabels(0), this.propagateSideLabels(1);\n for (var e = [!1, !1], n = this.iterator(); n.hasNext();) for (var r = n.next().getLabel(), i = 0; i < 2; i++) r.isLine(i) && r.getLocation(i) === Su.BOUNDARY && (e[i] = !0);\n for (var o = this.iterator(); o.hasNext();) for (var s = o.next(), a = s.getLabel(), u = 0; u < 2; u++) if (a.isAnyNull(u)) {\n var c = Su.NONE;\n if (e[u]) c = Su.EXTERIOR;else {\n var h = s.getCoordinate();\n c = this.getLocation(u, h, t);\n }\n a.setAllLocationsIfNull(u, c);\n }\n }, jl.prototype.getDegree = function () {\n return this._edgeMap.size();\n }, jl.prototype.insertEdgeEnd = function (t, e) {\n this._edgeMap.put(t, e), this._edgeList = null;\n }, jl.prototype.interfaces_ = function () {\n return [];\n }, jl.prototype.getClass = function () {\n return jl;\n };\n var Xl = function (t) {\n function e() {\n t.call(this), this._resultAreaEdgeList = null, this._label = null, this._SCANNING_FOR_INCOMING = 1, this._LINKING_TO_OUTGOING = 2;\n }\n return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.linkResultDirectedEdges = function () {\n this.getResultAreaEdges();\n for (var t = null, e = null, n = this._SCANNING_FOR_INCOMING, r = 0; r < this._resultAreaEdgeList.size(); r++) {\n var i = this._resultAreaEdgeList.get(r),\n o = i.getSym();\n if (i.getLabel().isArea()) switch (null === t && i.isInResult() && (t = i), n) {\n case this._SCANNING_FOR_INCOMING:\n if (!o.isInResult()) continue;\n e = o, n = this._LINKING_TO_OUTGOING;\n break;\n case this._LINKING_TO_OUTGOING:\n if (!i.isInResult()) continue;\n e.setNext(i), n = this._SCANNING_FOR_INCOMING;\n }\n }\n if (n === this._LINKING_TO_OUTGOING) {\n if (null === t) throw new Mh(\"no outgoing dirEdge found\", this.getCoordinate());\n tc.isTrue(t.isInResult(), \"unable to link last incoming dirEdge\"), e.setNext(t);\n }\n }, e.prototype.insert = function (t) {\n var e = t;\n this.insertEdgeEnd(e, e);\n }, e.prototype.getRightmostEdge = function () {\n var t = this.getEdges(),\n e = t.size();\n if (e < 1) return null;\n var n = t.get(0);\n if (1 === e) return n;\n var r = t.get(e - 1),\n i = n.getQuadrant(),\n o = r.getQuadrant();\n return Bh.isNorthern(i) && Bh.isNorthern(o) ? n : Bh.isNorthern(i) || Bh.isNorthern(o) ? 0 !== n.getDy() ? n : 0 !== r.getDy() ? r : (tc.shouldNeverReachHere(\"found two horizontal edges incident on node\"), null) : r;\n }, e.prototype.print = function (t) {\n Xu.out.println(\"DirectedEdgeStar: \" + this.getCoordinate());\n for (var e = this.iterator(); e.hasNext();) {\n var n = e.next();\n t.print(\"out \"), n.print(t), t.println(), t.print(\"in \"), n.getSym().print(t), t.println();\n }\n }, e.prototype.getResultAreaEdges = function () {\n if (null !== this._resultAreaEdgeList) return this._resultAreaEdgeList;\n this._resultAreaEdgeList = new bc();\n for (var t = this.iterator(); t.hasNext();) {\n var e = t.next();\n (e.isInResult() || e.getSym().isInResult()) && this._resultAreaEdgeList.add(e);\n }\n return this._resultAreaEdgeList;\n }, e.prototype.updateLabelling = function (t) {\n for (var e = this.iterator(); e.hasNext();) {\n var n = e.next().getLabel();\n n.setAllLocationsIfNull(0, t.getLocation(0)), n.setAllLocationsIfNull(1, t.getLocation(1));\n }\n }, e.prototype.linkAllDirectedEdges = function () {\n this.getEdges();\n for (var t = null, e = null, n = this._edgeList.size() - 1; n >= 0; n--) {\n var r = this._edgeList.get(n),\n i = r.getSym();\n null === e && (e = i), null !== t && i.setNext(t), t = r;\n }\n e.setNext(t);\n }, e.prototype.computeDepths = function () {\n if (1 === arguments.length) {\n var t = arguments[0],\n e = this.findIndex(t),\n n = t.getDepth(Nh.LEFT),\n r = t.getDepth(Nh.RIGHT),\n i = this.computeDepths(e + 1, this._edgeList.size(), n);\n if (this.computeDepths(0, e, i) !== r) throw new Mh(\"depth mismatch at \" + t.getCoordinate());\n } else if (3 === arguments.length) {\n for (var o = arguments[0], s = arguments[1], a = arguments[2], u = o; u < s; u++) {\n var c = this._edgeList.get(u);\n c.setEdgeDepths(Nh.RIGHT, a), a = c.getDepth(Nh.LEFT);\n }\n return a;\n }\n }, e.prototype.mergeSymLabels = function () {\n for (var t = this.iterator(); t.hasNext();) {\n var e = t.next();\n e.getLabel().merge(e.getSym().getLabel());\n }\n }, e.prototype.linkMinimalDirectedEdges = function (t) {\n for (var e = null, n = null, r = this._SCANNING_FOR_INCOMING, i = this._resultAreaEdgeList.size() - 1; i >= 0; i--) {\n var o = this._resultAreaEdgeList.get(i),\n s = o.getSym();\n switch (null === e && o.getEdgeRing() === t && (e = o), r) {\n case this._SCANNING_FOR_INCOMING:\n if (s.getEdgeRing() !== t) continue;\n n = s, r = this._LINKING_TO_OUTGOING;\n break;\n case this._LINKING_TO_OUTGOING:\n if (o.getEdgeRing() !== t) continue;\n n.setNextMin(o), r = this._SCANNING_FOR_INCOMING;\n }\n }\n r === this._LINKING_TO_OUTGOING && (tc.isTrue(null !== e, \"found null for first outgoing dirEdge\"), tc.isTrue(e.getEdgeRing() === t, \"unable to link last incoming dirEdge\"), n.setNextMin(e));\n }, e.prototype.getOutgoingDegree = function () {\n if (0 === arguments.length) {\n for (var t = 0, e = this.iterator(); e.hasNext();) {\n e.next().isInResult() && t++;\n }\n return t;\n }\n if (1 === arguments.length) {\n for (var n = arguments[0], r = 0, i = this.iterator(); i.hasNext();) {\n i.next().getEdgeRing() === n && r++;\n }\n return r;\n }\n }, e.prototype.getLabel = function () {\n return this._label;\n }, e.prototype.findCoveredLineEdges = function () {\n for (var t = Su.NONE, e = this.iterator(); e.hasNext();) {\n var n = e.next(),\n r = n.getSym();\n if (!n.isLineEdge()) {\n if (n.isInResult()) {\n t = Su.INTERIOR;\n break;\n }\n if (r.isInResult()) {\n t = Su.EXTERIOR;\n break;\n }\n }\n }\n if (t === Su.NONE) return null;\n for (var i = t, o = this.iterator(); o.hasNext();) {\n var s = o.next(),\n a = s.getSym();\n s.isLineEdge() ? s.getEdge().setCovered(i === Su.INTERIOR) : (s.isInResult() && (i = Su.EXTERIOR), a.isInResult() && (i = Su.INTERIOR));\n }\n }, e.prototype.computeLabelling = function (e) {\n t.prototype.computeLabelling.call(this, e), this._label = new Rh(Su.NONE);\n for (var n = this.iterator(); n.hasNext();) for (var r = n.next().getEdge().getLabel(), i = 0; i < 2; i++) {\n var o = r.getLocation(i);\n o !== Su.INTERIOR && o !== Su.BOUNDARY || this._label.setLocation(i, Su.INTERIOR);\n }\n }, e.prototype.interfaces_ = function () {\n return [];\n }, e.prototype.getClass = function () {\n return e;\n }, e;\n }(jl),\n Ul = function (t) {\n function e() {\n t.apply(this, arguments);\n }\n return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.createNode = function (t) {\n return new qh(t, new Xl());\n }, e.prototype.interfaces_ = function () {\n return [];\n }, e.prototype.getClass = function () {\n return e;\n }, e;\n }(Xh),\n Yl = function t() {\n this._pts = null, this._orientation = null;\n var e = arguments[0];\n this._pts = e, this._orientation = t.orientation(e);\n };\n Yl.prototype.compareTo = function (t) {\n var e = t;\n return Yl.compareOriented(this._pts, this._orientation, e._pts, e._orientation);\n }, Yl.prototype.interfaces_ = function () {\n return [xu];\n }, Yl.prototype.getClass = function () {\n return Yl;\n }, Yl.orientation = function (t) {\n return 1 === Cc.increasingDirection(t);\n }, Yl.compareOriented = function (t, e, n, r) {\n for (var i = e ? 1 : -1, o = r ? 1 : -1, s = e ? t.length : -1, a = r ? n.length : -1, u = e ? 0 : t.length - 1, c = r ? 0 : n.length - 1;;) {\n var h = t[u].compareTo(n[c]);\n if (0 !== h) return h;\n var l = (u += i) === s,\n p = (c += o) === a;\n if (l && !p) return -1;\n if (!l && p) return 1;\n if (l && p) return 0;\n }\n };\n var Vl = function () {\n this._edges = new bc(), this._ocaMap = new Gi();\n };\n Vl.prototype.print = function (t) {\n t.print(\"MULTILINESTRING ( \");\n for (var e = 0; e < this._edges.size(); e++) {\n var n = this._edges.get(e);\n e > 0 && t.print(\",\"), t.print(\"(\");\n for (var r = n.getCoordinates(), i = 0; i < r.length; i++) i > 0 && t.print(\",\"), t.print(r[i].x + \" \" + r[i].y);\n t.println(\")\");\n }\n t.print(\") \");\n }, Vl.prototype.addAll = function (t) {\n for (var e = t.iterator(); e.hasNext();) this.add(e.next());\n }, Vl.prototype.findEdgeIndex = function (t) {\n for (var e = 0; e < this._edges.size(); e++) if (this._edges.get(e).equals(t)) return e;\n return -1;\n }, Vl.prototype.iterator = function () {\n return this._edges.iterator();\n }, Vl.prototype.getEdges = function () {\n return this._edges;\n }, Vl.prototype.get = function (t) {\n return this._edges.get(t);\n }, Vl.prototype.findEqualEdge = function (t) {\n var e = new Yl(t.getCoordinates());\n return this._ocaMap.get(e);\n }, Vl.prototype.add = function (t) {\n this._edges.add(t);\n var e = new Yl(t.getCoordinates());\n this._ocaMap.put(e, t);\n }, Vl.prototype.interfaces_ = function () {\n return [];\n }, Vl.prototype.getClass = function () {\n return Vl;\n };\n var Hl = function () {};\n Hl.prototype.processIntersections = function (t, e, n, r) {}, Hl.prototype.isDone = function () {}, Hl.prototype.interfaces_ = function () {\n return [];\n }, Hl.prototype.getClass = function () {\n return Hl;\n };\n var Wl = function () {\n this._hasIntersection = !1, this._hasProper = !1, this._hasProperInterior = !1, this._hasInterior = !1, this._properIntersectionPoint = null, this._li = null, this._isSelfIntersection = null, this.numIntersections = 0, this.numInteriorIntersections = 0, this.numProperIntersections = 0, this.numTests = 0;\n var t = arguments[0];\n this._li = t;\n };\n Wl.prototype.isTrivialIntersection = function (t, e, n, r) {\n if (t === n && 1 === this._li.getIntersectionNum()) {\n if (Wl.isAdjacentSegments(e, r)) return !0;\n if (t.isClosed()) {\n var i = t.size() - 1;\n if (0 === e && r === i || 0 === r && e === i) return !0;\n }\n }\n return !1;\n }, Wl.prototype.getProperIntersectionPoint = function () {\n return this._properIntersectionPoint;\n }, Wl.prototype.hasProperInteriorIntersection = function () {\n return this._hasProperInterior;\n }, Wl.prototype.getLineIntersector = function () {\n return this._li;\n }, Wl.prototype.hasProperIntersection = function () {\n return this._hasProper;\n }, Wl.prototype.processIntersections = function (t, e, n, r) {\n if (t === n && e === r) return null;\n this.numTests++;\n var i = t.getCoordinates()[e],\n o = t.getCoordinates()[e + 1],\n s = n.getCoordinates()[r],\n a = n.getCoordinates()[r + 1];\n this._li.computeIntersection(i, o, s, a), this._li.hasIntersection() && (this.numIntersections++, this._li.isInteriorIntersection() && (this.numInteriorIntersections++, this._hasInterior = !0), this.isTrivialIntersection(t, e, n, r) || (this._hasIntersection = !0, t.addIntersections(this._li, e, 0), n.addIntersections(this._li, r, 1), this._li.isProper() && (this.numProperIntersections++, this._hasProper = !0, this._hasProperInterior = !0)));\n }, Wl.prototype.hasIntersection = function () {\n return this._hasIntersection;\n }, Wl.prototype.isDone = function () {\n return !1;\n }, Wl.prototype.hasInteriorIntersection = function () {\n return this._hasInterior;\n }, Wl.prototype.interfaces_ = function () {\n return [Hl];\n }, Wl.prototype.getClass = function () {\n return Wl;\n }, Wl.isAdjacentSegments = function (t, e) {\n return 1 === Math.abs(t - e);\n };\n var Jl = function () {\n this.coord = null, this.segmentIndex = null, this.dist = null;\n var t = arguments[0],\n e = arguments[1],\n n = arguments[2];\n this.coord = new bu(t), this.segmentIndex = e, this.dist = n;\n };\n Jl.prototype.getSegmentIndex = function () {\n return this.segmentIndex;\n }, Jl.prototype.getCoordinate = function () {\n return this.coord;\n }, Jl.prototype.print = function (t) {\n t.print(this.coord), t.print(\" seg # = \" + this.segmentIndex), t.println(\" dist = \" + this.dist);\n }, Jl.prototype.compareTo = function (t) {\n var e = t;\n return this.compare(e.segmentIndex, e.dist);\n }, Jl.prototype.isEndPoint = function (t) {\n return 0 === this.segmentIndex && 0 === this.dist || this.segmentIndex === t;\n }, Jl.prototype.toString = function () {\n return this.coord + \" seg # = \" + this.segmentIndex + \" dist = \" + this.dist;\n }, Jl.prototype.getDistance = function () {\n return this.dist;\n }, Jl.prototype.compare = function (t, e) {\n return this.segmentIndex < t ? -1 : this.segmentIndex > t ? 1 : this.dist < e ? -1 : this.dist > e ? 1 : 0;\n }, Jl.prototype.interfaces_ = function () {\n return [xu];\n }, Jl.prototype.getClass = function () {\n return Jl;\n };\n var Zl = function () {\n this._nodeMap = new Gi(), this.edge = null;\n var t = arguments[0];\n this.edge = t;\n };\n Zl.prototype.print = function (t) {\n t.println(\"Intersections:\");\n for (var e = this.iterator(); e.hasNext();) {\n e.next().print(t);\n }\n }, Zl.prototype.iterator = function () {\n return this._nodeMap.values().iterator();\n }, Zl.prototype.addSplitEdges = function (t) {\n this.addEndpoints();\n for (var e = this.iterator(), n = e.next(); e.hasNext();) {\n var r = e.next(),\n i = this.createSplitEdge(n, r);\n t.add(i), n = r;\n }\n }, Zl.prototype.addEndpoints = function () {\n var t = this.edge.pts.length - 1;\n this.add(this.edge.pts[0], 0, 0), this.add(this.edge.pts[t], t, 0);\n }, Zl.prototype.createSplitEdge = function (t, e) {\n var n = e.segmentIndex - t.segmentIndex + 2,\n r = this.edge.pts[e.segmentIndex],\n i = e.dist > 0 || !e.coord.equals2D(r);\n i || n--;\n var o = new Array(n).fill(null),\n s = 0;\n o[s++] = new bu(t.coord);\n for (var a = t.segmentIndex + 1; a <= e.segmentIndex; a++) o[s++] = this.edge.pts[a];\n return i && (o[s] = e.coord), new ep(o, new Rh(this.edge._label));\n }, Zl.prototype.add = function (t, e, n) {\n var r = new Jl(t, e, n),\n i = this._nodeMap.get(r);\n return null !== i ? i : (this._nodeMap.put(r, r), r);\n }, Zl.prototype.isIntersection = function (t) {\n for (var e = this.iterator(); e.hasNext();) {\n if (e.next().coord.equals(t)) return !0;\n }\n return !1;\n }, Zl.prototype.interfaces_ = function () {\n return [];\n }, Zl.prototype.getClass = function () {\n return Zl;\n };\n var Kl = function () {};\n Kl.prototype.getChainStartIndices = function (t) {\n var e = 0,\n n = new bc();\n n.add(new Tu(e));\n do {\n var r = this.findChainEnd(t, e);\n n.add(new Tu(r)), e = r;\n } while (e < t.length - 1);\n return Kl.toIntArray(n);\n }, Kl.prototype.findChainEnd = function (t, e) {\n for (var n = Bh.quadrant(t[e], t[e + 1]), r = e + 1; r < t.length;) {\n if (Bh.quadrant(t[r - 1], t[r]) !== n) break;\n r++;\n }\n return r - 1;\n }, Kl.prototype.interfaces_ = function () {\n return [];\n }, Kl.prototype.getClass = function () {\n return Kl;\n }, Kl.toIntArray = function (t) {\n for (var e = new Array(t.size()).fill(null), n = 0; n < e.length; n++) e[n] = t.get(n).intValue();\n return e;\n };\n var Ql = function () {\n this.e = null, this.pts = null, this.startIndex = null, this.env1 = new Yu(), this.env2 = new Yu();\n var t = arguments[0];\n this.e = t, this.pts = t.getCoordinates();\n var e = new Kl();\n this.startIndex = e.getChainStartIndices(this.pts);\n };\n Ql.prototype.getCoordinates = function () {\n return this.pts;\n }, Ql.prototype.getMaxX = function (t) {\n var e = this.pts[this.startIndex[t]].x,\n n = this.pts[this.startIndex[t + 1]].x;\n return e > n ? e : n;\n }, Ql.prototype.getMinX = function (t) {\n var e = this.pts[this.startIndex[t]].x,\n n = this.pts[this.startIndex[t + 1]].x;\n return e < n ? e : n;\n }, Ql.prototype.computeIntersectsForChain = function () {\n if (4 === arguments.length) {\n var t = arguments[0],\n e = arguments[1],\n n = arguments[2],\n r = arguments[3];\n this.computeIntersectsForChain(this.startIndex[t], this.startIndex[t + 1], e, e.startIndex[n], e.startIndex[n + 1], r);\n } else if (6 === arguments.length) {\n var i = arguments[0],\n o = arguments[1],\n s = arguments[2],\n a = arguments[3],\n u = arguments[4],\n c = arguments[5],\n h = this.pts[i],\n l = this.pts[o],\n p = s.pts[a],\n f = s.pts[u];\n if (o - i == 1 && u - a == 1) return c.addIntersections(this.e, i, s.e, a), null;\n if (this.env1.init(h, l), this.env2.init(p, f), !this.env1.intersects(this.env2)) return null;\n var g = Math.trunc((i + o) / 2),\n d = Math.trunc((a + u) / 2);\n i < g && (a < d && this.computeIntersectsForChain(i, g, s, a, d, c), d < u && this.computeIntersectsForChain(i, g, s, d, u, c)), g < o && (a < d && this.computeIntersectsForChain(g, o, s, a, d, c), d < u && this.computeIntersectsForChain(g, o, s, d, u, c));\n }\n }, Ql.prototype.getStartIndexes = function () {\n return this.startIndex;\n }, Ql.prototype.computeIntersects = function (t, e) {\n for (var n = 0; n < this.startIndex.length - 1; n++) for (var r = 0; r < t.startIndex.length - 1; r++) this.computeIntersectsForChain(n, t, r, e);\n }, Ql.prototype.interfaces_ = function () {\n return [];\n }, Ql.prototype.getClass = function () {\n return Ql;\n };\n var $l = function t() {\n this._depth = Array(2).fill().map(function () {\n return Array(3);\n });\n for (var e = 0; e < 2; e++) for (var n = 0; n < 3; n++) this._depth[e][n] = t.NULL_VALUE;\n },\n tp = {\n NULL_VALUE: {\n configurable: !0\n }\n };\n $l.prototype.getDepth = function (t, e) {\n return this._depth[t][e];\n }, $l.prototype.setDepth = function (t, e, n) {\n this._depth[t][e] = n;\n }, $l.prototype.isNull = function () {\n if (0 === arguments.length) {\n for (var t = 0; t < 2; t++) for (var e = 0; e < 3; e++) if (this._depth[t][e] !== $l.NULL_VALUE) return !1;\n return !0;\n }\n if (1 === arguments.length) {\n var n = arguments[0];\n return this._depth[n][1] === $l.NULL_VALUE;\n }\n if (2 === arguments.length) {\n var r = arguments[0],\n i = arguments[1];\n return this._depth[r][i] === $l.NULL_VALUE;\n }\n }, $l.prototype.normalize = function () {\n for (var t = 0; t < 2; t++) if (!this.isNull(t)) {\n var e = this._depth[t][1];\n this._depth[t][2] < e && (e = this._depth[t][2]), e < 0 && (e = 0);\n for (var n = 1; n < 3; n++) {\n var r = 0;\n this._depth[t][n] > e && (r = 1), this._depth[t][n] = r;\n }\n }\n }, $l.prototype.getDelta = function (t) {\n return this._depth[t][Nh.RIGHT] - this._depth[t][Nh.LEFT];\n }, $l.prototype.getLocation = function (t, e) {\n return this._depth[t][e] <= 0 ? Su.EXTERIOR : Su.INTERIOR;\n }, $l.prototype.toString = function () {\n return \"A: \" + this._depth[0][1] + \",\" + this._depth[0][2] + \" B: \" + this._depth[1][1] + \",\" + this._depth[1][2];\n }, $l.prototype.add = function () {\n if (1 === arguments.length) for (var t = arguments[0], e = 0; e < 2; e++) for (var n = 1; n < 3; n++) {\n var r = t.getLocation(e, n);\n r !== Su.EXTERIOR && r !== Su.INTERIOR || (this.isNull(e, n) ? this._depth[e][n] = $l.depthAtLocation(r) : this._depth[e][n] += $l.depthAtLocation(r));\n } else if (3 === arguments.length) {\n var i = arguments[0],\n o = arguments[1];\n arguments[2] === Su.INTERIOR && this._depth[i][o]++;\n }\n }, $l.prototype.interfaces_ = function () {\n return [];\n }, $l.prototype.getClass = function () {\n return $l;\n }, $l.depthAtLocation = function (t) {\n return t === Su.EXTERIOR ? 0 : t === Su.INTERIOR ? 1 : $l.NULL_VALUE;\n }, tp.NULL_VALUE.get = function () {\n return -1;\n }, Object.defineProperties($l, tp);\n var ep = function (t) {\n function e() {\n if (t.call(this), this.pts = null, this._env = null, this.eiList = new Zl(this), this._name = null, this._mce = null, this._isIsolated = !0, this._depth = new $l(), this._depthDelta = 0, 1 === arguments.length) {\n var n = arguments[0];\n e.call(this, n, null);\n } else if (2 === arguments.length) {\n var r = arguments[0],\n i = arguments[1];\n this.pts = r, this._label = i;\n }\n }\n return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.getDepth = function () {\n return this._depth;\n }, e.prototype.getCollapsedEdge = function () {\n var t = new Array(2).fill(null);\n t[0] = this.pts[0], t[1] = this.pts[1];\n return new e(t, Rh.toLineLabel(this._label));\n }, e.prototype.isIsolated = function () {\n return this._isIsolated;\n }, e.prototype.getCoordinates = function () {\n return this.pts;\n }, e.prototype.setIsolated = function (t) {\n this._isIsolated = t;\n }, e.prototype.setName = function (t) {\n this._name = t;\n }, e.prototype.equals = function (t) {\n if (!(t instanceof e)) return !1;\n var n = t;\n if (this.pts.length !== n.pts.length) return !1;\n for (var r = !0, i = !0, o = this.pts.length, s = 0; s < this.pts.length; s++) if (this.pts[s].equals2D(n.pts[s]) || (r = !1), this.pts[s].equals2D(n.pts[--o]) || (i = !1), !r && !i) return !1;\n return !0;\n }, e.prototype.getCoordinate = function () {\n if (0 === arguments.length) return this.pts.length > 0 ? this.pts[0] : null;\n if (1 === arguments.length) {\n var t = arguments[0];\n return this.pts[t];\n }\n }, e.prototype.print = function (t) {\n t.print(\"edge \" + this._name + \": \"), t.print(\"LINESTRING (\");\n for (var e = 0; e < this.pts.length; e++) e > 0 && t.print(\",\"), t.print(this.pts[e].x + \" \" + this.pts[e].y);\n t.print(\") \" + this._label + \" \" + this._depthDelta);\n }, e.prototype.computeIM = function (t) {\n e.updateIM(this._label, t);\n }, e.prototype.isCollapsed = function () {\n return !!this._label.isArea() && 3 === this.pts.length && !!this.pts[0].equals(this.pts[2]);\n }, e.prototype.isClosed = function () {\n return this.pts[0].equals(this.pts[this.pts.length - 1]);\n }, e.prototype.getMaximumSegmentIndex = function () {\n return this.pts.length - 1;\n }, e.prototype.getDepthDelta = function () {\n return this._depthDelta;\n }, e.prototype.getNumPoints = function () {\n return this.pts.length;\n }, e.prototype.printReverse = function (t) {\n t.print(\"edge \" + this._name + \": \");\n for (var e = this.pts.length - 1; e >= 0; e--) t.print(this.pts[e] + \" \");\n t.println(\"\");\n }, e.prototype.getMonotoneChainEdge = function () {\n return null === this._mce && (this._mce = new Ql(this)), this._mce;\n }, e.prototype.getEnvelope = function () {\n if (null === this._env) {\n this._env = new Yu();\n for (var t = 0; t < this.pts.length; t++) this._env.expandToInclude(this.pts[t]);\n }\n return this._env;\n }, e.prototype.addIntersection = function (t, e, n, r) {\n var i = new bu(t.getIntersection(r)),\n o = e,\n s = t.getEdgeDistance(n, r),\n a = o + 1;\n if (a < this.pts.length) {\n var u = this.pts[a];\n i.equals2D(u) && (o = a, s = 0);\n }\n this.eiList.add(i, o, s);\n }, e.prototype.toString = function () {\n var t = new Ru();\n t.append(\"edge \" + this._name + \": \"), t.append(\"LINESTRING (\");\n for (var e = 0; e < this.pts.length; e++) e > 0 && t.append(\",\"), t.append(this.pts[e].x + \" \" + this.pts[e].y);\n return t.append(\") \" + this._label + \" \" + this._depthDelta), t.toString();\n }, e.prototype.isPointwiseEqual = function (t) {\n if (this.pts.length !== t.pts.length) return !1;\n for (var e = 0; e < this.pts.length; e++) if (!this.pts[e].equals2D(t.pts[e])) return !1;\n return !0;\n }, e.prototype.setDepthDelta = function (t) {\n this._depthDelta = t;\n }, e.prototype.getEdgeIntersectionList = function () {\n return this.eiList;\n }, e.prototype.addIntersections = function (t, e, n) {\n for (var r = 0; r < t.getIntersectionNum(); r++) this.addIntersection(t, e, n, r);\n }, e.prototype.interfaces_ = function () {\n return [];\n }, e.prototype.getClass = function () {\n return e;\n }, e.updateIM = function () {\n if (2 !== arguments.length) return t.prototype.updateIM.apply(this, arguments);\n var e = arguments[0],\n n = arguments[1];\n n.setAtLeastIfValid(e.getLocation(0, Nh.ON), e.getLocation(1, Nh.ON), 1), e.isArea() && (n.setAtLeastIfValid(e.getLocation(0, Nh.LEFT), e.getLocation(1, Nh.LEFT), 2), n.setAtLeastIfValid(e.getLocation(0, Nh.RIGHT), e.getLocation(1, Nh.RIGHT), 2));\n }, e;\n }(Fh),\n np = function (t) {\n this._workingPrecisionModel = null, this._workingNoder = null, this._geomFact = null, this._graph = null, this._edgeList = new Vl(), this._bufParams = t || null;\n };\n np.prototype.setWorkingPrecisionModel = function (t) {\n this._workingPrecisionModel = t;\n }, np.prototype.insertUniqueEdge = function (t) {\n var e = this._edgeList.findEqualEdge(t);\n if (null !== e) {\n var n = e.getLabel(),\n r = t.getLabel();\n e.isPointwiseEqual(t) || (r = new Rh(t.getLabel())).flip(), n.merge(r);\n var i = np.depthDelta(r),\n o = e.getDepthDelta() + i;\n e.setDepthDelta(o);\n } else this._edgeList.add(t), t.setDepthDelta(np.depthDelta(t.getLabel()));\n }, np.prototype.buildSubgraphs = function (t, e) {\n for (var n = new bc(), r = t.iterator(); r.hasNext();) {\n var i = r.next(),\n o = i.getRightmostCoordinate(),\n s = new Al(n).getDepth(o);\n i.computeDepth(s), i.findResultEdges(), n.add(i), e.add(i.getDirectedEdges(), i.getNodes());\n }\n }, np.prototype.createSubgraphs = function (t) {\n for (var e = new bc(), n = t.getNodes().iterator(); n.hasNext();) {\n var r = n.next();\n if (!r.isVisited()) {\n var i = new Ph();\n i.create(r), e.add(i);\n }\n }\n return $h.sort(e, $h.reverseOrder()), e;\n }, np.prototype.createEmptyResultGeometry = function () {\n return this._geomFact.createPolygon();\n }, np.prototype.getNoder = function (t) {\n if (null !== this._workingNoder) return this._workingNoder;\n var e = new El(),\n n = new rc();\n return n.setPrecisionModel(t), e.setSegmentIntersector(new Wl(n)), e;\n }, np.prototype.buffer = function (t, e) {\n var n = this._workingPrecisionModel;\n null === n && (n = t.getPrecisionModel()), this._geomFact = t.getFactory();\n var r = new Tl(n, this._bufParams),\n i = new Gl(t, e, r).getCurves();\n if (i.size() <= 0) return this.createEmptyResultGeometry();\n this.computeNodedEdges(i, n), this._graph = new Uh(new Ul()), this._graph.addEdges(this._edgeList.getEdges());\n var o = this.createSubgraphs(this._graph),\n s = new Yh(this._geomFact);\n this.buildSubgraphs(o, s);\n var a = s.getPolygons();\n if (a.size() <= 0) return this.createEmptyResultGeometry();\n return this._geomFact.buildGeometry(a);\n }, np.prototype.computeNodedEdges = function (t, e) {\n var n = this.getNoder(e);\n n.computeNodes(t);\n for (var r = n.getNodedSubstrings().iterator(); r.hasNext();) {\n var i = r.next(),\n o = i.getCoordinates();\n if (2 !== o.length || !o[0].equals2D(o[1])) {\n var s = i.getData(),\n a = new ep(i.getCoordinates(), new Rh(s));\n this.insertUniqueEdge(a);\n }\n }\n }, np.prototype.setNoder = function (t) {\n this._workingNoder = t;\n }, np.prototype.interfaces_ = function () {\n return [];\n }, np.prototype.getClass = function () {\n return np;\n }, np.depthDelta = function (t) {\n var e = t.getLocation(0, Nh.LEFT),\n n = t.getLocation(0, Nh.RIGHT);\n return e === Su.INTERIOR && n === Su.EXTERIOR ? 1 : e === Su.EXTERIOR && n === Su.INTERIOR ? -1 : 0;\n }, np.convertSegStrings = function (t) {\n for (var e = new _h(), n = new bc(); t.hasNext();) {\n var r = t.next(),\n i = e.createLineString(r.getCoordinates());\n n.add(i);\n }\n return e.buildGeometry(n);\n };\n var rp = function () {\n if (this._noder = null, this._scaleFactor = null, this._offsetX = null, this._offsetY = null, this._isScaled = !1, 2 === arguments.length) {\n var t = arguments[0],\n e = arguments[1];\n this._noder = t, this._scaleFactor = e, this._offsetX = 0, this._offsetY = 0, this._isScaled = !this.isIntegerPrecision();\n } else if (4 === arguments.length) {\n var n = arguments[0],\n r = arguments[1],\n i = arguments[2],\n o = arguments[3];\n this._noder = n, this._scaleFactor = r, this._offsetX = i, this._offsetY = o, this._isScaled = !this.isIntegerPrecision();\n }\n };\n rp.prototype.rescale = function () {\n if (Lu(arguments[0], vc)) for (var t = arguments[0].iterator(); t.hasNext();) {\n var e = t.next();\n this.rescale(e.getCoordinates());\n } else if (arguments[0] instanceof Array) {\n for (var n = arguments[0], r = 0; r < n.length; r++) n[r].x = n[r].x / this._scaleFactor + this._offsetX, n[r].y = n[r].y / this._scaleFactor + this._offsetY;\n 2 === n.length && n[0].equals2D(n[1]) && Xu.out.println(n);\n }\n }, rp.prototype.scale = function () {\n if (Lu(arguments[0], vc)) {\n for (var t = arguments[0], e = new bc(), n = t.iterator(); n.hasNext();) {\n var r = n.next();\n e.add(new fl(this.scale(r.getCoordinates()), r.getData()));\n }\n return e;\n }\n if (arguments[0] instanceof Array) {\n for (var i = arguments[0], o = new Array(i.length).fill(null), s = 0; s < i.length; s++) o[s] = new bu(Math.round((i[s].x - this._offsetX) * this._scaleFactor), Math.round((i[s].y - this._offsetY) * this._scaleFactor), i[s].z);\n return Cc.removeRepeatedPoints(o);\n }\n }, rp.prototype.isIntegerPrecision = function () {\n return 1 === this._scaleFactor;\n }, rp.prototype.getNodedSubstrings = function () {\n var t = this._noder.getNodedSubstrings();\n return this._isScaled && this.rescale(t), t;\n }, rp.prototype.computeNodes = function (t) {\n var e = t;\n this._isScaled && (e = this.scale(t)), this._noder.computeNodes(e);\n }, rp.prototype.interfaces_ = function () {\n return [vl];\n }, rp.prototype.getClass = function () {\n return rp;\n };\n var ip = function () {\n this._li = new rc(), this._segStrings = null;\n var t = arguments[0];\n this._segStrings = t;\n },\n op = {\n fact: {\n configurable: !0\n }\n };\n ip.prototype.checkEndPtVertexIntersections = function () {\n if (0 === arguments.length) for (var t = this._segStrings.iterator(); t.hasNext();) {\n var e = t.next().getCoordinates();\n this.checkEndPtVertexIntersections(e[0], this._segStrings), this.checkEndPtVertexIntersections(e[e.length - 1], this._segStrings);\n } else if (2 === arguments.length) for (var n = arguments[0], r = arguments[1].iterator(); r.hasNext();) for (var i = r.next().getCoordinates(), o = 1; o < i.length - 1; o++) if (i[o].equals(n)) throw new Qu(\"found endpt/interior pt intersection at index \" + o + \" :pt \" + n);\n }, ip.prototype.checkInteriorIntersections = function () {\n if (0 === arguments.length) for (var t = this._segStrings.iterator(); t.hasNext();) for (var e = t.next(), n = this._segStrings.iterator(); n.hasNext();) {\n var r = n.next();\n this.checkInteriorIntersections(e, r);\n } else if (2 === arguments.length) for (var i = arguments[0], o = arguments[1], s = i.getCoordinates(), a = o.getCoordinates(), u = 0; u < s.length - 1; u++) for (var c = 0; c < a.length - 1; c++) this.checkInteriorIntersections(i, u, o, c);else if (4 === arguments.length) {\n var h = arguments[0],\n l = arguments[1],\n p = arguments[2],\n f = arguments[3];\n if (h === p && l === f) return null;\n var g = h.getCoordinates()[l],\n d = h.getCoordinates()[l + 1],\n y = p.getCoordinates()[f],\n _ = p.getCoordinates()[f + 1];\n if (this._li.computeIntersection(g, d, y, _), this._li.hasIntersection() && (this._li.isProper() || this.hasInteriorIntersection(this._li, g, d) || this.hasInteriorIntersection(this._li, y, _))) throw new Qu(\"found non-noded intersection at \" + g + \"-\" + d + \" and \" + y + \"-\" + _);\n }\n }, ip.prototype.checkValid = function () {\n this.checkEndPtVertexIntersections(), this.checkInteriorIntersections(), this.checkCollapses();\n }, ip.prototype.checkCollapses = function () {\n if (0 === arguments.length) for (var t = this._segStrings.iterator(); t.hasNext();) {\n var e = t.next();\n this.checkCollapses(e);\n } else if (1 === arguments.length) for (var n = arguments[0].getCoordinates(), r = 0; r < n.length - 2; r++) this.checkCollapse(n[r], n[r + 1], n[r + 2]);\n }, ip.prototype.hasInteriorIntersection = function (t, e, n) {\n for (var r = 0; r < t.getIntersectionNum(); r++) {\n var i = t.getIntersection(r);\n if (!i.equals(e) && !i.equals(n)) return !0;\n }\n return !1;\n }, ip.prototype.checkCollapse = function (t, e, n) {\n if (t.equals(n)) throw new Qu(\"found non-noded collapse at \" + ip.fact.createLineString([t, e, n]));\n }, ip.prototype.interfaces_ = function () {\n return [];\n }, ip.prototype.getClass = function () {\n return ip;\n }, op.fact.get = function () {\n return new _h();\n }, Object.defineProperties(ip, op);\n var sp = function () {\n this._li = null, this._pt = null, this._originalPt = null, this._ptScaled = null, this._p0Scaled = null, this._p1Scaled = null, this._scaleFactor = null, this._minx = null, this._maxx = null, this._miny = null, this._maxy = null, this._corner = new Array(4).fill(null), this._safeEnv = null;\n var t = arguments[0],\n e = arguments[1],\n n = arguments[2];\n if (this._originalPt = t, this._pt = t, this._scaleFactor = e, this._li = n, e <= 0) throw new _u(\"Scale factor must be non-zero\");\n 1 !== e && (this._pt = new bu(this.scale(t.x), this.scale(t.y)), this._p0Scaled = new bu(), this._p1Scaled = new bu()), this.initCorners(this._pt);\n },\n ap = {\n SAFE_ENV_EXPANSION_FACTOR: {\n configurable: !0\n }\n };\n sp.prototype.intersectsScaled = function (t, e) {\n var n = Math.min(t.x, e.x),\n r = Math.max(t.x, e.x),\n i = Math.min(t.y, e.y),\n o = Math.max(t.y, e.y),\n s = this._maxx < n || this._minx > r || this._maxy < i || this._miny > o;\n if (s) return !1;\n var a = this.intersectsToleranceSquare(t, e);\n return tc.isTrue(!(s && a), \"Found bad envelope test\"), a;\n }, sp.prototype.initCorners = function (t) {\n this._minx = t.x - .5, this._maxx = t.x + .5, this._miny = t.y - .5, this._maxy = t.y + .5, this._corner[0] = new bu(this._maxx, this._maxy), this._corner[1] = new bu(this._minx, this._maxy), this._corner[2] = new bu(this._minx, this._miny), this._corner[3] = new bu(this._maxx, this._miny);\n }, sp.prototype.intersects = function (t, e) {\n return 1 === this._scaleFactor ? this.intersectsScaled(t, e) : (this.copyScaled(t, this._p0Scaled), this.copyScaled(e, this._p1Scaled), this.intersectsScaled(this._p0Scaled, this._p1Scaled));\n }, sp.prototype.scale = function (t) {\n return Math.round(t * this._scaleFactor);\n }, sp.prototype.getCoordinate = function () {\n return this._originalPt;\n }, sp.prototype.copyScaled = function (t, e) {\n e.x = this.scale(t.x), e.y = this.scale(t.y);\n }, sp.prototype.getSafeEnvelope = function () {\n if (null === this._safeEnv) {\n var t = sp.SAFE_ENV_EXPANSION_FACTOR / this._scaleFactor;\n this._safeEnv = new Yu(this._originalPt.x - t, this._originalPt.x + t, this._originalPt.y - t, this._originalPt.y + t);\n }\n return this._safeEnv;\n }, sp.prototype.intersectsPixelClosure = function (t, e) {\n return this._li.computeIntersection(t, e, this._corner[0], this._corner[1]), !!this._li.hasIntersection() || (this._li.computeIntersection(t, e, this._corner[1], this._corner[2]), !!this._li.hasIntersection() || (this._li.computeIntersection(t, e, this._corner[2], this._corner[3]), !!this._li.hasIntersection() || (this._li.computeIntersection(t, e, this._corner[3], this._corner[0]), !!this._li.hasIntersection())));\n }, sp.prototype.intersectsToleranceSquare = function (t, e) {\n var n = !1,\n r = !1;\n return this._li.computeIntersection(t, e, this._corner[0], this._corner[1]), !!this._li.isProper() || (this._li.computeIntersection(t, e, this._corner[1], this._corner[2]), !!this._li.isProper() || (this._li.hasIntersection() && (n = !0), this._li.computeIntersection(t, e, this._corner[2], this._corner[3]), !!this._li.isProper() || (this._li.hasIntersection() && (r = !0), this._li.computeIntersection(t, e, this._corner[3], this._corner[0]), !!this._li.isProper() || !(!n || !r) || !!t.equals(this._pt) || !!e.equals(this._pt))));\n }, sp.prototype.addSnappedNode = function (t, e) {\n var n = t.getCoordinate(e),\n r = t.getCoordinate(e + 1);\n return !!this.intersects(n, r) && (t.addIntersection(this.getCoordinate(), e), !0);\n }, sp.prototype.interfaces_ = function () {\n return [];\n }, sp.prototype.getClass = function () {\n return sp;\n }, ap.SAFE_ENV_EXPANSION_FACTOR.get = function () {\n return .75;\n }, Object.defineProperties(sp, ap);\n var up = function () {\n this.tempEnv1 = new Yu(), this.selectedSegment = new gl();\n };\n up.prototype.select = function () {\n if (1 === arguments.length) ;else if (2 === arguments.length) {\n var t = arguments[0],\n e = arguments[1];\n t.getLineSegment(e, this.selectedSegment), this.select(this.selectedSegment);\n }\n }, up.prototype.interfaces_ = function () {\n return [];\n }, up.prototype.getClass = function () {\n return up;\n };\n var cp = function () {\n this._index = null;\n var t = arguments[0];\n this._index = t;\n },\n hp = {\n HotPixelSnapAction: {\n configurable: !0\n }\n };\n cp.prototype.snap = function () {\n if (1 === arguments.length) {\n var t = arguments[0];\n return this.snap(t, null, -1);\n }\n if (3 === arguments.length) {\n var e = arguments[0],\n n = arguments[1],\n r = arguments[2],\n i = e.getSafeEnvelope(),\n o = new lp(e, n, r);\n return this._index.query(i, {\n interfaces_: function () {\n return [Jh];\n },\n visitItem: function (t) {\n t.select(i, o);\n }\n }), o.isNodeAdded();\n }\n }, cp.prototype.interfaces_ = function () {\n return [];\n }, cp.prototype.getClass = function () {\n return cp;\n }, hp.HotPixelSnapAction.get = function () {\n return lp;\n }, Object.defineProperties(cp, hp);\n var lp = function (t) {\n function e() {\n t.call(this), this._hotPixel = null, this._parentEdge = null, this._hotPixelVertexIndex = null, this._isNodeAdded = !1;\n var e = arguments[0],\n n = arguments[1],\n r = arguments[2];\n this._hotPixel = e, this._parentEdge = n, this._hotPixelVertexIndex = r;\n }\n return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.isNodeAdded = function () {\n return this._isNodeAdded;\n }, e.prototype.select = function () {\n if (2 !== arguments.length) return t.prototype.select.apply(this, arguments);\n var e = arguments[0],\n n = arguments[1],\n r = e.getContext();\n if (null !== this._parentEdge && r === this._parentEdge && n === this._hotPixelVertexIndex) return null;\n this._isNodeAdded = this._hotPixel.addSnappedNode(r, n);\n }, e.prototype.interfaces_ = function () {\n return [];\n }, e.prototype.getClass = function () {\n return e;\n }, e;\n }(up),\n pp = function () {\n this._li = null, this._interiorIntersections = null;\n var t = arguments[0];\n this._li = t, this._interiorIntersections = new bc();\n };\n pp.prototype.processIntersections = function (t, e, n, r) {\n if (t === n && e === r) return null;\n var i = t.getCoordinates()[e],\n o = t.getCoordinates()[e + 1],\n s = n.getCoordinates()[r],\n a = n.getCoordinates()[r + 1];\n if (this._li.computeIntersection(i, o, s, a), this._li.hasIntersection() && this._li.isInteriorIntersection()) {\n for (var u = 0; u < this._li.getIntersectionNum(); u++) this._interiorIntersections.add(this._li.getIntersection(u));\n t.addIntersections(this._li, e, 0), n.addIntersections(this._li, r, 1);\n }\n }, pp.prototype.isDone = function () {\n return !1;\n }, pp.prototype.getInteriorIntersections = function () {\n return this._interiorIntersections;\n }, pp.prototype.interfaces_ = function () {\n return [Hl];\n }, pp.prototype.getClass = function () {\n return pp;\n };\n var fp = function () {\n this._pm = null, this._li = null, this._scaleFactor = null, this._noder = null, this._pointSnapper = null, this._nodedSegStrings = null;\n var t = arguments[0];\n this._pm = t, this._li = new rc(), this._li.setPrecisionModel(t), this._scaleFactor = t.getScale();\n };\n fp.prototype.checkCorrectness = function (t) {\n var e = fl.getNodedSubstrings(t),\n n = new ip(e);\n try {\n n.checkValid();\n } catch (t) {\n if (!(t instanceof zu)) throw t;\n t.printStackTrace();\n }\n }, fp.prototype.getNodedSubstrings = function () {\n return fl.getNodedSubstrings(this._nodedSegStrings);\n }, fp.prototype.snapRound = function (t, e) {\n var n = this.findInteriorIntersections(t, e);\n this.computeIntersectionSnaps(n), this.computeVertexSnaps(t);\n }, fp.prototype.findInteriorIntersections = function (t, e) {\n var n = new pp(e);\n return this._noder.setSegmentIntersector(n), this._noder.computeNodes(t), n.getInteriorIntersections();\n }, fp.prototype.computeVertexSnaps = function () {\n if (Lu(arguments[0], vc)) for (var t = arguments[0].iterator(); t.hasNext();) {\n var e = t.next();\n this.computeVertexSnaps(e);\n } else if (arguments[0] instanceof fl) for (var n = arguments[0], r = n.getCoordinates(), i = 0; i < r.length; i++) {\n var o = new sp(r[i], this._scaleFactor, this._li);\n this._pointSnapper.snap(o, n, i) && n.addIntersection(r[i], i);\n }\n }, fp.prototype.computeNodes = function (t) {\n this._nodedSegStrings = t, this._noder = new El(), this._pointSnapper = new cp(this._noder.getIndex()), this.snapRound(t, this._li);\n }, fp.prototype.computeIntersectionSnaps = function (t) {\n for (var e = t.iterator(); e.hasNext();) {\n var n = e.next(),\n r = new sp(n, this._scaleFactor, this._li);\n this._pointSnapper.snap(r);\n }\n }, fp.prototype.interfaces_ = function () {\n return [vl];\n }, fp.prototype.getClass = function () {\n return fp;\n };\n var gp = function () {\n if (this._argGeom = null, this._distance = null, this._bufParams = new bl(), this._resultGeometry = null, this._saveException = null, 1 === arguments.length) {\n var t = arguments[0];\n this._argGeom = t;\n } else if (2 === arguments.length) {\n var e = arguments[0],\n n = arguments[1];\n this._argGeom = e, this._bufParams = n;\n }\n },\n dp = {\n CAP_ROUND: {\n configurable: !0\n },\n CAP_BUTT: {\n configurable: !0\n },\n CAP_FLAT: {\n configurable: !0\n },\n CAP_SQUARE: {\n configurable: !0\n },\n MAX_PRECISION_DIGITS: {\n configurable: !0\n }\n };\n gp.prototype.bufferFixedPrecision = function (t) {\n var e = new rp(new fp(new fh(1)), t.getScale()),\n n = new np(this._bufParams);\n n.setWorkingPrecisionModel(t), n.setNoder(e), this._resultGeometry = n.buffer(this._argGeom, this._distance);\n }, gp.prototype.bufferReducedPrecision = function () {\n var t = this;\n if (0 === arguments.length) {\n for (var e = gp.MAX_PRECISION_DIGITS; e >= 0; e--) {\n try {\n t.bufferReducedPrecision(e);\n } catch (e) {\n if (!(e instanceof Mh)) throw e;\n t._saveException = e;\n }\n if (null !== t._resultGeometry) return null;\n }\n throw this._saveException;\n }\n if (1 === arguments.length) {\n var n = arguments[0],\n r = gp.precisionScaleFactor(this._argGeom, this._distance, n),\n i = new fh(r);\n this.bufferFixedPrecision(i);\n }\n }, gp.prototype.computeGeometry = function () {\n if (this.bufferOriginalPrecision(), null !== this._resultGeometry) return null;\n var t = this._argGeom.getFactory().getPrecisionModel();\n t.getType() === fh.FIXED ? this.bufferFixedPrecision(t) : this.bufferReducedPrecision();\n }, gp.prototype.setQuadrantSegments = function (t) {\n this._bufParams.setQuadrantSegments(t);\n }, gp.prototype.bufferOriginalPrecision = function () {\n try {\n var t = new np(this._bufParams);\n this._resultGeometry = t.buffer(this._argGeom, this._distance);\n } catch (t) {\n if (!(t instanceof Qu)) throw t;\n this._saveException = t;\n }\n }, gp.prototype.getResultGeometry = function (t) {\n return this._distance = t, this.computeGeometry(), this._resultGeometry;\n }, gp.prototype.setEndCapStyle = function (t) {\n this._bufParams.setEndCapStyle(t);\n }, gp.prototype.interfaces_ = function () {\n return [];\n }, gp.prototype.getClass = function () {\n return gp;\n }, gp.bufferOp = function () {\n if (2 === arguments.length) {\n var t = arguments[0],\n e = arguments[1];\n return new gp(t).getResultGeometry(e);\n }\n if (3 === arguments.length) {\n if (Number.isInteger(arguments[2]) && arguments[0] instanceof cc && \"number\" == typeof arguments[1]) {\n var n = arguments[0],\n r = arguments[1],\n i = arguments[2],\n o = new gp(n);\n o.setQuadrantSegments(i);\n return o.getResultGeometry(r);\n }\n if (arguments[2] instanceof bl && arguments[0] instanceof cc && \"number\" == typeof arguments[1]) {\n var s = arguments[0],\n a = arguments[1],\n u = arguments[2];\n return new gp(s, u).getResultGeometry(a);\n }\n } else if (4 === arguments.length) {\n var c = arguments[0],\n h = arguments[1],\n l = arguments[2],\n p = arguments[3],\n f = new gp(c);\n f.setQuadrantSegments(l), f.setEndCapStyle(p);\n return f.getResultGeometry(h);\n }\n }, gp.precisionScaleFactor = function (t, e, n) {\n var r = t.getEnvelopeInternal(),\n i = Pu.max(Math.abs(r.getMaxX()), Math.abs(r.getMaxY()), Math.abs(r.getMinX()), Math.abs(r.getMinY())) + 2 * (e > 0 ? e : 0),\n o = n - Math.trunc(Math.log(i) / Math.log(10) + 1);\n return Math.pow(10, o);\n }, dp.CAP_ROUND.get = function () {\n return bl.CAP_ROUND;\n }, dp.CAP_BUTT.get = function () {\n return bl.CAP_FLAT;\n }, dp.CAP_FLAT.get = function () {\n return bl.CAP_FLAT;\n }, dp.CAP_SQUARE.get = function () {\n return bl.CAP_SQUARE;\n }, dp.MAX_PRECISION_DIGITS.get = function () {\n return 12;\n }, Object.defineProperties(gp, dp);\n var yp = function () {\n this._pt = [new bu(), new bu()], this._distance = mu.NaN, this._isNull = !0;\n };\n yp.prototype.getCoordinates = function () {\n return this._pt;\n }, yp.prototype.getCoordinate = function (t) {\n return this._pt[t];\n }, yp.prototype.setMinimum = function () {\n if (1 === arguments.length) {\n var t = arguments[0];\n this.setMinimum(t._pt[0], t._pt[1]);\n } else if (2 === arguments.length) {\n var e = arguments[0],\n n = arguments[1];\n if (this._isNull) return this.initialize(e, n), null;\n var r = e.distance(n);\n r < this._distance && this.initialize(e, n, r);\n }\n }, yp.prototype.initialize = function () {\n if (0 === arguments.length) this._isNull = !0;else if (2 === arguments.length) {\n var t = arguments[0],\n e = arguments[1];\n this._pt[0].setCoordinate(t), this._pt[1].setCoordinate(e), this._distance = t.distance(e), this._isNull = !1;\n } else if (3 === arguments.length) {\n var n = arguments[0],\n r = arguments[1],\n i = arguments[2];\n this._pt[0].setCoordinate(n), this._pt[1].setCoordinate(r), this._distance = i, this._isNull = !1;\n }\n }, yp.prototype.getDistance = function () {\n return this._distance;\n }, yp.prototype.setMaximum = function () {\n if (1 === arguments.length) {\n var t = arguments[0];\n this.setMaximum(t._pt[0], t._pt[1]);\n } else if (2 === arguments.length) {\n var e = arguments[0],\n n = arguments[1];\n if (this._isNull) return this.initialize(e, n), null;\n var r = e.distance(n);\n r > this._distance && this.initialize(e, n, r);\n }\n }, yp.prototype.interfaces_ = function () {\n return [];\n }, yp.prototype.getClass = function () {\n return yp;\n };\n var _p = function () {};\n _p.prototype.interfaces_ = function () {\n return [];\n }, _p.prototype.getClass = function () {\n return _p;\n }, _p.computeDistance = function () {\n if (arguments[2] instanceof yp && arguments[0] instanceof Jc && arguments[1] instanceof bu) for (var t = arguments[0], e = arguments[1], n = arguments[2], r = t.getCoordinates(), i = new gl(), o = 0; o < r.length - 1; o++) {\n i.setCoordinates(r[o], r[o + 1]);\n var s = i.closestPoint(e);\n n.setMinimum(s, e);\n } else if (arguments[2] instanceof yp && arguments[0] instanceof $c && arguments[1] instanceof bu) {\n var a = arguments[0],\n u = arguments[1],\n c = arguments[2];\n _p.computeDistance(a.getExteriorRing(), u, c);\n for (var h = 0; h < a.getNumInteriorRing(); h++) _p.computeDistance(a.getInteriorRingN(h), u, c);\n } else if (arguments[2] instanceof yp && arguments[0] instanceof cc && arguments[1] instanceof bu) {\n var l = arguments[0],\n p = arguments[1],\n f = arguments[2];\n if (l instanceof Jc) _p.computeDistance(l, p, f);else if (l instanceof $c) _p.computeDistance(l, p, f);else if (l instanceof jc) for (var g = l, d = 0; d < g.getNumGeometries(); d++) {\n var y = g.getGeometryN(d);\n _p.computeDistance(y, p, f);\n } else f.setMinimum(l.getCoordinate(), p);\n } else if (arguments[2] instanceof yp && arguments[0] instanceof gl && arguments[1] instanceof bu) {\n var _ = arguments[0],\n m = arguments[1],\n v = arguments[2],\n x = _.closestPoint(m);\n v.setMinimum(x, m);\n }\n };\n var mp = function (t) {\n this._maxPtDist = new yp(), this._inputGeom = t || null;\n },\n vp = {\n MaxPointDistanceFilter: {\n configurable: !0\n },\n MaxMidpointDistanceFilter: {\n configurable: !0\n }\n };\n mp.prototype.computeMaxMidpointDistance = function (t) {\n var e = new Ep(this._inputGeom);\n t.apply(e), this._maxPtDist.setMaximum(e.getMaxPointDistance());\n }, mp.prototype.computeMaxVertexDistance = function (t) {\n var e = new xp(this._inputGeom);\n t.apply(e), this._maxPtDist.setMaximum(e.getMaxPointDistance());\n }, mp.prototype.findDistance = function (t) {\n return this.computeMaxVertexDistance(t), this.computeMaxMidpointDistance(t), this._maxPtDist.getDistance();\n }, mp.prototype.getDistancePoints = function () {\n return this._maxPtDist;\n }, mp.prototype.interfaces_ = function () {\n return [];\n }, mp.prototype.getClass = function () {\n return mp;\n }, vp.MaxPointDistanceFilter.get = function () {\n return xp;\n }, vp.MaxMidpointDistanceFilter.get = function () {\n return Ep;\n }, Object.defineProperties(mp, vp);\n var xp = function (t) {\n this._maxPtDist = new yp(), this._minPtDist = new yp(), this._geom = t || null;\n };\n xp.prototype.filter = function (t) {\n this._minPtDist.initialize(), _p.computeDistance(this._geom, t, this._minPtDist), this._maxPtDist.setMaximum(this._minPtDist);\n }, xp.prototype.getMaxPointDistance = function () {\n return this._maxPtDist;\n }, xp.prototype.interfaces_ = function () {\n return [pc];\n }, xp.prototype.getClass = function () {\n return xp;\n };\n var Ep = function (t) {\n this._maxPtDist = new yp(), this._minPtDist = new yp(), this._geom = t || null;\n };\n Ep.prototype.filter = function (t, e) {\n if (0 === e) return null;\n var n = t.getCoordinate(e - 1),\n r = t.getCoordinate(e),\n i = new bu((n.x + r.x) / 2, (n.y + r.y) / 2);\n this._minPtDist.initialize(), _p.computeDistance(this._geom, i, this._minPtDist), this._maxPtDist.setMaximum(this._minPtDist);\n }, Ep.prototype.isDone = function () {\n return !1;\n }, Ep.prototype.isGeometryChanged = function () {\n return !1;\n }, Ep.prototype.getMaxPointDistance = function () {\n return this._maxPtDist;\n }, Ep.prototype.interfaces_ = function () {\n return [zc];\n }, Ep.prototype.getClass = function () {\n return Ep;\n };\n var wp = function (t) {\n this._comps = t || null;\n };\n wp.prototype.filter = function (t) {\n t instanceof $c && this._comps.add(t);\n }, wp.prototype.interfaces_ = function () {\n return [kc];\n }, wp.prototype.getClass = function () {\n return wp;\n }, wp.getPolygons = function () {\n if (1 === arguments.length) {\n var t = arguments[0];\n return wp.getPolygons(t, new bc());\n }\n if (2 === arguments.length) {\n var e = arguments[0],\n n = arguments[1];\n return e instanceof $c ? n.add(e) : e instanceof jc && e.apply(new wp(n)), n;\n }\n };\n var bp = function () {\n if (this._lines = null, this._isForcedToLineString = !1, 1 === arguments.length) {\n var t = arguments[0];\n this._lines = t;\n } else if (2 === arguments.length) {\n var e = arguments[0],\n n = arguments[1];\n this._lines = e, this._isForcedToLineString = n;\n }\n };\n bp.prototype.filter = function (t) {\n if (this._isForcedToLineString && t instanceof eh) {\n var e = t.getFactory().createLineString(t.getCoordinateSequence());\n return this._lines.add(e), null;\n }\n t instanceof Jc && this._lines.add(t);\n }, bp.prototype.setForceToLineString = function (t) {\n this._isForcedToLineString = t;\n }, bp.prototype.interfaces_ = function () {\n return [uc];\n }, bp.prototype.getClass = function () {\n return bp;\n }, bp.getGeometry = function () {\n if (1 === arguments.length) {\n var t = arguments[0];\n return t.getFactory().buildGeometry(bp.getLines(t));\n }\n if (2 === arguments.length) {\n var e = arguments[0],\n n = arguments[1];\n return e.getFactory().buildGeometry(bp.getLines(e, n));\n }\n }, bp.getLines = function () {\n if (1 === arguments.length) {\n var t = arguments[0];\n return bp.getLines(t, !1);\n }\n if (2 === arguments.length) {\n if (Lu(arguments[0], vc) && Lu(arguments[1], vc)) {\n for (var e = arguments[0], n = arguments[1], r = e.iterator(); r.hasNext();) {\n var i = r.next();\n bp.getLines(i, n);\n }\n return n;\n }\n if (arguments[0] instanceof cc && \"boolean\" == typeof arguments[1]) {\n var o = arguments[0],\n s = arguments[1],\n a = new bc();\n return o.apply(new bp(a, s)), a;\n }\n if (arguments[0] instanceof cc && Lu(arguments[1], vc)) {\n var u = arguments[0],\n c = arguments[1];\n return u instanceof Jc ? c.add(u) : u.apply(new bp(c)), c;\n }\n } else if (3 === arguments.length) {\n if (\"boolean\" == typeof arguments[2] && Lu(arguments[0], vc) && Lu(arguments[1], vc)) {\n for (var h = arguments[0], l = arguments[1], p = arguments[2], f = h.iterator(); f.hasNext();) {\n var g = f.next();\n bp.getLines(g, l, p);\n }\n return l;\n }\n if (\"boolean\" == typeof arguments[2] && arguments[0] instanceof cc && Lu(arguments[1], vc)) {\n var d = arguments[0],\n y = arguments[1],\n _ = arguments[2];\n return d.apply(new bp(y, _)), y;\n }\n }\n };\n var Ip = function () {\n if (this._boundaryRule = fc.OGC_SFS_BOUNDARY_RULE, this._isIn = null, this._numBoundaries = null, 0 === arguments.length) ;else if (1 === arguments.length) {\n var t = arguments[0];\n if (null === t) throw new _u(\"Rule must be non-null\");\n this._boundaryRule = t;\n }\n };\n Ip.prototype.locateInternal = function () {\n if (arguments[0] instanceof bu && arguments[1] instanceof $c) {\n var t = arguments[0],\n e = arguments[1];\n if (e.isEmpty()) return Su.EXTERIOR;\n var n = e.getExteriorRing(),\n r = this.locateInPolygonRing(t, n);\n if (r === Su.EXTERIOR) return Su.EXTERIOR;\n if (r === Su.BOUNDARY) return Su.BOUNDARY;\n for (var i = 0; i < e.getNumInteriorRing(); i++) {\n var o = e.getInteriorRingN(i),\n s = this.locateInPolygonRing(t, o);\n if (s === Su.INTERIOR) return Su.EXTERIOR;\n if (s === Su.BOUNDARY) return Su.BOUNDARY;\n }\n return Su.INTERIOR;\n }\n if (arguments[0] instanceof bu && arguments[1] instanceof Jc) {\n var a = arguments[0],\n u = arguments[1];\n if (!u.getEnvelopeInternal().intersects(a)) return Su.EXTERIOR;\n var c = u.getCoordinates();\n return u.isClosed() || !a.equals(c[0]) && !a.equals(c[c.length - 1]) ? sc.isOnLine(a, c) ? Su.INTERIOR : Su.EXTERIOR : Su.BOUNDARY;\n }\n if (arguments[0] instanceof bu && arguments[1] instanceof Kc) {\n var h = arguments[0];\n return arguments[1].getCoordinate().equals2D(h) ? Su.INTERIOR : Su.EXTERIOR;\n }\n }, Ip.prototype.locateInPolygonRing = function (t, e) {\n return e.getEnvelopeInternal().intersects(t) ? sc.locatePointInRing(t, e.getCoordinates()) : Su.EXTERIOR;\n }, Ip.prototype.intersects = function (t, e) {\n return this.locate(t, e) !== Su.EXTERIOR;\n }, Ip.prototype.updateLocationInfo = function (t) {\n t === Su.INTERIOR && (this._isIn = !0), t === Su.BOUNDARY && this._numBoundaries++;\n }, Ip.prototype.computeLocation = function (t, e) {\n if (e instanceof Kc && this.updateLocationInfo(this.locateInternal(t, e)), e instanceof Jc) this.updateLocationInfo(this.locateInternal(t, e));else if (e instanceof $c) this.updateLocationInfo(this.locateInternal(t, e));else if (e instanceof Xc) for (var n = e, r = 0; r < n.getNumGeometries(); r++) {\n var i = n.getGeometryN(r);\n this.updateLocationInfo(this.locateInternal(t, i));\n } else if (e instanceof nh) for (var o = e, s = 0; s < o.getNumGeometries(); s++) {\n var a = o.getGeometryN(s);\n this.updateLocationInfo(this.locateInternal(t, a));\n } else if (e instanceof jc) for (var u = new kl(e); u.hasNext();) {\n var c = u.next();\n c !== e && this.computeLocation(t, c);\n }\n }, Ip.prototype.locate = function (t, e) {\n return e.isEmpty() ? Su.EXTERIOR : e instanceof Jc ? this.locateInternal(t, e) : e instanceof $c ? this.locateInternal(t, e) : (this._isIn = !1, this._numBoundaries = 0, this.computeLocation(t, e), this._boundaryRule.isInBoundary(this._numBoundaries) ? Su.BOUNDARY : this._numBoundaries > 0 || this._isIn ? Su.INTERIOR : Su.EXTERIOR);\n }, Ip.prototype.interfaces_ = function () {\n return [];\n }, Ip.prototype.getClass = function () {\n return Ip;\n };\n var Np = function t() {\n if (this._component = null, this._segIndex = null, this._pt = null, 2 === arguments.length) {\n var e = arguments[0],\n n = arguments[1];\n t.call(this, e, t.INSIDE_AREA, n);\n } else if (3 === arguments.length) {\n var r = arguments[0],\n i = arguments[1],\n o = arguments[2];\n this._component = r, this._segIndex = i, this._pt = o;\n }\n },\n Cp = {\n INSIDE_AREA: {\n configurable: !0\n }\n };\n Np.prototype.isInsideArea = function () {\n return this._segIndex === Np.INSIDE_AREA;\n }, Np.prototype.getCoordinate = function () {\n return this._pt;\n }, Np.prototype.getGeometryComponent = function () {\n return this._component;\n }, Np.prototype.getSegmentIndex = function () {\n return this._segIndex;\n }, Np.prototype.interfaces_ = function () {\n return [];\n }, Np.prototype.getClass = function () {\n return Np;\n }, Cp.INSIDE_AREA.get = function () {\n return -1;\n }, Object.defineProperties(Np, Cp);\n var Sp = function (t) {\n this._pts = t || null;\n };\n Sp.prototype.filter = function (t) {\n t instanceof Kc && this._pts.add(t);\n }, Sp.prototype.interfaces_ = function () {\n return [kc];\n }, Sp.prototype.getClass = function () {\n return Sp;\n }, Sp.getPoints = function () {\n if (1 === arguments.length) {\n var t = arguments[0];\n return t instanceof Kc ? $h.singletonList(t) : Sp.getPoints(t, new bc());\n }\n if (2 === arguments.length) {\n var e = arguments[0],\n n = arguments[1];\n return e instanceof Kc ? n.add(e) : e instanceof jc && e.apply(new Sp(n)), n;\n }\n };\n var Mp = function () {\n this._locations = null;\n var t = arguments[0];\n this._locations = t;\n };\n Mp.prototype.filter = function (t) {\n (t instanceof Kc || t instanceof Jc || t instanceof $c) && this._locations.add(new Np(t, 0, t.getCoordinate()));\n }, Mp.prototype.interfaces_ = function () {\n return [kc];\n }, Mp.prototype.getClass = function () {\n return Mp;\n }, Mp.getLocations = function (t) {\n var e = new bc();\n return t.apply(new Mp(e)), e;\n };\n var Lp = function () {\n if (this._geom = null, this._terminateDistance = 0, this._ptLocator = new Ip(), this._minDistanceLocation = null, this._minDistance = mu.MAX_VALUE, 2 === arguments.length) {\n var t = arguments[0],\n e = arguments[1];\n this._geom = [t, e], this._terminateDistance = 0;\n } else if (3 === arguments.length) {\n var n = arguments[0],\n r = arguments[1],\n i = arguments[2];\n this._geom = new Array(2).fill(null), this._geom[0] = n, this._geom[1] = r, this._terminateDistance = i;\n }\n };\n Lp.prototype.computeContainmentDistance = function () {\n if (0 === arguments.length) {\n var t = new Array(2).fill(null);\n if (this.computeContainmentDistance(0, t), this._minDistance <= this._terminateDistance) return null;\n this.computeContainmentDistance(1, t);\n } else if (2 === arguments.length) {\n var e = arguments[0],\n n = arguments[1],\n r = 1 - e,\n i = wp.getPolygons(this._geom[e]);\n if (i.size() > 0) {\n var o = Mp.getLocations(this._geom[r]);\n if (this.computeContainmentDistance(o, i, n), this._minDistance <= this._terminateDistance) return this._minDistanceLocation[r] = n[0], this._minDistanceLocation[e] = n[1], null;\n }\n } else if (3 === arguments.length) if (arguments[2] instanceof Array && Lu(arguments[0], wc) && Lu(arguments[1], wc)) {\n for (var s = arguments[0], a = arguments[1], u = arguments[2], c = 0; c < s.size(); c++) for (var h = s.get(c), l = 0; l < a.size(); l++) if (this.computeContainmentDistance(h, a.get(l), u), this._minDistance <= this._terminateDistance) return null;\n } else if (arguments[2] instanceof Array && arguments[0] instanceof Np && arguments[1] instanceof $c) {\n var p = arguments[0],\n f = arguments[1],\n g = arguments[2],\n d = p.getCoordinate();\n if (Su.EXTERIOR !== this._ptLocator.locate(d, f)) return this._minDistance = 0, g[0] = p, g[1] = new Np(f, d), null;\n }\n }, Lp.prototype.computeMinDistanceLinesPoints = function (t, e, n) {\n for (var r = 0; r < t.size(); r++) for (var i = t.get(r), o = 0; o < e.size(); o++) {\n var s = e.get(o);\n if (this.computeMinDistance(i, s, n), this._minDistance <= this._terminateDistance) return null;\n }\n }, Lp.prototype.computeFacetDistance = function () {\n var t = new Array(2).fill(null),\n e = bp.getLines(this._geom[0]),\n n = bp.getLines(this._geom[1]),\n r = Sp.getPoints(this._geom[0]),\n i = Sp.getPoints(this._geom[1]);\n return this.computeMinDistanceLines(e, n, t), this.updateMinDistance(t, !1), this._minDistance <= this._terminateDistance ? null : (t[0] = null, t[1] = null, this.computeMinDistanceLinesPoints(e, i, t), this.updateMinDistance(t, !1), this._minDistance <= this._terminateDistance ? null : (t[0] = null, t[1] = null, this.computeMinDistanceLinesPoints(n, r, t), this.updateMinDistance(t, !0), this._minDistance <= this._terminateDistance ? null : (t[0] = null, t[1] = null, this.computeMinDistancePoints(r, i, t), void this.updateMinDistance(t, !1))));\n }, Lp.prototype.nearestLocations = function () {\n return this.computeMinDistance(), this._minDistanceLocation;\n }, Lp.prototype.updateMinDistance = function (t, e) {\n if (null === t[0]) return null;\n e ? (this._minDistanceLocation[0] = t[1], this._minDistanceLocation[1] = t[0]) : (this._minDistanceLocation[0] = t[0], this._minDistanceLocation[1] = t[1]);\n }, Lp.prototype.nearestPoints = function () {\n this.computeMinDistance();\n return [this._minDistanceLocation[0].getCoordinate(), this._minDistanceLocation[1].getCoordinate()];\n }, Lp.prototype.computeMinDistance = function () {\n if (0 === arguments.length) {\n if (null !== this._minDistanceLocation) return null;\n if (this._minDistanceLocation = new Array(2).fill(null), this.computeContainmentDistance(), this._minDistance <= this._terminateDistance) return null;\n this.computeFacetDistance();\n } else if (3 === arguments.length) if (arguments[2] instanceof Array && arguments[0] instanceof Jc && arguments[1] instanceof Kc) {\n var t = arguments[0],\n e = arguments[1],\n n = arguments[2];\n if (t.getEnvelopeInternal().distance(e.getEnvelopeInternal()) > this._minDistance) return null;\n for (var r = t.getCoordinates(), i = e.getCoordinate(), o = 0; o < r.length - 1; o++) {\n var s = sc.distancePointLine(i, r[o], r[o + 1]);\n if (s < this._minDistance) {\n this._minDistance = s;\n var a = new gl(r[o], r[o + 1]).closestPoint(i);\n n[0] = new Np(t, o, a), n[1] = new Np(e, 0, i);\n }\n if (this._minDistance <= this._terminateDistance) return null;\n }\n } else if (arguments[2] instanceof Array && arguments[0] instanceof Jc && arguments[1] instanceof Jc) {\n var u = arguments[0],\n c = arguments[1],\n h = arguments[2];\n if (u.getEnvelopeInternal().distance(c.getEnvelopeInternal()) > this._minDistance) return null;\n for (var l = u.getCoordinates(), p = c.getCoordinates(), f = 0; f < l.length - 1; f++) for (var g = 0; g < p.length - 1; g++) {\n var d = sc.distanceLineLine(l[f], l[f + 1], p[g], p[g + 1]);\n if (d < this._minDistance) {\n this._minDistance = d;\n var y = new gl(l[f], l[f + 1]),\n _ = new gl(p[g], p[g + 1]),\n m = y.closestPoints(_);\n h[0] = new Np(u, f, m[0]), h[1] = new Np(c, g, m[1]);\n }\n if (this._minDistance <= this._terminateDistance) return null;\n }\n }\n }, Lp.prototype.computeMinDistancePoints = function (t, e, n) {\n for (var r = 0; r < t.size(); r++) for (var i = t.get(r), o = 0; o < e.size(); o++) {\n var s = e.get(o),\n a = i.getCoordinate().distance(s.getCoordinate());\n if (a < this._minDistance && (this._minDistance = a, n[0] = new Np(i, 0, i.getCoordinate()), n[1] = new Np(s, 0, s.getCoordinate())), this._minDistance <= this._terminateDistance) return null;\n }\n }, Lp.prototype.distance = function () {\n if (null === this._geom[0] || null === this._geom[1]) throw new _u(\"null geometries are not supported\");\n return this._geom[0].isEmpty() || this._geom[1].isEmpty() ? 0 : (this.computeMinDistance(), this._minDistance);\n }, Lp.prototype.computeMinDistanceLines = function (t, e, n) {\n for (var r = 0; r < t.size(); r++) for (var i = t.get(r), o = 0; o < e.size(); o++) {\n var s = e.get(o);\n if (this.computeMinDistance(i, s, n), this._minDistance <= this._terminateDistance) return null;\n }\n }, Lp.prototype.interfaces_ = function () {\n return [];\n }, Lp.prototype.getClass = function () {\n return Lp;\n }, Lp.distance = function (t, e) {\n return new Lp(t, e).distance();\n }, Lp.isWithinDistance = function (t, e, n) {\n return new Lp(t, e, n).distance() <= n;\n }, Lp.nearestPoints = function (t, e) {\n return new Lp(t, e).nearestPoints();\n };\n var Pp = function () {\n this._pt = [new bu(), new bu()], this._distance = mu.NaN, this._isNull = !0;\n };\n Pp.prototype.getCoordinates = function () {\n return this._pt;\n }, Pp.prototype.getCoordinate = function (t) {\n return this._pt[t];\n }, Pp.prototype.setMinimum = function () {\n if (1 === arguments.length) {\n var t = arguments[0];\n this.setMinimum(t._pt[0], t._pt[1]);\n } else if (2 === arguments.length) {\n var e = arguments[0],\n n = arguments[1];\n if (this._isNull) return this.initialize(e, n), null;\n var r = e.distance(n);\n r < this._distance && this.initialize(e, n, r);\n }\n }, Pp.prototype.initialize = function () {\n if (0 === arguments.length) this._isNull = !0;else if (2 === arguments.length) {\n var t = arguments[0],\n e = arguments[1];\n this._pt[0].setCoordinate(t), this._pt[1].setCoordinate(e), this._distance = t.distance(e), this._isNull = !1;\n } else if (3 === arguments.length) {\n var n = arguments[0],\n r = arguments[1],\n i = arguments[2];\n this._pt[0].setCoordinate(n), this._pt[1].setCoordinate(r), this._distance = i, this._isNull = !1;\n }\n }, Pp.prototype.toString = function () {\n return Ku.toLineString(this._pt[0], this._pt[1]);\n }, Pp.prototype.getDistance = function () {\n return this._distance;\n }, Pp.prototype.setMaximum = function () {\n if (1 === arguments.length) {\n var t = arguments[0];\n this.setMaximum(t._pt[0], t._pt[1]);\n } else if (2 === arguments.length) {\n var e = arguments[0],\n n = arguments[1];\n if (this._isNull) return this.initialize(e, n), null;\n var r = e.distance(n);\n r > this._distance && this.initialize(e, n, r);\n }\n }, Pp.prototype.interfaces_ = function () {\n return [];\n }, Pp.prototype.getClass = function () {\n return Pp;\n };\n var Op = function () {};\n Op.prototype.interfaces_ = function () {\n return [];\n }, Op.prototype.getClass = function () {\n return Op;\n }, Op.computeDistance = function () {\n if (arguments[2] instanceof Pp && arguments[0] instanceof Jc && arguments[1] instanceof bu) for (var t = arguments[0], e = arguments[1], n = arguments[2], r = new gl(), i = t.getCoordinates(), o = 0; o < i.length - 1; o++) {\n r.setCoordinates(i[o], i[o + 1]);\n var s = r.closestPoint(e);\n n.setMinimum(s, e);\n } else if (arguments[2] instanceof Pp && arguments[0] instanceof $c && arguments[1] instanceof bu) {\n var a = arguments[0],\n u = arguments[1],\n c = arguments[2];\n Op.computeDistance(a.getExteriorRing(), u, c);\n for (var h = 0; h < a.getNumInteriorRing(); h++) Op.computeDistance(a.getInteriorRingN(h), u, c);\n } else if (arguments[2] instanceof Pp && arguments[0] instanceof cc && arguments[1] instanceof bu) {\n var l = arguments[0],\n p = arguments[1],\n f = arguments[2];\n if (l instanceof Jc) Op.computeDistance(l, p, f);else if (l instanceof $c) Op.computeDistance(l, p, f);else if (l instanceof jc) for (var g = l, d = 0; d < g.getNumGeometries(); d++) {\n var y = g.getGeometryN(d);\n Op.computeDistance(y, p, f);\n } else f.setMinimum(l.getCoordinate(), p);\n } else if (arguments[2] instanceof Pp && arguments[0] instanceof gl && arguments[1] instanceof bu) {\n var _ = arguments[0],\n m = arguments[1],\n v = arguments[2],\n x = _.closestPoint(m);\n v.setMinimum(x, m);\n }\n };\n var Rp = function () {\n this._g0 = null, this._g1 = null, this._ptDist = new Pp(), this._densifyFrac = 0;\n var t = arguments[0],\n e = arguments[1];\n this._g0 = t, this._g1 = e;\n },\n Tp = {\n MaxPointDistanceFilter: {\n configurable: !0\n },\n MaxDensifiedByFractionDistanceFilter: {\n configurable: !0\n }\n };\n Rp.prototype.getCoordinates = function () {\n return this._ptDist.getCoordinates();\n }, Rp.prototype.setDensifyFraction = function (t) {\n if (t > 1 || t <= 0) throw new _u(\"Fraction is not in range (0.0 - 1.0]\");\n this._densifyFrac = t;\n }, Rp.prototype.compute = function (t, e) {\n this.computeOrientedDistance(t, e, this._ptDist), this.computeOrientedDistance(e, t, this._ptDist);\n }, Rp.prototype.distance = function () {\n return this.compute(this._g0, this._g1), this._ptDist.getDistance();\n }, Rp.prototype.computeOrientedDistance = function (t, e, n) {\n var r = new Ap(e);\n if (t.apply(r), n.setMaximum(r.getMaxPointDistance()), this._densifyFrac > 0) {\n var i = new Dp(e, this._densifyFrac);\n t.apply(i), n.setMaximum(i.getMaxPointDistance());\n }\n }, Rp.prototype.orientedDistance = function () {\n return this.computeOrientedDistance(this._g0, this._g1, this._ptDist), this._ptDist.getDistance();\n }, Rp.prototype.interfaces_ = function () {\n return [];\n }, Rp.prototype.getClass = function () {\n return Rp;\n }, Rp.distance = function () {\n if (2 === arguments.length) {\n var t = arguments[0],\n e = arguments[1];\n return new Rp(t, e).distance();\n }\n if (3 === arguments.length) {\n var n = arguments[0],\n r = arguments[1],\n i = arguments[2],\n o = new Rp(n, r);\n return o.setDensifyFraction(i), o.distance();\n }\n }, Tp.MaxPointDistanceFilter.get = function () {\n return Ap;\n }, Tp.MaxDensifiedByFractionDistanceFilter.get = function () {\n return Dp;\n }, Object.defineProperties(Rp, Tp);\n var Ap = function () {\n this._maxPtDist = new Pp(), this._minPtDist = new Pp(), this._euclideanDist = new Op(), this._geom = null;\n var t = arguments[0];\n this._geom = t;\n };\n Ap.prototype.filter = function (t) {\n this._minPtDist.initialize(), Op.computeDistance(this._geom, t, this._minPtDist), this._maxPtDist.setMaximum(this._minPtDist);\n }, Ap.prototype.getMaxPointDistance = function () {\n return this._maxPtDist;\n }, Ap.prototype.interfaces_ = function () {\n return [pc];\n }, Ap.prototype.getClass = function () {\n return Ap;\n };\n var Dp = function () {\n this._maxPtDist = new Pp(), this._minPtDist = new Pp(), this._geom = null, this._numSubSegs = 0;\n var t = arguments[0],\n e = arguments[1];\n this._geom = t, this._numSubSegs = Math.trunc(Math.round(1 / e));\n };\n Dp.prototype.filter = function (t, e) {\n if (0 === e) return null;\n for (var n = t.getCoordinate(e - 1), r = t.getCoordinate(e), i = (r.x - n.x) / this._numSubSegs, o = (r.y - n.y) / this._numSubSegs, s = 0; s < this._numSubSegs; s++) {\n var a = n.x + s * i,\n u = n.y + s * o,\n c = new bu(a, u);\n this._minPtDist.initialize(), Op.computeDistance(this._geom, c, this._minPtDist), this._maxPtDist.setMaximum(this._minPtDist);\n }\n }, Dp.prototype.isDone = function () {\n return !1;\n }, Dp.prototype.isGeometryChanged = function () {\n return !1;\n }, Dp.prototype.getMaxPointDistance = function () {\n return this._maxPtDist;\n }, Dp.prototype.interfaces_ = function () {\n return [zc];\n }, Dp.prototype.getClass = function () {\n return Dp;\n };\n var Fp = function (t, e, n) {\n this._minValidDistance = null, this._maxValidDistance = null, this._minDistanceFound = null, this._maxDistanceFound = null, this._isValid = !0, this._errMsg = null, this._errorLocation = null, this._errorIndicator = null, this._input = t || null, this._bufDistance = e || null, this._result = n || null;\n },\n qp = {\n VERBOSE: {\n configurable: !0\n },\n MAX_DISTANCE_DIFF_FRAC: {\n configurable: !0\n }\n };\n Fp.prototype.checkMaximumDistance = function (t, e, n) {\n var r = new Rp(e, t);\n if (r.setDensifyFraction(.25), this._maxDistanceFound = r.orientedDistance(), this._maxDistanceFound > n) {\n this._isValid = !1;\n var i = r.getCoordinates();\n this._errorLocation = i[1], this._errorIndicator = t.getFactory().createLineString(i), this._errMsg = \"Distance between buffer curve and input is too large (\" + this._maxDistanceFound + \" at \" + Ku.toLineString(i[0], i[1]) + \")\";\n }\n }, Fp.prototype.isValid = function () {\n var t = Math.abs(this._bufDistance),\n e = Fp.MAX_DISTANCE_DIFF_FRAC * t;\n return this._minValidDistance = t - e, this._maxValidDistance = t + e, !(!this._input.isEmpty() && !this._result.isEmpty()) || (this._bufDistance > 0 ? this.checkPositiveValid() : this.checkNegativeValid(), Fp.VERBOSE && Xu.out.println(\"Min Dist= \" + this._minDistanceFound + \" err= \" + (1 - this._minDistanceFound / this._bufDistance) + \" Max Dist= \" + this._maxDistanceFound + \" err= \" + (this._maxDistanceFound / this._bufDistance - 1)), this._isValid);\n }, Fp.prototype.checkNegativeValid = function () {\n if (!(this._input instanceof $c || this._input instanceof nh || this._input instanceof jc)) return null;\n var t = this.getPolygonLines(this._input);\n if (this.checkMinimumDistance(t, this._result, this._minValidDistance), !this._isValid) return null;\n this.checkMaximumDistance(t, this._result, this._maxValidDistance);\n }, Fp.prototype.getErrorIndicator = function () {\n return this._errorIndicator;\n }, Fp.prototype.checkMinimumDistance = function (t, e, n) {\n var r = new Lp(t, e, n);\n if (this._minDistanceFound = r.distance(), this._minDistanceFound < n) {\n this._isValid = !1;\n var i = r.nearestPoints();\n this._errorLocation = r.nearestPoints()[1], this._errorIndicator = t.getFactory().createLineString(i), this._errMsg = \"Distance between buffer curve and input is too small (\" + this._minDistanceFound + \" at \" + Ku.toLineString(i[0], i[1]) + \" )\";\n }\n }, Fp.prototype.checkPositiveValid = function () {\n var t = this._result.getBoundary();\n if (this.checkMinimumDistance(this._input, t, this._minValidDistance), !this._isValid) return null;\n this.checkMaximumDistance(this._input, t, this._maxValidDistance);\n }, Fp.prototype.getErrorLocation = function () {\n return this._errorLocation;\n }, Fp.prototype.getPolygonLines = function (t) {\n for (var e = new bc(), n = new bp(e), r = wp.getPolygons(t).iterator(); r.hasNext();) {\n r.next().apply(n);\n }\n return t.getFactory().buildGeometry(e);\n }, Fp.prototype.getErrorMessage = function () {\n return this._errMsg;\n }, Fp.prototype.interfaces_ = function () {\n return [];\n }, Fp.prototype.getClass = function () {\n return Fp;\n }, qp.VERBOSE.get = function () {\n return !1;\n }, qp.MAX_DISTANCE_DIFF_FRAC.get = function () {\n return .012;\n }, Object.defineProperties(Fp, qp);\n var Gp = function (t, e, n) {\n this._isValid = !0, this._errorMsg = null, this._errorLocation = null, this._errorIndicator = null, this._input = t || null, this._distance = e || null, this._result = n || null;\n },\n Bp = {\n VERBOSE: {\n configurable: !0\n },\n MAX_ENV_DIFF_FRAC: {\n configurable: !0\n }\n };\n Gp.prototype.isValid = function () {\n return this.checkPolygonal(), this._isValid ? (this.checkExpectedEmpty(), this._isValid ? (this.checkEnvelope(), this._isValid ? (this.checkArea(), this._isValid ? (this.checkDistance(), this._isValid) : this._isValid) : this._isValid) : this._isValid) : this._isValid;\n }, Gp.prototype.checkEnvelope = function () {\n if (this._distance < 0) return null;\n var t = this._distance * Gp.MAX_ENV_DIFF_FRAC;\n 0 === t && (t = .001);\n var e = new Yu(this._input.getEnvelopeInternal());\n e.expandBy(this._distance);\n var n = new Yu(this._result.getEnvelopeInternal());\n n.expandBy(t), n.contains(e) || (this._isValid = !1, this._errorMsg = \"Buffer envelope is incorrect\", this._errorIndicator = this._input.getFactory().toGeometry(n)), this.report(\"Envelope\");\n }, Gp.prototype.checkDistance = function () {\n var t = new Fp(this._input, this._distance, this._result);\n t.isValid() || (this._isValid = !1, this._errorMsg = t.getErrorMessage(), this._errorLocation = t.getErrorLocation(), this._errorIndicator = t.getErrorIndicator()), this.report(\"Distance\");\n }, Gp.prototype.checkArea = function () {\n var t = this._input.getArea(),\n e = this._result.getArea();\n this._distance > 0 && t > e && (this._isValid = !1, this._errorMsg = \"Area of positive buffer is smaller than input\", this._errorIndicator = this._result), this._distance < 0 && t < e && (this._isValid = !1, this._errorMsg = \"Area of negative buffer is larger than input\", this._errorIndicator = this._result), this.report(\"Area\");\n }, Gp.prototype.checkPolygonal = function () {\n this._result instanceof $c || this._result instanceof nh || (this._isValid = !1), this._errorMsg = \"Result is not polygonal\", this._errorIndicator = this._result, this.report(\"Polygonal\");\n }, Gp.prototype.getErrorIndicator = function () {\n return this._errorIndicator;\n }, Gp.prototype.getErrorLocation = function () {\n return this._errorLocation;\n }, Gp.prototype.checkExpectedEmpty = function () {\n return this._input.getDimension() >= 2 ? null : this._distance > 0 ? null : (this._result.isEmpty() || (this._isValid = !1, this._errorMsg = \"Result is non-empty\", this._errorIndicator = this._result), void this.report(\"ExpectedEmpty\"));\n }, Gp.prototype.report = function (t) {\n if (!Gp.VERBOSE) return null;\n Xu.out.println(\"Check \" + t + \": \" + (this._isValid ? \"passed\" : \"FAILED\"));\n }, Gp.prototype.getErrorMessage = function () {\n return this._errorMsg;\n }, Gp.prototype.interfaces_ = function () {\n return [];\n }, Gp.prototype.getClass = function () {\n return Gp;\n }, Gp.isValidMsg = function (t, e, n) {\n var r = new Gp(t, e, n);\n return r.isValid() ? null : r.getErrorMessage();\n }, Gp.isValid = function (t, e, n) {\n return !!new Gp(t, e, n).isValid();\n }, Bp.VERBOSE.get = function () {\n return !1;\n }, Bp.MAX_ENV_DIFF_FRAC.get = function () {\n return .012;\n }, Object.defineProperties(Gp, Bp);\n var kp = function () {\n this._pts = null, this._data = null;\n var t = arguments[0],\n e = arguments[1];\n this._pts = t, this._data = e;\n };\n kp.prototype.getCoordinates = function () {\n return this._pts;\n }, kp.prototype.size = function () {\n return this._pts.length;\n }, kp.prototype.getCoordinate = function (t) {\n return this._pts[t];\n }, kp.prototype.isClosed = function () {\n return this._pts[0].equals(this._pts[this._pts.length - 1]);\n }, kp.prototype.getSegmentOctant = function (t) {\n return t === this._pts.length - 1 ? -1 : hl.octant(this.getCoordinate(t), this.getCoordinate(t + 1));\n }, kp.prototype.setData = function (t) {\n this._data = t;\n }, kp.prototype.getData = function () {\n return this._data;\n }, kp.prototype.toString = function () {\n return Ku.toLineString(new uh(this._pts));\n }, kp.prototype.interfaces_ = function () {\n return [ll];\n }, kp.prototype.getClass = function () {\n return kp;\n };\n var zp = function () {\n this._findAllIntersections = !1, this._isCheckEndSegmentsOnly = !1, this._li = null, this._interiorIntersection = null, this._intSegments = null, this._intersections = new bc(), this._intersectionCount = 0, this._keepIntersections = !0;\n var t = arguments[0];\n this._li = t, this._interiorIntersection = null;\n };\n zp.prototype.getInteriorIntersection = function () {\n return this._interiorIntersection;\n }, zp.prototype.setCheckEndSegmentsOnly = function (t) {\n this._isCheckEndSegmentsOnly = t;\n }, zp.prototype.getIntersectionSegments = function () {\n return this._intSegments;\n }, zp.prototype.count = function () {\n return this._intersectionCount;\n }, zp.prototype.getIntersections = function () {\n return this._intersections;\n }, zp.prototype.setFindAllIntersections = function (t) {\n this._findAllIntersections = t;\n }, zp.prototype.setKeepIntersections = function (t) {\n this._keepIntersections = t;\n }, zp.prototype.processIntersections = function (t, e, n, r) {\n if (!this._findAllIntersections && this.hasIntersection()) return null;\n if (t === n && e === r) return null;\n if (this._isCheckEndSegmentsOnly) {\n if (!(this.isEndSegment(t, e) || this.isEndSegment(n, r))) return null;\n }\n var i = t.getCoordinates()[e],\n o = t.getCoordinates()[e + 1],\n s = n.getCoordinates()[r],\n a = n.getCoordinates()[r + 1];\n this._li.computeIntersection(i, o, s, a), this._li.hasIntersection() && this._li.isInteriorIntersection() && (this._intSegments = new Array(4).fill(null), this._intSegments[0] = i, this._intSegments[1] = o, this._intSegments[2] = s, this._intSegments[3] = a, this._interiorIntersection = this._li.getIntersection(0), this._keepIntersections && this._intersections.add(this._interiorIntersection), this._intersectionCount++);\n }, zp.prototype.isEndSegment = function (t, e) {\n return 0 === e || e >= t.size() - 2;\n }, zp.prototype.hasIntersection = function () {\n return null !== this._interiorIntersection;\n }, zp.prototype.isDone = function () {\n return !this._findAllIntersections && null !== this._interiorIntersection;\n }, zp.prototype.interfaces_ = function () {\n return [Hl];\n }, zp.prototype.getClass = function () {\n return zp;\n }, zp.createAllIntersectionsFinder = function (t) {\n var e = new zp(t);\n return e.setFindAllIntersections(!0), e;\n }, zp.createAnyIntersectionFinder = function (t) {\n return new zp(t);\n }, zp.createIntersectionCounter = function (t) {\n var e = new zp(t);\n return e.setFindAllIntersections(!0), e.setKeepIntersections(!1), e;\n };\n var jp = function () {\n this._li = new rc(), this._segStrings = null, this._findAllIntersections = !1, this._segInt = null, this._isValid = !0;\n var t = arguments[0];\n this._segStrings = t;\n };\n jp.prototype.execute = function () {\n if (null !== this._segInt) return null;\n this.checkInteriorIntersections();\n }, jp.prototype.getIntersections = function () {\n return this._segInt.getIntersections();\n }, jp.prototype.isValid = function () {\n return this.execute(), this._isValid;\n }, jp.prototype.setFindAllIntersections = function (t) {\n this._findAllIntersections = t;\n }, jp.prototype.checkInteriorIntersections = function () {\n this._isValid = !0, this._segInt = new zp(this._li), this._segInt.setFindAllIntersections(this._findAllIntersections);\n var t = new El();\n if (t.setSegmentIntersector(this._segInt), t.computeNodes(this._segStrings), this._segInt.hasIntersection()) return this._isValid = !1, null;\n }, jp.prototype.checkValid = function () {\n if (this.execute(), !this._isValid) throw new Mh(this.getErrorMessage(), this._segInt.getInteriorIntersection());\n }, jp.prototype.getErrorMessage = function () {\n if (this._isValid) return \"no intersections found\";\n var t = this._segInt.getIntersectionSegments();\n return \"found non-noded intersection between \" + Ku.toLineString(t[0], t[1]) + \" and \" + Ku.toLineString(t[2], t[3]);\n }, jp.prototype.interfaces_ = function () {\n return [];\n }, jp.prototype.getClass = function () {\n return jp;\n }, jp.computeIntersections = function (t) {\n var e = new jp(t);\n return e.setFindAllIntersections(!0), e.isValid(), e.getIntersections();\n };\n var Xp = function t() {\n this._nv = null;\n var e = arguments[0];\n this._nv = new jp(t.toSegmentStrings(e));\n };\n Xp.prototype.checkValid = function () {\n this._nv.checkValid();\n }, Xp.prototype.interfaces_ = function () {\n return [];\n }, Xp.prototype.getClass = function () {\n return Xp;\n }, Xp.toSegmentStrings = function (t) {\n for (var e = new bc(), n = t.iterator(); n.hasNext();) {\n var r = n.next();\n e.add(new kp(r.getCoordinates(), r));\n }\n return e;\n }, Xp.checkValid = function (t) {\n new Xp(t).checkValid();\n };\n var Up = function (t) {\n this._mapOp = t;\n };\n Up.prototype.map = function (t) {\n for (var e = new bc(), n = 0; n < t.getNumGeometries(); n++) {\n var r = this._mapOp.map(t.getGeometryN(n));\n r.isEmpty() || e.add(r);\n }\n return t.getFactory().createGeometryCollection(_h.toGeometryArray(e));\n }, Up.prototype.interfaces_ = function () {\n return [];\n }, Up.prototype.getClass = function () {\n return Up;\n }, Up.map = function (t, e) {\n return new Up(e).map(t);\n };\n var Yp = function () {\n this._op = null, this._geometryFactory = null, this._ptLocator = null, this._lineEdgesList = new bc(), this._resultLineList = new bc();\n var t = arguments[0],\n e = arguments[1],\n n = arguments[2];\n this._op = t, this._geometryFactory = e, this._ptLocator = n;\n };\n Yp.prototype.collectLines = function (t) {\n for (var e = this._op.getGraph().getEdgeEnds().iterator(); e.hasNext();) {\n var n = e.next();\n this.collectLineEdge(n, t, this._lineEdgesList), this.collectBoundaryTouchEdge(n, t, this._lineEdgesList);\n }\n }, Yp.prototype.labelIsolatedLine = function (t, e) {\n var n = this._ptLocator.locate(t.getCoordinate(), this._op.getArgGeometry(e));\n t.getLabel().setLocation(e, n);\n }, Yp.prototype.build = function (t) {\n return this.findCoveredLineEdges(), this.collectLines(t), this.buildLines(t), this._resultLineList;\n }, Yp.prototype.collectLineEdge = function (t, e, n) {\n var r = t.getLabel(),\n i = t.getEdge();\n t.isLineEdge() && (t.isVisited() || !Cf.isResultOfOp(r, e) || i.isCovered() || (n.add(i), t.setVisitedEdge(!0)));\n }, Yp.prototype.findCoveredLineEdges = function () {\n for (var t = this._op.getGraph().getNodes().iterator(); t.hasNext();) {\n t.next().getEdges().findCoveredLineEdges();\n }\n for (var e = this._op.getGraph().getEdgeEnds().iterator(); e.hasNext();) {\n var n = e.next(),\n r = n.getEdge();\n if (n.isLineEdge() && !r.isCoveredSet()) {\n var i = this._op.isCoveredByA(n.getCoordinate());\n r.setCovered(i);\n }\n }\n }, Yp.prototype.labelIsolatedLines = function (t) {\n for (var e = t.iterator(); e.hasNext();) {\n var n = e.next(),\n r = n.getLabel();\n n.isIsolated() && (r.isNull(0) ? this.labelIsolatedLine(n, 0) : this.labelIsolatedLine(n, 1));\n }\n }, Yp.prototype.buildLines = function (t) {\n for (var e = this._lineEdgesList.iterator(); e.hasNext();) {\n var n = e.next(),\n r = this._geometryFactory.createLineString(n.getCoordinates());\n this._resultLineList.add(r), n.setInResult(!0);\n }\n }, Yp.prototype.collectBoundaryTouchEdge = function (t, e, n) {\n var r = t.getLabel();\n return t.isLineEdge() ? null : t.isVisited() ? null : t.isInteriorAreaEdge() ? null : t.getEdge().isInResult() ? null : (tc.isTrue(!(t.isInResult() || t.getSym().isInResult()) || !t.getEdge().isInResult()), void (Cf.isResultOfOp(r, e) && e === Cf.INTERSECTION && (n.add(t.getEdge()), t.setVisitedEdge(!0))));\n }, Yp.prototype.interfaces_ = function () {\n return [];\n }, Yp.prototype.getClass = function () {\n return Yp;\n };\n var Vp = function () {\n this._op = null, this._geometryFactory = null, this._resultPointList = new bc();\n var t = arguments[0],\n e = arguments[1];\n this._op = t, this._geometryFactory = e;\n };\n Vp.prototype.filterCoveredNodeToPoint = function (t) {\n var e = t.getCoordinate();\n if (!this._op.isCoveredByLA(e)) {\n var n = this._geometryFactory.createPoint(e);\n this._resultPointList.add(n);\n }\n }, Vp.prototype.extractNonCoveredResultNodes = function (t) {\n for (var e = this._op.getGraph().getNodes().iterator(); e.hasNext();) {\n var n = e.next();\n if (!n.isInResult() && !n.isIncidentEdgeInResult() && (0 === n.getEdges().getDegree() || t === Cf.INTERSECTION)) {\n var r = n.getLabel();\n Cf.isResultOfOp(r, t) && this.filterCoveredNodeToPoint(n);\n }\n }\n }, Vp.prototype.build = function (t) {\n return this.extractNonCoveredResultNodes(t), this._resultPointList;\n }, Vp.prototype.interfaces_ = function () {\n return [];\n }, Vp.prototype.getClass = function () {\n return Vp;\n };\n var Hp = function () {\n this._inputGeom = null, this._factory = null, this._pruneEmptyGeometry = !0, this._preserveGeometryCollectionType = !0, this._preserveCollections = !1, this._preserveType = !1;\n };\n Hp.prototype.transformPoint = function (t, e) {\n return this._factory.createPoint(this.transformCoordinates(t.getCoordinateSequence(), t));\n }, Hp.prototype.transformPolygon = function (t, e) {\n var n = !0,\n r = this.transformLinearRing(t.getExteriorRing(), t);\n null !== r && r instanceof eh && !r.isEmpty() || (n = !1);\n for (var i = new bc(), o = 0; o < t.getNumInteriorRing(); o++) {\n var s = this.transformLinearRing(t.getInteriorRingN(o), t);\n null === s || s.isEmpty() || (s instanceof eh || (n = !1), i.add(s));\n }\n if (n) return this._factory.createPolygon(r, i.toArray([]));\n var a = new bc();\n return null !== r && a.add(r), a.addAll(i), this._factory.buildGeometry(a);\n }, Hp.prototype.createCoordinateSequence = function (t) {\n return this._factory.getCoordinateSequenceFactory().create(t);\n }, Hp.prototype.getInputGeometry = function () {\n return this._inputGeom;\n }, Hp.prototype.transformMultiLineString = function (t, e) {\n for (var n = new bc(), r = 0; r < t.getNumGeometries(); r++) {\n var i = this.transformLineString(t.getGeometryN(r), t);\n null !== i && (i.isEmpty() || n.add(i));\n }\n return this._factory.buildGeometry(n);\n }, Hp.prototype.transformCoordinates = function (t, e) {\n return this.copy(t);\n }, Hp.prototype.transformLineString = function (t, e) {\n return this._factory.createLineString(this.transformCoordinates(t.getCoordinateSequence(), t));\n }, Hp.prototype.transformMultiPoint = function (t, e) {\n for (var n = new bc(), r = 0; r < t.getNumGeometries(); r++) {\n var i = this.transformPoint(t.getGeometryN(r), t);\n null !== i && (i.isEmpty() || n.add(i));\n }\n return this._factory.buildGeometry(n);\n }, Hp.prototype.transformMultiPolygon = function (t, e) {\n for (var n = new bc(), r = 0; r < t.getNumGeometries(); r++) {\n var i = this.transformPolygon(t.getGeometryN(r), t);\n null !== i && (i.isEmpty() || n.add(i));\n }\n return this._factory.buildGeometry(n);\n }, Hp.prototype.copy = function (t) {\n return t.copy();\n }, Hp.prototype.transformGeometryCollection = function (t, e) {\n for (var n = new bc(), r = 0; r < t.getNumGeometries(); r++) {\n var i = this.transform(t.getGeometryN(r));\n null !== i && (this._pruneEmptyGeometry && i.isEmpty() || n.add(i));\n }\n return this._preserveGeometryCollectionType ? this._factory.createGeometryCollection(_h.toGeometryArray(n)) : this._factory.buildGeometry(n);\n }, Hp.prototype.transform = function (t) {\n if (this._inputGeom = t, this._factory = t.getFactory(), t instanceof Kc) return this.transformPoint(t, null);\n if (t instanceof th) return this.transformMultiPoint(t, null);\n if (t instanceof eh) return this.transformLinearRing(t, null);\n if (t instanceof Jc) return this.transformLineString(t, null);\n if (t instanceof Xc) return this.transformMultiLineString(t, null);\n if (t instanceof $c) return this.transformPolygon(t, null);\n if (t instanceof nh) return this.transformMultiPolygon(t, null);\n if (t instanceof jc) return this.transformGeometryCollection(t, null);\n throw new _u(\"Unknown Geometry subtype: \" + t.getClass().getName());\n }, Hp.prototype.transformLinearRing = function (t, e) {\n var n = this.transformCoordinates(t.getCoordinateSequence(), t);\n if (null === n) return this._factory.createLinearRing(null);\n var r = n.size();\n return r > 0 && r < 4 && !this._preserveType ? this._factory.createLineString(n) : this._factory.createLinearRing(n);\n }, Hp.prototype.interfaces_ = function () {\n return [];\n }, Hp.prototype.getClass = function () {\n return Hp;\n };\n var Wp = function t() {\n if (this._snapTolerance = 0, this._srcPts = null, this._seg = new gl(), this._allowSnappingToSourceVertices = !1, this._isClosed = !1, arguments[0] instanceof Jc && \"number\" == typeof arguments[1]) {\n var e = arguments[0],\n n = arguments[1];\n t.call(this, e.getCoordinates(), n);\n } else if (arguments[0] instanceof Array && \"number\" == typeof arguments[1]) {\n var r = arguments[0],\n i = arguments[1];\n this._srcPts = r, this._isClosed = t.isClosed(r), this._snapTolerance = i;\n }\n };\n Wp.prototype.snapVertices = function (t, e) {\n for (var n = this._isClosed ? t.size() - 1 : t.size(), r = 0; r < n; r++) {\n var i = t.get(r),\n o = this.findSnapForVertex(i, e);\n null !== o && (t.set(r, new bu(o)), 0 === r && this._isClosed && t.set(t.size() - 1, new bu(o)));\n }\n }, Wp.prototype.findSnapForVertex = function (t, e) {\n for (var n = 0; n < e.length; n++) {\n if (t.equals2D(e[n])) return null;\n if (t.distance(e[n]) < this._snapTolerance) return e[n];\n }\n return null;\n }, Wp.prototype.snapTo = function (t) {\n var e = new Nc(this._srcPts);\n this.snapVertices(e, t), this.snapSegments(e, t);\n return e.toCoordinateArray();\n }, Wp.prototype.snapSegments = function (t, e) {\n if (0 === e.length) return null;\n var n = e.length;\n e[0].equals2D(e[e.length - 1]) && (n = e.length - 1);\n for (var r = 0; r < n; r++) {\n var i = e[r],\n o = this.findSegmentIndexToSnap(i, t);\n o >= 0 && t.add(o + 1, new bu(i), !1);\n }\n }, Wp.prototype.findSegmentIndexToSnap = function (t, e) {\n for (var n = mu.MAX_VALUE, r = -1, i = 0; i < e.size() - 1; i++) {\n if (this._seg.p0 = e.get(i), this._seg.p1 = e.get(i + 1), this._seg.p0.equals2D(t) || this._seg.p1.equals2D(t)) {\n if (this._allowSnappingToSourceVertices) continue;\n return -1;\n }\n var o = this._seg.distance(t);\n o < this._snapTolerance && o < n && (n = o, r = i);\n }\n return r;\n }, Wp.prototype.setAllowSnappingToSourceVertices = function (t) {\n this._allowSnappingToSourceVertices = t;\n }, Wp.prototype.interfaces_ = function () {\n return [];\n }, Wp.prototype.getClass = function () {\n return Wp;\n }, Wp.isClosed = function (t) {\n return !(t.length <= 1) && t[0].equals2D(t[t.length - 1]);\n };\n var Jp = function (t) {\n this._srcGeom = t || null;\n },\n Zp = {\n SNAP_PRECISION_FACTOR: {\n configurable: !0\n }\n };\n Jp.prototype.snapTo = function (t, e) {\n var n = this.extractTargetCoordinates(t);\n return new Kp(e, n).transform(this._srcGeom);\n }, Jp.prototype.snapToSelf = function (t, e) {\n var n = this.extractTargetCoordinates(this._srcGeom),\n r = new Kp(t, n, !0).transform(this._srcGeom),\n i = r;\n return e && Lu(i, Qc) && (i = r.buffer(0)), i;\n }, Jp.prototype.computeSnapTolerance = function (t) {\n return this.computeMinimumSegmentLength(t) / 10;\n }, Jp.prototype.extractTargetCoordinates = function (t) {\n for (var e = new ki(), n = t.getCoordinates(), r = 0; r < n.length; r++) e.add(n[r]);\n return e.toArray(new Array(0).fill(null));\n }, Jp.prototype.computeMinimumSegmentLength = function (t) {\n for (var e = mu.MAX_VALUE, n = 0; n < t.length - 1; n++) {\n var r = t[n].distance(t[n + 1]);\n r < e && (e = r);\n }\n return e;\n }, Jp.prototype.interfaces_ = function () {\n return [];\n }, Jp.prototype.getClass = function () {\n return Jp;\n }, Jp.snap = function (t, e, n) {\n var r = new Array(2).fill(null),\n i = new Jp(t);\n r[0] = i.snapTo(e, n);\n var o = new Jp(e);\n return r[1] = o.snapTo(r[0], n), r;\n }, Jp.computeOverlaySnapTolerance = function () {\n if (1 === arguments.length) {\n var t = arguments[0],\n e = Jp.computeSizeBasedSnapTolerance(t),\n n = t.getPrecisionModel();\n if (n.getType() === fh.FIXED) {\n var r = 1 / n.getScale() * 2 / 1.415;\n r > e && (e = r);\n }\n return e;\n }\n if (2 === arguments.length) {\n var i = arguments[0],\n o = arguments[1];\n return Math.min(Jp.computeOverlaySnapTolerance(i), Jp.computeOverlaySnapTolerance(o));\n }\n }, Jp.computeSizeBasedSnapTolerance = function (t) {\n var e = t.getEnvelopeInternal();\n return Math.min(e.getHeight(), e.getWidth()) * Jp.SNAP_PRECISION_FACTOR;\n }, Jp.snapToSelf = function (t, e, n) {\n return new Jp(t).snapToSelf(e, n);\n }, Zp.SNAP_PRECISION_FACTOR.get = function () {\n return 1e-9;\n }, Object.defineProperties(Jp, Zp);\n var Kp = function (t) {\n function e(e, n, r) {\n t.call(this), this._snapTolerance = e || null, this._snapPts = n || null, this._isSelfSnap = void 0 !== r && r;\n }\n return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.snapLine = function (t, e) {\n var n = new Wp(t, this._snapTolerance);\n return n.setAllowSnappingToSourceVertices(this._isSelfSnap), n.snapTo(e);\n }, e.prototype.transformCoordinates = function (t, e) {\n var n = t.toCoordinateArray(),\n r = this.snapLine(n, this._snapPts);\n return this._factory.getCoordinateSequenceFactory().create(r);\n }, e.prototype.interfaces_ = function () {\n return [];\n }, e.prototype.getClass = function () {\n return e;\n }, e;\n }(Hp),\n Qp = function () {\n this._isFirst = !0, this._commonMantissaBitsCount = 53, this._commonBits = 0, this._commonSignExp = null;\n };\n Qp.prototype.getCommon = function () {\n return mu.longBitsToDouble(this._commonBits);\n }, Qp.prototype.add = function (t) {\n var e = mu.doubleToLongBits(t);\n if (this._isFirst) return this._commonBits = e, this._commonSignExp = Qp.signExpBits(this._commonBits), this._isFirst = !1, null;\n if (Qp.signExpBits(e) !== this._commonSignExp) return this._commonBits = 0, null;\n this._commonMantissaBitsCount = Qp.numCommonMostSigMantissaBits(this._commonBits, e), this._commonBits = Qp.zeroLowerBits(this._commonBits, 64 - (12 + this._commonMantissaBitsCount));\n }, Qp.prototype.toString = function () {\n if (1 === arguments.length) {\n var t = arguments[0],\n e = mu.longBitsToDouble(t),\n n = \"0000000000000000000000000000000000000000000000000000000000000000\" + mu.toBinaryString(t),\n r = n.substring(n.length - 64);\n return r.substring(0, 1) + \" \" + r.substring(1, 12) + \"(exp) \" + r.substring(12) + \" [ \" + e + \" ]\";\n }\n }, Qp.prototype.interfaces_ = function () {\n return [];\n }, Qp.prototype.getClass = function () {\n return Qp;\n }, Qp.getBit = function (t, e) {\n return 0 != (t & 1 << e) ? 1 : 0;\n }, Qp.signExpBits = function (t) {\n return t >> 52;\n }, Qp.zeroLowerBits = function (t, e) {\n return t & ~((1 << e) - 1);\n }, Qp.numCommonMostSigMantissaBits = function (t, e) {\n for (var n = 0, r = 52; r >= 0; r--) {\n if (Qp.getBit(t, r) !== Qp.getBit(e, r)) return n;\n n++;\n }\n return 52;\n };\n var $p = function () {\n this._commonCoord = null, this._ccFilter = new ef();\n },\n tf = {\n CommonCoordinateFilter: {\n configurable: !0\n },\n Translater: {\n configurable: !0\n }\n };\n $p.prototype.addCommonBits = function (t) {\n var e = new nf(this._commonCoord);\n t.apply(e), t.geometryChanged();\n }, $p.prototype.removeCommonBits = function (t) {\n if (0 === this._commonCoord.x && 0 === this._commonCoord.y) return t;\n var e = new bu(this._commonCoord);\n e.x = -e.x, e.y = -e.y;\n var n = new nf(e);\n return t.apply(n), t.geometryChanged(), t;\n }, $p.prototype.getCommonCoordinate = function () {\n return this._commonCoord;\n }, $p.prototype.add = function (t) {\n t.apply(this._ccFilter), this._commonCoord = this._ccFilter.getCommonCoordinate();\n }, $p.prototype.interfaces_ = function () {\n return [];\n }, $p.prototype.getClass = function () {\n return $p;\n }, tf.CommonCoordinateFilter.get = function () {\n return ef;\n }, tf.Translater.get = function () {\n return nf;\n }, Object.defineProperties($p, tf);\n var ef = function () {\n this._commonBitsX = new Qp(), this._commonBitsY = new Qp();\n };\n ef.prototype.filter = function (t) {\n this._commonBitsX.add(t.x), this._commonBitsY.add(t.y);\n }, ef.prototype.getCommonCoordinate = function () {\n return new bu(this._commonBitsX.getCommon(), this._commonBitsY.getCommon());\n }, ef.prototype.interfaces_ = function () {\n return [pc];\n }, ef.prototype.getClass = function () {\n return ef;\n };\n var nf = function () {\n this.trans = null;\n var t = arguments[0];\n this.trans = t;\n };\n nf.prototype.filter = function (t, e) {\n var n = t.getOrdinate(e, 0) + this.trans.x,\n r = t.getOrdinate(e, 1) + this.trans.y;\n t.setOrdinate(e, 0, n), t.setOrdinate(e, 1, r);\n }, nf.prototype.isDone = function () {\n return !1;\n }, nf.prototype.isGeometryChanged = function () {\n return !0;\n }, nf.prototype.interfaces_ = function () {\n return [zc];\n }, nf.prototype.getClass = function () {\n return nf;\n };\n var rf = function (t, e) {\n this._geom = new Array(2).fill(null), this._snapTolerance = null, this._cbr = null, this._geom[0] = t, this._geom[1] = e, this.computeSnapTolerance();\n };\n rf.prototype.selfSnap = function (t) {\n return new Jp(t).snapTo(t, this._snapTolerance);\n }, rf.prototype.removeCommonBits = function (t) {\n this._cbr = new $p(), this._cbr.add(t[0]), this._cbr.add(t[1]);\n var e = new Array(2).fill(null);\n return e[0] = this._cbr.removeCommonBits(t[0].copy()), e[1] = this._cbr.removeCommonBits(t[1].copy()), e;\n }, rf.prototype.prepareResult = function (t) {\n return this._cbr.addCommonBits(t), t;\n }, rf.prototype.getResultGeometry = function (t) {\n var e = this.snap(this._geom),\n n = Cf.overlayOp(e[0], e[1], t);\n return this.prepareResult(n);\n }, rf.prototype.checkValid = function (t) {\n t.isValid() || Xu.out.println(\"Snapped geometry is invalid\");\n }, rf.prototype.computeSnapTolerance = function () {\n this._snapTolerance = Jp.computeOverlaySnapTolerance(this._geom[0], this._geom[1]);\n }, rf.prototype.snap = function (t) {\n var e = this.removeCommonBits(t);\n return Jp.snap(e[0], e[1], this._snapTolerance);\n }, rf.prototype.interfaces_ = function () {\n return [];\n }, rf.prototype.getClass = function () {\n return rf;\n }, rf.overlayOp = function (t, e, n) {\n return new rf(t, e).getResultGeometry(n);\n }, rf.union = function (t, e) {\n return rf.overlayOp(t, e, Cf.UNION);\n }, rf.intersection = function (t, e) {\n return rf.overlayOp(t, e, Cf.INTERSECTION);\n }, rf.symDifference = function (t, e) {\n return rf.overlayOp(t, e, Cf.SYMDIFFERENCE);\n }, rf.difference = function (t, e) {\n return rf.overlayOp(t, e, Cf.DIFFERENCE);\n };\n var of = function (t, e) {\n this._geom = new Array(2).fill(null), this._geom[0] = t, this._geom[1] = e;\n };\n of.prototype.getResultGeometry = function (t) {\n var e = null,\n n = !1,\n r = null;\n try {\n e = Cf.overlayOp(this._geom[0], this._geom[1], t);\n n = !0;\n } catch (t) {\n if (!(t instanceof Qu)) throw t;\n r = t;\n }\n if (!n) try {\n e = rf.overlayOp(this._geom[0], this._geom[1], t);\n } catch (t) {\n throw t instanceof Qu ? r : t;\n }\n return e;\n }, of.prototype.interfaces_ = function () {\n return [];\n }, of.prototype.getClass = function () {\n return of;\n }, of.overlayOp = function (t, e, n) {\n return new of(t, e).getResultGeometry(n);\n }, of.union = function (t, e) {\n return of.overlayOp(t, e, Cf.UNION);\n }, of.intersection = function (t, e) {\n return of.overlayOp(t, e, Cf.INTERSECTION);\n }, of.symDifference = function (t, e) {\n return of.overlayOp(t, e, Cf.SYMDIFFERENCE);\n }, of.difference = function (t, e) {\n return of.overlayOp(t, e, Cf.DIFFERENCE);\n };\n var sf = function () {\n this.mce = null, this.chainIndex = null;\n var t = arguments[0],\n e = arguments[1];\n this.mce = t, this.chainIndex = e;\n };\n sf.prototype.computeIntersections = function (t, e) {\n this.mce.computeIntersectsForChain(this.chainIndex, t.mce, t.chainIndex, e);\n }, sf.prototype.interfaces_ = function () {\n return [];\n }, sf.prototype.getClass = function () {\n return sf;\n };\n var af = function t() {\n if (this._label = null, this._xValue = null, this._eventType = null, this._insertEvent = null, this._deleteEventIndex = null, this._obj = null, 2 === arguments.length) {\n var e = arguments[0],\n n = arguments[1];\n this._eventType = t.DELETE, this._xValue = e, this._insertEvent = n;\n } else if (3 === arguments.length) {\n var r = arguments[0],\n i = arguments[1],\n o = arguments[2];\n this._eventType = t.INSERT, this._label = r, this._xValue = i, this._obj = o;\n }\n },\n uf = {\n INSERT: {\n configurable: !0\n },\n DELETE: {\n configurable: !0\n }\n };\n af.prototype.isDelete = function () {\n return this._eventType === af.DELETE;\n }, af.prototype.setDeleteEventIndex = function (t) {\n this._deleteEventIndex = t;\n }, af.prototype.getObject = function () {\n return this._obj;\n }, af.prototype.compareTo = function (t) {\n var e = t;\n return this._xValue < e._xValue ? -1 : this._xValue > e._xValue ? 1 : this._eventType < e._eventType ? -1 : this._eventType > e._eventType ? 1 : 0;\n }, af.prototype.getInsertEvent = function () {\n return this._insertEvent;\n }, af.prototype.isInsert = function () {\n return this._eventType === af.INSERT;\n }, af.prototype.isSameLabel = function (t) {\n return null !== this._label && this._label === t._label;\n }, af.prototype.getDeleteEventIndex = function () {\n return this._deleteEventIndex;\n }, af.prototype.interfaces_ = function () {\n return [xu];\n }, af.prototype.getClass = function () {\n return af;\n }, uf.INSERT.get = function () {\n return 1;\n }, uf.DELETE.get = function () {\n return 2;\n }, Object.defineProperties(af, uf);\n var cf = function () {};\n cf.prototype.interfaces_ = function () {\n return [];\n }, cf.prototype.getClass = function () {\n return cf;\n };\n var hf = function () {\n this._hasIntersection = !1, this._hasProper = !1, this._hasProperInterior = !1, this._properIntersectionPoint = null, this._li = null, this._includeProper = null, this._recordIsolated = null, this._isSelfIntersection = null, this._numIntersections = 0, this.numTests = 0, this._bdyNodes = null, this._isDone = !1, this._isDoneWhenProperInt = !1;\n var t = arguments[0],\n e = arguments[1],\n n = arguments[2];\n this._li = t, this._includeProper = e, this._recordIsolated = n;\n };\n hf.prototype.isTrivialIntersection = function (t, e, n, r) {\n if (t === n && 1 === this._li.getIntersectionNum()) {\n if (hf.isAdjacentSegments(e, r)) return !0;\n if (t.isClosed()) {\n var i = t.getNumPoints() - 1;\n if (0 === e && r === i || 0 === r && e === i) return !0;\n }\n }\n return !1;\n }, hf.prototype.getProperIntersectionPoint = function () {\n return this._properIntersectionPoint;\n }, hf.prototype.setIsDoneIfProperInt = function (t) {\n this._isDoneWhenProperInt = t;\n }, hf.prototype.hasProperInteriorIntersection = function () {\n return this._hasProperInterior;\n }, hf.prototype.isBoundaryPointInternal = function (t, e) {\n for (var n = e.iterator(); n.hasNext();) {\n var r = n.next().getCoordinate();\n if (t.isIntersection(r)) return !0;\n }\n return !1;\n }, hf.prototype.hasProperIntersection = function () {\n return this._hasProper;\n }, hf.prototype.hasIntersection = function () {\n return this._hasIntersection;\n }, hf.prototype.isDone = function () {\n return this._isDone;\n }, hf.prototype.isBoundaryPoint = function (t, e) {\n return null !== e && (!!this.isBoundaryPointInternal(t, e[0]) || !!this.isBoundaryPointInternal(t, e[1]));\n }, hf.prototype.setBoundaryNodes = function (t, e) {\n this._bdyNodes = new Array(2).fill(null), this._bdyNodes[0] = t, this._bdyNodes[1] = e;\n }, hf.prototype.addIntersections = function (t, e, n, r) {\n if (t === n && e === r) return null;\n this.numTests++;\n var i = t.getCoordinates()[e],\n o = t.getCoordinates()[e + 1],\n s = n.getCoordinates()[r],\n a = n.getCoordinates()[r + 1];\n this._li.computeIntersection(i, o, s, a), this._li.hasIntersection() && (this._recordIsolated && (t.setIsolated(!1), n.setIsolated(!1)), this._numIntersections++, this.isTrivialIntersection(t, e, n, r) || (this._hasIntersection = !0, !this._includeProper && this._li.isProper() || (t.addIntersections(this._li, e, 0), n.addIntersections(this._li, r, 1)), this._li.isProper() && (this._properIntersectionPoint = this._li.getIntersection(0).copy(), this._hasProper = !0, this._isDoneWhenProperInt && (this._isDone = !0), this.isBoundaryPoint(this._li, this._bdyNodes) || (this._hasProperInterior = !0))));\n }, hf.prototype.interfaces_ = function () {\n return [];\n }, hf.prototype.getClass = function () {\n return hf;\n }, hf.isAdjacentSegments = function (t, e) {\n return 1 === Math.abs(t - e);\n };\n var lf = function (t) {\n function e() {\n t.call(this), this.events = new bc(), this.nOverlaps = null;\n }\n return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.prepareEvents = function () {\n $h.sort(this.events);\n for (var t = 0; t < this.events.size(); t++) {\n var e = this.events.get(t);\n e.isDelete() && e.getInsertEvent().setDeleteEventIndex(t);\n }\n }, e.prototype.computeIntersections = function () {\n if (1 === arguments.length) {\n var t = arguments[0];\n this.nOverlaps = 0, this.prepareEvents();\n for (var e = 0; e < this.events.size(); e++) {\n var n = this.events.get(e);\n if (n.isInsert() && this.processOverlaps(e, n.getDeleteEventIndex(), n, t), t.isDone()) break;\n }\n } else if (3 === arguments.length) if (arguments[2] instanceof hf && Lu(arguments[0], wc) && Lu(arguments[1], wc)) {\n var r = arguments[0],\n i = arguments[1],\n o = arguments[2];\n this.addEdges(r, r), this.addEdges(i, i), this.computeIntersections(o);\n } else if (\"boolean\" == typeof arguments[2] && Lu(arguments[0], wc) && arguments[1] instanceof hf) {\n var s = arguments[0],\n a = arguments[1];\n arguments[2] ? this.addEdges(s, null) : this.addEdges(s), this.computeIntersections(a);\n }\n }, e.prototype.addEdge = function (t, e) {\n for (var n = t.getMonotoneChainEdge(), r = n.getStartIndexes(), i = 0; i < r.length - 1; i++) {\n var o = new sf(n, i),\n s = new af(e, n.getMinX(i), o);\n this.events.add(s), this.events.add(new af(n.getMaxX(i), s));\n }\n }, e.prototype.processOverlaps = function (t, e, n, r) {\n for (var i = n.getObject(), o = t; o < e; o++) {\n var s = this.events.get(o);\n if (s.isInsert()) {\n var a = s.getObject();\n n.isSameLabel(s) || (i.computeIntersections(a, r), this.nOverlaps++);\n }\n }\n }, e.prototype.addEdges = function () {\n if (1 === arguments.length) for (var t = arguments[0].iterator(); t.hasNext();) {\n var e = t.next();\n this.addEdge(e, e);\n } else if (2 === arguments.length) for (var n = arguments[0], r = arguments[1], i = n.iterator(); i.hasNext();) {\n var o = i.next();\n this.addEdge(o, r);\n }\n }, e.prototype.interfaces_ = function () {\n return [];\n }, e.prototype.getClass = function () {\n return e;\n }, e;\n }(cf),\n pf = function () {\n this._min = mu.POSITIVE_INFINITY, this._max = mu.NEGATIVE_INFINITY;\n },\n ff = {\n NodeComparator: {\n configurable: !0\n }\n };\n pf.prototype.getMin = function () {\n return this._min;\n }, pf.prototype.intersects = function (t, e) {\n return !(this._min > e || this._max < t);\n }, pf.prototype.getMax = function () {\n return this._max;\n }, pf.prototype.toString = function () {\n return Ku.toLineString(new bu(this._min, 0), new bu(this._max, 0));\n }, pf.prototype.interfaces_ = function () {\n return [];\n }, pf.prototype.getClass = function () {\n return pf;\n }, ff.NodeComparator.get = function () {\n return gf;\n }, Object.defineProperties(pf, ff);\n var gf = function () {};\n gf.prototype.compare = function (t, e) {\n var n = t,\n r = e,\n i = (n._min + n._max) / 2,\n o = (r._min + r._max) / 2;\n return i < o ? -1 : i > o ? 1 : 0;\n }, gf.prototype.interfaces_ = function () {\n return [wu];\n }, gf.prototype.getClass = function () {\n return gf;\n };\n var df = function (t) {\n function e() {\n t.call(this), this._item = null;\n var e = arguments[0],\n n = arguments[1],\n r = arguments[2];\n this._min = e, this._max = n, this._item = r;\n }\n return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.query = function (t, e, n) {\n if (!this.intersects(t, e)) return null;\n n.visitItem(this._item);\n }, e.prototype.interfaces_ = function () {\n return [];\n }, e.prototype.getClass = function () {\n return e;\n }, e;\n }(pf),\n yf = function (t) {\n function e() {\n t.call(this), this._node1 = null, this._node2 = null;\n var e = arguments[0],\n n = arguments[1];\n this._node1 = e, this._node2 = n, this.buildExtent(this._node1, this._node2);\n }\n return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.buildExtent = function (t, e) {\n this._min = Math.min(t._min, e._min), this._max = Math.max(t._max, e._max);\n }, e.prototype.query = function (t, e, n) {\n if (!this.intersects(t, e)) return null;\n null !== this._node1 && this._node1.query(t, e, n), null !== this._node2 && this._node2.query(t, e, n);\n }, e.prototype.interfaces_ = function () {\n return [];\n }, e.prototype.getClass = function () {\n return e;\n }, e;\n }(pf),\n _f = function () {\n this._leaves = new bc(), this._root = null, this._level = 0;\n };\n _f.prototype.buildTree = function () {\n $h.sort(this._leaves, new pf.NodeComparator());\n for (var t = this._leaves, e = null, n = new bc();;) {\n if (this.buildLevel(t, n), 1 === n.size()) return n.get(0);\n e = t, t = n, n = e;\n }\n }, _f.prototype.insert = function (t, e, n) {\n if (null !== this._root) throw new Error(\"Index cannot be added to once it has been queried\");\n this._leaves.add(new df(t, e, n));\n }, _f.prototype.query = function (t, e, n) {\n this.init(), this._root.query(t, e, n);\n }, _f.prototype.buildRoot = function () {\n if (null !== this._root) return null;\n this._root = this.buildTree();\n }, _f.prototype.printNode = function (t) {\n Xu.out.println(Ku.toLineString(new bu(t._min, this._level), new bu(t._max, this._level)));\n }, _f.prototype.init = function () {\n if (null !== this._root) return null;\n this.buildRoot();\n }, _f.prototype.buildLevel = function (t, e) {\n this._level++, e.clear();\n for (var n = 0; n < t.size(); n += 2) {\n var r = t.get(n);\n if (null === (n + 1 < t.size() ? t.get(n) : null)) e.add(r);else {\n var i = new yf(t.get(n), t.get(n + 1));\n e.add(i);\n }\n }\n }, _f.prototype.interfaces_ = function () {\n return [];\n }, _f.prototype.getClass = function () {\n return _f;\n };\n var mf = function () {\n this._items = new bc();\n };\n mf.prototype.visitItem = function (t) {\n this._items.add(t);\n }, mf.prototype.getItems = function () {\n return this._items;\n }, mf.prototype.interfaces_ = function () {\n return [Jh];\n }, mf.prototype.getClass = function () {\n return mf;\n };\n var vf = function () {\n this._index = null;\n var t = arguments[0];\n if (!Lu(t, Qc)) throw new _u(\"Argument must be Polygonal\");\n this._index = new wf(t);\n },\n xf = {\n SegmentVisitor: {\n configurable: !0\n },\n IntervalIndexedGeometry: {\n configurable: !0\n }\n };\n vf.prototype.locate = function (t) {\n var e = new oc(t),\n n = new Ef(e);\n return this._index.query(t.y, t.y, n), e.getLocation();\n }, vf.prototype.interfaces_ = function () {\n return [Bl];\n }, vf.prototype.getClass = function () {\n return vf;\n }, xf.SegmentVisitor.get = function () {\n return Ef;\n }, xf.IntervalIndexedGeometry.get = function () {\n return wf;\n }, Object.defineProperties(vf, xf);\n var Ef = function () {\n this._counter = null;\n var t = arguments[0];\n this._counter = t;\n };\n Ef.prototype.visitItem = function (t) {\n var e = t;\n this._counter.countSegment(e.getCoordinate(0), e.getCoordinate(1));\n }, Ef.prototype.interfaces_ = function () {\n return [Jh];\n }, Ef.prototype.getClass = function () {\n return Ef;\n };\n var wf = function () {\n this._index = new _f();\n var t = arguments[0];\n this.init(t);\n };\n wf.prototype.init = function (t) {\n for (var e = bp.getLines(t).iterator(); e.hasNext();) {\n var n = e.next().getCoordinates();\n this.addLine(n);\n }\n }, wf.prototype.addLine = function (t) {\n for (var e = 1; e < t.length; e++) {\n var n = new gl(t[e - 1], t[e]),\n r = Math.min(n.p0.y, n.p1.y),\n i = Math.max(n.p0.y, n.p1.y);\n this._index.insert(r, i, n);\n }\n }, wf.prototype.query = function () {\n if (2 === arguments.length) {\n var t = arguments[0],\n e = arguments[1],\n n = new mf();\n return this._index.query(t, e, n), n.getItems();\n }\n if (3 === arguments.length) {\n var r = arguments[0],\n i = arguments[1],\n o = arguments[2];\n this._index.query(r, i, o);\n }\n }, wf.prototype.interfaces_ = function () {\n return [];\n }, wf.prototype.getClass = function () {\n return wf;\n };\n var bf = function (t) {\n function e() {\n if (t.call(this), this._parentGeom = null, this._lineEdgeMap = new ph(), this._boundaryNodeRule = null, this._useBoundaryDeterminationRule = !0, this._argIndex = null, this._boundaryNodes = null, this._hasTooFewPoints = !1, this._invalidPoint = null, this._areaPtLocator = null, this._ptLocator = new Ip(), 2 === arguments.length) {\n var e = arguments[0],\n n = arguments[1],\n r = fc.OGC_SFS_BOUNDARY_RULE;\n this._argIndex = e, this._parentGeom = n, this._boundaryNodeRule = r, null !== n && this.add(n);\n } else if (3 === arguments.length) {\n var i = arguments[0],\n o = arguments[1],\n s = arguments[2];\n this._argIndex = i, this._parentGeom = o, this._boundaryNodeRule = s, null !== o && this.add(o);\n }\n }\n return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.insertBoundaryPoint = function (t, n) {\n var r = this._nodes.addNode(n).getLabel(),\n i = 1;\n Su.NONE;\n r.getLocation(t, Nh.ON) === Su.BOUNDARY && i++;\n var o = e.determineBoundary(this._boundaryNodeRule, i);\n r.setLocation(t, o);\n }, e.prototype.computeSelfNodes = function () {\n if (2 === arguments.length) {\n var t = arguments[0],\n e = arguments[1];\n return this.computeSelfNodes(t, e, !1);\n }\n if (3 === arguments.length) {\n var n = arguments[0],\n r = arguments[1],\n i = arguments[2],\n o = new hf(n, !0, !1);\n o.setIsDoneIfProperInt(i);\n var s = this.createEdgeSetIntersector(),\n a = this._parentGeom instanceof eh || this._parentGeom instanceof $c || this._parentGeom instanceof nh,\n u = r || !a;\n return s.computeIntersections(this._edges, o, u), this.addSelfIntersectionNodes(this._argIndex), o;\n }\n }, e.prototype.computeSplitEdges = function (t) {\n for (var e = this._edges.iterator(); e.hasNext();) {\n e.next().eiList.addSplitEdges(t);\n }\n }, e.prototype.computeEdgeIntersections = function (t, e, n) {\n var r = new hf(e, n, !0);\n r.setBoundaryNodes(this.getBoundaryNodes(), t.getBoundaryNodes());\n return this.createEdgeSetIntersector().computeIntersections(this._edges, t._edges, r), r;\n }, e.prototype.getGeometry = function () {\n return this._parentGeom;\n }, e.prototype.getBoundaryNodeRule = function () {\n return this._boundaryNodeRule;\n }, e.prototype.hasTooFewPoints = function () {\n return this._hasTooFewPoints;\n }, e.prototype.addPoint = function () {\n if (arguments[0] instanceof Kc) {\n var t = arguments[0].getCoordinate();\n this.insertPoint(this._argIndex, t, Su.INTERIOR);\n } else if (arguments[0] instanceof bu) {\n var e = arguments[0];\n this.insertPoint(this._argIndex, e, Su.INTERIOR);\n }\n }, e.prototype.addPolygon = function (t) {\n this.addPolygonRing(t.getExteriorRing(), Su.EXTERIOR, Su.INTERIOR);\n for (var e = 0; e < t.getNumInteriorRing(); e++) {\n var n = t.getInteriorRingN(e);\n this.addPolygonRing(n, Su.INTERIOR, Su.EXTERIOR);\n }\n }, e.prototype.addEdge = function (t) {\n this.insertEdge(t);\n var e = t.getCoordinates();\n this.insertPoint(this._argIndex, e[0], Su.BOUNDARY), this.insertPoint(this._argIndex, e[e.length - 1], Su.BOUNDARY);\n }, e.prototype.addLineString = function (t) {\n var e = Cc.removeRepeatedPoints(t.getCoordinates());\n if (e.length < 2) return this._hasTooFewPoints = !0, this._invalidPoint = e[0], null;\n var n = new ep(e, new Rh(this._argIndex, Su.INTERIOR));\n this._lineEdgeMap.put(t, n), this.insertEdge(n), tc.isTrue(e.length >= 2, \"found LineString with single point\"), this.insertBoundaryPoint(this._argIndex, e[0]), this.insertBoundaryPoint(this._argIndex, e[e.length - 1]);\n }, e.prototype.getInvalidPoint = function () {\n return this._invalidPoint;\n }, e.prototype.getBoundaryPoints = function () {\n for (var t = this.getBoundaryNodes(), e = new Array(t.size()).fill(null), n = 0, r = t.iterator(); r.hasNext();) {\n var i = r.next();\n e[n++] = i.getCoordinate().copy();\n }\n return e;\n }, e.prototype.getBoundaryNodes = function () {\n return null === this._boundaryNodes && (this._boundaryNodes = this._nodes.getBoundaryNodes(this._argIndex)), this._boundaryNodes;\n }, e.prototype.addSelfIntersectionNode = function (t, e, n) {\n if (this.isBoundaryNode(t, e)) return null;\n n === Su.BOUNDARY && this._useBoundaryDeterminationRule ? this.insertBoundaryPoint(t, e) : this.insertPoint(t, e, n);\n }, e.prototype.addPolygonRing = function (t, e, n) {\n if (t.isEmpty()) return null;\n var r = Cc.removeRepeatedPoints(t.getCoordinates());\n if (r.length < 4) return this._hasTooFewPoints = !0, this._invalidPoint = r[0], null;\n var i = e,\n o = n;\n sc.isCCW(r) && (i = n, o = e);\n var s = new ep(r, new Rh(this._argIndex, Su.BOUNDARY, i, o));\n this._lineEdgeMap.put(t, s), this.insertEdge(s), this.insertPoint(this._argIndex, r[0], Su.BOUNDARY);\n }, e.prototype.insertPoint = function (t, e, n) {\n var r = this._nodes.addNode(e),\n i = r.getLabel();\n null === i ? r._label = new Rh(t, n) : i.setLocation(t, n);\n }, e.prototype.createEdgeSetIntersector = function () {\n return new lf();\n }, e.prototype.addSelfIntersectionNodes = function (t) {\n for (var e = this._edges.iterator(); e.hasNext();) for (var n = e.next(), r = n.getLabel().getLocation(t), i = n.eiList.iterator(); i.hasNext();) {\n var o = i.next();\n this.addSelfIntersectionNode(t, o.coord, r);\n }\n }, e.prototype.add = function () {\n if (1 !== arguments.length) return t.prototype.add.apply(this, arguments);\n var e = arguments[0];\n if (e.isEmpty()) return null;\n if (e instanceof nh && (this._useBoundaryDeterminationRule = !1), e instanceof $c) this.addPolygon(e);else if (e instanceof Jc) this.addLineString(e);else if (e instanceof Kc) this.addPoint(e);else if (e instanceof th) this.addCollection(e);else if (e instanceof Xc) this.addCollection(e);else if (e instanceof nh) this.addCollection(e);else {\n if (!(e instanceof jc)) throw new Error(e.getClass().getName());\n this.addCollection(e);\n }\n }, e.prototype.addCollection = function (t) {\n for (var e = 0; e < t.getNumGeometries(); e++) {\n var n = t.getGeometryN(e);\n this.add(n);\n }\n }, e.prototype.locate = function (t) {\n return Lu(this._parentGeom, Qc) && this._parentGeom.getNumGeometries() > 50 ? (null === this._areaPtLocator && (this._areaPtLocator = new vf(this._parentGeom)), this._areaPtLocator.locate(t)) : this._ptLocator.locate(t, this._parentGeom);\n }, e.prototype.findEdge = function () {\n if (1 === arguments.length) {\n var e = arguments[0];\n return this._lineEdgeMap.get(e);\n }\n return t.prototype.findEdge.apply(this, arguments);\n }, e.prototype.interfaces_ = function () {\n return [];\n }, e.prototype.getClass = function () {\n return e;\n }, e.determineBoundary = function (t, e) {\n return t.isInBoundary(e) ? Su.BOUNDARY : Su.INTERIOR;\n }, e;\n }(Uh),\n If = function () {\n if (this._li = new rc(), this._resultPrecisionModel = null, this._arg = null, 1 === arguments.length) {\n var t = arguments[0];\n this.setComputationPrecision(t.getPrecisionModel()), this._arg = new Array(1).fill(null), this._arg[0] = new bf(0, t);\n } else if (2 === arguments.length) {\n var e = arguments[0],\n n = arguments[1],\n r = fc.OGC_SFS_BOUNDARY_RULE;\n e.getPrecisionModel().compareTo(n.getPrecisionModel()) >= 0 ? this.setComputationPrecision(e.getPrecisionModel()) : this.setComputationPrecision(n.getPrecisionModel()), this._arg = new Array(2).fill(null), this._arg[0] = new bf(0, e, r), this._arg[1] = new bf(1, n, r);\n } else if (3 === arguments.length) {\n var i = arguments[0],\n o = arguments[1],\n s = arguments[2];\n i.getPrecisionModel().compareTo(o.getPrecisionModel()) >= 0 ? this.setComputationPrecision(i.getPrecisionModel()) : this.setComputationPrecision(o.getPrecisionModel()), this._arg = new Array(2).fill(null), this._arg[0] = new bf(0, i, s), this._arg[1] = new bf(1, o, s);\n }\n };\n If.prototype.getArgGeometry = function (t) {\n return this._arg[t].getGeometry();\n }, If.prototype.setComputationPrecision = function (t) {\n this._resultPrecisionModel = t, this._li.setPrecisionModel(this._resultPrecisionModel);\n }, If.prototype.interfaces_ = function () {\n return [];\n }, If.prototype.getClass = function () {\n return If;\n };\n var Nf = function () {};\n Nf.prototype.interfaces_ = function () {\n return [];\n }, Nf.prototype.getClass = function () {\n return Nf;\n }, Nf.map = function () {\n if (arguments[0] instanceof cc && Lu(arguments[1], Nf.MapOp)) {\n for (var t = arguments[0], e = arguments[1], n = new bc(), r = 0; r < t.getNumGeometries(); r++) {\n var i = e.map(t.getGeometryN(r));\n null !== i && n.add(i);\n }\n return t.getFactory().buildGeometry(n);\n }\n if (Lu(arguments[0], vc) && Lu(arguments[1], Nf.MapOp)) {\n for (var o = arguments[0], s = arguments[1], a = new bc(), u = o.iterator(); u.hasNext();) {\n var c = u.next(),\n h = s.map(c);\n null !== h && a.add(h);\n }\n return a;\n }\n }, Nf.MapOp = function () {};\n var Cf = function (t) {\n function e() {\n var e = arguments[0],\n n = arguments[1];\n t.call(this, e, n), this._ptLocator = new Ip(), this._geomFact = null, this._resultGeom = null, this._graph = null, this._edgeList = new Vl(), this._resultPolyList = new bc(), this._resultLineList = new bc(), this._resultPointList = new bc(), this._graph = new Uh(new Ul()), this._geomFact = e.getFactory();\n }\n return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.insertUniqueEdge = function (t) {\n var e = this._edgeList.findEqualEdge(t);\n if (null !== e) {\n var n = e.getLabel(),\n r = t.getLabel();\n e.isPointwiseEqual(t) || (r = new Rh(t.getLabel())).flip();\n var i = e.getDepth();\n i.isNull() && i.add(n), i.add(r), n.merge(r);\n } else this._edgeList.add(t);\n }, e.prototype.getGraph = function () {\n return this._graph;\n }, e.prototype.cancelDuplicateResultEdges = function () {\n for (var t = this._graph.getEdgeEnds().iterator(); t.hasNext();) {\n var e = t.next(),\n n = e.getSym();\n e.isInResult() && n.isInResult() && (e.setInResult(!1), n.setInResult(!1));\n }\n }, e.prototype.isCoveredByLA = function (t) {\n return !!this.isCovered(t, this._resultLineList) || !!this.isCovered(t, this._resultPolyList);\n }, e.prototype.computeGeometry = function (t, n, r, i) {\n var o = new bc();\n return o.addAll(t), o.addAll(n), o.addAll(r), o.isEmpty() ? e.createEmptyResult(i, this._arg[0].getGeometry(), this._arg[1].getGeometry(), this._geomFact) : this._geomFact.buildGeometry(o);\n }, e.prototype.mergeSymLabels = function () {\n for (var t = this._graph.getNodes().iterator(); t.hasNext();) {\n t.next().getEdges().mergeSymLabels();\n }\n }, e.prototype.isCovered = function (t, e) {\n for (var n = e.iterator(); n.hasNext();) {\n var r = n.next();\n if (this._ptLocator.locate(t, r) !== Su.EXTERIOR) return !0;\n }\n return !1;\n }, e.prototype.replaceCollapsedEdges = function () {\n for (var t = new bc(), e = this._edgeList.iterator(); e.hasNext();) {\n var n = e.next();\n n.isCollapsed() && (e.remove(), t.add(n.getCollapsedEdge()));\n }\n this._edgeList.addAll(t);\n }, e.prototype.updateNodeLabelling = function () {\n for (var t = this._graph.getNodes().iterator(); t.hasNext();) {\n var e = t.next(),\n n = e.getEdges().getLabel();\n e.getLabel().merge(n);\n }\n }, e.prototype.getResultGeometry = function (t) {\n return this.computeOverlay(t), this._resultGeom;\n }, e.prototype.insertUniqueEdges = function (t) {\n for (var e = t.iterator(); e.hasNext();) {\n var n = e.next();\n this.insertUniqueEdge(n);\n }\n }, e.prototype.computeOverlay = function (t) {\n this.copyPoints(0), this.copyPoints(1), this._arg[0].computeSelfNodes(this._li, !1), this._arg[1].computeSelfNodes(this._li, !1), this._arg[0].computeEdgeIntersections(this._arg[1], this._li, !0);\n var e = new bc();\n this._arg[0].computeSplitEdges(e), this._arg[1].computeSplitEdges(e), this.insertUniqueEdges(e), this.computeLabelsFromDepths(), this.replaceCollapsedEdges(), Xp.checkValid(this._edgeList.getEdges()), this._graph.addEdges(this._edgeList.getEdges()), this.computeLabelling(), this.labelIncompleteNodes(), this.findResultAreaEdges(t), this.cancelDuplicateResultEdges();\n var n = new Yh(this._geomFact);\n n.add(this._graph), this._resultPolyList = n.getPolygons();\n var r = new Yp(this, this._geomFact, this._ptLocator);\n this._resultLineList = r.build(t);\n var i = new Vp(this, this._geomFact, this._ptLocator);\n this._resultPointList = i.build(t), this._resultGeom = this.computeGeometry(this._resultPointList, this._resultLineList, this._resultPolyList, t);\n }, e.prototype.labelIncompleteNode = function (t, e) {\n var n = this._ptLocator.locate(t.getCoordinate(), this._arg[e].getGeometry());\n t.getLabel().setLocation(e, n);\n }, e.prototype.copyPoints = function (t) {\n for (var e = this._arg[t].getNodeIterator(); e.hasNext();) {\n var n = e.next();\n this._graph.addNode(n.getCoordinate()).setLabel(t, n.getLabel().getLocation(t));\n }\n }, e.prototype.findResultAreaEdges = function (t) {\n for (var n = this._graph.getEdgeEnds().iterator(); n.hasNext();) {\n var r = n.next(),\n i = r.getLabel();\n i.isArea() && !r.isInteriorAreaEdge() && e.isResultOfOp(i.getLocation(0, Nh.RIGHT), i.getLocation(1, Nh.RIGHT), t) && r.setInResult(!0);\n }\n }, e.prototype.computeLabelsFromDepths = function () {\n for (var t = this._edgeList.iterator(); t.hasNext();) {\n var e = t.next(),\n n = e.getLabel(),\n r = e.getDepth();\n if (!r.isNull()) {\n r.normalize();\n for (var i = 0; i < 2; i++) n.isNull(i) || !n.isArea() || r.isNull(i) || (0 === r.getDelta(i) ? n.toLine(i) : (tc.isTrue(!r.isNull(i, Nh.LEFT), \"depth of LEFT side has not been initialized\"), n.setLocation(i, Nh.LEFT, r.getLocation(i, Nh.LEFT)), tc.isTrue(!r.isNull(i, Nh.RIGHT), \"depth of RIGHT side has not been initialized\"), n.setLocation(i, Nh.RIGHT, r.getLocation(i, Nh.RIGHT))));\n }\n }\n }, e.prototype.computeLabelling = function () {\n for (var t = this._graph.getNodes().iterator(); t.hasNext();) {\n t.next().getEdges().computeLabelling(this._arg);\n }\n this.mergeSymLabels(), this.updateNodeLabelling();\n }, e.prototype.labelIncompleteNodes = function () {\n for (var t = this._graph.getNodes().iterator(); t.hasNext();) {\n var e = t.next(),\n n = e.getLabel();\n e.isIsolated() && (n.isNull(0) ? this.labelIncompleteNode(e, 0) : this.labelIncompleteNode(e, 1)), e.getEdges().updateLabelling(n);\n }\n }, e.prototype.isCoveredByA = function (t) {\n return !!this.isCovered(t, this._resultPolyList);\n }, e.prototype.interfaces_ = function () {\n return [];\n }, e.prototype.getClass = function () {\n return e;\n }, e;\n }(If);\n Cf.overlayOp = function (t, e, n) {\n return new Cf(t, e).getResultGeometry(n);\n }, Cf.intersection = function (t, e) {\n if (t.isEmpty() || e.isEmpty()) return Cf.createEmptyResult(Cf.INTERSECTION, t, e, t.getFactory());\n if (t.isGeometryCollection()) {\n var n = e;\n return Up.map(t, {\n interfaces_: function () {\n return [Nf.MapOp];\n },\n map: function (t) {\n return t.intersection(n);\n }\n });\n }\n return t.checkNotGeometryCollection(t), t.checkNotGeometryCollection(e), of.overlayOp(t, e, Cf.INTERSECTION);\n }, Cf.symDifference = function (t, e) {\n if (t.isEmpty() || e.isEmpty()) {\n if (t.isEmpty() && e.isEmpty()) return Cf.createEmptyResult(Cf.SYMDIFFERENCE, t, e, t.getFactory());\n if (t.isEmpty()) return e.copy();\n if (e.isEmpty()) return t.copy();\n }\n return t.checkNotGeometryCollection(t), t.checkNotGeometryCollection(e), of.overlayOp(t, e, Cf.SYMDIFFERENCE);\n }, Cf.resultDimension = function (t, e, n) {\n var r = e.getDimension(),\n i = n.getDimension(),\n o = -1;\n switch (t) {\n case Cf.INTERSECTION:\n o = Math.min(r, i);\n break;\n case Cf.UNION:\n o = Math.max(r, i);\n break;\n case Cf.DIFFERENCE:\n o = r;\n break;\n case Cf.SYMDIFFERENCE:\n o = Math.max(r, i);\n }\n return o;\n }, Cf.createEmptyResult = function (t, e, n, r) {\n var i = null;\n switch (Cf.resultDimension(t, e, n)) {\n case -1:\n i = r.createGeometryCollection(new Array(0).fill(null));\n break;\n case 0:\n i = r.createPoint();\n break;\n case 1:\n i = r.createLineString();\n break;\n case 2:\n i = r.createPolygon();\n }\n return i;\n }, Cf.difference = function (t, e) {\n return t.isEmpty() ? Cf.createEmptyResult(Cf.DIFFERENCE, t, e, t.getFactory()) : e.isEmpty() ? t.copy() : (t.checkNotGeometryCollection(t), t.checkNotGeometryCollection(e), of.overlayOp(t, e, Cf.DIFFERENCE));\n }, Cf.isResultOfOp = function () {\n if (2 === arguments.length) {\n var t = arguments[0],\n e = arguments[1],\n n = t.getLocation(0),\n r = t.getLocation(1);\n return Cf.isResultOfOp(n, r, e);\n }\n if (3 === arguments.length) {\n var i = arguments[0],\n o = arguments[1],\n s = arguments[2];\n switch (i === Su.BOUNDARY && (i = Su.INTERIOR), o === Su.BOUNDARY && (o = Su.INTERIOR), s) {\n case Cf.INTERSECTION:\n return i === Su.INTERIOR && o === Su.INTERIOR;\n case Cf.UNION:\n return i === Su.INTERIOR || o === Su.INTERIOR;\n case Cf.DIFFERENCE:\n return i === Su.INTERIOR && o !== Su.INTERIOR;\n case Cf.SYMDIFFERENCE:\n return i === Su.INTERIOR && o !== Su.INTERIOR || i !== Su.INTERIOR && o === Su.INTERIOR;\n }\n return !1;\n }\n }, Cf.INTERSECTION = 1, Cf.UNION = 2, Cf.DIFFERENCE = 3, Cf.SYMDIFFERENCE = 4;\n var Sf = function () {\n this._g = null, this._boundaryDistanceTolerance = null, this._linework = null, this._ptLocator = new Ip(), this._seg = new gl();\n var t = arguments[0],\n e = arguments[1];\n this._g = t, this._boundaryDistanceTolerance = e, this._linework = this.extractLinework(t);\n };\n Sf.prototype.isWithinToleranceOfBoundary = function (t) {\n for (var e = 0; e < this._linework.getNumGeometries(); e++) for (var n = this._linework.getGeometryN(e).getCoordinateSequence(), r = 0; r < n.size() - 1; r++) {\n n.getCoordinate(r, this._seg.p0), n.getCoordinate(r + 1, this._seg.p1);\n if (this._seg.distance(t) <= this._boundaryDistanceTolerance) return !0;\n }\n return !1;\n }, Sf.prototype.getLocation = function (t) {\n return this.isWithinToleranceOfBoundary(t) ? Su.BOUNDARY : this._ptLocator.locate(t, this._g);\n }, Sf.prototype.extractLinework = function (t) {\n var e = new Mf();\n t.apply(e);\n var n = e.getLinework(),\n r = _h.toLineStringArray(n);\n return t.getFactory().createMultiLineString(r);\n }, Sf.prototype.interfaces_ = function () {\n return [];\n }, Sf.prototype.getClass = function () {\n return Sf;\n };\n var Mf = function () {\n this._linework = null, this._linework = new bc();\n };\n Mf.prototype.getLinework = function () {\n return this._linework;\n }, Mf.prototype.filter = function (t) {\n if (t instanceof $c) {\n var e = t;\n this._linework.add(e.getExteriorRing());\n for (var n = 0; n < e.getNumInteriorRing(); n++) this._linework.add(e.getInteriorRingN(n));\n }\n }, Mf.prototype.interfaces_ = function () {\n return [kc];\n }, Mf.prototype.getClass = function () {\n return Mf;\n };\n var Lf = function () {\n this._g = null, this._doLeft = !0, this._doRight = !0;\n var t = arguments[0];\n this._g = t;\n };\n Lf.prototype.extractPoints = function (t, e, n) {\n for (var r = t.getCoordinates(), i = 0; i < r.length - 1; i++) this.computeOffsetPoints(r[i], r[i + 1], e, n);\n }, Lf.prototype.setSidesToGenerate = function (t, e) {\n this._doLeft = t, this._doRight = e;\n }, Lf.prototype.getPoints = function (t) {\n for (var e = new bc(), n = bp.getLines(this._g).iterator(); n.hasNext();) {\n var r = n.next();\n this.extractPoints(r, t, e);\n }\n return e;\n }, Lf.prototype.computeOffsetPoints = function (t, e, n, r) {\n var i = e.x - t.x,\n o = e.y - t.y,\n s = Math.sqrt(i * i + o * o),\n a = n * i / s,\n u = n * o / s,\n c = (e.x + t.x) / 2,\n h = (e.y + t.y) / 2;\n if (this._doLeft) {\n var l = new bu(c - u, h + a);\n r.add(l);\n }\n if (this._doRight) {\n var p = new bu(c + u, h - a);\n r.add(p);\n }\n }, Lf.prototype.interfaces_ = function () {\n return [];\n }, Lf.prototype.getClass = function () {\n return Lf;\n };\n var Pf = function t() {\n this._geom = null, this._locFinder = null, this._location = new Array(3).fill(null), this._invalidLocation = null, this._boundaryDistanceTolerance = t.TOLERANCE, this._testCoords = new bc();\n var e = arguments[0],\n n = arguments[1],\n r = arguments[2];\n this._boundaryDistanceTolerance = t.computeBoundaryDistanceTolerance(e, n), this._geom = [e, n, r], this._locFinder = [new Sf(this._geom[0], this._boundaryDistanceTolerance), new Sf(this._geom[1], this._boundaryDistanceTolerance), new Sf(this._geom[2], this._boundaryDistanceTolerance)];\n },\n Of = {\n TOLERANCE: {\n configurable: !0\n }\n };\n Pf.prototype.reportResult = function (t, e, n) {\n Xu.out.println(\"Overlay result invalid - A:\" + Su.toLocationSymbol(e[0]) + \" B:\" + Su.toLocationSymbol(e[1]) + \" expected:\" + (n ? \"i\" : \"e\") + \" actual:\" + Su.toLocationSymbol(e[2]));\n }, Pf.prototype.isValid = function (t) {\n this.addTestPts(this._geom[0]), this.addTestPts(this._geom[1]);\n var e = this.checkValid(t);\n return e;\n }, Pf.prototype.checkValid = function () {\n if (1 === arguments.length) {\n for (var t = arguments[0], e = 0; e < this._testCoords.size(); e++) {\n var n = this._testCoords.get(e);\n if (!this.checkValid(t, n)) return this._invalidLocation = n, !1;\n }\n return !0;\n }\n if (2 === arguments.length) {\n var r = arguments[0],\n i = arguments[1];\n return this._location[0] = this._locFinder[0].getLocation(i), this._location[1] = this._locFinder[1].getLocation(i), this._location[2] = this._locFinder[2].getLocation(i), !!Pf.hasLocation(this._location, Su.BOUNDARY) || this.isValidResult(r, this._location);\n }\n }, Pf.prototype.addTestPts = function (t) {\n var e = new Lf(t);\n this._testCoords.addAll(e.getPoints(5 * this._boundaryDistanceTolerance));\n }, Pf.prototype.isValidResult = function (t, e) {\n var n = Cf.isResultOfOp(e[0], e[1], t),\n r = !(n ^ e[2] === Su.INTERIOR);\n return r || this.reportResult(t, e, n), r;\n }, Pf.prototype.getInvalidLocation = function () {\n return this._invalidLocation;\n }, Pf.prototype.interfaces_ = function () {\n return [];\n }, Pf.prototype.getClass = function () {\n return Pf;\n }, Pf.hasLocation = function (t, e) {\n for (var n = 0; n < 3; n++) if (t[n] === e) return !0;\n return !1;\n }, Pf.computeBoundaryDistanceTolerance = function (t, e) {\n return Math.min(Jp.computeSizeBasedSnapTolerance(t), Jp.computeSizeBasedSnapTolerance(e));\n }, Pf.isValid = function (t, e, n, r) {\n return new Pf(t, e, r).isValid(n);\n }, Of.TOLERANCE.get = function () {\n return 1e-6;\n }, Object.defineProperties(Pf, Of);\n var Rf = function t(e) {\n this._geomFactory = null, this._skipEmpty = !1, this._inputGeoms = null, this._geomFactory = t.extractFactory(e), this._inputGeoms = e;\n };\n Rf.prototype.extractElements = function (t, e) {\n if (null === t) return null;\n for (var n = 0; n < t.getNumGeometries(); n++) {\n var r = t.getGeometryN(n);\n this._skipEmpty && r.isEmpty() || e.add(r);\n }\n }, Rf.prototype.combine = function () {\n for (var t = new bc(), e = this._inputGeoms.iterator(); e.hasNext();) {\n var n = e.next();\n this.extractElements(n, t);\n }\n return 0 === t.size() ? null !== this._geomFactory ? this._geomFactory.createGeometryCollection(null) : null : this._geomFactory.buildGeometry(t);\n }, Rf.prototype.interfaces_ = function () {\n return [];\n }, Rf.prototype.getClass = function () {\n return Rf;\n }, Rf.combine = function () {\n if (1 === arguments.length) {\n var t = arguments[0];\n return new Rf(t).combine();\n }\n if (2 === arguments.length) {\n var e = arguments[0],\n n = arguments[1];\n return new Rf(Rf.createList(e, n)).combine();\n }\n if (3 === arguments.length) {\n var r = arguments[0],\n i = arguments[1],\n o = arguments[2];\n return new Rf(Rf.createList(r, i, o)).combine();\n }\n }, Rf.extractFactory = function (t) {\n return t.isEmpty() ? null : t.iterator().next().getFactory();\n }, Rf.createList = function () {\n if (2 === arguments.length) {\n var t = arguments[0],\n e = arguments[1],\n n = new bc();\n return n.add(t), n.add(e), n;\n }\n if (3 === arguments.length) {\n var r = arguments[0],\n i = arguments[1],\n o = arguments[2],\n s = new bc();\n return s.add(r), s.add(i), s.add(o), s;\n }\n };\n var Tf = function () {\n this._inputPolys = null, this._geomFactory = null;\n var t = arguments[0];\n this._inputPolys = t, null === this._inputPolys && (this._inputPolys = new bc());\n },\n Af = {\n STRTREE_NODE_CAPACITY: {\n configurable: !0\n }\n };\n Tf.prototype.reduceToGeometries = function (t) {\n for (var e = new bc(), n = t.iterator(); n.hasNext();) {\n var r = n.next(),\n i = null;\n Lu(r, wc) ? i = this.unionTree(r) : r instanceof cc && (i = r), e.add(i);\n }\n return e;\n }, Tf.prototype.extractByEnvelope = function (t, e, n) {\n for (var r = new bc(), i = 0; i < e.getNumGeometries(); i++) {\n var o = e.getGeometryN(i);\n o.getEnvelopeInternal().intersects(t) ? r.add(o) : n.add(o);\n }\n return this._geomFactory.buildGeometry(r);\n }, Tf.prototype.unionOptimized = function (t, e) {\n var n = t.getEnvelopeInternal(),\n r = e.getEnvelopeInternal();\n if (!n.intersects(r)) {\n return Rf.combine(t, e);\n }\n if (t.getNumGeometries() <= 1 && e.getNumGeometries() <= 1) return this.unionActual(t, e);\n var i = n.intersection(r);\n return this.unionUsingEnvelopeIntersection(t, e, i);\n }, Tf.prototype.union = function () {\n if (null === this._inputPolys) throw new Error(\"union() method cannot be called twice\");\n if (this._inputPolys.isEmpty()) return null;\n this._geomFactory = this._inputPolys.iterator().next().getFactory();\n for (var t = new ol(Tf.STRTREE_NODE_CAPACITY), e = this._inputPolys.iterator(); e.hasNext();) {\n var n = e.next();\n t.insert(n.getEnvelopeInternal(), n);\n }\n this._inputPolys = null;\n var r = t.itemsTree();\n return this.unionTree(r);\n }, Tf.prototype.binaryUnion = function () {\n if (1 === arguments.length) {\n var t = arguments[0];\n return this.binaryUnion(t, 0, t.size());\n }\n if (3 === arguments.length) {\n var e = arguments[0],\n n = arguments[1],\n r = arguments[2];\n if (r - n <= 1) {\n var i = Tf.getGeometry(e, n);\n return this.unionSafe(i, null);\n }\n if (r - n == 2) return this.unionSafe(Tf.getGeometry(e, n), Tf.getGeometry(e, n + 1));\n var o = Math.trunc((r + n) / 2),\n s = this.binaryUnion(e, n, o),\n a = this.binaryUnion(e, o, r);\n return this.unionSafe(s, a);\n }\n }, Tf.prototype.repeatedUnion = function (t) {\n for (var e = null, n = t.iterator(); n.hasNext();) {\n var r = n.next();\n e = null === e ? r.copy() : e.union(r);\n }\n return e;\n }, Tf.prototype.unionSafe = function (t, e) {\n return null === t && null === e ? null : null === t ? e.copy() : null === e ? t.copy() : this.unionOptimized(t, e);\n }, Tf.prototype.unionActual = function (t, e) {\n return Tf.restrictToPolygons(t.union(e));\n }, Tf.prototype.unionTree = function (t) {\n var e = this.reduceToGeometries(t);\n return this.binaryUnion(e);\n }, Tf.prototype.unionUsingEnvelopeIntersection = function (t, e, n) {\n var r = new bc(),\n i = this.extractByEnvelope(n, t, r),\n o = this.extractByEnvelope(n, e, r),\n s = this.unionActual(i, o);\n r.add(s);\n return Rf.combine(r);\n }, Tf.prototype.bufferUnion = function () {\n if (1 === arguments.length) {\n var t = arguments[0];\n return t.get(0).getFactory().buildGeometry(t).buffer(0);\n }\n if (2 === arguments.length) {\n var e = arguments[0],\n n = arguments[1];\n return e.getFactory().createGeometryCollection([e, n]).buffer(0);\n }\n }, Tf.prototype.interfaces_ = function () {\n return [];\n }, Tf.prototype.getClass = function () {\n return Tf;\n }, Tf.restrictToPolygons = function (t) {\n if (Lu(t, Qc)) return t;\n var e = wp.getPolygons(t);\n return 1 === e.size() ? e.get(0) : t.getFactory().createMultiPolygon(_h.toPolygonArray(e));\n }, Tf.getGeometry = function (t, e) {\n return e >= t.size() ? null : t.get(e);\n }, Tf.union = function (t) {\n return new Tf(t).union();\n }, Af.STRTREE_NODE_CAPACITY.get = function () {\n return 4;\n }, Object.defineProperties(Tf, Af);\n var Df = function () {};\n Df.prototype.interfaces_ = function () {\n return [];\n }, Df.prototype.getClass = function () {\n return Df;\n }, Df.union = function (t, e) {\n if (t.isEmpty() || e.isEmpty()) {\n if (t.isEmpty() && e.isEmpty()) return Cf.createEmptyResult(Cf.UNION, t, e, t.getFactory());\n if (t.isEmpty()) return e.copy();\n if (e.isEmpty()) return t.copy();\n }\n return t.checkNotGeometryCollection(t), t.checkNotGeometryCollection(e), of.overlayOp(t, e, Cf.UNION);\n };\n var Ff = function () {\n return new Yi();\n };\n Yi.prototype = {\n constructor: Yi,\n reset: function () {\n this.s = this.t = 0;\n },\n add: function (t) {\n Vi(qf, t, this.t), Vi(this, qf.s, this.s), this.s ? this.t += qf.t : this.s = qf.t;\n },\n valueOf: function () {\n return this.s;\n }\n };\n var qf = new Yi(),\n Gf = 1e-6,\n Bf = Math.PI,\n kf = Bf / 2,\n zf = Bf / 4,\n jf = 2 * Bf,\n Xf = 180 / Bf,\n Uf = Bf / 180,\n Yf = Math.abs,\n Vf = Math.atan,\n Hf = Math.atan2,\n Wf = Math.cos,\n Jf = Math.exp,\n Zf = Math.log,\n Kf = Math.sin,\n Qf = Math.sqrt,\n $f = Math.tan,\n tg = {\n Feature: function (t, e) {\n Ji(t.geometry, e);\n },\n FeatureCollection: function (t, e) {\n for (var n = t.features, r = -1, i = n.length; ++r < i;) Ji(n[r].geometry, e);\n }\n },\n eg = {\n Sphere: function (t, e) {\n e.sphere();\n },\n Point: function (t, e) {\n t = t.coordinates, e.point(t[0], t[1], t[2]);\n },\n MultiPoint: function (t, e) {\n for (var n = t.coordinates, r = -1, i = n.length; ++r < i;) t = n[r], e.point(t[0], t[1], t[2]);\n },\n LineString: function (t, e) {\n Zi(t.coordinates, e, 0);\n },\n MultiLineString: function (t, e) {\n for (var n = t.coordinates, r = -1, i = n.length; ++r < i;) Zi(n[r], e, 0);\n },\n Polygon: function (t, e) {\n Ki(t.coordinates, e);\n },\n MultiPolygon: function (t, e) {\n for (var n = t.coordinates, r = -1, i = n.length; ++r < i;) Ki(n[r], e);\n },\n GeometryCollection: function (t, e) {\n for (var n = t.geometries, r = -1, i = n.length; ++r < i;) Ji(n[r], e);\n }\n },\n ng = function (t, e) {\n t && tg.hasOwnProperty(t.type) ? tg[t.type](t, e) : Ji(t, e);\n },\n rg = (Ff(), Ff(), Ff(), function (t, e) {\n function n(n, r) {\n return n = t(n, r), e(n[0], n[1]);\n }\n return t.invert && e.invert && (n.invert = function (n, r) {\n return (n = e.invert(n, r)) && t.invert(n[0], n[1]);\n }), n;\n });\n oo.invert = oo;\n var ig = function (t) {\n function e(e) {\n return e = t(e[0] * Uf, e[1] * Uf), e[0] *= Xf, e[1] *= Xf, e;\n }\n return t = so(t[0] * Uf, t[1] * Uf, t.length > 2 ? t[2] * Uf : 0), e.invert = function (e) {\n return e = t.invert(e[0] * Uf, e[1] * Uf), e[0] *= Xf, e[1] *= Xf, e;\n }, e;\n },\n og = function () {\n var t,\n e = [];\n return {\n point: function (e, n) {\n t.push([e, n]);\n },\n lineStart: function () {\n e.push(t = []);\n },\n lineEnd: Wi,\n rejoin: function () {\n e.length > 1 && e.push(e.pop().concat(e.shift()));\n },\n result: function () {\n var n = e;\n return e = [], t = null, n;\n }\n };\n },\n sg = function (t, e, n, r, i, o) {\n var s,\n a = t[0],\n u = t[1],\n c = 0,\n h = 1,\n l = e[0] - a,\n p = e[1] - u;\n if (s = n - a, l || !(s > 0)) {\n if (s /= l, l < 0) {\n if (s < c) return;\n s < h && (h = s);\n } else if (l > 0) {\n if (s > h) return;\n s > c && (c = s);\n }\n if (s = i - a, l || !(s < 0)) {\n if (s /= l, l < 0) {\n if (s > h) return;\n s > c && (c = s);\n } else if (l > 0) {\n if (s < c) return;\n s < h && (h = s);\n }\n if (s = r - u, p || !(s > 0)) {\n if (s /= p, p < 0) {\n if (s < c) return;\n s < h && (h = s);\n } else if (p > 0) {\n if (s > h) return;\n s > c && (c = s);\n }\n if (s = o - u, p || !(s < 0)) {\n if (s /= p, p < 0) {\n if (s > h) return;\n s > c && (c = s);\n } else if (p > 0) {\n if (s < c) return;\n s < h && (h = s);\n }\n return c > 0 && (t[0] = a + c * l, t[1] = u + c * p), h < 1 && (e[0] = a + h * l, e[1] = u + h * p), !0;\n }\n }\n }\n }\n },\n ag = function (t, e) {\n return Yf(t[0] - e[0]) < Gf && Yf(t[1] - e[1]) < Gf;\n },\n ug = function (t, e, n, r, i) {\n var o,\n s,\n a = [],\n u = [];\n if (t.forEach(function (t) {\n if (!((e = t.length - 1) <= 0)) {\n var e,\n n,\n r = t[0],\n s = t[e];\n if (ag(r, s)) {\n for (i.lineStart(), o = 0; o < e; ++o) i.point((r = t[o])[0], r[1]);\n i.lineEnd();\n } else a.push(n = new lo(r, t, null, !0)), u.push(n.o = new lo(r, null, n, !1)), a.push(n = new lo(s, t, null, !1)), u.push(n.o = new lo(s, null, n, !0));\n }\n }), a.length) {\n for (u.sort(e), po(a), po(u), o = 0, s = u.length; o < s; ++o) u[o].e = n = !n;\n for (var c, h, l = a[0];;) {\n for (var p = l, f = !0; p.v;) if ((p = p.n) === l) return;\n c = p.z, i.lineStart();\n do {\n if (p.v = p.o.v = !0, p.e) {\n if (f) for (o = 0, s = c.length; o < s; ++o) i.point((h = c[o])[0], h[1]);else r(p.x, p.n.x, 1, i);\n p = p.n;\n } else {\n if (f) for (c = p.p.z, o = c.length - 1; o >= 0; --o) i.point((h = c[o])[0], h[1]);else r(p.x, p.p.x, -1, i);\n p = p.p;\n }\n c = (p = p.o).z, f = !f;\n } while (!p.v);\n i.lineEnd();\n }\n }\n },\n cg = function (t, e) {\n return t < e ? -1 : t > e ? 1 : t >= e ? 0 : NaN;\n },\n hg = (function (t) {\n 1 === t.length && (t = function (t) {\n return function (e, n) {\n return cg(t(e), n);\n };\n }(t));\n }(cg), function (t) {\n for (var e, n, r, i = t.length, o = -1, s = 0; ++o < i;) s += t[o].length;\n for (n = new Array(s); --i >= 0;) for (e = (r = t[i]).length; --e >= 0;) n[--s] = r[e];\n return n;\n }),\n lg = 1e9,\n pg = -lg,\n fg = Ff(),\n gg = (Ff(), function (t) {\n return t;\n }),\n dg = (Ff(), Ff(), 1 / 0),\n yg = dg,\n _g = -dg,\n mg = _g,\n vg = {\n point: function (t, e) {\n t < dg && (dg = t), t > _g && (_g = t), e < yg && (yg = e), e > mg && (mg = e);\n },\n lineStart: Wi,\n lineEnd: Wi,\n polygonStart: Wi,\n polygonEnd: Wi,\n result: function () {\n var t = [[dg, yg], [_g, mg]];\n return _g = mg = -(yg = dg = 1 / 0), t;\n }\n },\n xg = (Ff(), function (t, e, n, r) {\n return function (i, o) {\n function s(e, n) {\n var r = i(e, n);\n t(e = r[0], n = r[1]) && o.point(e, n);\n }\n function a(t, e) {\n var n = i(t, e);\n y.point(n[0], n[1]);\n }\n function u() {\n E.point = a, y.lineStart();\n }\n function c() {\n E.point = s, y.lineEnd();\n }\n function h(t, e) {\n d.push([t, e]);\n var n = i(t, e);\n v.point(n[0], n[1]);\n }\n function l() {\n v.lineStart(), d = [];\n }\n function p() {\n h(d[0][0], d[0][1]), v.lineEnd();\n var t,\n e,\n n,\n r,\n i = v.clean(),\n s = m.result(),\n a = s.length;\n if (d.pop(), f.push(d), d = null, a) if (1 & i) {\n if (n = s[0], (e = n.length - 1) > 0) {\n for (x || (o.polygonStart(), x = !0), o.lineStart(), t = 0; t < e; ++t) o.point((r = n[t])[0], r[1]);\n o.lineEnd();\n }\n } else a > 1 && 2 & i && s.push(s.pop().concat(s.shift())), g.push(s.filter(go));\n }\n var f,\n g,\n d,\n y = e(o),\n _ = i.invert(r[0], r[1]),\n m = og(),\n v = e(m),\n x = !1,\n E = {\n point: s,\n lineStart: u,\n lineEnd: c,\n polygonStart: function () {\n E.point = h, E.lineStart = l, E.lineEnd = p, g = [], f = [];\n },\n polygonEnd: function () {\n E.point = s, E.lineStart = u, E.lineEnd = c, g = hg(g);\n var t = function (t, e) {\n var n = e[0],\n r = e[1],\n i = [Kf(n), -Wf(n), 0],\n o = 0,\n s = 0;\n fg.reset();\n for (var a = 0, u = t.length; a < u; ++a) if (h = (c = t[a]).length) for (var c, h, l = c[h - 1], p = l[0], f = l[1] / 2 + zf, g = Kf(f), d = Wf(f), y = 0; y < h; ++y, p = m, g = x, d = E, l = _) {\n var _ = c[y],\n m = _[0],\n v = _[1] / 2 + zf,\n x = Kf(v),\n E = Wf(v),\n w = m - p,\n b = w >= 0 ? 1 : -1,\n I = b * w,\n N = I > Bf,\n C = g * x;\n if (fg.add(Hf(C * b * Kf(I), d * E + C * Wf(I))), o += N ? w + b * jf : w, N ^ p >= n ^ m >= n) {\n var S = eo($i(l), $i(_));\n io(S);\n var M = eo(i, S);\n io(M);\n var L = (N ^ w >= 0 ? -1 : 1) * Hi(M[2]);\n (r > L || r === L && (S[0] || S[1])) && (s += N ^ w >= 0 ? 1 : -1);\n }\n }\n return (o < -Gf || o < Gf && fg < -Gf) ^ 1 & s;\n }(f, _);\n g.length ? (x || (o.polygonStart(), x = !0), ug(g, yo, t, n, o)) : t && (x || (o.polygonStart(), x = !0), o.lineStart(), n(null, null, 1, o), o.lineEnd()), x && (o.polygonEnd(), x = !1), g = f = null;\n },\n sphere: function () {\n o.polygonStart(), o.lineStart(), n(null, null, 1, o), o.lineEnd(), o.polygonEnd();\n }\n };\n return E;\n };\n }),\n Eg = xg(function () {\n return !0;\n }, function (t) {\n var e,\n n = NaN,\n r = NaN,\n i = NaN;\n return {\n lineStart: function () {\n t.lineStart(), e = 1;\n },\n point: function (o, s) {\n var a = o > 0 ? Bf : -Bf,\n u = Yf(o - n);\n Yf(u - Bf) < Gf ? (t.point(n, r = (r + s) / 2 > 0 ? kf : -kf), t.point(i, r), t.lineEnd(), t.lineStart(), t.point(a, r), t.point(o, r), e = 0) : i !== a && u >= Bf && (Yf(n - i) < Gf && (n -= i * Gf), Yf(o - a) < Gf && (o -= a * Gf), r = function (t, e, n, r) {\n var i,\n o,\n s = Kf(t - n);\n return Yf(s) > Gf ? Vf((Kf(e) * (o = Wf(r)) * Kf(n) - Kf(r) * (i = Wf(e)) * Kf(t)) / (i * o * s)) : (e + r) / 2;\n }(n, r, o, s), t.point(i, r), t.lineEnd(), t.lineStart(), t.point(a, r), e = 0), t.point(n = o, r = s), i = a;\n },\n lineEnd: function () {\n t.lineEnd(), n = r = NaN;\n },\n clean: function () {\n return 2 - e;\n }\n };\n }, function (t, e, n, r) {\n var i;\n if (null == t) i = n * kf, r.point(-Bf, i), r.point(0, i), r.point(Bf, i), r.point(Bf, 0), r.point(Bf, -i), r.point(0, -i), r.point(-Bf, -i), r.point(-Bf, 0), r.point(-Bf, i);else if (Yf(t[0] - e[0]) > Gf) {\n var o = t[0] < e[0] ? Bf : -Bf;\n i = n * o / 2, r.point(-o, i), r.point(0, i), r.point(o, i);\n } else r.point(e[0], e[1]);\n }, [-Bf, -kf]),\n wg = function (t, e) {\n function n(t, e) {\n return Wf(t) * Wf(e) > o;\n }\n function r(t, e, n) {\n var r = [1, 0, 0],\n i = eo($i(t), $i(e)),\n s = to(i, i),\n a = i[0],\n u = s - a * a;\n if (!u) return !n && t;\n var c = o * s / u,\n h = -o * a / u,\n l = eo(r, i),\n p = ro(r, c);\n no(p, ro(i, h));\n var f = l,\n g = to(p, f),\n d = to(f, f),\n y = g * g - d * (to(p, p) - 1);\n if (!(y < 0)) {\n var _ = Qf(y),\n m = ro(f, (-g - _) / d);\n if (no(m, p), m = Qi(m), !n) return m;\n var v,\n x = t[0],\n E = e[0],\n w = t[1],\n b = e[1];\n E < x && (v = x, x = E, E = v);\n var I = E - x,\n N = Yf(I - Bf) < Gf;\n if (!N && b < w && (v = w, w = b, b = v), N || I < Gf ? N ? w + b > 0 ^ m[1] < (Yf(m[0] - x) < Gf ? w : b) : w <= m[1] && m[1] <= b : I > Bf ^ (x <= m[0] && m[0] <= E)) {\n var C = ro(f, (-g + _) / d);\n return no(C, p), [m, Qi(C)];\n }\n }\n }\n function i(e, n) {\n var r = s ? t : Bf - t,\n i = 0;\n return e < -r ? i |= 1 : e > r && (i |= 2), n < -r ? i |= 4 : n > r && (i |= 8), i;\n }\n var o = Wf(t),\n s = o > 0,\n a = Yf(o) > Gf;\n return xg(n, function (t) {\n var e, o, u, c, h;\n return {\n lineStart: function () {\n c = u = !1, h = 1;\n },\n point: function (l, p) {\n var f,\n g = [l, p],\n d = n(l, p),\n y = s ? d ? 0 : i(l, p) : d ? i(l + (l < 0 ? Bf : -Bf), p) : 0;\n if (!e && (c = u = d) && t.lineStart(), d !== u && (!(f = r(e, g)) || ag(e, f) || ag(g, f)) && (g[0] += Gf, g[1] += Gf, d = n(g[0], g[1])), d !== u) h = 0, d ? (t.lineStart(), f = r(g, e), t.point(f[0], f[1])) : (f = r(e, g), t.point(f[0], f[1]), t.lineEnd()), e = f;else if (a && e && s ^ d) {\n var _;\n y & o || !(_ = r(g, e, !0)) || (h = 0, s ? (t.lineStart(), t.point(_[0][0], _[0][1]), t.point(_[1][0], _[1][1]), t.lineEnd()) : (t.point(_[1][0], _[1][1]), t.lineEnd(), t.lineStart(), t.point(_[0][0], _[0][1])));\n }\n !d || e && ag(e, g) || t.point(g[0], g[1]), e = g, u = d, o = y;\n },\n lineEnd: function () {\n u && t.lineEnd(), e = null;\n },\n clean: function () {\n return h | (c && u) << 1;\n }\n };\n }, function (n, r, i, o) {\n !function (t, e, n, r, i, o) {\n if (n) {\n var s = Wf(e),\n a = Kf(e),\n u = r * n;\n null == i ? (i = e + r * jf, o = e - u / 2) : (i = ho(s, i), o = ho(s, o), (r > 0 ? i < o : i > o) && (i += r * jf));\n for (var c, h = i; r > 0 ? h > o : h < o; h -= u) c = Qi([s, -a * Wf(h), -a * Kf(h)]), t.point(c[0], c[1]);\n }\n }(o, t, e, i, n, r);\n }, s ? [0, -t] : [-Bf, t - Bf]);\n };\n mo.prototype = {\n constructor: mo,\n point: function (t, e) {\n this.stream.point(t, e);\n },\n sphere: function () {\n this.stream.sphere();\n },\n lineStart: function () {\n this.stream.lineStart();\n },\n lineEnd: function () {\n this.stream.lineEnd();\n },\n polygonStart: function () {\n this.stream.polygonStart();\n },\n polygonEnd: function () {\n this.stream.polygonEnd();\n }\n };\n var bg = 16,\n Ig = Wf(30 * Uf),\n Ng = function (t, e) {\n return +e ? function (t, e) {\n function n(r, i, o, s, a, u, c, h, l, p, f, g, d, y) {\n var _ = c - r,\n m = h - i,\n v = _ * _ + m * m;\n if (v > 4 * e && d--) {\n var x = s + p,\n E = a + f,\n w = u + g,\n b = Qf(x * x + E * E + w * w),\n I = Hi(w /= b),\n N = Yf(Yf(w) - 1) < Gf || Yf(o - l) < Gf ? (o + l) / 2 : Hf(E, x),\n C = t(N, I),\n S = C[0],\n M = C[1],\n L = S - r,\n P = M - i,\n O = m * L - _ * P;\n (O * O / v > e || Yf((_ * L + m * P) / v - .5) > .3 || s * p + a * f + u * g < Ig) && (n(r, i, o, s, a, u, S, M, N, x /= b, E /= b, w, d, y), y.point(S, M), n(S, M, N, x, E, w, c, h, l, p, f, g, d, y));\n }\n }\n return function (e) {\n function r(n, r) {\n n = t(n, r), e.point(n[0], n[1]);\n }\n function i() {\n _ = NaN, w.point = o, e.lineStart();\n }\n function o(r, i) {\n var o = $i([r, i]),\n s = t(r, i);\n n(_, m, y, v, x, E, _ = s[0], m = s[1], y = r, v = o[0], x = o[1], E = o[2], bg, e), e.point(_, m);\n }\n function s() {\n w.point = r, e.lineEnd();\n }\n function a() {\n i(), w.point = u, w.lineEnd = c;\n }\n function u(t, e) {\n o(h = t, e), l = _, p = m, f = v, g = x, d = E, w.point = o;\n }\n function c() {\n n(_, m, y, v, x, E, l, p, h, f, g, d, bg, e), w.lineEnd = s, s();\n }\n var h,\n l,\n p,\n f,\n g,\n d,\n y,\n _,\n m,\n v,\n x,\n E,\n w = {\n point: r,\n lineStart: i,\n lineEnd: s,\n polygonStart: function () {\n e.polygonStart(), w.lineStart = a;\n },\n polygonEnd: function () {\n e.polygonEnd(), w.lineStart = i;\n }\n };\n return w;\n };\n }(t, e) : function (t) {\n return _o({\n point: function (e, n) {\n e = t(e, n), this.stream.point(e[0], e[1]);\n }\n });\n }(t);\n },\n Cg = _o({\n point: function (t, e) {\n this.stream.point(t * Uf, e * Uf);\n }\n });\n Eo.invert = function (t, e) {\n return [t, 2 * Vf(Jf(e)) - kf];\n }, wo.invert = function (t, e) {\n return [-e, 2 * Vf(Jf(t)) - kf];\n };\n var Sg = function () {\n var t = function (t) {\n function e() {\n var e = Bf * a(),\n s = o(ig(o.rotate()).invert([0, 0]));\n return c(null == h ? [[s[0] - e, s[1] - e], [s[0] + e, s[1] + e]] : t === Eo ? [[Math.max(s[0] - e, h), n], [Math.min(s[0] + e, r), i]] : [[h, Math.max(s[1] - e, n)], [r, Math.min(s[1] + e, i)]]);\n }\n var n,\n r,\n i,\n o = xo(t),\n s = o.center,\n a = o.scale,\n u = o.translate,\n c = o.clipExtent,\n h = null;\n return o.scale = function (t) {\n return arguments.length ? (a(t), e()) : a();\n }, o.translate = function (t) {\n return arguments.length ? (u(t), e()) : u();\n }, o.center = function (t) {\n return arguments.length ? (s(t), e()) : s();\n }, o.clipExtent = function (t) {\n return arguments.length ? (null == t ? h = n = r = i = null : (h = +t[0][0], n = +t[0][1], r = +t[1][0], i = +t[1][1]), e()) : null == h ? null : [[h, n], [r, i]];\n }, e();\n }(wo),\n e = t.center,\n n = t.rotate;\n return t.center = function (t) {\n return arguments.length ? e([-t[1], t[0]]) : (t = e(), [t[1], -t[0]]);\n }, t.rotate = function (t) {\n return arguments.length ? n([t[0], t[1], t.length > 2 ? t[2] + 90 : 90]) : (t = n(), [t[0], t[1], t[2] - 90]);\n }, n([0, 0, 90]).scale(159.155);\n };\n t.projection = Cs, t.random = gu, t.clusters = du, t.helpers = ko, t.invariant = jo, t.meta = zo, t.isolines = function (t, e, n) {\n if (n = n || {}, !I(n)) throw new Error(\"options is invalid\");\n var r = n.zProperty || \"elevation\",\n i = n.commonProperties || {},\n o = n.breaksProperties || [];\n if (W(t, \"Point\", \"Input must contain Points\"), !e) throw new Error(\"breaks is required\");\n if (!Array.isArray(e)) throw new Error(\"breaks must be an Array\");\n if (!I(i)) throw new Error(\"commonProperties must be an Object\");\n if (!Array.isArray(o)) throw new Error(\"breaksProperties must be an Array\");\n var s = rt(t, {\n zProperty: r,\n flip: !0\n });\n return c(function (t, e, n) {\n var r = j(n),\n i = r[2] - r[0],\n o = r[3] - r[1],\n s = r[0],\n a = r[1],\n u = e[0].length - 1,\n c = e.length - 1,\n h = i / u,\n l = o / c,\n p = function (t) {\n t[0] = t[0] * h + s, t[1] = t[1] * l + a;\n };\n return t.forEach(function (t) {\n S(t, p);\n }), t;\n }(function (t, e, n, r, i) {\n for (var o = [], s = 1; s < e.length; s++) {\n var a = +e[s],\n u = Object.assign({}, r, i[s]);\n u[n] = a;\n var c = h(Q(t, a), u);\n o.push(c);\n }\n return o;\n }(s, e, r, i, o), s, t));\n }, t.convex = Lt, t.pointsWithinPolygon = Rt, t.concave = function (t, n) {\n if (n = n || {}, !I(n)) throw new Error(\"options is invalid\");\n if (!t) throw new Error(\"points is required\");\n var r = n.maxEdge || 1 / 0;\n if (!b(r)) throw new Error(\"maxEdge is invalid\");\n var i = Tt(function (t) {\n var e = [],\n n = {};\n return O(t, function (t) {\n if (t.geometry) {\n var r = t.geometry.coordinates.join(\"-\");\n n.hasOwnProperty(r) || (e.push(t), n[r] = !0);\n }\n }), c(e);\n }(t));\n if (i.features = i.features.filter(function (t) {\n var e = t.geometry.coordinates[0][0],\n i = t.geometry.coordinates[0][1],\n o = t.geometry.coordinates[0][2],\n s = qt(e, i, n),\n a = qt(i, o, n),\n u = qt(e, o, n);\n return s <= r && a <= r && u <= r;\n }), i.features.length < 1) return null;\n var o = $t(i, n);\n return 1 === o.coordinates.length && (o.coordinates = o.coordinates[0], o.type = \"Polygon\"), e(o);\n }, t.collect = function (t, e, n, r) {\n var i = Vo(6),\n o = e.features.map(function (t) {\n return {\n minX: t.geometry.coordinates[0],\n minY: t.geometry.coordinates[1],\n maxX: t.geometry.coordinates[0],\n maxY: t.geometry.coordinates[1],\n property: t.properties[n]\n };\n });\n return i.load(o), t.features.forEach(function (t) {\n t.properties || (t.properties = {});\n var e = j(t),\n n = [];\n i.search({\n minX: e[0],\n minY: e[1],\n maxX: e[2],\n maxY: e[3]\n }).forEach(function (e) {\n Pt([e.minX, e.minY], t) && n.push(e.property);\n }), t.properties[r] = n;\n }), t;\n }, t.flip = function (t, e) {\n if (e = e || {}, !I(e)) throw new Error(\"options is invalid\");\n var n = e.mutate;\n if (!t) throw new Error(\"geojson is required\");\n return !1 !== n && void 0 !== n || (t = Gt(t)), S(t, function (t) {\n var e = t[0],\n n = t[1];\n t[0] = n, t[1] = e;\n }), t;\n }, t.simplify = function (t, e) {\n if (e = e || {}, !I(e)) throw new Error(\"options is invalid\");\n var n = void 0 !== e.tolerance ? e.tolerance : 1,\n r = e.highQuality || !1,\n i = e.mutate || !1;\n if (!t) throw new Error(\"geojson is required\");\n if (n && n < 0) throw new Error(\"invalid tolerance\");\n return !0 !== i && (t = Gt(t)), A(t, function (t) {\n !function (t, e, n) {\n var r = t.type;\n if (\"Point\" === r || \"MultiPoint\" === r) return t;\n te(t, !0);\n var i = t.coordinates;\n switch (r) {\n case \"LineString\":\n t.coordinates = se(i, e, n);\n break;\n case \"MultiLineString\":\n t.coordinates = i.map(function (t) {\n return se(t, e, n);\n });\n break;\n case \"Polygon\":\n t.coordinates = ae(i, e, n);\n break;\n case \"MultiPolygon\":\n t.coordinates = i.map(function (t) {\n return ae(t, e, n);\n });\n }\n }(t, n, r);\n }), t;\n }, t.bezierSpline = ue, t.tag = function (t, e, n, r) {\n return t = Gt(t), e = Gt(e), O(t, function (t) {\n t.properties || (t.properties = {}), O(e, function (e) {\n void 0 === t.properties[r] && Pt(t, e) && (t.properties[r] = e.properties[n]);\n });\n }), t;\n }, t.sample = function (t, e) {\n if (!t) throw new Error(\"featurecollection is required\");\n if (null === e || void 0 === e) throw new Error(\"num is required\");\n if (\"number\" != typeof e) throw new Error(\"num must be a number\");\n return c(function (t, e) {\n for (var n, r, i = t.slice(0), o = t.length, s = o - e; o-- > s;) r = Math.floor((o + 1) * Math.random()), n = i[r], i[r] = i[o], i[o] = n;\n return i.slice(s);\n }(t.features, e));\n }, t.envelope = he, t.square = le, t.circle = fe, t.midpoint = function (t, e) {\n return pe(t, qt(t, e) / 2, ge(t, e));\n }, t.center = de, t.centerOfMass = _e, t.centroid = ye, t.combine = function (t) {\n function n(t, e, n) {\n n ? r[e].coordinates = r[e].coordinates.concat(t.geometry.coordinates) : r[e].coordinates.push(t.geometry.coordinates), r[e].properties.push(t.properties);\n }\n var r = {\n MultiPoint: {\n coordinates: [],\n properties: []\n },\n MultiLineString: {\n coordinates: [],\n properties: []\n },\n MultiPolygon: {\n coordinates: [],\n properties: []\n }\n },\n i = Object.keys(r).reduce(function (t, e) {\n return t[e.replace(\"Multi\", \"\")] = e, t;\n }, {});\n return O(t, function (t) {\n t.geometry && (r[t.geometry.type] ? n(t, t.geometry.type, !0) : i[t.geometry.type] && n(t, i[t.geometry.type], !1));\n }), c(Object.keys(r).filter(function (t) {\n return r[t].coordinates.length;\n }).sort().map(function (t) {\n return e({\n type: t,\n coordinates: r[t].coordinates\n }, {\n collectedProperties: r[t].properties\n });\n }));\n }, t.distance = qt, t.explode = me, t.bbox = j, t.tesselate = function (t) {\n if (!t.geometry || \"Polygon\" !== t.geometry.type && \"MultiPolygon\" !== t.geometry.type) throw new Error(\"input must be a Polygon or MultiPolygon\");\n var e = {\n type: \"FeatureCollection\",\n features: []\n };\n return \"Polygon\" === t.geometry.type ? e.features = De(t.geometry.coordinates) : t.geometry.coordinates.forEach(function (t) {\n e.features = e.features.concat(De(t));\n }), e;\n }, t.bboxPolygon = ce, t.booleanPointInPolygon = Pt, t.nearestPoint = Fe, t.nearestPointOnLine = on, t.nearestPointToLine = function (t, e, n) {\n if (n = n || {}, !I(n)) throw new Error(\"options is invalid\");\n var r = n.units,\n i = n.properties || {};\n if (!t) throw new Error(\"points is required\");\n if (!(t = function (t) {\n var e = [];\n switch (t.geometry ? t.geometry.type : t.type) {\n case \"GeometryCollection\":\n return A(t, function (t) {\n \"Point\" === t.type && e.push({\n type: \"Feature\",\n properties: {},\n geometry: t\n });\n }), {\n type: \"FeatureCollection\",\n features: e\n };\n case \"FeatureCollection\":\n return t.features = t.features.filter(function (t) {\n return \"Point\" === t.geometry.type;\n }), t;\n default:\n throw new Error(\"points must be a Point Collection\");\n }\n }(t)).features.length) throw new Error(\"points must contain features\");\n if (!e) throw new Error(\"line is required\");\n if (\"LineString\" !== K(e)) throw new Error(\"line must be a LineString\");\n var o = 1 / 0,\n s = null;\n return O(t, function (t) {\n var n = gn(t, e, {\n units: r\n });\n n < o && (o = n, s = t);\n }), s && (s.properties = Object.assign({\n dist: o\n }, s.properties, i)), s;\n }, t.planepoint = function (t, e) {\n var n = X(t),\n r = J(e).coordinates[0];\n if (r.length < 4) throw new Error(\"OuterRing of a Polygon must have 4 or more Positions.\");\n var i = e.properties || {},\n o = i.a,\n s = i.b,\n a = i.c,\n u = n[0],\n c = n[1],\n h = r[0][0],\n l = r[0][1],\n p = void 0 !== o ? o : r[0][2],\n f = r[1][0],\n g = r[1][1],\n d = void 0 !== s ? s : r[1][2],\n y = r[2][0],\n _ = r[2][1],\n m = void 0 !== a ? a : r[2][2];\n return (m * (u - h) * (c - g) + p * (u - f) * (c - _) + d * (u - y) * (c - l) - d * (u - h) * (c - _) - m * (u - f) * (c - l) - p * (u - y) * (c - g)) / ((u - h) * (c - g) + (u - f) * (c - _) + (u - y) * (c - l) - (u - h) * (c - _) - (u - f) * (c - l) - (u - y) * (c - g));\n }, t.tin = Tt, t.bearing = ge, t.destination = pe, t.kinks = function (t) {\n var e,\n n,\n i = {\n type: \"FeatureCollection\",\n features: []\n };\n if (\"LineString\" === (n = \"Feature\" === t.type ? t.geometry : t).type) e = [n.coordinates];else if (\"MultiLineString\" === n.type) e = n.coordinates;else if (\"MultiPolygon\" === n.type) e = [].concat.apply([], n.coordinates);else {\n if (\"Polygon\" !== n.type) throw new Error(\"Input must be a LineString, MultiLineString, Polygon, or MultiPolygon Feature or Geometry\");\n e = n.coordinates;\n }\n return e.forEach(function (t) {\n e.forEach(function (e) {\n for (var n = 0; n < t.length - 1; n++) for (var o = n; o < e.length - 1; o++) {\n if (t === e) {\n if (1 === Math.abs(n - o)) continue;\n if (0 === n && o === t.length - 2 && t[n][0] === t[t.length - 1][0] && t[n][1] === t[t.length - 1][1]) continue;\n }\n var s = function (t, e, n, r, i, o, s, a) {\n var u,\n c,\n h,\n l,\n p,\n f = {\n x: null,\n y: null,\n onLine1: !1,\n onLine2: !1\n };\n return 0 == (u = (a - o) * (n - t) - (s - i) * (r - e)) ? null !== f.x && null !== f.y && f : (c = e - o, h = t - i, l = (s - i) * c - (a - o) * h, p = (n - t) * c - (r - e) * h, c = l / u, h = p / u, f.x = t + c * (n - t), f.y = e + c * (r - e), c >= 0 && c <= 1 && (f.onLine1 = !0), h >= 0 && h <= 1 && (f.onLine2 = !0), !(!f.onLine1 || !f.onLine2) && [f.x, f.y]);\n }(t[n][0], t[n][1], t[n + 1][0], t[n + 1][1], e[o][0], e[o][1], e[o + 1][0], e[o + 1][1]);\n s && i.features.push(r([s[0], s[1]]));\n }\n });\n }), i;\n }, t.pointOnFeature = yn, t.area = mn, t.along = function (t, e, n) {\n if (n = n || {}, !I(n)) throw new Error(\"options is invalid\");\n var i;\n if (\"Feature\" === t.type) i = t.geometry.coordinates;else {\n if (\"LineString\" !== t.type) throw new Error(\"input must be a LineString Feature or Geometry\");\n i = t.coordinates;\n }\n if (!b(e)) throw new Error(\"distance must be a number\");\n for (var o = 0, s = 0; s < i.length && !(e >= o && s === i.length - 1); s++) {\n if (o >= e) {\n var a = e - o;\n if (a) {\n var u = ge(i[s], i[s - 1]) - 180;\n return pe(i[s], a, u, n);\n }\n return r(i[s]);\n }\n o += qt(i[s], i[s + 1], n);\n }\n return r(i[i.length - 1]);\n }, t.length = bn, t.lineSlice = function (t, e, n) {\n var r = U(n);\n if (\"LineString\" !== K(n)) throw new Error(\"line must be a LineString\");\n for (var i, o = on(n, t), s = on(n, e), u = [(i = o.properties.index <= s.properties.index ? [o, s] : [s, o])[0].geometry.coordinates], c = i[0].properties.index + 1; c < i[1].properties.index + 1; c++) u.push(r[c]);\n return u.push(i[1].geometry.coordinates), a(u, n.properties);\n }, t.lineSliceAlong = In, t.pointGrid = Ln, t.truncate = Pn, t.flatten = function (t) {\n if (!t) throw new Error(\"geojson is required\");\n var e = [];\n return F(t, function (t) {\n e.push(t);\n }), c(e);\n }, t.lineIntersect = nn, t.lineChunk = function (t, e, n) {\n if (n = n || {}, !I(n)) throw new Error(\"options is invalid\");\n var r = n.units,\n i = n.reverse;\n if (!t) throw new Error(\"geojson is required\");\n if (e <= 0) throw new Error(\"segmentLength must be greater than 0\");\n var o = [];\n return F(t, function (t) {\n i && (t.geometry.coordinates = t.geometry.coordinates.reverse()), function (t, e, n, r) {\n var i = bn(t, {\n units: n\n });\n if (i <= e) return r(t);\n var o = i / e;\n Number.isInteger(o) || (o = Math.floor(o) + 1);\n for (var s = 0; s < o; s++) {\n var a = In(t, e * s, e * (s + 1), {\n units: n\n });\n r(a, s);\n }\n }(t, e, r, function (t) {\n o.push(t);\n });\n }), c(o);\n }, t.unkinkPolygon = function (t) {\n var e = [];\n return F(t, function (t) {\n \"Polygon\" === t.geometry.type && O(Ls(t), function (n) {\n e.push(o(n.geometry.coordinates, t.properties));\n });\n }), c(e);\n }, t.greatCircle = function (t, e, n) {\n if (\"object\" != typeof (n = n || {})) throw new Error(\"options is invalid\");\n var r = n.properties,\n i = n.npoints,\n o = n.offset;\n return t = X(t), e = X(e), r = r || {}, i = i || 100, o = o || 10, new qs({\n x: t[0],\n y: t[1]\n }, {\n x: e[0],\n y: e[1]\n }, r).Arc(i, {\n offset: o\n }).json();\n }, t.lineSegment = en, t.lineSplit = function (t, e) {\n if (!t) throw new Error(\"line is required\");\n if (!e) throw new Error(\"splitter is required\");\n var n = K(t),\n r = K(e);\n if (\"LineString\" !== n) throw new Error(\"line must be LineString\");\n if (\"FeatureCollection\" === r) throw new Error(\"splitter cannot be a FeatureCollection\");\n if (\"GeometryCollection\" === r) throw new Error(\"splitter cannot be a GeometryCollection\");\n var i = Pn(e, {\n precision: 7\n });\n switch (r) {\n case \"Point\":\n return Dn(t, i);\n case \"MultiPoint\":\n return An(t, i);\n case \"LineString\":\n case \"MultiLineString\":\n case \"Polygon\":\n case \"MultiPolygon\":\n return An(t, nn(t, i));\n }\n }, t.lineArc = Gn, t.polygonToLine = kn, t.lineToPolygon = jn, t.bboxClip = function (t, e) {\n var n = function (t) {\n return t.geometry ? t.geometry.type : t.type;\n }(t),\n r = U(t),\n i = t.properties;\n switch (n) {\n case \"LineString\":\n case \"MultiLineString\":\n var s = [];\n return \"LineString\" === n && (r = [r]), r.forEach(function (t) {\n Gs(t, e, s);\n }), 1 === s.length ? a(s[0], i) : h(s, i);\n case \"Polygon\":\n return o(Wn(r, e), i);\n case \"MultiPolygon\":\n return p(r.map(function (t) {\n return Wn(t, e);\n }), i);\n default:\n throw new Error(\"geometry \" + n + \" not supported\");\n }\n }, t.lineOverlap = $n, t.sector = function (t, e, n, r, i) {\n if (i = i || {}, !I(i)) throw new Error(\"options is invalid\");\n if (!t) throw new Error(\"center is required\");\n if (void 0 === n || null === n) throw new Error(\"bearing1 is required\");\n if (void 0 === r || null === r) throw new Error(\"bearing2 is required\");\n if (!e) throw new Error(\"radius is required\");\n if (\"object\" != typeof i) throw new Error(\"options must be an object\");\n if (er(n) === er(r)) return fe(t, e, i);\n var s = U(t),\n a = [[s]];\n return S(Gn(t, e, n, r, i), function (t) {\n a[0].push(t);\n }), a[0].push(s), o(a);\n }, t.rhumbBearing = sn, t.rhumbDistance = un, t.rhumbDestination = nr, t.polygonTangents = function (t, e) {\n var n,\n i,\n o,\n s = U(t),\n a = U(e);\n switch (K(e)) {\n case \"Polygon\":\n n = a[0][0], i = a[0][0], o = ir(a[0][0], a[0][a[0].length - 1], s);\n var u = rr(a[0], s, o, void 0, n, i);\n n = u[0], i = u[1];\n break;\n case \"MultiPolygon\":\n n = a[0][0][0], i = a[0][0][0], o = ir(a[0][0][0], a[0][0][a[0][0].length - 1], s), a.forEach(function (t) {\n var e = rr(t[0], s, o, void 0, n, i);\n n = e[0], i = e[1];\n });\n }\n return c([r(n), r(i)]);\n }, t.rewind = function (t, e) {\n if (e = e || {}, !I(e)) throw new Error(\"options is invalid\");\n var n = e.reverse || !1,\n r = e.mutate || !1;\n if (!t) throw new Error(\" is required\");\n if (\"boolean\" != typeof n) throw new Error(\" must be a boolean\");\n if (\"boolean\" != typeof r) throw new Error(\" must be a boolean\");\n !1 === r && (t = Gt(t));\n var i = [];\n switch (t.type) {\n case \"GeometryCollection\":\n return A(t, function (t) {\n sr(t, n);\n }), t;\n case \"FeatureCollection\":\n return O(t, function (t) {\n O(sr(t, n), function (t) {\n i.push(t);\n });\n }), c(i);\n }\n return sr(t, n);\n }, t.isobands = function (t, e, n) {\n if (n = n || {}, !I(n)) throw new Error(\"options is invalid\");\n var r = n.zProperty || \"elevation\",\n i = n.commonProperties || {},\n s = n.breaksProperties || [];\n if (W(t, \"Point\", \"Input must contain Points\"), !e) throw new Error(\"breaks is required\");\n if (!Array.isArray(e)) throw new Error(\"breaks is not an Array\");\n if (!I(i)) throw new Error(\"commonProperties is not an Object\");\n if (!Array.isArray(s)) throw new Error(\"breaksProperties is not an Array\");\n var a = cr(t, {\n zProperty: r,\n flip: !0\n }),\n u = function (t, e, n) {\n for (var r = [], i = 1; i < e.length; i++) {\n var s = +e[i - 1],\n a = +e[i],\n u = hr(t, s, a - s),\n c = function (t) {\n var e = [],\n n = [];\n t.forEach(function (t) {\n var r = mn(o([t]));\n n.push(r), e.push({\n ring: t,\n area: r\n });\n }), n.sort(function (t, e) {\n return e - t;\n });\n var r = [];\n return n.forEach(function (t) {\n for (var n = 0; n < e.length; n++) if (e[n].area === t) {\n r.push(e[n].ring), e.splice(n, 1);\n break;\n }\n }), r;\n }(u),\n h = function (t) {\n for (var e = t.map(function (t) {\n return {\n lrCoordinates: t,\n grouped: !1\n };\n }), n = []; !function (t) {\n for (var e = 0; e < t.length; e++) if (!1 === t[e].grouped) return !1;\n return !0;\n }(e);) for (var r = 0; r < e.length; r++) if (!e[r].grouped) {\n var i = [];\n i.push(e[r].lrCoordinates), e[r].grouped = !0;\n for (var s = o([e[r].lrCoordinates]), a = r + 1; a < e.length; a++) if (!e[a].grouped) {\n var u = o([e[a].lrCoordinates]);\n (function (t, e) {\n for (var n = me(t), r = 0; r < n.features.length; r++) if (!Pt(n.features[r], e)) return !1;\n return !0;\n })(u, s) && (i.push(e[a].lrCoordinates), e[a].grouped = !0);\n }\n n.push(i);\n }\n return n;\n }(c),\n l = {};\n l.groupedRings = h, l[n] = s + \"-\" + a, r.push(l);\n }\n return r;\n }(a, e, r);\n return c((u = function (t, e, n) {\n var r = j(n),\n i = r[2] - r[0],\n o = r[3] - r[1],\n s = r[0],\n a = r[1],\n u = e[0].length - 1,\n c = e.length - 1,\n h = i / u,\n l = o / c,\n p = function (t) {\n t[0] = t[0] * h + s, t[1] = t[1] * l + a;\n };\n return t.forEach(function (t) {\n t.groupedRings.forEach(function (t) {\n t.forEach(function (t) {\n t.forEach(p);\n });\n });\n }), t;\n }(u, a, t)).map(function (t, e) {\n if (s[e] && !I(s[e])) throw new Error(\"Each mappedProperty is required to be an Object\");\n var n = Object.assign({}, i, s[e]);\n return n[r] = t[r], p(t.groupedRings, n);\n }));\n }, t.transformRotate = fr, t.transformScale = gr, t.transformTranslate = function (t, e, n, r) {\n if (r = r || {}, !I(r)) throw new Error(\"options is invalid\");\n var i = r.units,\n o = r.zTranslation,\n s = r.mutate;\n if (!t) throw new Error(\"geojson is required\");\n if (void 0 === e || null === e || isNaN(e)) throw new Error(\"distance is required\");\n if (o && \"number\" != typeof o && isNaN(o)) throw new Error(\"zTranslation is not a number\");\n if (o = void 0 !== o ? o : 0, 0 === e && 0 === o) return t;\n if (void 0 === n || null === n || isNaN(n)) throw new Error(\"direction is required\");\n return e < 0 && (e = -e, n = -n), !1 !== s && void 0 !== s || (t = Gt(t)), S(t, function (t) {\n var r = U(nr(t, e, n, {\n units: i\n }));\n t[0] = r[0], t[1] = r[1], o && 3 === t.length && (t[2] += o);\n }), t;\n }, t.lineOffset = function (t, e, n) {\n if (n = n || {}, !I(n)) throw new Error(\"options is invalid\");\n var r = n.units;\n if (!t) throw new Error(\"geojson is required\");\n if (void 0 === e || null === e || isNaN(e)) throw new Error(\"distance is required\");\n var i = K(t),\n o = t.properties;\n switch (i) {\n case \"LineString\":\n return vr(t, e, r);\n case \"MultiLineString\":\n var s = [];\n return F(t, function (t) {\n s.push(vr(t, e, r).geometry.coordinates);\n }), h(s, o);\n default:\n throw new Error(\"geometry \" + i + \" is not supported\");\n }\n }, t.polygonize = function (t) {\n var e = qa.fromGeoJson(t);\n e.deleteDangles(), e.deleteCutEdges();\n var n = [],\n r = [];\n return e.getEdgeRings().filter(function (t) {\n return t.isValid();\n }).forEach(function (t) {\n t.isHole() ? n.push(t) : r.push(t);\n }), n.forEach(function (t) {\n Da.findEdgeRingContaining(t, r) && r.push(t);\n }), c(r.map(function (t) {\n return t.toPolygon();\n }));\n }, t.booleanDisjoint = function (t, e) {\n var n;\n return F(t, function (t) {\n F(e, function (e) {\n if (!1 === n) return !1;\n n = function (t, e) {\n switch (t.type) {\n case \"Point\":\n switch (e.type) {\n case \"Point\":\n return !function (t, e) {\n return t[0] === e[0] && t[1] === e[1];\n }(t.coordinates, e.coordinates);\n case \"LineString\":\n return !wr(e, t);\n case \"Polygon\":\n return !Pt(t, e);\n }\n break;\n case \"LineString\":\n switch (e.type) {\n case \"Point\":\n return !wr(t, e);\n case \"LineString\":\n return !function (t, e) {\n return nn(t, e).features.length > 0;\n }(t, e);\n case \"Polygon\":\n return !br(e, t);\n }\n break;\n case \"Polygon\":\n switch (e.type) {\n case \"Point\":\n return !Pt(e, t);\n case \"LineString\":\n return !br(t, e);\n case \"Polygon\":\n return !function (t, e) {\n for (var n = 0; n < t.coordinates[0].length; n++) if (Pt(t.coordinates[0][n], e)) return !0;\n for (var r = 0; r < e.coordinates[0].length; r++) if (Pt(e.coordinates[0][r], t)) return !0;\n return !1;\n }(e, t);\n }\n }\n }(t.geometry, e.geometry);\n });\n }), n;\n }, t.booleanContains = function (t, e) {\n var n = K(t),\n r = K(e),\n i = J(t),\n o = J(e),\n s = U(t),\n a = U(e);\n switch (n) {\n case \"Point\":\n switch (r) {\n case \"Point\":\n return Nr(s, a);\n default:\n throw new Error(\"feature2 \" + r + \" geometry not supported\");\n }\n case \"MultiPoint\":\n switch (r) {\n case \"Point\":\n return function (t, e) {\n var n,\n r = !1;\n for (n = 0; n < t.coordinates.length; n++) if (Nr(t.coordinates[n], e.coordinates)) {\n r = !0;\n break;\n }\n return r;\n }(i, o);\n case \"MultiPoint\":\n return function (t, e) {\n for (var n = 0; n < e.coordinates.length; n++) {\n for (var r = !1, i = 0; i < t.coordinates.length; i++) if (Nr(e.coordinates[n], t.coordinates[i])) {\n r = !0;\n break;\n }\n if (!r) return !1;\n }\n return !0;\n }(i, o);\n default:\n throw new Error(\"feature2 \" + r + \" geometry not supported\");\n }\n case \"LineString\":\n switch (r) {\n case \"Point\":\n return Nn(o, i, {\n ignoreEndVertices: !0\n });\n case \"LineString\":\n return function (t, e) {\n for (var n = !1, r = 0; r < e.coordinates.length; r++) if (Nn({\n type: \"Point\",\n coordinates: e.coordinates[r]\n }, t, {\n ignoreEndVertices: !0\n }) && (n = !0), !Nn({\n type: \"Point\",\n coordinates: e.coordinates[r]\n }, t, {\n ignoreEndVertices: !1\n })) return !1;\n return n;\n }(i, o);\n case \"MultiPoint\":\n return function (t, e) {\n for (var n = !1, r = 0; r < e.coordinates.length; r++) if (Nn(e.coordinates[r], t, {\n ignoreEndVertices: !0\n }) && (n = !0), !Nn(e.coordinates[r], t)) return !1;\n return !!n;\n }(i, o);\n default:\n throw new Error(\"feature2 \" + r + \" geometry not supported\");\n }\n case \"Polygon\":\n switch (r) {\n case \"Point\":\n return Pt(o, i, {\n ignoreBoundary: !0\n });\n case \"LineString\":\n return function (t, e) {\n var n = !1,\n r = 0,\n i = j(t),\n o = j(e);\n if (!Ir(i, o)) return !1;\n for (; r < e.coordinates.length - 1; r++) {\n var s = function (t, e) {\n return [(t[0] + e[0]) / 2, (t[1] + e[1]) / 2];\n }(e.coordinates[r], e.coordinates[r + 1]);\n if (Pt({\n type: \"Point\",\n coordinates: s\n }, t, {\n ignoreBoundary: !0\n })) {\n n = !0;\n break;\n }\n }\n return n;\n }(i, o);\n case \"Polygon\":\n return function (t, e) {\n var n = j(t),\n r = j(e);\n if (!Ir(n, r)) return !1;\n for (var i = 0; i < e.coordinates[0].length; i++) if (!Pt(e.coordinates[0][i], t)) return !1;\n return !0;\n }(i, o);\n case \"MultiPoint\":\n return function (t, e) {\n for (var n = 0; n < e.coordinates.length; n++) if (!Pt(e.coordinates[n], t, {\n ignoreBoundary: !0\n })) return !1;\n return !0;\n }(i, o);\n default:\n throw new Error(\"feature2 \" + r + \" geometry not supported\");\n }\n default:\n throw new Error(\"feature1 \" + n + \" geometry not supported\");\n }\n }, t.booleanCrosses = function (t, e) {\n var n = K(t),\n r = K(e),\n i = J(t),\n o = J(e);\n switch (n) {\n case \"MultiPoint\":\n switch (r) {\n case \"LineString\":\n return Cr(i, o);\n case \"Polygon\":\n return Mr(i, o);\n default:\n throw new Error(\"feature2 \" + r + \" geometry not supported\");\n }\n case \"LineString\":\n switch (r) {\n case \"MultiPoint\":\n return Cr(o, i);\n case \"LineString\":\n return function (t, e) {\n if (nn(t, e).features.length > 0) for (var n = 0; n < t.coordinates.length - 1; n++) for (var r = 0; r < e.coordinates.length - 1; r++) {\n var i = !0;\n if (0 !== r && r !== e.coordinates.length - 2 || (i = !1), Lr(t.coordinates[n], t.coordinates[n + 1], e.coordinates[r], i)) return !0;\n }\n return !1;\n }(i, o);\n case \"Polygon\":\n return Sr(i, o);\n default:\n throw new Error(\"feature2 \" + r + \" geometry not supported\");\n }\n case \"Polygon\":\n switch (r) {\n case \"MultiPoint\":\n return Mr(o, i);\n case \"LineString\":\n return Sr(o, i);\n default:\n throw new Error(\"feature2 \" + r + \" geometry not supported\");\n }\n default:\n throw new Error(\"feature1 \" + n + \" geometry not supported\");\n }\n }, t.booleanClockwise = or, t.booleanOverlap = Tr, t.booleanPointOnLine = Nn, t.booleanEqual = function (t, e) {\n if (!t) throw new Error(\"feature1 is required\");\n if (!e) throw new Error(\"feature2 is required\");\n return K(t) === K(e) && new ja({\n precision: 6\n }).compare(te(t), te(e));\n }, t.booleanWithin = Cn, t.clone = Gt, t.cleanCoords = te, t.clustersDbscan = function (t, e, n) {\n if (\"object\" != typeof (n = n || {})) throw new Error(\"options is invalid\");\n var r = n.minPoints,\n i = n.units;\n if (W(t, \"Point\", \"Input must contain Points\"), null === e || void 0 === e) throw new Error(\"maxDistance is required\");\n if (!(Math.sign(e) > 0)) throw new Error(\"Invalid maxDistance\");\n if (!(void 0 === r || null === r || Math.sign(r) > 0)) throw new Error(\"Invalid minPoints\");\n t = Gt(t), r = r || 3;\n var o = new Ha.DBSCAN(),\n s = -1;\n return o.run(T(t), E(e, i), r, qt).forEach(function (e) {\n s++, e.forEach(function (e) {\n var n = t.features[e];\n n.properties || (n.properties = {}), n.properties.cluster = s, n.properties.dbscan = \"core\";\n });\n }), o.noise.forEach(function (e) {\n var n = t.features[e];\n n.properties || (n.properties = {}), n.properties.cluster ? n.properties.dbscan = \"edge\" : n.properties.dbscan = \"noise\";\n }), t;\n }, t.clustersKmeans = function (t, e) {\n if (\"object\" != typeof (e = e || {})) throw new Error(\"options is invalid\");\n var n = e.numberOfClusters,\n r = e.mutate;\n W(t, \"Point\", \"Input must contain Points\");\n var i = t.features.length;\n (n = n || Math.round(Math.sqrt(i / 2))) > i && (n = i), !1 !== r && void 0 !== r || (t = Gt(t));\n var o = T(t),\n s = o.slice(0, n),\n a = eu(o, n, s),\n u = {};\n return a.centroids.forEach(function (t, e) {\n u[e] = t;\n }), O(t, function (t, e) {\n var n = a.idxs[e];\n t.properties.cluster = n, t.properties.centroid = u[n];\n }), t;\n }, t.pointToLineDistance = gn, t.booleanParallel = function (t, e) {\n if (!t) throw new Error(\"line1 is required\");\n if (!e) throw new Error(\"line2 is required\");\n if (\"LineString\" !== Dr(t, \"line1\")) throw new Error(\"line1 must be a LineString\");\n if (\"LineString\" !== Dr(e, \"line2\")) throw new Error(\"line2 must be a LineString\");\n for (var n = en(te(t)).features, r = en(te(e)).features, i = 0; i < n.length; i++) {\n var o = n[i].geometry.coordinates;\n if (!r[i]) break;\n if (!function (t, e) {\n var n = m(sn(t[0], t[1])),\n r = m(sn(e[0], e[1]));\n return n === r;\n }(o, r[i].geometry.coordinates)) return !1;\n }\n return !0;\n }, t.shortestPath = function (t, n, i) {\n if (i = i || {}, !I(i)) throw new Error(\"options is invalid\");\n var o = i.resolution,\n s = i.minDistance,\n u = i.obstacles || c([]);\n if (!t) throw new Error(\"start is required\");\n if (!n) throw new Error(\"end is required\");\n if (o && !b(o) || o <= 0) throw new Error(\"options.resolution must be a number, greater than 0\");\n if (s) throw new Error(\"options.minDistance is not yet implemented\");\n var h = X(t),\n l = X(n);\n switch (t = r(h), n = r(l), K(u)) {\n case \"FeatureCollection\":\n if (0 === u.features.length) return a([h, l]);\n break;\n case \"Polygon\":\n u = c([e(J(u))]);\n break;\n default:\n throw new Error(\"invalid obstacles\");\n }\n var p = u;\n p.features.push(t), p.features.push(n);\n var f = j(gr(ce(j(p)), 1.15));\n o || (o = qt([f[0], f[1]], [f[2], f[1]], i) / 100);\n p.features.pop(), p.features.pop();\n for (var g = f[0], d = f[1], y = f[2], _ = f[3], m = o / qt([g, d], [y, d], i) * (y - g), v = o / qt([g, d], [g, _], i) * (_ - d), x = y - g, E = _ - d, w = (x - Math.floor(x / m) * m) / 2, N = [], C = [], S = [], M = [], L = 1 / 0, P = 1 / 0, O = _ - (E - Math.floor(E / v) * v) / 2, R = 0; O >= d;) {\n for (var T = [], A = [], D = g + w, F = 0; D <= y;) {\n var q = r([D, O]),\n G = function (t, e) {\n for (var n = 0; n < e.features.length; n++) if (Pt(t, e.features[n])) return !0;\n return !1;\n }(q, u);\n T.push(G ? 0 : 1), A.push(D + \"|\" + O);\n var B = qt(q, t);\n !G && B < L && (L = B, S = {\n x: F,\n y: R\n });\n var k = qt(q, n);\n !G && k < P && (P = k, M = {\n x: F,\n y: R\n }), D += m, F++;\n }\n C.push(T), N.push(A), O -= v, R++;\n }\n var z = new qr(C, {\n diagonal: !0\n }),\n U = z.grid[S.y][S.x],\n Y = z.grid[M.y][M.x],\n V = [h];\n return nu.search(z, U, Y).forEach(function (t) {\n var e = N[t.x][t.y].split(\"|\");\n V.push([+e[0], +e[1]]);\n }), V.push(l), te(a(V));\n }, t.voronoi = function (t, e) {\n if (e = e || {}, !I(e)) throw new Error(\"options is invalid\");\n var n = e.bbox || [-180, -85, 180, 85];\n if (!t) throw new Error(\"points is required\");\n if (!Array.isArray(n)) throw new Error(\"bbox is invalid\");\n return W(t, \"Point\", \"points\"), c(fu().x(function (t) {\n return t.geometry.coordinates[0];\n }).y(function (t) {\n return t.geometry.coordinates[1];\n }).extent([[n[0], n[1]], [n[2], n[3]]]).polygons(t.features).map(li));\n }, t.ellipse = pi, t.centerMean = gi, t.centerMedian = function (t, e) {\n if (e = e || {}, !I(e)) throw new Error(\"options is invalid\");\n var n = e.counter || 10;\n if (!b(n)) throw new Error(\"counter must be a number\");\n var r = e.weight,\n i = gi(t, {\n weight: e.weight\n }),\n o = c([]);\n return O(t, function (t) {\n o.features.push(ye(t, {\n weight: t.properties[r]\n }));\n }), o.properties = {\n tolerance: e.tolerance,\n medianCandidates: []\n }, di(i.geometry.coordinates, [0, 0], o, n);\n }, t.standardDeviationalEllipse = function (t, e) {\n if (e = e || {}, !I(e)) throw new Error(\"options is invalid\");\n var n = e.steps || 64,\n r = e.weight,\n i = e.properties || {};\n if (!b(n)) throw new Error(\"steps must be a number\");\n if (!I(i)) throw new Error(\"properties must be a number\");\n var o = T(t).length,\n s = gi(t, {\n weight: r\n }),\n a = 0,\n u = 0,\n h = 0;\n O(t, function (t) {\n var e = t.properties[r] || 1,\n n = yi(U(t), U(s));\n a += Math.pow(n.x, 2) * e, u += Math.pow(n.y, 2) * e, h += n.x * n.y * e;\n });\n var l = a - u,\n p = Math.sqrt(Math.pow(l, 2) + 4 * Math.pow(h, 2)),\n f = 2 * h,\n g = Math.atan((l + p) / f),\n d = 180 * g / Math.PI,\n y = 0,\n _ = 0,\n m = 0;\n O(t, function (t) {\n var e = t.properties[r] || 1,\n n = yi(U(t), U(s));\n y += Math.pow(n.x * Math.cos(g) - n.y * Math.sin(g), 2) * e, _ += Math.pow(n.x * Math.sin(g) + n.y * Math.cos(g), 2) * e, m += e;\n });\n var v = Math.sqrt(2 * y / m),\n x = Math.sqrt(2 * _ / m),\n E = pi(s, v, x, {\n units: \"degrees\",\n angle: d,\n steps: n,\n properties: i\n }),\n w = Rt(t, c([E])),\n N = {\n meanCenterCoordinates: U(s),\n semiMajorAxis: v,\n semiMinorAxis: x,\n numberOfFeatures: o,\n angle: d,\n percentageWithinEllipse: 100 * T(w).length / o\n };\n return E.properties.standardDeviationalEllipse = N, E;\n }, t.difference = function (t, n) {\n var r = J(t),\n i = J(n),\n o = t.properties || {};\n if (r = Ui(r), i = Ui(i), !r) return null;\n if (!i) return e(r, o);\n var s = new bh(),\n a = s.read(r),\n u = s.read(i),\n c = Cf.difference(a, u);\n return c.isEmpty() ? null : e(new Ih().write(c), o);\n }, t.buffer = function (t, e, n) {\n var r = (n = n || {}).units,\n i = n.steps || 64;\n if (!t) throw new Error(\"geojson is required\");\n if (\"object\" != typeof n) throw new Error(\"options must be an object\");\n if (\"number\" != typeof i) throw new Error(\"steps must be an number\");\n if (void 0 === e) throw new Error(\"radius is required\");\n if (i <= 0) throw new Error(\"steps must be greater than 0\");\n i = i || 64, r = r || \"kilometers\";\n var o = [];\n switch (t.type) {\n case \"GeometryCollection\":\n return A(t, function (t) {\n var n = bo(t, e, r, i);\n n && o.push(n);\n }), c(o);\n case \"FeatureCollection\":\n return O(t, function (t) {\n var n = bo(t, e, r, i);\n n && O(n, function (t) {\n t && o.push(t);\n });\n }), c(o);\n }\n return bo(t, e, r, i);\n }, t.union = Mo, t.intersect = Lo, t.dissolve = function (t, e) {\n if (e = e || {}, !I(e)) throw new Error(\"options is invalid\");\n var n = e.propertyName;\n W(t, \"Polygon\", \"dissolve\");\n var r = Gt(t),\n i = r.features,\n o = [];\n i.forEach(function (t, e) {\n t.properties.origIndexPosition = e;\n });\n var s = Qe();\n s.load(r);\n for (var u in i) {\n var c = i[u],\n h = !1;\n if (s.search(c).features.forEach(function (t) {\n c = i[u];\n var e = t.properties.origIndexPosition;\n if (o.length > 0 && 0 !== e) if (e > o[o.length - 1]) e -= o.length;else {\n var r = Po(e, o);\n 0 !== r && (e -= r);\n }\n if (e !== +u) {\n var l = i[e];\n l && c && (void 0 !== n && l.properties[n] !== c.properties[n] || Tr(c, l) && function (t, e) {\n var n = a(T(t)),\n r = a(T(e));\n return nn(n, r).features.length > 0;\n }(c, l) && (i[u] = Mo(c, l), o.push(t.properties.origIndexPosition), o.sort(function (t, e) {\n return t - e;\n }), s.remove(t), i.splice(e, 1), c.properties.origIndexPosition = u, s.remove(c, function (t, e) {\n return t.properties.origIndexPosition === e.properties.origIndexPosition;\n }), h = !0));\n }\n }), h) {\n if (!c) continue;\n c.properties.origIndexPosition = u, s.insert(c), u--;\n }\n }\n return i.forEach(function (t) {\n delete t.properties.origIndexPosition, delete t.bbox;\n }), r;\n }, t.hexGrid = Oo, t.mask = function (t, e) {\n var n = function (t) {\n return o(t && t.geometry.coordinates || [[[180, 90], [-180, 90], [-180, -90], [180, -90], [180, 90]]]);\n }(e),\n r = function (t) {\n var e = [],\n n = [];\n return F(t, function (t) {\n var r = t.geometry.coordinates,\n i = r[0],\n s = r.slice(1);\n e.push(o([i])), s.forEach(function (t) {\n n.push(o([t]));\n });\n }), [c(e), c(n)];\n }(t),\n i = r[0],\n s = r[1];\n return function (t, e, n) {\n var r = [];\n return r.push(t.geometry.coordinates[0]), F(e, function (t) {\n r.push(t.geometry.coordinates[0]);\n }), F(n, function (t) {\n r.push(t.geometry.coordinates[0]);\n }), o(r);\n }(n, i = Ro(i), s = Ro(s));\n }, t.squareGrid = Ao, t.triangleGrid = Do, t.interpolate = function (t, e, n) {\n if (\"object\" != typeof (n = n || {})) throw new Error(\"options is invalid\");\n var r = n.gridType,\n i = n.property,\n o = n.weight;\n if (!t) throw new Error(\"points is required\");\n if (W(t, \"Point\", \"input must contain Points\"), !e) throw new Error(\"cellSize is required\");\n if (void 0 !== o && \"number\" != typeof o) throw new Error(\"weight must be a number\");\n i = i || \"elevation\", r = r || \"square\", o = o || 1;\n var s,\n a = j(t);\n switch (r) {\n case \"point\":\n case \"points\":\n s = Ln(a, e, n);\n break;\n case \"square\":\n case \"squares\":\n s = Ao(a, e, n);\n break;\n case \"hex\":\n case \"hexes\":\n s = Oo(a, e, n);\n break;\n case \"triangle\":\n case \"triangles\":\n s = Do(a, e, n);\n break;\n default:\n throw new Error(\"invalid gridType\");\n }\n var u = [];\n return O(s, function (e) {\n var s = 0,\n a = 0;\n O(t, function (t) {\n var u,\n c = qt(\"point\" === r ? e : ye(e), t, n);\n if (void 0 !== i && (u = t.properties[i]), void 0 === u && (u = t.geometry.coordinates[2]), void 0 === u) throw new Error(\"zValue is missing\");\n 0 === c && (s = u);\n var h = 1 / Math.pow(c, o);\n a += h, s += h * u;\n });\n var c = Gt(e);\n c.properties[i] = s / a, u.push(c);\n }), c(u);\n }, t.pointOnSurface = yn, t.polygonToLineString = kn, t.lineStringToPolygon = jn, t.inside = Pt, t.within = Rt, t.bezier = ue, t.nearest = Fe, t.pointOnLine = on, t.lineDistance = bn, t.radians2degrees = v, t.degrees2radians = x, t.distanceToDegrees = _, t.distanceToRadians = y, t.radiansToDistance = d, t.bearingToAngle = m, t.convertDistance = E, t.toMercator = cn, t.toWgs84 = hn, t.randomPosition = _i, t.randomPoint = mi, t.randomPolygon = vi, t.randomLineString = xi, t.getCluster = wi, t.clusterEach = bi, t.clusterReduce = Ii, t.createBins = Ni, t.applyFilter = Ci, t.propertiesContainsFilter = Si, t.filterProperties = Mi, t.earthRadius = Fo, t.factors = qo, t.unitsFactors = Go, t.areaFactors = Bo, t.feature = e, t.geometry = n, t.point = r, t.points = i, t.polygon = o, t.polygons = s, t.lineString = a, t.lineStrings = u, t.featureCollection = c, t.multiLineString = h, t.multiPoint = l, t.multiPolygon = p, t.geometryCollection = f, t.round = g, t.radiansToLength = d, t.lengthToRadians = y, t.lengthToDegrees = _, t.bearingToAzimuth = m, t.radiansToDegrees = v, t.degreesToRadians = x, t.convertLength = E, t.convertArea = w, t.isNumber = b, t.isObject = I, t.validateBBox = N, t.validateId = C, t.getCoord = X, t.getCoords = U, t.containsNumber = Y, t.geojsonType = V, t.featureOf = H, t.collectionOf = W, t.getGeom = J, t.getGeomType = Z, t.getType = K, t.coordEach = S, t.coordReduce = M, t.propEach = L, t.propReduce = P, t.featureEach = O, t.featureReduce = R, t.coordAll = T, t.geomEach = A, t.geomReduce = D, t.flattenEach = F, t.flattenReduce = q, t.segmentEach = G, t.segmentReduce = B, t.lineEach = k, t.lineReduce = z, Object.defineProperty(t, \"__esModule\", {\n value: !0\n });\n});","//! moment.js\n//! version : 2.30.1\n//! authors : Tim Wood, Iskren Chernev, Moment.js contributors\n//! license : MIT\n//! momentjs.com\n\n;\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : global.moment = factory();\n})(this, function () {\n 'use strict';\n\n var hookCallback;\n function hooks() {\n return hookCallback.apply(null, arguments);\n }\n\n // This is done to register the method called with moment()\n // without creating circular dependencies.\n function setHookCallback(callback) {\n hookCallback = callback;\n }\n function isArray(input) {\n return input instanceof Array || Object.prototype.toString.call(input) === '[object Array]';\n }\n function isObject(input) {\n // IE8 will treat undefined and null as object if it wasn't for\n // input != null\n return input != null && Object.prototype.toString.call(input) === '[object Object]';\n }\n function hasOwnProp(a, b) {\n return Object.prototype.hasOwnProperty.call(a, b);\n }\n function isObjectEmpty(obj) {\n if (Object.getOwnPropertyNames) {\n return Object.getOwnPropertyNames(obj).length === 0;\n } else {\n var k;\n for (k in obj) {\n if (hasOwnProp(obj, k)) {\n return false;\n }\n }\n return true;\n }\n }\n function isUndefined(input) {\n return input === void 0;\n }\n function isNumber(input) {\n return typeof input === 'number' || Object.prototype.toString.call(input) === '[object Number]';\n }\n function isDate(input) {\n return input instanceof Date || Object.prototype.toString.call(input) === '[object Date]';\n }\n function map(arr, fn) {\n var res = [],\n i,\n arrLen = arr.length;\n for (i = 0; i < arrLen; ++i) {\n res.push(fn(arr[i], i));\n }\n return res;\n }\n function extend(a, b) {\n for (var i in b) {\n if (hasOwnProp(b, i)) {\n a[i] = b[i];\n }\n }\n if (hasOwnProp(b, 'toString')) {\n a.toString = b.toString;\n }\n if (hasOwnProp(b, 'valueOf')) {\n a.valueOf = b.valueOf;\n }\n return a;\n }\n function createUTC(input, format, locale, strict) {\n return createLocalOrUTC(input, format, locale, strict, true).utc();\n }\n function defaultParsingFlags() {\n // We need to deep clone this object.\n return {\n empty: false,\n unusedTokens: [],\n unusedInput: [],\n overflow: -2,\n charsLeftOver: 0,\n nullInput: false,\n invalidEra: null,\n invalidMonth: null,\n invalidFormat: false,\n userInvalidated: false,\n iso: false,\n parsedDateParts: [],\n era: null,\n meridiem: null,\n rfc2822: false,\n weekdayMismatch: false\n };\n }\n function getParsingFlags(m) {\n if (m._pf == null) {\n m._pf = defaultParsingFlags();\n }\n return m._pf;\n }\n var some;\n if (Array.prototype.some) {\n some = Array.prototype.some;\n } else {\n some = function (fun) {\n var t = Object(this),\n len = t.length >>> 0,\n i;\n for (i = 0; i < len; i++) {\n if (i in t && fun.call(this, t[i], i, t)) {\n return true;\n }\n }\n return false;\n };\n }\n function isValid(m) {\n var flags = null,\n parsedParts = false,\n isNowValid = m._d && !isNaN(m._d.getTime());\n if (isNowValid) {\n flags = getParsingFlags(m);\n parsedParts = some.call(flags.parsedDateParts, function (i) {\n return i != null;\n });\n isNowValid = flags.overflow < 0 && !flags.empty && !flags.invalidEra && !flags.invalidMonth && !flags.invalidWeekday && !flags.weekdayMismatch && !flags.nullInput && !flags.invalidFormat && !flags.userInvalidated && (!flags.meridiem || flags.meridiem && parsedParts);\n if (m._strict) {\n isNowValid = isNowValid && flags.charsLeftOver === 0 && flags.unusedTokens.length === 0 && flags.bigHour === undefined;\n }\n }\n if (Object.isFrozen == null || !Object.isFrozen(m)) {\n m._isValid = isNowValid;\n } else {\n return isNowValid;\n }\n return m._isValid;\n }\n function createInvalid(flags) {\n var m = createUTC(NaN);\n if (flags != null) {\n extend(getParsingFlags(m), flags);\n } else {\n getParsingFlags(m).userInvalidated = true;\n }\n return m;\n }\n\n // Plugins that add properties should also add the key here (null value),\n // so we can properly clone ourselves.\n var momentProperties = hooks.momentProperties = [],\n updateInProgress = false;\n function copyConfig(to, from) {\n var i,\n prop,\n val,\n momentPropertiesLen = momentProperties.length;\n if (!isUndefined(from._isAMomentObject)) {\n to._isAMomentObject = from._isAMomentObject;\n }\n if (!isUndefined(from._i)) {\n to._i = from._i;\n }\n if (!isUndefined(from._f)) {\n to._f = from._f;\n }\n if (!isUndefined(from._l)) {\n to._l = from._l;\n }\n if (!isUndefined(from._strict)) {\n to._strict = from._strict;\n }\n if (!isUndefined(from._tzm)) {\n to._tzm = from._tzm;\n }\n if (!isUndefined(from._isUTC)) {\n to._isUTC = from._isUTC;\n }\n if (!isUndefined(from._offset)) {\n to._offset = from._offset;\n }\n if (!isUndefined(from._pf)) {\n to._pf = getParsingFlags(from);\n }\n if (!isUndefined(from._locale)) {\n to._locale = from._locale;\n }\n if (momentPropertiesLen > 0) {\n for (i = 0; i < momentPropertiesLen; i++) {\n prop = momentProperties[i];\n val = from[prop];\n if (!isUndefined(val)) {\n to[prop] = val;\n }\n }\n }\n return to;\n }\n\n // Moment prototype object\n function Moment(config) {\n copyConfig(this, config);\n this._d = new Date(config._d != null ? config._d.getTime() : NaN);\n if (!this.isValid()) {\n this._d = new Date(NaN);\n }\n // Prevent infinite loop in case updateOffset creates new moment\n // objects.\n if (updateInProgress === false) {\n updateInProgress = true;\n hooks.updateOffset(this);\n updateInProgress = false;\n }\n }\n function isMoment(obj) {\n return obj instanceof Moment || obj != null && obj._isAMomentObject != null;\n }\n function warn(msg) {\n if (hooks.suppressDeprecationWarnings === false && typeof console !== 'undefined' && console.warn) {\n console.warn('Deprecation warning: ' + msg);\n }\n }\n function deprecate(msg, fn) {\n var firstTime = true;\n return extend(function () {\n if (hooks.deprecationHandler != null) {\n hooks.deprecationHandler(null, msg);\n }\n if (firstTime) {\n var args = [],\n arg,\n i,\n key,\n argLen = arguments.length;\n for (i = 0; i < argLen; i++) {\n arg = '';\n if (typeof arguments[i] === 'object') {\n arg += '\\n[' + i + '] ';\n for (key in arguments[0]) {\n if (hasOwnProp(arguments[0], key)) {\n arg += key + ': ' + arguments[0][key] + ', ';\n }\n }\n arg = arg.slice(0, -2); // Remove trailing comma and space\n } else {\n arg = arguments[i];\n }\n args.push(arg);\n }\n warn(msg + '\\nArguments: ' + Array.prototype.slice.call(args).join('') + '\\n' + new Error().stack);\n firstTime = false;\n }\n return fn.apply(this, arguments);\n }, fn);\n }\n var deprecations = {};\n function deprecateSimple(name, msg) {\n if (hooks.deprecationHandler != null) {\n hooks.deprecationHandler(name, msg);\n }\n if (!deprecations[name]) {\n warn(msg);\n deprecations[name] = true;\n }\n }\n hooks.suppressDeprecationWarnings = false;\n hooks.deprecationHandler = null;\n function isFunction(input) {\n return typeof Function !== 'undefined' && input instanceof Function || Object.prototype.toString.call(input) === '[object Function]';\n }\n function set(config) {\n var prop, i;\n for (i in config) {\n if (hasOwnProp(config, i)) {\n prop = config[i];\n if (isFunction(prop)) {\n this[i] = prop;\n } else {\n this['_' + i] = prop;\n }\n }\n }\n this._config = config;\n // Lenient ordinal parsing accepts just a number in addition to\n // number + (possibly) stuff coming from _dayOfMonthOrdinalParse.\n // TODO: Remove \"ordinalParse\" fallback in next major release.\n this._dayOfMonthOrdinalParseLenient = new RegExp((this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) + '|' + /\\d{1,2}/.source);\n }\n function mergeConfigs(parentConfig, childConfig) {\n var res = extend({}, parentConfig),\n prop;\n for (prop in childConfig) {\n if (hasOwnProp(childConfig, prop)) {\n if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) {\n res[prop] = {};\n extend(res[prop], parentConfig[prop]);\n extend(res[prop], childConfig[prop]);\n } else if (childConfig[prop] != null) {\n res[prop] = childConfig[prop];\n } else {\n delete res[prop];\n }\n }\n }\n for (prop in parentConfig) {\n if (hasOwnProp(parentConfig, prop) && !hasOwnProp(childConfig, prop) && isObject(parentConfig[prop])) {\n // make sure changes to properties don't modify parent config\n res[prop] = extend({}, res[prop]);\n }\n }\n return res;\n }\n function Locale(config) {\n if (config != null) {\n this.set(config);\n }\n }\n var keys;\n if (Object.keys) {\n keys = Object.keys;\n } else {\n keys = function (obj) {\n var i,\n res = [];\n for (i in obj) {\n if (hasOwnProp(obj, i)) {\n res.push(i);\n }\n }\n return res;\n };\n }\n var defaultCalendar = {\n sameDay: '[Today at] LT',\n nextDay: '[Tomorrow at] LT',\n nextWeek: 'dddd [at] LT',\n lastDay: '[Yesterday at] LT',\n lastWeek: '[Last] dddd [at] LT',\n sameElse: 'L'\n };\n function calendar(key, mom, now) {\n var output = this._calendar[key] || this._calendar['sameElse'];\n return isFunction(output) ? output.call(mom, now) : output;\n }\n function zeroFill(number, targetLength, forceSign) {\n var absNumber = '' + Math.abs(number),\n zerosToFill = targetLength - absNumber.length,\n sign = number >= 0;\n return (sign ? forceSign ? '+' : '' : '-') + Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + absNumber;\n }\n var formattingTokens = /(\\[[^\\[]*\\])|(\\\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,\n localFormattingTokens = /(\\[[^\\[]*\\])|(\\\\)?(LTS|LT|LL?L?L?|l{1,4})/g,\n formatFunctions = {},\n formatTokenFunctions = {};\n\n // token: 'M'\n // padded: ['MM', 2]\n // ordinal: 'Mo'\n // callback: function () { this.month() + 1 }\n function addFormatToken(token, padded, ordinal, callback) {\n var func = callback;\n if (typeof callback === 'string') {\n func = function () {\n return this[callback]();\n };\n }\n if (token) {\n formatTokenFunctions[token] = func;\n }\n if (padded) {\n formatTokenFunctions[padded[0]] = function () {\n return zeroFill(func.apply(this, arguments), padded[1], padded[2]);\n };\n }\n if (ordinal) {\n formatTokenFunctions[ordinal] = function () {\n return this.localeData().ordinal(func.apply(this, arguments), token);\n };\n }\n }\n function removeFormattingTokens(input) {\n if (input.match(/\\[[\\s\\S]/)) {\n return input.replace(/^\\[|\\]$/g, '');\n }\n return input.replace(/\\\\/g, '');\n }\n function makeFormatFunction(format) {\n var array = format.match(formattingTokens),\n i,\n length;\n for (i = 0, length = array.length; i < length; i++) {\n if (formatTokenFunctions[array[i]]) {\n array[i] = formatTokenFunctions[array[i]];\n } else {\n array[i] = removeFormattingTokens(array[i]);\n }\n }\n return function (mom) {\n var output = '',\n i;\n for (i = 0; i < length; i++) {\n output += isFunction(array[i]) ? array[i].call(mom, format) : array[i];\n }\n return output;\n };\n }\n\n // format date using native date object\n function formatMoment(m, format) {\n if (!m.isValid()) {\n return m.localeData().invalidDate();\n }\n format = expandFormat(format, m.localeData());\n formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format);\n return formatFunctions[format](m);\n }\n function expandFormat(format, locale) {\n var i = 5;\n function replaceLongDateFormatTokens(input) {\n return locale.longDateFormat(input) || input;\n }\n localFormattingTokens.lastIndex = 0;\n while (i >= 0 && localFormattingTokens.test(format)) {\n format = format.replace(localFormattingTokens, replaceLongDateFormatTokens);\n localFormattingTokens.lastIndex = 0;\n i -= 1;\n }\n return format;\n }\n var defaultLongDateFormat = {\n LTS: 'h:mm:ss A',\n LT: 'h:mm A',\n L: 'MM/DD/YYYY',\n LL: 'MMMM D, YYYY',\n LLL: 'MMMM D, YYYY h:mm A',\n LLLL: 'dddd, MMMM D, YYYY h:mm A'\n };\n function longDateFormat(key) {\n var format = this._longDateFormat[key],\n formatUpper = this._longDateFormat[key.toUpperCase()];\n if (format || !formatUpper) {\n return format;\n }\n this._longDateFormat[key] = formatUpper.match(formattingTokens).map(function (tok) {\n if (tok === 'MMMM' || tok === 'MM' || tok === 'DD' || tok === 'dddd') {\n return tok.slice(1);\n }\n return tok;\n }).join('');\n return this._longDateFormat[key];\n }\n var defaultInvalidDate = 'Invalid date';\n function invalidDate() {\n return this._invalidDate;\n }\n var defaultOrdinal = '%d',\n defaultDayOfMonthOrdinalParse = /\\d{1,2}/;\n function ordinal(number) {\n return this._ordinal.replace('%d', number);\n }\n var defaultRelativeTime = {\n future: 'in %s',\n past: '%s ago',\n s: 'a few seconds',\n ss: '%d seconds',\n m: 'a minute',\n mm: '%d minutes',\n h: 'an hour',\n hh: '%d hours',\n d: 'a day',\n dd: '%d days',\n w: 'a week',\n ww: '%d weeks',\n M: 'a month',\n MM: '%d months',\n y: 'a year',\n yy: '%d years'\n };\n function relativeTime(number, withoutSuffix, string, isFuture) {\n var output = this._relativeTime[string];\n return isFunction(output) ? output(number, withoutSuffix, string, isFuture) : output.replace(/%d/i, number);\n }\n function pastFuture(diff, output) {\n var format = this._relativeTime[diff > 0 ? 'future' : 'past'];\n return isFunction(format) ? format(output) : format.replace(/%s/i, output);\n }\n var aliases = {\n D: 'date',\n dates: 'date',\n date: 'date',\n d: 'day',\n days: 'day',\n day: 'day',\n e: 'weekday',\n weekdays: 'weekday',\n weekday: 'weekday',\n E: 'isoWeekday',\n isoweekdays: 'isoWeekday',\n isoweekday: 'isoWeekday',\n DDD: 'dayOfYear',\n dayofyears: 'dayOfYear',\n dayofyear: 'dayOfYear',\n h: 'hour',\n hours: 'hour',\n hour: 'hour',\n ms: 'millisecond',\n milliseconds: 'millisecond',\n millisecond: 'millisecond',\n m: 'minute',\n minutes: 'minute',\n minute: 'minute',\n M: 'month',\n months: 'month',\n month: 'month',\n Q: 'quarter',\n quarters: 'quarter',\n quarter: 'quarter',\n s: 'second',\n seconds: 'second',\n second: 'second',\n gg: 'weekYear',\n weekyears: 'weekYear',\n weekyear: 'weekYear',\n GG: 'isoWeekYear',\n isoweekyears: 'isoWeekYear',\n isoweekyear: 'isoWeekYear',\n w: 'week',\n weeks: 'week',\n week: 'week',\n W: 'isoWeek',\n isoweeks: 'isoWeek',\n isoweek: 'isoWeek',\n y: 'year',\n years: 'year',\n year: 'year'\n };\n function normalizeUnits(units) {\n return typeof units === 'string' ? aliases[units] || aliases[units.toLowerCase()] : undefined;\n }\n function normalizeObjectUnits(inputObject) {\n var normalizedInput = {},\n normalizedProp,\n prop;\n for (prop in inputObject) {\n if (hasOwnProp(inputObject, prop)) {\n normalizedProp = normalizeUnits(prop);\n if (normalizedProp) {\n normalizedInput[normalizedProp] = inputObject[prop];\n }\n }\n }\n return normalizedInput;\n }\n var priorities = {\n date: 9,\n day: 11,\n weekday: 11,\n isoWeekday: 11,\n dayOfYear: 4,\n hour: 13,\n millisecond: 16,\n minute: 14,\n month: 8,\n quarter: 7,\n second: 15,\n weekYear: 1,\n isoWeekYear: 1,\n week: 5,\n isoWeek: 5,\n year: 1\n };\n function getPrioritizedUnits(unitsObj) {\n var units = [],\n u;\n for (u in unitsObj) {\n if (hasOwnProp(unitsObj, u)) {\n units.push({\n unit: u,\n priority: priorities[u]\n });\n }\n }\n units.sort(function (a, b) {\n return a.priority - b.priority;\n });\n return units;\n }\n var match1 = /\\d/,\n // 0 - 9\n match2 = /\\d\\d/,\n // 00 - 99\n match3 = /\\d{3}/,\n // 000 - 999\n match4 = /\\d{4}/,\n // 0000 - 9999\n match6 = /[+-]?\\d{6}/,\n // -999999 - 999999\n match1to2 = /\\d\\d?/,\n // 0 - 99\n match3to4 = /\\d\\d\\d\\d?/,\n // 999 - 9999\n match5to6 = /\\d\\d\\d\\d\\d\\d?/,\n // 99999 - 999999\n match1to3 = /\\d{1,3}/,\n // 0 - 999\n match1to4 = /\\d{1,4}/,\n // 0 - 9999\n match1to6 = /[+-]?\\d{1,6}/,\n // -999999 - 999999\n matchUnsigned = /\\d+/,\n // 0 - inf\n matchSigned = /[+-]?\\d+/,\n // -inf - inf\n matchOffset = /Z|[+-]\\d\\d:?\\d\\d/gi,\n // +00:00 -00:00 +0000 -0000 or Z\n matchShortOffset = /Z|[+-]\\d\\d(?::?\\d\\d)?/gi,\n // +00 -00 +00:00 -00:00 +0000 -0000 or Z\n matchTimestamp = /[+-]?\\d+(\\.\\d{1,3})?/,\n // 123456789 123456789.123\n // any word (or two) characters or numbers including two/three word month in arabic.\n // includes scottish gaelic two word and hyphenated months\n matchWord = /[0-9]{0,256}['a-z\\u00A0-\\u05FF\\u0700-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFF07\\uFF10-\\uFFEF]{1,256}|[\\u0600-\\u06FF\\/]{1,256}(\\s*?[\\u0600-\\u06FF]{1,256}){1,2}/i,\n match1to2NoLeadingZero = /^[1-9]\\d?/,\n // 1-99\n match1to2HasZero = /^([1-9]\\d|\\d)/,\n // 0-99\n regexes;\n regexes = {};\n function addRegexToken(token, regex, strictRegex) {\n regexes[token] = isFunction(regex) ? regex : function (isStrict, localeData) {\n return isStrict && strictRegex ? strictRegex : regex;\n };\n }\n function getParseRegexForToken(token, config) {\n if (!hasOwnProp(regexes, token)) {\n return new RegExp(unescapeFormat(token));\n }\n return regexes[token](config._strict, config._locale);\n }\n\n // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript\n function unescapeFormat(s) {\n return regexEscape(s.replace('\\\\', '').replace(/\\\\(\\[)|\\\\(\\])|\\[([^\\]\\[]*)\\]|\\\\(.)/g, function (matched, p1, p2, p3, p4) {\n return p1 || p2 || p3 || p4;\n }));\n }\n function regexEscape(s) {\n return s.replace(/[-\\/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&');\n }\n function absFloor(number) {\n if (number < 0) {\n // -0 -> 0\n return Math.ceil(number) || 0;\n } else {\n return Math.floor(number);\n }\n }\n function toInt(argumentForCoercion) {\n var coercedNumber = +argumentForCoercion,\n value = 0;\n if (coercedNumber !== 0 && isFinite(coercedNumber)) {\n value = absFloor(coercedNumber);\n }\n return value;\n }\n var tokens = {};\n function addParseToken(token, callback) {\n var i,\n func = callback,\n tokenLen;\n if (typeof token === 'string') {\n token = [token];\n }\n if (isNumber(callback)) {\n func = function (input, array) {\n array[callback] = toInt(input);\n };\n }\n tokenLen = token.length;\n for (i = 0; i < tokenLen; i++) {\n tokens[token[i]] = func;\n }\n }\n function addWeekParseToken(token, callback) {\n addParseToken(token, function (input, array, config, token) {\n config._w = config._w || {};\n callback(input, config._w, config, token);\n });\n }\n function addTimeToArrayFromToken(token, input, config) {\n if (input != null && hasOwnProp(tokens, token)) {\n tokens[token](input, config._a, config, token);\n }\n }\n function isLeapYear(year) {\n return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0;\n }\n var YEAR = 0,\n MONTH = 1,\n DATE = 2,\n HOUR = 3,\n MINUTE = 4,\n SECOND = 5,\n MILLISECOND = 6,\n WEEK = 7,\n WEEKDAY = 8;\n\n // FORMATTING\n\n addFormatToken('Y', 0, 0, function () {\n var y = this.year();\n return y <= 9999 ? zeroFill(y, 4) : '+' + y;\n });\n addFormatToken(0, ['YY', 2], 0, function () {\n return this.year() % 100;\n });\n addFormatToken(0, ['YYYY', 4], 0, 'year');\n addFormatToken(0, ['YYYYY', 5], 0, 'year');\n addFormatToken(0, ['YYYYYY', 6, true], 0, 'year');\n\n // PARSING\n\n addRegexToken('Y', matchSigned);\n addRegexToken('YY', match1to2, match2);\n addRegexToken('YYYY', match1to4, match4);\n addRegexToken('YYYYY', match1to6, match6);\n addRegexToken('YYYYYY', match1to6, match6);\n addParseToken(['YYYYY', 'YYYYYY'], YEAR);\n addParseToken('YYYY', function (input, array) {\n array[YEAR] = input.length === 2 ? hooks.parseTwoDigitYear(input) : toInt(input);\n });\n addParseToken('YY', function (input, array) {\n array[YEAR] = hooks.parseTwoDigitYear(input);\n });\n addParseToken('Y', function (input, array) {\n array[YEAR] = parseInt(input, 10);\n });\n\n // HELPERS\n\n function daysInYear(year) {\n return isLeapYear(year) ? 366 : 365;\n }\n\n // HOOKS\n\n hooks.parseTwoDigitYear = function (input) {\n return toInt(input) + (toInt(input) > 68 ? 1900 : 2000);\n };\n\n // MOMENTS\n\n var getSetYear = makeGetSet('FullYear', true);\n function getIsLeapYear() {\n return isLeapYear(this.year());\n }\n function makeGetSet(unit, keepTime) {\n return function (value) {\n if (value != null) {\n set$1(this, unit, value);\n hooks.updateOffset(this, keepTime);\n return this;\n } else {\n return get(this, unit);\n }\n };\n }\n function get(mom, unit) {\n if (!mom.isValid()) {\n return NaN;\n }\n var d = mom._d,\n isUTC = mom._isUTC;\n switch (unit) {\n case 'Milliseconds':\n return isUTC ? d.getUTCMilliseconds() : d.getMilliseconds();\n case 'Seconds':\n return isUTC ? d.getUTCSeconds() : d.getSeconds();\n case 'Minutes':\n return isUTC ? d.getUTCMinutes() : d.getMinutes();\n case 'Hours':\n return isUTC ? d.getUTCHours() : d.getHours();\n case 'Date':\n return isUTC ? d.getUTCDate() : d.getDate();\n case 'Day':\n return isUTC ? d.getUTCDay() : d.getDay();\n case 'Month':\n return isUTC ? d.getUTCMonth() : d.getMonth();\n case 'FullYear':\n return isUTC ? d.getUTCFullYear() : d.getFullYear();\n default:\n return NaN;\n // Just in case\n }\n }\n function set$1(mom, unit, value) {\n var d, isUTC, year, month, date;\n if (!mom.isValid() || isNaN(value)) {\n return;\n }\n d = mom._d;\n isUTC = mom._isUTC;\n switch (unit) {\n case 'Milliseconds':\n return void (isUTC ? d.setUTCMilliseconds(value) : d.setMilliseconds(value));\n case 'Seconds':\n return void (isUTC ? d.setUTCSeconds(value) : d.setSeconds(value));\n case 'Minutes':\n return void (isUTC ? d.setUTCMinutes(value) : d.setMinutes(value));\n case 'Hours':\n return void (isUTC ? d.setUTCHours(value) : d.setHours(value));\n case 'Date':\n return void (isUTC ? d.setUTCDate(value) : d.setDate(value));\n // case 'Day': // Not real\n // return void (isUTC ? d.setUTCDay(value) : d.setDay(value));\n // case 'Month': // Not used because we need to pass two variables\n // return void (isUTC ? d.setUTCMonth(value) : d.setMonth(value));\n case 'FullYear':\n break;\n // See below ...\n default:\n return;\n // Just in case\n }\n year = value;\n month = mom.month();\n date = mom.date();\n date = date === 29 && month === 1 && !isLeapYear(year) ? 28 : date;\n void (isUTC ? d.setUTCFullYear(year, month, date) : d.setFullYear(year, month, date));\n }\n\n // MOMENTS\n\n function stringGet(units) {\n units = normalizeUnits(units);\n if (isFunction(this[units])) {\n return this[units]();\n }\n return this;\n }\n function stringSet(units, value) {\n if (typeof units === 'object') {\n units = normalizeObjectUnits(units);\n var prioritized = getPrioritizedUnits(units),\n i,\n prioritizedLen = prioritized.length;\n for (i = 0; i < prioritizedLen; i++) {\n this[prioritized[i].unit](units[prioritized[i].unit]);\n }\n } else {\n units = normalizeUnits(units);\n if (isFunction(this[units])) {\n return this[units](value);\n }\n }\n return this;\n }\n function mod(n, x) {\n return (n % x + x) % x;\n }\n var indexOf;\n if (Array.prototype.indexOf) {\n indexOf = Array.prototype.indexOf;\n } else {\n indexOf = function (o) {\n // I know\n var i;\n for (i = 0; i < this.length; ++i) {\n if (this[i] === o) {\n return i;\n }\n }\n return -1;\n };\n }\n function daysInMonth(year, month) {\n if (isNaN(year) || isNaN(month)) {\n return NaN;\n }\n var modMonth = mod(month, 12);\n year += (month - modMonth) / 12;\n return modMonth === 1 ? isLeapYear(year) ? 29 : 28 : 31 - modMonth % 7 % 2;\n }\n\n // FORMATTING\n\n addFormatToken('M', ['MM', 2], 'Mo', function () {\n return this.month() + 1;\n });\n addFormatToken('MMM', 0, 0, function (format) {\n return this.localeData().monthsShort(this, format);\n });\n addFormatToken('MMMM', 0, 0, function (format) {\n return this.localeData().months(this, format);\n });\n\n // PARSING\n\n addRegexToken('M', match1to2, match1to2NoLeadingZero);\n addRegexToken('MM', match1to2, match2);\n addRegexToken('MMM', function (isStrict, locale) {\n return locale.monthsShortRegex(isStrict);\n });\n addRegexToken('MMMM', function (isStrict, locale) {\n return locale.monthsRegex(isStrict);\n });\n addParseToken(['M', 'MM'], function (input, array) {\n array[MONTH] = toInt(input) - 1;\n });\n addParseToken(['MMM', 'MMMM'], function (input, array, config, token) {\n var month = config._locale.monthsParse(input, token, config._strict);\n // if we didn't find a month name, mark the date as invalid.\n if (month != null) {\n array[MONTH] = month;\n } else {\n getParsingFlags(config).invalidMonth = input;\n }\n });\n\n // LOCALES\n\n var defaultLocaleMonths = 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'),\n defaultLocaleMonthsShort = 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'),\n MONTHS_IN_FORMAT = /D[oD]?(\\[[^\\[\\]]*\\]|\\s)+MMMM?/,\n defaultMonthsShortRegex = matchWord,\n defaultMonthsRegex = matchWord;\n function localeMonths(m, format) {\n if (!m) {\n return isArray(this._months) ? this._months : this._months['standalone'];\n }\n return isArray(this._months) ? this._months[m.month()] : this._months[(this._months.isFormat || MONTHS_IN_FORMAT).test(format) ? 'format' : 'standalone'][m.month()];\n }\n function localeMonthsShort(m, format) {\n if (!m) {\n return isArray(this._monthsShort) ? this._monthsShort : this._monthsShort['standalone'];\n }\n return isArray(this._monthsShort) ? this._monthsShort[m.month()] : this._monthsShort[MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone'][m.month()];\n }\n function handleStrictParse(monthName, format, strict) {\n var i,\n ii,\n mom,\n llc = monthName.toLocaleLowerCase();\n if (!this._monthsParse) {\n // this is not used\n this._monthsParse = [];\n this._longMonthsParse = [];\n this._shortMonthsParse = [];\n for (i = 0; i < 12; ++i) {\n mom = createUTC([2000, i]);\n this._shortMonthsParse[i] = this.monthsShort(mom, '').toLocaleLowerCase();\n this._longMonthsParse[i] = this.months(mom, '').toLocaleLowerCase();\n }\n }\n if (strict) {\n if (format === 'MMM') {\n ii = indexOf.call(this._shortMonthsParse, llc);\n return ii !== -1 ? ii : null;\n } else {\n ii = indexOf.call(this._longMonthsParse, llc);\n return ii !== -1 ? ii : null;\n }\n } else {\n if (format === 'MMM') {\n ii = indexOf.call(this._shortMonthsParse, llc);\n if (ii !== -1) {\n return ii;\n }\n ii = indexOf.call(this._longMonthsParse, llc);\n return ii !== -1 ? ii : null;\n } else {\n ii = indexOf.call(this._longMonthsParse, llc);\n if (ii !== -1) {\n return ii;\n }\n ii = indexOf.call(this._shortMonthsParse, llc);\n return ii !== -1 ? ii : null;\n }\n }\n }\n function localeMonthsParse(monthName, format, strict) {\n var i, mom, regex;\n if (this._monthsParseExact) {\n return handleStrictParse.call(this, monthName, format, strict);\n }\n if (!this._monthsParse) {\n this._monthsParse = [];\n this._longMonthsParse = [];\n this._shortMonthsParse = [];\n }\n\n // TODO: add sorting\n // Sorting makes sure if one month (or abbr) is a prefix of another\n // see sorting in computeMonthsParse\n for (i = 0; i < 12; i++) {\n // make the regex if we don't have it already\n mom = createUTC([2000, i]);\n if (strict && !this._longMonthsParse[i]) {\n this._longMonthsParse[i] = new RegExp('^' + this.months(mom, '').replace('.', '') + '$', 'i');\n this._shortMonthsParse[i] = new RegExp('^' + this.monthsShort(mom, '').replace('.', '') + '$', 'i');\n }\n if (!strict && !this._monthsParse[i]) {\n regex = '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, '');\n this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i');\n }\n // test the regex\n if (strict && format === 'MMMM' && this._longMonthsParse[i].test(monthName)) {\n return i;\n } else if (strict && format === 'MMM' && this._shortMonthsParse[i].test(monthName)) {\n return i;\n } else if (!strict && this._monthsParse[i].test(monthName)) {\n return i;\n }\n }\n }\n\n // MOMENTS\n\n function setMonth(mom, value) {\n if (!mom.isValid()) {\n // No op\n return mom;\n }\n if (typeof value === 'string') {\n if (/^\\d+$/.test(value)) {\n value = toInt(value);\n } else {\n value = mom.localeData().monthsParse(value);\n // TODO: Another silent failure?\n if (!isNumber(value)) {\n return mom;\n }\n }\n }\n var month = value,\n date = mom.date();\n date = date < 29 ? date : Math.min(date, daysInMonth(mom.year(), month));\n void (mom._isUTC ? mom._d.setUTCMonth(month, date) : mom._d.setMonth(month, date));\n return mom;\n }\n function getSetMonth(value) {\n if (value != null) {\n setMonth(this, value);\n hooks.updateOffset(this, true);\n return this;\n } else {\n return get(this, 'Month');\n }\n }\n function getDaysInMonth() {\n return daysInMonth(this.year(), this.month());\n }\n function monthsShortRegex(isStrict) {\n if (this._monthsParseExact) {\n if (!hasOwnProp(this, '_monthsRegex')) {\n computeMonthsParse.call(this);\n }\n if (isStrict) {\n return this._monthsShortStrictRegex;\n } else {\n return this._monthsShortRegex;\n }\n } else {\n if (!hasOwnProp(this, '_monthsShortRegex')) {\n this._monthsShortRegex = defaultMonthsShortRegex;\n }\n return this._monthsShortStrictRegex && isStrict ? this._monthsShortStrictRegex : this._monthsShortRegex;\n }\n }\n function monthsRegex(isStrict) {\n if (this._monthsParseExact) {\n if (!hasOwnProp(this, '_monthsRegex')) {\n computeMonthsParse.call(this);\n }\n if (isStrict) {\n return this._monthsStrictRegex;\n } else {\n return this._monthsRegex;\n }\n } else {\n if (!hasOwnProp(this, '_monthsRegex')) {\n this._monthsRegex = defaultMonthsRegex;\n }\n return this._monthsStrictRegex && isStrict ? this._monthsStrictRegex : this._monthsRegex;\n }\n }\n function computeMonthsParse() {\n function cmpLenRev(a, b) {\n return b.length - a.length;\n }\n var shortPieces = [],\n longPieces = [],\n mixedPieces = [],\n i,\n mom,\n shortP,\n longP;\n for (i = 0; i < 12; i++) {\n // make the regex if we don't have it already\n mom = createUTC([2000, i]);\n shortP = regexEscape(this.monthsShort(mom, ''));\n longP = regexEscape(this.months(mom, ''));\n shortPieces.push(shortP);\n longPieces.push(longP);\n mixedPieces.push(longP);\n mixedPieces.push(shortP);\n }\n // Sorting makes sure if one month (or abbr) is a prefix of another it\n // will match the longer piece.\n shortPieces.sort(cmpLenRev);\n longPieces.sort(cmpLenRev);\n mixedPieces.sort(cmpLenRev);\n this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');\n this._monthsShortRegex = this._monthsRegex;\n this._monthsStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i');\n this._monthsShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i');\n }\n function createDate(y, m, d, h, M, s, ms) {\n // can't just apply() to create a date:\n // https://stackoverflow.com/q/181348\n var date;\n // the date constructor remaps years 0-99 to 1900-1999\n if (y < 100 && y >= 0) {\n // preserve leap years using a full 400 year cycle, then reset\n date = new Date(y + 400, m, d, h, M, s, ms);\n if (isFinite(date.getFullYear())) {\n date.setFullYear(y);\n }\n } else {\n date = new Date(y, m, d, h, M, s, ms);\n }\n return date;\n }\n function createUTCDate(y) {\n var date, args;\n // the Date.UTC function remaps years 0-99 to 1900-1999\n if (y < 100 && y >= 0) {\n args = Array.prototype.slice.call(arguments);\n // preserve leap years using a full 400 year cycle, then reset\n args[0] = y + 400;\n date = new Date(Date.UTC.apply(null, args));\n if (isFinite(date.getUTCFullYear())) {\n date.setUTCFullYear(y);\n }\n } else {\n date = new Date(Date.UTC.apply(null, arguments));\n }\n return date;\n }\n\n // start-of-first-week - start-of-year\n function firstWeekOffset(year, dow, doy) {\n var\n // first-week day -- which january is always in the first week (4 for iso, 1 for other)\n fwd = 7 + dow - doy,\n // first-week day local weekday -- which local weekday is fwd\n fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7;\n return -fwdlw + fwd - 1;\n }\n\n // https://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday\n function dayOfYearFromWeeks(year, week, weekday, dow, doy) {\n var localWeekday = (7 + weekday - dow) % 7,\n weekOffset = firstWeekOffset(year, dow, doy),\n dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset,\n resYear,\n resDayOfYear;\n if (dayOfYear <= 0) {\n resYear = year - 1;\n resDayOfYear = daysInYear(resYear) + dayOfYear;\n } else if (dayOfYear > daysInYear(year)) {\n resYear = year + 1;\n resDayOfYear = dayOfYear - daysInYear(year);\n } else {\n resYear = year;\n resDayOfYear = dayOfYear;\n }\n return {\n year: resYear,\n dayOfYear: resDayOfYear\n };\n }\n function weekOfYear(mom, dow, doy) {\n var weekOffset = firstWeekOffset(mom.year(), dow, doy),\n week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1,\n resWeek,\n resYear;\n if (week < 1) {\n resYear = mom.year() - 1;\n resWeek = week + weeksInYear(resYear, dow, doy);\n } else if (week > weeksInYear(mom.year(), dow, doy)) {\n resWeek = week - weeksInYear(mom.year(), dow, doy);\n resYear = mom.year() + 1;\n } else {\n resYear = mom.year();\n resWeek = week;\n }\n return {\n week: resWeek,\n year: resYear\n };\n }\n function weeksInYear(year, dow, doy) {\n var weekOffset = firstWeekOffset(year, dow, doy),\n weekOffsetNext = firstWeekOffset(year + 1, dow, doy);\n return (daysInYear(year) - weekOffset + weekOffsetNext) / 7;\n }\n\n // FORMATTING\n\n addFormatToken('w', ['ww', 2], 'wo', 'week');\n addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek');\n\n // PARSING\n\n addRegexToken('w', match1to2, match1to2NoLeadingZero);\n addRegexToken('ww', match1to2, match2);\n addRegexToken('W', match1to2, match1to2NoLeadingZero);\n addRegexToken('WW', match1to2, match2);\n addWeekParseToken(['w', 'ww', 'W', 'WW'], function (input, week, config, token) {\n week[token.substr(0, 1)] = toInt(input);\n });\n\n // HELPERS\n\n // LOCALES\n\n function localeWeek(mom) {\n return weekOfYear(mom, this._week.dow, this._week.doy).week;\n }\n var defaultLocaleWeek = {\n dow: 0,\n // Sunday is the first day of the week.\n doy: 6 // The week that contains Jan 6th is the first week of the year.\n };\n function localeFirstDayOfWeek() {\n return this._week.dow;\n }\n function localeFirstDayOfYear() {\n return this._week.doy;\n }\n\n // MOMENTS\n\n function getSetWeek(input) {\n var week = this.localeData().week(this);\n return input == null ? week : this.add((input - week) * 7, 'd');\n }\n function getSetISOWeek(input) {\n var week = weekOfYear(this, 1, 4).week;\n return input == null ? week : this.add((input - week) * 7, 'd');\n }\n\n // FORMATTING\n\n addFormatToken('d', 0, 'do', 'day');\n addFormatToken('dd', 0, 0, function (format) {\n return this.localeData().weekdaysMin(this, format);\n });\n addFormatToken('ddd', 0, 0, function (format) {\n return this.localeData().weekdaysShort(this, format);\n });\n addFormatToken('dddd', 0, 0, function (format) {\n return this.localeData().weekdays(this, format);\n });\n addFormatToken('e', 0, 0, 'weekday');\n addFormatToken('E', 0, 0, 'isoWeekday');\n\n // PARSING\n\n addRegexToken('d', match1to2);\n addRegexToken('e', match1to2);\n addRegexToken('E', match1to2);\n addRegexToken('dd', function (isStrict, locale) {\n return locale.weekdaysMinRegex(isStrict);\n });\n addRegexToken('ddd', function (isStrict, locale) {\n return locale.weekdaysShortRegex(isStrict);\n });\n addRegexToken('dddd', function (isStrict, locale) {\n return locale.weekdaysRegex(isStrict);\n });\n addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config, token) {\n var weekday = config._locale.weekdaysParse(input, token, config._strict);\n // if we didn't get a weekday name, mark the date as invalid\n if (weekday != null) {\n week.d = weekday;\n } else {\n getParsingFlags(config).invalidWeekday = input;\n }\n });\n addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) {\n week[token] = toInt(input);\n });\n\n // HELPERS\n\n function parseWeekday(input, locale) {\n if (typeof input !== 'string') {\n return input;\n }\n if (!isNaN(input)) {\n return parseInt(input, 10);\n }\n input = locale.weekdaysParse(input);\n if (typeof input === 'number') {\n return input;\n }\n return null;\n }\n function parseIsoWeekday(input, locale) {\n if (typeof input === 'string') {\n return locale.weekdaysParse(input) % 7 || 7;\n }\n return isNaN(input) ? null : input;\n }\n\n // LOCALES\n function shiftWeekdays(ws, n) {\n return ws.slice(n, 7).concat(ws.slice(0, n));\n }\n var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'),\n defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'),\n defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'),\n defaultWeekdaysRegex = matchWord,\n defaultWeekdaysShortRegex = matchWord,\n defaultWeekdaysMinRegex = matchWord;\n function localeWeekdays(m, format) {\n var weekdays = isArray(this._weekdays) ? this._weekdays : this._weekdays[m && m !== true && this._weekdays.isFormat.test(format) ? 'format' : 'standalone'];\n return m === true ? shiftWeekdays(weekdays, this._week.dow) : m ? weekdays[m.day()] : weekdays;\n }\n function localeWeekdaysShort(m) {\n return m === true ? shiftWeekdays(this._weekdaysShort, this._week.dow) : m ? this._weekdaysShort[m.day()] : this._weekdaysShort;\n }\n function localeWeekdaysMin(m) {\n return m === true ? shiftWeekdays(this._weekdaysMin, this._week.dow) : m ? this._weekdaysMin[m.day()] : this._weekdaysMin;\n }\n function handleStrictParse$1(weekdayName, format, strict) {\n var i,\n ii,\n mom,\n llc = weekdayName.toLocaleLowerCase();\n if (!this._weekdaysParse) {\n this._weekdaysParse = [];\n this._shortWeekdaysParse = [];\n this._minWeekdaysParse = [];\n for (i = 0; i < 7; ++i) {\n mom = createUTC([2000, 1]).day(i);\n this._minWeekdaysParse[i] = this.weekdaysMin(mom, '').toLocaleLowerCase();\n this._shortWeekdaysParse[i] = this.weekdaysShort(mom, '').toLocaleLowerCase();\n this._weekdaysParse[i] = this.weekdays(mom, '').toLocaleLowerCase();\n }\n }\n if (strict) {\n if (format === 'dddd') {\n ii = indexOf.call(this._weekdaysParse, llc);\n return ii !== -1 ? ii : null;\n } else if (format === 'ddd') {\n ii = indexOf.call(this._shortWeekdaysParse, llc);\n return ii !== -1 ? ii : null;\n } else {\n ii = indexOf.call(this._minWeekdaysParse, llc);\n return ii !== -1 ? ii : null;\n }\n } else {\n if (format === 'dddd') {\n ii = indexOf.call(this._weekdaysParse, llc);\n if (ii !== -1) {\n return ii;\n }\n ii = indexOf.call(this._shortWeekdaysParse, llc);\n if (ii !== -1) {\n return ii;\n }\n ii = indexOf.call(this._minWeekdaysParse, llc);\n return ii !== -1 ? ii : null;\n } else if (format === 'ddd') {\n ii = indexOf.call(this._shortWeekdaysParse, llc);\n if (ii !== -1) {\n return ii;\n }\n ii = indexOf.call(this._weekdaysParse, llc);\n if (ii !== -1) {\n return ii;\n }\n ii = indexOf.call(this._minWeekdaysParse, llc);\n return ii !== -1 ? ii : null;\n } else {\n ii = indexOf.call(this._minWeekdaysParse, llc);\n if (ii !== -1) {\n return ii;\n }\n ii = indexOf.call(this._weekdaysParse, llc);\n if (ii !== -1) {\n return ii;\n }\n ii = indexOf.call(this._shortWeekdaysParse, llc);\n return ii !== -1 ? ii : null;\n }\n }\n }\n function localeWeekdaysParse(weekdayName, format, strict) {\n var i, mom, regex;\n if (this._weekdaysParseExact) {\n return handleStrictParse$1.call(this, weekdayName, format, strict);\n }\n if (!this._weekdaysParse) {\n this._weekdaysParse = [];\n this._minWeekdaysParse = [];\n this._shortWeekdaysParse = [];\n this._fullWeekdaysParse = [];\n }\n for (i = 0; i < 7; i++) {\n // make the regex if we don't have it already\n\n mom = createUTC([2000, 1]).day(i);\n if (strict && !this._fullWeekdaysParse[i]) {\n this._fullWeekdaysParse[i] = new RegExp('^' + this.weekdays(mom, '').replace('.', '\\\\.?') + '$', 'i');\n this._shortWeekdaysParse[i] = new RegExp('^' + this.weekdaysShort(mom, '').replace('.', '\\\\.?') + '$', 'i');\n this._minWeekdaysParse[i] = new RegExp('^' + this.weekdaysMin(mom, '').replace('.', '\\\\.?') + '$', 'i');\n }\n if (!this._weekdaysParse[i]) {\n regex = '^' + this.weekdays(mom, '') + '|^' + this.weekdaysShort(mom, '') + '|^' + this.weekdaysMin(mom, '');\n this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i');\n }\n // test the regex\n if (strict && format === 'dddd' && this._fullWeekdaysParse[i].test(weekdayName)) {\n return i;\n } else if (strict && format === 'ddd' && this._shortWeekdaysParse[i].test(weekdayName)) {\n return i;\n } else if (strict && format === 'dd' && this._minWeekdaysParse[i].test(weekdayName)) {\n return i;\n } else if (!strict && this._weekdaysParse[i].test(weekdayName)) {\n return i;\n }\n }\n }\n\n // MOMENTS\n\n function getSetDayOfWeek(input) {\n if (!this.isValid()) {\n return input != null ? this : NaN;\n }\n var day = get(this, 'Day');\n if (input != null) {\n input = parseWeekday(input, this.localeData());\n return this.add(input - day, 'd');\n } else {\n return day;\n }\n }\n function getSetLocaleDayOfWeek(input) {\n if (!this.isValid()) {\n return input != null ? this : NaN;\n }\n var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7;\n return input == null ? weekday : this.add(input - weekday, 'd');\n }\n function getSetISODayOfWeek(input) {\n if (!this.isValid()) {\n return input != null ? this : NaN;\n }\n\n // behaves the same as moment#day except\n // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6)\n // as a setter, sunday should belong to the previous week.\n\n if (input != null) {\n var weekday = parseIsoWeekday(input, this.localeData());\n return this.day(this.day() % 7 ? weekday : weekday - 7);\n } else {\n return this.day() || 7;\n }\n }\n function weekdaysRegex(isStrict) {\n if (this._weekdaysParseExact) {\n if (!hasOwnProp(this, '_weekdaysRegex')) {\n computeWeekdaysParse.call(this);\n }\n if (isStrict) {\n return this._weekdaysStrictRegex;\n } else {\n return this._weekdaysRegex;\n }\n } else {\n if (!hasOwnProp(this, '_weekdaysRegex')) {\n this._weekdaysRegex = defaultWeekdaysRegex;\n }\n return this._weekdaysStrictRegex && isStrict ? this._weekdaysStrictRegex : this._weekdaysRegex;\n }\n }\n function weekdaysShortRegex(isStrict) {\n if (this._weekdaysParseExact) {\n if (!hasOwnProp(this, '_weekdaysRegex')) {\n computeWeekdaysParse.call(this);\n }\n if (isStrict) {\n return this._weekdaysShortStrictRegex;\n } else {\n return this._weekdaysShortRegex;\n }\n } else {\n if (!hasOwnProp(this, '_weekdaysShortRegex')) {\n this._weekdaysShortRegex = defaultWeekdaysShortRegex;\n }\n return this._weekdaysShortStrictRegex && isStrict ? this._weekdaysShortStrictRegex : this._weekdaysShortRegex;\n }\n }\n function weekdaysMinRegex(isStrict) {\n if (this._weekdaysParseExact) {\n if (!hasOwnProp(this, '_weekdaysRegex')) {\n computeWeekdaysParse.call(this);\n }\n if (isStrict) {\n return this._weekdaysMinStrictRegex;\n } else {\n return this._weekdaysMinRegex;\n }\n } else {\n if (!hasOwnProp(this, '_weekdaysMinRegex')) {\n this._weekdaysMinRegex = defaultWeekdaysMinRegex;\n }\n return this._weekdaysMinStrictRegex && isStrict ? this._weekdaysMinStrictRegex : this._weekdaysMinRegex;\n }\n }\n function computeWeekdaysParse() {\n function cmpLenRev(a, b) {\n return b.length - a.length;\n }\n var minPieces = [],\n shortPieces = [],\n longPieces = [],\n mixedPieces = [],\n i,\n mom,\n minp,\n shortp,\n longp;\n for (i = 0; i < 7; i++) {\n // make the regex if we don't have it already\n mom = createUTC([2000, 1]).day(i);\n minp = regexEscape(this.weekdaysMin(mom, ''));\n shortp = regexEscape(this.weekdaysShort(mom, ''));\n longp = regexEscape(this.weekdays(mom, ''));\n minPieces.push(minp);\n shortPieces.push(shortp);\n longPieces.push(longp);\n mixedPieces.push(minp);\n mixedPieces.push(shortp);\n mixedPieces.push(longp);\n }\n // Sorting makes sure if one weekday (or abbr) is a prefix of another it\n // will match the longer piece.\n minPieces.sort(cmpLenRev);\n shortPieces.sort(cmpLenRev);\n longPieces.sort(cmpLenRev);\n mixedPieces.sort(cmpLenRev);\n this._weekdaysRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');\n this._weekdaysShortRegex = this._weekdaysRegex;\n this._weekdaysMinRegex = this._weekdaysRegex;\n this._weekdaysStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i');\n this._weekdaysShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i');\n this._weekdaysMinStrictRegex = new RegExp('^(' + minPieces.join('|') + ')', 'i');\n }\n\n // FORMATTING\n\n function hFormat() {\n return this.hours() % 12 || 12;\n }\n function kFormat() {\n return this.hours() || 24;\n }\n addFormatToken('H', ['HH', 2], 0, 'hour');\n addFormatToken('h', ['hh', 2], 0, hFormat);\n addFormatToken('k', ['kk', 2], 0, kFormat);\n addFormatToken('hmm', 0, 0, function () {\n return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2);\n });\n addFormatToken('hmmss', 0, 0, function () {\n return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2) + zeroFill(this.seconds(), 2);\n });\n addFormatToken('Hmm', 0, 0, function () {\n return '' + this.hours() + zeroFill(this.minutes(), 2);\n });\n addFormatToken('Hmmss', 0, 0, function () {\n return '' + this.hours() + zeroFill(this.minutes(), 2) + zeroFill(this.seconds(), 2);\n });\n function meridiem(token, lowercase) {\n addFormatToken(token, 0, 0, function () {\n return this.localeData().meridiem(this.hours(), this.minutes(), lowercase);\n });\n }\n meridiem('a', true);\n meridiem('A', false);\n\n // PARSING\n\n function matchMeridiem(isStrict, locale) {\n return locale._meridiemParse;\n }\n addRegexToken('a', matchMeridiem);\n addRegexToken('A', matchMeridiem);\n addRegexToken('H', match1to2, match1to2HasZero);\n addRegexToken('h', match1to2, match1to2NoLeadingZero);\n addRegexToken('k', match1to2, match1to2NoLeadingZero);\n addRegexToken('HH', match1to2, match2);\n addRegexToken('hh', match1to2, match2);\n addRegexToken('kk', match1to2, match2);\n addRegexToken('hmm', match3to4);\n addRegexToken('hmmss', match5to6);\n addRegexToken('Hmm', match3to4);\n addRegexToken('Hmmss', match5to6);\n addParseToken(['H', 'HH'], HOUR);\n addParseToken(['k', 'kk'], function (input, array, config) {\n var kInput = toInt(input);\n array[HOUR] = kInput === 24 ? 0 : kInput;\n });\n addParseToken(['a', 'A'], function (input, array, config) {\n config._isPm = config._locale.isPM(input);\n config._meridiem = input;\n });\n addParseToken(['h', 'hh'], function (input, array, config) {\n array[HOUR] = toInt(input);\n getParsingFlags(config).bigHour = true;\n });\n addParseToken('hmm', function (input, array, config) {\n var pos = input.length - 2;\n array[HOUR] = toInt(input.substr(0, pos));\n array[MINUTE] = toInt(input.substr(pos));\n getParsingFlags(config).bigHour = true;\n });\n addParseToken('hmmss', function (input, array, config) {\n var pos1 = input.length - 4,\n pos2 = input.length - 2;\n array[HOUR] = toInt(input.substr(0, pos1));\n array[MINUTE] = toInt(input.substr(pos1, 2));\n array[SECOND] = toInt(input.substr(pos2));\n getParsingFlags(config).bigHour = true;\n });\n addParseToken('Hmm', function (input, array, config) {\n var pos = input.length - 2;\n array[HOUR] = toInt(input.substr(0, pos));\n array[MINUTE] = toInt(input.substr(pos));\n });\n addParseToken('Hmmss', function (input, array, config) {\n var pos1 = input.length - 4,\n pos2 = input.length - 2;\n array[HOUR] = toInt(input.substr(0, pos1));\n array[MINUTE] = toInt(input.substr(pos1, 2));\n array[SECOND] = toInt(input.substr(pos2));\n });\n\n // LOCALES\n\n function localeIsPM(input) {\n // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays\n // Using charAt should be more compatible.\n return (input + '').toLowerCase().charAt(0) === 'p';\n }\n var defaultLocaleMeridiemParse = /[ap]\\.?m?\\.?/i,\n // Setting the hour should keep the time, because the user explicitly\n // specified which hour they want. So trying to maintain the same hour (in\n // a new timezone) makes sense. Adding/subtracting hours does not follow\n // this rule.\n getSetHour = makeGetSet('Hours', true);\n function localeMeridiem(hours, minutes, isLower) {\n if (hours > 11) {\n return isLower ? 'pm' : 'PM';\n } else {\n return isLower ? 'am' : 'AM';\n }\n }\n var baseConfig = {\n calendar: defaultCalendar,\n longDateFormat: defaultLongDateFormat,\n invalidDate: defaultInvalidDate,\n ordinal: defaultOrdinal,\n dayOfMonthOrdinalParse: defaultDayOfMonthOrdinalParse,\n relativeTime: defaultRelativeTime,\n months: defaultLocaleMonths,\n monthsShort: defaultLocaleMonthsShort,\n week: defaultLocaleWeek,\n weekdays: defaultLocaleWeekdays,\n weekdaysMin: defaultLocaleWeekdaysMin,\n weekdaysShort: defaultLocaleWeekdaysShort,\n meridiemParse: defaultLocaleMeridiemParse\n };\n\n // internal storage for locale config files\n var locales = {},\n localeFamilies = {},\n globalLocale;\n function commonPrefix(arr1, arr2) {\n var i,\n minl = Math.min(arr1.length, arr2.length);\n for (i = 0; i < minl; i += 1) {\n if (arr1[i] !== arr2[i]) {\n return i;\n }\n }\n return minl;\n }\n function normalizeLocale(key) {\n return key ? key.toLowerCase().replace('_', '-') : key;\n }\n\n // pick the locale from the array\n // try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each\n // substring from most specific to least, but move to the next array item if it's a more specific variant than the current root\n function chooseLocale(names) {\n var i = 0,\n j,\n next,\n locale,\n split;\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (next && next.length >= j && commonPrefix(split, next) >= j - 1) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return globalLocale;\n }\n function isLocaleNameSane(name) {\n // Prevent names that look like filesystem paths, i.e contain '/' or '\\'\n // Ensure name is available and function returns boolean\n return !!(name && name.match('^[^/\\\\\\\\]*$'));\n }\n function loadLocale(name) {\n var oldLocale = null,\n aliasedRequire;\n // TODO: Find a better way to register and load all the locales in Node\n if (locales[name] === undefined && typeof module !== 'undefined' && module && module.exports && isLocaleNameSane(name)) {\n try {\n oldLocale = globalLocale._abbr;\n aliasedRequire = require;\n aliasedRequire('./locale/' + name);\n getSetGlobalLocale(oldLocale);\n } catch (e) {\n // mark as not found to avoid repeating expensive file require call causing high CPU\n // when trying to find en-US, en_US, en-us for every format call\n locales[name] = null; // null means not found\n }\n }\n return locales[name];\n }\n\n // This function will load locale and then set the global locale. If\n // no arguments are passed in, it will simply return the current global\n // locale key.\n function getSetGlobalLocale(key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n } else {\n data = defineLocale(key, values);\n }\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n } else {\n if (typeof console !== 'undefined' && console.warn) {\n //warn user if arguments are passed but the locale could not be set\n console.warn('Locale ' + key + ' not found. Did you forget to load it?');\n }\n }\n }\n return globalLocale._abbr;\n }\n function defineLocale(name, config) {\n if (config !== null) {\n var locale,\n parentConfig = baseConfig;\n config.abbr = name;\n if (locales[name] != null) {\n deprecateSimple('defineLocaleOverride', 'use moment.updateLocale(localeName, config) to change ' + 'an existing locale. moment.defineLocale(localeName, ' + 'config) should only be used for creating a new locale ' + 'See http://momentjs.com/guides/#/warnings/define-locale/ for more info.');\n parentConfig = locales[name]._config;\n } else if (config.parentLocale != null) {\n if (locales[config.parentLocale] != null) {\n parentConfig = locales[config.parentLocale]._config;\n } else {\n locale = loadLocale(config.parentLocale);\n if (locale != null) {\n parentConfig = locale._config;\n } else {\n if (!localeFamilies[config.parentLocale]) {\n localeFamilies[config.parentLocale] = [];\n }\n localeFamilies[config.parentLocale].push({\n name: name,\n config: config\n });\n return null;\n }\n }\n }\n locales[name] = new Locale(mergeConfigs(parentConfig, config));\n if (localeFamilies[name]) {\n localeFamilies[name].forEach(function (x) {\n defineLocale(x.name, x.config);\n });\n }\n\n // backwards compat for now: also set the locale\n // make sure we set the locale AFTER all child locales have been\n // created, so we won't end up with the child locale set.\n getSetGlobalLocale(name);\n return locales[name];\n } else {\n // useful for testing\n delete locales[name];\n return null;\n }\n }\n function updateLocale(name, config) {\n if (config != null) {\n var locale,\n tmpLocale,\n parentConfig = baseConfig;\n if (locales[name] != null && locales[name].parentLocale != null) {\n // Update existing child locale in-place to avoid memory-leaks\n locales[name].set(mergeConfigs(locales[name]._config, config));\n } else {\n // MERGE\n tmpLocale = loadLocale(name);\n if (tmpLocale != null) {\n parentConfig = tmpLocale._config;\n }\n config = mergeConfigs(parentConfig, config);\n if (tmpLocale == null) {\n // updateLocale is called for creating a new locale\n // Set abbr so it will have a name (getters return\n // undefined otherwise).\n config.abbr = name;\n }\n locale = new Locale(config);\n locale.parentLocale = locales[name];\n locales[name] = locale;\n }\n\n // backwards compat for now: also set the locale\n getSetGlobalLocale(name);\n } else {\n // pass null for config to unupdate, useful for tests\n if (locales[name] != null) {\n if (locales[name].parentLocale != null) {\n locales[name] = locales[name].parentLocale;\n if (name === getSetGlobalLocale()) {\n getSetGlobalLocale(name);\n }\n } else if (locales[name] != null) {\n delete locales[name];\n }\n }\n }\n return locales[name];\n }\n\n // returns locale data\n function getLocale(key) {\n var locale;\n if (key && key._locale && key._locale._abbr) {\n key = key._locale._abbr;\n }\n if (!key) {\n return globalLocale;\n }\n if (!isArray(key)) {\n //short-circuit everything else\n locale = loadLocale(key);\n if (locale) {\n return locale;\n }\n key = [key];\n }\n return chooseLocale(key);\n }\n function listLocales() {\n return keys(locales);\n }\n function checkOverflow(m) {\n var overflow,\n a = m._a;\n if (a && getParsingFlags(m).overflow === -2) {\n overflow = a[MONTH] < 0 || a[MONTH] > 11 ? MONTH : a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH]) ? DATE : a[HOUR] < 0 || a[HOUR] > 24 || a[HOUR] === 24 && (a[MINUTE] !== 0 || a[SECOND] !== 0 || a[MILLISECOND] !== 0) ? HOUR : a[MINUTE] < 0 || a[MINUTE] > 59 ? MINUTE : a[SECOND] < 0 || a[SECOND] > 59 ? SECOND : a[MILLISECOND] < 0 || a[MILLISECOND] > 999 ? MILLISECOND : -1;\n if (getParsingFlags(m)._overflowDayOfYear && (overflow < YEAR || overflow > DATE)) {\n overflow = DATE;\n }\n if (getParsingFlags(m)._overflowWeeks && overflow === -1) {\n overflow = WEEK;\n }\n if (getParsingFlags(m)._overflowWeekday && overflow === -1) {\n overflow = WEEKDAY;\n }\n getParsingFlags(m).overflow = overflow;\n }\n return m;\n }\n\n // iso 8601 regex\n // 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00)\n var extendedIsoRegex = /^\\s*((?:[+-]\\d{6}|\\d{4})-(?:\\d\\d-\\d\\d|W\\d\\d-\\d|W\\d\\d|\\d\\d\\d|\\d\\d))(?:(T| )(\\d\\d(?::\\d\\d(?::\\d\\d(?:[.,]\\d+)?)?)?)([+-]\\d\\d(?::?\\d\\d)?|\\s*Z)?)?$/,\n basicIsoRegex = /^\\s*((?:[+-]\\d{6}|\\d{4})(?:\\d\\d\\d\\d|W\\d\\d\\d|W\\d\\d|\\d\\d\\d|\\d\\d|))(?:(T| )(\\d\\d(?:\\d\\d(?:\\d\\d(?:[.,]\\d+)?)?)?)([+-]\\d\\d(?::?\\d\\d)?|\\s*Z)?)?$/,\n tzRegex = /Z|[+-]\\d\\d(?::?\\d\\d)?/,\n isoDates = [['YYYYYY-MM-DD', /[+-]\\d{6}-\\d\\d-\\d\\d/], ['YYYY-MM-DD', /\\d{4}-\\d\\d-\\d\\d/], ['GGGG-[W]WW-E', /\\d{4}-W\\d\\d-\\d/], ['GGGG-[W]WW', /\\d{4}-W\\d\\d/, false], ['YYYY-DDD', /\\d{4}-\\d{3}/], ['YYYY-MM', /\\d{4}-\\d\\d/, false], ['YYYYYYMMDD', /[+-]\\d{10}/], ['YYYYMMDD', /\\d{8}/], ['GGGG[W]WWE', /\\d{4}W\\d{3}/], ['GGGG[W]WW', /\\d{4}W\\d{2}/, false], ['YYYYDDD', /\\d{7}/], ['YYYYMM', /\\d{6}/, false], ['YYYY', /\\d{4}/, false]],\n // iso time formats and regexes\n isoTimes = [['HH:mm:ss.SSSS', /\\d\\d:\\d\\d:\\d\\d\\.\\d+/], ['HH:mm:ss,SSSS', /\\d\\d:\\d\\d:\\d\\d,\\d+/], ['HH:mm:ss', /\\d\\d:\\d\\d:\\d\\d/], ['HH:mm', /\\d\\d:\\d\\d/], ['HHmmss.SSSS', /\\d\\d\\d\\d\\d\\d\\.\\d+/], ['HHmmss,SSSS', /\\d\\d\\d\\d\\d\\d,\\d+/], ['HHmmss', /\\d\\d\\d\\d\\d\\d/], ['HHmm', /\\d\\d\\d\\d/], ['HH', /\\d\\d/]],\n aspNetJsonRegex = /^\\/?Date\\((-?\\d+)/i,\n // RFC 2822 regex: For details see https://tools.ietf.org/html/rfc2822#section-3.3\n rfc2822 = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\\s)?(\\d{1,2})\\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\\s(\\d{2,4})\\s(\\d\\d):(\\d\\d)(?::(\\d\\d))?\\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\\d{4}))$/,\n obsOffsets = {\n UT: 0,\n GMT: 0,\n EDT: -4 * 60,\n EST: -5 * 60,\n CDT: -5 * 60,\n CST: -6 * 60,\n MDT: -6 * 60,\n MST: -7 * 60,\n PDT: -7 * 60,\n PST: -8 * 60\n };\n\n // date from iso format\n function configFromISO(config) {\n var i,\n l,\n string = config._i,\n match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string),\n allowTime,\n dateFormat,\n timeFormat,\n tzFormat,\n isoDatesLen = isoDates.length,\n isoTimesLen = isoTimes.length;\n if (match) {\n getParsingFlags(config).iso = true;\n for (i = 0, l = isoDatesLen; i < l; i++) {\n if (isoDates[i][1].exec(match[1])) {\n dateFormat = isoDates[i][0];\n allowTime = isoDates[i][2] !== false;\n break;\n }\n }\n if (dateFormat == null) {\n config._isValid = false;\n return;\n }\n if (match[3]) {\n for (i = 0, l = isoTimesLen; i < l; i++) {\n if (isoTimes[i][1].exec(match[3])) {\n // match[2] should be 'T' or space\n timeFormat = (match[2] || ' ') + isoTimes[i][0];\n break;\n }\n }\n if (timeFormat == null) {\n config._isValid = false;\n return;\n }\n }\n if (!allowTime && timeFormat != null) {\n config._isValid = false;\n return;\n }\n if (match[4]) {\n if (tzRegex.exec(match[4])) {\n tzFormat = 'Z';\n } else {\n config._isValid = false;\n return;\n }\n }\n config._f = dateFormat + (timeFormat || '') + (tzFormat || '');\n configFromStringAndFormat(config);\n } else {\n config._isValid = false;\n }\n }\n function extractFromRFC2822Strings(yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr) {\n var result = [untruncateYear(yearStr), defaultLocaleMonthsShort.indexOf(monthStr), parseInt(dayStr, 10), parseInt(hourStr, 10), parseInt(minuteStr, 10)];\n if (secondStr) {\n result.push(parseInt(secondStr, 10));\n }\n return result;\n }\n function untruncateYear(yearStr) {\n var year = parseInt(yearStr, 10);\n if (year <= 49) {\n return 2000 + year;\n } else if (year <= 999) {\n return 1900 + year;\n }\n return year;\n }\n function preprocessRFC2822(s) {\n // Remove comments and folding whitespace and replace multiple-spaces with a single space\n return s.replace(/\\([^()]*\\)|[\\n\\t]/g, ' ').replace(/(\\s\\s+)/g, ' ').replace(/^\\s\\s*/, '').replace(/\\s\\s*$/, '');\n }\n function checkWeekday(weekdayStr, parsedInput, config) {\n if (weekdayStr) {\n // TODO: Replace the vanilla JS Date object with an independent day-of-week check.\n var weekdayProvided = defaultLocaleWeekdaysShort.indexOf(weekdayStr),\n weekdayActual = new Date(parsedInput[0], parsedInput[1], parsedInput[2]).getDay();\n if (weekdayProvided !== weekdayActual) {\n getParsingFlags(config).weekdayMismatch = true;\n config._isValid = false;\n return false;\n }\n }\n return true;\n }\n function calculateOffset(obsOffset, militaryOffset, numOffset) {\n if (obsOffset) {\n return obsOffsets[obsOffset];\n } else if (militaryOffset) {\n // the only allowed military tz is Z\n return 0;\n } else {\n var hm = parseInt(numOffset, 10),\n m = hm % 100,\n h = (hm - m) / 100;\n return h * 60 + m;\n }\n }\n\n // date and time from ref 2822 format\n function configFromRFC2822(config) {\n var match = rfc2822.exec(preprocessRFC2822(config._i)),\n parsedArray;\n if (match) {\n parsedArray = extractFromRFC2822Strings(match[4], match[3], match[2], match[5], match[6], match[7]);\n if (!checkWeekday(match[1], parsedArray, config)) {\n return;\n }\n config._a = parsedArray;\n config._tzm = calculateOffset(match[8], match[9], match[10]);\n config._d = createUTCDate.apply(null, config._a);\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n getParsingFlags(config).rfc2822 = true;\n } else {\n config._isValid = false;\n }\n }\n\n // date from 1) ASP.NET, 2) ISO, 3) RFC 2822 formats, or 4) optional fallback if parsing isn't strict\n function configFromString(config) {\n var matched = aspNetJsonRegex.exec(config._i);\n if (matched !== null) {\n config._d = new Date(+matched[1]);\n return;\n }\n configFromISO(config);\n if (config._isValid === false) {\n delete config._isValid;\n } else {\n return;\n }\n configFromRFC2822(config);\n if (config._isValid === false) {\n delete config._isValid;\n } else {\n return;\n }\n if (config._strict) {\n config._isValid = false;\n } else {\n // Final attempt, use Input Fallback\n hooks.createFromInputFallback(config);\n }\n }\n hooks.createFromInputFallback = deprecate('value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), ' + 'which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are ' + 'discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.', function (config) {\n config._d = new Date(config._i + (config._useUTC ? ' UTC' : ''));\n });\n\n // Pick the first defined of two or three arguments.\n function defaults(a, b, c) {\n if (a != null) {\n return a;\n }\n if (b != null) {\n return b;\n }\n return c;\n }\n function currentDateArray(config) {\n // hooks is actually the exported moment object\n var nowValue = new Date(hooks.now());\n if (config._useUTC) {\n return [nowValue.getUTCFullYear(), nowValue.getUTCMonth(), nowValue.getUTCDate()];\n }\n return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()];\n }\n\n // convert an array to a date.\n // the array should mirror the parameters below\n // note: all values past the year are optional and will default to the lowest possible value.\n // [year, month, day , hour, minute, second, millisecond]\n function configFromArray(config) {\n var i,\n date,\n input = [],\n currentDate,\n expectedWeekday,\n yearToUse;\n if (config._d) {\n return;\n }\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear != null) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n if (config._dayOfYear > daysInYear(yearToUse) || config._dayOfYear === 0) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] = config._a[i] == null ? i === 2 ? 1 : 0 : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (config._a[HOUR] === 24 && config._a[MINUTE] === 0 && config._a[SECOND] === 0 && config._a[MILLISECOND] === 0) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);\n expectedWeekday = config._useUTC ? config._d.getUTCDay() : config._d.getDay();\n\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n\n // check for mismatching day of week\n if (config._w && typeof config._w.d !== 'undefined' && config._w.d !== expectedWeekday) {\n getParsingFlags(config).weekdayMismatch = true;\n }\n }\n function dayOfYearFromWeekInfo(config) {\n var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow, curWeek;\n w = config._w;\n if (w.GG != null || w.W != null || w.E != null) {\n dow = 1;\n doy = 4;\n\n // TODO: We need to take the current isoWeekYear, but that depends on\n // how we interpret now (local, utc, fixed offset). So create\n // a now version of current config (take local/utc/offset flags, and\n // create now).\n weekYear = defaults(w.GG, config._a[YEAR], weekOfYear(createLocal(), 1, 4).year);\n week = defaults(w.W, 1);\n weekday = defaults(w.E, 1);\n if (weekday < 1 || weekday > 7) {\n weekdayOverflow = true;\n }\n } else {\n dow = config._locale._week.dow;\n doy = config._locale._week.doy;\n curWeek = weekOfYear(createLocal(), dow, doy);\n weekYear = defaults(w.gg, config._a[YEAR], curWeek.year);\n\n // Default to current week.\n week = defaults(w.w, curWeek.week);\n if (w.d != null) {\n // weekday -- low day numbers are considered next week\n weekday = w.d;\n if (weekday < 0 || weekday > 6) {\n weekdayOverflow = true;\n }\n } else if (w.e != null) {\n // local weekday -- counting starts from beginning of week\n weekday = w.e + dow;\n if (w.e < 0 || w.e > 6) {\n weekdayOverflow = true;\n }\n } else {\n // default to beginning of week\n weekday = dow;\n }\n }\n if (week < 1 || week > weeksInYear(weekYear, dow, doy)) {\n getParsingFlags(config)._overflowWeeks = true;\n } else if (weekdayOverflow != null) {\n getParsingFlags(config)._overflowWeekday = true;\n } else {\n temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy);\n config._a[YEAR] = temp.year;\n config._dayOfYear = temp.dayOfYear;\n }\n }\n\n // constant that refers to the ISO standard\n hooks.ISO_8601 = function () {};\n\n // constant that refers to the RFC 2822 form\n hooks.RFC_2822 = function () {};\n\n // date from string and format string\n function configFromStringAndFormat(config) {\n // TODO: Move this to another part of the creation flow to prevent circular deps\n if (config._f === hooks.ISO_8601) {\n configFromISO(config);\n return;\n }\n if (config._f === hooks.RFC_2822) {\n configFromRFC2822(config);\n return;\n }\n config._a = [];\n getParsingFlags(config).empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var string = '' + config._i,\n i,\n parsedInput,\n tokens,\n token,\n skipped,\n stringLength = string.length,\n totalParsedInputLength = 0,\n era,\n tokenLen;\n tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];\n tokenLen = tokens.length;\n for (i = 0; i < tokenLen; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n getParsingFlags(config).unusedInput.push(skipped);\n }\n string = string.slice(string.indexOf(parsedInput) + parsedInput.length);\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n getParsingFlags(config).empty = false;\n } else {\n getParsingFlags(config).unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n } else if (config._strict && !parsedInput) {\n getParsingFlags(config).unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n getParsingFlags(config).charsLeftOver = stringLength - totalParsedInputLength;\n if (string.length > 0) {\n getParsingFlags(config).unusedInput.push(string);\n }\n\n // clear _12h flag if hour is <= 12\n if (config._a[HOUR] <= 12 && getParsingFlags(config).bigHour === true && config._a[HOUR] > 0) {\n getParsingFlags(config).bigHour = undefined;\n }\n getParsingFlags(config).parsedDateParts = config._a.slice(0);\n getParsingFlags(config).meridiem = config._meridiem;\n // handle meridiem\n config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR], config._meridiem);\n\n // handle era\n era = getParsingFlags(config).era;\n if (era !== null) {\n config._a[YEAR] = config._locale.erasConvertYear(era, config._a[YEAR]);\n }\n configFromArray(config);\n checkOverflow(config);\n }\n function meridiemFixWrap(locale, hour, meridiem) {\n var isPm;\n if (meridiem == null) {\n // nothing to do\n return hour;\n }\n if (locale.meridiemHour != null) {\n return locale.meridiemHour(hour, meridiem);\n } else if (locale.isPM != null) {\n // Fallback\n isPm = locale.isPM(meridiem);\n if (isPm && hour < 12) {\n hour += 12;\n }\n if (!isPm && hour === 12) {\n hour = 0;\n }\n return hour;\n } else {\n // this is not supposed to happen\n return hour;\n }\n }\n\n // date from string and array of format strings\n function configFromStringAndArray(config) {\n var tempConfig,\n bestMoment,\n scoreToBeat,\n i,\n currentScore,\n validFormatFound,\n bestFormatIsValid = false,\n configfLen = config._f.length;\n if (configfLen === 0) {\n getParsingFlags(config).invalidFormat = true;\n config._d = new Date(NaN);\n return;\n }\n for (i = 0; i < configfLen; i++) {\n currentScore = 0;\n validFormatFound = false;\n tempConfig = copyConfig({}, config);\n if (config._useUTC != null) {\n tempConfig._useUTC = config._useUTC;\n }\n tempConfig._f = config._f[i];\n configFromStringAndFormat(tempConfig);\n if (isValid(tempConfig)) {\n validFormatFound = true;\n }\n\n // if there is any input that was not parsed add a penalty for that format\n currentScore += getParsingFlags(tempConfig).charsLeftOver;\n\n //or tokens\n currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10;\n getParsingFlags(tempConfig).score = currentScore;\n if (!bestFormatIsValid) {\n if (scoreToBeat == null || currentScore < scoreToBeat || validFormatFound) {\n scoreToBeat = currentScore;\n bestMoment = tempConfig;\n if (validFormatFound) {\n bestFormatIsValid = true;\n }\n }\n } else {\n if (currentScore < scoreToBeat) {\n scoreToBeat = currentScore;\n bestMoment = tempConfig;\n }\n }\n }\n extend(config, bestMoment || tempConfig);\n }\n function configFromObject(config) {\n if (config._d) {\n return;\n }\n var i = normalizeObjectUnits(config._i),\n dayOrDate = i.day === undefined ? i.date : i.day;\n config._a = map([i.year, i.month, dayOrDate, i.hour, i.minute, i.second, i.millisecond], function (obj) {\n return obj && parseInt(obj, 10);\n });\n configFromArray(config);\n }\n function createFromConfig(config) {\n var res = new Moment(checkOverflow(prepareConfig(config)));\n if (res._nextDay) {\n // Adding is smart enough around DST\n res.add(1, 'd');\n res._nextDay = undefined;\n }\n return res;\n }\n function prepareConfig(config) {\n var input = config._i,\n format = config._f;\n config._locale = config._locale || getLocale(config._l);\n if (input === null || format === undefined && input === '') {\n return createInvalid({\n nullInput: true\n });\n }\n if (typeof input === 'string') {\n config._i = input = config._locale.preparse(input);\n }\n if (isMoment(input)) {\n return new Moment(checkOverflow(input));\n } else if (isDate(input)) {\n config._d = input;\n } else if (isArray(format)) {\n configFromStringAndArray(config);\n } else if (format) {\n configFromStringAndFormat(config);\n } else {\n configFromInput(config);\n }\n if (!isValid(config)) {\n config._d = null;\n }\n return config;\n }\n function configFromInput(config) {\n var input = config._i;\n if (isUndefined(input)) {\n config._d = new Date(hooks.now());\n } else if (isDate(input)) {\n config._d = new Date(input.valueOf());\n } else if (typeof input === 'string') {\n configFromString(config);\n } else if (isArray(input)) {\n config._a = map(input.slice(0), function (obj) {\n return parseInt(obj, 10);\n });\n configFromArray(config);\n } else if (isObject(input)) {\n configFromObject(config);\n } else if (isNumber(input)) {\n // from milliseconds\n config._d = new Date(input);\n } else {\n hooks.createFromInputFallback(config);\n }\n }\n function createLocalOrUTC(input, format, locale, strict, isUTC) {\n var c = {};\n if (format === true || format === false) {\n strict = format;\n format = undefined;\n }\n if (locale === true || locale === false) {\n strict = locale;\n locale = undefined;\n }\n if (isObject(input) && isObjectEmpty(input) || isArray(input) && input.length === 0) {\n input = undefined;\n }\n // object construction must be done this way.\n // https://github.com/moment/moment/issues/1423\n c._isAMomentObject = true;\n c._useUTC = c._isUTC = isUTC;\n c._l = locale;\n c._i = input;\n c._f = format;\n c._strict = strict;\n return createFromConfig(c);\n }\n function createLocal(input, format, locale, strict) {\n return createLocalOrUTC(input, format, locale, strict, false);\n }\n var prototypeMin = deprecate('moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/', function () {\n var other = createLocal.apply(null, arguments);\n if (this.isValid() && other.isValid()) {\n return other < this ? this : other;\n } else {\n return createInvalid();\n }\n }),\n prototypeMax = deprecate('moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/', function () {\n var other = createLocal.apply(null, arguments);\n if (this.isValid() && other.isValid()) {\n return other > this ? this : other;\n } else {\n return createInvalid();\n }\n });\n\n // Pick a moment m from moments so that m[fn](other) is true for all\n // other. This relies on the function fn to be transitive.\n //\n // moments should either be an array of moment objects or an array, whose\n // first element is an array of moment objects.\n function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }\n\n // TODO: Use [].sort instead?\n function min() {\n var args = [].slice.call(arguments, 0);\n return pickBy('isBefore', args);\n }\n function max() {\n var args = [].slice.call(arguments, 0);\n return pickBy('isAfter', args);\n }\n var now = function () {\n return Date.now ? Date.now() : +new Date();\n };\n var ordering = ['year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', 'millisecond'];\n function isDurationValid(m) {\n var key,\n unitHasDecimal = false,\n i,\n orderLen = ordering.length;\n for (key in m) {\n if (hasOwnProp(m, key) && !(indexOf.call(ordering, key) !== -1 && (m[key] == null || !isNaN(m[key])))) {\n return false;\n }\n }\n for (i = 0; i < orderLen; ++i) {\n if (m[ordering[i]]) {\n if (unitHasDecimal) {\n return false; // only allow non-integers for smallest unit\n }\n if (parseFloat(m[ordering[i]]) !== toInt(m[ordering[i]])) {\n unitHasDecimal = true;\n }\n }\n }\n return true;\n }\n function isValid$1() {\n return this._isValid;\n }\n function createInvalid$1() {\n return createDuration(NaN);\n }\n function Duration(duration) {\n var normalizedInput = normalizeObjectUnits(duration),\n years = normalizedInput.year || 0,\n quarters = normalizedInput.quarter || 0,\n months = normalizedInput.month || 0,\n weeks = normalizedInput.week || normalizedInput.isoWeek || 0,\n days = normalizedInput.day || 0,\n hours = normalizedInput.hour || 0,\n minutes = normalizedInput.minute || 0,\n seconds = normalizedInput.second || 0,\n milliseconds = normalizedInput.millisecond || 0;\n this._isValid = isDurationValid(normalizedInput);\n\n // representation for dateAddRemove\n this._milliseconds = +milliseconds + seconds * 1e3 +\n // 1000\n minutes * 6e4 +\n // 1000 * 60\n hours * 1000 * 60 * 60; //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978\n // Because of dateAddRemove treats 24 hours as different from a\n // day when working around DST, we need to store them separately\n this._days = +days + weeks * 7;\n // It is impossible to translate months into days without knowing\n // which months you are are talking about, so we have to store\n // it separately.\n this._months = +months + quarters * 3 + years * 12;\n this._data = {};\n this._locale = getLocale();\n this._bubble();\n }\n function isDuration(obj) {\n return obj instanceof Duration;\n }\n function absRound(number) {\n if (number < 0) {\n return Math.round(-1 * number) * -1;\n } else {\n return Math.round(number);\n }\n }\n\n // compare two arrays, return the number of differences\n function compareArrays(array1, array2, dontConvert) {\n var len = Math.min(array1.length, array2.length),\n lengthDiff = Math.abs(array1.length - array2.length),\n diffs = 0,\n i;\n for (i = 0; i < len; i++) {\n if (dontConvert && array1[i] !== array2[i] || !dontConvert && toInt(array1[i]) !== toInt(array2[i])) {\n diffs++;\n }\n }\n return diffs + lengthDiff;\n }\n\n // FORMATTING\n\n function offset(token, separator) {\n addFormatToken(token, 0, 0, function () {\n var offset = this.utcOffset(),\n sign = '+';\n if (offset < 0) {\n offset = -offset;\n sign = '-';\n }\n return sign + zeroFill(~~(offset / 60), 2) + separator + zeroFill(~~offset % 60, 2);\n });\n }\n offset('Z', ':');\n offset('ZZ', '');\n\n // PARSING\n\n addRegexToken('Z', matchShortOffset);\n addRegexToken('ZZ', matchShortOffset);\n addParseToken(['Z', 'ZZ'], function (input, array, config) {\n config._useUTC = true;\n config._tzm = offsetFromString(matchShortOffset, input);\n });\n\n // HELPERS\n\n // timezone chunker\n // '+10:00' > ['10', '00']\n // '-1530' > ['-15', '30']\n var chunkOffset = /([\\+\\-]|\\d\\d)/gi;\n function offsetFromString(matcher, string) {\n var matches = (string || '').match(matcher),\n chunk,\n parts,\n minutes;\n if (matches === null) {\n return null;\n }\n chunk = matches[matches.length - 1] || [];\n parts = (chunk + '').match(chunkOffset) || ['-', 0, 0];\n minutes = +(parts[1] * 60) + toInt(parts[2]);\n return minutes === 0 ? 0 : parts[0] === '+' ? minutes : -minutes;\n }\n\n // Return a moment from input, that is local/utc/zone equivalent to model.\n function cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(res._d.valueOf() + diff);\n hooks.updateOffset(res, false);\n return res;\n } else {\n return createLocal(input).local();\n }\n }\n function getDateOffset(m) {\n // On Firefox.24 Date#getTimezoneOffset returns a floating point.\n // https://github.com/moment/moment/pull/1871\n return -Math.round(m._d.getTimezoneOffset());\n }\n\n // HOOKS\n\n // This function will be called whenever a moment is mutated.\n // It is intended to keep the offset in sync with the timezone.\n hooks.updateOffset = function () {};\n\n // MOMENTS\n\n // keepLocalTime = true means only change the timezone, without\n // affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]-->\n // 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset\n // +0200, so we adjust the time as needed, to be valid.\n //\n // Keeping the time actually adds/subtracts (one hour)\n // from the actual represented time. That is why we call updateOffset\n // a second time. In case it wants us to change the offset again\n // _changeInProgress == true case, then we have to adjust, because\n // there is no such time in the given timezone.\n function getSetOffset(input, keepLocalTime, keepMinutes) {\n var offset = this._offset || 0,\n localAdjust;\n if (!this.isValid()) {\n return input != null ? this : NaN;\n }\n if (input != null) {\n if (typeof input === 'string') {\n input = offsetFromString(matchShortOffset, input);\n if (input === null) {\n return this;\n }\n } else if (Math.abs(input) < 16 && !keepMinutes) {\n input = input * 60;\n }\n if (!this._isUTC && keepLocalTime) {\n localAdjust = getDateOffset(this);\n }\n this._offset = input;\n this._isUTC = true;\n if (localAdjust != null) {\n this.add(localAdjust, 'm');\n }\n if (offset !== input) {\n if (!keepLocalTime || this._changeInProgress) {\n addSubtract(this, createDuration(input - offset, 'm'), 1, false);\n } else if (!this._changeInProgress) {\n this._changeInProgress = true;\n hooks.updateOffset(this, true);\n this._changeInProgress = null;\n }\n }\n return this;\n } else {\n return this._isUTC ? offset : getDateOffset(this);\n }\n }\n function getSetZone(input, keepLocalTime) {\n if (input != null) {\n if (typeof input !== 'string') {\n input = -input;\n }\n this.utcOffset(input, keepLocalTime);\n return this;\n } else {\n return -this.utcOffset();\n }\n }\n function setOffsetToUTC(keepLocalTime) {\n return this.utcOffset(0, keepLocalTime);\n }\n function setOffsetToLocal(keepLocalTime) {\n if (this._isUTC) {\n this.utcOffset(0, keepLocalTime);\n this._isUTC = false;\n if (keepLocalTime) {\n this.subtract(getDateOffset(this), 'm');\n }\n }\n return this;\n }\n function setOffsetToParsedOffset() {\n if (this._tzm != null) {\n this.utcOffset(this._tzm, false, true);\n } else if (typeof this._i === 'string') {\n var tZone = offsetFromString(matchOffset, this._i);\n if (tZone != null) {\n this.utcOffset(tZone);\n } else {\n this.utcOffset(0, true);\n }\n }\n return this;\n }\n function hasAlignedHourOffset(input) {\n if (!this.isValid()) {\n return false;\n }\n input = input ? createLocal(input).utcOffset() : 0;\n return (this.utcOffset() - input) % 60 === 0;\n }\n function isDaylightSavingTime() {\n return this.utcOffset() > this.clone().month(0).utcOffset() || this.utcOffset() > this.clone().month(5).utcOffset();\n }\n function isDaylightSavingTimeShifted() {\n if (!isUndefined(this._isDSTShifted)) {\n return this._isDSTShifted;\n }\n var c = {},\n other;\n copyConfig(c, this);\n c = prepareConfig(c);\n if (c._a) {\n other = c._isUTC ? createUTC(c._a) : createLocal(c._a);\n this._isDSTShifted = this.isValid() && compareArrays(c._a, other.toArray()) > 0;\n } else {\n this._isDSTShifted = false;\n }\n return this._isDSTShifted;\n }\n function isLocal() {\n return this.isValid() ? !this._isUTC : false;\n }\n function isUtcOffset() {\n return this.isValid() ? this._isUTC : false;\n }\n function isUtc() {\n return this.isValid() ? this._isUTC && this._offset === 0 : false;\n }\n\n // ASP.NET json date format regex\n var aspNetRegex = /^(-|\\+)?(?:(\\d*)[. ])?(\\d+):(\\d+)(?::(\\d+)(\\.\\d*)?)?$/,\n // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html\n // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere\n // and further modified to allow for strings containing both week and day\n isoRegex = /^(-|\\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;\n function createDuration(input, key) {\n var duration = input,\n // matching against regexp is expensive, do it on demand\n match = null,\n sign,\n ret,\n diffRes;\n if (isDuration(input)) {\n duration = {\n ms: input._milliseconds,\n d: input._days,\n M: input._months\n };\n } else if (isNumber(input) || !isNaN(+input)) {\n duration = {};\n if (key) {\n duration[key] = +input;\n } else {\n duration.milliseconds = +input;\n }\n } else if (match = aspNetRegex.exec(input)) {\n sign = match[1] === '-' ? -1 : 1;\n duration = {\n y: 0,\n d: toInt(match[DATE]) * sign,\n h: toInt(match[HOUR]) * sign,\n m: toInt(match[MINUTE]) * sign,\n s: toInt(match[SECOND]) * sign,\n ms: toInt(absRound(match[MILLISECOND] * 1000)) * sign // the millisecond decimal point is included in the match\n };\n } else if (match = isoRegex.exec(input)) {\n sign = match[1] === '-' ? -1 : 1;\n duration = {\n y: parseIso(match[2], sign),\n M: parseIso(match[3], sign),\n w: parseIso(match[4], sign),\n d: parseIso(match[5], sign),\n h: parseIso(match[6], sign),\n m: parseIso(match[7], sign),\n s: parseIso(match[8], sign)\n };\n } else if (duration == null) {\n // checks for null or undefined\n duration = {};\n } else if (typeof duration === 'object' && ('from' in duration || 'to' in duration)) {\n diffRes = momentsDifference(createLocal(duration.from), createLocal(duration.to));\n duration = {};\n duration.ms = diffRes.milliseconds;\n duration.M = diffRes.months;\n }\n ret = new Duration(duration);\n if (isDuration(input) && hasOwnProp(input, '_locale')) {\n ret._locale = input._locale;\n }\n if (isDuration(input) && hasOwnProp(input, '_isValid')) {\n ret._isValid = input._isValid;\n }\n return ret;\n }\n createDuration.fn = Duration.prototype;\n createDuration.invalid = createInvalid$1;\n function parseIso(inp, sign) {\n // We'd normally use ~~inp for this, but unfortunately it also\n // converts floats to ints.\n // inp may be undefined, so careful calling replace on it.\n var res = inp && parseFloat(inp.replace(',', '.'));\n // apply sign while we're at it\n return (isNaN(res) ? 0 : res) * sign;\n }\n function positiveMomentsDifference(base, other) {\n var res = {};\n res.months = other.month() - base.month() + (other.year() - base.year()) * 12;\n if (base.clone().add(res.months, 'M').isAfter(other)) {\n --res.months;\n }\n res.milliseconds = +other - +base.clone().add(res.months, 'M');\n return res;\n }\n function momentsDifference(base, other) {\n var res;\n if (!(base.isValid() && other.isValid())) {\n return {\n milliseconds: 0,\n months: 0\n };\n }\n other = cloneWithOffset(other, base);\n if (base.isBefore(other)) {\n res = positiveMomentsDifference(base, other);\n } else {\n res = positiveMomentsDifference(other, base);\n res.milliseconds = -res.milliseconds;\n res.months = -res.months;\n }\n return res;\n }\n\n // TODO: remove 'name' arg after deprecation is removed\n function createAdder(direction, name) {\n return function (val, period) {\n var dur, tmp;\n //invert the arguments, but complain about it\n if (period !== null && !isNaN(+period)) {\n deprecateSimple(name, 'moment().' + name + '(period, number) is deprecated. Please use moment().' + name + '(number, period). ' + 'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.');\n tmp = val;\n val = period;\n period = tmp;\n }\n dur = createDuration(val, period);\n addSubtract(this, dur, direction);\n return this;\n };\n }\n function addSubtract(mom, duration, isAdding, updateOffset) {\n var milliseconds = duration._milliseconds,\n days = absRound(duration._days),\n months = absRound(duration._months);\n if (!mom.isValid()) {\n // No op\n return;\n }\n updateOffset = updateOffset == null ? true : updateOffset;\n if (months) {\n setMonth(mom, get(mom, 'Month') + months * isAdding);\n }\n if (days) {\n set$1(mom, 'Date', get(mom, 'Date') + days * isAdding);\n }\n if (milliseconds) {\n mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding);\n }\n if (updateOffset) {\n hooks.updateOffset(mom, days || months);\n }\n }\n var add = createAdder(1, 'add'),\n subtract = createAdder(-1, 'subtract');\n function isString(input) {\n return typeof input === 'string' || input instanceof String;\n }\n\n // type MomentInput = Moment | Date | string | number | (number | string)[] | MomentInputObject | void; // null | undefined\n function isMomentInput(input) {\n return isMoment(input) || isDate(input) || isString(input) || isNumber(input) || isNumberOrStringArray(input) || isMomentInputObject(input) || input === null || input === undefined;\n }\n function isMomentInputObject(input) {\n var objectTest = isObject(input) && !isObjectEmpty(input),\n propertyTest = false,\n properties = ['years', 'year', 'y', 'months', 'month', 'M', 'days', 'day', 'd', 'dates', 'date', 'D', 'hours', 'hour', 'h', 'minutes', 'minute', 'm', 'seconds', 'second', 's', 'milliseconds', 'millisecond', 'ms'],\n i,\n property,\n propertyLen = properties.length;\n for (i = 0; i < propertyLen; i += 1) {\n property = properties[i];\n propertyTest = propertyTest || hasOwnProp(input, property);\n }\n return objectTest && propertyTest;\n }\n function isNumberOrStringArray(input) {\n var arrayTest = isArray(input),\n dataTypeTest = false;\n if (arrayTest) {\n dataTypeTest = input.filter(function (item) {\n return !isNumber(item) && isString(input);\n }).length === 0;\n }\n return arrayTest && dataTypeTest;\n }\n function isCalendarSpec(input) {\n var objectTest = isObject(input) && !isObjectEmpty(input),\n propertyTest = false,\n properties = ['sameDay', 'nextDay', 'lastDay', 'nextWeek', 'lastWeek', 'sameElse'],\n i,\n property;\n for (i = 0; i < properties.length; i += 1) {\n property = properties[i];\n propertyTest = propertyTest || hasOwnProp(input, property);\n }\n return objectTest && propertyTest;\n }\n function getCalendarFormat(myMoment, now) {\n var diff = myMoment.diff(now, 'days', true);\n return diff < -6 ? 'sameElse' : diff < -1 ? 'lastWeek' : diff < 0 ? 'lastDay' : diff < 1 ? 'sameDay' : diff < 2 ? 'nextDay' : diff < 7 ? 'nextWeek' : 'sameElse';\n }\n function calendar$1(time, formats) {\n // Support for single parameter, formats only overload to the calendar function\n if (arguments.length === 1) {\n if (!arguments[0]) {\n time = undefined;\n formats = undefined;\n } else if (isMomentInput(arguments[0])) {\n time = arguments[0];\n formats = undefined;\n } else if (isCalendarSpec(arguments[0])) {\n formats = arguments[0];\n time = undefined;\n }\n }\n // We want to compare the start of today, vs this.\n // Getting start-of-today depends on whether we're local/utc/offset or not.\n var now = time || createLocal(),\n sod = cloneWithOffset(now, this).startOf('day'),\n format = hooks.calendarFormat(this, sod) || 'sameElse',\n output = formats && (isFunction(formats[format]) ? formats[format].call(this, now) : formats[format]);\n return this.format(output || this.localeData().calendar(format, this, createLocal(now)));\n }\n function clone() {\n return new Moment(this);\n }\n function isAfter(input, units) {\n var localInput = isMoment(input) ? input : createLocal(input);\n if (!(this.isValid() && localInput.isValid())) {\n return false;\n }\n units = normalizeUnits(units) || 'millisecond';\n if (units === 'millisecond') {\n return this.valueOf() > localInput.valueOf();\n } else {\n return localInput.valueOf() < this.clone().startOf(units).valueOf();\n }\n }\n function isBefore(input, units) {\n var localInput = isMoment(input) ? input : createLocal(input);\n if (!(this.isValid() && localInput.isValid())) {\n return false;\n }\n units = normalizeUnits(units) || 'millisecond';\n if (units === 'millisecond') {\n return this.valueOf() < localInput.valueOf();\n } else {\n return this.clone().endOf(units).valueOf() < localInput.valueOf();\n }\n }\n function isBetween(from, to, units, inclusivity) {\n var localFrom = isMoment(from) ? from : createLocal(from),\n localTo = isMoment(to) ? to : createLocal(to);\n if (!(this.isValid() && localFrom.isValid() && localTo.isValid())) {\n return false;\n }\n inclusivity = inclusivity || '()';\n return (inclusivity[0] === '(' ? this.isAfter(localFrom, units) : !this.isBefore(localFrom, units)) && (inclusivity[1] === ')' ? this.isBefore(localTo, units) : !this.isAfter(localTo, units));\n }\n function isSame(input, units) {\n var localInput = isMoment(input) ? input : createLocal(input),\n inputMs;\n if (!(this.isValid() && localInput.isValid())) {\n return false;\n }\n units = normalizeUnits(units) || 'millisecond';\n if (units === 'millisecond') {\n return this.valueOf() === localInput.valueOf();\n } else {\n inputMs = localInput.valueOf();\n return this.clone().startOf(units).valueOf() <= inputMs && inputMs <= this.clone().endOf(units).valueOf();\n }\n }\n function isSameOrAfter(input, units) {\n return this.isSame(input, units) || this.isAfter(input, units);\n }\n function isSameOrBefore(input, units) {\n return this.isSame(input, units) || this.isBefore(input, units);\n }\n function diff(input, units, asFloat) {\n var that, zoneDelta, output;\n if (!this.isValid()) {\n return NaN;\n }\n that = cloneWithOffset(input, this);\n if (!that.isValid()) {\n return NaN;\n }\n zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4;\n units = normalizeUnits(units);\n switch (units) {\n case 'year':\n output = monthDiff(this, that) / 12;\n break;\n case 'month':\n output = monthDiff(this, that);\n break;\n case 'quarter':\n output = monthDiff(this, that) / 3;\n break;\n case 'second':\n output = (this - that) / 1e3;\n break;\n // 1000\n case 'minute':\n output = (this - that) / 6e4;\n break;\n // 1000 * 60\n case 'hour':\n output = (this - that) / 36e5;\n break;\n // 1000 * 60 * 60\n case 'day':\n output = (this - that - zoneDelta) / 864e5;\n break;\n // 1000 * 60 * 60 * 24, negate dst\n case 'week':\n output = (this - that - zoneDelta) / 6048e5;\n break;\n // 1000 * 60 * 60 * 24 * 7, negate dst\n default:\n output = this - that;\n }\n return asFloat ? output : absFloor(output);\n }\n function monthDiff(a, b) {\n if (a.date() < b.date()) {\n // end-of-month calculations work correct when the start month has more\n // days than the end month.\n return -monthDiff(b, a);\n }\n // difference in months\n var wholeMonthDiff = (b.year() - a.year()) * 12 + (b.month() - a.month()),\n // b is in (anchor - 1 month, anchor + 1 month)\n anchor = a.clone().add(wholeMonthDiff, 'months'),\n anchor2,\n adjust;\n if (b - anchor < 0) {\n anchor2 = a.clone().add(wholeMonthDiff - 1, 'months');\n // linear across the month\n adjust = (b - anchor) / (anchor - anchor2);\n } else {\n anchor2 = a.clone().add(wholeMonthDiff + 1, 'months');\n // linear across the month\n adjust = (b - anchor) / (anchor2 - anchor);\n }\n\n //check for negative zero, return zero if negative zero\n return -(wholeMonthDiff + adjust) || 0;\n }\n hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ';\n hooks.defaultFormatUtc = 'YYYY-MM-DDTHH:mm:ss[Z]';\n function toString() {\n return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ');\n }\n function toISOString(keepOffset) {\n if (!this.isValid()) {\n return null;\n }\n var utc = keepOffset !== true,\n m = utc ? this.clone().utc() : this;\n if (m.year() < 0 || m.year() > 9999) {\n return formatMoment(m, utc ? 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYYYY-MM-DD[T]HH:mm:ss.SSSZ');\n }\n if (isFunction(Date.prototype.toISOString)) {\n // native implementation is ~50x faster, use it when we can\n if (utc) {\n return this.toDate().toISOString();\n } else {\n return new Date(this.valueOf() + this.utcOffset() * 60 * 1000).toISOString().replace('Z', formatMoment(m, 'Z'));\n }\n }\n return formatMoment(m, utc ? 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYY-MM-DD[T]HH:mm:ss.SSSZ');\n }\n\n /**\n * Return a human readable representation of a moment that can\n * also be evaluated to get a new moment which is the same\n *\n * @link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects\n */\n function inspect() {\n if (!this.isValid()) {\n return 'moment.invalid(/* ' + this._i + ' */)';\n }\n var func = 'moment',\n zone = '',\n prefix,\n year,\n datetime,\n suffix;\n if (!this.isLocal()) {\n func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';\n zone = 'Z';\n }\n prefix = '[' + func + '(\"]';\n year = 0 <= this.year() && this.year() <= 9999 ? 'YYYY' : 'YYYYYY';\n datetime = '-MM-DD[T]HH:mm:ss.SSS';\n suffix = zone + '[\")]';\n return this.format(prefix + year + datetime + suffix);\n }\n function format(inputString) {\n if (!inputString) {\n inputString = this.isUtc() ? hooks.defaultFormatUtc : hooks.defaultFormat;\n }\n var output = formatMoment(this, inputString);\n return this.localeData().postformat(output);\n }\n function from(time, withoutSuffix) {\n if (this.isValid() && (isMoment(time) && time.isValid() || createLocal(time).isValid())) {\n return createDuration({\n to: this,\n from: time\n }).locale(this.locale()).humanize(!withoutSuffix);\n } else {\n return this.localeData().invalidDate();\n }\n }\n function fromNow(withoutSuffix) {\n return this.from(createLocal(), withoutSuffix);\n }\n function to(time, withoutSuffix) {\n if (this.isValid() && (isMoment(time) && time.isValid() || createLocal(time).isValid())) {\n return createDuration({\n from: this,\n to: time\n }).locale(this.locale()).humanize(!withoutSuffix);\n } else {\n return this.localeData().invalidDate();\n }\n }\n function toNow(withoutSuffix) {\n return this.to(createLocal(), withoutSuffix);\n }\n\n // If passed a locale key, it will set the locale for this\n // instance. Otherwise, it will return the locale configuration\n // variables for this instance.\n function locale(key) {\n var newLocaleData;\n if (key === undefined) {\n return this._locale._abbr;\n } else {\n newLocaleData = getLocale(key);\n if (newLocaleData != null) {\n this._locale = newLocaleData;\n }\n return this;\n }\n }\n var lang = deprecate('moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.', function (key) {\n if (key === undefined) {\n return this.localeData();\n } else {\n return this.locale(key);\n }\n });\n function localeData() {\n return this._locale;\n }\n var MS_PER_SECOND = 1000,\n MS_PER_MINUTE = 60 * MS_PER_SECOND,\n MS_PER_HOUR = 60 * MS_PER_MINUTE,\n MS_PER_400_YEARS = (365 * 400 + 97) * 24 * MS_PER_HOUR;\n\n // actual modulo - handles negative numbers (for dates before 1970):\n function mod$1(dividend, divisor) {\n return (dividend % divisor + divisor) % divisor;\n }\n function localStartOfDate(y, m, d) {\n // the date constructor remaps years 0-99 to 1900-1999\n if (y < 100 && y >= 0) {\n // preserve leap years using a full 400 year cycle, then reset\n return new Date(y + 400, m, d) - MS_PER_400_YEARS;\n } else {\n return new Date(y, m, d).valueOf();\n }\n }\n function utcStartOfDate(y, m, d) {\n // Date.UTC remaps years 0-99 to 1900-1999\n if (y < 100 && y >= 0) {\n // preserve leap years using a full 400 year cycle, then reset\n return Date.UTC(y + 400, m, d) - MS_PER_400_YEARS;\n } else {\n return Date.UTC(y, m, d);\n }\n }\n function startOf(units) {\n var time, startOfDate;\n units = normalizeUnits(units);\n if (units === undefined || units === 'millisecond' || !this.isValid()) {\n return this;\n }\n startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;\n switch (units) {\n case 'year':\n time = startOfDate(this.year(), 0, 1);\n break;\n case 'quarter':\n time = startOfDate(this.year(), this.month() - this.month() % 3, 1);\n break;\n case 'month':\n time = startOfDate(this.year(), this.month(), 1);\n break;\n case 'week':\n time = startOfDate(this.year(), this.month(), this.date() - this.weekday());\n break;\n case 'isoWeek':\n time = startOfDate(this.year(), this.month(), this.date() - (this.isoWeekday() - 1));\n break;\n case 'day':\n case 'date':\n time = startOfDate(this.year(), this.month(), this.date());\n break;\n case 'hour':\n time = this._d.valueOf();\n time -= mod$1(time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE), MS_PER_HOUR);\n break;\n case 'minute':\n time = this._d.valueOf();\n time -= mod$1(time, MS_PER_MINUTE);\n break;\n case 'second':\n time = this._d.valueOf();\n time -= mod$1(time, MS_PER_SECOND);\n break;\n }\n this._d.setTime(time);\n hooks.updateOffset(this, true);\n return this;\n }\n function endOf(units) {\n var time, startOfDate;\n units = normalizeUnits(units);\n if (units === undefined || units === 'millisecond' || !this.isValid()) {\n return this;\n }\n startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;\n switch (units) {\n case 'year':\n time = startOfDate(this.year() + 1, 0, 1) - 1;\n break;\n case 'quarter':\n time = startOfDate(this.year(), this.month() - this.month() % 3 + 3, 1) - 1;\n break;\n case 'month':\n time = startOfDate(this.year(), this.month() + 1, 1) - 1;\n break;\n case 'week':\n time = startOfDate(this.year(), this.month(), this.date() - this.weekday() + 7) - 1;\n break;\n case 'isoWeek':\n time = startOfDate(this.year(), this.month(), this.date() - (this.isoWeekday() - 1) + 7) - 1;\n break;\n case 'day':\n case 'date':\n time = startOfDate(this.year(), this.month(), this.date() + 1) - 1;\n break;\n case 'hour':\n time = this._d.valueOf();\n time += MS_PER_HOUR - mod$1(time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE), MS_PER_HOUR) - 1;\n break;\n case 'minute':\n time = this._d.valueOf();\n time += MS_PER_MINUTE - mod$1(time, MS_PER_MINUTE) - 1;\n break;\n case 'second':\n time = this._d.valueOf();\n time += MS_PER_SECOND - mod$1(time, MS_PER_SECOND) - 1;\n break;\n }\n this._d.setTime(time);\n hooks.updateOffset(this, true);\n return this;\n }\n function valueOf() {\n return this._d.valueOf() - (this._offset || 0) * 60000;\n }\n function unix() {\n return Math.floor(this.valueOf() / 1000);\n }\n function toDate() {\n return new Date(this.valueOf());\n }\n function toArray() {\n var m = this;\n return [m.year(), m.month(), m.date(), m.hour(), m.minute(), m.second(), m.millisecond()];\n }\n function toObject() {\n var m = this;\n return {\n years: m.year(),\n months: m.month(),\n date: m.date(),\n hours: m.hours(),\n minutes: m.minutes(),\n seconds: m.seconds(),\n milliseconds: m.milliseconds()\n };\n }\n function toJSON() {\n // new Date(NaN).toJSON() === null\n return this.isValid() ? this.toISOString() : null;\n }\n function isValid$2() {\n return isValid(this);\n }\n function parsingFlags() {\n return extend({}, getParsingFlags(this));\n }\n function invalidAt() {\n return getParsingFlags(this).overflow;\n }\n function creationData() {\n return {\n input: this._i,\n format: this._f,\n locale: this._locale,\n isUTC: this._isUTC,\n strict: this._strict\n };\n }\n addFormatToken('N', 0, 0, 'eraAbbr');\n addFormatToken('NN', 0, 0, 'eraAbbr');\n addFormatToken('NNN', 0, 0, 'eraAbbr');\n addFormatToken('NNNN', 0, 0, 'eraName');\n addFormatToken('NNNNN', 0, 0, 'eraNarrow');\n addFormatToken('y', ['y', 1], 'yo', 'eraYear');\n addFormatToken('y', ['yy', 2], 0, 'eraYear');\n addFormatToken('y', ['yyy', 3], 0, 'eraYear');\n addFormatToken('y', ['yyyy', 4], 0, 'eraYear');\n addRegexToken('N', matchEraAbbr);\n addRegexToken('NN', matchEraAbbr);\n addRegexToken('NNN', matchEraAbbr);\n addRegexToken('NNNN', matchEraName);\n addRegexToken('NNNNN', matchEraNarrow);\n addParseToken(['N', 'NN', 'NNN', 'NNNN', 'NNNNN'], function (input, array, config, token) {\n var era = config._locale.erasParse(input, token, config._strict);\n if (era) {\n getParsingFlags(config).era = era;\n } else {\n getParsingFlags(config).invalidEra = input;\n }\n });\n addRegexToken('y', matchUnsigned);\n addRegexToken('yy', matchUnsigned);\n addRegexToken('yyy', matchUnsigned);\n addRegexToken('yyyy', matchUnsigned);\n addRegexToken('yo', matchEraYearOrdinal);\n addParseToken(['y', 'yy', 'yyy', 'yyyy'], YEAR);\n addParseToken(['yo'], function (input, array, config, token) {\n var match;\n if (config._locale._eraYearOrdinalRegex) {\n match = input.match(config._locale._eraYearOrdinalRegex);\n }\n if (config._locale.eraYearOrdinalParse) {\n array[YEAR] = config._locale.eraYearOrdinalParse(input, match);\n } else {\n array[YEAR] = parseInt(input, 10);\n }\n });\n function localeEras(m, format) {\n var i,\n l,\n date,\n eras = this._eras || getLocale('en')._eras;\n for (i = 0, l = eras.length; i < l; ++i) {\n switch (typeof eras[i].since) {\n case 'string':\n // truncate time\n date = hooks(eras[i].since).startOf('day');\n eras[i].since = date.valueOf();\n break;\n }\n switch (typeof eras[i].until) {\n case 'undefined':\n eras[i].until = +Infinity;\n break;\n case 'string':\n // truncate time\n date = hooks(eras[i].until).startOf('day').valueOf();\n eras[i].until = date.valueOf();\n break;\n }\n }\n return eras;\n }\n function localeErasParse(eraName, format, strict) {\n var i,\n l,\n eras = this.eras(),\n name,\n abbr,\n narrow;\n eraName = eraName.toUpperCase();\n for (i = 0, l = eras.length; i < l; ++i) {\n name = eras[i].name.toUpperCase();\n abbr = eras[i].abbr.toUpperCase();\n narrow = eras[i].narrow.toUpperCase();\n if (strict) {\n switch (format) {\n case 'N':\n case 'NN':\n case 'NNN':\n if (abbr === eraName) {\n return eras[i];\n }\n break;\n case 'NNNN':\n if (name === eraName) {\n return eras[i];\n }\n break;\n case 'NNNNN':\n if (narrow === eraName) {\n return eras[i];\n }\n break;\n }\n } else if ([name, abbr, narrow].indexOf(eraName) >= 0) {\n return eras[i];\n }\n }\n }\n function localeErasConvertYear(era, year) {\n var dir = era.since <= era.until ? +1 : -1;\n if (year === undefined) {\n return hooks(era.since).year();\n } else {\n return hooks(era.since).year() + (year - era.offset) * dir;\n }\n }\n function getEraName() {\n var i,\n l,\n val,\n eras = this.localeData().eras();\n for (i = 0, l = eras.length; i < l; ++i) {\n // truncate time\n val = this.clone().startOf('day').valueOf();\n if (eras[i].since <= val && val <= eras[i].until) {\n return eras[i].name;\n }\n if (eras[i].until <= val && val <= eras[i].since) {\n return eras[i].name;\n }\n }\n return '';\n }\n function getEraNarrow() {\n var i,\n l,\n val,\n eras = this.localeData().eras();\n for (i = 0, l = eras.length; i < l; ++i) {\n // truncate time\n val = this.clone().startOf('day').valueOf();\n if (eras[i].since <= val && val <= eras[i].until) {\n return eras[i].narrow;\n }\n if (eras[i].until <= val && val <= eras[i].since) {\n return eras[i].narrow;\n }\n }\n return '';\n }\n function getEraAbbr() {\n var i,\n l,\n val,\n eras = this.localeData().eras();\n for (i = 0, l = eras.length; i < l; ++i) {\n // truncate time\n val = this.clone().startOf('day').valueOf();\n if (eras[i].since <= val && val <= eras[i].until) {\n return eras[i].abbr;\n }\n if (eras[i].until <= val && val <= eras[i].since) {\n return eras[i].abbr;\n }\n }\n return '';\n }\n function getEraYear() {\n var i,\n l,\n dir,\n val,\n eras = this.localeData().eras();\n for (i = 0, l = eras.length; i < l; ++i) {\n dir = eras[i].since <= eras[i].until ? +1 : -1;\n\n // truncate time\n val = this.clone().startOf('day').valueOf();\n if (eras[i].since <= val && val <= eras[i].until || eras[i].until <= val && val <= eras[i].since) {\n return (this.year() - hooks(eras[i].since).year()) * dir + eras[i].offset;\n }\n }\n return this.year();\n }\n function erasNameRegex(isStrict) {\n if (!hasOwnProp(this, '_erasNameRegex')) {\n computeErasParse.call(this);\n }\n return isStrict ? this._erasNameRegex : this._erasRegex;\n }\n function erasAbbrRegex(isStrict) {\n if (!hasOwnProp(this, '_erasAbbrRegex')) {\n computeErasParse.call(this);\n }\n return isStrict ? this._erasAbbrRegex : this._erasRegex;\n }\n function erasNarrowRegex(isStrict) {\n if (!hasOwnProp(this, '_erasNarrowRegex')) {\n computeErasParse.call(this);\n }\n return isStrict ? this._erasNarrowRegex : this._erasRegex;\n }\n function matchEraAbbr(isStrict, locale) {\n return locale.erasAbbrRegex(isStrict);\n }\n function matchEraName(isStrict, locale) {\n return locale.erasNameRegex(isStrict);\n }\n function matchEraNarrow(isStrict, locale) {\n return locale.erasNarrowRegex(isStrict);\n }\n function matchEraYearOrdinal(isStrict, locale) {\n return locale._eraYearOrdinalRegex || matchUnsigned;\n }\n function computeErasParse() {\n var abbrPieces = [],\n namePieces = [],\n narrowPieces = [],\n mixedPieces = [],\n i,\n l,\n erasName,\n erasAbbr,\n erasNarrow,\n eras = this.eras();\n for (i = 0, l = eras.length; i < l; ++i) {\n erasName = regexEscape(eras[i].name);\n erasAbbr = regexEscape(eras[i].abbr);\n erasNarrow = regexEscape(eras[i].narrow);\n namePieces.push(erasName);\n abbrPieces.push(erasAbbr);\n narrowPieces.push(erasNarrow);\n mixedPieces.push(erasName);\n mixedPieces.push(erasAbbr);\n mixedPieces.push(erasNarrow);\n }\n this._erasRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');\n this._erasNameRegex = new RegExp('^(' + namePieces.join('|') + ')', 'i');\n this._erasAbbrRegex = new RegExp('^(' + abbrPieces.join('|') + ')', 'i');\n this._erasNarrowRegex = new RegExp('^(' + narrowPieces.join('|') + ')', 'i');\n }\n\n // FORMATTING\n\n addFormatToken(0, ['gg', 2], 0, function () {\n return this.weekYear() % 100;\n });\n addFormatToken(0, ['GG', 2], 0, function () {\n return this.isoWeekYear() % 100;\n });\n function addWeekYearFormatToken(token, getter) {\n addFormatToken(0, [token, token.length], 0, getter);\n }\n addWeekYearFormatToken('gggg', 'weekYear');\n addWeekYearFormatToken('ggggg', 'weekYear');\n addWeekYearFormatToken('GGGG', 'isoWeekYear');\n addWeekYearFormatToken('GGGGG', 'isoWeekYear');\n\n // ALIASES\n\n // PARSING\n\n addRegexToken('G', matchSigned);\n addRegexToken('g', matchSigned);\n addRegexToken('GG', match1to2, match2);\n addRegexToken('gg', match1to2, match2);\n addRegexToken('GGGG', match1to4, match4);\n addRegexToken('gggg', match1to4, match4);\n addRegexToken('GGGGG', match1to6, match6);\n addRegexToken('ggggg', match1to6, match6);\n addWeekParseToken(['gggg', 'ggggg', 'GGGG', 'GGGGG'], function (input, week, config, token) {\n week[token.substr(0, 2)] = toInt(input);\n });\n addWeekParseToken(['gg', 'GG'], function (input, week, config, token) {\n week[token] = hooks.parseTwoDigitYear(input);\n });\n\n // MOMENTS\n\n function getSetWeekYear(input) {\n return getSetWeekYearHelper.call(this, input, this.week(), this.weekday() + this.localeData()._week.dow, this.localeData()._week.dow, this.localeData()._week.doy);\n }\n function getSetISOWeekYear(input) {\n return getSetWeekYearHelper.call(this, input, this.isoWeek(), this.isoWeekday(), 1, 4);\n }\n function getISOWeeksInYear() {\n return weeksInYear(this.year(), 1, 4);\n }\n function getISOWeeksInISOWeekYear() {\n return weeksInYear(this.isoWeekYear(), 1, 4);\n }\n function getWeeksInYear() {\n var weekInfo = this.localeData()._week;\n return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy);\n }\n function getWeeksInWeekYear() {\n var weekInfo = this.localeData()._week;\n return weeksInYear(this.weekYear(), weekInfo.dow, weekInfo.doy);\n }\n function getSetWeekYearHelper(input, week, weekday, dow, doy) {\n var weeksTarget;\n if (input == null) {\n return weekOfYear(this, dow, doy).year;\n } else {\n weeksTarget = weeksInYear(input, dow, doy);\n if (week > weeksTarget) {\n week = weeksTarget;\n }\n return setWeekAll.call(this, input, week, weekday, dow, doy);\n }\n }\n function setWeekAll(weekYear, week, weekday, dow, doy) {\n var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy),\n date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear);\n this.year(date.getUTCFullYear());\n this.month(date.getUTCMonth());\n this.date(date.getUTCDate());\n return this;\n }\n\n // FORMATTING\n\n addFormatToken('Q', 0, 'Qo', 'quarter');\n\n // PARSING\n\n addRegexToken('Q', match1);\n addParseToken('Q', function (input, array) {\n array[MONTH] = (toInt(input) - 1) * 3;\n });\n\n // MOMENTS\n\n function getSetQuarter(input) {\n return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3);\n }\n\n // FORMATTING\n\n addFormatToken('D', ['DD', 2], 'Do', 'date');\n\n // PARSING\n\n addRegexToken('D', match1to2, match1to2NoLeadingZero);\n addRegexToken('DD', match1to2, match2);\n addRegexToken('Do', function (isStrict, locale) {\n // TODO: Remove \"ordinalParse\" fallback in next major release.\n return isStrict ? locale._dayOfMonthOrdinalParse || locale._ordinalParse : locale._dayOfMonthOrdinalParseLenient;\n });\n addParseToken(['D', 'DD'], DATE);\n addParseToken('Do', function (input, array) {\n array[DATE] = toInt(input.match(match1to2)[0]);\n });\n\n // MOMENTS\n\n var getSetDayOfMonth = makeGetSet('Date', true);\n\n // FORMATTING\n\n addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear');\n\n // PARSING\n\n addRegexToken('DDD', match1to3);\n addRegexToken('DDDD', match3);\n addParseToken(['DDD', 'DDDD'], function (input, array, config) {\n config._dayOfYear = toInt(input);\n });\n\n // HELPERS\n\n // MOMENTS\n\n function getSetDayOfYear(input) {\n var dayOfYear = Math.round((this.clone().startOf('day') - this.clone().startOf('year')) / 864e5) + 1;\n return input == null ? dayOfYear : this.add(input - dayOfYear, 'd');\n }\n\n // FORMATTING\n\n addFormatToken('m', ['mm', 2], 0, 'minute');\n\n // PARSING\n\n addRegexToken('m', match1to2, match1to2HasZero);\n addRegexToken('mm', match1to2, match2);\n addParseToken(['m', 'mm'], MINUTE);\n\n // MOMENTS\n\n var getSetMinute = makeGetSet('Minutes', false);\n\n // FORMATTING\n\n addFormatToken('s', ['ss', 2], 0, 'second');\n\n // PARSING\n\n addRegexToken('s', match1to2, match1to2HasZero);\n addRegexToken('ss', match1to2, match2);\n addParseToken(['s', 'ss'], SECOND);\n\n // MOMENTS\n\n var getSetSecond = makeGetSet('Seconds', false);\n\n // FORMATTING\n\n addFormatToken('S', 0, 0, function () {\n return ~~(this.millisecond() / 100);\n });\n addFormatToken(0, ['SS', 2], 0, function () {\n return ~~(this.millisecond() / 10);\n });\n addFormatToken(0, ['SSS', 3], 0, 'millisecond');\n addFormatToken(0, ['SSSS', 4], 0, function () {\n return this.millisecond() * 10;\n });\n addFormatToken(0, ['SSSSS', 5], 0, function () {\n return this.millisecond() * 100;\n });\n addFormatToken(0, ['SSSSSS', 6], 0, function () {\n return this.millisecond() * 1000;\n });\n addFormatToken(0, ['SSSSSSS', 7], 0, function () {\n return this.millisecond() * 10000;\n });\n addFormatToken(0, ['SSSSSSSS', 8], 0, function () {\n return this.millisecond() * 100000;\n });\n addFormatToken(0, ['SSSSSSSSS', 9], 0, function () {\n return this.millisecond() * 1000000;\n });\n\n // PARSING\n\n addRegexToken('S', match1to3, match1);\n addRegexToken('SS', match1to3, match2);\n addRegexToken('SSS', match1to3, match3);\n var token, getSetMillisecond;\n for (token = 'SSSS'; token.length <= 9; token += 'S') {\n addRegexToken(token, matchUnsigned);\n }\n function parseMs(input, array) {\n array[MILLISECOND] = toInt(('0.' + input) * 1000);\n }\n for (token = 'S'; token.length <= 9; token += 'S') {\n addParseToken(token, parseMs);\n }\n getSetMillisecond = makeGetSet('Milliseconds', false);\n\n // FORMATTING\n\n addFormatToken('z', 0, 0, 'zoneAbbr');\n addFormatToken('zz', 0, 0, 'zoneName');\n\n // MOMENTS\n\n function getZoneAbbr() {\n return this._isUTC ? 'UTC' : '';\n }\n function getZoneName() {\n return this._isUTC ? 'Coordinated Universal Time' : '';\n }\n var proto = Moment.prototype;\n proto.add = add;\n proto.calendar = calendar$1;\n proto.clone = clone;\n proto.diff = diff;\n proto.endOf = endOf;\n proto.format = format;\n proto.from = from;\n proto.fromNow = fromNow;\n proto.to = to;\n proto.toNow = toNow;\n proto.get = stringGet;\n proto.invalidAt = invalidAt;\n proto.isAfter = isAfter;\n proto.isBefore = isBefore;\n proto.isBetween = isBetween;\n proto.isSame = isSame;\n proto.isSameOrAfter = isSameOrAfter;\n proto.isSameOrBefore = isSameOrBefore;\n proto.isValid = isValid$2;\n proto.lang = lang;\n proto.locale = locale;\n proto.localeData = localeData;\n proto.max = prototypeMax;\n proto.min = prototypeMin;\n proto.parsingFlags = parsingFlags;\n proto.set = stringSet;\n proto.startOf = startOf;\n proto.subtract = subtract;\n proto.toArray = toArray;\n proto.toObject = toObject;\n proto.toDate = toDate;\n proto.toISOString = toISOString;\n proto.inspect = inspect;\n if (typeof Symbol !== 'undefined' && Symbol.for != null) {\n proto[Symbol.for('nodejs.util.inspect.custom')] = function () {\n return 'Moment<' + this.format() + '>';\n };\n }\n proto.toJSON = toJSON;\n proto.toString = toString;\n proto.unix = unix;\n proto.valueOf = valueOf;\n proto.creationData = creationData;\n proto.eraName = getEraName;\n proto.eraNarrow = getEraNarrow;\n proto.eraAbbr = getEraAbbr;\n proto.eraYear = getEraYear;\n proto.year = getSetYear;\n proto.isLeapYear = getIsLeapYear;\n proto.weekYear = getSetWeekYear;\n proto.isoWeekYear = getSetISOWeekYear;\n proto.quarter = proto.quarters = getSetQuarter;\n proto.month = getSetMonth;\n proto.daysInMonth = getDaysInMonth;\n proto.week = proto.weeks = getSetWeek;\n proto.isoWeek = proto.isoWeeks = getSetISOWeek;\n proto.weeksInYear = getWeeksInYear;\n proto.weeksInWeekYear = getWeeksInWeekYear;\n proto.isoWeeksInYear = getISOWeeksInYear;\n proto.isoWeeksInISOWeekYear = getISOWeeksInISOWeekYear;\n proto.date = getSetDayOfMonth;\n proto.day = proto.days = getSetDayOfWeek;\n proto.weekday = getSetLocaleDayOfWeek;\n proto.isoWeekday = getSetISODayOfWeek;\n proto.dayOfYear = getSetDayOfYear;\n proto.hour = proto.hours = getSetHour;\n proto.minute = proto.minutes = getSetMinute;\n proto.second = proto.seconds = getSetSecond;\n proto.millisecond = proto.milliseconds = getSetMillisecond;\n proto.utcOffset = getSetOffset;\n proto.utc = setOffsetToUTC;\n proto.local = setOffsetToLocal;\n proto.parseZone = setOffsetToParsedOffset;\n proto.hasAlignedHourOffset = hasAlignedHourOffset;\n proto.isDST = isDaylightSavingTime;\n proto.isLocal = isLocal;\n proto.isUtcOffset = isUtcOffset;\n proto.isUtc = isUtc;\n proto.isUTC = isUtc;\n proto.zoneAbbr = getZoneAbbr;\n proto.zoneName = getZoneName;\n proto.dates = deprecate('dates accessor is deprecated. Use date instead.', getSetDayOfMonth);\n proto.months = deprecate('months accessor is deprecated. Use month instead', getSetMonth);\n proto.years = deprecate('years accessor is deprecated. Use year instead', getSetYear);\n proto.zone = deprecate('moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/', getSetZone);\n proto.isDSTShifted = deprecate('isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information', isDaylightSavingTimeShifted);\n function createUnix(input) {\n return createLocal(input * 1000);\n }\n function createInZone() {\n return createLocal.apply(null, arguments).parseZone();\n }\n function preParsePostFormat(string) {\n return string;\n }\n var proto$1 = Locale.prototype;\n proto$1.calendar = calendar;\n proto$1.longDateFormat = longDateFormat;\n proto$1.invalidDate = invalidDate;\n proto$1.ordinal = ordinal;\n proto$1.preparse = preParsePostFormat;\n proto$1.postformat = preParsePostFormat;\n proto$1.relativeTime = relativeTime;\n proto$1.pastFuture = pastFuture;\n proto$1.set = set;\n proto$1.eras = localeEras;\n proto$1.erasParse = localeErasParse;\n proto$1.erasConvertYear = localeErasConvertYear;\n proto$1.erasAbbrRegex = erasAbbrRegex;\n proto$1.erasNameRegex = erasNameRegex;\n proto$1.erasNarrowRegex = erasNarrowRegex;\n proto$1.months = localeMonths;\n proto$1.monthsShort = localeMonthsShort;\n proto$1.monthsParse = localeMonthsParse;\n proto$1.monthsRegex = monthsRegex;\n proto$1.monthsShortRegex = monthsShortRegex;\n proto$1.week = localeWeek;\n proto$1.firstDayOfYear = localeFirstDayOfYear;\n proto$1.firstDayOfWeek = localeFirstDayOfWeek;\n proto$1.weekdays = localeWeekdays;\n proto$1.weekdaysMin = localeWeekdaysMin;\n proto$1.weekdaysShort = localeWeekdaysShort;\n proto$1.weekdaysParse = localeWeekdaysParse;\n proto$1.weekdaysRegex = weekdaysRegex;\n proto$1.weekdaysShortRegex = weekdaysShortRegex;\n proto$1.weekdaysMinRegex = weekdaysMinRegex;\n proto$1.isPM = localeIsPM;\n proto$1.meridiem = localeMeridiem;\n function get$1(format, index, field, setter) {\n var locale = getLocale(),\n utc = createUTC().set(setter, index);\n return locale[field](utc, format);\n }\n function listMonthsImpl(format, index, field) {\n if (isNumber(format)) {\n index = format;\n format = undefined;\n }\n format = format || '';\n if (index != null) {\n return get$1(format, index, field, 'month');\n }\n var i,\n out = [];\n for (i = 0; i < 12; i++) {\n out[i] = get$1(format, i, field, 'month');\n }\n return out;\n }\n\n // ()\n // (5)\n // (fmt, 5)\n // (fmt)\n // (true)\n // (true, 5)\n // (true, fmt, 5)\n // (true, fmt)\n function listWeekdaysImpl(localeSorted, format, index, field) {\n if (typeof localeSorted === 'boolean') {\n if (isNumber(format)) {\n index = format;\n format = undefined;\n }\n format = format || '';\n } else {\n format = localeSorted;\n index = format;\n localeSorted = false;\n if (isNumber(format)) {\n index = format;\n format = undefined;\n }\n format = format || '';\n }\n var locale = getLocale(),\n shift = localeSorted ? locale._week.dow : 0,\n i,\n out = [];\n if (index != null) {\n return get$1(format, (index + shift) % 7, field, 'day');\n }\n for (i = 0; i < 7; i++) {\n out[i] = get$1(format, (i + shift) % 7, field, 'day');\n }\n return out;\n }\n function listMonths(format, index) {\n return listMonthsImpl(format, index, 'months');\n }\n function listMonthsShort(format, index) {\n return listMonthsImpl(format, index, 'monthsShort');\n }\n function listWeekdays(localeSorted, format, index) {\n return listWeekdaysImpl(localeSorted, format, index, 'weekdays');\n }\n function listWeekdaysShort(localeSorted, format, index) {\n return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort');\n }\n function listWeekdaysMin(localeSorted, format, index) {\n return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin');\n }\n getSetGlobalLocale('en', {\n eras: [{\n since: '0001-01-01',\n until: +Infinity,\n offset: 1,\n name: 'Anno Domini',\n narrow: 'AD',\n abbr: 'AD'\n }, {\n since: '0000-12-31',\n until: -Infinity,\n offset: 1,\n name: 'Before Christ',\n narrow: 'BC',\n abbr: 'BC'\n }],\n dayOfMonthOrdinalParse: /\\d{1,2}(th|st|nd|rd)/,\n ordinal: function (number) {\n var b = number % 10,\n output = toInt(number % 100 / 10) === 1 ? 'th' : b === 1 ? 'st' : b === 2 ? 'nd' : b === 3 ? 'rd' : 'th';\n return number + output;\n }\n });\n\n // Side effect imports\n\n hooks.lang = deprecate('moment.lang is deprecated. Use moment.locale instead.', getSetGlobalLocale);\n hooks.langData = deprecate('moment.langData is deprecated. Use moment.localeData instead.', getLocale);\n var mathAbs = Math.abs;\n function abs() {\n var data = this._data;\n this._milliseconds = mathAbs(this._milliseconds);\n this._days = mathAbs(this._days);\n this._months = mathAbs(this._months);\n data.milliseconds = mathAbs(data.milliseconds);\n data.seconds = mathAbs(data.seconds);\n data.minutes = mathAbs(data.minutes);\n data.hours = mathAbs(data.hours);\n data.months = mathAbs(data.months);\n data.years = mathAbs(data.years);\n return this;\n }\n function addSubtract$1(duration, input, value, direction) {\n var other = createDuration(input, value);\n duration._milliseconds += direction * other._milliseconds;\n duration._days += direction * other._days;\n duration._months += direction * other._months;\n return duration._bubble();\n }\n\n // supports only 2.0-style add(1, 's') or add(duration)\n function add$1(input, value) {\n return addSubtract$1(this, input, value, 1);\n }\n\n // supports only 2.0-style subtract(1, 's') or subtract(duration)\n function subtract$1(input, value) {\n return addSubtract$1(this, input, value, -1);\n }\n function absCeil(number) {\n if (number < 0) {\n return Math.floor(number);\n } else {\n return Math.ceil(number);\n }\n }\n function bubble() {\n var milliseconds = this._milliseconds,\n days = this._days,\n months = this._months,\n data = this._data,\n seconds,\n minutes,\n hours,\n years,\n monthsFromDays;\n\n // if we have a mix of positive and negative values, bubble down first\n // check: https://github.com/moment/moment/issues/2166\n if (!(milliseconds >= 0 && days >= 0 && months >= 0 || milliseconds <= 0 && days <= 0 && months <= 0)) {\n milliseconds += absCeil(monthsToDays(months) + days) * 864e5;\n days = 0;\n months = 0;\n }\n\n // The following code bubbles up values, see the tests for\n // examples of what that means.\n data.milliseconds = milliseconds % 1000;\n seconds = absFloor(milliseconds / 1000);\n data.seconds = seconds % 60;\n minutes = absFloor(seconds / 60);\n data.minutes = minutes % 60;\n hours = absFloor(minutes / 60);\n data.hours = hours % 24;\n days += absFloor(hours / 24);\n\n // convert days to months\n monthsFromDays = absFloor(daysToMonths(days));\n months += monthsFromDays;\n days -= absCeil(monthsToDays(monthsFromDays));\n\n // 12 months -> 1 year\n years = absFloor(months / 12);\n months %= 12;\n data.days = days;\n data.months = months;\n data.years = years;\n return this;\n }\n function daysToMonths(days) {\n // 400 years have 146097 days (taking into account leap year rules)\n // 400 years have 12 months === 4800\n return days * 4800 / 146097;\n }\n function monthsToDays(months) {\n // the reverse of daysToMonths\n return months * 146097 / 4800;\n }\n function as(units) {\n if (!this.isValid()) {\n return NaN;\n }\n var days,\n months,\n milliseconds = this._milliseconds;\n units = normalizeUnits(units);\n if (units === 'month' || units === 'quarter' || units === 'year') {\n days = this._days + milliseconds / 864e5;\n months = this._months + daysToMonths(days);\n switch (units) {\n case 'month':\n return months;\n case 'quarter':\n return months / 3;\n case 'year':\n return months / 12;\n }\n } else {\n // handle milliseconds separately because of floating point math errors (issue #1867)\n days = this._days + Math.round(monthsToDays(this._months));\n switch (units) {\n case 'week':\n return days / 7 + milliseconds / 6048e5;\n case 'day':\n return days + milliseconds / 864e5;\n case 'hour':\n return days * 24 + milliseconds / 36e5;\n case 'minute':\n return days * 1440 + milliseconds / 6e4;\n case 'second':\n return days * 86400 + milliseconds / 1000;\n // Math.floor prevents floating point math errors here\n case 'millisecond':\n return Math.floor(days * 864e5) + milliseconds;\n default:\n throw new Error('Unknown unit ' + units);\n }\n }\n }\n function makeAs(alias) {\n return function () {\n return this.as(alias);\n };\n }\n var asMilliseconds = makeAs('ms'),\n asSeconds = makeAs('s'),\n asMinutes = makeAs('m'),\n asHours = makeAs('h'),\n asDays = makeAs('d'),\n asWeeks = makeAs('w'),\n asMonths = makeAs('M'),\n asQuarters = makeAs('Q'),\n asYears = makeAs('y'),\n valueOf$1 = asMilliseconds;\n function clone$1() {\n return createDuration(this);\n }\n function get$2(units) {\n units = normalizeUnits(units);\n return this.isValid() ? this[units + 's']() : NaN;\n }\n function makeGetter(name) {\n return function () {\n return this.isValid() ? this._data[name] : NaN;\n };\n }\n var milliseconds = makeGetter('milliseconds'),\n seconds = makeGetter('seconds'),\n minutes = makeGetter('minutes'),\n hours = makeGetter('hours'),\n days = makeGetter('days'),\n months = makeGetter('months'),\n years = makeGetter('years');\n function weeks() {\n return absFloor(this.days() / 7);\n }\n var round = Math.round,\n thresholds = {\n ss: 44,\n // a few seconds to seconds\n s: 45,\n // seconds to minute\n m: 45,\n // minutes to hour\n h: 22,\n // hours to day\n d: 26,\n // days to month/week\n w: null,\n // weeks to month\n M: 11 // months to year\n };\n\n // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize\n function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) {\n return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture);\n }\n function relativeTime$1(posNegDuration, withoutSuffix, thresholds, locale) {\n var duration = createDuration(posNegDuration).abs(),\n seconds = round(duration.as('s')),\n minutes = round(duration.as('m')),\n hours = round(duration.as('h')),\n days = round(duration.as('d')),\n months = round(duration.as('M')),\n weeks = round(duration.as('w')),\n years = round(duration.as('y')),\n a = seconds <= thresholds.ss && ['s', seconds] || seconds < thresholds.s && ['ss', seconds] || minutes <= 1 && ['m'] || minutes < thresholds.m && ['mm', minutes] || hours <= 1 && ['h'] || hours < thresholds.h && ['hh', hours] || days <= 1 && ['d'] || days < thresholds.d && ['dd', days];\n if (thresholds.w != null) {\n a = a || weeks <= 1 && ['w'] || weeks < thresholds.w && ['ww', weeks];\n }\n a = a || months <= 1 && ['M'] || months < thresholds.M && ['MM', months] || years <= 1 && ['y'] || ['yy', years];\n a[2] = withoutSuffix;\n a[3] = +posNegDuration > 0;\n a[4] = locale;\n return substituteTimeAgo.apply(null, a);\n }\n\n // This function allows you to set the rounding function for relative time strings\n function getSetRelativeTimeRounding(roundingFunction) {\n if (roundingFunction === undefined) {\n return round;\n }\n if (typeof roundingFunction === 'function') {\n round = roundingFunction;\n return true;\n }\n return false;\n }\n\n // This function allows you to set a threshold for relative time strings\n function getSetRelativeTimeThreshold(threshold, limit) {\n if (thresholds[threshold] === undefined) {\n return false;\n }\n if (limit === undefined) {\n return thresholds[threshold];\n }\n thresholds[threshold] = limit;\n if (threshold === 's') {\n thresholds.ss = limit - 1;\n }\n return true;\n }\n function humanize(argWithSuffix, argThresholds) {\n if (!this.isValid()) {\n return this.localeData().invalidDate();\n }\n var withSuffix = false,\n th = thresholds,\n locale,\n output;\n if (typeof argWithSuffix === 'object') {\n argThresholds = argWithSuffix;\n argWithSuffix = false;\n }\n if (typeof argWithSuffix === 'boolean') {\n withSuffix = argWithSuffix;\n }\n if (typeof argThresholds === 'object') {\n th = Object.assign({}, thresholds, argThresholds);\n if (argThresholds.s != null && argThresholds.ss == null) {\n th.ss = argThresholds.s - 1;\n }\n }\n locale = this.localeData();\n output = relativeTime$1(this, !withSuffix, th, locale);\n if (withSuffix) {\n output = locale.pastFuture(+this, output);\n }\n return locale.postformat(output);\n }\n var abs$1 = Math.abs;\n function sign(x) {\n return (x > 0) - (x < 0) || +x;\n }\n function toISOString$1() {\n // for ISO strings we do not use the normal bubbling rules:\n // * milliseconds bubble up until they become hours\n // * days do not bubble at all\n // * months bubble up until they become years\n // This is because there is no context-free conversion between hours and days\n // (think of clock changes)\n // and also not between days and months (28-31 days per month)\n if (!this.isValid()) {\n return this.localeData().invalidDate();\n }\n var seconds = abs$1(this._milliseconds) / 1000,\n days = abs$1(this._days),\n months = abs$1(this._months),\n minutes,\n hours,\n years,\n s,\n total = this.asSeconds(),\n totalSign,\n ymSign,\n daysSign,\n hmsSign;\n if (!total) {\n // this is the same as C#'s (Noda) and python (isodate)...\n // but not other JS (goog.date)\n return 'P0D';\n }\n\n // 3600 seconds -> 60 minutes -> 1 hour\n minutes = absFloor(seconds / 60);\n hours = absFloor(minutes / 60);\n seconds %= 60;\n minutes %= 60;\n\n // 12 months -> 1 year\n years = absFloor(months / 12);\n months %= 12;\n\n // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js\n s = seconds ? seconds.toFixed(3).replace(/\\.?0+$/, '') : '';\n totalSign = total < 0 ? '-' : '';\n ymSign = sign(this._months) !== sign(total) ? '-' : '';\n daysSign = sign(this._days) !== sign(total) ? '-' : '';\n hmsSign = sign(this._milliseconds) !== sign(total) ? '-' : '';\n return totalSign + 'P' + (years ? ymSign + years + 'Y' : '') + (months ? ymSign + months + 'M' : '') + (days ? daysSign + days + 'D' : '') + (hours || minutes || seconds ? 'T' : '') + (hours ? hmsSign + hours + 'H' : '') + (minutes ? hmsSign + minutes + 'M' : '') + (seconds ? hmsSign + s + 'S' : '');\n }\n var proto$2 = Duration.prototype;\n proto$2.isValid = isValid$1;\n proto$2.abs = abs;\n proto$2.add = add$1;\n proto$2.subtract = subtract$1;\n proto$2.as = as;\n proto$2.asMilliseconds = asMilliseconds;\n proto$2.asSeconds = asSeconds;\n proto$2.asMinutes = asMinutes;\n proto$2.asHours = asHours;\n proto$2.asDays = asDays;\n proto$2.asWeeks = asWeeks;\n proto$2.asMonths = asMonths;\n proto$2.asQuarters = asQuarters;\n proto$2.asYears = asYears;\n proto$2.valueOf = valueOf$1;\n proto$2._bubble = bubble;\n proto$2.clone = clone$1;\n proto$2.get = get$2;\n proto$2.milliseconds = milliseconds;\n proto$2.seconds = seconds;\n proto$2.minutes = minutes;\n proto$2.hours = hours;\n proto$2.days = days;\n proto$2.weeks = weeks;\n proto$2.months = months;\n proto$2.years = years;\n proto$2.humanize = humanize;\n proto$2.toISOString = toISOString$1;\n proto$2.toString = toISOString$1;\n proto$2.toJSON = toISOString$1;\n proto$2.locale = locale;\n proto$2.localeData = localeData;\n proto$2.toIsoString = deprecate('toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)', toISOString$1);\n proto$2.lang = lang;\n\n // FORMATTING\n\n addFormatToken('X', 0, 0, 'unix');\n addFormatToken('x', 0, 0, 'valueOf');\n\n // PARSING\n\n addRegexToken('x', matchSigned);\n addRegexToken('X', matchTimestamp);\n addParseToken('X', function (input, array, config) {\n config._d = new Date(parseFloat(input) * 1000);\n });\n addParseToken('x', function (input, array, config) {\n config._d = new Date(toInt(input));\n });\n\n //! moment.js\n\n hooks.version = '2.30.1';\n setHookCallback(createLocal);\n hooks.fn = proto;\n hooks.min = min;\n hooks.max = max;\n hooks.now = now;\n hooks.utc = createUTC;\n hooks.unix = createUnix;\n hooks.months = listMonths;\n hooks.isDate = isDate;\n hooks.locale = getSetGlobalLocale;\n hooks.invalid = createInvalid;\n hooks.duration = createDuration;\n hooks.isMoment = isMoment;\n hooks.weekdays = listWeekdays;\n hooks.parseZone = createInZone;\n hooks.localeData = getLocale;\n hooks.isDuration = isDuration;\n hooks.monthsShort = listMonthsShort;\n hooks.weekdaysMin = listWeekdaysMin;\n hooks.defineLocale = defineLocale;\n hooks.updateLocale = updateLocale;\n hooks.locales = listLocales;\n hooks.weekdaysShort = listWeekdaysShort;\n hooks.normalizeUnits = normalizeUnits;\n hooks.relativeTimeRounding = getSetRelativeTimeRounding;\n hooks.relativeTimeThreshold = getSetRelativeTimeThreshold;\n hooks.calendarFormat = getCalendarFormat;\n hooks.prototype = proto;\n\n // currently HTML5 input type only supports 24-hour formats\n hooks.HTML5_FMT = {\n DATETIME_LOCAL: 'YYYY-MM-DDTHH:mm',\n // \n DATETIME_LOCAL_SECONDS: 'YYYY-MM-DDTHH:mm:ss',\n // \n DATETIME_LOCAL_MS: 'YYYY-MM-DDTHH:mm:ss.SSS',\n // \n DATE: 'YYYY-MM-DD',\n // \n TIME: 'HH:mm',\n // \n TIME_SECONDS: 'HH:mm:ss',\n // \n TIME_MS: 'HH:mm:ss.SSS',\n // \n WEEK: 'GGGG-[W]WW',\n // \n MONTH: 'YYYY-MM' // \n };\n return hooks;\n});","export default function (defs) {\n defs('EPSG:4326', \"+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees\");\n defs('EPSG:4269', \"+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees\");\n defs('EPSG:3857', \"+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs\");\n defs.WGS84 = defs['EPSG:4326'];\n defs['EPSG:3785'] = defs['EPSG:3857']; // maintain backward compat, official code is 3857\n defs.GOOGLE = defs['EPSG:3857'];\n defs['EPSG:900913'] = defs['EPSG:3857'];\n defs['EPSG:102113'] = defs['EPSG:3857'];\n}","export var PJD_3PARAM = 1;\nexport var PJD_7PARAM = 2;\nexport var PJD_GRIDSHIFT = 3;\nexport var PJD_WGS84 = 4; // WGS84 or equivalent\nexport var PJD_NODATUM = 5; // WGS84 or equivalent\nexport var SRS_WGS84_SEMIMAJOR = 6378137.0; // only used in grid shift transforms\nexport var SRS_WGS84_SEMIMINOR = 6356752.314; // only used in grid shift transforms\nexport var SRS_WGS84_ESQUARED = 0.0066943799901413165; // only used in grid shift transforms\nexport var SEC_TO_RAD = 4.84813681109535993589914102357e-6;\nexport var HALF_PI = Math.PI / 2;\n// ellipoid pj_set_ell.c\nexport var SIXTH = 0.1666666666666666667;\n/* 1/6 */\nexport var RA4 = 0.04722222222222222222;\n/* 17/360 */\nexport var RA6 = 0.02215608465608465608;\nexport var EPSLN = 1.0e-10;\n// you'd think you could use Number.EPSILON above but that makes\n// Mollweide get into an infinate loop.\n\nexport var D2R = 0.01745329251994329577;\nexport var R2D = 57.29577951308232088;\nexport var FORTPI = Math.PI / 4;\nexport var TWO_PI = Math.PI * 2;\n// SPI is slightly greater than Math.PI, so values that exceed the -180..180\n// degree range by a tiny amount don't get wrapped. This prevents points that\n// have drifted from their original location along the 180th meridian (due to\n// floating point error) from changing their sign.\nexport var SPI = 3.14159265359;","var exports = {};\nexport { exports as default };\nexports.greenwich = 0.0; //\"0dE\",\nexports.lisbon = -9.131906111111; //\"9d07'54.862\\\"W\",\nexports.paris = 2.337229166667; //\"2d20'14.025\\\"E\",\nexports.bogota = -74.080916666667; //\"74d04'51.3\\\"W\",\nexports.madrid = -3.687938888889; //\"3d41'16.58\\\"W\",\nexports.rome = 12.452333333333; //\"12d27'8.4\\\"E\",\nexports.bern = 7.439583333333; //\"7d26'22.5\\\"E\",\nexports.jakarta = 106.807719444444; //\"106d48'27.79\\\"E\",\nexports.ferro = -17.666666666667; //\"17d40'W\",\nexports.brussels = 4.367975; //\"4d22'4.71\\\"E\",\nexports.stockholm = 18.058277777778; //\"18d3'29.8\\\"E\",\nexports.athens = 23.7163375; //\"23d42'58.815\\\"E\",\nexports.oslo = 10.722916666667; //\"10d43'22.5\\\"E\"","export default {\n ft: {\n to_meter: 0.3048\n },\n 'us-ft': {\n to_meter: 1200 / 3937\n }\n};","var ignoredChar = /[\\s_\\-\\/\\(\\)]/g;\nexport default function match(obj, key) {\n if (obj[key]) {\n return obj[key];\n }\n var keys = Object.keys(obj);\n var lkey = key.toLowerCase().replace(ignoredChar, '');\n var i = -1;\n var testkey, processedKey;\n while (++i < keys.length) {\n testkey = keys[i];\n processedKey = testkey.toLowerCase().replace(ignoredChar, '');\n if (processedKey === lkey) {\n return obj[testkey];\n }\n }\n}","import { D2R } from './constants/values';\nimport PrimeMeridian from './constants/PrimeMeridian';\nimport units from './constants/units';\nimport match from './match';\nexport default function (defData) {\n var self = {};\n var paramObj = defData.split('+').map(function (v) {\n return v.trim();\n }).filter(function (a) {\n return a;\n }).reduce(function (p, a) {\n var split = a.split('=');\n split.push(true);\n p[split[0].toLowerCase()] = split[1];\n return p;\n }, {});\n var paramName, paramVal, paramOutname;\n var params = {\n proj: 'projName',\n datum: 'datumCode',\n rf: function (v) {\n self.rf = parseFloat(v);\n },\n lat_0: function (v) {\n self.lat0 = v * D2R;\n },\n lat_1: function (v) {\n self.lat1 = v * D2R;\n },\n lat_2: function (v) {\n self.lat2 = v * D2R;\n },\n lat_ts: function (v) {\n self.lat_ts = v * D2R;\n },\n lon_0: function (v) {\n self.long0 = v * D2R;\n },\n lon_1: function (v) {\n self.long1 = v * D2R;\n },\n lon_2: function (v) {\n self.long2 = v * D2R;\n },\n alpha: function (v) {\n self.alpha = parseFloat(v) * D2R;\n },\n gamma: function (v) {\n self.rectified_grid_angle = parseFloat(v);\n },\n lonc: function (v) {\n self.longc = v * D2R;\n },\n x_0: function (v) {\n self.x0 = parseFloat(v);\n },\n y_0: function (v) {\n self.y0 = parseFloat(v);\n },\n k_0: function (v) {\n self.k0 = parseFloat(v);\n },\n k: function (v) {\n self.k0 = parseFloat(v);\n },\n a: function (v) {\n self.a = parseFloat(v);\n },\n b: function (v) {\n self.b = parseFloat(v);\n },\n r: function (v) {\n self.a = self.b = parseFloat(v);\n },\n r_a: function () {\n self.R_A = true;\n },\n zone: function (v) {\n self.zone = parseInt(v, 10);\n },\n south: function () {\n self.utmSouth = true;\n },\n towgs84: function (v) {\n self.datum_params = v.split(\",\").map(function (a) {\n return parseFloat(a);\n });\n },\n to_meter: function (v) {\n self.to_meter = parseFloat(v);\n },\n units: function (v) {\n self.units = v;\n var unit = match(units, v);\n if (unit) {\n self.to_meter = unit.to_meter;\n }\n },\n from_greenwich: function (v) {\n self.from_greenwich = v * D2R;\n },\n pm: function (v) {\n var pm = match(PrimeMeridian, v);\n self.from_greenwich = (pm ? pm : parseFloat(v)) * D2R;\n },\n nadgrids: function (v) {\n if (v === '@null') {\n self.datumCode = 'none';\n } else {\n self.nadgrids = v;\n }\n },\n axis: function (v) {\n var legalAxis = \"ewnsud\";\n if (v.length === 3 && legalAxis.indexOf(v.substr(0, 1)) !== -1 && legalAxis.indexOf(v.substr(1, 1)) !== -1 && legalAxis.indexOf(v.substr(2, 1)) !== -1) {\n self.axis = v;\n }\n },\n approx: function () {\n self.approx = true;\n }\n };\n for (paramName in paramObj) {\n paramVal = paramObj[paramName];\n if (paramName in params) {\n paramOutname = params[paramName];\n if (typeof paramOutname === 'function') {\n paramOutname(paramVal);\n } else {\n self[paramOutname] = paramVal;\n }\n } else {\n self[paramName] = paramVal;\n }\n }\n if (typeof self.datumCode === 'string' && self.datumCode !== \"WGS84\") {\n self.datumCode = self.datumCode.toLowerCase();\n }\n return self;\n}","export default parseString;\nvar NEUTRAL = 1;\nvar KEYWORD = 2;\nvar NUMBER = 3;\nvar QUOTED = 4;\nvar AFTERQUOTE = 5;\nvar ENDED = -1;\nvar whitespace = /\\s/;\nvar latin = /[A-Za-z]/;\nvar keyword = /[A-Za-z84_]/;\nvar endThings = /[,\\]]/;\nvar digets = /[\\d\\.E\\-\\+]/;\n// const ignoredChar = /[\\s_\\-\\/\\(\\)]/g;\nfunction Parser(text) {\n if (typeof text !== 'string') {\n throw new Error('not a string');\n }\n this.text = text.trim();\n this.level = 0;\n this.place = 0;\n this.root = null;\n this.stack = [];\n this.currentObject = null;\n this.state = NEUTRAL;\n}\nParser.prototype.readCharicter = function () {\n var char = this.text[this.place++];\n if (this.state !== QUOTED) {\n while (whitespace.test(char)) {\n if (this.place >= this.text.length) {\n return;\n }\n char = this.text[this.place++];\n }\n }\n switch (this.state) {\n case NEUTRAL:\n return this.neutral(char);\n case KEYWORD:\n return this.keyword(char);\n case QUOTED:\n return this.quoted(char);\n case AFTERQUOTE:\n return this.afterquote(char);\n case NUMBER:\n return this.number(char);\n case ENDED:\n return;\n }\n};\nParser.prototype.afterquote = function (char) {\n if (char === '\"') {\n this.word += '\"';\n this.state = QUOTED;\n return;\n }\n if (endThings.test(char)) {\n this.word = this.word.trim();\n this.afterItem(char);\n return;\n }\n throw new Error('havn\\'t handled \"' + char + '\" in afterquote yet, index ' + this.place);\n};\nParser.prototype.afterItem = function (char) {\n if (char === ',') {\n if (this.word !== null) {\n this.currentObject.push(this.word);\n }\n this.word = null;\n this.state = NEUTRAL;\n return;\n }\n if (char === ']') {\n this.level--;\n if (this.word !== null) {\n this.currentObject.push(this.word);\n this.word = null;\n }\n this.state = NEUTRAL;\n this.currentObject = this.stack.pop();\n if (!this.currentObject) {\n this.state = ENDED;\n }\n return;\n }\n};\nParser.prototype.number = function (char) {\n if (digets.test(char)) {\n this.word += char;\n return;\n }\n if (endThings.test(char)) {\n this.word = parseFloat(this.word);\n this.afterItem(char);\n return;\n }\n throw new Error('havn\\'t handled \"' + char + '\" in number yet, index ' + this.place);\n};\nParser.prototype.quoted = function (char) {\n if (char === '\"') {\n this.state = AFTERQUOTE;\n return;\n }\n this.word += char;\n return;\n};\nParser.prototype.keyword = function (char) {\n if (keyword.test(char)) {\n this.word += char;\n return;\n }\n if (char === '[') {\n var newObjects = [];\n newObjects.push(this.word);\n this.level++;\n if (this.root === null) {\n this.root = newObjects;\n } else {\n this.currentObject.push(newObjects);\n }\n this.stack.push(this.currentObject);\n this.currentObject = newObjects;\n this.state = NEUTRAL;\n return;\n }\n if (endThings.test(char)) {\n this.afterItem(char);\n return;\n }\n throw new Error('havn\\'t handled \"' + char + '\" in keyword yet, index ' + this.place);\n};\nParser.prototype.neutral = function (char) {\n if (latin.test(char)) {\n this.word = char;\n this.state = KEYWORD;\n return;\n }\n if (char === '\"') {\n this.word = '';\n this.state = QUOTED;\n return;\n }\n if (digets.test(char)) {\n this.word = char;\n this.state = NUMBER;\n return;\n }\n if (endThings.test(char)) {\n this.afterItem(char);\n return;\n }\n throw new Error('havn\\'t handled \"' + char + '\" in neutral yet, index ' + this.place);\n};\nParser.prototype.output = function () {\n while (this.place < this.text.length) {\n this.readCharicter();\n }\n if (this.state === ENDED) {\n return this.root;\n }\n throw new Error('unable to parse string \"' + this.text + '\". State is ' + this.state);\n};\nfunction parseString(txt) {\n var parser = new Parser(txt);\n return parser.output();\n}","function mapit(obj, key, value) {\n if (Array.isArray(key)) {\n value.unshift(key);\n key = null;\n }\n var thing = key ? {} : obj;\n var out = value.reduce(function (newObj, item) {\n sExpr(item, newObj);\n return newObj;\n }, thing);\n if (key) {\n obj[key] = out;\n }\n}\nexport function sExpr(v, obj) {\n if (!Array.isArray(v)) {\n obj[v] = true;\n return;\n }\n var key = v.shift();\n if (key === 'PARAMETER') {\n key = v.shift();\n }\n if (v.length === 1) {\n if (Array.isArray(v[0])) {\n obj[key] = {};\n sExpr(v[0], obj[key]);\n return;\n }\n obj[key] = v[0];\n return;\n }\n if (!v.length) {\n obj[key] = true;\n return;\n }\n if (key === 'TOWGS84') {\n obj[key] = v;\n return;\n }\n if (key === 'AXIS') {\n if (!(key in obj)) {\n obj[key] = [];\n }\n obj[key].push(v);\n return;\n }\n if (!Array.isArray(key)) {\n obj[key] = {};\n }\n var i;\n switch (key) {\n case 'UNIT':\n case 'PRIMEM':\n case 'VERT_DATUM':\n obj[key] = {\n name: v[0].toLowerCase(),\n convert: v[1]\n };\n if (v.length === 3) {\n sExpr(v[2], obj[key]);\n }\n return;\n case 'SPHEROID':\n case 'ELLIPSOID':\n obj[key] = {\n name: v[0],\n a: v[1],\n rf: v[2]\n };\n if (v.length === 4) {\n sExpr(v[3], obj[key]);\n }\n return;\n case 'PROJECTEDCRS':\n case 'PROJCRS':\n case 'GEOGCS':\n case 'GEOCCS':\n case 'PROJCS':\n case 'LOCAL_CS':\n case 'GEODCRS':\n case 'GEODETICCRS':\n case 'GEODETICDATUM':\n case 'EDATUM':\n case 'ENGINEERINGDATUM':\n case 'VERT_CS':\n case 'VERTCRS':\n case 'VERTICALCRS':\n case 'COMPD_CS':\n case 'COMPOUNDCRS':\n case 'ENGINEERINGCRS':\n case 'ENGCRS':\n case 'FITTED_CS':\n case 'LOCAL_DATUM':\n case 'DATUM':\n v[0] = ['name', v[0]];\n mapit(obj, key, v);\n return;\n default:\n i = -1;\n while (++i < v.length) {\n if (!Array.isArray(v[i])) {\n return sExpr(v, obj[key]);\n }\n }\n return mapit(obj, key, v);\n }\n}","var D2R = 0.01745329251994329577;\nimport parser from './parser';\nimport { sExpr } from './process';\nfunction rename(obj, params) {\n var outName = params[0];\n var inName = params[1];\n if (!(outName in obj) && inName in obj) {\n obj[outName] = obj[inName];\n if (params.length === 3) {\n obj[outName] = params[2](obj[outName]);\n }\n }\n}\nfunction d2r(input) {\n return input * D2R;\n}\nfunction cleanWKT(wkt) {\n if (wkt.type === 'GEOGCS') {\n wkt.projName = 'longlat';\n } else if (wkt.type === 'LOCAL_CS') {\n wkt.projName = 'identity';\n wkt.local = true;\n } else {\n if (typeof wkt.PROJECTION === 'object') {\n wkt.projName = Object.keys(wkt.PROJECTION)[0];\n } else {\n wkt.projName = wkt.PROJECTION;\n }\n }\n if (wkt.AXIS) {\n var axisOrder = '';\n for (var i = 0, ii = wkt.AXIS.length; i < ii; ++i) {\n var axis = [wkt.AXIS[i][0].toLowerCase(), wkt.AXIS[i][1].toLowerCase()];\n if (axis[0].indexOf('north') !== -1 || (axis[0] === 'y' || axis[0] === 'lat') && axis[1] === 'north') {\n axisOrder += 'n';\n } else if (axis[0].indexOf('south') !== -1 || (axis[0] === 'y' || axis[0] === 'lat') && axis[1] === 'south') {\n axisOrder += 's';\n } else if (axis[0].indexOf('east') !== -1 || (axis[0] === 'x' || axis[0] === 'lon') && axis[1] === 'east') {\n axisOrder += 'e';\n } else if (axis[0].indexOf('west') !== -1 || (axis[0] === 'x' || axis[0] === 'lon') && axis[1] === 'west') {\n axisOrder += 'w';\n }\n }\n if (axisOrder.length === 2) {\n axisOrder += 'u';\n }\n if (axisOrder.length === 3) {\n wkt.axis = axisOrder;\n }\n }\n if (wkt.UNIT) {\n wkt.units = wkt.UNIT.name.toLowerCase();\n if (wkt.units === 'metre') {\n wkt.units = 'meter';\n }\n if (wkt.UNIT.convert) {\n if (wkt.type === 'GEOGCS') {\n if (wkt.DATUM && wkt.DATUM.SPHEROID) {\n wkt.to_meter = wkt.UNIT.convert * wkt.DATUM.SPHEROID.a;\n }\n } else {\n wkt.to_meter = wkt.UNIT.convert;\n }\n }\n }\n var geogcs = wkt.GEOGCS;\n if (wkt.type === 'GEOGCS') {\n geogcs = wkt;\n }\n if (geogcs) {\n //if(wkt.GEOGCS.PRIMEM&&wkt.GEOGCS.PRIMEM.convert){\n // wkt.from_greenwich=wkt.GEOGCS.PRIMEM.convert*D2R;\n //}\n if (geogcs.DATUM) {\n wkt.datumCode = geogcs.DATUM.name.toLowerCase();\n } else {\n wkt.datumCode = geogcs.name.toLowerCase();\n }\n if (wkt.datumCode.slice(0, 2) === 'd_') {\n wkt.datumCode = wkt.datumCode.slice(2);\n }\n if (wkt.datumCode === 'new_zealand_geodetic_datum_1949' || wkt.datumCode === 'new_zealand_1949') {\n wkt.datumCode = 'nzgd49';\n }\n if (wkt.datumCode === 'wgs_1984' || wkt.datumCode === 'world_geodetic_system_1984') {\n if (wkt.PROJECTION === 'Mercator_Auxiliary_Sphere') {\n wkt.sphere = true;\n }\n wkt.datumCode = 'wgs84';\n }\n if (wkt.datumCode.slice(-6) === '_ferro') {\n wkt.datumCode = wkt.datumCode.slice(0, -6);\n }\n if (wkt.datumCode.slice(-8) === '_jakarta') {\n wkt.datumCode = wkt.datumCode.slice(0, -8);\n }\n if (~wkt.datumCode.indexOf('belge')) {\n wkt.datumCode = 'rnb72';\n }\n if (geogcs.DATUM && geogcs.DATUM.SPHEROID) {\n wkt.ellps = geogcs.DATUM.SPHEROID.name.replace('_19', '').replace(/[Cc]larke\\_18/, 'clrk');\n if (wkt.ellps.toLowerCase().slice(0, 13) === 'international') {\n wkt.ellps = 'intl';\n }\n wkt.a = geogcs.DATUM.SPHEROID.a;\n wkt.rf = parseFloat(geogcs.DATUM.SPHEROID.rf, 10);\n }\n if (geogcs.DATUM && geogcs.DATUM.TOWGS84) {\n wkt.datum_params = geogcs.DATUM.TOWGS84;\n }\n if (~wkt.datumCode.indexOf('osgb_1936')) {\n wkt.datumCode = 'osgb36';\n }\n if (~wkt.datumCode.indexOf('osni_1952')) {\n wkt.datumCode = 'osni52';\n }\n if (~wkt.datumCode.indexOf('tm65') || ~wkt.datumCode.indexOf('geodetic_datum_of_1965')) {\n wkt.datumCode = 'ire65';\n }\n if (wkt.datumCode === 'ch1903+') {\n wkt.datumCode = 'ch1903';\n }\n if (~wkt.datumCode.indexOf('israel')) {\n wkt.datumCode = 'isr93';\n }\n }\n if (wkt.b && !isFinite(wkt.b)) {\n wkt.b = wkt.a;\n }\n function toMeter(input) {\n var ratio = wkt.to_meter || 1;\n return input * ratio;\n }\n var renamer = function (a) {\n return rename(wkt, a);\n };\n var list = [['standard_parallel_1', 'Standard_Parallel_1'], ['standard_parallel_1', 'Latitude of 1st standard parallel'], ['standard_parallel_2', 'Standard_Parallel_2'], ['standard_parallel_2', 'Latitude of 2nd standard parallel'], ['false_easting', 'False_Easting'], ['false_easting', 'False easting'], ['false-easting', 'Easting at false origin'], ['false_northing', 'False_Northing'], ['false_northing', 'False northing'], ['false_northing', 'Northing at false origin'], ['central_meridian', 'Central_Meridian'], ['central_meridian', 'Longitude of natural origin'], ['central_meridian', 'Longitude of false origin'], ['latitude_of_origin', 'Latitude_Of_Origin'], ['latitude_of_origin', 'Central_Parallel'], ['latitude_of_origin', 'Latitude of natural origin'], ['latitude_of_origin', 'Latitude of false origin'], ['scale_factor', 'Scale_Factor'], ['k0', 'scale_factor'], ['latitude_of_center', 'Latitude_Of_Center'], ['latitude_of_center', 'Latitude_of_center'], ['lat0', 'latitude_of_center', d2r], ['longitude_of_center', 'Longitude_Of_Center'], ['longitude_of_center', 'Longitude_of_center'], ['longc', 'longitude_of_center', d2r], ['x0', 'false_easting', toMeter], ['y0', 'false_northing', toMeter], ['long0', 'central_meridian', d2r], ['lat0', 'latitude_of_origin', d2r], ['lat0', 'standard_parallel_1', d2r], ['lat1', 'standard_parallel_1', d2r], ['lat2', 'standard_parallel_2', d2r], ['azimuth', 'Azimuth'], ['alpha', 'azimuth', d2r], ['srsCode', 'name']];\n list.forEach(renamer);\n if (!wkt.long0 && wkt.longc && (wkt.projName === 'Albers_Conic_Equal_Area' || wkt.projName === 'Lambert_Azimuthal_Equal_Area')) {\n wkt.long0 = wkt.longc;\n }\n if (!wkt.lat_ts && wkt.lat1 && (wkt.projName === 'Stereographic_South_Pole' || wkt.projName === 'Polar Stereographic (variant B)')) {\n wkt.lat0 = d2r(wkt.lat1 > 0 ? 90 : -90);\n wkt.lat_ts = wkt.lat1;\n } else if (!wkt.lat_ts && wkt.lat0 && wkt.projName === 'Polar_Stereographic') {\n wkt.lat_ts = wkt.lat0;\n wkt.lat0 = d2r(wkt.lat0 > 0 ? 90 : -90);\n }\n}\nexport default function (wkt) {\n var lisp = parser(wkt);\n var type = lisp.shift();\n var name = lisp.shift();\n lisp.unshift(['name', name]);\n lisp.unshift(['type', type]);\n var obj = {};\n sExpr(lisp, obj);\n cleanWKT(obj);\n return obj;\n}","import globals from './global';\nimport parseProj from './projString';\nimport wkt from 'wkt-parser';\nfunction defs(name) {\n /*global console*/\n var that = this;\n if (arguments.length === 2) {\n var def = arguments[1];\n if (typeof def === 'string') {\n if (def.charAt(0) === '+') {\n defs[name] = parseProj(arguments[1]);\n } else {\n defs[name] = wkt(arguments[1]);\n }\n } else {\n defs[name] = def;\n }\n } else if (arguments.length === 1) {\n if (Array.isArray(name)) {\n return name.map(function (v) {\n if (Array.isArray(v)) {\n defs.apply(that, v);\n } else {\n defs(v);\n }\n });\n } else if (typeof name === 'string') {\n if (name in defs) {\n return defs[name];\n }\n } else if ('EPSG' in name) {\n defs['EPSG:' + name.EPSG] = name;\n } else if ('ESRI' in name) {\n defs['ESRI:' + name.ESRI] = name;\n } else if ('IAU2000' in name) {\n defs['IAU2000:' + name.IAU2000] = name;\n } else {\n console.log(name);\n }\n return;\n }\n}\nglobals(defs);\nexport default defs;","import defs from './defs';\nimport wkt from 'wkt-parser';\nimport projStr from './projString';\nimport match from './match';\nfunction testObj(code) {\n return typeof code === 'string';\n}\nfunction testDef(code) {\n return code in defs;\n}\nvar codeWords = ['PROJECTEDCRS', 'PROJCRS', 'GEOGCS', 'GEOCCS', 'PROJCS', 'LOCAL_CS', 'GEODCRS', 'GEODETICCRS', 'GEODETICDATUM', 'ENGCRS', 'ENGINEERINGCRS'];\nfunction testWKT(code) {\n return codeWords.some(function (word) {\n return code.indexOf(word) > -1;\n });\n}\nvar codes = ['3857', '900913', '3785', '102113'];\nfunction checkMercator(item) {\n var auth = match(item, 'authority');\n if (!auth) {\n return;\n }\n var code = match(auth, 'epsg');\n return code && codes.indexOf(code) > -1;\n}\nfunction checkProjStr(item) {\n var ext = match(item, 'extension');\n if (!ext) {\n return;\n }\n return match(ext, 'proj4');\n}\nfunction testProj(code) {\n return code[0] === '+';\n}\nfunction parse(code) {\n if (testObj(code)) {\n //check to see if this is a WKT string\n if (testDef(code)) {\n return defs[code];\n }\n if (testWKT(code)) {\n var out = wkt(code);\n // test of spetial case, due to this being a very common and often malformed\n if (checkMercator(out)) {\n return defs['EPSG:3857'];\n }\n var maybeProjStr = checkProjStr(out);\n if (maybeProjStr) {\n return projStr(maybeProjStr);\n }\n return out;\n }\n if (testProj(code)) {\n return projStr(code);\n }\n } else {\n return code;\n }\n}\nexport default parse;","export default function (destination, source) {\n destination = destination || {};\n var value, property;\n if (!source) {\n return destination;\n }\n for (property in source) {\n value = source[property];\n if (value !== undefined) {\n destination[property] = value;\n }\n }\n return destination;\n}","export default function (eccent, sinphi, cosphi) {\n var con = eccent * sinphi;\n return cosphi / Math.sqrt(1 - con * con);\n}","export default function (x) {\n return x < 0 ? -1 : 1;\n}","import { TWO_PI, SPI } from '../constants/values';\nimport sign from './sign';\nexport default function (x) {\n return Math.abs(x) <= SPI ? x : x - sign(x) * TWO_PI;\n}","import { HALF_PI } from '../constants/values';\nexport default function (eccent, phi, sinphi) {\n var con = eccent * sinphi;\n var com = 0.5 * eccent;\n con = Math.pow((1 - con) / (1 + con), com);\n return Math.tan(0.5 * (HALF_PI - phi)) / con;\n}","import { HALF_PI } from '../constants/values';\nexport default function (eccent, ts) {\n var eccnth = 0.5 * eccent;\n var con, dphi;\n var phi = HALF_PI - 2 * Math.atan(ts);\n for (var i = 0; i <= 15; i++) {\n con = eccent * Math.sin(phi);\n dphi = HALF_PI - 2 * Math.atan(ts * Math.pow((1 - con) / (1 + con), eccnth)) - phi;\n phi += dphi;\n if (Math.abs(dphi) <= 0.0000000001) {\n return phi;\n }\n }\n //console.log(\"phi2z has NoConvergence\");\n return -9999;\n}","import msfnz from '../common/msfnz';\nimport adjust_lon from '../common/adjust_lon';\nimport tsfnz from '../common/tsfnz';\nimport phi2z from '../common/phi2z';\nimport { FORTPI, R2D, EPSLN, HALF_PI } from '../constants/values';\nexport function init() {\n var con = this.b / this.a;\n this.es = 1 - con * con;\n if (!('x0' in this)) {\n this.x0 = 0;\n }\n if (!('y0' in this)) {\n this.y0 = 0;\n }\n this.e = Math.sqrt(this.es);\n if (this.lat_ts) {\n if (this.sphere) {\n this.k0 = Math.cos(this.lat_ts);\n } else {\n this.k0 = msfnz(this.e, Math.sin(this.lat_ts), Math.cos(this.lat_ts));\n }\n } else {\n if (!this.k0) {\n if (this.k) {\n this.k0 = this.k;\n } else {\n this.k0 = 1;\n }\n }\n }\n}\n\n/* Mercator forward equations--mapping lat,long to x,y\n --------------------------------------------------*/\n\nexport function forward(p) {\n var lon = p.x;\n var lat = p.y;\n // convert to radians\n if (lat * R2D > 90 && lat * R2D < -90 && lon * R2D > 180 && lon * R2D < -180) {\n return null;\n }\n var x, y;\n if (Math.abs(Math.abs(lat) - HALF_PI) <= EPSLN) {\n return null;\n } else {\n if (this.sphere) {\n x = this.x0 + this.a * this.k0 * adjust_lon(lon - this.long0);\n y = this.y0 + this.a * this.k0 * Math.log(Math.tan(FORTPI + 0.5 * lat));\n } else {\n var sinphi = Math.sin(lat);\n var ts = tsfnz(this.e, lat, sinphi);\n x = this.x0 + this.a * this.k0 * adjust_lon(lon - this.long0);\n y = this.y0 - this.a * this.k0 * Math.log(ts);\n }\n p.x = x;\n p.y = y;\n return p;\n }\n}\n\n/* Mercator inverse equations--mapping x,y to lat/long\n --------------------------------------------------*/\nexport function inverse(p) {\n var x = p.x - this.x0;\n var y = p.y - this.y0;\n var lon, lat;\n if (this.sphere) {\n lat = HALF_PI - 2 * Math.atan(Math.exp(-y / (this.a * this.k0)));\n } else {\n var ts = Math.exp(-y / (this.a * this.k0));\n lat = phi2z(this.e, ts);\n if (lat === -9999) {\n return null;\n }\n }\n lon = adjust_lon(this.long0 + x / (this.a * this.k0));\n p.x = lon;\n p.y = lat;\n return p;\n}\nexport var names = [\"Mercator\", \"Popular Visualisation Pseudo Mercator\", \"Mercator_1SP\", \"Mercator_Auxiliary_Sphere\", \"merc\"];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};","export function init() {\n //no-op for longlat\n}\nfunction identity(pt) {\n return pt;\n}\nexport { identity as forward };\nexport { identity as inverse };\nexport var names = [\"longlat\", \"identity\"];\nexport default {\n init: init,\n forward: identity,\n inverse: identity,\n names: names\n};","import merc from \"./projections/merc\";\nimport longlat from \"./projections/longlat\";\nvar projs = [merc, longlat];\nvar names = {};\nvar projStore = [];\nfunction add(proj, i) {\n var len = projStore.length;\n if (!proj.names) {\n console.log(i);\n return true;\n }\n projStore[len] = proj;\n proj.names.forEach(function (n) {\n names[n.toLowerCase()] = len;\n });\n return this;\n}\nexport { add };\nexport function get(name) {\n if (!name) {\n return false;\n }\n var n = name.toLowerCase();\n if (typeof names[n] !== 'undefined' && projStore[names[n]]) {\n return projStore[names[n]];\n }\n}\nexport function start() {\n projs.forEach(add);\n}\nexport default {\n start: start,\n add: add,\n get: get\n};","var exports = {};\nexport { exports as default };\nexports.MERIT = {\n a: 6378137.0,\n rf: 298.257,\n ellipseName: \"MERIT 1983\"\n};\nexports.SGS85 = {\n a: 6378136.0,\n rf: 298.257,\n ellipseName: \"Soviet Geodetic System 85\"\n};\nexports.GRS80 = {\n a: 6378137.0,\n rf: 298.257222101,\n ellipseName: \"GRS 1980(IUGG, 1980)\"\n};\nexports.IAU76 = {\n a: 6378140.0,\n rf: 298.257,\n ellipseName: \"IAU 1976\"\n};\nexports.airy = {\n a: 6377563.396,\n b: 6356256.910,\n ellipseName: \"Airy 1830\"\n};\nexports.APL4 = {\n a: 6378137,\n rf: 298.25,\n ellipseName: \"Appl. Physics. 1965\"\n};\nexports.NWL9D = {\n a: 6378145.0,\n rf: 298.25,\n ellipseName: \"Naval Weapons Lab., 1965\"\n};\nexports.mod_airy = {\n a: 6377340.189,\n b: 6356034.446,\n ellipseName: \"Modified Airy\"\n};\nexports.andrae = {\n a: 6377104.43,\n rf: 300.0,\n ellipseName: \"Andrae 1876 (Den., Iclnd.)\"\n};\nexports.aust_SA = {\n a: 6378160.0,\n rf: 298.25,\n ellipseName: \"Australian Natl & S. Amer. 1969\"\n};\nexports.GRS67 = {\n a: 6378160.0,\n rf: 298.2471674270,\n ellipseName: \"GRS 67(IUGG 1967)\"\n};\nexports.bessel = {\n a: 6377397.155,\n rf: 299.1528128,\n ellipseName: \"Bessel 1841\"\n};\nexports.bess_nam = {\n a: 6377483.865,\n rf: 299.1528128,\n ellipseName: \"Bessel 1841 (Namibia)\"\n};\nexports.clrk66 = {\n a: 6378206.4,\n b: 6356583.8,\n ellipseName: \"Clarke 1866\"\n};\nexports.clrk80 = {\n a: 6378249.145,\n rf: 293.4663,\n ellipseName: \"Clarke 1880 mod.\"\n};\nexports.clrk80ign = {\n a: 6378249.2,\n b: 6356515,\n rf: 293.4660213,\n ellipseName: \"Clarke 1880 (IGN)\"\n};\nexports.clrk58 = {\n a: 6378293.645208759,\n rf: 294.2606763692654,\n ellipseName: \"Clarke 1858\"\n};\nexports.CPM = {\n a: 6375738.7,\n rf: 334.29,\n ellipseName: \"Comm. des Poids et Mesures 1799\"\n};\nexports.delmbr = {\n a: 6376428.0,\n rf: 311.5,\n ellipseName: \"Delambre 1810 (Belgium)\"\n};\nexports.engelis = {\n a: 6378136.05,\n rf: 298.2566,\n ellipseName: \"Engelis 1985\"\n};\nexports.evrst30 = {\n a: 6377276.345,\n rf: 300.8017,\n ellipseName: \"Everest 1830\"\n};\nexports.evrst48 = {\n a: 6377304.063,\n rf: 300.8017,\n ellipseName: \"Everest 1948\"\n};\nexports.evrst56 = {\n a: 6377301.243,\n rf: 300.8017,\n ellipseName: \"Everest 1956\"\n};\nexports.evrst69 = {\n a: 6377295.664,\n rf: 300.8017,\n ellipseName: \"Everest 1969\"\n};\nexports.evrstSS = {\n a: 6377298.556,\n rf: 300.8017,\n ellipseName: \"Everest (Sabah & Sarawak)\"\n};\nexports.fschr60 = {\n a: 6378166.0,\n rf: 298.3,\n ellipseName: \"Fischer (Mercury Datum) 1960\"\n};\nexports.fschr60m = {\n a: 6378155.0,\n rf: 298.3,\n ellipseName: \"Fischer 1960\"\n};\nexports.fschr68 = {\n a: 6378150.0,\n rf: 298.3,\n ellipseName: \"Fischer 1968\"\n};\nexports.helmert = {\n a: 6378200.0,\n rf: 298.3,\n ellipseName: \"Helmert 1906\"\n};\nexports.hough = {\n a: 6378270.0,\n rf: 297.0,\n ellipseName: \"Hough\"\n};\nexports.intl = {\n a: 6378388.0,\n rf: 297.0,\n ellipseName: \"International 1909 (Hayford)\"\n};\nexports.kaula = {\n a: 6378163.0,\n rf: 298.24,\n ellipseName: \"Kaula 1961\"\n};\nexports.lerch = {\n a: 6378139.0,\n rf: 298.257,\n ellipseName: \"Lerch 1979\"\n};\nexports.mprts = {\n a: 6397300.0,\n rf: 191.0,\n ellipseName: \"Maupertius 1738\"\n};\nexports.new_intl = {\n a: 6378157.5,\n b: 6356772.2,\n ellipseName: \"New International 1967\"\n};\nexports.plessis = {\n a: 6376523.0,\n rf: 6355863.0,\n ellipseName: \"Plessis 1817 (France)\"\n};\nexports.krass = {\n a: 6378245.0,\n rf: 298.3,\n ellipseName: \"Krassovsky, 1942\"\n};\nexports.SEasia = {\n a: 6378155.0,\n b: 6356773.3205,\n ellipseName: \"Southeast Asia\"\n};\nexports.walbeck = {\n a: 6376896.0,\n b: 6355834.8467,\n ellipseName: \"Walbeck\"\n};\nexports.WGS60 = {\n a: 6378165.0,\n rf: 298.3,\n ellipseName: \"WGS 60\"\n};\nexports.WGS66 = {\n a: 6378145.0,\n rf: 298.25,\n ellipseName: \"WGS 66\"\n};\nexports.WGS7 = {\n a: 6378135.0,\n rf: 298.26,\n ellipseName: \"WGS 72\"\n};\nexport var WGS84 = exports.WGS84 = {\n a: 6378137.0,\n rf: 298.257223563,\n ellipseName: \"WGS 84\"\n};\nexports.sphere = {\n a: 6370997.0,\n b: 6370997.0,\n ellipseName: \"Normal Sphere (r=6370997)\"\n};","import { SIXTH, RA4, RA6, EPSLN } from './constants/values';\nimport { default as Ellipsoid, WGS84 } from './constants/Ellipsoid';\nimport match from './match';\nexport function eccentricity(a, b, rf, R_A) {\n var a2 = a * a; // used in geocentric\n var b2 = b * b; // used in geocentric\n var es = (a2 - b2) / a2; // e ^ 2\n var e = 0;\n if (R_A) {\n a *= 1 - es * (SIXTH + es * (RA4 + es * RA6));\n a2 = a * a;\n es = 0;\n } else {\n e = Math.sqrt(es); // eccentricity\n }\n var ep2 = (a2 - b2) / b2; // used in geocentric\n return {\n es: es,\n e: e,\n ep2: ep2\n };\n}\nexport function sphere(a, b, rf, ellps, sphere) {\n if (!a) {\n // do we have an ellipsoid?\n var ellipse = match(Ellipsoid, ellps);\n if (!ellipse) {\n ellipse = WGS84;\n }\n a = ellipse.a;\n b = ellipse.b;\n rf = ellipse.rf;\n }\n if (rf && !b) {\n b = (1.0 - 1.0 / rf) * a;\n }\n if (rf === 0 || Math.abs(a - b) < EPSLN) {\n sphere = true;\n b = a;\n }\n return {\n a: a,\n b: b,\n rf: rf,\n sphere: sphere\n };\n}","var exports = {};\nexport { exports as default };\nexports.wgs84 = {\n towgs84: \"0,0,0\",\n ellipse: \"WGS84\",\n datumName: \"WGS84\"\n};\nexports.ch1903 = {\n towgs84: \"674.374,15.056,405.346\",\n ellipse: \"bessel\",\n datumName: \"swiss\"\n};\nexports.ggrs87 = {\n towgs84: \"-199.87,74.79,246.62\",\n ellipse: \"GRS80\",\n datumName: \"Greek_Geodetic_Reference_System_1987\"\n};\nexports.nad83 = {\n towgs84: \"0,0,0\",\n ellipse: \"GRS80\",\n datumName: \"North_American_Datum_1983\"\n};\nexports.nad27 = {\n nadgrids: \"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat\",\n ellipse: \"clrk66\",\n datumName: \"North_American_Datum_1927\"\n};\nexports.potsdam = {\n towgs84: \"598.1,73.7,418.2,0.202,0.045,-2.455,6.7\",\n ellipse: \"bessel\",\n datumName: \"Potsdam Rauenberg 1950 DHDN\"\n};\nexports.carthage = {\n towgs84: \"-263.0,6.0,431.0\",\n ellipse: \"clark80\",\n datumName: \"Carthage 1934 Tunisia\"\n};\nexports.hermannskogel = {\n towgs84: \"577.326,90.129,463.919,5.137,1.474,5.297,2.4232\",\n ellipse: \"bessel\",\n datumName: \"Hermannskogel\"\n};\nexports.militargeographische_institut = {\n towgs84: \"577.326,90.129,463.919,5.137,1.474,5.297,2.4232\",\n ellipse: \"bessel\",\n datumName: \"Militar-Geographische Institut\"\n};\nexports.osni52 = {\n towgs84: \"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15\",\n ellipse: \"airy\",\n datumName: \"Irish National\"\n};\nexports.ire65 = {\n towgs84: \"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15\",\n ellipse: \"mod_airy\",\n datumName: \"Ireland 1965\"\n};\nexports.rassadiran = {\n towgs84: \"-133.63,-157.5,-158.62\",\n ellipse: \"intl\",\n datumName: \"Rassadiran\"\n};\nexports.nzgd49 = {\n towgs84: \"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993\",\n ellipse: \"intl\",\n datumName: \"New Zealand Geodetic Datum 1949\"\n};\nexports.osgb36 = {\n towgs84: \"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894\",\n ellipse: \"airy\",\n datumName: \"Airy 1830\"\n};\nexports.s_jtsk = {\n towgs84: \"589,76,480\",\n ellipse: 'bessel',\n datumName: 'S-JTSK (Ferro)'\n};\nexports.beduaram = {\n towgs84: '-106,-87,188',\n ellipse: 'clrk80',\n datumName: 'Beduaram'\n};\nexports.gunung_segara = {\n towgs84: '-403,684,41',\n ellipse: 'bessel',\n datumName: 'Gunung Segara Jakarta'\n};\nexports.rnb72 = {\n towgs84: \"106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1\",\n ellipse: \"intl\",\n datumName: \"Reseau National Belge 1972\"\n};","import { PJD_3PARAM, PJD_7PARAM, PJD_GRIDSHIFT, PJD_WGS84, PJD_NODATUM, SEC_TO_RAD } from './constants/values';\nfunction datum(datumCode, datum_params, a, b, es, ep2, nadgrids) {\n var out = {};\n if (datumCode === undefined || datumCode === 'none') {\n out.datum_type = PJD_NODATUM;\n } else {\n out.datum_type = PJD_WGS84;\n }\n if (datum_params) {\n out.datum_params = datum_params.map(parseFloat);\n if (out.datum_params[0] !== 0 || out.datum_params[1] !== 0 || out.datum_params[2] !== 0) {\n out.datum_type = PJD_3PARAM;\n }\n if (out.datum_params.length > 3) {\n if (out.datum_params[3] !== 0 || out.datum_params[4] !== 0 || out.datum_params[5] !== 0 || out.datum_params[6] !== 0) {\n out.datum_type = PJD_7PARAM;\n out.datum_params[3] *= SEC_TO_RAD;\n out.datum_params[4] *= SEC_TO_RAD;\n out.datum_params[5] *= SEC_TO_RAD;\n out.datum_params[6] = out.datum_params[6] / 1000000.0 + 1.0;\n }\n }\n }\n if (nadgrids) {\n out.datum_type = PJD_GRIDSHIFT;\n out.grids = nadgrids;\n }\n out.a = a; //datum object also uses these values\n out.b = b;\n out.es = es;\n out.ep2 = ep2;\n return out;\n}\nexport default datum;","/**\n * Resources for details of NTv2 file formats:\n * - https://web.archive.org/web/20140127204822if_/http://www.mgs.gov.on.ca:80/stdprodconsume/groups/content/@mgs/@iandit/documents/resourcelist/stel02_047447.pdf\n * - http://mimaka.com/help/gs/html/004_NTV2%20Data%20Format.htm\n */\n\nvar loadedNadgrids = {};\n\n/**\n * Load a binary NTv2 file (.gsb) to a key that can be used in a proj string like +nadgrids=. Pass the NTv2 file\n * as an ArrayBuffer.\n */\nexport default function nadgrid(key, data) {\n var view = new DataView(data);\n var isLittleEndian = detectLittleEndian(view);\n var header = readHeader(view, isLittleEndian);\n var subgrids = readSubgrids(view, header, isLittleEndian);\n var nadgrid = {\n header: header,\n subgrids: subgrids\n };\n loadedNadgrids[key] = nadgrid;\n return nadgrid;\n}\n\n/**\n * Given a proj4 value for nadgrids, return an array of loaded grids\n */\nexport function getNadgrids(nadgrids) {\n // Format details: http://proj.maptools.org/gen_parms.html\n if (nadgrids === undefined) {\n return null;\n }\n var grids = nadgrids.split(',');\n return grids.map(parseNadgridString);\n}\nfunction parseNadgridString(value) {\n if (value.length === 0) {\n return null;\n }\n var optional = value[0] === '@';\n if (optional) {\n value = value.slice(1);\n }\n if (value === 'null') {\n return {\n name: 'null',\n mandatory: !optional,\n grid: null,\n isNull: true\n };\n }\n return {\n name: value,\n mandatory: !optional,\n grid: loadedNadgrids[value] || null,\n isNull: false\n };\n}\nfunction secondsToRadians(seconds) {\n return seconds / 3600 * Math.PI / 180;\n}\nfunction detectLittleEndian(view) {\n var nFields = view.getInt32(8, false);\n if (nFields === 11) {\n return false;\n }\n nFields = view.getInt32(8, true);\n if (nFields !== 11) {\n console.warn('Failed to detect nadgrid endian-ness, defaulting to little-endian');\n }\n return true;\n}\nfunction readHeader(view, isLittleEndian) {\n return {\n nFields: view.getInt32(8, isLittleEndian),\n nSubgridFields: view.getInt32(24, isLittleEndian),\n nSubgrids: view.getInt32(40, isLittleEndian),\n shiftType: decodeString(view, 56, 56 + 8).trim(),\n fromSemiMajorAxis: view.getFloat64(120, isLittleEndian),\n fromSemiMinorAxis: view.getFloat64(136, isLittleEndian),\n toSemiMajorAxis: view.getFloat64(152, isLittleEndian),\n toSemiMinorAxis: view.getFloat64(168, isLittleEndian)\n };\n}\nfunction decodeString(view, start, end) {\n return String.fromCharCode.apply(null, new Uint8Array(view.buffer.slice(start, end)));\n}\nfunction readSubgrids(view, header, isLittleEndian) {\n var gridOffset = 176;\n var grids = [];\n for (var i = 0; i < header.nSubgrids; i++) {\n var subHeader = readGridHeader(view, gridOffset, isLittleEndian);\n var nodes = readGridNodes(view, gridOffset, subHeader, isLittleEndian);\n var lngColumnCount = Math.round(1 + (subHeader.upperLongitude - subHeader.lowerLongitude) / subHeader.longitudeInterval);\n var latColumnCount = Math.round(1 + (subHeader.upperLatitude - subHeader.lowerLatitude) / subHeader.latitudeInterval);\n // Proj4 operates on radians whereas the coordinates are in seconds in the grid\n grids.push({\n ll: [secondsToRadians(subHeader.lowerLongitude), secondsToRadians(subHeader.lowerLatitude)],\n del: [secondsToRadians(subHeader.longitudeInterval), secondsToRadians(subHeader.latitudeInterval)],\n lim: [lngColumnCount, latColumnCount],\n count: subHeader.gridNodeCount,\n cvs: mapNodes(nodes)\n });\n gridOffset += 176 + subHeader.gridNodeCount * 16;\n }\n return grids;\n}\nfunction mapNodes(nodes) {\n return nodes.map(function (r) {\n return [secondsToRadians(r.longitudeShift), secondsToRadians(r.latitudeShift)];\n });\n}\nfunction readGridHeader(view, offset, isLittleEndian) {\n return {\n name: decodeString(view, offset + 8, offset + 16).trim(),\n parent: decodeString(view, offset + 24, offset + 24 + 8).trim(),\n lowerLatitude: view.getFloat64(offset + 72, isLittleEndian),\n upperLatitude: view.getFloat64(offset + 88, isLittleEndian),\n lowerLongitude: view.getFloat64(offset + 104, isLittleEndian),\n upperLongitude: view.getFloat64(offset + 120, isLittleEndian),\n latitudeInterval: view.getFloat64(offset + 136, isLittleEndian),\n longitudeInterval: view.getFloat64(offset + 152, isLittleEndian),\n gridNodeCount: view.getInt32(offset + 168, isLittleEndian)\n };\n}\nfunction readGridNodes(view, offset, gridHeader, isLittleEndian) {\n var nodesOffset = offset + 176;\n var gridRecordLength = 16;\n var gridShiftRecords = [];\n for (var i = 0; i < gridHeader.gridNodeCount; i++) {\n var record = {\n latitudeShift: view.getFloat32(nodesOffset + i * gridRecordLength, isLittleEndian),\n longitudeShift: view.getFloat32(nodesOffset + i * gridRecordLength + 4, isLittleEndian),\n latitudeAccuracy: view.getFloat32(nodesOffset + i * gridRecordLength + 8, isLittleEndian),\n longitudeAccuracy: view.getFloat32(nodesOffset + i * gridRecordLength + 12, isLittleEndian)\n };\n gridShiftRecords.push(record);\n }\n return gridShiftRecords;\n}","import parseCode from './parseCode';\nimport extend from './extend';\nimport projections from './projections';\nimport { sphere as dc_sphere, eccentricity as dc_eccentricity } from './deriveConstants';\nimport Datum from './constants/Datum';\nimport datum from './datum';\nimport match from './match';\nimport { getNadgrids } from \"./nadgrid\";\nfunction Projection(srsCode, callback) {\n if (!(this instanceof Projection)) {\n return new Projection(srsCode);\n }\n callback = callback || function (error) {\n if (error) {\n throw error;\n }\n };\n var json = parseCode(srsCode);\n if (typeof json !== 'object') {\n callback(srsCode);\n return;\n }\n var ourProj = Projection.projections.get(json.projName);\n if (!ourProj) {\n callback(srsCode);\n return;\n }\n if (json.datumCode && json.datumCode !== 'none') {\n var datumDef = match(Datum, json.datumCode);\n if (datumDef) {\n json.datum_params = json.datum_params || (datumDef.towgs84 ? datumDef.towgs84.split(',') : null);\n json.ellps = datumDef.ellipse;\n json.datumName = datumDef.datumName ? datumDef.datumName : json.datumCode;\n }\n }\n json.k0 = json.k0 || 1.0;\n json.axis = json.axis || 'enu';\n json.ellps = json.ellps || 'wgs84';\n json.lat1 = json.lat1 || json.lat0; // Lambert_Conformal_Conic_1SP, for example, needs this\n\n var sphere_ = dc_sphere(json.a, json.b, json.rf, json.ellps, json.sphere);\n var ecc = dc_eccentricity(sphere_.a, sphere_.b, sphere_.rf, json.R_A);\n var nadgrids = getNadgrids(json.nadgrids);\n var datumObj = json.datum || datum(json.datumCode, json.datum_params, sphere_.a, sphere_.b, ecc.es, ecc.ep2, nadgrids);\n extend(this, json); // transfer everything over from the projection because we don't know what we'll need\n extend(this, ourProj); // transfer all the methods from the projection\n\n // copy the 4 things over we calculated in deriveConstants.sphere\n this.a = sphere_.a;\n this.b = sphere_.b;\n this.rf = sphere_.rf;\n this.sphere = sphere_.sphere;\n\n // copy the 3 things we calculated in deriveConstants.eccentricity\n this.es = ecc.es;\n this.e = ecc.e;\n this.ep2 = ecc.ep2;\n\n // add in the datum object\n this.datum = datumObj;\n\n // init the projection\n this.init();\n\n // legecy callback from back in the day when it went to spatialreference.org\n callback(null, this);\n}\nProjection.projections = projections;\nProjection.projections.start();\nexport default Projection;","'use strict';\n\nimport { PJD_3PARAM, PJD_7PARAM, HALF_PI } from './constants/values';\nexport function compareDatums(source, dest) {\n if (source.datum_type !== dest.datum_type) {\n return false; // false, datums are not equal\n } else if (source.a !== dest.a || Math.abs(source.es - dest.es) > 0.000000000050) {\n // the tolerance for es is to ensure that GRS80 and WGS84\n // are considered identical\n return false;\n } else if (source.datum_type === PJD_3PARAM) {\n return source.datum_params[0] === dest.datum_params[0] && source.datum_params[1] === dest.datum_params[1] && source.datum_params[2] === dest.datum_params[2];\n } else if (source.datum_type === PJD_7PARAM) {\n return source.datum_params[0] === dest.datum_params[0] && source.datum_params[1] === dest.datum_params[1] && source.datum_params[2] === dest.datum_params[2] && source.datum_params[3] === dest.datum_params[3] && source.datum_params[4] === dest.datum_params[4] && source.datum_params[5] === dest.datum_params[5] && source.datum_params[6] === dest.datum_params[6];\n } else {\n return true; // datums are equal\n }\n} // cs_compare_datums()\n\n/*\n * The function Convert_Geodetic_To_Geocentric converts geodetic coordinates\n * (latitude, longitude, and height) to geocentric coordinates (X, Y, Z),\n * according to the current ellipsoid parameters.\n *\n * Latitude : Geodetic latitude in radians (input)\n * Longitude : Geodetic longitude in radians (input)\n * Height : Geodetic height, in meters (input)\n * X : Calculated Geocentric X coordinate, in meters (output)\n * Y : Calculated Geocentric Y coordinate, in meters (output)\n * Z : Calculated Geocentric Z coordinate, in meters (output)\n *\n */\nexport function geodeticToGeocentric(p, es, a) {\n var Longitude = p.x;\n var Latitude = p.y;\n var Height = p.z ? p.z : 0; //Z value not always supplied\n\n var Rn; /* Earth radius at location */\n var Sin_Lat; /* Math.sin(Latitude) */\n var Sin2_Lat; /* Square of Math.sin(Latitude) */\n var Cos_Lat; /* Math.cos(Latitude) */\n\n /*\n ** Don't blow up if Latitude is just a little out of the value\n ** range as it may just be a rounding issue. Also removed longitude\n ** test, it should be wrapped by Math.cos() and Math.sin(). NFW for PROJ.4, Sep/2001.\n */\n if (Latitude < -HALF_PI && Latitude > -1.001 * HALF_PI) {\n Latitude = -HALF_PI;\n } else if (Latitude > HALF_PI && Latitude < 1.001 * HALF_PI) {\n Latitude = HALF_PI;\n } else if (Latitude < -HALF_PI) {\n /* Latitude out of range */\n //..reportError('geocent:lat out of range:' + Latitude);\n return {\n x: -Infinity,\n y: -Infinity,\n z: p.z\n };\n } else if (Latitude > HALF_PI) {\n /* Latitude out of range */\n return {\n x: Infinity,\n y: Infinity,\n z: p.z\n };\n }\n if (Longitude > Math.PI) {\n Longitude -= 2 * Math.PI;\n }\n Sin_Lat = Math.sin(Latitude);\n Cos_Lat = Math.cos(Latitude);\n Sin2_Lat = Sin_Lat * Sin_Lat;\n Rn = a / Math.sqrt(1.0e0 - es * Sin2_Lat);\n return {\n x: (Rn + Height) * Cos_Lat * Math.cos(Longitude),\n y: (Rn + Height) * Cos_Lat * Math.sin(Longitude),\n z: (Rn * (1 - es) + Height) * Sin_Lat\n };\n} // cs_geodetic_to_geocentric()\n\nexport function geocentricToGeodetic(p, es, a, b) {\n /* local defintions and variables */\n /* end-criterium of loop, accuracy of sin(Latitude) */\n var genau = 1e-12;\n var genau2 = genau * genau;\n var maxiter = 30;\n var P; /* distance between semi-minor axis and location */\n var RR; /* distance between center and location */\n var CT; /* sin of geocentric latitude */\n var ST; /* cos of geocentric latitude */\n var RX;\n var RK;\n var RN; /* Earth radius at location */\n var CPHI0; /* cos of start or old geodetic latitude in iterations */\n var SPHI0; /* sin of start or old geodetic latitude in iterations */\n var CPHI; /* cos of searched geodetic latitude */\n var SPHI; /* sin of searched geodetic latitude */\n var SDPHI; /* end-criterium: addition-theorem of sin(Latitude(iter)-Latitude(iter-1)) */\n var iter; /* # of continous iteration, max. 30 is always enough (s.a.) */\n\n var X = p.x;\n var Y = p.y;\n var Z = p.z ? p.z : 0.0; //Z value not always supplied\n var Longitude;\n var Latitude;\n var Height;\n P = Math.sqrt(X * X + Y * Y);\n RR = Math.sqrt(X * X + Y * Y + Z * Z);\n\n /* special cases for latitude and longitude */\n if (P / a < genau) {\n /* special case, if P=0. (X=0., Y=0.) */\n Longitude = 0.0;\n\n /* if (X,Y,Z)=(0.,0.,0.) then Height becomes semi-minor axis\n * of ellipsoid (=center of mass), Latitude becomes PI/2 */\n if (RR / a < genau) {\n Latitude = HALF_PI;\n Height = -b;\n return {\n x: p.x,\n y: p.y,\n z: p.z\n };\n }\n } else {\n /* ellipsoidal (geodetic) longitude\n * interval: -PI < Longitude <= +PI */\n Longitude = Math.atan2(Y, X);\n }\n\n /* --------------------------------------------------------------\n * Following iterative algorithm was developped by\n * \"Institut for Erdmessung\", University of Hannover, July 1988.\n * Internet: www.ife.uni-hannover.de\n * Iterative computation of CPHI,SPHI and Height.\n * Iteration of CPHI and SPHI to 10**-12 radian resp.\n * 2*10**-7 arcsec.\n * --------------------------------------------------------------\n */\n CT = Z / RR;\n ST = P / RR;\n RX = 1.0 / Math.sqrt(1.0 - es * (2.0 - es) * ST * ST);\n CPHI0 = ST * (1.0 - es) * RX;\n SPHI0 = CT * RX;\n iter = 0;\n\n /* loop to find sin(Latitude) resp. Latitude\n * until |sin(Latitude(iter)-Latitude(iter-1))| < genau */\n do {\n iter++;\n RN = a / Math.sqrt(1.0 - es * SPHI0 * SPHI0);\n\n /* ellipsoidal (geodetic) height */\n Height = P * CPHI0 + Z * SPHI0 - RN * (1.0 - es * SPHI0 * SPHI0);\n RK = es * RN / (RN + Height);\n RX = 1.0 / Math.sqrt(1.0 - RK * (2.0 - RK) * ST * ST);\n CPHI = ST * (1.0 - RK) * RX;\n SPHI = CT * RX;\n SDPHI = SPHI * CPHI0 - CPHI * SPHI0;\n CPHI0 = CPHI;\n SPHI0 = SPHI;\n } while (SDPHI * SDPHI > genau2 && iter < maxiter);\n\n /* ellipsoidal (geodetic) latitude */\n Latitude = Math.atan(SPHI / Math.abs(CPHI));\n return {\n x: Longitude,\n y: Latitude,\n z: Height\n };\n} // cs_geocentric_to_geodetic()\n\n/****************************************************************/\n// pj_geocentic_to_wgs84( p )\n// p = point to transform in geocentric coordinates (x,y,z)\n\n/** point object, nothing fancy, just allows values to be\n passed back and forth by reference rather than by value.\n Other point classes may be used as long as they have\n x and y properties, which will get modified in the transform method.\n*/\nexport function geocentricToWgs84(p, datum_type, datum_params) {\n if (datum_type === PJD_3PARAM) {\n // if( x[io] === HUGE_VAL )\n // continue;\n return {\n x: p.x + datum_params[0],\n y: p.y + datum_params[1],\n z: p.z + datum_params[2]\n };\n } else if (datum_type === PJD_7PARAM) {\n var Dx_BF = datum_params[0];\n var Dy_BF = datum_params[1];\n var Dz_BF = datum_params[2];\n var Rx_BF = datum_params[3];\n var Ry_BF = datum_params[4];\n var Rz_BF = datum_params[5];\n var M_BF = datum_params[6];\n // if( x[io] === HUGE_VAL )\n // continue;\n return {\n x: M_BF * (p.x - Rz_BF * p.y + Ry_BF * p.z) + Dx_BF,\n y: M_BF * (Rz_BF * p.x + p.y - Rx_BF * p.z) + Dy_BF,\n z: M_BF * (-Ry_BF * p.x + Rx_BF * p.y + p.z) + Dz_BF\n };\n }\n} // cs_geocentric_to_wgs84\n\n/****************************************************************/\n// pj_geocentic_from_wgs84()\n// coordinate system definition,\n// point to transform in geocentric coordinates (x,y,z)\nexport function geocentricFromWgs84(p, datum_type, datum_params) {\n if (datum_type === PJD_3PARAM) {\n //if( x[io] === HUGE_VAL )\n // continue;\n return {\n x: p.x - datum_params[0],\n y: p.y - datum_params[1],\n z: p.z - datum_params[2]\n };\n } else if (datum_type === PJD_7PARAM) {\n var Dx_BF = datum_params[0];\n var Dy_BF = datum_params[1];\n var Dz_BF = datum_params[2];\n var Rx_BF = datum_params[3];\n var Ry_BF = datum_params[4];\n var Rz_BF = datum_params[5];\n var M_BF = datum_params[6];\n var x_tmp = (p.x - Dx_BF) / M_BF;\n var y_tmp = (p.y - Dy_BF) / M_BF;\n var z_tmp = (p.z - Dz_BF) / M_BF;\n //if( x[io] === HUGE_VAL )\n // continue;\n\n return {\n x: x_tmp + Rz_BF * y_tmp - Ry_BF * z_tmp,\n y: -Rz_BF * x_tmp + y_tmp + Rx_BF * z_tmp,\n z: Ry_BF * x_tmp - Rx_BF * y_tmp + z_tmp\n };\n } //cs_geocentric_from_wgs84()\n}","import { PJD_3PARAM, PJD_7PARAM, PJD_GRIDSHIFT, PJD_NODATUM, R2D, SRS_WGS84_ESQUARED, SRS_WGS84_SEMIMAJOR, SRS_WGS84_SEMIMINOR } from './constants/values';\nimport { geodeticToGeocentric, geocentricToGeodetic, geocentricToWgs84, geocentricFromWgs84, compareDatums } from './datumUtils';\nimport adjust_lon from \"./common/adjust_lon\";\nfunction checkParams(type) {\n return type === PJD_3PARAM || type === PJD_7PARAM;\n}\nexport default function (source, dest, point) {\n // Short cut if the datums are identical.\n if (compareDatums(source, dest)) {\n return point; // in this case, zero is sucess,\n // whereas cs_compare_datums returns 1 to indicate TRUE\n // confusing, should fix this\n }\n\n // Explicitly skip datum transform by setting 'datum=none' as parameter for either source or dest\n if (source.datum_type === PJD_NODATUM || dest.datum_type === PJD_NODATUM) {\n return point;\n }\n\n // If this datum requires grid shifts, then apply it to geodetic coordinates.\n var source_a = source.a;\n var source_es = source.es;\n if (source.datum_type === PJD_GRIDSHIFT) {\n var gridShiftCode = applyGridShift(source, false, point);\n if (gridShiftCode !== 0) {\n return undefined;\n }\n source_a = SRS_WGS84_SEMIMAJOR;\n source_es = SRS_WGS84_ESQUARED;\n }\n var dest_a = dest.a;\n var dest_b = dest.b;\n var dest_es = dest.es;\n if (dest.datum_type === PJD_GRIDSHIFT) {\n dest_a = SRS_WGS84_SEMIMAJOR;\n dest_b = SRS_WGS84_SEMIMINOR;\n dest_es = SRS_WGS84_ESQUARED;\n }\n\n // Do we need to go through geocentric coordinates?\n if (source_es === dest_es && source_a === dest_a && !checkParams(source.datum_type) && !checkParams(dest.datum_type)) {\n return point;\n }\n\n // Convert to geocentric coordinates.\n point = geodeticToGeocentric(point, source_es, source_a);\n // Convert between datums\n if (checkParams(source.datum_type)) {\n point = geocentricToWgs84(point, source.datum_type, source.datum_params);\n }\n if (checkParams(dest.datum_type)) {\n point = geocentricFromWgs84(point, dest.datum_type, dest.datum_params);\n }\n point = geocentricToGeodetic(point, dest_es, dest_a, dest_b);\n if (dest.datum_type === PJD_GRIDSHIFT) {\n var destGridShiftResult = applyGridShift(dest, true, point);\n if (destGridShiftResult !== 0) {\n return undefined;\n }\n }\n return point;\n}\nexport function applyGridShift(source, inverse, point) {\n if (source.grids === null || source.grids.length === 0) {\n console.log('Grid shift grids not found');\n return -1;\n }\n var input = {\n x: -point.x,\n y: point.y\n };\n var output = {\n x: Number.NaN,\n y: Number.NaN\n };\n var onlyMandatoryGrids = false;\n var attemptedGrids = [];\n outer: for (var i = 0; i < source.grids.length; i++) {\n var grid = source.grids[i];\n attemptedGrids.push(grid.name);\n if (grid.isNull) {\n output = input;\n break;\n }\n onlyMandatoryGrids = grid.mandatory;\n if (grid.grid === null) {\n if (grid.mandatory) {\n console.log(\"Unable to find mandatory grid '\" + grid.name + \"'\");\n return -1;\n }\n continue;\n }\n var subgrids = grid.grid.subgrids;\n for (var j = 0, jj = subgrids.length; j < jj; j++) {\n var subgrid = subgrids[j];\n // skip tables that don't match our point at all\n var epsilon = (Math.abs(subgrid.del[1]) + Math.abs(subgrid.del[0])) / 10000.0;\n var minX = subgrid.ll[0] - epsilon;\n var minY = subgrid.ll[1] - epsilon;\n var maxX = subgrid.ll[0] + (subgrid.lim[0] - 1) * subgrid.del[0] + epsilon;\n var maxY = subgrid.ll[1] + (subgrid.lim[1] - 1) * subgrid.del[1] + epsilon;\n if (minY > input.y || minX > input.x || maxY < input.y || maxX < input.x) {\n continue;\n }\n output = applySubgridShift(input, inverse, subgrid);\n if (!isNaN(output.x)) {\n break outer;\n }\n }\n }\n if (isNaN(output.x)) {\n console.log(\"Failed to find a grid shift table for location '\" + -input.x * R2D + \" \" + input.y * R2D + \" tried: '\" + attemptedGrids + \"'\");\n return -1;\n }\n point.x = -output.x;\n point.y = output.y;\n return 0;\n}\nfunction applySubgridShift(pin, inverse, ct) {\n var val = {\n x: Number.NaN,\n y: Number.NaN\n };\n if (isNaN(pin.x)) {\n return val;\n }\n var tb = {\n x: pin.x,\n y: pin.y\n };\n tb.x -= ct.ll[0];\n tb.y -= ct.ll[1];\n tb.x = adjust_lon(tb.x - Math.PI) + Math.PI;\n var t = nadInterpolate(tb, ct);\n if (inverse) {\n if (isNaN(t.x)) {\n return val;\n }\n t.x = tb.x - t.x;\n t.y = tb.y - t.y;\n var i = 9,\n tol = 1e-12;\n var dif, del;\n do {\n del = nadInterpolate(t, ct);\n if (isNaN(del.x)) {\n console.log(\"Inverse grid shift iteration failed, presumably at grid edge. Using first approximation.\");\n break;\n }\n dif = {\n x: tb.x - (del.x + t.x),\n y: tb.y - (del.y + t.y)\n };\n t.x += dif.x;\n t.y += dif.y;\n } while (i-- && Math.abs(dif.x) > tol && Math.abs(dif.y) > tol);\n if (i < 0) {\n console.log(\"Inverse grid shift iterator failed to converge.\");\n return val;\n }\n val.x = adjust_lon(t.x + ct.ll[0]);\n val.y = t.y + ct.ll[1];\n } else {\n if (!isNaN(t.x)) {\n val.x = pin.x + t.x;\n val.y = pin.y + t.y;\n }\n }\n return val;\n}\nfunction nadInterpolate(pin, ct) {\n var t = {\n x: pin.x / ct.del[0],\n y: pin.y / ct.del[1]\n };\n var indx = {\n x: Math.floor(t.x),\n y: Math.floor(t.y)\n };\n var frct = {\n x: t.x - 1.0 * indx.x,\n y: t.y - 1.0 * indx.y\n };\n var val = {\n x: Number.NaN,\n y: Number.NaN\n };\n var inx;\n if (indx.x < 0 || indx.x >= ct.lim[0]) {\n return val;\n }\n if (indx.y < 0 || indx.y >= ct.lim[1]) {\n return val;\n }\n inx = indx.y * ct.lim[0] + indx.x;\n var f00 = {\n x: ct.cvs[inx][0],\n y: ct.cvs[inx][1]\n };\n inx++;\n var f10 = {\n x: ct.cvs[inx][0],\n y: ct.cvs[inx][1]\n };\n inx += ct.lim[0];\n var f11 = {\n x: ct.cvs[inx][0],\n y: ct.cvs[inx][1]\n };\n inx--;\n var f01 = {\n x: ct.cvs[inx][0],\n y: ct.cvs[inx][1]\n };\n var m11 = frct.x * frct.y,\n m10 = frct.x * (1.0 - frct.y),\n m00 = (1.0 - frct.x) * (1.0 - frct.y),\n m01 = (1.0 - frct.x) * frct.y;\n val.x = m00 * f00.x + m10 * f10.x + m01 * f01.x + m11 * f11.x;\n val.y = m00 * f00.y + m10 * f10.y + m01 * f01.y + m11 * f11.y;\n return val;\n}","export default function (crs, denorm, point) {\n var xin = point.x,\n yin = point.y,\n zin = point.z || 0.0;\n var v, t, i;\n var out = {};\n for (i = 0; i < 3; i++) {\n if (denorm && i === 2 && point.z === undefined) {\n continue;\n }\n if (i === 0) {\n v = xin;\n if (\"ew\".indexOf(crs.axis[i]) !== -1) {\n t = 'x';\n } else {\n t = 'y';\n }\n } else if (i === 1) {\n v = yin;\n if (\"ns\".indexOf(crs.axis[i]) !== -1) {\n t = 'y';\n } else {\n t = 'x';\n }\n } else {\n v = zin;\n t = 'z';\n }\n switch (crs.axis[i]) {\n case 'e':\n out[t] = v;\n break;\n case 'w':\n out[t] = -v;\n break;\n case 'n':\n out[t] = v;\n break;\n case 's':\n out[t] = -v;\n break;\n case 'u':\n if (point[t] !== undefined) {\n out.z = v;\n }\n break;\n case 'd':\n if (point[t] !== undefined) {\n out.z = -v;\n }\n break;\n default:\n //console.log(\"ERROR: unknow axis (\"+crs.axis[i]+\") - check definition of \"+crs.projName);\n return null;\n }\n }\n return out;\n}","export default function (array) {\n var out = {\n x: array[0],\n y: array[1]\n };\n if (array.length > 2) {\n out.z = array[2];\n }\n if (array.length > 3) {\n out.m = array[3];\n }\n return out;\n}","export default function (point) {\n checkCoord(point.x);\n checkCoord(point.y);\n}\nfunction checkCoord(num) {\n if (typeof Number.isFinite === 'function') {\n if (Number.isFinite(num)) {\n return;\n }\n throw new TypeError('coordinates must be finite numbers');\n }\n if (typeof num !== 'number' || num !== num || !isFinite(num)) {\n throw new TypeError('coordinates must be finite numbers');\n }\n}","import { D2R, R2D, PJD_3PARAM, PJD_7PARAM, PJD_GRIDSHIFT } from './constants/values';\nimport datum_transform from './datum_transform';\nimport adjust_axis from './adjust_axis';\nimport proj from './Proj';\nimport toPoint from './common/toPoint';\nimport checkSanity from './checkSanity';\nfunction checkNotWGS(source, dest) {\n return (source.datum.datum_type === PJD_3PARAM || source.datum.datum_type === PJD_7PARAM || source.datum.datum_type === PJD_GRIDSHIFT) && dest.datumCode !== 'WGS84' || (dest.datum.datum_type === PJD_3PARAM || dest.datum.datum_type === PJD_7PARAM || dest.datum.datum_type === PJD_GRIDSHIFT) && source.datumCode !== 'WGS84';\n}\nexport default function transform(source, dest, point, enforceAxis) {\n var wgs84;\n if (Array.isArray(point)) {\n point = toPoint(point);\n } else {\n // Clone the point object so inputs don't get modified\n point = {\n x: point.x,\n y: point.y,\n z: point.z,\n m: point.m\n };\n }\n var hasZ = point.z !== undefined;\n checkSanity(point);\n // Workaround for datum shifts towgs84, if either source or destination projection is not wgs84\n if (source.datum && dest.datum && checkNotWGS(source, dest)) {\n wgs84 = new proj('WGS84');\n point = transform(source, wgs84, point, enforceAxis);\n source = wgs84;\n }\n // DGR, 2010/11/12\n if (enforceAxis && source.axis !== 'enu') {\n point = adjust_axis(source, false, point);\n }\n // Transform source points to long/lat, if they aren't already.\n if (source.projName === 'longlat') {\n point = {\n x: point.x * D2R,\n y: point.y * D2R,\n z: point.z || 0\n };\n } else {\n if (source.to_meter) {\n point = {\n x: point.x * source.to_meter,\n y: point.y * source.to_meter,\n z: point.z || 0\n };\n }\n point = source.inverse(point); // Convert Cartesian to longlat\n if (!point) {\n return;\n }\n }\n // Adjust for the prime meridian if necessary\n if (source.from_greenwich) {\n point.x += source.from_greenwich;\n }\n\n // Convert datums if needed, and if possible.\n point = datum_transform(source.datum, dest.datum, point);\n if (!point) {\n return;\n }\n\n // Adjust for the prime meridian if necessary\n if (dest.from_greenwich) {\n point = {\n x: point.x - dest.from_greenwich,\n y: point.y,\n z: point.z || 0\n };\n }\n if (dest.projName === 'longlat') {\n // convert radians to decimal degrees\n point = {\n x: point.x * R2D,\n y: point.y * R2D,\n z: point.z || 0\n };\n } else {\n // else project\n point = dest.forward(point);\n if (dest.to_meter) {\n point = {\n x: point.x / dest.to_meter,\n y: point.y / dest.to_meter,\n z: point.z || 0\n };\n }\n }\n\n // DGR, 2010/11/12\n if (enforceAxis && dest.axis !== 'enu') {\n return adjust_axis(dest, true, point);\n }\n if (point && !hasZ) {\n delete point.z;\n }\n return point;\n}","import proj from './Proj';\nimport transform from './transform';\nvar wgs84 = proj('WGS84');\nfunction transformer(from, to, coords, enforceAxis) {\n var transformedArray, out, keys;\n if (Array.isArray(coords)) {\n transformedArray = transform(from, to, coords, enforceAxis) || {\n x: NaN,\n y: NaN\n };\n if (coords.length > 2) {\n if (typeof from.name !== 'undefined' && from.name === 'geocent' || typeof to.name !== 'undefined' && to.name === 'geocent') {\n if (typeof transformedArray.z === 'number') {\n return [transformedArray.x, transformedArray.y, transformedArray.z].concat(coords.splice(3));\n } else {\n return [transformedArray.x, transformedArray.y, coords[2]].concat(coords.splice(3));\n }\n } else {\n return [transformedArray.x, transformedArray.y].concat(coords.splice(2));\n }\n } else {\n return [transformedArray.x, transformedArray.y];\n }\n } else {\n out = transform(from, to, coords, enforceAxis);\n keys = Object.keys(coords);\n if (keys.length === 2) {\n return out;\n }\n keys.forEach(function (key) {\n if (typeof from.name !== 'undefined' && from.name === 'geocent' || typeof to.name !== 'undefined' && to.name === 'geocent') {\n if (key === 'x' || key === 'y' || key === 'z') {\n return;\n }\n } else {\n if (key === 'x' || key === 'y') {\n return;\n }\n }\n out[key] = coords[key];\n });\n return out;\n }\n}\nfunction checkProj(item) {\n if (item instanceof proj) {\n return item;\n }\n if (item.oProj) {\n return item.oProj;\n }\n return proj(item);\n}\nfunction proj4(fromProj, toProj, coord) {\n fromProj = checkProj(fromProj);\n var single = false;\n var obj;\n if (typeof toProj === 'undefined') {\n toProj = fromProj;\n fromProj = wgs84;\n single = true;\n } else if (typeof toProj.x !== 'undefined' || Array.isArray(toProj)) {\n coord = toProj;\n toProj = fromProj;\n fromProj = wgs84;\n single = true;\n }\n toProj = checkProj(toProj);\n if (coord) {\n return transformer(fromProj, toProj, coord);\n } else {\n obj = {\n forward: function (coords, enforceAxis) {\n return transformer(fromProj, toProj, coords, enforceAxis);\n },\n inverse: function (coords, enforceAxis) {\n return transformer(toProj, fromProj, coords, enforceAxis);\n }\n };\n if (single) {\n obj.oProj = toProj;\n }\n return obj;\n }\n}\nexport default proj4;","/**\n * UTM zones are grouped, and assigned to one of a group of 6\n * sets.\n *\n * {int} @private\n */\nvar NUM_100K_SETS = 6;\n\n/**\n * The column letters (for easting) of the lower left value, per\n * set.\n *\n * {string} @private\n */\nvar SET_ORIGIN_COLUMN_LETTERS = 'AJSAJS';\n\n/**\n * The row letters (for northing) of the lower left value, per\n * set.\n *\n * {string} @private\n */\nvar SET_ORIGIN_ROW_LETTERS = 'AFAFAF';\nvar A = 65; // A\nvar I = 73; // I\nvar O = 79; // O\nvar V = 86; // V\nvar Z = 90; // Z\nexport default {\n forward: forward,\n inverse: inverse,\n toPoint: toPoint\n};\n/**\n * Conversion of lat/lon to MGRS.\n *\n * @param {object} ll Object literal with lat and lon properties on a\n * WGS84 ellipsoid.\n * @param {int} accuracy Accuracy in digits (5 for 1 m, 4 for 10 m, 3 for\n * 100 m, 2 for 1000 m or 1 for 10000 m). Optional, default is 5.\n * @return {string} the MGRS string for the given location and accuracy.\n */\nexport function forward(ll, accuracy) {\n accuracy = accuracy || 5; // default accuracy 1m\n return encode(LLtoUTM({\n lat: ll[1],\n lon: ll[0]\n }), accuracy);\n}\n;\n\n/**\n * Conversion of MGRS to lat/lon.\n *\n * @param {string} mgrs MGRS string.\n * @return {array} An array with left (longitude), bottom (latitude), right\n * (longitude) and top (latitude) values in WGS84, representing the\n * bounding box for the provided MGRS reference.\n */\nexport function inverse(mgrs) {\n var bbox = UTMtoLL(decode(mgrs.toUpperCase()));\n if (bbox.lat && bbox.lon) {\n return [bbox.lon, bbox.lat, bbox.lon, bbox.lat];\n }\n return [bbox.left, bbox.bottom, bbox.right, bbox.top];\n}\n;\nexport function toPoint(mgrs) {\n var bbox = UTMtoLL(decode(mgrs.toUpperCase()));\n if (bbox.lat && bbox.lon) {\n return [bbox.lon, bbox.lat];\n }\n return [(bbox.left + bbox.right) / 2, (bbox.top + bbox.bottom) / 2];\n}\n;\n/**\n * Conversion from degrees to radians.\n *\n * @private\n * @param {number} deg the angle in degrees.\n * @return {number} the angle in radians.\n */\nfunction degToRad(deg) {\n return deg * (Math.PI / 180.0);\n}\n\n/**\n * Conversion from radians to degrees.\n *\n * @private\n * @param {number} rad the angle in radians.\n * @return {number} the angle in degrees.\n */\nfunction radToDeg(rad) {\n return 180.0 * (rad / Math.PI);\n}\n\n/**\n * Converts a set of Longitude and Latitude co-ordinates to UTM\n * using the WGS84 ellipsoid.\n *\n * @private\n * @param {object} ll Object literal with lat and lon properties\n * representing the WGS84 coordinate to be converted.\n * @return {object} Object literal containing the UTM value with easting,\n * northing, zoneNumber and zoneLetter properties, and an optional\n * accuracy property in digits. Returns null if the conversion failed.\n */\nfunction LLtoUTM(ll) {\n var Lat = ll.lat;\n var Long = ll.lon;\n var a = 6378137.0; //ellip.radius;\n var eccSquared = 0.00669438; //ellip.eccsq;\n var k0 = 0.9996;\n var LongOrigin;\n var eccPrimeSquared;\n var N, T, C, A, M;\n var LatRad = degToRad(Lat);\n var LongRad = degToRad(Long);\n var LongOriginRad;\n var ZoneNumber;\n // (int)\n ZoneNumber = Math.floor((Long + 180) / 6) + 1;\n\n //Make sure the longitude 180.00 is in Zone 60\n if (Long === 180) {\n ZoneNumber = 60;\n }\n\n // Special zone for Norway\n if (Lat >= 56.0 && Lat < 64.0 && Long >= 3.0 && Long < 12.0) {\n ZoneNumber = 32;\n }\n\n // Special zones for Svalbard\n if (Lat >= 72.0 && Lat < 84.0) {\n if (Long >= 0.0 && Long < 9.0) {\n ZoneNumber = 31;\n } else if (Long >= 9.0 && Long < 21.0) {\n ZoneNumber = 33;\n } else if (Long >= 21.0 && Long < 33.0) {\n ZoneNumber = 35;\n } else if (Long >= 33.0 && Long < 42.0) {\n ZoneNumber = 37;\n }\n }\n LongOrigin = (ZoneNumber - 1) * 6 - 180 + 3; //+3 puts origin\n // in middle of\n // zone\n LongOriginRad = degToRad(LongOrigin);\n eccPrimeSquared = eccSquared / (1 - eccSquared);\n N = a / Math.sqrt(1 - eccSquared * Math.sin(LatRad) * Math.sin(LatRad));\n T = Math.tan(LatRad) * Math.tan(LatRad);\n C = eccPrimeSquared * Math.cos(LatRad) * Math.cos(LatRad);\n A = Math.cos(LatRad) * (LongRad - LongOriginRad);\n M = a * ((1 - eccSquared / 4 - 3 * eccSquared * eccSquared / 64 - 5 * eccSquared * eccSquared * eccSquared / 256) * LatRad - (3 * eccSquared / 8 + 3 * eccSquared * eccSquared / 32 + 45 * eccSquared * eccSquared * eccSquared / 1024) * Math.sin(2 * LatRad) + (15 * eccSquared * eccSquared / 256 + 45 * eccSquared * eccSquared * eccSquared / 1024) * Math.sin(4 * LatRad) - 35 * eccSquared * eccSquared * eccSquared / 3072 * Math.sin(6 * LatRad));\n var UTMEasting = k0 * N * (A + (1 - T + C) * A * A * A / 6.0 + (5 - 18 * T + T * T + 72 * C - 58 * eccPrimeSquared) * A * A * A * A * A / 120.0) + 500000.0;\n var UTMNorthing = k0 * (M + N * Math.tan(LatRad) * (A * A / 2 + (5 - T + 9 * C + 4 * C * C) * A * A * A * A / 24.0 + (61 - 58 * T + T * T + 600 * C - 330 * eccPrimeSquared) * A * A * A * A * A * A / 720.0));\n if (Lat < 0.0) {\n UTMNorthing += 10000000.0; //10000000 meter offset for\n // southern hemisphere\n }\n return {\n northing: Math.round(UTMNorthing),\n easting: Math.round(UTMEasting),\n zoneNumber: ZoneNumber,\n zoneLetter: getLetterDesignator(Lat)\n };\n}\n\n/**\n * Converts UTM coords to lat/long, using the WGS84 ellipsoid. This is a convenience\n * class where the Zone can be specified as a single string eg.\"60N\" which\n * is then broken down into the ZoneNumber and ZoneLetter.\n *\n * @private\n * @param {object} utm An object literal with northing, easting, zoneNumber\n * and zoneLetter properties. If an optional accuracy property is\n * provided (in meters), a bounding box will be returned instead of\n * latitude and longitude.\n * @return {object} An object literal containing either lat and lon values\n * (if no accuracy was provided), or top, right, bottom and left values\n * for the bounding box calculated according to the provided accuracy.\n * Returns null if the conversion failed.\n */\nfunction UTMtoLL(utm) {\n var UTMNorthing = utm.northing;\n var UTMEasting = utm.easting;\n var zoneLetter = utm.zoneLetter;\n var zoneNumber = utm.zoneNumber;\n // check the ZoneNummber is valid\n if (zoneNumber < 0 || zoneNumber > 60) {\n return null;\n }\n var k0 = 0.9996;\n var a = 6378137.0; //ellip.radius;\n var eccSquared = 0.00669438; //ellip.eccsq;\n var eccPrimeSquared;\n var e1 = (1 - Math.sqrt(1 - eccSquared)) / (1 + Math.sqrt(1 - eccSquared));\n var N1, T1, C1, R1, D, M;\n var LongOrigin;\n var mu, phi1Rad;\n\n // remove 500,000 meter offset for longitude\n var x = UTMEasting - 500000.0;\n var y = UTMNorthing;\n\n // We must know somehow if we are in the Northern or Southern\n // hemisphere, this is the only time we use the letter So even\n // if the Zone letter isn't exactly correct it should indicate\n // the hemisphere correctly\n if (zoneLetter < 'N') {\n y -= 10000000.0; // remove 10,000,000 meter offset used\n // for southern hemisphere\n }\n\n // There are 60 zones with zone 1 being at West -180 to -174\n LongOrigin = (zoneNumber - 1) * 6 - 180 + 3; // +3 puts origin\n // in middle of\n // zone\n\n eccPrimeSquared = eccSquared / (1 - eccSquared);\n M = y / k0;\n mu = M / (a * (1 - eccSquared / 4 - 3 * eccSquared * eccSquared / 64 - 5 * eccSquared * eccSquared * eccSquared / 256));\n phi1Rad = mu + (3 * e1 / 2 - 27 * e1 * e1 * e1 / 32) * Math.sin(2 * mu) + (21 * e1 * e1 / 16 - 55 * e1 * e1 * e1 * e1 / 32) * Math.sin(4 * mu) + 151 * e1 * e1 * e1 / 96 * Math.sin(6 * mu);\n // double phi1 = ProjMath.radToDeg(phi1Rad);\n\n N1 = a / Math.sqrt(1 - eccSquared * Math.sin(phi1Rad) * Math.sin(phi1Rad));\n T1 = Math.tan(phi1Rad) * Math.tan(phi1Rad);\n C1 = eccPrimeSquared * Math.cos(phi1Rad) * Math.cos(phi1Rad);\n R1 = a * (1 - eccSquared) / Math.pow(1 - eccSquared * Math.sin(phi1Rad) * Math.sin(phi1Rad), 1.5);\n D = x / (N1 * k0);\n var lat = phi1Rad - N1 * Math.tan(phi1Rad) / R1 * (D * D / 2 - (5 + 3 * T1 + 10 * C1 - 4 * C1 * C1 - 9 * eccPrimeSquared) * D * D * D * D / 24 + (61 + 90 * T1 + 298 * C1 + 45 * T1 * T1 - 252 * eccPrimeSquared - 3 * C1 * C1) * D * D * D * D * D * D / 720);\n lat = radToDeg(lat);\n var lon = (D - (1 + 2 * T1 + C1) * D * D * D / 6 + (5 - 2 * C1 + 28 * T1 - 3 * C1 * C1 + 8 * eccPrimeSquared + 24 * T1 * T1) * D * D * D * D * D / 120) / Math.cos(phi1Rad);\n lon = LongOrigin + radToDeg(lon);\n var result;\n if (utm.accuracy) {\n var topRight = UTMtoLL({\n northing: utm.northing + utm.accuracy,\n easting: utm.easting + utm.accuracy,\n zoneLetter: utm.zoneLetter,\n zoneNumber: utm.zoneNumber\n });\n result = {\n top: topRight.lat,\n right: topRight.lon,\n bottom: lat,\n left: lon\n };\n } else {\n result = {\n lat: lat,\n lon: lon\n };\n }\n return result;\n}\n\n/**\n * Calculates the MGRS letter designator for the given latitude.\n *\n * @private\n * @param {number} lat The latitude in WGS84 to get the letter designator\n * for.\n * @return {char} The letter designator.\n */\nfunction getLetterDesignator(lat) {\n //This is here as an error flag to show that the Latitude is\n //outside MGRS limits\n var LetterDesignator = 'Z';\n if (84 >= lat && lat >= 72) {\n LetterDesignator = 'X';\n } else if (72 > lat && lat >= 64) {\n LetterDesignator = 'W';\n } else if (64 > lat && lat >= 56) {\n LetterDesignator = 'V';\n } else if (56 > lat && lat >= 48) {\n LetterDesignator = 'U';\n } else if (48 > lat && lat >= 40) {\n LetterDesignator = 'T';\n } else if (40 > lat && lat >= 32) {\n LetterDesignator = 'S';\n } else if (32 > lat && lat >= 24) {\n LetterDesignator = 'R';\n } else if (24 > lat && lat >= 16) {\n LetterDesignator = 'Q';\n } else if (16 > lat && lat >= 8) {\n LetterDesignator = 'P';\n } else if (8 > lat && lat >= 0) {\n LetterDesignator = 'N';\n } else if (0 > lat && lat >= -8) {\n LetterDesignator = 'M';\n } else if (-8 > lat && lat >= -16) {\n LetterDesignator = 'L';\n } else if (-16 > lat && lat >= -24) {\n LetterDesignator = 'K';\n } else if (-24 > lat && lat >= -32) {\n LetterDesignator = 'J';\n } else if (-32 > lat && lat >= -40) {\n LetterDesignator = 'H';\n } else if (-40 > lat && lat >= -48) {\n LetterDesignator = 'G';\n } else if (-48 > lat && lat >= -56) {\n LetterDesignator = 'F';\n } else if (-56 > lat && lat >= -64) {\n LetterDesignator = 'E';\n } else if (-64 > lat && lat >= -72) {\n LetterDesignator = 'D';\n } else if (-72 > lat && lat >= -80) {\n LetterDesignator = 'C';\n }\n return LetterDesignator;\n}\n\n/**\n * Encodes a UTM location as MGRS string.\n *\n * @private\n * @param {object} utm An object literal with easting, northing,\n * zoneLetter, zoneNumber\n * @param {number} accuracy Accuracy in digits (1-5).\n * @return {string} MGRS string for the given UTM location.\n */\nfunction encode(utm, accuracy) {\n // prepend with leading zeroes\n var seasting = \"00000\" + utm.easting,\n snorthing = \"00000\" + utm.northing;\n return utm.zoneNumber + utm.zoneLetter + get100kID(utm.easting, utm.northing, utm.zoneNumber) + seasting.substr(seasting.length - 5, accuracy) + snorthing.substr(snorthing.length - 5, accuracy);\n}\n\n/**\n * Get the two letter 100k designator for a given UTM easting,\n * northing and zone number value.\n *\n * @private\n * @param {number} easting\n * @param {number} northing\n * @param {number} zoneNumber\n * @return the two letter 100k designator for the given UTM location.\n */\nfunction get100kID(easting, northing, zoneNumber) {\n var setParm = get100kSetForZone(zoneNumber);\n var setColumn = Math.floor(easting / 100000);\n var setRow = Math.floor(northing / 100000) % 20;\n return getLetter100kID(setColumn, setRow, setParm);\n}\n\n/**\n * Given a UTM zone number, figure out the MGRS 100K set it is in.\n *\n * @private\n * @param {number} i An UTM zone number.\n * @return {number} the 100k set the UTM zone is in.\n */\nfunction get100kSetForZone(i) {\n var setParm = i % NUM_100K_SETS;\n if (setParm === 0) {\n setParm = NUM_100K_SETS;\n }\n return setParm;\n}\n\n/**\n * Get the two-letter MGRS 100k designator given information\n * translated from the UTM northing, easting and zone number.\n *\n * @private\n * @param {number} column the column index as it relates to the MGRS\n * 100k set spreadsheet, created from the UTM easting.\n * Values are 1-8.\n * @param {number} row the row index as it relates to the MGRS 100k set\n * spreadsheet, created from the UTM northing value. Values\n * are from 0-19.\n * @param {number} parm the set block, as it relates to the MGRS 100k set\n * spreadsheet, created from the UTM zone. Values are from\n * 1-60.\n * @return two letter MGRS 100k code.\n */\nfunction getLetter100kID(column, row, parm) {\n // colOrigin and rowOrigin are the letters at the origin of the set\n var index = parm - 1;\n var colOrigin = SET_ORIGIN_COLUMN_LETTERS.charCodeAt(index);\n var rowOrigin = SET_ORIGIN_ROW_LETTERS.charCodeAt(index);\n\n // colInt and rowInt are the letters to build to return\n var colInt = colOrigin + column - 1;\n var rowInt = rowOrigin + row;\n var rollover = false;\n if (colInt > Z) {\n colInt = colInt - Z + A - 1;\n rollover = true;\n }\n if (colInt === I || colOrigin < I && colInt > I || (colInt > I || colOrigin < I) && rollover) {\n colInt++;\n }\n if (colInt === O || colOrigin < O && colInt > O || (colInt > O || colOrigin < O) && rollover) {\n colInt++;\n if (colInt === I) {\n colInt++;\n }\n }\n if (colInt > Z) {\n colInt = colInt - Z + A - 1;\n }\n if (rowInt > V) {\n rowInt = rowInt - V + A - 1;\n rollover = true;\n } else {\n rollover = false;\n }\n if (rowInt === I || rowOrigin < I && rowInt > I || (rowInt > I || rowOrigin < I) && rollover) {\n rowInt++;\n }\n if (rowInt === O || rowOrigin < O && rowInt > O || (rowInt > O || rowOrigin < O) && rollover) {\n rowInt++;\n if (rowInt === I) {\n rowInt++;\n }\n }\n if (rowInt > V) {\n rowInt = rowInt - V + A - 1;\n }\n var twoLetter = String.fromCharCode(colInt) + String.fromCharCode(rowInt);\n return twoLetter;\n}\n\n/**\n * Decode the UTM parameters from a MGRS string.\n *\n * @private\n * @param {string} mgrsString an UPPERCASE coordinate string is expected.\n * @return {object} An object literal with easting, northing, zoneLetter,\n * zoneNumber and accuracy (in meters) properties.\n */\nfunction decode(mgrsString) {\n if (mgrsString && mgrsString.length === 0) {\n throw \"MGRSPoint coverting from nothing\";\n }\n var length = mgrsString.length;\n var hunK = null;\n var sb = \"\";\n var testChar;\n var i = 0;\n\n // get Zone number\n while (!/[A-Z]/.test(testChar = mgrsString.charAt(i))) {\n if (i >= 2) {\n throw \"MGRSPoint bad conversion from: \" + mgrsString;\n }\n sb += testChar;\n i++;\n }\n var zoneNumber = parseInt(sb, 10);\n if (i === 0 || i + 3 > length) {\n // A good MGRS string has to be 4-5 digits long,\n // ##AAA/#AAA at least.\n throw \"MGRSPoint bad conversion from: \" + mgrsString;\n }\n var zoneLetter = mgrsString.charAt(i++);\n\n // Should we check the zone letter here? Why not.\n if (zoneLetter <= 'A' || zoneLetter === 'B' || zoneLetter === 'Y' || zoneLetter >= 'Z' || zoneLetter === 'I' || zoneLetter === 'O') {\n throw \"MGRSPoint zone letter \" + zoneLetter + \" not handled: \" + mgrsString;\n }\n hunK = mgrsString.substring(i, i += 2);\n var set = get100kSetForZone(zoneNumber);\n var east100k = getEastingFromChar(hunK.charAt(0), set);\n var north100k = getNorthingFromChar(hunK.charAt(1), set);\n\n // We have a bug where the northing may be 2000000 too low.\n // How\n // do we know when to roll over?\n\n while (north100k < getMinNorthing(zoneLetter)) {\n north100k += 2000000;\n }\n\n // calculate the char index for easting/northing separator\n var remainder = length - i;\n if (remainder % 2 !== 0) {\n throw \"MGRSPoint has to have an even number \\nof digits after the zone letter and two 100km letters - front \\nhalf for easting meters, second half for \\nnorthing meters\" + mgrsString;\n }\n var sep = remainder / 2;\n var sepEasting = 0.0;\n var sepNorthing = 0.0;\n var accuracyBonus, sepEastingString, sepNorthingString, easting, northing;\n if (sep > 0) {\n accuracyBonus = 100000.0 / Math.pow(10, sep);\n sepEastingString = mgrsString.substring(i, i + sep);\n sepEasting = parseFloat(sepEastingString) * accuracyBonus;\n sepNorthingString = mgrsString.substring(i + sep);\n sepNorthing = parseFloat(sepNorthingString) * accuracyBonus;\n }\n easting = sepEasting + east100k;\n northing = sepNorthing + north100k;\n return {\n easting: easting,\n northing: northing,\n zoneLetter: zoneLetter,\n zoneNumber: zoneNumber,\n accuracy: accuracyBonus\n };\n}\n\n/**\n * Given the first letter from a two-letter MGRS 100k zone, and given the\n * MGRS table set for the zone number, figure out the easting value that\n * should be added to the other, secondary easting value.\n *\n * @private\n * @param {char} e The first letter from a two-letter MGRS 100´k zone.\n * @param {number} set The MGRS table set for the zone number.\n * @return {number} The easting value for the given letter and set.\n */\nfunction getEastingFromChar(e, set) {\n // colOrigin is the letter at the origin of the set for the\n // column\n var curCol = SET_ORIGIN_COLUMN_LETTERS.charCodeAt(set - 1);\n var eastingValue = 100000.0;\n var rewindMarker = false;\n while (curCol !== e.charCodeAt(0)) {\n curCol++;\n if (curCol === I) {\n curCol++;\n }\n if (curCol === O) {\n curCol++;\n }\n if (curCol > Z) {\n if (rewindMarker) {\n throw \"Bad character: \" + e;\n }\n curCol = A;\n rewindMarker = true;\n }\n eastingValue += 100000.0;\n }\n return eastingValue;\n}\n\n/**\n * Given the second letter from a two-letter MGRS 100k zone, and given the\n * MGRS table set for the zone number, figure out the northing value that\n * should be added to the other, secondary northing value. You have to\n * remember that Northings are determined from the equator, and the vertical\n * cycle of letters mean a 2000000 additional northing meters. This happens\n * approx. every 18 degrees of latitude. This method does *NOT* count any\n * additional northings. You have to figure out how many 2000000 meters need\n * to be added for the zone letter of the MGRS coordinate.\n *\n * @private\n * @param {char} n Second letter of the MGRS 100k zone\n * @param {number} set The MGRS table set number, which is dependent on the\n * UTM zone number.\n * @return {number} The northing value for the given letter and set.\n */\nfunction getNorthingFromChar(n, set) {\n if (n > 'V') {\n throw \"MGRSPoint given invalid Northing \" + n;\n }\n\n // rowOrigin is the letter at the origin of the set for the\n // column\n var curRow = SET_ORIGIN_ROW_LETTERS.charCodeAt(set - 1);\n var northingValue = 0.0;\n var rewindMarker = false;\n while (curRow !== n.charCodeAt(0)) {\n curRow++;\n if (curRow === I) {\n curRow++;\n }\n if (curRow === O) {\n curRow++;\n }\n // fixing a bug making whole application hang in this loop\n // when 'n' is a wrong character\n if (curRow > V) {\n if (rewindMarker) {\n // making sure that this loop ends\n throw \"Bad character: \" + n;\n }\n curRow = A;\n rewindMarker = true;\n }\n northingValue += 100000.0;\n }\n return northingValue;\n}\n\n/**\n * The function getMinNorthing returns the minimum northing value of a MGRS\n * zone.\n *\n * Ported from Geotrans' c Lattitude_Band_Value structure table.\n *\n * @private\n * @param {char} zoneLetter The MGRS zone to get the min northing for.\n * @return {number}\n */\nfunction getMinNorthing(zoneLetter) {\n var northing;\n switch (zoneLetter) {\n case 'C':\n northing = 1100000.0;\n break;\n case 'D':\n northing = 2000000.0;\n break;\n case 'E':\n northing = 2800000.0;\n break;\n case 'F':\n northing = 3700000.0;\n break;\n case 'G':\n northing = 4600000.0;\n break;\n case 'H':\n northing = 5500000.0;\n break;\n case 'J':\n northing = 6400000.0;\n break;\n case 'K':\n northing = 7300000.0;\n break;\n case 'L':\n northing = 8200000.0;\n break;\n case 'M':\n northing = 9100000.0;\n break;\n case 'N':\n northing = 0.0;\n break;\n case 'P':\n northing = 800000.0;\n break;\n case 'Q':\n northing = 1700000.0;\n break;\n case 'R':\n northing = 2600000.0;\n break;\n case 'S':\n northing = 3500000.0;\n break;\n case 'T':\n northing = 4400000.0;\n break;\n case 'U':\n northing = 5300000.0;\n break;\n case 'V':\n northing = 6200000.0;\n break;\n case 'W':\n northing = 7000000.0;\n break;\n case 'X':\n northing = 7900000.0;\n break;\n default:\n northing = -1.0;\n }\n if (northing >= 0.0) {\n return northing;\n } else {\n throw \"Invalid zone letter: \" + zoneLetter;\n }\n}","import { toPoint, forward } from 'mgrs';\nfunction Point(x, y, z) {\n if (!(this instanceof Point)) {\n return new Point(x, y, z);\n }\n if (Array.isArray(x)) {\n this.x = x[0];\n this.y = x[1];\n this.z = x[2] || 0.0;\n } else if (typeof x === 'object') {\n this.x = x.x;\n this.y = x.y;\n this.z = x.z || 0.0;\n } else if (typeof x === 'string' && typeof y === 'undefined') {\n var coords = x.split(',');\n this.x = parseFloat(coords[0], 10);\n this.y = parseFloat(coords[1], 10);\n this.z = parseFloat(coords[2], 10) || 0.0;\n } else {\n this.x = x;\n this.y = y;\n this.z = z || 0.0;\n }\n console.warn('proj4.Point will be removed in version 3, use proj4.toPoint');\n}\nPoint.fromMGRS = function (mgrsStr) {\n return new Point(toPoint(mgrsStr));\n};\nPoint.prototype.toMGRS = function (accuracy) {\n return forward([this.x, this.y], accuracy);\n};\nexport default Point;","var C00 = 1;\nvar C02 = 0.25;\nvar C04 = 0.046875;\nvar C06 = 0.01953125;\nvar C08 = 0.01068115234375;\nvar C22 = 0.75;\nvar C44 = 0.46875;\nvar C46 = 0.01302083333333333333;\nvar C48 = 0.00712076822916666666;\nvar C66 = 0.36458333333333333333;\nvar C68 = 0.00569661458333333333;\nvar C88 = 0.3076171875;\nexport default function (es) {\n var en = [];\n en[0] = C00 - es * (C02 + es * (C04 + es * (C06 + es * C08)));\n en[1] = es * (C22 - es * (C04 + es * (C06 + es * C08)));\n var t = es * es;\n en[2] = t * (C44 - es * (C46 + es * C48));\n t *= es;\n en[3] = t * (C66 - es * C68);\n en[4] = t * es * C88;\n return en;\n}","export default function (phi, sphi, cphi, en) {\n cphi *= sphi;\n sphi *= sphi;\n return en[0] * phi - cphi * (en[1] + sphi * (en[2] + sphi * (en[3] + sphi * en[4])));\n}","import pj_mlfn from \"./pj_mlfn\";\nimport { EPSLN } from '../constants/values';\nvar MAX_ITER = 20;\nexport default function (arg, es, en) {\n var k = 1 / (1 - es);\n var phi = arg;\n for (var i = MAX_ITER; i; --i) {\n /* rarely goes over 2 iterations */\n var s = Math.sin(phi);\n var t = 1 - es * s * s;\n //t = this.pj_mlfn(phi, s, Math.cos(phi), en) - arg;\n //phi -= t * (t * Math.sqrt(t)) * k;\n t = (pj_mlfn(phi, s, Math.cos(phi), en) - arg) * (t * Math.sqrt(t)) * k;\n phi -= t;\n if (Math.abs(t) < EPSLN) {\n return phi;\n }\n }\n //..reportError(\"cass:pj_inv_mlfn: Convergence error\");\n return phi;\n}","// Heavily based on this tmerc projection implementation\n// https://github.com/mbloch/mapshaper-proj/blob/master/src/projections/tmerc.js\n\nimport pj_enfn from '../common/pj_enfn';\nimport pj_mlfn from '../common/pj_mlfn';\nimport pj_inv_mlfn from '../common/pj_inv_mlfn';\nimport adjust_lon from '../common/adjust_lon';\nimport { EPSLN, HALF_PI } from '../constants/values';\nimport sign from '../common/sign';\nexport function init() {\n this.x0 = this.x0 !== undefined ? this.x0 : 0;\n this.y0 = this.y0 !== undefined ? this.y0 : 0;\n this.long0 = this.long0 !== undefined ? this.long0 : 0;\n this.lat0 = this.lat0 !== undefined ? this.lat0 : 0;\n if (this.es) {\n this.en = pj_enfn(this.es);\n this.ml0 = pj_mlfn(this.lat0, Math.sin(this.lat0), Math.cos(this.lat0), this.en);\n }\n}\n\n/**\n Transverse Mercator Forward - long/lat to x/y\n long/lat in radians\n */\nexport function forward(p) {\n var lon = p.x;\n var lat = p.y;\n var delta_lon = adjust_lon(lon - this.long0);\n var con;\n var x, y;\n var sin_phi = Math.sin(lat);\n var cos_phi = Math.cos(lat);\n if (!this.es) {\n var b = cos_phi * Math.sin(delta_lon);\n if (Math.abs(Math.abs(b) - 1) < EPSLN) {\n return 93;\n } else {\n x = 0.5 * this.a * this.k0 * Math.log((1 + b) / (1 - b)) + this.x0;\n y = cos_phi * Math.cos(delta_lon) / Math.sqrt(1 - Math.pow(b, 2));\n b = Math.abs(y);\n if (b >= 1) {\n if (b - 1 > EPSLN) {\n return 93;\n } else {\n y = 0;\n }\n } else {\n y = Math.acos(y);\n }\n if (lat < 0) {\n y = -y;\n }\n y = this.a * this.k0 * (y - this.lat0) + this.y0;\n }\n } else {\n var al = cos_phi * delta_lon;\n var als = Math.pow(al, 2);\n var c = this.ep2 * Math.pow(cos_phi, 2);\n var cs = Math.pow(c, 2);\n var tq = Math.abs(cos_phi) > EPSLN ? Math.tan(lat) : 0;\n var t = Math.pow(tq, 2);\n var ts = Math.pow(t, 2);\n con = 1 - this.es * Math.pow(sin_phi, 2);\n al = al / Math.sqrt(con);\n var ml = pj_mlfn(lat, sin_phi, cos_phi, this.en);\n x = this.a * (this.k0 * al * (1 + als / 6 * (1 - t + c + als / 20 * (5 - 18 * t + ts + 14 * c - 58 * t * c + als / 42 * (61 + 179 * ts - ts * t - 479 * t))))) + this.x0;\n y = this.a * (this.k0 * (ml - this.ml0 + sin_phi * delta_lon * al / 2 * (1 + als / 12 * (5 - t + 9 * c + 4 * cs + als / 30 * (61 + ts - 58 * t + 270 * c - 330 * t * c + als / 56 * (1385 + 543 * ts - ts * t - 3111 * t)))))) + this.y0;\n }\n p.x = x;\n p.y = y;\n return p;\n}\n\n/**\n Transverse Mercator Inverse - x/y to long/lat\n */\nexport function inverse(p) {\n var con, phi;\n var lat, lon;\n var x = (p.x - this.x0) * (1 / this.a);\n var y = (p.y - this.y0) * (1 / this.a);\n if (!this.es) {\n var f = Math.exp(x / this.k0);\n var g = 0.5 * (f - 1 / f);\n var temp = this.lat0 + y / this.k0;\n var h = Math.cos(temp);\n con = Math.sqrt((1 - Math.pow(h, 2)) / (1 + Math.pow(g, 2)));\n lat = Math.asin(con);\n if (y < 0) {\n lat = -lat;\n }\n if (g === 0 && h === 0) {\n lon = 0;\n } else {\n lon = adjust_lon(Math.atan2(g, h) + this.long0);\n }\n } else {\n // ellipsoidal form\n con = this.ml0 + y / this.k0;\n phi = pj_inv_mlfn(con, this.es, this.en);\n if (Math.abs(phi) < HALF_PI) {\n var sin_phi = Math.sin(phi);\n var cos_phi = Math.cos(phi);\n var tan_phi = Math.abs(cos_phi) > EPSLN ? Math.tan(phi) : 0;\n var c = this.ep2 * Math.pow(cos_phi, 2);\n var cs = Math.pow(c, 2);\n var t = Math.pow(tan_phi, 2);\n var ts = Math.pow(t, 2);\n con = 1 - this.es * Math.pow(sin_phi, 2);\n var d = x * Math.sqrt(con) / this.k0;\n var ds = Math.pow(d, 2);\n con = con * tan_phi;\n lat = phi - con * ds / (1 - this.es) * 0.5 * (1 - ds / 12 * (5 + 3 * t - 9 * c * t + c - 4 * cs - ds / 30 * (61 + 90 * t - 252 * c * t + 45 * ts + 46 * c - ds / 56 * (1385 + 3633 * t + 4095 * ts + 1574 * ts * t))));\n lon = adjust_lon(this.long0 + d * (1 - ds / 6 * (1 + 2 * t + c - ds / 20 * (5 + 28 * t + 24 * ts + 8 * c * t + 6 * c - ds / 42 * (61 + 662 * t + 1320 * ts + 720 * ts * t)))) / cos_phi);\n } else {\n lat = HALF_PI * sign(y);\n lon = 0;\n }\n }\n p.x = lon;\n p.y = lat;\n return p;\n}\nexport var names = [\"Fast_Transverse_Mercator\", \"Fast Transverse Mercator\"];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};","export default function (x) {\n var r = Math.exp(x);\n r = (r - 1 / r) / 2;\n return r;\n}","export default function (x, y) {\n x = Math.abs(x);\n y = Math.abs(y);\n var a = Math.max(x, y);\n var b = Math.min(x, y) / (a ? a : 1);\n return a * Math.sqrt(1 + Math.pow(b, 2));\n}","export default function (x) {\n var y = 1 + x;\n var z = y - 1;\n return z === 0 ? x : x * Math.log(y) / z;\n}","import hypot from './hypot';\nimport log1py from './log1py';\nexport default function (x) {\n var y = Math.abs(x);\n y = log1py(y * (1 + y / (hypot(1, y) + 1)));\n return x < 0 ? -y : y;\n}","export default function (pp, B) {\n var cos_2B = 2 * Math.cos(2 * B);\n var i = pp.length - 1;\n var h1 = pp[i];\n var h2 = 0;\n var h;\n while (--i >= 0) {\n h = -h2 + cos_2B * h1 + pp[i];\n h2 = h1;\n h1 = h;\n }\n return B + h * Math.sin(2 * B);\n}","export default function (pp, arg_r) {\n var r = 2 * Math.cos(arg_r);\n var i = pp.length - 1;\n var hr1 = pp[i];\n var hr2 = 0;\n var hr;\n while (--i >= 0) {\n hr = -hr2 + r * hr1 + pp[i];\n hr2 = hr1;\n hr1 = hr;\n }\n return Math.sin(arg_r) * hr;\n}","export default function (x) {\n var r = Math.exp(x);\n r = (r + 1 / r) / 2;\n return r;\n}","import sinh from './sinh';\nimport cosh from './cosh';\nexport default function (pp, arg_r, arg_i) {\n var sin_arg_r = Math.sin(arg_r);\n var cos_arg_r = Math.cos(arg_r);\n var sinh_arg_i = sinh(arg_i);\n var cosh_arg_i = cosh(arg_i);\n var r = 2 * cos_arg_r * cosh_arg_i;\n var i = -2 * sin_arg_r * sinh_arg_i;\n var j = pp.length - 1;\n var hr = pp[j];\n var hi1 = 0;\n var hr1 = 0;\n var hi = 0;\n var hr2;\n var hi2;\n while (--j >= 0) {\n hr2 = hr1;\n hi2 = hi1;\n hr1 = hr;\n hi1 = hi;\n hr = -hr2 + r * hr1 - i * hi1 + pp[j];\n hi = -hi2 + i * hr1 + r * hi1;\n }\n r = sin_arg_r * cosh_arg_i;\n i = cos_arg_r * sinh_arg_i;\n return [r * hr - i * hi, r * hi + i * hr];\n}","// Heavily based on this etmerc projection implementation\n// https://github.com/mbloch/mapshaper-proj/blob/master/src/projections/etmerc.js\n\nimport tmerc from '../projections/tmerc';\nimport sinh from '../common/sinh';\nimport hypot from '../common/hypot';\nimport asinhy from '../common/asinhy';\nimport gatg from '../common/gatg';\nimport clens from '../common/clens';\nimport clens_cmplx from '../common/clens_cmplx';\nimport adjust_lon from '../common/adjust_lon';\nexport function init() {\n if (!this.approx && (isNaN(this.es) || this.es <= 0)) {\n throw new Error('Incorrect elliptical usage. Try using the +approx option in the proj string, or PROJECTION[\"Fast_Transverse_Mercator\"] in the WKT.');\n }\n if (this.approx) {\n // When '+approx' is set, use tmerc instead\n tmerc.init.apply(this);\n this.forward = tmerc.forward;\n this.inverse = tmerc.inverse;\n }\n this.x0 = this.x0 !== undefined ? this.x0 : 0;\n this.y0 = this.y0 !== undefined ? this.y0 : 0;\n this.long0 = this.long0 !== undefined ? this.long0 : 0;\n this.lat0 = this.lat0 !== undefined ? this.lat0 : 0;\n this.cgb = [];\n this.cbg = [];\n this.utg = [];\n this.gtu = [];\n var f = this.es / (1 + Math.sqrt(1 - this.es));\n var n = f / (2 - f);\n var np = n;\n this.cgb[0] = n * (2 + n * (-2 / 3 + n * (-2 + n * (116 / 45 + n * (26 / 45 + n * (-2854 / 675))))));\n this.cbg[0] = n * (-2 + n * (2 / 3 + n * (4 / 3 + n * (-82 / 45 + n * (32 / 45 + n * (4642 / 4725))))));\n np = np * n;\n this.cgb[1] = np * (7 / 3 + n * (-8 / 5 + n * (-227 / 45 + n * (2704 / 315 + n * (2323 / 945)))));\n this.cbg[1] = np * (5 / 3 + n * (-16 / 15 + n * (-13 / 9 + n * (904 / 315 + n * (-1522 / 945)))));\n np = np * n;\n this.cgb[2] = np * (56 / 15 + n * (-136 / 35 + n * (-1262 / 105 + n * (73814 / 2835))));\n this.cbg[2] = np * (-26 / 15 + n * (34 / 21 + n * (8 / 5 + n * (-12686 / 2835))));\n np = np * n;\n this.cgb[3] = np * (4279 / 630 + n * (-332 / 35 + n * (-399572 / 14175)));\n this.cbg[3] = np * (1237 / 630 + n * (-12 / 5 + n * (-24832 / 14175)));\n np = np * n;\n this.cgb[4] = np * (4174 / 315 + n * (-144838 / 6237));\n this.cbg[4] = np * (-734 / 315 + n * (109598 / 31185));\n np = np * n;\n this.cgb[5] = np * (601676 / 22275);\n this.cbg[5] = np * (444337 / 155925);\n np = Math.pow(n, 2);\n this.Qn = this.k0 / (1 + n) * (1 + np * (1 / 4 + np * (1 / 64 + np / 256)));\n this.utg[0] = n * (-0.5 + n * (2 / 3 + n * (-37 / 96 + n * (1 / 360 + n * (81 / 512 + n * (-96199 / 604800))))));\n this.gtu[0] = n * (0.5 + n * (-2 / 3 + n * (5 / 16 + n * (41 / 180 + n * (-127 / 288 + n * (7891 / 37800))))));\n this.utg[1] = np * (-1 / 48 + n * (-1 / 15 + n * (437 / 1440 + n * (-46 / 105 + n * (1118711 / 3870720)))));\n this.gtu[1] = np * (13 / 48 + n * (-3 / 5 + n * (557 / 1440 + n * (281 / 630 + n * (-1983433 / 1935360)))));\n np = np * n;\n this.utg[2] = np * (-17 / 480 + n * (37 / 840 + n * (209 / 4480 + n * (-5569 / 90720))));\n this.gtu[2] = np * (61 / 240 + n * (-103 / 140 + n * (15061 / 26880 + n * (167603 / 181440))));\n np = np * n;\n this.utg[3] = np * (-4397 / 161280 + n * (11 / 504 + n * (830251 / 7257600)));\n this.gtu[3] = np * (49561 / 161280 + n * (-179 / 168 + n * (6601661 / 7257600)));\n np = np * n;\n this.utg[4] = np * (-4583 / 161280 + n * (108847 / 3991680));\n this.gtu[4] = np * (34729 / 80640 + n * (-3418889 / 1995840));\n np = np * n;\n this.utg[5] = np * (-20648693 / 638668800);\n this.gtu[5] = np * (212378941 / 319334400);\n var Z = gatg(this.cbg, this.lat0);\n this.Zb = -this.Qn * (Z + clens(this.gtu, 2 * Z));\n}\nexport function forward(p) {\n var Ce = adjust_lon(p.x - this.long0);\n var Cn = p.y;\n Cn = gatg(this.cbg, Cn);\n var sin_Cn = Math.sin(Cn);\n var cos_Cn = Math.cos(Cn);\n var sin_Ce = Math.sin(Ce);\n var cos_Ce = Math.cos(Ce);\n Cn = Math.atan2(sin_Cn, cos_Ce * cos_Cn);\n Ce = Math.atan2(sin_Ce * cos_Cn, hypot(sin_Cn, cos_Cn * cos_Ce));\n Ce = asinhy(Math.tan(Ce));\n var tmp = clens_cmplx(this.gtu, 2 * Cn, 2 * Ce);\n Cn = Cn + tmp[0];\n Ce = Ce + tmp[1];\n var x;\n var y;\n if (Math.abs(Ce) <= 2.623395162778) {\n x = this.a * (this.Qn * Ce) + this.x0;\n y = this.a * (this.Qn * Cn + this.Zb) + this.y0;\n } else {\n x = Infinity;\n y = Infinity;\n }\n p.x = x;\n p.y = y;\n return p;\n}\nexport function inverse(p) {\n var Ce = (p.x - this.x0) * (1 / this.a);\n var Cn = (p.y - this.y0) * (1 / this.a);\n Cn = (Cn - this.Zb) / this.Qn;\n Ce = Ce / this.Qn;\n var lon;\n var lat;\n if (Math.abs(Ce) <= 2.623395162778) {\n var tmp = clens_cmplx(this.utg, 2 * Cn, 2 * Ce);\n Cn = Cn + tmp[0];\n Ce = Ce + tmp[1];\n Ce = Math.atan(sinh(Ce));\n var sin_Cn = Math.sin(Cn);\n var cos_Cn = Math.cos(Cn);\n var sin_Ce = Math.sin(Ce);\n var cos_Ce = Math.cos(Ce);\n Cn = Math.atan2(sin_Cn * cos_Ce, hypot(sin_Ce, cos_Ce * cos_Cn));\n Ce = Math.atan2(sin_Ce, cos_Ce * cos_Cn);\n lon = adjust_lon(Ce + this.long0);\n lat = gatg(this.cgb, Cn);\n } else {\n lon = Infinity;\n lat = Infinity;\n }\n p.x = lon;\n p.y = lat;\n return p;\n}\nexport var names = [\"Extended_Transverse_Mercator\", \"Extended Transverse Mercator\", \"etmerc\", \"Transverse_Mercator\", \"Transverse Mercator\", \"Gauss Kruger\", \"Gauss_Kruger\", \"tmerc\"];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};","import adjust_lon from './adjust_lon';\nexport default function (zone, lon) {\n if (zone === undefined) {\n zone = Math.floor((adjust_lon(lon) + Math.PI) * 30 / Math.PI) + 1;\n if (zone < 0) {\n return 0;\n } else if (zone > 60) {\n return 60;\n }\n }\n return zone;\n}","import adjust_zone from '../common/adjust_zone';\nimport etmerc from './etmerc';\nexport var dependsOn = 'etmerc';\nimport { D2R } from '../constants/values';\nexport function init() {\n var zone = adjust_zone(this.zone, this.long0);\n if (zone === undefined) {\n throw new Error('unknown utm zone');\n }\n this.lat0 = 0;\n this.long0 = (6 * Math.abs(zone) - 183) * D2R;\n this.x0 = 500000;\n this.y0 = this.utmSouth ? 10000000 : 0;\n this.k0 = 0.9996;\n etmerc.init.apply(this);\n this.forward = etmerc.forward;\n this.inverse = etmerc.inverse;\n}\nexport var names = [\"Universal Transverse Mercator System\", \"utm\"];\nexport default {\n init: init,\n names: names,\n dependsOn: dependsOn\n};","export default function (esinp, exp) {\n return Math.pow((1 - esinp) / (1 + esinp), exp);\n}","import srat from '../common/srat';\nvar MAX_ITER = 20;\nimport { HALF_PI, FORTPI } from '../constants/values';\nexport function init() {\n var sphi = Math.sin(this.lat0);\n var cphi = Math.cos(this.lat0);\n cphi *= cphi;\n this.rc = Math.sqrt(1 - this.es) / (1 - this.es * sphi * sphi);\n this.C = Math.sqrt(1 + this.es * cphi * cphi / (1 - this.es));\n this.phic0 = Math.asin(sphi / this.C);\n this.ratexp = 0.5 * this.C * this.e;\n this.K = Math.tan(0.5 * this.phic0 + FORTPI) / (Math.pow(Math.tan(0.5 * this.lat0 + FORTPI), this.C) * srat(this.e * sphi, this.ratexp));\n}\nexport function forward(p) {\n var lon = p.x;\n var lat = p.y;\n p.y = 2 * Math.atan(this.K * Math.pow(Math.tan(0.5 * lat + FORTPI), this.C) * srat(this.e * Math.sin(lat), this.ratexp)) - HALF_PI;\n p.x = this.C * lon;\n return p;\n}\nexport function inverse(p) {\n var DEL_TOL = 1e-14;\n var lon = p.x / this.C;\n var lat = p.y;\n var num = Math.pow(Math.tan(0.5 * lat + FORTPI) / this.K, 1 / this.C);\n for (var i = MAX_ITER; i > 0; --i) {\n lat = 2 * Math.atan(num * srat(this.e * Math.sin(p.y), -0.5 * this.e)) - HALF_PI;\n if (Math.abs(lat - p.y) < DEL_TOL) {\n break;\n }\n p.y = lat;\n }\n /* convergence failed */\n if (!i) {\n return null;\n }\n p.x = lon;\n p.y = lat;\n return p;\n}\nexport var names = [\"gauss\"];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};","import gauss from './gauss';\nimport adjust_lon from '../common/adjust_lon';\nimport hypot from '../common/hypot';\nexport function init() {\n gauss.init.apply(this);\n if (!this.rc) {\n return;\n }\n this.sinc0 = Math.sin(this.phic0);\n this.cosc0 = Math.cos(this.phic0);\n this.R2 = 2 * this.rc;\n if (!this.title) {\n this.title = \"Oblique Stereographic Alternative\";\n }\n}\nexport function forward(p) {\n var sinc, cosc, cosl, k;\n p.x = adjust_lon(p.x - this.long0);\n gauss.forward.apply(this, [p]);\n sinc = Math.sin(p.y);\n cosc = Math.cos(p.y);\n cosl = Math.cos(p.x);\n k = this.k0 * this.R2 / (1 + this.sinc0 * sinc + this.cosc0 * cosc * cosl);\n p.x = k * cosc * Math.sin(p.x);\n p.y = k * (this.cosc0 * sinc - this.sinc0 * cosc * cosl);\n p.x = this.a * p.x + this.x0;\n p.y = this.a * p.y + this.y0;\n return p;\n}\nexport function inverse(p) {\n var sinc, cosc, lon, lat, rho;\n p.x = (p.x - this.x0) / this.a;\n p.y = (p.y - this.y0) / this.a;\n p.x /= this.k0;\n p.y /= this.k0;\n if (rho = hypot(p.x, p.y)) {\n var c = 2 * Math.atan2(rho, this.R2);\n sinc = Math.sin(c);\n cosc = Math.cos(c);\n lat = Math.asin(cosc * this.sinc0 + p.y * sinc * this.cosc0 / rho);\n lon = Math.atan2(p.x * sinc, rho * this.cosc0 * cosc - p.y * this.sinc0 * sinc);\n } else {\n lat = this.phic0;\n lon = 0;\n }\n p.x = lon;\n p.y = lat;\n gauss.inverse.apply(this, [p]);\n p.x = adjust_lon(p.x + this.long0);\n return p;\n}\nexport var names = [\"Stereographic_North_Pole\", \"Oblique_Stereographic\", \"sterea\", \"Oblique Stereographic Alternative\", \"Double_Stereographic\"];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};","import { EPSLN, HALF_PI } from '../constants/values';\nimport sign from '../common/sign';\nimport msfnz from '../common/msfnz';\nimport tsfnz from '../common/tsfnz';\nimport phi2z from '../common/phi2z';\nimport adjust_lon from '../common/adjust_lon';\nexport function ssfn_(phit, sinphi, eccen) {\n sinphi *= eccen;\n return Math.tan(0.5 * (HALF_PI + phit)) * Math.pow((1 - sinphi) / (1 + sinphi), 0.5 * eccen);\n}\nexport function init() {\n // setting default parameters\n this.x0 = this.x0 || 0;\n this.y0 = this.y0 || 0;\n this.lat0 = this.lat0 || 0;\n this.long0 = this.long0 || 0;\n this.coslat0 = Math.cos(this.lat0);\n this.sinlat0 = Math.sin(this.lat0);\n if (this.sphere) {\n if (this.k0 === 1 && !isNaN(this.lat_ts) && Math.abs(this.coslat0) <= EPSLN) {\n this.k0 = 0.5 * (1 + sign(this.lat0) * Math.sin(this.lat_ts));\n }\n } else {\n if (Math.abs(this.coslat0) <= EPSLN) {\n if (this.lat0 > 0) {\n //North pole\n //trace('stere:north pole');\n this.con = 1;\n } else {\n //South pole\n //trace('stere:south pole');\n this.con = -1;\n }\n }\n this.cons = Math.sqrt(Math.pow(1 + this.e, 1 + this.e) * Math.pow(1 - this.e, 1 - this.e));\n if (this.k0 === 1 && !isNaN(this.lat_ts) && Math.abs(this.coslat0) <= EPSLN && Math.abs(Math.cos(this.lat_ts)) > EPSLN) {\n // When k0 is 1 (default value) and lat_ts is a vaild number and lat0 is at a pole and lat_ts is not at a pole\n // Recalculate k0 using formula 21-35 from p161 of Snyder, 1987\n this.k0 = 0.5 * this.cons * msfnz(this.e, Math.sin(this.lat_ts), Math.cos(this.lat_ts)) / tsfnz(this.e, this.con * this.lat_ts, this.con * Math.sin(this.lat_ts));\n }\n this.ms1 = msfnz(this.e, this.sinlat0, this.coslat0);\n this.X0 = 2 * Math.atan(this.ssfn_(this.lat0, this.sinlat0, this.e)) - HALF_PI;\n this.cosX0 = Math.cos(this.X0);\n this.sinX0 = Math.sin(this.X0);\n }\n}\n\n// Stereographic forward equations--mapping lat,long to x,y\nexport function forward(p) {\n var lon = p.x;\n var lat = p.y;\n var sinlat = Math.sin(lat);\n var coslat = Math.cos(lat);\n var A, X, sinX, cosX, ts, rh;\n var dlon = adjust_lon(lon - this.long0);\n if (Math.abs(Math.abs(lon - this.long0) - Math.PI) <= EPSLN && Math.abs(lat + this.lat0) <= EPSLN) {\n //case of the origine point\n //trace('stere:this is the origin point');\n p.x = NaN;\n p.y = NaN;\n return p;\n }\n if (this.sphere) {\n //trace('stere:sphere case');\n A = 2 * this.k0 / (1 + this.sinlat0 * sinlat + this.coslat0 * coslat * Math.cos(dlon));\n p.x = this.a * A * coslat * Math.sin(dlon) + this.x0;\n p.y = this.a * A * (this.coslat0 * sinlat - this.sinlat0 * coslat * Math.cos(dlon)) + this.y0;\n return p;\n } else {\n X = 2 * Math.atan(this.ssfn_(lat, sinlat, this.e)) - HALF_PI;\n cosX = Math.cos(X);\n sinX = Math.sin(X);\n if (Math.abs(this.coslat0) <= EPSLN) {\n ts = tsfnz(this.e, lat * this.con, this.con * sinlat);\n rh = 2 * this.a * this.k0 * ts / this.cons;\n p.x = this.x0 + rh * Math.sin(lon - this.long0);\n p.y = this.y0 - this.con * rh * Math.cos(lon - this.long0);\n //trace(p.toString());\n return p;\n } else if (Math.abs(this.sinlat0) < EPSLN) {\n //Eq\n //trace('stere:equateur');\n A = 2 * this.a * this.k0 / (1 + cosX * Math.cos(dlon));\n p.y = A * sinX;\n } else {\n //other case\n //trace('stere:normal case');\n A = 2 * this.a * this.k0 * this.ms1 / (this.cosX0 * (1 + this.sinX0 * sinX + this.cosX0 * cosX * Math.cos(dlon)));\n p.y = A * (this.cosX0 * sinX - this.sinX0 * cosX * Math.cos(dlon)) + this.y0;\n }\n p.x = A * cosX * Math.sin(dlon) + this.x0;\n }\n //trace(p.toString());\n return p;\n}\n\n//* Stereographic inverse equations--mapping x,y to lat/long\nexport function inverse(p) {\n p.x -= this.x0;\n p.y -= this.y0;\n var lon, lat, ts, ce, Chi;\n var rh = Math.sqrt(p.x * p.x + p.y * p.y);\n if (this.sphere) {\n var c = 2 * Math.atan(rh / (2 * this.a * this.k0));\n lon = this.long0;\n lat = this.lat0;\n if (rh <= EPSLN) {\n p.x = lon;\n p.y = lat;\n return p;\n }\n lat = Math.asin(Math.cos(c) * this.sinlat0 + p.y * Math.sin(c) * this.coslat0 / rh);\n if (Math.abs(this.coslat0) < EPSLN) {\n if (this.lat0 > 0) {\n lon = adjust_lon(this.long0 + Math.atan2(p.x, -1 * p.y));\n } else {\n lon = adjust_lon(this.long0 + Math.atan2(p.x, p.y));\n }\n } else {\n lon = adjust_lon(this.long0 + Math.atan2(p.x * Math.sin(c), rh * this.coslat0 * Math.cos(c) - p.y * this.sinlat0 * Math.sin(c)));\n }\n p.x = lon;\n p.y = lat;\n return p;\n } else {\n if (Math.abs(this.coslat0) <= EPSLN) {\n if (rh <= EPSLN) {\n lat = this.lat0;\n lon = this.long0;\n p.x = lon;\n p.y = lat;\n //trace(p.toString());\n return p;\n }\n p.x *= this.con;\n p.y *= this.con;\n ts = rh * this.cons / (2 * this.a * this.k0);\n lat = this.con * phi2z(this.e, ts);\n lon = this.con * adjust_lon(this.con * this.long0 + Math.atan2(p.x, -1 * p.y));\n } else {\n ce = 2 * Math.atan(rh * this.cosX0 / (2 * this.a * this.k0 * this.ms1));\n lon = this.long0;\n if (rh <= EPSLN) {\n Chi = this.X0;\n } else {\n Chi = Math.asin(Math.cos(ce) * this.sinX0 + p.y * Math.sin(ce) * this.cosX0 / rh);\n lon = adjust_lon(this.long0 + Math.atan2(p.x * Math.sin(ce), rh * this.cosX0 * Math.cos(ce) - p.y * this.sinX0 * Math.sin(ce)));\n }\n lat = -1 * phi2z(this.e, Math.tan(0.5 * (HALF_PI + Chi)));\n }\n }\n p.x = lon;\n p.y = lat;\n\n //trace(p.toString());\n return p;\n}\nexport var names = [\"stere\", \"Stereographic_South_Pole\", \"Polar Stereographic (variant B)\", \"Polar_Stereographic\"];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names,\n ssfn_: ssfn_\n};","/*\n references:\n Formules et constantes pour le Calcul pour la\n projection cylindrique conforme à axe oblique et pour la transformation entre\n des systèmes de référence.\n http://www.swisstopo.admin.ch/internet/swisstopo/fr/home/topics/survey/sys/refsys/switzerland.parsysrelated1.31216.downloadList.77004.DownloadFile.tmp/swissprojectionfr.pdf\n */\n\nexport function init() {\n var phy0 = this.lat0;\n this.lambda0 = this.long0;\n var sinPhy0 = Math.sin(phy0);\n var semiMajorAxis = this.a;\n var invF = this.rf;\n var flattening = 1 / invF;\n var e2 = 2 * flattening - Math.pow(flattening, 2);\n var e = this.e = Math.sqrt(e2);\n this.R = this.k0 * semiMajorAxis * Math.sqrt(1 - e2) / (1 - e2 * Math.pow(sinPhy0, 2));\n this.alpha = Math.sqrt(1 + e2 / (1 - e2) * Math.pow(Math.cos(phy0), 4));\n this.b0 = Math.asin(sinPhy0 / this.alpha);\n var k1 = Math.log(Math.tan(Math.PI / 4 + this.b0 / 2));\n var k2 = Math.log(Math.tan(Math.PI / 4 + phy0 / 2));\n var k3 = Math.log((1 + e * sinPhy0) / (1 - e * sinPhy0));\n this.K = k1 - this.alpha * k2 + this.alpha * e / 2 * k3;\n}\nexport function forward(p) {\n var Sa1 = Math.log(Math.tan(Math.PI / 4 - p.y / 2));\n var Sa2 = this.e / 2 * Math.log((1 + this.e * Math.sin(p.y)) / (1 - this.e * Math.sin(p.y)));\n var S = -this.alpha * (Sa1 + Sa2) + this.K;\n\n // spheric latitude\n var b = 2 * (Math.atan(Math.exp(S)) - Math.PI / 4);\n\n // spheric longitude\n var I = this.alpha * (p.x - this.lambda0);\n\n // psoeudo equatorial rotation\n var rotI = Math.atan(Math.sin(I) / (Math.sin(this.b0) * Math.tan(b) + Math.cos(this.b0) * Math.cos(I)));\n var rotB = Math.asin(Math.cos(this.b0) * Math.sin(b) - Math.sin(this.b0) * Math.cos(b) * Math.cos(I));\n p.y = this.R / 2 * Math.log((1 + Math.sin(rotB)) / (1 - Math.sin(rotB))) + this.y0;\n p.x = this.R * rotI + this.x0;\n return p;\n}\nexport function inverse(p) {\n var Y = p.x - this.x0;\n var X = p.y - this.y0;\n var rotI = Y / this.R;\n var rotB = 2 * (Math.atan(Math.exp(X / this.R)) - Math.PI / 4);\n var b = Math.asin(Math.cos(this.b0) * Math.sin(rotB) + Math.sin(this.b0) * Math.cos(rotB) * Math.cos(rotI));\n var I = Math.atan(Math.sin(rotI) / (Math.cos(this.b0) * Math.cos(rotI) - Math.sin(this.b0) * Math.tan(rotB)));\n var lambda = this.lambda0 + I / this.alpha;\n var S = 0;\n var phy = b;\n var prevPhy = -1000;\n var iteration = 0;\n while (Math.abs(phy - prevPhy) > 0.0000001) {\n if (++iteration > 20) {\n //...reportError(\"omercFwdInfinity\");\n return;\n }\n //S = Math.log(Math.tan(Math.PI / 4 + phy / 2));\n S = 1 / this.alpha * (Math.log(Math.tan(Math.PI / 4 + b / 2)) - this.K) + this.e * Math.log(Math.tan(Math.PI / 4 + Math.asin(this.e * Math.sin(phy)) / 2));\n prevPhy = phy;\n phy = 2 * Math.atan(Math.exp(S)) - Math.PI / 2;\n }\n p.x = lambda;\n p.y = phy;\n return p;\n}\nexport var names = [\"somerc\"];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};","import tsfnz from '../common/tsfnz';\nimport adjust_lon from '../common/adjust_lon';\nimport phi2z from '../common/phi2z';\nimport { D2R, EPSLN, HALF_PI, TWO_PI, FORTPI } from '../constants/values';\nvar TOL = 1e-7;\nfunction isTypeA(P) {\n var typeAProjections = ['Hotine_Oblique_Mercator', 'Hotine_Oblique_Mercator_Azimuth_Natural_Origin'];\n var projectionName = typeof P.PROJECTION === \"object\" ? Object.keys(P.PROJECTION)[0] : P.PROJECTION;\n return 'no_uoff' in P || 'no_off' in P || typeAProjections.indexOf(projectionName) !== -1;\n}\n\n/* Initialize the Oblique Mercator projection\n ------------------------------------------*/\nexport function init() {\n var con,\n com,\n cosph0,\n D,\n F,\n H,\n L,\n sinph0,\n p,\n J,\n gamma = 0,\n gamma0,\n lamc = 0,\n lam1 = 0,\n lam2 = 0,\n phi1 = 0,\n phi2 = 0,\n alpha_c = 0,\n AB;\n\n // only Type A uses the no_off or no_uoff property\n // https://github.com/OSGeo/proj.4/issues/104\n this.no_off = isTypeA(this);\n this.no_rot = 'no_rot' in this;\n var alp = false;\n if (\"alpha\" in this) {\n alp = true;\n }\n var gam = false;\n if (\"rectified_grid_angle\" in this) {\n gam = true;\n }\n if (alp) {\n alpha_c = this.alpha;\n }\n if (gam) {\n gamma = this.rectified_grid_angle * D2R;\n }\n if (alp || gam) {\n lamc = this.longc;\n } else {\n lam1 = this.long1;\n phi1 = this.lat1;\n lam2 = this.long2;\n phi2 = this.lat2;\n if (Math.abs(phi1 - phi2) <= TOL || (con = Math.abs(phi1)) <= TOL || Math.abs(con - HALF_PI) <= TOL || Math.abs(Math.abs(this.lat0) - HALF_PI) <= TOL || Math.abs(Math.abs(phi2) - HALF_PI) <= TOL) {\n throw new Error();\n }\n }\n var one_es = 1.0 - this.es;\n com = Math.sqrt(one_es);\n if (Math.abs(this.lat0) > EPSLN) {\n sinph0 = Math.sin(this.lat0);\n cosph0 = Math.cos(this.lat0);\n con = 1 - this.es * sinph0 * sinph0;\n this.B = cosph0 * cosph0;\n this.B = Math.sqrt(1 + this.es * this.B * this.B / one_es);\n this.A = this.B * this.k0 * com / con;\n D = this.B * com / (cosph0 * Math.sqrt(con));\n F = D * D - 1;\n if (F <= 0) {\n F = 0;\n } else {\n F = Math.sqrt(F);\n if (this.lat0 < 0) {\n F = -F;\n }\n }\n this.E = F += D;\n this.E *= Math.pow(tsfnz(this.e, this.lat0, sinph0), this.B);\n } else {\n this.B = 1 / com;\n this.A = this.k0;\n this.E = D = F = 1;\n }\n if (alp || gam) {\n if (alp) {\n gamma0 = Math.asin(Math.sin(alpha_c) / D);\n if (!gam) {\n gamma = alpha_c;\n }\n } else {\n gamma0 = gamma;\n alpha_c = Math.asin(D * Math.sin(gamma0));\n }\n this.lam0 = lamc - Math.asin(0.5 * (F - 1 / F) * Math.tan(gamma0)) / this.B;\n } else {\n H = Math.pow(tsfnz(this.e, phi1, Math.sin(phi1)), this.B);\n L = Math.pow(tsfnz(this.e, phi2, Math.sin(phi2)), this.B);\n F = this.E / H;\n p = (L - H) / (L + H);\n J = this.E * this.E;\n J = (J - L * H) / (J + L * H);\n con = lam1 - lam2;\n if (con < -Math.pi) {\n lam2 -= TWO_PI;\n } else if (con > Math.pi) {\n lam2 += TWO_PI;\n }\n this.lam0 = adjust_lon(0.5 * (lam1 + lam2) - Math.atan(J * Math.tan(0.5 * this.B * (lam1 - lam2)) / p) / this.B);\n gamma0 = Math.atan(2 * Math.sin(this.B * adjust_lon(lam1 - this.lam0)) / (F - 1 / F));\n gamma = alpha_c = Math.asin(D * Math.sin(gamma0));\n }\n this.singam = Math.sin(gamma0);\n this.cosgam = Math.cos(gamma0);\n this.sinrot = Math.sin(gamma);\n this.cosrot = Math.cos(gamma);\n this.rB = 1 / this.B;\n this.ArB = this.A * this.rB;\n this.BrA = 1 / this.ArB;\n AB = this.A * this.B;\n if (this.no_off) {\n this.u_0 = 0;\n } else {\n this.u_0 = Math.abs(this.ArB * Math.atan(Math.sqrt(D * D - 1) / Math.cos(alpha_c)));\n if (this.lat0 < 0) {\n this.u_0 = -this.u_0;\n }\n }\n F = 0.5 * gamma0;\n this.v_pole_n = this.ArB * Math.log(Math.tan(FORTPI - F));\n this.v_pole_s = this.ArB * Math.log(Math.tan(FORTPI + F));\n}\n\n/* Oblique Mercator forward equations--mapping lat,long to x,y\n ----------------------------------------------------------*/\nexport function forward(p) {\n var coords = {};\n var S, T, U, V, W, temp, u, v;\n p.x = p.x - this.lam0;\n if (Math.abs(Math.abs(p.y) - HALF_PI) > EPSLN) {\n W = this.E / Math.pow(tsfnz(this.e, p.y, Math.sin(p.y)), this.B);\n temp = 1 / W;\n S = 0.5 * (W - temp);\n T = 0.5 * (W + temp);\n V = Math.sin(this.B * p.x);\n U = (S * this.singam - V * this.cosgam) / T;\n if (Math.abs(Math.abs(U) - 1.0) < EPSLN) {\n throw new Error();\n }\n v = 0.5 * this.ArB * Math.log((1 - U) / (1 + U));\n temp = Math.cos(this.B * p.x);\n if (Math.abs(temp) < TOL) {\n u = this.A * p.x;\n } else {\n u = this.ArB * Math.atan2(S * this.cosgam + V * this.singam, temp);\n }\n } else {\n v = p.y > 0 ? this.v_pole_n : this.v_pole_s;\n u = this.ArB * p.y;\n }\n if (this.no_rot) {\n coords.x = u;\n coords.y = v;\n } else {\n u -= this.u_0;\n coords.x = v * this.cosrot + u * this.sinrot;\n coords.y = u * this.cosrot - v * this.sinrot;\n }\n coords.x = this.a * coords.x + this.x0;\n coords.y = this.a * coords.y + this.y0;\n return coords;\n}\nexport function inverse(p) {\n var u, v, Qp, Sp, Tp, Vp, Up;\n var coords = {};\n p.x = (p.x - this.x0) * (1.0 / this.a);\n p.y = (p.y - this.y0) * (1.0 / this.a);\n if (this.no_rot) {\n v = p.y;\n u = p.x;\n } else {\n v = p.x * this.cosrot - p.y * this.sinrot;\n u = p.y * this.cosrot + p.x * this.sinrot + this.u_0;\n }\n Qp = Math.exp(-this.BrA * v);\n Sp = 0.5 * (Qp - 1 / Qp);\n Tp = 0.5 * (Qp + 1 / Qp);\n Vp = Math.sin(this.BrA * u);\n Up = (Vp * this.cosgam + Sp * this.singam) / Tp;\n if (Math.abs(Math.abs(Up) - 1) < EPSLN) {\n coords.x = 0;\n coords.y = Up < 0 ? -HALF_PI : HALF_PI;\n } else {\n coords.y = this.E / Math.sqrt((1 + Up) / (1 - Up));\n coords.y = phi2z(this.e, Math.pow(coords.y, 1 / this.B));\n if (coords.y === Infinity) {\n throw new Error();\n }\n coords.x = -this.rB * Math.atan2(Sp * this.cosgam - Vp * this.singam, Math.cos(this.BrA * u));\n }\n coords.x += this.lam0;\n return coords;\n}\nexport var names = [\"Hotine_Oblique_Mercator\", \"Hotine Oblique Mercator\", \"Hotine_Oblique_Mercator_Azimuth_Natural_Origin\", \"Hotine_Oblique_Mercator_Two_Point_Natural_Origin\", \"Hotine_Oblique_Mercator_Azimuth_Center\", \"Oblique_Mercator\", \"omerc\"];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};","import msfnz from '../common/msfnz';\nimport tsfnz from '../common/tsfnz';\nimport sign from '../common/sign';\nimport adjust_lon from '../common/adjust_lon';\nimport phi2z from '../common/phi2z';\nimport { HALF_PI, EPSLN } from '../constants/values';\nexport function init() {\n //double lat0; /* the reference latitude */\n //double long0; /* the reference longitude */\n //double lat1; /* first standard parallel */\n //double lat2; /* second standard parallel */\n //double r_maj; /* major axis */\n //double r_min; /* minor axis */\n //double false_east; /* x offset in meters */\n //double false_north; /* y offset in meters */\n\n //the above value can be set with proj4.defs\n //example: proj4.defs(\"EPSG:2154\",\"+proj=lcc +lat_1=49 +lat_2=44 +lat_0=46.5 +lon_0=3 +x_0=700000 +y_0=6600000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs\");\n\n if (!this.lat2) {\n this.lat2 = this.lat1;\n } //if lat2 is not defined\n if (!this.k0) {\n this.k0 = 1;\n }\n this.x0 = this.x0 || 0;\n this.y0 = this.y0 || 0;\n // Standard Parallels cannot be equal and on opposite sides of the equator\n if (Math.abs(this.lat1 + this.lat2) < EPSLN) {\n return;\n }\n var temp = this.b / this.a;\n this.e = Math.sqrt(1 - temp * temp);\n var sin1 = Math.sin(this.lat1);\n var cos1 = Math.cos(this.lat1);\n var ms1 = msfnz(this.e, sin1, cos1);\n var ts1 = tsfnz(this.e, this.lat1, sin1);\n var sin2 = Math.sin(this.lat2);\n var cos2 = Math.cos(this.lat2);\n var ms2 = msfnz(this.e, sin2, cos2);\n var ts2 = tsfnz(this.e, this.lat2, sin2);\n var ts0 = tsfnz(this.e, this.lat0, Math.sin(this.lat0));\n if (Math.abs(this.lat1 - this.lat2) > EPSLN) {\n this.ns = Math.log(ms1 / ms2) / Math.log(ts1 / ts2);\n } else {\n this.ns = sin1;\n }\n if (isNaN(this.ns)) {\n this.ns = sin1;\n }\n this.f0 = ms1 / (this.ns * Math.pow(ts1, this.ns));\n this.rh = this.a * this.f0 * Math.pow(ts0, this.ns);\n if (!this.title) {\n this.title = \"Lambert Conformal Conic\";\n }\n}\n\n// Lambert Conformal conic forward equations--mapping lat,long to x,y\n// -----------------------------------------------------------------\nexport function forward(p) {\n var lon = p.x;\n var lat = p.y;\n\n // singular cases :\n if (Math.abs(2 * Math.abs(lat) - Math.PI) <= EPSLN) {\n lat = sign(lat) * (HALF_PI - 2 * EPSLN);\n }\n var con = Math.abs(Math.abs(lat) - HALF_PI);\n var ts, rh1;\n if (con > EPSLN) {\n ts = tsfnz(this.e, lat, Math.sin(lat));\n rh1 = this.a * this.f0 * Math.pow(ts, this.ns);\n } else {\n con = lat * this.ns;\n if (con <= 0) {\n return null;\n }\n rh1 = 0;\n }\n var theta = this.ns * adjust_lon(lon - this.long0);\n p.x = this.k0 * (rh1 * Math.sin(theta)) + this.x0;\n p.y = this.k0 * (this.rh - rh1 * Math.cos(theta)) + this.y0;\n return p;\n}\n\n// Lambert Conformal Conic inverse equations--mapping x,y to lat/long\n// -----------------------------------------------------------------\nexport function inverse(p) {\n var rh1, con, ts;\n var lat, lon;\n var x = (p.x - this.x0) / this.k0;\n var y = this.rh - (p.y - this.y0) / this.k0;\n if (this.ns > 0) {\n rh1 = Math.sqrt(x * x + y * y);\n con = 1;\n } else {\n rh1 = -Math.sqrt(x * x + y * y);\n con = -1;\n }\n var theta = 0;\n if (rh1 !== 0) {\n theta = Math.atan2(con * x, con * y);\n }\n if (rh1 !== 0 || this.ns > 0) {\n con = 1 / this.ns;\n ts = Math.pow(rh1 / (this.a * this.f0), con);\n lat = phi2z(this.e, ts);\n if (lat === -9999) {\n return null;\n }\n } else {\n lat = -HALF_PI;\n }\n lon = adjust_lon(theta / this.ns + this.long0);\n p.x = lon;\n p.y = lat;\n return p;\n}\nexport var names = [\"Lambert Tangential Conformal Conic Projection\", \"Lambert_Conformal_Conic\", \"Lambert_Conformal_Conic_1SP\", \"Lambert_Conformal_Conic_2SP\", \"lcc\", \"Lambert Conic Conformal (1SP)\", \"Lambert Conic Conformal (2SP)\"];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};","import adjust_lon from '../common/adjust_lon';\nexport function init() {\n this.a = 6377397.155;\n this.es = 0.006674372230614;\n this.e = Math.sqrt(this.es);\n if (!this.lat0) {\n this.lat0 = 0.863937979737193;\n }\n if (!this.long0) {\n this.long0 = 0.7417649320975901 - 0.308341501185665;\n }\n /* if scale not set default to 0.9999 */\n if (!this.k0) {\n this.k0 = 0.9999;\n }\n this.s45 = 0.785398163397448; /* 45 */\n this.s90 = 2 * this.s45;\n this.fi0 = this.lat0;\n this.e2 = this.es;\n this.e = Math.sqrt(this.e2);\n this.alfa = Math.sqrt(1 + this.e2 * Math.pow(Math.cos(this.fi0), 4) / (1 - this.e2));\n this.uq = 1.04216856380474;\n this.u0 = Math.asin(Math.sin(this.fi0) / this.alfa);\n this.g = Math.pow((1 + this.e * Math.sin(this.fi0)) / (1 - this.e * Math.sin(this.fi0)), this.alfa * this.e / 2);\n this.k = Math.tan(this.u0 / 2 + this.s45) / Math.pow(Math.tan(this.fi0 / 2 + this.s45), this.alfa) * this.g;\n this.k1 = this.k0;\n this.n0 = this.a * Math.sqrt(1 - this.e2) / (1 - this.e2 * Math.pow(Math.sin(this.fi0), 2));\n this.s0 = 1.37008346281555;\n this.n = Math.sin(this.s0);\n this.ro0 = this.k1 * this.n0 / Math.tan(this.s0);\n this.ad = this.s90 - this.uq;\n}\n\n/* ellipsoid */\n/* calculate xy from lat/lon */\n/* Constants, identical to inverse transform function */\nexport function forward(p) {\n var gfi, u, deltav, s, d, eps, ro;\n var lon = p.x;\n var lat = p.y;\n var delta_lon = adjust_lon(lon - this.long0);\n /* Transformation */\n gfi = Math.pow((1 + this.e * Math.sin(lat)) / (1 - this.e * Math.sin(lat)), this.alfa * this.e / 2);\n u = 2 * (Math.atan(this.k * Math.pow(Math.tan(lat / 2 + this.s45), this.alfa) / gfi) - this.s45);\n deltav = -delta_lon * this.alfa;\n s = Math.asin(Math.cos(this.ad) * Math.sin(u) + Math.sin(this.ad) * Math.cos(u) * Math.cos(deltav));\n d = Math.asin(Math.cos(u) * Math.sin(deltav) / Math.cos(s));\n eps = this.n * d;\n ro = this.ro0 * Math.pow(Math.tan(this.s0 / 2 + this.s45), this.n) / Math.pow(Math.tan(s / 2 + this.s45), this.n);\n p.y = ro * Math.cos(eps) / 1;\n p.x = ro * Math.sin(eps) / 1;\n if (!this.czech) {\n p.y *= -1;\n p.x *= -1;\n }\n return p;\n}\n\n/* calculate lat/lon from xy */\nexport function inverse(p) {\n var u, deltav, s, d, eps, ro, fi1;\n var ok;\n\n /* Transformation */\n /* revert y, x*/\n var tmp = p.x;\n p.x = p.y;\n p.y = tmp;\n if (!this.czech) {\n p.y *= -1;\n p.x *= -1;\n }\n ro = Math.sqrt(p.x * p.x + p.y * p.y);\n eps = Math.atan2(p.y, p.x);\n d = eps / Math.sin(this.s0);\n s = 2 * (Math.atan(Math.pow(this.ro0 / ro, 1 / this.n) * Math.tan(this.s0 / 2 + this.s45)) - this.s45);\n u = Math.asin(Math.cos(this.ad) * Math.sin(s) - Math.sin(this.ad) * Math.cos(s) * Math.cos(d));\n deltav = Math.asin(Math.cos(s) * Math.sin(d) / Math.cos(u));\n p.x = this.long0 - deltav / this.alfa;\n fi1 = u;\n ok = 0;\n var iter = 0;\n do {\n p.y = 2 * (Math.atan(Math.pow(this.k, -1 / this.alfa) * Math.pow(Math.tan(u / 2 + this.s45), 1 / this.alfa) * Math.pow((1 + this.e * Math.sin(fi1)) / (1 - this.e * Math.sin(fi1)), this.e / 2)) - this.s45);\n if (Math.abs(fi1 - p.y) < 0.0000000001) {\n ok = 1;\n }\n fi1 = p.y;\n iter += 1;\n } while (ok === 0 && iter < 15);\n if (iter >= 15) {\n return null;\n }\n return p;\n}\nexport var names = [\"Krovak\", \"krovak\"];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};","export default function (e0, e1, e2, e3, phi) {\n return e0 * phi - e1 * Math.sin(2 * phi) + e2 * Math.sin(4 * phi) - e3 * Math.sin(6 * phi);\n}","export default function (x) {\n return 1 - 0.25 * x * (1 + x / 16 * (3 + 1.25 * x));\n}","export default function (x) {\n return 0.375 * x * (1 + 0.25 * x * (1 + 0.46875 * x));\n}","export default function (x) {\n return 0.05859375 * x * x * (1 + 0.75 * x);\n}","export default function (x) {\n return x * x * x * (35 / 3072);\n}","export default function (a, e, sinphi) {\n var temp = e * sinphi;\n return a / Math.sqrt(1 - temp * temp);\n}","import { HALF_PI } from '../constants/values';\nimport sign from './sign';\nexport default function (x) {\n return Math.abs(x) < HALF_PI ? x : x - sign(x) * Math.PI;\n}","export default function (ml, e0, e1, e2, e3) {\n var phi;\n var dphi;\n phi = ml / e0;\n for (var i = 0; i < 15; i++) {\n dphi = (ml - (e0 * phi - e1 * Math.sin(2 * phi) + e2 * Math.sin(4 * phi) - e3 * Math.sin(6 * phi))) / (e0 - 2 * e1 * Math.cos(2 * phi) + 4 * e2 * Math.cos(4 * phi) - 6 * e3 * Math.cos(6 * phi));\n phi += dphi;\n if (Math.abs(dphi) <= 0.0000000001) {\n return phi;\n }\n }\n\n //..reportError(\"IMLFN-CONV:Latitude failed to converge after 15 iterations\");\n return NaN;\n}","import mlfn from '../common/mlfn';\nimport e0fn from '../common/e0fn';\nimport e1fn from '../common/e1fn';\nimport e2fn from '../common/e2fn';\nimport e3fn from '../common/e3fn';\nimport gN from '../common/gN';\nimport adjust_lon from '../common/adjust_lon';\nimport adjust_lat from '../common/adjust_lat';\nimport imlfn from '../common/imlfn';\nimport { HALF_PI, EPSLN } from '../constants/values';\nexport function init() {\n if (!this.sphere) {\n this.e0 = e0fn(this.es);\n this.e1 = e1fn(this.es);\n this.e2 = e2fn(this.es);\n this.e3 = e3fn(this.es);\n this.ml0 = this.a * mlfn(this.e0, this.e1, this.e2, this.e3, this.lat0);\n }\n}\n\n/* Cassini forward equations--mapping lat,long to x,y\n -----------------------------------------------------------------------*/\nexport function forward(p) {\n /* Forward equations\n -----------------*/\n var x, y;\n var lam = p.x;\n var phi = p.y;\n lam = adjust_lon(lam - this.long0);\n if (this.sphere) {\n x = this.a * Math.asin(Math.cos(phi) * Math.sin(lam));\n y = this.a * (Math.atan2(Math.tan(phi), Math.cos(lam)) - this.lat0);\n } else {\n //ellipsoid\n var sinphi = Math.sin(phi);\n var cosphi = Math.cos(phi);\n var nl = gN(this.a, this.e, sinphi);\n var tl = Math.tan(phi) * Math.tan(phi);\n var al = lam * Math.cos(phi);\n var asq = al * al;\n var cl = this.es * cosphi * cosphi / (1 - this.es);\n var ml = this.a * mlfn(this.e0, this.e1, this.e2, this.e3, phi);\n x = nl * al * (1 - asq * tl * (1 / 6 - (8 - tl + 8 * cl) * asq / 120));\n y = ml - this.ml0 + nl * sinphi / cosphi * asq * (0.5 + (5 - tl + 6 * cl) * asq / 24);\n }\n p.x = x + this.x0;\n p.y = y + this.y0;\n return p;\n}\n\n/* Inverse equations\n -----------------*/\nexport function inverse(p) {\n p.x -= this.x0;\n p.y -= this.y0;\n var x = p.x / this.a;\n var y = p.y / this.a;\n var phi, lam;\n if (this.sphere) {\n var dd = y + this.lat0;\n phi = Math.asin(Math.sin(dd) * Math.cos(x));\n lam = Math.atan2(Math.tan(x), Math.cos(dd));\n } else {\n /* ellipsoid */\n var ml1 = this.ml0 / this.a + y;\n var phi1 = imlfn(ml1, this.e0, this.e1, this.e2, this.e3);\n if (Math.abs(Math.abs(phi1) - HALF_PI) <= EPSLN) {\n p.x = this.long0;\n p.y = HALF_PI;\n if (y < 0) {\n p.y *= -1;\n }\n return p;\n }\n var nl1 = gN(this.a, this.e, Math.sin(phi1));\n var rl1 = nl1 * nl1 * nl1 / this.a / this.a * (1 - this.es);\n var tl1 = Math.pow(Math.tan(phi1), 2);\n var dl = x * this.a / nl1;\n var dsq = dl * dl;\n phi = phi1 - nl1 * Math.tan(phi1) / rl1 * dl * dl * (0.5 - (1 + 3 * tl1) * dl * dl / 24);\n lam = dl * (1 - dsq * (tl1 / 3 + (1 + 3 * tl1) * tl1 * dsq / 15)) / Math.cos(phi1);\n }\n p.x = adjust_lon(lam + this.long0);\n p.y = adjust_lat(phi);\n return p;\n}\nexport var names = [\"Cassini\", \"Cassini_Soldner\", \"cass\"];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};","export default function (eccent, sinphi) {\n var con;\n if (eccent > 1.0e-7) {\n con = eccent * sinphi;\n return (1 - eccent * eccent) * (sinphi / (1 - con * con) - 0.5 / eccent * Math.log((1 - con) / (1 + con)));\n } else {\n return 2 * sinphi;\n }\n}","import { HALF_PI, EPSLN, FORTPI } from '../constants/values';\nimport qsfnz from '../common/qsfnz';\nimport adjust_lon from '../common/adjust_lon';\n\n/*\n reference\n \"New Equal-Area Map Projections for Noncircular Regions\", John P. Snyder,\n The American Cartographer, Vol 15, No. 4, October 1988, pp. 341-355.\n */\n\nexport var S_POLE = 1;\nexport var N_POLE = 2;\nexport var EQUIT = 3;\nexport var OBLIQ = 4;\n\n/* Initialize the Lambert Azimuthal Equal Area projection\n ------------------------------------------------------*/\nexport function init() {\n var t = Math.abs(this.lat0);\n if (Math.abs(t - HALF_PI) < EPSLN) {\n this.mode = this.lat0 < 0 ? this.S_POLE : this.N_POLE;\n } else if (Math.abs(t) < EPSLN) {\n this.mode = this.EQUIT;\n } else {\n this.mode = this.OBLIQ;\n }\n if (this.es > 0) {\n var sinphi;\n this.qp = qsfnz(this.e, 1);\n this.mmf = 0.5 / (1 - this.es);\n this.apa = authset(this.es);\n switch (this.mode) {\n case this.N_POLE:\n this.dd = 1;\n break;\n case this.S_POLE:\n this.dd = 1;\n break;\n case this.EQUIT:\n this.rq = Math.sqrt(0.5 * this.qp);\n this.dd = 1 / this.rq;\n this.xmf = 1;\n this.ymf = 0.5 * this.qp;\n break;\n case this.OBLIQ:\n this.rq = Math.sqrt(0.5 * this.qp);\n sinphi = Math.sin(this.lat0);\n this.sinb1 = qsfnz(this.e, sinphi) / this.qp;\n this.cosb1 = Math.sqrt(1 - this.sinb1 * this.sinb1);\n this.dd = Math.cos(this.lat0) / (Math.sqrt(1 - this.es * sinphi * sinphi) * this.rq * this.cosb1);\n this.ymf = (this.xmf = this.rq) / this.dd;\n this.xmf *= this.dd;\n break;\n }\n } else {\n if (this.mode === this.OBLIQ) {\n this.sinph0 = Math.sin(this.lat0);\n this.cosph0 = Math.cos(this.lat0);\n }\n }\n}\n\n/* Lambert Azimuthal Equal Area forward equations--mapping lat,long to x,y\n -----------------------------------------------------------------------*/\nexport function forward(p) {\n /* Forward equations\n -----------------*/\n var x, y, coslam, sinlam, sinphi, q, sinb, cosb, b, cosphi;\n var lam = p.x;\n var phi = p.y;\n lam = adjust_lon(lam - this.long0);\n if (this.sphere) {\n sinphi = Math.sin(phi);\n cosphi = Math.cos(phi);\n coslam = Math.cos(lam);\n if (this.mode === this.OBLIQ || this.mode === this.EQUIT) {\n y = this.mode === this.EQUIT ? 1 + cosphi * coslam : 1 + this.sinph0 * sinphi + this.cosph0 * cosphi * coslam;\n if (y <= EPSLN) {\n return null;\n }\n y = Math.sqrt(2 / y);\n x = y * cosphi * Math.sin(lam);\n y *= this.mode === this.EQUIT ? sinphi : this.cosph0 * sinphi - this.sinph0 * cosphi * coslam;\n } else if (this.mode === this.N_POLE || this.mode === this.S_POLE) {\n if (this.mode === this.N_POLE) {\n coslam = -coslam;\n }\n if (Math.abs(phi + this.lat0) < EPSLN) {\n return null;\n }\n y = FORTPI - phi * 0.5;\n y = 2 * (this.mode === this.S_POLE ? Math.cos(y) : Math.sin(y));\n x = y * Math.sin(lam);\n y *= coslam;\n }\n } else {\n sinb = 0;\n cosb = 0;\n b = 0;\n coslam = Math.cos(lam);\n sinlam = Math.sin(lam);\n sinphi = Math.sin(phi);\n q = qsfnz(this.e, sinphi);\n if (this.mode === this.OBLIQ || this.mode === this.EQUIT) {\n sinb = q / this.qp;\n cosb = Math.sqrt(1 - sinb * sinb);\n }\n switch (this.mode) {\n case this.OBLIQ:\n b = 1 + this.sinb1 * sinb + this.cosb1 * cosb * coslam;\n break;\n case this.EQUIT:\n b = 1 + cosb * coslam;\n break;\n case this.N_POLE:\n b = HALF_PI + phi;\n q = this.qp - q;\n break;\n case this.S_POLE:\n b = phi - HALF_PI;\n q = this.qp + q;\n break;\n }\n if (Math.abs(b) < EPSLN) {\n return null;\n }\n switch (this.mode) {\n case this.OBLIQ:\n case this.EQUIT:\n b = Math.sqrt(2 / b);\n if (this.mode === this.OBLIQ) {\n y = this.ymf * b * (this.cosb1 * sinb - this.sinb1 * cosb * coslam);\n } else {\n y = (b = Math.sqrt(2 / (1 + cosb * coslam))) * sinb * this.ymf;\n }\n x = this.xmf * b * cosb * sinlam;\n break;\n case this.N_POLE:\n case this.S_POLE:\n if (q >= 0) {\n x = (b = Math.sqrt(q)) * sinlam;\n y = coslam * (this.mode === this.S_POLE ? b : -b);\n } else {\n x = y = 0;\n }\n break;\n }\n }\n p.x = this.a * x + this.x0;\n p.y = this.a * y + this.y0;\n return p;\n}\n\n/* Inverse equations\n -----------------*/\nexport function inverse(p) {\n p.x -= this.x0;\n p.y -= this.y0;\n var x = p.x / this.a;\n var y = p.y / this.a;\n var lam, phi, cCe, sCe, q, rho, ab;\n if (this.sphere) {\n var cosz = 0,\n rh,\n sinz = 0;\n rh = Math.sqrt(x * x + y * y);\n phi = rh * 0.5;\n if (phi > 1) {\n return null;\n }\n phi = 2 * Math.asin(phi);\n if (this.mode === this.OBLIQ || this.mode === this.EQUIT) {\n sinz = Math.sin(phi);\n cosz = Math.cos(phi);\n }\n switch (this.mode) {\n case this.EQUIT:\n phi = Math.abs(rh) <= EPSLN ? 0 : Math.asin(y * sinz / rh);\n x *= sinz;\n y = cosz * rh;\n break;\n case this.OBLIQ:\n phi = Math.abs(rh) <= EPSLN ? this.lat0 : Math.asin(cosz * this.sinph0 + y * sinz * this.cosph0 / rh);\n x *= sinz * this.cosph0;\n y = (cosz - Math.sin(phi) * this.sinph0) * rh;\n break;\n case this.N_POLE:\n y = -y;\n phi = HALF_PI - phi;\n break;\n case this.S_POLE:\n phi -= HALF_PI;\n break;\n }\n lam = y === 0 && (this.mode === this.EQUIT || this.mode === this.OBLIQ) ? 0 : Math.atan2(x, y);\n } else {\n ab = 0;\n if (this.mode === this.OBLIQ || this.mode === this.EQUIT) {\n x /= this.dd;\n y *= this.dd;\n rho = Math.sqrt(x * x + y * y);\n if (rho < EPSLN) {\n p.x = this.long0;\n p.y = this.lat0;\n return p;\n }\n sCe = 2 * Math.asin(0.5 * rho / this.rq);\n cCe = Math.cos(sCe);\n x *= sCe = Math.sin(sCe);\n if (this.mode === this.OBLIQ) {\n ab = cCe * this.sinb1 + y * sCe * this.cosb1 / rho;\n q = this.qp * ab;\n y = rho * this.cosb1 * cCe - y * this.sinb1 * sCe;\n } else {\n ab = y * sCe / rho;\n q = this.qp * ab;\n y = rho * cCe;\n }\n } else if (this.mode === this.N_POLE || this.mode === this.S_POLE) {\n if (this.mode === this.N_POLE) {\n y = -y;\n }\n q = x * x + y * y;\n if (!q) {\n p.x = this.long0;\n p.y = this.lat0;\n return p;\n }\n ab = 1 - q / this.qp;\n if (this.mode === this.S_POLE) {\n ab = -ab;\n }\n }\n lam = Math.atan2(x, y);\n phi = authlat(Math.asin(ab), this.apa);\n }\n p.x = adjust_lon(this.long0 + lam);\n p.y = phi;\n return p;\n}\n\n/* determine latitude from authalic latitude */\nvar P00 = 0.33333333333333333333;\nvar P01 = 0.17222222222222222222;\nvar P02 = 0.10257936507936507936;\nvar P10 = 0.06388888888888888888;\nvar P11 = 0.06640211640211640211;\nvar P20 = 0.01641501294219154443;\nfunction authset(es) {\n var t;\n var APA = [];\n APA[0] = es * P00;\n t = es * es;\n APA[0] += t * P01;\n APA[1] = t * P10;\n t *= es;\n APA[0] += t * P02;\n APA[1] += t * P11;\n APA[2] = t * P20;\n return APA;\n}\nfunction authlat(beta, APA) {\n var t = beta + beta;\n return beta + APA[0] * Math.sin(t) + APA[1] * Math.sin(t + t) + APA[2] * Math.sin(t + t + t);\n}\nexport var names = [\"Lambert Azimuthal Equal Area\", \"Lambert_Azimuthal_Equal_Area\", \"laea\"];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names,\n S_POLE: S_POLE,\n N_POLE: N_POLE,\n EQUIT: EQUIT,\n OBLIQ: OBLIQ\n};","export default function (x) {\n if (Math.abs(x) > 1) {\n x = x > 1 ? 1 : -1;\n }\n return Math.asin(x);\n}","import msfnz from '../common/msfnz';\nimport qsfnz from '../common/qsfnz';\nimport adjust_lon from '../common/adjust_lon';\nimport asinz from '../common/asinz';\nimport { EPSLN } from '../constants/values';\nexport function init() {\n if (Math.abs(this.lat1 + this.lat2) < EPSLN) {\n return;\n }\n this.temp = this.b / this.a;\n this.es = 1 - Math.pow(this.temp, 2);\n this.e3 = Math.sqrt(this.es);\n this.sin_po = Math.sin(this.lat1);\n this.cos_po = Math.cos(this.lat1);\n this.t1 = this.sin_po;\n this.con = this.sin_po;\n this.ms1 = msfnz(this.e3, this.sin_po, this.cos_po);\n this.qs1 = qsfnz(this.e3, this.sin_po);\n this.sin_po = Math.sin(this.lat2);\n this.cos_po = Math.cos(this.lat2);\n this.t2 = this.sin_po;\n this.ms2 = msfnz(this.e3, this.sin_po, this.cos_po);\n this.qs2 = qsfnz(this.e3, this.sin_po);\n this.sin_po = Math.sin(this.lat0);\n this.cos_po = Math.cos(this.lat0);\n this.t3 = this.sin_po;\n this.qs0 = qsfnz(this.e3, this.sin_po);\n if (Math.abs(this.lat1 - this.lat2) > EPSLN) {\n this.ns0 = (this.ms1 * this.ms1 - this.ms2 * this.ms2) / (this.qs2 - this.qs1);\n } else {\n this.ns0 = this.con;\n }\n this.c = this.ms1 * this.ms1 + this.ns0 * this.qs1;\n this.rh = this.a * Math.sqrt(this.c - this.ns0 * this.qs0) / this.ns0;\n}\n\n/* Albers Conical Equal Area forward equations--mapping lat,long to x,y\n -------------------------------------------------------------------*/\nexport function forward(p) {\n var lon = p.x;\n var lat = p.y;\n this.sin_phi = Math.sin(lat);\n this.cos_phi = Math.cos(lat);\n var qs = qsfnz(this.e3, this.sin_phi);\n var rh1 = this.a * Math.sqrt(this.c - this.ns0 * qs) / this.ns0;\n var theta = this.ns0 * adjust_lon(lon - this.long0);\n var x = rh1 * Math.sin(theta) + this.x0;\n var y = this.rh - rh1 * Math.cos(theta) + this.y0;\n p.x = x;\n p.y = y;\n return p;\n}\nexport function inverse(p) {\n var rh1, qs, con, theta, lon, lat;\n p.x -= this.x0;\n p.y = this.rh - p.y + this.y0;\n if (this.ns0 >= 0) {\n rh1 = Math.sqrt(p.x * p.x + p.y * p.y);\n con = 1;\n } else {\n rh1 = -Math.sqrt(p.x * p.x + p.y * p.y);\n con = -1;\n }\n theta = 0;\n if (rh1 !== 0) {\n theta = Math.atan2(con * p.x, con * p.y);\n }\n con = rh1 * this.ns0 / this.a;\n if (this.sphere) {\n lat = Math.asin((this.c - con * con) / (2 * this.ns0));\n } else {\n qs = (this.c - con * con) / this.ns0;\n lat = this.phi1z(this.e3, qs);\n }\n lon = adjust_lon(theta / this.ns0 + this.long0);\n p.x = lon;\n p.y = lat;\n return p;\n}\n\n/* Function to compute phi1, the latitude for the inverse of the\n Albers Conical Equal-Area projection.\n-------------------------------------------*/\nexport function phi1z(eccent, qs) {\n var sinphi, cosphi, con, com, dphi;\n var phi = asinz(0.5 * qs);\n if (eccent < EPSLN) {\n return phi;\n }\n var eccnts = eccent * eccent;\n for (var i = 1; i <= 25; i++) {\n sinphi = Math.sin(phi);\n cosphi = Math.cos(phi);\n con = eccent * sinphi;\n com = 1 - con * con;\n dphi = 0.5 * com * com / cosphi * (qs / (1 - eccnts) - sinphi / com + 0.5 / eccent * Math.log((1 - con) / (1 + con)));\n phi = phi + dphi;\n if (Math.abs(dphi) <= 1e-7) {\n return phi;\n }\n }\n return null;\n}\nexport var names = [\"Albers_Conic_Equal_Area\", \"Albers\", \"aea\"];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names,\n phi1z: phi1z\n};","import adjust_lon from '../common/adjust_lon';\nimport asinz from '../common/asinz';\nimport { EPSLN } from '../constants/values';\n\n/*\n reference:\n Wolfram Mathworld \"Gnomonic Projection\"\n http://mathworld.wolfram.com/GnomonicProjection.html\n Accessed: 12th November 2009\n */\nexport function init() {\n /* Place parameters in static storage for common use\n -------------------------------------------------*/\n this.sin_p14 = Math.sin(this.lat0);\n this.cos_p14 = Math.cos(this.lat0);\n // Approximation for projecting points to the horizon (infinity)\n this.infinity_dist = 1000 * this.a;\n this.rc = 1;\n}\n\n/* Gnomonic forward equations--mapping lat,long to x,y\n ---------------------------------------------------*/\nexport function forward(p) {\n var sinphi, cosphi; /* sin and cos value */\n var dlon; /* delta longitude value */\n var coslon; /* cos of longitude */\n var ksp; /* scale factor */\n var g;\n var x, y;\n var lon = p.x;\n var lat = p.y;\n /* Forward equations\n -----------------*/\n dlon = adjust_lon(lon - this.long0);\n sinphi = Math.sin(lat);\n cosphi = Math.cos(lat);\n coslon = Math.cos(dlon);\n g = this.sin_p14 * sinphi + this.cos_p14 * cosphi * coslon;\n ksp = 1;\n if (g > 0 || Math.abs(g) <= EPSLN) {\n x = this.x0 + this.a * ksp * cosphi * Math.sin(dlon) / g;\n y = this.y0 + this.a * ksp * (this.cos_p14 * sinphi - this.sin_p14 * cosphi * coslon) / g;\n } else {\n // Point is in the opposing hemisphere and is unprojectable\n // We still need to return a reasonable point, so we project\n // to infinity, on a bearing\n // equivalent to the northern hemisphere equivalent\n // This is a reasonable approximation for short shapes and lines that\n // straddle the horizon.\n\n x = this.x0 + this.infinity_dist * cosphi * Math.sin(dlon);\n y = this.y0 + this.infinity_dist * (this.cos_p14 * sinphi - this.sin_p14 * cosphi * coslon);\n }\n p.x = x;\n p.y = y;\n return p;\n}\nexport function inverse(p) {\n var rh; /* Rho */\n var sinc, cosc;\n var c;\n var lon, lat;\n\n /* Inverse equations\n -----------------*/\n p.x = (p.x - this.x0) / this.a;\n p.y = (p.y - this.y0) / this.a;\n p.x /= this.k0;\n p.y /= this.k0;\n if (rh = Math.sqrt(p.x * p.x + p.y * p.y)) {\n c = Math.atan2(rh, this.rc);\n sinc = Math.sin(c);\n cosc = Math.cos(c);\n lat = asinz(cosc * this.sin_p14 + p.y * sinc * this.cos_p14 / rh);\n lon = Math.atan2(p.x * sinc, rh * this.cos_p14 * cosc - p.y * this.sin_p14 * sinc);\n lon = adjust_lon(this.long0 + lon);\n } else {\n lat = this.phic0;\n lon = 0;\n }\n p.x = lon;\n p.y = lat;\n return p;\n}\nexport var names = [\"gnom\"];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};","import { HALF_PI } from '../constants/values';\nexport default function (eccent, q) {\n var temp = 1 - (1 - eccent * eccent) / (2 * eccent) * Math.log((1 - eccent) / (1 + eccent));\n if (Math.abs(Math.abs(q) - temp) < 1.0E-6) {\n if (q < 0) {\n return -1 * HALF_PI;\n } else {\n return HALF_PI;\n }\n }\n //var phi = 0.5* q/(1-eccent*eccent);\n var phi = Math.asin(0.5 * q);\n var dphi;\n var sin_phi;\n var cos_phi;\n var con;\n for (var i = 0; i < 30; i++) {\n sin_phi = Math.sin(phi);\n cos_phi = Math.cos(phi);\n con = eccent * sin_phi;\n dphi = Math.pow(1 - con * con, 2) / (2 * cos_phi) * (q / (1 - eccent * eccent) - sin_phi / (1 - con * con) + 0.5 / eccent * Math.log((1 - con) / (1 + con)));\n phi += dphi;\n if (Math.abs(dphi) <= 0.0000000001) {\n return phi;\n }\n }\n\n //console.log(\"IQSFN-CONV:Latitude failed to converge after 30 iterations\");\n return NaN;\n}","import adjust_lon from '../common/adjust_lon';\nimport qsfnz from '../common/qsfnz';\nimport msfnz from '../common/msfnz';\nimport iqsfnz from '../common/iqsfnz';\n\n/*\n reference:\n \"Cartographic Projection Procedures for the UNIX Environment-\n A User's Manual\" by Gerald I. Evenden,\n USGS Open File Report 90-284and Release 4 Interim Reports (2003)\n*/\nexport function init() {\n //no-op\n if (!this.sphere) {\n this.k0 = msfnz(this.e, Math.sin(this.lat_ts), Math.cos(this.lat_ts));\n }\n}\n\n/* Cylindrical Equal Area forward equations--mapping lat,long to x,y\n ------------------------------------------------------------*/\nexport function forward(p) {\n var lon = p.x;\n var lat = p.y;\n var x, y;\n /* Forward equations\n -----------------*/\n var dlon = adjust_lon(lon - this.long0);\n if (this.sphere) {\n x = this.x0 + this.a * dlon * Math.cos(this.lat_ts);\n y = this.y0 + this.a * Math.sin(lat) / Math.cos(this.lat_ts);\n } else {\n var qs = qsfnz(this.e, Math.sin(lat));\n x = this.x0 + this.a * this.k0 * dlon;\n y = this.y0 + this.a * qs * 0.5 / this.k0;\n }\n p.x = x;\n p.y = y;\n return p;\n}\n\n/* Cylindrical Equal Area inverse equations--mapping x,y to lat/long\n ------------------------------------------------------------*/\nexport function inverse(p) {\n p.x -= this.x0;\n p.y -= this.y0;\n var lon, lat;\n if (this.sphere) {\n lon = adjust_lon(this.long0 + p.x / this.a / Math.cos(this.lat_ts));\n lat = Math.asin(p.y / this.a * Math.cos(this.lat_ts));\n } else {\n lat = iqsfnz(this.e, 2 * p.y * this.k0 / this.a);\n lon = adjust_lon(this.long0 + p.x / (this.a * this.k0));\n }\n p.x = lon;\n p.y = lat;\n return p;\n}\nexport var names = [\"cea\"];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};","import adjust_lon from '../common/adjust_lon';\nimport adjust_lat from '../common/adjust_lat';\nexport function init() {\n this.x0 = this.x0 || 0;\n this.y0 = this.y0 || 0;\n this.lat0 = this.lat0 || 0;\n this.long0 = this.long0 || 0;\n this.lat_ts = this.lat_ts || 0;\n this.title = this.title || \"Equidistant Cylindrical (Plate Carre)\";\n this.rc = Math.cos(this.lat_ts);\n}\n\n// forward equations--mapping lat,long to x,y\n// -----------------------------------------------------------------\nexport function forward(p) {\n var lon = p.x;\n var lat = p.y;\n var dlon = adjust_lon(lon - this.long0);\n var dlat = adjust_lat(lat - this.lat0);\n p.x = this.x0 + this.a * dlon * this.rc;\n p.y = this.y0 + this.a * dlat;\n return p;\n}\n\n// inverse equations--mapping x,y to lat/long\n// -----------------------------------------------------------------\nexport function inverse(p) {\n var x = p.x;\n var y = p.y;\n p.x = adjust_lon(this.long0 + (x - this.x0) / (this.a * this.rc));\n p.y = adjust_lat(this.lat0 + (y - this.y0) / this.a);\n return p;\n}\nexport var names = [\"Equirectangular\", \"Equidistant_Cylindrical\", \"eqc\"];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};","import e0fn from '../common/e0fn';\nimport e1fn from '../common/e1fn';\nimport e2fn from '../common/e2fn';\nimport e3fn from '../common/e3fn';\nimport adjust_lon from '../common/adjust_lon';\nimport adjust_lat from '../common/adjust_lat';\nimport mlfn from '../common/mlfn';\nimport { EPSLN } from '../constants/values';\nimport gN from '../common/gN';\nvar MAX_ITER = 20;\nexport function init() {\n /* Place parameters in static storage for common use\n -------------------------------------------------*/\n this.temp = this.b / this.a;\n this.es = 1 - Math.pow(this.temp, 2); // devait etre dans tmerc.js mais n y est pas donc je commente sinon retour de valeurs nulles\n this.e = Math.sqrt(this.es);\n this.e0 = e0fn(this.es);\n this.e1 = e1fn(this.es);\n this.e2 = e2fn(this.es);\n this.e3 = e3fn(this.es);\n this.ml0 = this.a * mlfn(this.e0, this.e1, this.e2, this.e3, this.lat0); //si que des zeros le calcul ne se fait pas\n}\n\n/* Polyconic forward equations--mapping lat,long to x,y\n ---------------------------------------------------*/\nexport function forward(p) {\n var lon = p.x;\n var lat = p.y;\n var x, y, el;\n var dlon = adjust_lon(lon - this.long0);\n el = dlon * Math.sin(lat);\n if (this.sphere) {\n if (Math.abs(lat) <= EPSLN) {\n x = this.a * dlon;\n y = -1 * this.a * this.lat0;\n } else {\n x = this.a * Math.sin(el) / Math.tan(lat);\n y = this.a * (adjust_lat(lat - this.lat0) + (1 - Math.cos(el)) / Math.tan(lat));\n }\n } else {\n if (Math.abs(lat) <= EPSLN) {\n x = this.a * dlon;\n y = -1 * this.ml0;\n } else {\n var nl = gN(this.a, this.e, Math.sin(lat)) / Math.tan(lat);\n x = nl * Math.sin(el);\n y = this.a * mlfn(this.e0, this.e1, this.e2, this.e3, lat) - this.ml0 + nl * (1 - Math.cos(el));\n }\n }\n p.x = x + this.x0;\n p.y = y + this.y0;\n return p;\n}\n\n/* Inverse equations\n -----------------*/\nexport function inverse(p) {\n var lon, lat, x, y, i;\n var al, bl;\n var phi, dphi;\n x = p.x - this.x0;\n y = p.y - this.y0;\n if (this.sphere) {\n if (Math.abs(y + this.a * this.lat0) <= EPSLN) {\n lon = adjust_lon(x / this.a + this.long0);\n lat = 0;\n } else {\n al = this.lat0 + y / this.a;\n bl = x * x / this.a / this.a + al * al;\n phi = al;\n var tanphi;\n for (i = MAX_ITER; i; --i) {\n tanphi = Math.tan(phi);\n dphi = -1 * (al * (phi * tanphi + 1) - phi - 0.5 * (phi * phi + bl) * tanphi) / ((phi - al) / tanphi - 1);\n phi += dphi;\n if (Math.abs(dphi) <= EPSLN) {\n lat = phi;\n break;\n }\n }\n lon = adjust_lon(this.long0 + Math.asin(x * Math.tan(phi) / this.a) / Math.sin(lat));\n }\n } else {\n if (Math.abs(y + this.ml0) <= EPSLN) {\n lat = 0;\n lon = adjust_lon(this.long0 + x / this.a);\n } else {\n al = (this.ml0 + y) / this.a;\n bl = x * x / this.a / this.a + al * al;\n phi = al;\n var cl, mln, mlnp, ma;\n var con;\n for (i = MAX_ITER; i; --i) {\n con = this.e * Math.sin(phi);\n cl = Math.sqrt(1 - con * con) * Math.tan(phi);\n mln = this.a * mlfn(this.e0, this.e1, this.e2, this.e3, phi);\n mlnp = this.e0 - 2 * this.e1 * Math.cos(2 * phi) + 4 * this.e2 * Math.cos(4 * phi) - 6 * this.e3 * Math.cos(6 * phi);\n ma = mln / this.a;\n dphi = (al * (cl * ma + 1) - ma - 0.5 * cl * (ma * ma + bl)) / (this.es * Math.sin(2 * phi) * (ma * ma + bl - 2 * al * ma) / (4 * cl) + (al - ma) * (cl * mlnp - 2 / Math.sin(2 * phi)) - mlnp);\n phi -= dphi;\n if (Math.abs(dphi) <= EPSLN) {\n lat = phi;\n break;\n }\n }\n\n //lat=phi4z(this.e,this.e0,this.e1,this.e2,this.e3,al,bl,0,0);\n cl = Math.sqrt(1 - this.es * Math.pow(Math.sin(lat), 2)) * Math.tan(lat);\n lon = adjust_lon(this.long0 + Math.asin(x * cl / this.a) / Math.sin(lat));\n }\n }\n p.x = lon;\n p.y = lat;\n return p;\n}\nexport var names = [\"Polyconic\", \"poly\"];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};","import { SEC_TO_RAD } from '../constants/values';\n\n/*\n reference\n Department of Land and Survey Technical Circular 1973/32\n http://www.linz.govt.nz/docs/miscellaneous/nz-map-definition.pdf\n OSG Technical Report 4.1\n http://www.linz.govt.nz/docs/miscellaneous/nzmg.pdf\n */\n\n/**\n * iterations: Number of iterations to refine inverse transform.\n * 0 -> km accuracy\n * 1 -> m accuracy -- suitable for most mapping applications\n * 2 -> mm accuracy\n */\nexport var iterations = 1;\nexport function init() {\n this.A = [];\n this.A[1] = 0.6399175073;\n this.A[2] = -0.1358797613;\n this.A[3] = 0.063294409;\n this.A[4] = -0.02526853;\n this.A[5] = 0.0117879;\n this.A[6] = -0.0055161;\n this.A[7] = 0.0026906;\n this.A[8] = -0.001333;\n this.A[9] = 0.00067;\n this.A[10] = -0.00034;\n this.B_re = [];\n this.B_im = [];\n this.B_re[1] = 0.7557853228;\n this.B_im[1] = 0;\n this.B_re[2] = 0.249204646;\n this.B_im[2] = 0.003371507;\n this.B_re[3] = -0.001541739;\n this.B_im[3] = 0.041058560;\n this.B_re[4] = -0.10162907;\n this.B_im[4] = 0.01727609;\n this.B_re[5] = -0.26623489;\n this.B_im[5] = -0.36249218;\n this.B_re[6] = -0.6870983;\n this.B_im[6] = -1.1651967;\n this.C_re = [];\n this.C_im = [];\n this.C_re[1] = 1.3231270439;\n this.C_im[1] = 0;\n this.C_re[2] = -0.577245789;\n this.C_im[2] = -0.007809598;\n this.C_re[3] = 0.508307513;\n this.C_im[3] = -0.112208952;\n this.C_re[4] = -0.15094762;\n this.C_im[4] = 0.18200602;\n this.C_re[5] = 1.01418179;\n this.C_im[5] = 1.64497696;\n this.C_re[6] = 1.9660549;\n this.C_im[6] = 2.5127645;\n this.D = [];\n this.D[1] = 1.5627014243;\n this.D[2] = 0.5185406398;\n this.D[3] = -0.03333098;\n this.D[4] = -0.1052906;\n this.D[5] = -0.0368594;\n this.D[6] = 0.007317;\n this.D[7] = 0.01220;\n this.D[8] = 0.00394;\n this.D[9] = -0.0013;\n}\n\n/**\n New Zealand Map Grid Forward - long/lat to x/y\n long/lat in radians\n */\nexport function forward(p) {\n var n;\n var lon = p.x;\n var lat = p.y;\n var delta_lat = lat - this.lat0;\n var delta_lon = lon - this.long0;\n\n // 1. Calculate d_phi and d_psi ... // and d_lambda\n // For this algorithm, delta_latitude is in seconds of arc x 10-5, so we need to scale to those units. Longitude is radians.\n var d_phi = delta_lat / SEC_TO_RAD * 1E-5;\n var d_lambda = delta_lon;\n var d_phi_n = 1; // d_phi^0\n\n var d_psi = 0;\n for (n = 1; n <= 10; n++) {\n d_phi_n = d_phi_n * d_phi;\n d_psi = d_psi + this.A[n] * d_phi_n;\n }\n\n // 2. Calculate theta\n var th_re = d_psi;\n var th_im = d_lambda;\n\n // 3. Calculate z\n var th_n_re = 1;\n var th_n_im = 0; // theta^0\n var th_n_re1;\n var th_n_im1;\n var z_re = 0;\n var z_im = 0;\n for (n = 1; n <= 6; n++) {\n th_n_re1 = th_n_re * th_re - th_n_im * th_im;\n th_n_im1 = th_n_im * th_re + th_n_re * th_im;\n th_n_re = th_n_re1;\n th_n_im = th_n_im1;\n z_re = z_re + this.B_re[n] * th_n_re - this.B_im[n] * th_n_im;\n z_im = z_im + this.B_im[n] * th_n_re + this.B_re[n] * th_n_im;\n }\n\n // 4. Calculate easting and northing\n p.x = z_im * this.a + this.x0;\n p.y = z_re * this.a + this.y0;\n return p;\n}\n\n/**\n New Zealand Map Grid Inverse - x/y to long/lat\n */\nexport function inverse(p) {\n var n;\n var x = p.x;\n var y = p.y;\n var delta_x = x - this.x0;\n var delta_y = y - this.y0;\n\n // 1. Calculate z\n var z_re = delta_y / this.a;\n var z_im = delta_x / this.a;\n\n // 2a. Calculate theta - first approximation gives km accuracy\n var z_n_re = 1;\n var z_n_im = 0; // z^0\n var z_n_re1;\n var z_n_im1;\n var th_re = 0;\n var th_im = 0;\n for (n = 1; n <= 6; n++) {\n z_n_re1 = z_n_re * z_re - z_n_im * z_im;\n z_n_im1 = z_n_im * z_re + z_n_re * z_im;\n z_n_re = z_n_re1;\n z_n_im = z_n_im1;\n th_re = th_re + this.C_re[n] * z_n_re - this.C_im[n] * z_n_im;\n th_im = th_im + this.C_im[n] * z_n_re + this.C_re[n] * z_n_im;\n }\n\n // 2b. Iterate to refine the accuracy of the calculation\n // 0 iterations gives km accuracy\n // 1 iteration gives m accuracy -- good enough for most mapping applications\n // 2 iterations bives mm accuracy\n for (var i = 0; i < this.iterations; i++) {\n var th_n_re = th_re;\n var th_n_im = th_im;\n var th_n_re1;\n var th_n_im1;\n var num_re = z_re;\n var num_im = z_im;\n for (n = 2; n <= 6; n++) {\n th_n_re1 = th_n_re * th_re - th_n_im * th_im;\n th_n_im1 = th_n_im * th_re + th_n_re * th_im;\n th_n_re = th_n_re1;\n th_n_im = th_n_im1;\n num_re = num_re + (n - 1) * (this.B_re[n] * th_n_re - this.B_im[n] * th_n_im);\n num_im = num_im + (n - 1) * (this.B_im[n] * th_n_re + this.B_re[n] * th_n_im);\n }\n th_n_re = 1;\n th_n_im = 0;\n var den_re = this.B_re[1];\n var den_im = this.B_im[1];\n for (n = 2; n <= 6; n++) {\n th_n_re1 = th_n_re * th_re - th_n_im * th_im;\n th_n_im1 = th_n_im * th_re + th_n_re * th_im;\n th_n_re = th_n_re1;\n th_n_im = th_n_im1;\n den_re = den_re + n * (this.B_re[n] * th_n_re - this.B_im[n] * th_n_im);\n den_im = den_im + n * (this.B_im[n] * th_n_re + this.B_re[n] * th_n_im);\n }\n\n // Complex division\n var den2 = den_re * den_re + den_im * den_im;\n th_re = (num_re * den_re + num_im * den_im) / den2;\n th_im = (num_im * den_re - num_re * den_im) / den2;\n }\n\n // 3. Calculate d_phi ... // and d_lambda\n var d_psi = th_re;\n var d_lambda = th_im;\n var d_psi_n = 1; // d_psi^0\n\n var d_phi = 0;\n for (n = 1; n <= 9; n++) {\n d_psi_n = d_psi_n * d_psi;\n d_phi = d_phi + this.D[n] * d_psi_n;\n }\n\n // 4. Calculate latitude and longitude\n // d_phi is calcuated in second of arc * 10^-5, so we need to scale back to radians. d_lambda is in radians.\n var lat = this.lat0 + d_phi * SEC_TO_RAD * 1E5;\n var lon = this.long0 + d_lambda;\n p.x = lon;\n p.y = lat;\n return p;\n}\nexport var names = [\"New_Zealand_Map_Grid\", \"nzmg\"];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};","import adjust_lon from '../common/adjust_lon';\n\n/*\n reference\n \"New Equal-Area Map Projections for Noncircular Regions\", John P. Snyder,\n The American Cartographer, Vol 15, No. 4, October 1988, pp. 341-355.\n */\n\n/* Initialize the Miller Cylindrical projection\n -------------------------------------------*/\nexport function init() {\n //no-op\n}\n\n/* Miller Cylindrical forward equations--mapping lat,long to x,y\n ------------------------------------------------------------*/\nexport function forward(p) {\n var lon = p.x;\n var lat = p.y;\n /* Forward equations\n -----------------*/\n var dlon = adjust_lon(lon - this.long0);\n var x = this.x0 + this.a * dlon;\n var y = this.y0 + this.a * Math.log(Math.tan(Math.PI / 4 + lat / 2.5)) * 1.25;\n p.x = x;\n p.y = y;\n return p;\n}\n\n/* Miller Cylindrical inverse equations--mapping x,y to lat/long\n ------------------------------------------------------------*/\nexport function inverse(p) {\n p.x -= this.x0;\n p.y -= this.y0;\n var lon = adjust_lon(this.long0 + p.x / this.a);\n var lat = 2.5 * (Math.atan(Math.exp(0.8 * p.y / this.a)) - Math.PI / 4);\n p.x = lon;\n p.y = lat;\n return p;\n}\nexport var names = [\"Miller_Cylindrical\", \"mill\"];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};","import adjust_lon from '../common/adjust_lon';\nimport adjust_lat from '../common/adjust_lat';\nimport pj_enfn from '../common/pj_enfn';\nvar MAX_ITER = 20;\nimport pj_mlfn from '../common/pj_mlfn';\nimport pj_inv_mlfn from '../common/pj_inv_mlfn';\nimport { EPSLN, HALF_PI } from '../constants/values';\nimport asinz from '../common/asinz';\nexport function init() {\n /* Place parameters in static storage for common use\n -------------------------------------------------*/\n\n if (!this.sphere) {\n this.en = pj_enfn(this.es);\n } else {\n this.n = 1;\n this.m = 0;\n this.es = 0;\n this.C_y = Math.sqrt((this.m + 1) / this.n);\n this.C_x = this.C_y / (this.m + 1);\n }\n}\n\n/* Sinusoidal forward equations--mapping lat,long to x,y\n -----------------------------------------------------*/\nexport function forward(p) {\n var x, y;\n var lon = p.x;\n var lat = p.y;\n /* Forward equations\n -----------------*/\n lon = adjust_lon(lon - this.long0);\n if (this.sphere) {\n if (!this.m) {\n lat = this.n !== 1 ? Math.asin(this.n * Math.sin(lat)) : lat;\n } else {\n var k = this.n * Math.sin(lat);\n for (var i = MAX_ITER; i; --i) {\n var V = (this.m * lat + Math.sin(lat) - k) / (this.m + Math.cos(lat));\n lat -= V;\n if (Math.abs(V) < EPSLN) {\n break;\n }\n }\n }\n x = this.a * this.C_x * lon * (this.m + Math.cos(lat));\n y = this.a * this.C_y * lat;\n } else {\n var s = Math.sin(lat);\n var c = Math.cos(lat);\n y = this.a * pj_mlfn(lat, s, c, this.en);\n x = this.a * lon * c / Math.sqrt(1 - this.es * s * s);\n }\n p.x = x;\n p.y = y;\n return p;\n}\nexport function inverse(p) {\n var lat, temp, lon, s;\n p.x -= this.x0;\n lon = p.x / this.a;\n p.y -= this.y0;\n lat = p.y / this.a;\n if (this.sphere) {\n lat /= this.C_y;\n lon = lon / (this.C_x * (this.m + Math.cos(lat)));\n if (this.m) {\n lat = asinz((this.m * lat + Math.sin(lat)) / this.n);\n } else if (this.n !== 1) {\n lat = asinz(Math.sin(lat) / this.n);\n }\n lon = adjust_lon(lon + this.long0);\n lat = adjust_lat(lat);\n } else {\n lat = pj_inv_mlfn(p.y / this.a, this.es, this.en);\n s = Math.abs(lat);\n if (s < HALF_PI) {\n s = Math.sin(lat);\n temp = this.long0 + p.x * Math.sqrt(1 - this.es * s * s) / (this.a * Math.cos(lat));\n //temp = this.long0 + p.x / (this.a * Math.cos(lat));\n lon = adjust_lon(temp);\n } else if (s - EPSLN < HALF_PI) {\n lon = this.long0;\n }\n }\n p.x = lon;\n p.y = lat;\n return p;\n}\nexport var names = [\"Sinusoidal\", \"sinu\"];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};","import adjust_lon from '../common/adjust_lon';\nexport function init() {}\nimport { EPSLN } from '../constants/values';\n/* Mollweide forward equations--mapping lat,long to x,y\n ----------------------------------------------------*/\nexport function forward(p) {\n /* Forward equations\n -----------------*/\n var lon = p.x;\n var lat = p.y;\n var delta_lon = adjust_lon(lon - this.long0);\n var theta = lat;\n var con = Math.PI * Math.sin(lat);\n\n /* Iterate using the Newton-Raphson method to find theta\n -----------------------------------------------------*/\n while (true) {\n var delta_theta = -(theta + Math.sin(theta) - con) / (1 + Math.cos(theta));\n theta += delta_theta;\n if (Math.abs(delta_theta) < EPSLN) {\n break;\n }\n }\n theta /= 2;\n\n /* If the latitude is 90 deg, force the x coordinate to be \"0 + false easting\"\n this is done here because of precision problems with \"cos(theta)\"\n --------------------------------------------------------------------------*/\n if (Math.PI / 2 - Math.abs(lat) < EPSLN) {\n delta_lon = 0;\n }\n var x = 0.900316316158 * this.a * delta_lon * Math.cos(theta) + this.x0;\n var y = 1.4142135623731 * this.a * Math.sin(theta) + this.y0;\n p.x = x;\n p.y = y;\n return p;\n}\nexport function inverse(p) {\n var theta;\n var arg;\n\n /* Inverse equations\n -----------------*/\n p.x -= this.x0;\n p.y -= this.y0;\n arg = p.y / (1.4142135623731 * this.a);\n\n /* Because of division by zero problems, 'arg' can not be 1. Therefore\n a number very close to one is used instead.\n -------------------------------------------------------------------*/\n if (Math.abs(arg) > 0.999999999999) {\n arg = 0.999999999999;\n }\n theta = Math.asin(arg);\n var lon = adjust_lon(this.long0 + p.x / (0.900316316158 * this.a * Math.cos(theta)));\n if (lon < -Math.PI) {\n lon = -Math.PI;\n }\n if (lon > Math.PI) {\n lon = Math.PI;\n }\n arg = (2 * theta + Math.sin(2 * theta)) / Math.PI;\n if (Math.abs(arg) > 1) {\n arg = 1;\n }\n var lat = Math.asin(arg);\n p.x = lon;\n p.y = lat;\n return p;\n}\nexport var names = [\"Mollweide\", \"moll\"];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};","import e0fn from '../common/e0fn';\nimport e1fn from '../common/e1fn';\nimport e2fn from '../common/e2fn';\nimport e3fn from '../common/e3fn';\nimport msfnz from '../common/msfnz';\nimport mlfn from '../common/mlfn';\nimport adjust_lon from '../common/adjust_lon';\nimport adjust_lat from '../common/adjust_lat';\nimport imlfn from '../common/imlfn';\nimport { EPSLN } from '../constants/values';\nexport function init() {\n /* Place parameters in static storage for common use\n -------------------------------------------------*/\n // Standard Parallels cannot be equal and on opposite sides of the equator\n if (Math.abs(this.lat1 + this.lat2) < EPSLN) {\n return;\n }\n this.lat2 = this.lat2 || this.lat1;\n this.temp = this.b / this.a;\n this.es = 1 - Math.pow(this.temp, 2);\n this.e = Math.sqrt(this.es);\n this.e0 = e0fn(this.es);\n this.e1 = e1fn(this.es);\n this.e2 = e2fn(this.es);\n this.e3 = e3fn(this.es);\n this.sinphi = Math.sin(this.lat1);\n this.cosphi = Math.cos(this.lat1);\n this.ms1 = msfnz(this.e, this.sinphi, this.cosphi);\n this.ml1 = mlfn(this.e0, this.e1, this.e2, this.e3, this.lat1);\n if (Math.abs(this.lat1 - this.lat2) < EPSLN) {\n this.ns = this.sinphi;\n } else {\n this.sinphi = Math.sin(this.lat2);\n this.cosphi = Math.cos(this.lat2);\n this.ms2 = msfnz(this.e, this.sinphi, this.cosphi);\n this.ml2 = mlfn(this.e0, this.e1, this.e2, this.e3, this.lat2);\n this.ns = (this.ms1 - this.ms2) / (this.ml2 - this.ml1);\n }\n this.g = this.ml1 + this.ms1 / this.ns;\n this.ml0 = mlfn(this.e0, this.e1, this.e2, this.e3, this.lat0);\n this.rh = this.a * (this.g - this.ml0);\n}\n\n/* Equidistant Conic forward equations--mapping lat,long to x,y\n -----------------------------------------------------------*/\nexport function forward(p) {\n var lon = p.x;\n var lat = p.y;\n var rh1;\n\n /* Forward equations\n -----------------*/\n if (this.sphere) {\n rh1 = this.a * (this.g - lat);\n } else {\n var ml = mlfn(this.e0, this.e1, this.e2, this.e3, lat);\n rh1 = this.a * (this.g - ml);\n }\n var theta = this.ns * adjust_lon(lon - this.long0);\n var x = this.x0 + rh1 * Math.sin(theta);\n var y = this.y0 + this.rh - rh1 * Math.cos(theta);\n p.x = x;\n p.y = y;\n return p;\n}\n\n/* Inverse equations\n -----------------*/\nexport function inverse(p) {\n p.x -= this.x0;\n p.y = this.rh - p.y + this.y0;\n var con, rh1, lat, lon;\n if (this.ns >= 0) {\n rh1 = Math.sqrt(p.x * p.x + p.y * p.y);\n con = 1;\n } else {\n rh1 = -Math.sqrt(p.x * p.x + p.y * p.y);\n con = -1;\n }\n var theta = 0;\n if (rh1 !== 0) {\n theta = Math.atan2(con * p.x, con * p.y);\n }\n if (this.sphere) {\n lon = adjust_lon(this.long0 + theta / this.ns);\n lat = adjust_lat(this.g - rh1 / this.a);\n p.x = lon;\n p.y = lat;\n return p;\n } else {\n var ml = this.g - rh1 / this.a;\n lat = imlfn(ml, this.e0, this.e1, this.e2, this.e3);\n lon = adjust_lon(this.long0 + theta / this.ns);\n p.x = lon;\n p.y = lat;\n return p;\n }\n}\nexport var names = [\"Equidistant_Conic\", \"eqdc\"];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};","import adjust_lon from '../common/adjust_lon';\nimport { HALF_PI, EPSLN } from '../constants/values';\nimport asinz from '../common/asinz';\n\n/* Initialize the Van Der Grinten projection\n ----------------------------------------*/\nexport function init() {\n //this.R = 6370997; //Radius of earth\n this.R = this.a;\n}\nexport function forward(p) {\n var lon = p.x;\n var lat = p.y;\n\n /* Forward equations\n -----------------*/\n var dlon = adjust_lon(lon - this.long0);\n var x, y;\n if (Math.abs(lat) <= EPSLN) {\n x = this.x0 + this.R * dlon;\n y = this.y0;\n }\n var theta = asinz(2 * Math.abs(lat / Math.PI));\n if (Math.abs(dlon) <= EPSLN || Math.abs(Math.abs(lat) - HALF_PI) <= EPSLN) {\n x = this.x0;\n if (lat >= 0) {\n y = this.y0 + Math.PI * this.R * Math.tan(0.5 * theta);\n } else {\n y = this.y0 + Math.PI * this.R * -Math.tan(0.5 * theta);\n }\n // return(OK);\n }\n var al = 0.5 * Math.abs(Math.PI / dlon - dlon / Math.PI);\n var asq = al * al;\n var sinth = Math.sin(theta);\n var costh = Math.cos(theta);\n var g = costh / (sinth + costh - 1);\n var gsq = g * g;\n var m = g * (2 / sinth - 1);\n var msq = m * m;\n var con = Math.PI * this.R * (al * (g - msq) + Math.sqrt(asq * (g - msq) * (g - msq) - (msq + asq) * (gsq - msq))) / (msq + asq);\n if (dlon < 0) {\n con = -con;\n }\n x = this.x0 + con;\n //con = Math.abs(con / (Math.PI * this.R));\n var q = asq + g;\n con = Math.PI * this.R * (m * q - al * Math.sqrt((msq + asq) * (asq + 1) - q * q)) / (msq + asq);\n if (lat >= 0) {\n //y = this.y0 + Math.PI * this.R * Math.sqrt(1 - con * con - 2 * al * con);\n y = this.y0 + con;\n } else {\n //y = this.y0 - Math.PI * this.R * Math.sqrt(1 - con * con - 2 * al * con);\n y = this.y0 - con;\n }\n p.x = x;\n p.y = y;\n return p;\n}\n\n/* Van Der Grinten inverse equations--mapping x,y to lat/long\n ---------------------------------------------------------*/\nexport function inverse(p) {\n var lon, lat;\n var xx, yy, xys, c1, c2, c3;\n var a1;\n var m1;\n var con;\n var th1;\n var d;\n\n /* inverse equations\n -----------------*/\n p.x -= this.x0;\n p.y -= this.y0;\n con = Math.PI * this.R;\n xx = p.x / con;\n yy = p.y / con;\n xys = xx * xx + yy * yy;\n c1 = -Math.abs(yy) * (1 + xys);\n c2 = c1 - 2 * yy * yy + xx * xx;\n c3 = -2 * c1 + 1 + 2 * yy * yy + xys * xys;\n d = yy * yy / c3 + (2 * c2 * c2 * c2 / c3 / c3 / c3 - 9 * c1 * c2 / c3 / c3) / 27;\n a1 = (c1 - c2 * c2 / 3 / c3) / c3;\n m1 = 2 * Math.sqrt(-a1 / 3);\n con = 3 * d / a1 / m1;\n if (Math.abs(con) > 1) {\n if (con >= 0) {\n con = 1;\n } else {\n con = -1;\n }\n }\n th1 = Math.acos(con) / 3;\n if (p.y >= 0) {\n lat = (-m1 * Math.cos(th1 + Math.PI / 3) - c2 / 3 / c3) * Math.PI;\n } else {\n lat = -(-m1 * Math.cos(th1 + Math.PI / 3) - c2 / 3 / c3) * Math.PI;\n }\n if (Math.abs(xx) < EPSLN) {\n lon = this.long0;\n } else {\n lon = adjust_lon(this.long0 + Math.PI * (xys - 1 + Math.sqrt(1 + 2 * (xx * xx - yy * yy) + xys * xys)) / 2 / xx);\n }\n p.x = lon;\n p.y = lat;\n return p;\n}\nexport var names = [\"Van_der_Grinten_I\", \"VanDerGrinten\", \"vandg\"];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};","import adjust_lon from '../common/adjust_lon';\nimport { HALF_PI, EPSLN } from '../constants/values';\nimport mlfn from '../common/mlfn';\nimport e0fn from '../common/e0fn';\nimport e1fn from '../common/e1fn';\nimport e2fn from '../common/e2fn';\nimport e3fn from '../common/e3fn';\nimport gN from '../common/gN';\nimport asinz from '../common/asinz';\nimport imlfn from '../common/imlfn';\nexport function init() {\n this.sin_p12 = Math.sin(this.lat0);\n this.cos_p12 = Math.cos(this.lat0);\n}\nexport function forward(p) {\n var lon = p.x;\n var lat = p.y;\n var sinphi = Math.sin(p.y);\n var cosphi = Math.cos(p.y);\n var dlon = adjust_lon(lon - this.long0);\n var e0, e1, e2, e3, Mlp, Ml, tanphi, Nl1, Nl, psi, Az, G, H, GH, Hs, c, kp, cos_c, s, s2, s3, s4, s5;\n if (this.sphere) {\n if (Math.abs(this.sin_p12 - 1) <= EPSLN) {\n //North Pole case\n p.x = this.x0 + this.a * (HALF_PI - lat) * Math.sin(dlon);\n p.y = this.y0 - this.a * (HALF_PI - lat) * Math.cos(dlon);\n return p;\n } else if (Math.abs(this.sin_p12 + 1) <= EPSLN) {\n //South Pole case\n p.x = this.x0 + this.a * (HALF_PI + lat) * Math.sin(dlon);\n p.y = this.y0 + this.a * (HALF_PI + lat) * Math.cos(dlon);\n return p;\n } else {\n //default case\n cos_c = this.sin_p12 * sinphi + this.cos_p12 * cosphi * Math.cos(dlon);\n c = Math.acos(cos_c);\n kp = c ? c / Math.sin(c) : 1;\n p.x = this.x0 + this.a * kp * cosphi * Math.sin(dlon);\n p.y = this.y0 + this.a * kp * (this.cos_p12 * sinphi - this.sin_p12 * cosphi * Math.cos(dlon));\n return p;\n }\n } else {\n e0 = e0fn(this.es);\n e1 = e1fn(this.es);\n e2 = e2fn(this.es);\n e3 = e3fn(this.es);\n if (Math.abs(this.sin_p12 - 1) <= EPSLN) {\n //North Pole case\n Mlp = this.a * mlfn(e0, e1, e2, e3, HALF_PI);\n Ml = this.a * mlfn(e0, e1, e2, e3, lat);\n p.x = this.x0 + (Mlp - Ml) * Math.sin(dlon);\n p.y = this.y0 - (Mlp - Ml) * Math.cos(dlon);\n return p;\n } else if (Math.abs(this.sin_p12 + 1) <= EPSLN) {\n //South Pole case\n Mlp = this.a * mlfn(e0, e1, e2, e3, HALF_PI);\n Ml = this.a * mlfn(e0, e1, e2, e3, lat);\n p.x = this.x0 + (Mlp + Ml) * Math.sin(dlon);\n p.y = this.y0 + (Mlp + Ml) * Math.cos(dlon);\n return p;\n } else {\n //Default case\n tanphi = sinphi / cosphi;\n Nl1 = gN(this.a, this.e, this.sin_p12);\n Nl = gN(this.a, this.e, sinphi);\n psi = Math.atan((1 - this.es) * tanphi + this.es * Nl1 * this.sin_p12 / (Nl * cosphi));\n Az = Math.atan2(Math.sin(dlon), this.cos_p12 * Math.tan(psi) - this.sin_p12 * Math.cos(dlon));\n if (Az === 0) {\n s = Math.asin(this.cos_p12 * Math.sin(psi) - this.sin_p12 * Math.cos(psi));\n } else if (Math.abs(Math.abs(Az) - Math.PI) <= EPSLN) {\n s = -Math.asin(this.cos_p12 * Math.sin(psi) - this.sin_p12 * Math.cos(psi));\n } else {\n s = Math.asin(Math.sin(dlon) * Math.cos(psi) / Math.sin(Az));\n }\n G = this.e * this.sin_p12 / Math.sqrt(1 - this.es);\n H = this.e * this.cos_p12 * Math.cos(Az) / Math.sqrt(1 - this.es);\n GH = G * H;\n Hs = H * H;\n s2 = s * s;\n s3 = s2 * s;\n s4 = s3 * s;\n s5 = s4 * s;\n c = Nl1 * s * (1 - s2 * Hs * (1 - Hs) / 6 + s3 / 8 * GH * (1 - 2 * Hs) + s4 / 120 * (Hs * (4 - 7 * Hs) - 3 * G * G * (1 - 7 * Hs)) - s5 / 48 * GH);\n p.x = this.x0 + c * Math.sin(Az);\n p.y = this.y0 + c * Math.cos(Az);\n return p;\n }\n }\n}\nexport function inverse(p) {\n p.x -= this.x0;\n p.y -= this.y0;\n var rh, z, sinz, cosz, lon, lat, con, e0, e1, e2, e3, Mlp, M, N1, psi, Az, cosAz, tmp, A, B, D, Ee, F, sinpsi;\n if (this.sphere) {\n rh = Math.sqrt(p.x * p.x + p.y * p.y);\n if (rh > 2 * HALF_PI * this.a) {\n return;\n }\n z = rh / this.a;\n sinz = Math.sin(z);\n cosz = Math.cos(z);\n lon = this.long0;\n if (Math.abs(rh) <= EPSLN) {\n lat = this.lat0;\n } else {\n lat = asinz(cosz * this.sin_p12 + p.y * sinz * this.cos_p12 / rh);\n con = Math.abs(this.lat0) - HALF_PI;\n if (Math.abs(con) <= EPSLN) {\n if (this.lat0 >= 0) {\n lon = adjust_lon(this.long0 + Math.atan2(p.x, -p.y));\n } else {\n lon = adjust_lon(this.long0 - Math.atan2(-p.x, p.y));\n }\n } else {\n /*con = cosz - this.sin_p12 * Math.sin(lat);\n if ((Math.abs(con) < EPSLN) && (Math.abs(p.x) < EPSLN)) {\n //no-op, just keep the lon value as is\n } else {\n var temp = Math.atan2((p.x * sinz * this.cos_p12), (con * rh));\n lon = adjust_lon(this.long0 + Math.atan2((p.x * sinz * this.cos_p12), (con * rh)));\n }*/\n lon = adjust_lon(this.long0 + Math.atan2(p.x * sinz, rh * this.cos_p12 * cosz - p.y * this.sin_p12 * sinz));\n }\n }\n p.x = lon;\n p.y = lat;\n return p;\n } else {\n e0 = e0fn(this.es);\n e1 = e1fn(this.es);\n e2 = e2fn(this.es);\n e3 = e3fn(this.es);\n if (Math.abs(this.sin_p12 - 1) <= EPSLN) {\n //North pole case\n Mlp = this.a * mlfn(e0, e1, e2, e3, HALF_PI);\n rh = Math.sqrt(p.x * p.x + p.y * p.y);\n M = Mlp - rh;\n lat = imlfn(M / this.a, e0, e1, e2, e3);\n lon = adjust_lon(this.long0 + Math.atan2(p.x, -1 * p.y));\n p.x = lon;\n p.y = lat;\n return p;\n } else if (Math.abs(this.sin_p12 + 1) <= EPSLN) {\n //South pole case\n Mlp = this.a * mlfn(e0, e1, e2, e3, HALF_PI);\n rh = Math.sqrt(p.x * p.x + p.y * p.y);\n M = rh - Mlp;\n lat = imlfn(M / this.a, e0, e1, e2, e3);\n lon = adjust_lon(this.long0 + Math.atan2(p.x, p.y));\n p.x = lon;\n p.y = lat;\n return p;\n } else {\n //default case\n rh = Math.sqrt(p.x * p.x + p.y * p.y);\n Az = Math.atan2(p.x, p.y);\n N1 = gN(this.a, this.e, this.sin_p12);\n cosAz = Math.cos(Az);\n tmp = this.e * this.cos_p12 * cosAz;\n A = -tmp * tmp / (1 - this.es);\n B = 3 * this.es * (1 - A) * this.sin_p12 * this.cos_p12 * cosAz / (1 - this.es);\n D = rh / N1;\n Ee = D - A * (1 + A) * Math.pow(D, 3) / 6 - B * (1 + 3 * A) * Math.pow(D, 4) / 24;\n F = 1 - A * Ee * Ee / 2 - D * Ee * Ee * Ee / 6;\n psi = Math.asin(this.sin_p12 * Math.cos(Ee) + this.cos_p12 * Math.sin(Ee) * cosAz);\n lon = adjust_lon(this.long0 + Math.asin(Math.sin(Az) * Math.sin(Ee) / Math.cos(psi)));\n sinpsi = Math.sin(psi);\n lat = Math.atan2((sinpsi - this.es * F * this.sin_p12) * Math.tan(psi), sinpsi * (1 - this.es));\n p.x = lon;\n p.y = lat;\n return p;\n }\n }\n}\nexport var names = [\"Azimuthal_Equidistant\", \"aeqd\"];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};","import adjust_lon from '../common/adjust_lon';\nimport asinz from '../common/asinz';\nimport { EPSLN, HALF_PI } from '../constants/values';\nexport function init() {\n //double temp; /* temporary variable */\n\n /* Place parameters in static storage for common use\n -------------------------------------------------*/\n this.sin_p14 = Math.sin(this.lat0);\n this.cos_p14 = Math.cos(this.lat0);\n}\n\n/* Orthographic forward equations--mapping lat,long to x,y\n ---------------------------------------------------*/\nexport function forward(p) {\n var sinphi, cosphi; /* sin and cos value */\n var dlon; /* delta longitude value */\n var coslon; /* cos of longitude */\n var ksp; /* scale factor */\n var g, x, y;\n var lon = p.x;\n var lat = p.y;\n /* Forward equations\n -----------------*/\n dlon = adjust_lon(lon - this.long0);\n sinphi = Math.sin(lat);\n cosphi = Math.cos(lat);\n coslon = Math.cos(dlon);\n g = this.sin_p14 * sinphi + this.cos_p14 * cosphi * coslon;\n ksp = 1;\n if (g > 0 || Math.abs(g) <= EPSLN) {\n x = this.a * ksp * cosphi * Math.sin(dlon);\n y = this.y0 + this.a * ksp * (this.cos_p14 * sinphi - this.sin_p14 * cosphi * coslon);\n }\n p.x = x;\n p.y = y;\n return p;\n}\nexport function inverse(p) {\n var rh; /* height above ellipsoid */\n var z; /* angle */\n var sinz, cosz; /* sin of z and cos of z */\n var con;\n var lon, lat;\n /* Inverse equations\n -----------------*/\n p.x -= this.x0;\n p.y -= this.y0;\n rh = Math.sqrt(p.x * p.x + p.y * p.y);\n z = asinz(rh / this.a);\n sinz = Math.sin(z);\n cosz = Math.cos(z);\n lon = this.long0;\n if (Math.abs(rh) <= EPSLN) {\n lat = this.lat0;\n p.x = lon;\n p.y = lat;\n return p;\n }\n lat = asinz(cosz * this.sin_p14 + p.y * sinz * this.cos_p14 / rh);\n con = Math.abs(this.lat0) - HALF_PI;\n if (Math.abs(con) <= EPSLN) {\n if (this.lat0 >= 0) {\n lon = adjust_lon(this.long0 + Math.atan2(p.x, -p.y));\n } else {\n lon = adjust_lon(this.long0 - Math.atan2(-p.x, p.y));\n }\n p.x = lon;\n p.y = lat;\n return p;\n }\n lon = adjust_lon(this.long0 + Math.atan2(p.x * sinz, rh * this.cos_p14 * cosz - p.y * this.sin_p14 * sinz));\n p.x = lon;\n p.y = lat;\n return p;\n}\nexport var names = [\"ortho\"];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};","// QSC projection rewritten from the original PROJ4\n// https://github.com/OSGeo/proj.4/blob/master/src/PJ_qsc.c\n\nimport { EPSLN, TWO_PI, SPI, HALF_PI, FORTPI } from '../constants/values';\n\n/* constants */\nvar FACE_ENUM = {\n FRONT: 1,\n RIGHT: 2,\n BACK: 3,\n LEFT: 4,\n TOP: 5,\n BOTTOM: 6\n};\nvar AREA_ENUM = {\n AREA_0: 1,\n AREA_1: 2,\n AREA_2: 3,\n AREA_3: 4\n};\nexport function init() {\n this.x0 = this.x0 || 0;\n this.y0 = this.y0 || 0;\n this.lat0 = this.lat0 || 0;\n this.long0 = this.long0 || 0;\n this.lat_ts = this.lat_ts || 0;\n this.title = this.title || \"Quadrilateralized Spherical Cube\";\n\n /* Determine the cube face from the center of projection. */\n if (this.lat0 >= HALF_PI - FORTPI / 2.0) {\n this.face = FACE_ENUM.TOP;\n } else if (this.lat0 <= -(HALF_PI - FORTPI / 2.0)) {\n this.face = FACE_ENUM.BOTTOM;\n } else if (Math.abs(this.long0) <= FORTPI) {\n this.face = FACE_ENUM.FRONT;\n } else if (Math.abs(this.long0) <= HALF_PI + FORTPI) {\n this.face = this.long0 > 0.0 ? FACE_ENUM.RIGHT : FACE_ENUM.LEFT;\n } else {\n this.face = FACE_ENUM.BACK;\n }\n\n /* Fill in useful values for the ellipsoid <-> sphere shift\n * described in [LK12]. */\n if (this.es !== 0) {\n this.one_minus_f = 1 - (this.a - this.b) / this.a;\n this.one_minus_f_squared = this.one_minus_f * this.one_minus_f;\n }\n}\n\n// QSC forward equations--mapping lat,long to x,y\n// -----------------------------------------------------------------\nexport function forward(p) {\n var xy = {\n x: 0,\n y: 0\n };\n var lat, lon;\n var theta, phi;\n var t, mu;\n /* nu; */\n var area = {\n value: 0\n };\n\n // move lon according to projection's lon\n p.x -= this.long0;\n\n /* Convert the geodetic latitude to a geocentric latitude.\n * This corresponds to the shift from the ellipsoid to the sphere\n * described in [LK12]. */\n if (this.es !== 0) {\n //if (P->es != 0) {\n lat = Math.atan(this.one_minus_f_squared * Math.tan(p.y));\n } else {\n lat = p.y;\n }\n\n /* Convert the input lat, lon into theta, phi as used by QSC.\n * This depends on the cube face and the area on it.\n * For the top and bottom face, we can compute theta and phi\n * directly from phi, lam. For the other faces, we must use\n * unit sphere cartesian coordinates as an intermediate step. */\n lon = p.x; //lon = lp.lam;\n if (this.face === FACE_ENUM.TOP) {\n phi = HALF_PI - lat;\n if (lon >= FORTPI && lon <= HALF_PI + FORTPI) {\n area.value = AREA_ENUM.AREA_0;\n theta = lon - HALF_PI;\n } else if (lon > HALF_PI + FORTPI || lon <= -(HALF_PI + FORTPI)) {\n area.value = AREA_ENUM.AREA_1;\n theta = lon > 0.0 ? lon - SPI : lon + SPI;\n } else if (lon > -(HALF_PI + FORTPI) && lon <= -FORTPI) {\n area.value = AREA_ENUM.AREA_2;\n theta = lon + HALF_PI;\n } else {\n area.value = AREA_ENUM.AREA_3;\n theta = lon;\n }\n } else if (this.face === FACE_ENUM.BOTTOM) {\n phi = HALF_PI + lat;\n if (lon >= FORTPI && lon <= HALF_PI + FORTPI) {\n area.value = AREA_ENUM.AREA_0;\n theta = -lon + HALF_PI;\n } else if (lon < FORTPI && lon >= -FORTPI) {\n area.value = AREA_ENUM.AREA_1;\n theta = -lon;\n } else if (lon < -FORTPI && lon >= -(HALF_PI + FORTPI)) {\n area.value = AREA_ENUM.AREA_2;\n theta = -lon - HALF_PI;\n } else {\n area.value = AREA_ENUM.AREA_3;\n theta = lon > 0.0 ? -lon + SPI : -lon - SPI;\n }\n } else {\n var q, r, s;\n var sinlat, coslat;\n var sinlon, coslon;\n if (this.face === FACE_ENUM.RIGHT) {\n lon = qsc_shift_lon_origin(lon, +HALF_PI);\n } else if (this.face === FACE_ENUM.BACK) {\n lon = qsc_shift_lon_origin(lon, +SPI);\n } else if (this.face === FACE_ENUM.LEFT) {\n lon = qsc_shift_lon_origin(lon, -HALF_PI);\n }\n sinlat = Math.sin(lat);\n coslat = Math.cos(lat);\n sinlon = Math.sin(lon);\n coslon = Math.cos(lon);\n q = coslat * coslon;\n r = coslat * sinlon;\n s = sinlat;\n if (this.face === FACE_ENUM.FRONT) {\n phi = Math.acos(q);\n theta = qsc_fwd_equat_face_theta(phi, s, r, area);\n } else if (this.face === FACE_ENUM.RIGHT) {\n phi = Math.acos(r);\n theta = qsc_fwd_equat_face_theta(phi, s, -q, area);\n } else if (this.face === FACE_ENUM.BACK) {\n phi = Math.acos(-q);\n theta = qsc_fwd_equat_face_theta(phi, s, -r, area);\n } else if (this.face === FACE_ENUM.LEFT) {\n phi = Math.acos(-r);\n theta = qsc_fwd_equat_face_theta(phi, s, q, area);\n } else {\n /* Impossible */\n phi = theta = 0;\n area.value = AREA_ENUM.AREA_0;\n }\n }\n\n /* Compute mu and nu for the area of definition.\n * For mu, see Eq. (3-21) in [OL76], but note the typos:\n * compare with Eq. (3-14). For nu, see Eq. (3-38). */\n mu = Math.atan(12 / SPI * (theta + Math.acos(Math.sin(theta) * Math.cos(FORTPI)) - HALF_PI));\n t = Math.sqrt((1 - Math.cos(phi)) / (Math.cos(mu) * Math.cos(mu)) / (1 - Math.cos(Math.atan(1 / Math.cos(theta)))));\n\n /* Apply the result to the real area. */\n if (area.value === AREA_ENUM.AREA_1) {\n mu += HALF_PI;\n } else if (area.value === AREA_ENUM.AREA_2) {\n mu += SPI;\n } else if (area.value === AREA_ENUM.AREA_3) {\n mu += 1.5 * SPI;\n }\n\n /* Now compute x, y from mu and nu */\n xy.x = t * Math.cos(mu);\n xy.y = t * Math.sin(mu);\n xy.x = xy.x * this.a + this.x0;\n xy.y = xy.y * this.a + this.y0;\n p.x = xy.x;\n p.y = xy.y;\n return p;\n}\n\n// QSC inverse equations--mapping x,y to lat/long\n// -----------------------------------------------------------------\nexport function inverse(p) {\n var lp = {\n lam: 0,\n phi: 0\n };\n var mu, nu, cosmu, tannu;\n var tantheta, theta, cosphi, phi;\n var t;\n var area = {\n value: 0\n };\n\n /* de-offset */\n p.x = (p.x - this.x0) / this.a;\n p.y = (p.y - this.y0) / this.a;\n\n /* Convert the input x, y to the mu and nu angles as used by QSC.\n * This depends on the area of the cube face. */\n nu = Math.atan(Math.sqrt(p.x * p.x + p.y * p.y));\n mu = Math.atan2(p.y, p.x);\n if (p.x >= 0.0 && p.x >= Math.abs(p.y)) {\n area.value = AREA_ENUM.AREA_0;\n } else if (p.y >= 0.0 && p.y >= Math.abs(p.x)) {\n area.value = AREA_ENUM.AREA_1;\n mu -= HALF_PI;\n } else if (p.x < 0.0 && -p.x >= Math.abs(p.y)) {\n area.value = AREA_ENUM.AREA_2;\n mu = mu < 0.0 ? mu + SPI : mu - SPI;\n } else {\n area.value = AREA_ENUM.AREA_3;\n mu += HALF_PI;\n }\n\n /* Compute phi and theta for the area of definition.\n * The inverse projection is not described in the original paper, but some\n * good hints can be found here (as of 2011-12-14):\n * http://fits.gsfc.nasa.gov/fitsbits/saf.93/saf.9302\n * (search for \"Message-Id: <9302181759.AA25477 at fits.cv.nrao.edu>\") */\n t = SPI / 12 * Math.tan(mu);\n tantheta = Math.sin(t) / (Math.cos(t) - 1 / Math.sqrt(2));\n theta = Math.atan(tantheta);\n cosmu = Math.cos(mu);\n tannu = Math.tan(nu);\n cosphi = 1 - cosmu * cosmu * tannu * tannu * (1 - Math.cos(Math.atan(1 / Math.cos(theta))));\n if (cosphi < -1) {\n cosphi = -1;\n } else if (cosphi > +1) {\n cosphi = +1;\n }\n\n /* Apply the result to the real area on the cube face.\n * For the top and bottom face, we can compute phi and lam directly.\n * For the other faces, we must use unit sphere cartesian coordinates\n * as an intermediate step. */\n if (this.face === FACE_ENUM.TOP) {\n phi = Math.acos(cosphi);\n lp.phi = HALF_PI - phi;\n if (area.value === AREA_ENUM.AREA_0) {\n lp.lam = theta + HALF_PI;\n } else if (area.value === AREA_ENUM.AREA_1) {\n lp.lam = theta < 0.0 ? theta + SPI : theta - SPI;\n } else if (area.value === AREA_ENUM.AREA_2) {\n lp.lam = theta - HALF_PI;\n } else /* area.value == AREA_ENUM.AREA_3 */{\n lp.lam = theta;\n }\n } else if (this.face === FACE_ENUM.BOTTOM) {\n phi = Math.acos(cosphi);\n lp.phi = phi - HALF_PI;\n if (area.value === AREA_ENUM.AREA_0) {\n lp.lam = -theta + HALF_PI;\n } else if (area.value === AREA_ENUM.AREA_1) {\n lp.lam = -theta;\n } else if (area.value === AREA_ENUM.AREA_2) {\n lp.lam = -theta - HALF_PI;\n } else /* area.value == AREA_ENUM.AREA_3 */{\n lp.lam = theta < 0.0 ? -theta - SPI : -theta + SPI;\n }\n } else {\n /* Compute phi and lam via cartesian unit sphere coordinates. */\n var q, r, s;\n q = cosphi;\n t = q * q;\n if (t >= 1) {\n s = 0;\n } else {\n s = Math.sqrt(1 - t) * Math.sin(theta);\n }\n t += s * s;\n if (t >= 1) {\n r = 0;\n } else {\n r = Math.sqrt(1 - t);\n }\n /* Rotate q,r,s into the correct area. */\n if (area.value === AREA_ENUM.AREA_1) {\n t = r;\n r = -s;\n s = t;\n } else if (area.value === AREA_ENUM.AREA_2) {\n r = -r;\n s = -s;\n } else if (area.value === AREA_ENUM.AREA_3) {\n t = r;\n r = s;\n s = -t;\n }\n /* Rotate q,r,s into the correct cube face. */\n if (this.face === FACE_ENUM.RIGHT) {\n t = q;\n q = -r;\n r = t;\n } else if (this.face === FACE_ENUM.BACK) {\n q = -q;\n r = -r;\n } else if (this.face === FACE_ENUM.LEFT) {\n t = q;\n q = r;\n r = -t;\n }\n /* Now compute phi and lam from the unit sphere coordinates. */\n lp.phi = Math.acos(-s) - HALF_PI;\n lp.lam = Math.atan2(r, q);\n if (this.face === FACE_ENUM.RIGHT) {\n lp.lam = qsc_shift_lon_origin(lp.lam, -HALF_PI);\n } else if (this.face === FACE_ENUM.BACK) {\n lp.lam = qsc_shift_lon_origin(lp.lam, -SPI);\n } else if (this.face === FACE_ENUM.LEFT) {\n lp.lam = qsc_shift_lon_origin(lp.lam, +HALF_PI);\n }\n }\n\n /* Apply the shift from the sphere to the ellipsoid as described\n * in [LK12]. */\n if (this.es !== 0) {\n var invert_sign;\n var tanphi, xa;\n invert_sign = lp.phi < 0 ? 1 : 0;\n tanphi = Math.tan(lp.phi);\n xa = this.b / Math.sqrt(tanphi * tanphi + this.one_minus_f_squared);\n lp.phi = Math.atan(Math.sqrt(this.a * this.a - xa * xa) / (this.one_minus_f * xa));\n if (invert_sign) {\n lp.phi = -lp.phi;\n }\n }\n lp.lam += this.long0;\n p.x = lp.lam;\n p.y = lp.phi;\n return p;\n}\n\n/* Helper function for forward projection: compute the theta angle\n * and determine the area number. */\nfunction qsc_fwd_equat_face_theta(phi, y, x, area) {\n var theta;\n if (phi < EPSLN) {\n area.value = AREA_ENUM.AREA_0;\n theta = 0.0;\n } else {\n theta = Math.atan2(y, x);\n if (Math.abs(theta) <= FORTPI) {\n area.value = AREA_ENUM.AREA_0;\n } else if (theta > FORTPI && theta <= HALF_PI + FORTPI) {\n area.value = AREA_ENUM.AREA_1;\n theta -= HALF_PI;\n } else if (theta > HALF_PI + FORTPI || theta <= -(HALF_PI + FORTPI)) {\n area.value = AREA_ENUM.AREA_2;\n theta = theta >= 0.0 ? theta - SPI : theta + SPI;\n } else {\n area.value = AREA_ENUM.AREA_3;\n theta += HALF_PI;\n }\n }\n return theta;\n}\n\n/* Helper function: shift the longitude. */\nfunction qsc_shift_lon_origin(lon, offset) {\n var slon = lon + offset;\n if (slon < -SPI) {\n slon += TWO_PI;\n } else if (slon > +SPI) {\n slon -= TWO_PI;\n }\n return slon;\n}\nexport var names = [\"Quadrilateralized Spherical Cube\", \"Quadrilateralized_Spherical_Cube\", \"qsc\"];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};","// Robinson projection\n// Based on https://github.com/OSGeo/proj.4/blob/master/src/PJ_robin.c\n// Polynomial coeficients from http://article.gmane.org/gmane.comp.gis.proj-4.devel/6039\n\nimport { HALF_PI, D2R, R2D, EPSLN } from '../constants/values';\nimport adjust_lon from '../common/adjust_lon';\nvar COEFS_X = [[1.0000, 2.2199e-17, -7.15515e-05, 3.1103e-06], [0.9986, -0.000482243, -2.4897e-05, -1.3309e-06], [0.9954, -0.00083103, -4.48605e-05, -9.86701e-07], [0.9900, -0.00135364, -5.9661e-05, 3.6777e-06], [0.9822, -0.00167442, -4.49547e-06, -5.72411e-06], [0.9730, -0.00214868, -9.03571e-05, 1.8736e-08], [0.9600, -0.00305085, -9.00761e-05, 1.64917e-06], [0.9427, -0.00382792, -6.53386e-05, -2.6154e-06], [0.9216, -0.00467746, -0.00010457, 4.81243e-06], [0.8962, -0.00536223, -3.23831e-05, -5.43432e-06], [0.8679, -0.00609363, -0.000113898, 3.32484e-06], [0.8350, -0.00698325, -6.40253e-05, 9.34959e-07], [0.7986, -0.00755338, -5.00009e-05, 9.35324e-07], [0.7597, -0.00798324, -3.5971e-05, -2.27626e-06], [0.7186, -0.00851367, -7.01149e-05, -8.6303e-06], [0.6732, -0.00986209, -0.000199569, 1.91974e-05], [0.6213, -0.010418, 8.83923e-05, 6.24051e-06], [0.5722, -0.00906601, 0.000182, 6.24051e-06], [0.5322, -0.00677797, 0.000275608, 6.24051e-06]];\nvar COEFS_Y = [[-5.20417e-18, 0.0124, 1.21431e-18, -8.45284e-11], [0.0620, 0.0124, -1.26793e-09, 4.22642e-10], [0.1240, 0.0124, 5.07171e-09, -1.60604e-09], [0.1860, 0.0123999, -1.90189e-08, 6.00152e-09], [0.2480, 0.0124002, 7.10039e-08, -2.24e-08], [0.3100, 0.0123992, -2.64997e-07, 8.35986e-08], [0.3720, 0.0124029, 9.88983e-07, -3.11994e-07], [0.4340, 0.0123893, -3.69093e-06, -4.35621e-07], [0.4958, 0.0123198, -1.02252e-05, -3.45523e-07], [0.5571, 0.0121916, -1.54081e-05, -5.82288e-07], [0.6176, 0.0119938, -2.41424e-05, -5.25327e-07], [0.6769, 0.011713, -3.20223e-05, -5.16405e-07], [0.7346, 0.0113541, -3.97684e-05, -6.09052e-07], [0.7903, 0.0109107, -4.89042e-05, -1.04739e-06], [0.8435, 0.0103431, -6.4615e-05, -1.40374e-09], [0.8936, 0.00969686, -6.4636e-05, -8.547e-06], [0.9394, 0.00840947, -0.000192841, -4.2106e-06], [0.9761, 0.00616527, -0.000256, -4.2106e-06], [1.0000, 0.00328947, -0.000319159, -4.2106e-06]];\nvar FXC = 0.8487;\nvar FYC = 1.3523;\nvar C1 = R2D / 5; // rad to 5-degree interval\nvar RC1 = 1 / C1;\nvar NODES = 18;\nvar poly3_val = function (coefs, x) {\n return coefs[0] + x * (coefs[1] + x * (coefs[2] + x * coefs[3]));\n};\nvar poly3_der = function (coefs, x) {\n return coefs[1] + x * (2 * coefs[2] + x * 3 * coefs[3]);\n};\nfunction newton_rapshon(f_df, start, max_err, iters) {\n var x = start;\n for (; iters; --iters) {\n var upd = f_df(x);\n x -= upd;\n if (Math.abs(upd) < max_err) {\n break;\n }\n }\n return x;\n}\nexport function init() {\n this.x0 = this.x0 || 0;\n this.y0 = this.y0 || 0;\n this.long0 = this.long0 || 0;\n this.es = 0;\n this.title = this.title || \"Robinson\";\n}\nexport function forward(ll) {\n var lon = adjust_lon(ll.x - this.long0);\n var dphi = Math.abs(ll.y);\n var i = Math.floor(dphi * C1);\n if (i < 0) {\n i = 0;\n } else if (i >= NODES) {\n i = NODES - 1;\n }\n dphi = R2D * (dphi - RC1 * i);\n var xy = {\n x: poly3_val(COEFS_X[i], dphi) * lon,\n y: poly3_val(COEFS_Y[i], dphi)\n };\n if (ll.y < 0) {\n xy.y = -xy.y;\n }\n xy.x = xy.x * this.a * FXC + this.x0;\n xy.y = xy.y * this.a * FYC + this.y0;\n return xy;\n}\nexport function inverse(xy) {\n var ll = {\n x: (xy.x - this.x0) / (this.a * FXC),\n y: Math.abs(xy.y - this.y0) / (this.a * FYC)\n };\n if (ll.y >= 1) {\n // pathologic case\n ll.x /= COEFS_X[NODES][0];\n ll.y = xy.y < 0 ? -HALF_PI : HALF_PI;\n } else {\n // find table interval\n var i = Math.floor(ll.y * NODES);\n if (i < 0) {\n i = 0;\n } else if (i >= NODES) {\n i = NODES - 1;\n }\n for (;;) {\n if (COEFS_Y[i][0] > ll.y) {\n --i;\n } else if (COEFS_Y[i + 1][0] <= ll.y) {\n ++i;\n } else {\n break;\n }\n }\n // linear interpolation in 5 degree interval\n var coefs = COEFS_Y[i];\n var t = 5 * (ll.y - coefs[0]) / (COEFS_Y[i + 1][0] - coefs[0]);\n // find t so that poly3_val(coefs, t) = ll.y\n t = newton_rapshon(function (x) {\n return (poly3_val(coefs, x) - ll.y) / poly3_der(coefs, x);\n }, t, EPSLN, 100);\n ll.x /= poly3_val(COEFS_X[i], t);\n ll.y = (5 * i + t) * D2R;\n if (xy.y < 0) {\n ll.y = -ll.y;\n }\n }\n ll.x = adjust_lon(ll.x + this.long0);\n return ll;\n}\nexport var names = [\"Robinson\", \"robin\"];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};","import { geodeticToGeocentric, geocentricToGeodetic } from '../datumUtils';\nexport function init() {\n this.name = 'geocent';\n}\nexport function forward(p) {\n var point = geodeticToGeocentric(p, this.es, this.a);\n return point;\n}\nexport function inverse(p) {\n var point = geocentricToGeodetic(p, this.es, this.a, this.b);\n return point;\n}\nexport var names = [\"Geocentric\", 'geocentric', \"geocent\", \"Geocent\"];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};","var mode = {\n N_POLE: 0,\n S_POLE: 1,\n EQUIT: 2,\n OBLIQ: 3\n};\nimport { D2R, HALF_PI, EPSLN } from \"../constants/values\";\nimport hypot from \"../common/hypot\";\nvar params = {\n h: {\n def: 100000,\n num: true\n },\n // default is Karman line, no default in PROJ.7\n azi: {\n def: 0,\n num: true,\n degrees: true\n },\n // default is North\n tilt: {\n def: 0,\n num: true,\n degrees: true\n },\n // default is Nadir\n long0: {\n def: 0,\n num: true\n },\n // default is Greenwich, conversion to rad is automatic\n lat0: {\n def: 0,\n num: true\n } // default is Equator, conversion to rad is automatic\n};\nexport function init() {\n Object.keys(params).forEach(function (p) {\n if (typeof this[p] === \"undefined\") {\n this[p] = params[p].def;\n } else if (params[p].num && isNaN(this[p])) {\n throw new Error(\"Invalid parameter value, must be numeric \" + p + \" = \" + this[p]);\n } else if (params[p].num) {\n this[p] = parseFloat(this[p]);\n }\n if (params[p].degrees) {\n this[p] = this[p] * D2R;\n }\n }.bind(this));\n if (Math.abs(Math.abs(this.lat0) - HALF_PI) < EPSLN) {\n this.mode = this.lat0 < 0 ? mode.S_POLE : mode.N_POLE;\n } else if (Math.abs(this.lat0) < EPSLN) {\n this.mode = mode.EQUIT;\n } else {\n this.mode = mode.OBLIQ;\n this.sinph0 = Math.sin(this.lat0);\n this.cosph0 = Math.cos(this.lat0);\n }\n this.pn1 = this.h / this.a; // Normalize relative to the Earth's radius\n\n if (this.pn1 <= 0 || this.pn1 > 1e10) {\n throw new Error(\"Invalid height\");\n }\n this.p = 1 + this.pn1;\n this.rp = 1 / this.p;\n this.h1 = 1 / this.pn1;\n this.pfact = (this.p + 1) * this.h1;\n this.es = 0;\n var omega = this.tilt;\n var gamma = this.azi;\n this.cg = Math.cos(gamma);\n this.sg = Math.sin(gamma);\n this.cw = Math.cos(omega);\n this.sw = Math.sin(omega);\n}\nexport function forward(p) {\n p.x -= this.long0;\n var sinphi = Math.sin(p.y);\n var cosphi = Math.cos(p.y);\n var coslam = Math.cos(p.x);\n var x, y;\n switch (this.mode) {\n case mode.OBLIQ:\n y = this.sinph0 * sinphi + this.cosph0 * cosphi * coslam;\n break;\n case mode.EQUIT:\n y = cosphi * coslam;\n break;\n case mode.S_POLE:\n y = -sinphi;\n break;\n case mode.N_POLE:\n y = sinphi;\n break;\n }\n y = this.pn1 / (this.p - y);\n x = y * cosphi * Math.sin(p.x);\n switch (this.mode) {\n case mode.OBLIQ:\n y *= this.cosph0 * sinphi - this.sinph0 * cosphi * coslam;\n break;\n case mode.EQUIT:\n y *= sinphi;\n break;\n case mode.N_POLE:\n y *= -(cosphi * coslam);\n break;\n case mode.S_POLE:\n y *= cosphi * coslam;\n break;\n }\n\n // Tilt \n var yt, ba;\n yt = y * this.cg + x * this.sg;\n ba = 1 / (yt * this.sw * this.h1 + this.cw);\n x = (x * this.cg - y * this.sg) * this.cw * ba;\n y = yt * ba;\n p.x = x * this.a;\n p.y = y * this.a;\n return p;\n}\nexport function inverse(p) {\n p.x /= this.a;\n p.y /= this.a;\n var r = {\n x: p.x,\n y: p.y\n };\n\n // Un-Tilt\n var bm, bq, yt;\n yt = 1 / (this.pn1 - p.y * this.sw);\n bm = this.pn1 * p.x * yt;\n bq = this.pn1 * p.y * this.cw * yt;\n p.x = bm * this.cg + bq * this.sg;\n p.y = bq * this.cg - bm * this.sg;\n var rh = hypot(p.x, p.y);\n if (Math.abs(rh) < EPSLN) {\n r.x = 0;\n r.y = p.y;\n } else {\n var cosz, sinz;\n sinz = 1 - rh * rh * this.pfact;\n sinz = (this.p - Math.sqrt(sinz)) / (this.pn1 / rh + rh / this.pn1);\n cosz = Math.sqrt(1 - sinz * sinz);\n switch (this.mode) {\n case mode.OBLIQ:\n r.y = Math.asin(cosz * this.sinph0 + p.y * sinz * this.cosph0 / rh);\n p.y = (cosz - this.sinph0 * Math.sin(r.y)) * rh;\n p.x *= sinz * this.cosph0;\n break;\n case mode.EQUIT:\n r.y = Math.asin(p.y * sinz / rh);\n p.y = cosz * rh;\n p.x *= sinz;\n break;\n case mode.N_POLE:\n r.y = Math.asin(cosz);\n p.y = -p.y;\n break;\n case mode.S_POLE:\n r.y = -Math.asin(cosz);\n break;\n }\n r.x = Math.atan2(p.x, p.y);\n }\n p.x = r.x + this.long0;\n p.y = r.y;\n return p;\n}\nexport var names = [\"Tilted_Perspective\", \"tpers\"];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};","import hypot from '../common/hypot';\nexport function init() {\n this.flip_axis = this.sweep === 'x' ? 1 : 0;\n this.h = Number(this.h);\n this.radius_g_1 = this.h / this.a;\n if (this.radius_g_1 <= 0 || this.radius_g_1 > 1e10) {\n throw new Error();\n }\n this.radius_g = 1.0 + this.radius_g_1;\n this.C = this.radius_g * this.radius_g - 1.0;\n if (this.es !== 0.0) {\n var one_es = 1.0 - this.es;\n var rone_es = 1 / one_es;\n this.radius_p = Math.sqrt(one_es);\n this.radius_p2 = one_es;\n this.radius_p_inv2 = rone_es;\n this.shape = 'ellipse'; // Use as a condition in the forward and inverse functions.\n } else {\n this.radius_p = 1.0;\n this.radius_p2 = 1.0;\n this.radius_p_inv2 = 1.0;\n this.shape = 'sphere'; // Use as a condition in the forward and inverse functions.\n }\n if (!this.title) {\n this.title = \"Geostationary Satellite View\";\n }\n}\nfunction forward(p) {\n var lon = p.x;\n var lat = p.y;\n var tmp, v_x, v_y, v_z;\n lon = lon - this.long0;\n if (this.shape === 'ellipse') {\n lat = Math.atan(this.radius_p2 * Math.tan(lat));\n var r = this.radius_p / hypot(this.radius_p * Math.cos(lat), Math.sin(lat));\n v_x = r * Math.cos(lon) * Math.cos(lat);\n v_y = r * Math.sin(lon) * Math.cos(lat);\n v_z = r * Math.sin(lat);\n if ((this.radius_g - v_x) * v_x - v_y * v_y - v_z * v_z * this.radius_p_inv2 < 0.0) {\n p.x = Number.NaN;\n p.y = Number.NaN;\n return p;\n }\n tmp = this.radius_g - v_x;\n if (this.flip_axis) {\n p.x = this.radius_g_1 * Math.atan(v_y / hypot(v_z, tmp));\n p.y = this.radius_g_1 * Math.atan(v_z / tmp);\n } else {\n p.x = this.radius_g_1 * Math.atan(v_y / tmp);\n p.y = this.radius_g_1 * Math.atan(v_z / hypot(v_y, tmp));\n }\n } else if (this.shape === 'sphere') {\n tmp = Math.cos(lat);\n v_x = Math.cos(lon) * tmp;\n v_y = Math.sin(lon) * tmp;\n v_z = Math.sin(lat);\n tmp = this.radius_g - v_x;\n if (this.flip_axis) {\n p.x = this.radius_g_1 * Math.atan(v_y / hypot(v_z, tmp));\n p.y = this.radius_g_1 * Math.atan(v_z / tmp);\n } else {\n p.x = this.radius_g_1 * Math.atan(v_y / tmp);\n p.y = this.radius_g_1 * Math.atan(v_z / hypot(v_y, tmp));\n }\n }\n p.x = p.x * this.a;\n p.y = p.y * this.a;\n return p;\n}\nfunction inverse(p) {\n var v_x = -1.0;\n var v_y = 0.0;\n var v_z = 0.0;\n var a, b, det, k;\n p.x = p.x / this.a;\n p.y = p.y / this.a;\n if (this.shape === 'ellipse') {\n if (this.flip_axis) {\n v_z = Math.tan(p.y / this.radius_g_1);\n v_y = Math.tan(p.x / this.radius_g_1) * hypot(1.0, v_z);\n } else {\n v_y = Math.tan(p.x / this.radius_g_1);\n v_z = Math.tan(p.y / this.radius_g_1) * hypot(1.0, v_y);\n }\n var v_zp = v_z / this.radius_p;\n a = v_y * v_y + v_zp * v_zp + v_x * v_x;\n b = 2 * this.radius_g * v_x;\n det = b * b - 4 * a * this.C;\n if (det < 0.0) {\n p.x = Number.NaN;\n p.y = Number.NaN;\n return p;\n }\n k = (-b - Math.sqrt(det)) / (2.0 * a);\n v_x = this.radius_g + k * v_x;\n v_y *= k;\n v_z *= k;\n p.x = Math.atan2(v_y, v_x);\n p.y = Math.atan(v_z * Math.cos(p.x) / v_x);\n p.y = Math.atan(this.radius_p_inv2 * Math.tan(p.y));\n } else if (this.shape === 'sphere') {\n if (this.flip_axis) {\n v_z = Math.tan(p.y / this.radius_g_1);\n v_y = Math.tan(p.x / this.radius_g_1) * Math.sqrt(1.0 + v_z * v_z);\n } else {\n v_y = Math.tan(p.x / this.radius_g_1);\n v_z = Math.tan(p.y / this.radius_g_1) * Math.sqrt(1.0 + v_y * v_y);\n }\n a = v_y * v_y + v_z * v_z + v_x * v_x;\n b = 2 * this.radius_g * v_x;\n det = b * b - 4 * a * this.C;\n if (det < 0.0) {\n p.x = Number.NaN;\n p.y = Number.NaN;\n return p;\n }\n k = (-b - Math.sqrt(det)) / (2.0 * a);\n v_x = this.radius_g + k * v_x;\n v_y *= k;\n v_z *= k;\n p.x = Math.atan2(v_y, v_x);\n p.y = Math.atan(v_z * Math.cos(p.x) / v_x);\n }\n p.x = p.x + this.long0;\n return p;\n}\nexport var names = [\"Geostationary Satellite View\", \"Geostationary_Satellite\", \"geos\"];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};","/**\n * Copyright 2018 Bernie Jenny, Monash University, Melbourne, Australia.\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 * Equal Earth is a projection inspired by the Robinson projection, but unlike\n * the Robinson projection retains the relative size of areas. The projection\n * was designed in 2018 by Bojan Savric, Tom Patterson and Bernhard Jenny.\n *\n * Publication:\n * Bojan Savric, Tom Patterson & Bernhard Jenny (2018). The Equal Earth map\n * projection, International Journal of Geographical Information Science,\n * DOI: 10.1080/13658816.2018.1504949\n *\n * Code released August 2018\n * Ported to JavaScript and adapted for mapshaper-proj by Matthew Bloch August 2018\n * Modified for proj4js by Andreas Hocevar by Andreas Hocevar March 2024\n */\n\nimport adjust_lon from \"../common/adjust_lon\";\nvar A1 = 1.340264,\n A2 = -0.081106,\n A3 = 0.000893,\n A4 = 0.003796,\n M = Math.sqrt(3) / 2.0;\nexport function init() {\n this.es = 0;\n this.long0 = this.long0 !== undefined ? this.long0 : 0;\n}\nexport function forward(p) {\n var lam = adjust_lon(p.x - this.long0);\n var phi = p.y;\n var paramLat = Math.asin(M * Math.sin(phi)),\n paramLatSq = paramLat * paramLat,\n paramLatPow6 = paramLatSq * paramLatSq * paramLatSq;\n p.x = lam * Math.cos(paramLat) / (M * (A1 + 3 * A2 * paramLatSq + paramLatPow6 * (7 * A3 + 9 * A4 * paramLatSq)));\n p.y = paramLat * (A1 + A2 * paramLatSq + paramLatPow6 * (A3 + A4 * paramLatSq));\n p.x = this.a * p.x + this.x0;\n p.y = this.a * p.y + this.y0;\n return p;\n}\nexport function inverse(p) {\n p.x = (p.x - this.x0) / this.a;\n p.y = (p.y - this.y0) / this.a;\n var EPS = 1e-9,\n NITER = 12,\n paramLat = p.y,\n paramLatSq,\n paramLatPow6,\n fy,\n fpy,\n dlat,\n i;\n for (i = 0; i < NITER; ++i) {\n paramLatSq = paramLat * paramLat;\n paramLatPow6 = paramLatSq * paramLatSq * paramLatSq;\n fy = paramLat * (A1 + A2 * paramLatSq + paramLatPow6 * (A3 + A4 * paramLatSq)) - p.y;\n fpy = A1 + 3 * A2 * paramLatSq + paramLatPow6 * (7 * A3 + 9 * A4 * paramLatSq);\n paramLat -= dlat = fy / fpy;\n if (Math.abs(dlat) < EPS) {\n break;\n }\n }\n paramLatSq = paramLat * paramLat;\n paramLatPow6 = paramLatSq * paramLatSq * paramLatSq;\n p.x = M * p.x * (A1 + 3 * A2 * paramLatSq + paramLatPow6 * (7 * A3 + 9 * A4 * paramLatSq)) / Math.cos(paramLat);\n p.y = Math.asin(Math.sin(paramLat) / M);\n p.x = adjust_lon(p.x + this.long0);\n return p;\n}\nexport var names = [\"eqearth\", \"Equal Earth\", \"Equal_Earth\"];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};","import tmerc from './lib/projections/tmerc';\nimport etmerc from './lib/projections/etmerc';\nimport utm from './lib/projections/utm';\nimport sterea from './lib/projections/sterea';\nimport stere from './lib/projections/stere';\nimport somerc from './lib/projections/somerc';\nimport omerc from './lib/projections/omerc';\nimport lcc from './lib/projections/lcc';\nimport krovak from './lib/projections/krovak';\nimport cass from './lib/projections/cass';\nimport laea from './lib/projections/laea';\nimport aea from './lib/projections/aea';\nimport gnom from './lib/projections/gnom';\nimport cea from './lib/projections/cea';\nimport eqc from './lib/projections/eqc';\nimport poly from './lib/projections/poly';\nimport nzmg from './lib/projections/nzmg';\nimport mill from './lib/projections/mill';\nimport sinu from './lib/projections/sinu';\nimport moll from './lib/projections/moll';\nimport eqdc from './lib/projections/eqdc';\nimport vandg from './lib/projections/vandg';\nimport aeqd from './lib/projections/aeqd';\nimport ortho from './lib/projections/ortho';\nimport qsc from './lib/projections/qsc';\nimport robin from './lib/projections/robin';\nimport geocent from './lib/projections/geocent';\nimport tpers from './lib/projections/tpers';\nimport geos from './lib/projections/geos';\nimport eqearth from './lib/projections/eqearth';\nexport default function (proj4) {\n proj4.Proj.projections.add(tmerc);\n proj4.Proj.projections.add(etmerc);\n proj4.Proj.projections.add(utm);\n proj4.Proj.projections.add(sterea);\n proj4.Proj.projections.add(stere);\n proj4.Proj.projections.add(somerc);\n proj4.Proj.projections.add(omerc);\n proj4.Proj.projections.add(lcc);\n proj4.Proj.projections.add(krovak);\n proj4.Proj.projections.add(cass);\n proj4.Proj.projections.add(laea);\n proj4.Proj.projections.add(aea);\n proj4.Proj.projections.add(gnom);\n proj4.Proj.projections.add(cea);\n proj4.Proj.projections.add(eqc);\n proj4.Proj.projections.add(poly);\n proj4.Proj.projections.add(nzmg);\n proj4.Proj.projections.add(mill);\n proj4.Proj.projections.add(sinu);\n proj4.Proj.projections.add(moll);\n proj4.Proj.projections.add(eqdc);\n proj4.Proj.projections.add(vandg);\n proj4.Proj.projections.add(aeqd);\n proj4.Proj.projections.add(ortho);\n proj4.Proj.projections.add(qsc);\n proj4.Proj.projections.add(robin);\n proj4.Proj.projections.add(geocent);\n proj4.Proj.projections.add(tpers);\n proj4.Proj.projections.add(geos);\n proj4.Proj.projections.add(eqearth);\n}","import proj4 from './core';\nimport Proj from \"./Proj\";\nimport Point from \"./Point\";\nimport common from \"./common/toPoint\";\nimport defs from \"./defs\";\nimport nadgrid from \"./nadgrid\";\nimport transform from \"./transform\";\nimport mgrs from \"mgrs\";\nimport includedProjections from \"../projs\";\nproj4.defaultDatum = 'WGS84'; //default datum\nproj4.Proj = Proj;\nproj4.WGS84 = new proj4.Proj('WGS84');\nproj4.Point = Point;\nproj4.toPoint = common;\nproj4.defs = defs;\nproj4.nadgrid = nadgrid;\nproj4.transform = transform;\nproj4.mgrs = mgrs;\nproj4.version = '__VERSION__';\nincludedProjections(proj4);\nexport default proj4;","'use strict';\n\n// private property\nvar _keyStr = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\n\n// public method for encoding\nexports.encode = function (input, utf8) {\n var output = \"\";\n var chr1, chr2, chr3, enc1, enc2, enc3, enc4;\n var i = 0;\n while (i < input.length) {\n chr1 = input.charCodeAt(i++);\n chr2 = input.charCodeAt(i++);\n chr3 = input.charCodeAt(i++);\n enc1 = chr1 >> 2;\n enc2 = (chr1 & 3) << 4 | chr2 >> 4;\n enc3 = (chr2 & 15) << 2 | chr3 >> 6;\n enc4 = chr3 & 63;\n if (isNaN(chr2)) {\n enc3 = enc4 = 64;\n } else if (isNaN(chr3)) {\n enc4 = 64;\n }\n output = output + _keyStr.charAt(enc1) + _keyStr.charAt(enc2) + _keyStr.charAt(enc3) + _keyStr.charAt(enc4);\n }\n return output;\n};\n\n// public method for decoding\nexports.decode = function (input, utf8) {\n var output = \"\";\n var chr1, chr2, chr3;\n var enc1, enc2, enc3, enc4;\n var i = 0;\n input = input.replace(/[^A-Za-z0-9\\+\\/\\=]/g, \"\");\n while (i < input.length) {\n enc1 = _keyStr.indexOf(input.charAt(i++));\n enc2 = _keyStr.indexOf(input.charAt(i++));\n enc3 = _keyStr.indexOf(input.charAt(i++));\n enc4 = _keyStr.indexOf(input.charAt(i++));\n chr1 = enc1 << 2 | enc2 >> 4;\n chr2 = (enc2 & 15) << 4 | enc3 >> 2;\n chr3 = (enc3 & 3) << 6 | enc4;\n output = output + String.fromCharCode(chr1);\n if (enc3 != 64) {\n output = output + String.fromCharCode(chr2);\n }\n if (enc4 != 64) {\n output = output + String.fromCharCode(chr3);\n }\n }\n return output;\n};","'use strict';\n\nexports.base64 = true;\nexports.array = true;\nexports.string = true;\nexports.arraybuffer = typeof ArrayBuffer !== \"undefined\" && typeof Uint8Array !== \"undefined\";\n// contains true if JSZip can read/generate nodejs Buffer, false otherwise.\n// Browserify will provide a Buffer implementation for browsers, which is\n// an augmented Uint8Array (i.e., can be used as either Buffer or U8).\nexports.nodebuffer = typeof Buffer !== \"undefined\";\n// contains true if JSZip can read/generate Uint8Array, false otherwise.\nexports.uint8array = typeof Uint8Array !== \"undefined\";\nif (typeof ArrayBuffer === \"undefined\") {\n exports.blob = false;\n} else {\n var buffer = new ArrayBuffer(0);\n try {\n exports.blob = new Blob([buffer], {\n type: \"application/zip\"\n }).size === 0;\n } catch (e) {\n try {\n var Builder = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder || window.MSBlobBuilder;\n var builder = new Builder();\n builder.append(buffer);\n exports.blob = builder.getBlob('application/zip').size === 0;\n } catch (e) {\n exports.blob = false;\n }\n }\n}","'use strict';\n\nvar TYPED_OK = typeof Uint8Array !== 'undefined' && typeof Uint16Array !== 'undefined' && typeof Int32Array !== 'undefined';\nfunction _has(obj, key) {\n return Object.prototype.hasOwnProperty.call(obj, key);\n}\nexports.assign = function (obj /*from1, from2, from3, ...*/) {\n var sources = Array.prototype.slice.call(arguments, 1);\n while (sources.length) {\n var source = sources.shift();\n if (!source) {\n continue;\n }\n if (typeof source !== 'object') {\n throw new TypeError(source + 'must be non-object');\n }\n for (var p in source) {\n if (_has(source, p)) {\n obj[p] = source[p];\n }\n }\n }\n return obj;\n};\n\n// reduce buffer size, avoiding mem copy\nexports.shrinkBuf = function (buf, size) {\n if (buf.length === size) {\n return buf;\n }\n if (buf.subarray) {\n return buf.subarray(0, size);\n }\n buf.length = size;\n return buf;\n};\nvar fnTyped = {\n arraySet: function (dest, src, src_offs, len, dest_offs) {\n if (src.subarray && dest.subarray) {\n dest.set(src.subarray(src_offs, src_offs + len), dest_offs);\n return;\n }\n // Fallback to ordinary array\n for (var i = 0; i < len; i++) {\n dest[dest_offs + i] = src[src_offs + i];\n }\n },\n // Join array of chunks to single array.\n flattenChunks: function (chunks) {\n var i, l, len, pos, chunk, result;\n\n // calculate data length\n len = 0;\n for (i = 0, l = chunks.length; i < l; i++) {\n len += chunks[i].length;\n }\n\n // join chunks\n result = new Uint8Array(len);\n pos = 0;\n for (i = 0, l = chunks.length; i < l; i++) {\n chunk = chunks[i];\n result.set(chunk, pos);\n pos += chunk.length;\n }\n return result;\n }\n};\nvar fnUntyped = {\n arraySet: function (dest, src, src_offs, len, dest_offs) {\n for (var i = 0; i < len; i++) {\n dest[dest_offs + i] = src[src_offs + i];\n }\n },\n // Join array of chunks to single array.\n flattenChunks: function (chunks) {\n return [].concat.apply([], chunks);\n }\n};\n\n// Enable/Disable typed arrays use, for testing\n//\nexports.setTyped = function (on) {\n if (on) {\n exports.Buf8 = Uint8Array;\n exports.Buf16 = Uint16Array;\n exports.Buf32 = Int32Array;\n exports.assign(exports, fnTyped);\n } else {\n exports.Buf8 = Array;\n exports.Buf16 = Array;\n exports.Buf32 = Array;\n exports.assign(exports, fnUntyped);\n }\n};\nexports.setTyped(TYPED_OK);","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\n/* eslint-disable space-unary-ops */\nvar utils = require('../utils/common');\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\n//var Z_FILTERED = 1;\n//var Z_HUFFMAN_ONLY = 2;\n//var Z_RLE = 3;\nvar Z_FIXED = 4;\n//var Z_DEFAULT_STRATEGY = 0;\n\n/* Possible values of the data_type field (though see inflate()) */\nvar Z_BINARY = 0;\nvar Z_TEXT = 1;\n//var Z_ASCII = 1; // = Z_TEXT\nvar Z_UNKNOWN = 2;\n\n/*============================================================================*/\n\nfunction zero(buf) {\n var len = buf.length;\n while (--len >= 0) {\n buf[len] = 0;\n }\n}\n\n// From zutil.h\n\nvar STORED_BLOCK = 0;\nvar STATIC_TREES = 1;\nvar DYN_TREES = 2;\n/* The three kinds of block type */\n\nvar MIN_MATCH = 3;\nvar MAX_MATCH = 258;\n/* The minimum and maximum match lengths */\n\n// From deflate.h\n/* ===========================================================================\n * Internal compression state.\n */\n\nvar LENGTH_CODES = 29;\n/* number of length codes, not counting the special END_BLOCK code */\n\nvar LITERALS = 256;\n/* number of literal bytes 0..255 */\n\nvar L_CODES = LITERALS + 1 + LENGTH_CODES;\n/* number of Literal or Length codes, including the END_BLOCK code */\n\nvar D_CODES = 30;\n/* number of distance codes */\n\nvar BL_CODES = 19;\n/* number of codes used to transfer the bit lengths */\n\nvar HEAP_SIZE = 2 * L_CODES + 1;\n/* maximum heap size */\n\nvar MAX_BITS = 15;\n/* All codes must not exceed MAX_BITS bits */\n\nvar Buf_size = 16;\n/* size of bit buffer in bi_buf */\n\n/* ===========================================================================\n * Constants\n */\n\nvar MAX_BL_BITS = 7;\n/* Bit length codes must not exceed MAX_BL_BITS bits */\n\nvar END_BLOCK = 256;\n/* end of block literal code */\n\nvar REP_3_6 = 16;\n/* repeat previous bit length 3-6 times (2 bits of repeat count) */\n\nvar REPZ_3_10 = 17;\n/* repeat a zero length 3-10 times (3 bits of repeat count) */\n\nvar REPZ_11_138 = 18;\n/* repeat a zero length 11-138 times (7 bits of repeat count) */\n\n/* eslint-disable comma-spacing,array-bracket-spacing */\nvar extra_lbits = /* extra bits for each length code */\n[0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0];\nvar extra_dbits = /* extra bits for each distance code */\n[0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13];\nvar extra_blbits = /* extra bits for each bit length code */\n[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7];\nvar bl_order = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15];\n/* eslint-enable comma-spacing,array-bracket-spacing */\n\n/* The lengths of the bit length codes are sent in order of decreasing\n * probability, to avoid transmitting the lengths for unused bit length codes.\n */\n\n/* ===========================================================================\n * Local data. These are initialized only once.\n */\n\n// We pre-fill arrays with 0 to avoid uninitialized gaps\n\nvar DIST_CODE_LEN = 512; /* see definition of array dist_code below */\n\n// !!!! Use flat array instead of structure, Freq = i*2, Len = i*2+1\nvar static_ltree = new Array((L_CODES + 2) * 2);\nzero(static_ltree);\n/* The static literal tree. Since the bit lengths are imposed, there is no\n * need for the L_CODES extra codes used during heap construction. However\n * The codes 286 and 287 are needed to build a canonical tree (see _tr_init\n * below).\n */\n\nvar static_dtree = new Array(D_CODES * 2);\nzero(static_dtree);\n/* The static distance tree. (Actually a trivial tree since all codes use\n * 5 bits.)\n */\n\nvar _dist_code = new Array(DIST_CODE_LEN);\nzero(_dist_code);\n/* Distance codes. The first 256 values correspond to the distances\n * 3 .. 258, the last 256 values correspond to the top 8 bits of\n * the 15 bit distances.\n */\n\nvar _length_code = new Array(MAX_MATCH - MIN_MATCH + 1);\nzero(_length_code);\n/* length code for each normalized match length (0 == MIN_MATCH) */\n\nvar base_length = new Array(LENGTH_CODES);\nzero(base_length);\n/* First normalized length for each code (0 = MIN_MATCH) */\n\nvar base_dist = new Array(D_CODES);\nzero(base_dist);\n/* First normalized distance for each code (0 = distance of 1) */\n\nfunction StaticTreeDesc(static_tree, extra_bits, extra_base, elems, max_length) {\n this.static_tree = static_tree; /* static tree or NULL */\n this.extra_bits = extra_bits; /* extra bits for each code or NULL */\n this.extra_base = extra_base; /* base index for extra_bits */\n this.elems = elems; /* max number of elements in the tree */\n this.max_length = max_length; /* max bit length for the codes */\n\n // show if `static_tree` has data or dummy - needed for monomorphic objects\n this.has_stree = static_tree && static_tree.length;\n}\nvar static_l_desc;\nvar static_d_desc;\nvar static_bl_desc;\nfunction TreeDesc(dyn_tree, stat_desc) {\n this.dyn_tree = dyn_tree; /* the dynamic tree */\n this.max_code = 0; /* largest code with non zero frequency */\n this.stat_desc = stat_desc; /* the corresponding static tree */\n}\nfunction d_code(dist) {\n return dist < 256 ? _dist_code[dist] : _dist_code[256 + (dist >>> 7)];\n}\n\n/* ===========================================================================\n * Output a short LSB first on the stream.\n * IN assertion: there is enough room in pendingBuf.\n */\nfunction put_short(s, w) {\n // put_byte(s, (uch)((w) & 0xff));\n // put_byte(s, (uch)((ush)(w) >> 8));\n s.pending_buf[s.pending++] = w & 0xff;\n s.pending_buf[s.pending++] = w >>> 8 & 0xff;\n}\n\n/* ===========================================================================\n * Send a value on a given number of bits.\n * IN assertion: length <= 16 and value fits in length bits.\n */\nfunction send_bits(s, value, length) {\n if (s.bi_valid > Buf_size - length) {\n s.bi_buf |= value << s.bi_valid & 0xffff;\n put_short(s, s.bi_buf);\n s.bi_buf = value >> Buf_size - s.bi_valid;\n s.bi_valid += length - Buf_size;\n } else {\n s.bi_buf |= value << s.bi_valid & 0xffff;\n s.bi_valid += length;\n }\n}\nfunction send_code(s, c, tree) {\n send_bits(s, tree[c * 2] /*.Code*/, tree[c * 2 + 1] /*.Len*/);\n}\n\n/* ===========================================================================\n * Reverse the first len bits of a code, using straightforward code (a faster\n * method would use a table)\n * IN assertion: 1 <= len <= 15\n */\nfunction bi_reverse(code, len) {\n var res = 0;\n do {\n res |= code & 1;\n code >>>= 1;\n res <<= 1;\n } while (--len > 0);\n return res >>> 1;\n}\n\n/* ===========================================================================\n * Flush the bit buffer, keeping at most 7 bits in it.\n */\nfunction bi_flush(s) {\n if (s.bi_valid === 16) {\n put_short(s, s.bi_buf);\n s.bi_buf = 0;\n s.bi_valid = 0;\n } else if (s.bi_valid >= 8) {\n s.pending_buf[s.pending++] = s.bi_buf & 0xff;\n s.bi_buf >>= 8;\n s.bi_valid -= 8;\n }\n}\n\n/* ===========================================================================\n * Compute the optimal bit lengths for a tree and update the total bit length\n * for the current block.\n * IN assertion: the fields freq and dad are set, heap[heap_max] and\n * above are the tree nodes sorted by increasing frequency.\n * OUT assertions: the field len is set to the optimal bit length, the\n * array bl_count contains the frequencies for each bit length.\n * The length opt_len is updated; static_len is also updated if stree is\n * not null.\n */\nfunction gen_bitlen(s, desc)\n// deflate_state *s;\n// tree_desc *desc; /* the tree descriptor */\n{\n var tree = desc.dyn_tree;\n var max_code = desc.max_code;\n var stree = desc.stat_desc.static_tree;\n var has_stree = desc.stat_desc.has_stree;\n var extra = desc.stat_desc.extra_bits;\n var base = desc.stat_desc.extra_base;\n var max_length = desc.stat_desc.max_length;\n var h; /* heap index */\n var n, m; /* iterate over the tree elements */\n var bits; /* bit length */\n var xbits; /* extra bits */\n var f; /* frequency */\n var overflow = 0; /* number of elements with bit length too large */\n\n for (bits = 0; bits <= MAX_BITS; bits++) {\n s.bl_count[bits] = 0;\n }\n\n /* In a first pass, compute the optimal bit lengths (which may\n * overflow in the case of the bit length tree).\n */\n tree[s.heap[s.heap_max] * 2 + 1] /*.Len*/ = 0; /* root of the heap */\n\n for (h = s.heap_max + 1; h < HEAP_SIZE; h++) {\n n = s.heap[h];\n bits = tree[tree[n * 2 + 1] /*.Dad*/ * 2 + 1] /*.Len*/ + 1;\n if (bits > max_length) {\n bits = max_length;\n overflow++;\n }\n tree[n * 2 + 1] /*.Len*/ = bits;\n /* We overwrite tree[n].Dad which is no longer needed */\n\n if (n > max_code) {\n continue;\n } /* not a leaf node */\n\n s.bl_count[bits]++;\n xbits = 0;\n if (n >= base) {\n xbits = extra[n - base];\n }\n f = tree[n * 2] /*.Freq*/;\n s.opt_len += f * (bits + xbits);\n if (has_stree) {\n s.static_len += f * (stree[n * 2 + 1] /*.Len*/ + xbits);\n }\n }\n if (overflow === 0) {\n return;\n }\n\n // Trace((stderr,\"\\nbit length overflow\\n\"));\n /* This happens for example on obj2 and pic of the Calgary corpus */\n\n /* Find the first bit length which could increase: */\n do {\n bits = max_length - 1;\n while (s.bl_count[bits] === 0) {\n bits--;\n }\n s.bl_count[bits]--; /* move one leaf down the tree */\n s.bl_count[bits + 1] += 2; /* move one overflow item as its brother */\n s.bl_count[max_length]--;\n /* The brother of the overflow item also moves one step up,\n * but this does not affect bl_count[max_length]\n */\n overflow -= 2;\n } while (overflow > 0);\n\n /* Now recompute all bit lengths, scanning in increasing frequency.\n * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all\n * lengths instead of fixing only the wrong ones. This idea is taken\n * from 'ar' written by Haruhiko Okumura.)\n */\n for (bits = max_length; bits !== 0; bits--) {\n n = s.bl_count[bits];\n while (n !== 0) {\n m = s.heap[--h];\n if (m > max_code) {\n continue;\n }\n if (tree[m * 2 + 1] /*.Len*/ !== bits) {\n // Trace((stderr,\"code %d bits %d->%d\\n\", m, tree[m].Len, bits));\n s.opt_len += (bits - tree[m * 2 + 1] /*.Len*/) * tree[m * 2] /*.Freq*/;\n tree[m * 2 + 1] /*.Len*/ = bits;\n }\n n--;\n }\n }\n}\n\n/* ===========================================================================\n * Generate the codes for a given tree and bit counts (which need not be\n * optimal).\n * IN assertion: the array bl_count contains the bit length statistics for\n * the given tree and the field len is set for all tree elements.\n * OUT assertion: the field code is set for all tree elements of non\n * zero code length.\n */\nfunction gen_codes(tree, max_code, bl_count)\n// ct_data *tree; /* the tree to decorate */\n// int max_code; /* largest code with non zero frequency */\n// ushf *bl_count; /* number of codes at each bit length */\n{\n var next_code = new Array(MAX_BITS + 1); /* next code value for each bit length */\n var code = 0; /* running code value */\n var bits; /* bit index */\n var n; /* code index */\n\n /* The distribution counts are first used to generate the code values\n * without bit reversal.\n */\n for (bits = 1; bits <= MAX_BITS; bits++) {\n next_code[bits] = code = code + bl_count[bits - 1] << 1;\n }\n /* Check that the bit counts in bl_count are consistent. The last code\n * must be all ones.\n */\n //Assert (code + bl_count[MAX_BITS]-1 == (1< length code (0..28) */\n length = 0;\n for (code = 0; code < LENGTH_CODES - 1; code++) {\n base_length[code] = length;\n for (n = 0; n < 1 << extra_lbits[code]; n++) {\n _length_code[length++] = code;\n }\n }\n //Assert (length == 256, \"tr_static_init: length != 256\");\n /* Note that the length 255 (match length 258) can be represented\n * in two different ways: code 284 + 5 bits or code 285, so we\n * overwrite length_code[255] to use the best encoding:\n */\n _length_code[length - 1] = code;\n\n /* Initialize the mapping dist (0..32K) -> dist code (0..29) */\n dist = 0;\n for (code = 0; code < 16; code++) {\n base_dist[code] = dist;\n for (n = 0; n < 1 << extra_dbits[code]; n++) {\n _dist_code[dist++] = code;\n }\n }\n //Assert (dist == 256, \"tr_static_init: dist != 256\");\n dist >>= 7; /* from now on, all distances are divided by 128 */\n for (; code < D_CODES; code++) {\n base_dist[code] = dist << 7;\n for (n = 0; n < 1 << extra_dbits[code] - 7; n++) {\n _dist_code[256 + dist++] = code;\n }\n }\n //Assert (dist == 256, \"tr_static_init: 256+dist != 512\");\n\n /* Construct the codes of the static literal tree */\n for (bits = 0; bits <= MAX_BITS; bits++) {\n bl_count[bits] = 0;\n }\n n = 0;\n while (n <= 143) {\n static_ltree[n * 2 + 1] /*.Len*/ = 8;\n n++;\n bl_count[8]++;\n }\n while (n <= 255) {\n static_ltree[n * 2 + 1] /*.Len*/ = 9;\n n++;\n bl_count[9]++;\n }\n while (n <= 279) {\n static_ltree[n * 2 + 1] /*.Len*/ = 7;\n n++;\n bl_count[7]++;\n }\n while (n <= 287) {\n static_ltree[n * 2 + 1] /*.Len*/ = 8;\n n++;\n bl_count[8]++;\n }\n /* Codes 286 and 287 do not exist, but we must include them in the\n * tree construction to get a canonical Huffman tree (longest code\n * all ones)\n */\n gen_codes(static_ltree, L_CODES + 1, bl_count);\n\n /* The static distance tree is trivial: */\n for (n = 0; n < D_CODES; n++) {\n static_dtree[n * 2 + 1] /*.Len*/ = 5;\n static_dtree[n * 2] /*.Code*/ = bi_reverse(n, 5);\n }\n\n // Now data ready and we can init static trees\n static_l_desc = new StaticTreeDesc(static_ltree, extra_lbits, LITERALS + 1, L_CODES, MAX_BITS);\n static_d_desc = new StaticTreeDesc(static_dtree, extra_dbits, 0, D_CODES, MAX_BITS);\n static_bl_desc = new StaticTreeDesc(new Array(0), extra_blbits, 0, BL_CODES, MAX_BL_BITS);\n\n //static_init_done = true;\n}\n\n/* ===========================================================================\n * Initialize a new block.\n */\nfunction init_block(s) {\n var n; /* iterates over tree elements */\n\n /* Initialize the trees. */\n for (n = 0; n < L_CODES; n++) {\n s.dyn_ltree[n * 2] /*.Freq*/ = 0;\n }\n for (n = 0; n < D_CODES; n++) {\n s.dyn_dtree[n * 2] /*.Freq*/ = 0;\n }\n for (n = 0; n < BL_CODES; n++) {\n s.bl_tree[n * 2] /*.Freq*/ = 0;\n }\n s.dyn_ltree[END_BLOCK * 2] /*.Freq*/ = 1;\n s.opt_len = s.static_len = 0;\n s.last_lit = s.matches = 0;\n}\n\n/* ===========================================================================\n * Flush the bit buffer and align the output on a byte boundary\n */\nfunction bi_windup(s) {\n if (s.bi_valid > 8) {\n put_short(s, s.bi_buf);\n } else if (s.bi_valid > 0) {\n //put_byte(s, (Byte)s->bi_buf);\n s.pending_buf[s.pending++] = s.bi_buf;\n }\n s.bi_buf = 0;\n s.bi_valid = 0;\n}\n\n/* ===========================================================================\n * Copy a stored block, storing first the length and its\n * one's complement if requested.\n */\nfunction copy_block(s, buf, len, header)\n//DeflateState *s;\n//charf *buf; /* the input data */\n//unsigned len; /* its length */\n//int header; /* true if block header must be written */\n{\n bi_windup(s); /* align on byte boundary */\n\n if (header) {\n put_short(s, len);\n put_short(s, ~len);\n }\n // while (len--) {\n // put_byte(s, *buf++);\n // }\n utils.arraySet(s.pending_buf, s.window, buf, len, s.pending);\n s.pending += len;\n}\n\n/* ===========================================================================\n * Compares to subtrees, using the tree depth as tie breaker when\n * the subtrees have equal frequency. This minimizes the worst case length.\n */\nfunction smaller(tree, n, m, depth) {\n var _n2 = n * 2;\n var _m2 = m * 2;\n return tree[_n2] /*.Freq*/ < tree[_m2] /*.Freq*/ || tree[_n2] /*.Freq*/ === tree[_m2] /*.Freq*/ && depth[n] <= depth[m];\n}\n\n/* ===========================================================================\n * Restore the heap property by moving down the tree starting at node k,\n * exchanging a node with the smallest of its two sons if necessary, stopping\n * when the heap property is re-established (each father smaller than its\n * two sons).\n */\nfunction pqdownheap(s, tree, k)\n// deflate_state *s;\n// ct_data *tree; /* the tree to restore */\n// int k; /* node to move down */\n{\n var v = s.heap[k];\n var j = k << 1; /* left son of k */\n while (j <= s.heap_len) {\n /* Set j to the smallest of the two sons: */\n if (j < s.heap_len && smaller(tree, s.heap[j + 1], s.heap[j], s.depth)) {\n j++;\n }\n /* Exit if v is smaller than both sons */\n if (smaller(tree, v, s.heap[j], s.depth)) {\n break;\n }\n\n /* Exchange v with the smallest son */\n s.heap[k] = s.heap[j];\n k = j;\n\n /* And continue down the tree, setting j to the left son of k */\n j <<= 1;\n }\n s.heap[k] = v;\n}\n\n// inlined manually\n// var SMALLEST = 1;\n\n/* ===========================================================================\n * Send the block data compressed using the given Huffman trees\n */\nfunction compress_block(s, ltree, dtree)\n// deflate_state *s;\n// const ct_data *ltree; /* literal tree */\n// const ct_data *dtree; /* distance tree */\n{\n var dist; /* distance of matched string */\n var lc; /* match length or unmatched char (if dist == 0) */\n var lx = 0; /* running index in l_buf */\n var code; /* the code to send */\n var extra; /* number of extra bits to send */\n\n if (s.last_lit !== 0) {\n do {\n dist = s.pending_buf[s.d_buf + lx * 2] << 8 | s.pending_buf[s.d_buf + lx * 2 + 1];\n lc = s.pending_buf[s.l_buf + lx];\n lx++;\n if (dist === 0) {\n send_code(s, lc, ltree); /* send a literal byte */\n //Tracecv(isgraph(lc), (stderr,\" '%c' \", lc));\n } else {\n /* Here, lc is the match length - MIN_MATCH */\n code = _length_code[lc];\n send_code(s, code + LITERALS + 1, ltree); /* send the length code */\n extra = extra_lbits[code];\n if (extra !== 0) {\n lc -= base_length[code];\n send_bits(s, lc, extra); /* send the extra length bits */\n }\n dist--; /* dist is now the match distance - 1 */\n code = d_code(dist);\n //Assert (code < D_CODES, \"bad d_code\");\n\n send_code(s, code, dtree); /* send the distance code */\n extra = extra_dbits[code];\n if (extra !== 0) {\n dist -= base_dist[code];\n send_bits(s, dist, extra); /* send the extra distance bits */\n }\n } /* literal or match pair ? */\n\n /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */\n //Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx,\n // \"pendingBuf overflow\");\n } while (lx < s.last_lit);\n }\n send_code(s, END_BLOCK, ltree);\n}\n\n/* ===========================================================================\n * Construct one Huffman tree and assigns the code bit strings and lengths.\n * Update the total bit length for the current block.\n * IN assertion: the field freq is set for all tree elements.\n * OUT assertions: the fields len and code are set to the optimal bit length\n * and corresponding code. The length opt_len is updated; static_len is\n * also updated if stree is not null. The field max_code is set.\n */\nfunction build_tree(s, desc)\n// deflate_state *s;\n// tree_desc *desc; /* the tree descriptor */\n{\n var tree = desc.dyn_tree;\n var stree = desc.stat_desc.static_tree;\n var has_stree = desc.stat_desc.has_stree;\n var elems = desc.stat_desc.elems;\n var n, m; /* iterate over heap elements */\n var max_code = -1; /* largest code with non zero frequency */\n var node; /* new node being created */\n\n /* Construct the initial heap, with least frequent element in\n * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1].\n * heap[0] is not used.\n */\n s.heap_len = 0;\n s.heap_max = HEAP_SIZE;\n for (n = 0; n < elems; n++) {\n if (tree[n * 2] /*.Freq*/ !== 0) {\n s.heap[++s.heap_len] = max_code = n;\n s.depth[n] = 0;\n } else {\n tree[n * 2 + 1] /*.Len*/ = 0;\n }\n }\n\n /* The pkzip format requires that at least one distance code exists,\n * and that at least one bit should be sent even if there is only one\n * possible code. So to avoid special checks later on we force at least\n * two codes of non zero frequency.\n */\n while (s.heap_len < 2) {\n node = s.heap[++s.heap_len] = max_code < 2 ? ++max_code : 0;\n tree[node * 2] /*.Freq*/ = 1;\n s.depth[node] = 0;\n s.opt_len--;\n if (has_stree) {\n s.static_len -= stree[node * 2 + 1] /*.Len*/;\n }\n /* node is 0 or 1 so it does not have extra bits */\n }\n desc.max_code = max_code;\n\n /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree,\n * establish sub-heaps of increasing lengths:\n */\n for (n = s.heap_len >> 1 /*int /2*/; n >= 1; n--) {\n pqdownheap(s, tree, n);\n }\n\n /* Construct the Huffman tree by repeatedly combining the least two\n * frequent nodes.\n */\n node = elems; /* next internal node of the tree */\n do {\n //pqremove(s, tree, n); /* n = node of least frequency */\n /*** pqremove ***/\n n = s.heap[1 /*SMALLEST*/];\n s.heap[1 /*SMALLEST*/] = s.heap[s.heap_len--];\n pqdownheap(s, tree, 1 /*SMALLEST*/);\n /***/\n\n m = s.heap[1 /*SMALLEST*/]; /* m = node of next least frequency */\n\n s.heap[--s.heap_max] = n; /* keep the nodes sorted by frequency */\n s.heap[--s.heap_max] = m;\n\n /* Create a new node father of n and m */\n tree[node * 2] /*.Freq*/ = tree[n * 2] /*.Freq*/ + tree[m * 2] /*.Freq*/;\n s.depth[node] = (s.depth[n] >= s.depth[m] ? s.depth[n] : s.depth[m]) + 1;\n tree[n * 2 + 1] /*.Dad*/ = tree[m * 2 + 1] /*.Dad*/ = node;\n\n /* and insert the new node in the heap */\n s.heap[1 /*SMALLEST*/] = node++;\n pqdownheap(s, tree, 1 /*SMALLEST*/);\n } while (s.heap_len >= 2);\n s.heap[--s.heap_max] = s.heap[1 /*SMALLEST*/];\n\n /* At this point, the fields freq and dad are set. We can now\n * generate the bit lengths.\n */\n gen_bitlen(s, desc);\n\n /* The field len is now set, we can generate the bit codes */\n gen_codes(tree, max_code, s.bl_count);\n}\n\n/* ===========================================================================\n * Scan a literal or distance tree to determine the frequencies of the codes\n * in the bit length tree.\n */\nfunction scan_tree(s, tree, max_code)\n// deflate_state *s;\n// ct_data *tree; /* the tree to be scanned */\n// int max_code; /* and its largest code of non zero frequency */\n{\n var n; /* iterates over all tree elements */\n var prevlen = -1; /* last emitted length */\n var curlen; /* length of current code */\n\n var nextlen = tree[0 * 2 + 1] /*.Len*/; /* length of next code */\n\n var count = 0; /* repeat count of the current code */\n var max_count = 7; /* max repeat count */\n var min_count = 4; /* min repeat count */\n\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n }\n tree[(max_code + 1) * 2 + 1] /*.Len*/ = 0xffff; /* guard */\n\n for (n = 0; n <= max_code; n++) {\n curlen = nextlen;\n nextlen = tree[(n + 1) * 2 + 1] /*.Len*/;\n if (++count < max_count && curlen === nextlen) {\n continue;\n } else if (count < min_count) {\n s.bl_tree[curlen * 2] /*.Freq*/ += count;\n } else if (curlen !== 0) {\n if (curlen !== prevlen) {\n s.bl_tree[curlen * 2] /*.Freq*/++;\n }\n s.bl_tree[REP_3_6 * 2] /*.Freq*/++;\n } else if (count <= 10) {\n s.bl_tree[REPZ_3_10 * 2] /*.Freq*/++;\n } else {\n s.bl_tree[REPZ_11_138 * 2] /*.Freq*/++;\n }\n count = 0;\n prevlen = curlen;\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n } else if (curlen === nextlen) {\n max_count = 6;\n min_count = 3;\n } else {\n max_count = 7;\n min_count = 4;\n }\n }\n}\n\n/* ===========================================================================\n * Send a literal or distance tree in compressed form, using the codes in\n * bl_tree.\n */\nfunction send_tree(s, tree, max_code)\n// deflate_state *s;\n// ct_data *tree; /* the tree to be scanned */\n// int max_code; /* and its largest code of non zero frequency */\n{\n var n; /* iterates over all tree elements */\n var prevlen = -1; /* last emitted length */\n var curlen; /* length of current code */\n\n var nextlen = tree[0 * 2 + 1] /*.Len*/; /* length of next code */\n\n var count = 0; /* repeat count of the current code */\n var max_count = 7; /* max repeat count */\n var min_count = 4; /* min repeat count */\n\n /* tree[max_code+1].Len = -1; */ /* guard already set */\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n }\n for (n = 0; n <= max_code; n++) {\n curlen = nextlen;\n nextlen = tree[(n + 1) * 2 + 1] /*.Len*/;\n if (++count < max_count && curlen === nextlen) {\n continue;\n } else if (count < min_count) {\n do {\n send_code(s, curlen, s.bl_tree);\n } while (--count !== 0);\n } else if (curlen !== 0) {\n if (curlen !== prevlen) {\n send_code(s, curlen, s.bl_tree);\n count--;\n }\n //Assert(count >= 3 && count <= 6, \" 3_6?\");\n send_code(s, REP_3_6, s.bl_tree);\n send_bits(s, count - 3, 2);\n } else if (count <= 10) {\n send_code(s, REPZ_3_10, s.bl_tree);\n send_bits(s, count - 3, 3);\n } else {\n send_code(s, REPZ_11_138, s.bl_tree);\n send_bits(s, count - 11, 7);\n }\n count = 0;\n prevlen = curlen;\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n } else if (curlen === nextlen) {\n max_count = 6;\n min_count = 3;\n } else {\n max_count = 7;\n min_count = 4;\n }\n }\n}\n\n/* ===========================================================================\n * Construct the Huffman tree for the bit lengths and return the index in\n * bl_order of the last bit length code to send.\n */\nfunction build_bl_tree(s) {\n var max_blindex; /* index of last bit length code of non zero freq */\n\n /* Determine the bit length frequencies for literal and distance trees */\n scan_tree(s, s.dyn_ltree, s.l_desc.max_code);\n scan_tree(s, s.dyn_dtree, s.d_desc.max_code);\n\n /* Build the bit length tree: */\n build_tree(s, s.bl_desc);\n /* opt_len now includes the length of the tree representations, except\n * the lengths of the bit lengths codes and the 5+5+4 bits for the counts.\n */\n\n /* Determine the number of bit length codes to send. The pkzip format\n * requires that at least 4 bit length codes be sent. (appnote.txt says\n * 3 but the actual value used is 4.)\n */\n for (max_blindex = BL_CODES - 1; max_blindex >= 3; max_blindex--) {\n if (s.bl_tree[bl_order[max_blindex] * 2 + 1] /*.Len*/ !== 0) {\n break;\n }\n }\n /* Update opt_len to include the bit length tree and counts */\n s.opt_len += 3 * (max_blindex + 1) + 5 + 5 + 4;\n //Tracev((stderr, \"\\ndyn trees: dyn %ld, stat %ld\",\n // s->opt_len, s->static_len));\n\n return max_blindex;\n}\n\n/* ===========================================================================\n * Send the header for a block using dynamic Huffman trees: the counts, the\n * lengths of the bit length codes, the literal tree and the distance tree.\n * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.\n */\nfunction send_all_trees(s, lcodes, dcodes, blcodes)\n// deflate_state *s;\n// int lcodes, dcodes, blcodes; /* number of codes for each tree */\n{\n var rank; /* index in bl_order */\n\n //Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, \"not enough codes\");\n //Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES,\n // \"too many codes\");\n //Tracev((stderr, \"\\nbl counts: \"));\n send_bits(s, lcodes - 257, 5); /* not +255 as stated in appnote.txt */\n send_bits(s, dcodes - 1, 5);\n send_bits(s, blcodes - 4, 4); /* not -3 as stated in appnote.txt */\n for (rank = 0; rank < blcodes; rank++) {\n //Tracev((stderr, \"\\nbl code %2d \", bl_order[rank]));\n send_bits(s, s.bl_tree[bl_order[rank] * 2 + 1] /*.Len*/, 3);\n }\n //Tracev((stderr, \"\\nbl tree: sent %ld\", s->bits_sent));\n\n send_tree(s, s.dyn_ltree, lcodes - 1); /* literal tree */\n //Tracev((stderr, \"\\nlit tree: sent %ld\", s->bits_sent));\n\n send_tree(s, s.dyn_dtree, dcodes - 1); /* distance tree */\n //Tracev((stderr, \"\\ndist tree: sent %ld\", s->bits_sent));\n}\n\n/* ===========================================================================\n * Check if the data type is TEXT or BINARY, using the following algorithm:\n * - TEXT if the two conditions below are satisfied:\n * a) There are no non-portable control characters belonging to the\n * \"black list\" (0..6, 14..25, 28..31).\n * b) There is at least one printable character belonging to the\n * \"white list\" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255).\n * - BINARY otherwise.\n * - The following partially-portable control characters form a\n * \"gray list\" that is ignored in this detection algorithm:\n * (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}).\n * IN assertion: the fields Freq of dyn_ltree are set.\n */\nfunction detect_data_type(s) {\n /* black_mask is the bit mask of black-listed bytes\n * set bits 0..6, 14..25, and 28..31\n * 0xf3ffc07f = binary 11110011111111111100000001111111\n */\n var black_mask = 0xf3ffc07f;\n var n;\n\n /* Check for non-textual (\"black-listed\") bytes. */\n for (n = 0; n <= 31; n++, black_mask >>>= 1) {\n if (black_mask & 1 && s.dyn_ltree[n * 2] /*.Freq*/ !== 0) {\n return Z_BINARY;\n }\n }\n\n /* Check for textual (\"white-listed\") bytes. */\n if (s.dyn_ltree[9 * 2] /*.Freq*/ !== 0 || s.dyn_ltree[10 * 2] /*.Freq*/ !== 0 || s.dyn_ltree[13 * 2] /*.Freq*/ !== 0) {\n return Z_TEXT;\n }\n for (n = 32; n < LITERALS; n++) {\n if (s.dyn_ltree[n * 2] /*.Freq*/ !== 0) {\n return Z_TEXT;\n }\n }\n\n /* There are no \"black-listed\" or \"white-listed\" bytes:\n * this stream either is empty or has tolerated (\"gray-listed\") bytes only.\n */\n return Z_BINARY;\n}\nvar static_init_done = false;\n\n/* ===========================================================================\n * Initialize the tree data structures for a new zlib stream.\n */\nfunction _tr_init(s) {\n if (!static_init_done) {\n tr_static_init();\n static_init_done = true;\n }\n s.l_desc = new TreeDesc(s.dyn_ltree, static_l_desc);\n s.d_desc = new TreeDesc(s.dyn_dtree, static_d_desc);\n s.bl_desc = new TreeDesc(s.bl_tree, static_bl_desc);\n s.bi_buf = 0;\n s.bi_valid = 0;\n\n /* Initialize the first block of the first file: */\n init_block(s);\n}\n\n/* ===========================================================================\n * Send a stored block\n */\nfunction _tr_stored_block(s, buf, stored_len, last)\n//DeflateState *s;\n//charf *buf; /* input block */\n//ulg stored_len; /* length of input block */\n//int last; /* one if this is the last block for a file */\n{\n send_bits(s, (STORED_BLOCK << 1) + (last ? 1 : 0), 3); /* send block type */\n copy_block(s, buf, stored_len, true); /* with header */\n}\n\n/* ===========================================================================\n * Send one empty static block to give enough lookahead for inflate.\n * This takes 10 bits, of which 7 may remain in the bit buffer.\n */\nfunction _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}\n\n/* ===========================================================================\n * Determine the best encoding for the current block: dynamic trees, static\n * trees or store, and output the encoded block to the zip file.\n */\nfunction _tr_flush_block(s, buf, stored_len, last)\n//DeflateState *s;\n//charf *buf; /* input block, or NULL if too old */\n//ulg stored_len; /* length of input block */\n//int last; /* one if this is the last block for a file */\n{\n var opt_lenb, static_lenb; /* opt_len and static_len in bytes */\n var max_blindex = 0; /* index of last bit length code of non zero freq */\n\n /* Build the Huffman trees unless a stored block is forced */\n if (s.level > 0) {\n /* Check if the file is binary or text */\n if (s.strm.data_type === Z_UNKNOWN) {\n s.strm.data_type = detect_data_type(s);\n }\n\n /* Construct the literal and distance trees */\n build_tree(s, s.l_desc);\n // Tracev((stderr, \"\\nlit data: dyn %ld, stat %ld\", s->opt_len,\n // s->static_len));\n\n build_tree(s, s.d_desc);\n // Tracev((stderr, \"\\ndist data: dyn %ld, stat %ld\", s->opt_len,\n // s->static_len));\n /* At this point, opt_len and static_len are the total bit lengths of\n * the compressed block data, excluding the tree representations.\n */\n\n /* Build the bit length tree for the above two trees, and get the index\n * in bl_order of the last bit length code to send.\n */\n max_blindex = build_bl_tree(s);\n\n /* Determine the best encoding. Compute the block lengths in bytes. */\n opt_lenb = s.opt_len + 3 + 7 >>> 3;\n static_lenb = s.static_len + 3 + 7 >>> 3;\n\n // Tracev((stderr, \"\\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u \",\n // opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,\n // s->last_lit));\n\n if (static_lenb <= opt_lenb) {\n opt_lenb = static_lenb;\n }\n } else {\n // Assert(buf != (char*)0, \"lost buf\");\n opt_lenb = static_lenb = stored_len + 5; /* force a stored block */\n }\n if (stored_len + 4 <= opt_lenb && buf !== -1) {\n /* 4: two words for the lengths */\n\n /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE.\n * Otherwise we can't have processed more than WSIZE input bytes since\n * the last block flush, because compression would have been\n * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to\n * transform a block into a stored block.\n */\n _tr_stored_block(s, buf, stored_len, last);\n } else if (s.strategy === Z_FIXED || static_lenb === opt_lenb) {\n send_bits(s, (STATIC_TREES << 1) + (last ? 1 : 0), 3);\n compress_block(s, static_ltree, static_dtree);\n } else {\n send_bits(s, (DYN_TREES << 1) + (last ? 1 : 0), 3);\n send_all_trees(s, s.l_desc.max_code + 1, s.d_desc.max_code + 1, max_blindex + 1);\n compress_block(s, s.dyn_ltree, s.dyn_dtree);\n }\n // Assert (s->compressed_len == s->bits_sent, \"bad compressed size\");\n /* The above check is made mod 2^32, for files larger than 512 MB\n * and uLong implemented on 32 bits.\n */\n init_block(s);\n if (last) {\n bi_windup(s);\n }\n // Tracev((stderr,\"\\ncomprlen %lu(%lu) \", s->compressed_len>>3,\n // s->compressed_len-7*last));\n}\n\n/* ===========================================================================\n * Save the match info and tally the frequency counts. Return true if\n * the current block must be flushed.\n */\nfunction _tr_tally(s, dist, lc)\n// deflate_state *s;\n// unsigned dist; /* distance of matched string */\n// unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */\n{\n //var out_length, in_length, dcode;\n\n s.pending_buf[s.d_buf + s.last_lit * 2] = dist >>> 8 & 0xff;\n s.pending_buf[s.d_buf + s.last_lit * 2 + 1] = dist & 0xff;\n s.pending_buf[s.l_buf + s.last_lit] = lc & 0xff;\n s.last_lit++;\n if (dist === 0) {\n /* lc is the unmatched char */\n s.dyn_ltree[lc * 2] /*.Freq*/++;\n } else {\n s.matches++;\n /* Here, lc is the match length - MIN_MATCH */\n dist--; /* dist = match distance - 1 */\n //Assert((ush)dist < (ush)MAX_DIST(s) &&\n // (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) &&\n // (ush)d_code(dist) < (ush)D_CODES, \"_tr_tally: bad match\");\n\n s.dyn_ltree[(_length_code[lc] + LITERALS + 1) * 2] /*.Freq*/++;\n s.dyn_dtree[d_code(dist) * 2] /*.Freq*/++;\n }\n\n // (!) This block is disabled in zlib defaults,\n // don't enable it for binary compatibility\n\n //#ifdef TRUNCATE_BLOCK\n // /* Try to guess if it is profitable to stop the current block here */\n // if ((s.last_lit & 0x1fff) === 0 && s.level > 2) {\n // /* Compute an upper bound for the compressed length */\n // out_length = s.last_lit*8;\n // in_length = s.strstart - s.block_start;\n //\n // for (dcode = 0; dcode < D_CODES; dcode++) {\n // out_length += s.dyn_dtree[dcode*2]/*.Freq*/ * (5 + extra_dbits[dcode]);\n // }\n // out_length >>>= 3;\n // //Tracev((stderr,\"\\nlast_lit %u, in %ld, out ~%ld(%ld%%) \",\n // // s->last_lit, in_length, out_length,\n // // 100L - out_length*100L/in_length));\n // if (s.matches < (s.last_lit>>1)/*int /2*/ && out_length < (in_length>>1)/*int /2*/) {\n // return true;\n // }\n // }\n //#endif\n\n return s.last_lit === s.lit_bufsize - 1;\n /* We avoid equality with lit_bufsize because of wraparound at 64K\n * on 16 bit machines and because stored blocks are restricted to\n * 64K-1 bytes.\n */\n}\nexports._tr_init = _tr_init;\nexports._tr_stored_block = _tr_stored_block;\nexports._tr_flush_block = _tr_flush_block;\nexports._tr_tally = _tr_tally;\nexports._tr_align = _tr_align;","'use strict';\n\n// Note: adler32 takes 12% for level 0 and 2% for level 6.\n// It isn't worth it to make additional optimizations as in original.\n// Small size is preferable.\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\nfunction adler32(adler, buf, len, pos) {\n var s1 = adler & 0xffff | 0,\n s2 = adler >>> 16 & 0xffff | 0,\n n = 0;\n while (len !== 0) {\n // Set limit ~ twice less than 5552, to keep\n // s2 in 31-bits, because we force signed ints.\n // in other case %= will fail.\n n = len > 2000 ? 2000 : len;\n len -= n;\n do {\n s1 = s1 + buf[pos++] | 0;\n s2 = s2 + s1 | 0;\n } while (--n);\n s1 %= 65521;\n s2 %= 65521;\n }\n return s1 | s2 << 16 | 0;\n}\nmodule.exports = adler32;","'use strict';\n\n// Note: we can't get significant speed boost here.\n// So write code to minimize size - no pregenerated tables\n// and array tools dependencies.\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\n// Use ordinary array, since untyped makes no boost here\nfunction makeTable() {\n var c,\n table = [];\n for (var n = 0; n < 256; n++) {\n c = n;\n for (var k = 0; k < 8; k++) {\n c = c & 1 ? 0xEDB88320 ^ c >>> 1 : c >>> 1;\n }\n table[n] = c;\n }\n return table;\n}\n\n// Create table on load. Just 255 signed longs. Not a problem.\nvar crcTable = makeTable();\nfunction crc32(crc, buf, len, pos) {\n var t = crcTable,\n end = pos + len;\n crc ^= -1;\n for (var i = pos; i < end; i++) {\n crc = crc >>> 8 ^ t[(crc ^ buf[i]) & 0xFF];\n }\n return crc ^ -1; // >>> 0;\n}\nmodule.exports = crc32;","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\nmodule.exports = {\n 2: 'need dictionary',\n /* Z_NEED_DICT 2 */\n 1: 'stream end',\n /* Z_STREAM_END 1 */\n 0: '',\n /* Z_OK 0 */\n '-1': 'file error',\n /* Z_ERRNO (-1) */\n '-2': 'stream error',\n /* Z_STREAM_ERROR (-2) */\n '-3': 'data error',\n /* Z_DATA_ERROR (-3) */\n '-4': 'insufficient memory',\n /* Z_MEM_ERROR (-4) */\n '-5': 'buffer error',\n /* Z_BUF_ERROR (-5) */\n '-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */\n};","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\nvar utils = require('../utils/common');\nvar trees = require('./trees');\nvar adler32 = require('./adler32');\nvar crc32 = require('./crc32');\nvar msg = require('./messages');\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\n/* Allowed flush values; see deflate() and inflate() below for details */\nvar Z_NO_FLUSH = 0;\nvar Z_PARTIAL_FLUSH = 1;\n//var Z_SYNC_FLUSH = 2;\nvar Z_FULL_FLUSH = 3;\nvar Z_FINISH = 4;\nvar Z_BLOCK = 5;\n//var Z_TREES = 6;\n\n/* Return codes for the compression/decompression functions. Negative values\n * are errors, positive values are used for special but normal events.\n */\nvar Z_OK = 0;\nvar Z_STREAM_END = 1;\n//var Z_NEED_DICT = 2;\n//var Z_ERRNO = -1;\nvar Z_STREAM_ERROR = -2;\nvar Z_DATA_ERROR = -3;\n//var Z_MEM_ERROR = -4;\nvar Z_BUF_ERROR = -5;\n//var Z_VERSION_ERROR = -6;\n\n/* compression levels */\n//var Z_NO_COMPRESSION = 0;\n//var Z_BEST_SPEED = 1;\n//var Z_BEST_COMPRESSION = 9;\nvar Z_DEFAULT_COMPRESSION = -1;\nvar Z_FILTERED = 1;\nvar Z_HUFFMAN_ONLY = 2;\nvar Z_RLE = 3;\nvar Z_FIXED = 4;\nvar Z_DEFAULT_STRATEGY = 0;\n\n/* Possible values of the data_type field (though see inflate()) */\n//var Z_BINARY = 0;\n//var Z_TEXT = 1;\n//var Z_ASCII = 1; // = Z_TEXT\nvar Z_UNKNOWN = 2;\n\n/* The deflate compression method */\nvar Z_DEFLATED = 8;\n\n/*============================================================================*/\n\nvar MAX_MEM_LEVEL = 9;\n/* Maximum value for memLevel in deflateInit2 */\nvar MAX_WBITS = 15;\n/* 32K LZ77 window */\nvar DEF_MEM_LEVEL = 8;\nvar LENGTH_CODES = 29;\n/* number of length codes, not counting the special END_BLOCK code */\nvar LITERALS = 256;\n/* number of literal bytes 0..255 */\nvar L_CODES = LITERALS + 1 + LENGTH_CODES;\n/* number of Literal or Length codes, including the END_BLOCK code */\nvar D_CODES = 30;\n/* number of distance codes */\nvar BL_CODES = 19;\n/* number of codes used to transfer the bit lengths */\nvar HEAP_SIZE = 2 * L_CODES + 1;\n/* maximum heap size */\nvar MAX_BITS = 15;\n/* All codes must not exceed MAX_BITS bits */\n\nvar MIN_MATCH = 3;\nvar MAX_MATCH = 258;\nvar MIN_LOOKAHEAD = MAX_MATCH + MIN_MATCH + 1;\nvar PRESET_DICT = 0x20;\nvar INIT_STATE = 42;\nvar EXTRA_STATE = 69;\nvar NAME_STATE = 73;\nvar COMMENT_STATE = 91;\nvar HCRC_STATE = 103;\nvar BUSY_STATE = 113;\nvar FINISH_STATE = 666;\nvar BS_NEED_MORE = 1; /* block not completed, need more input or more output */\nvar BS_BLOCK_DONE = 2; /* block flush performed */\nvar BS_FINISH_STARTED = 3; /* finish started, need only more output at next deflate */\nvar BS_FINISH_DONE = 4; /* finish done, accept no more input or output */\n\nvar OS_CODE = 0x03; // Unix :) . Don't detect, use this default.\n\nfunction err(strm, errorCode) {\n strm.msg = msg[errorCode];\n return errorCode;\n}\nfunction rank(f) {\n return (f << 1) - (f > 4 ? 9 : 0);\n}\nfunction zero(buf) {\n var len = buf.length;\n while (--len >= 0) {\n buf[len] = 0;\n }\n}\n\n/* =========================================================================\n * Flush as much pending output as possible. All deflate() output goes\n * through this function so some applications may wish to modify it\n * to avoid allocating a large strm->output buffer and copying into it.\n * (See also read_buf()).\n */\nfunction flush_pending(strm) {\n var s = strm.state;\n\n //_tr_flush_bits(s);\n var len = s.pending;\n if (len > strm.avail_out) {\n len = strm.avail_out;\n }\n if (len === 0) {\n return;\n }\n utils.arraySet(strm.output, s.pending_buf, s.pending_out, len, strm.next_out);\n strm.next_out += len;\n s.pending_out += len;\n strm.total_out += len;\n strm.avail_out -= len;\n s.pending -= len;\n if (s.pending === 0) {\n s.pending_out = 0;\n }\n}\nfunction flush_block_only(s, last) {\n trees._tr_flush_block(s, s.block_start >= 0 ? s.block_start : -1, s.strstart - s.block_start, last);\n s.block_start = s.strstart;\n flush_pending(s.strm);\n}\nfunction put_byte(s, b) {\n s.pending_buf[s.pending++] = b;\n}\n\n/* =========================================================================\n * Put a short in the pending buffer. The 16-bit value is put in MSB order.\n * IN assertion: the stream state is correct and there is enough room in\n * pending_buf.\n */\nfunction putShortMSB(s, b) {\n // put_byte(s, (Byte)(b >> 8));\n // put_byte(s, (Byte)(b & 0xff));\n s.pending_buf[s.pending++] = b >>> 8 & 0xff;\n s.pending_buf[s.pending++] = b & 0xff;\n}\n\n/* ===========================================================================\n * Read a new buffer from the current input stream, update the adler32\n * and total number of bytes read. All deflate() input goes through\n * this function so some applications may wish to modify it to avoid\n * allocating a large strm->input buffer and copying from it.\n * (See also flush_pending()).\n */\nfunction read_buf(strm, buf, start, size) {\n var len = strm.avail_in;\n if (len > size) {\n len = size;\n }\n if (len === 0) {\n return 0;\n }\n strm.avail_in -= len;\n\n // zmemcpy(buf, strm->next_in, len);\n utils.arraySet(buf, strm.input, strm.next_in, len, start);\n if (strm.state.wrap === 1) {\n strm.adler = adler32(strm.adler, buf, len, start);\n } else if (strm.state.wrap === 2) {\n strm.adler = crc32(strm.adler, buf, len, start);\n }\n strm.next_in += len;\n strm.total_in += len;\n return len;\n}\n\n/* ===========================================================================\n * Set match_start to the longest match starting at the given string and\n * return its length. Matches shorter or equal to prev_length are discarded,\n * in which case the result is equal to prev_length and match_start is\n * garbage.\n * IN assertions: cur_match is the head of the hash chain for the current\n * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1\n * OUT assertion: the match length is not greater than s->lookahead.\n */\nfunction longest_match(s, cur_match) {\n var chain_length = s.max_chain_length; /* max hash chain length */\n var scan = s.strstart; /* current string */\n var match; /* matched string */\n var len; /* length of current match */\n var best_len = s.prev_length; /* best match length so far */\n var nice_match = s.nice_match; /* stop if match long enough */\n var limit = s.strstart > s.w_size - MIN_LOOKAHEAD ? s.strstart - (s.w_size - MIN_LOOKAHEAD) : 0 /*NIL*/;\n var _win = s.window; // shortcut\n\n var wmask = s.w_mask;\n var prev = s.prev;\n\n /* Stop when cur_match becomes <= limit. To simplify the code,\n * we prevent matches with the string of window index 0.\n */\n\n var strend = s.strstart + MAX_MATCH;\n var scan_end1 = _win[scan + best_len - 1];\n var scan_end = _win[scan + best_len];\n\n /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.\n * It is easy to get rid of this optimization if necessary.\n */\n // Assert(s->hash_bits >= 8 && MAX_MATCH == 258, \"Code too clever\");\n\n /* Do not waste too much time if we already have a good match: */\n if (s.prev_length >= s.good_match) {\n chain_length >>= 2;\n }\n /* Do not look for matches beyond the end of the input. This is necessary\n * to make deflate deterministic.\n */\n if (nice_match > s.lookahead) {\n nice_match = s.lookahead;\n }\n\n // Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, \"need lookahead\");\n\n do {\n // Assert(cur_match < s->strstart, \"no future\");\n match = cur_match;\n\n /* Skip to next match if the match length cannot increase\n * or if the match length is less than 2. Note that the checks below\n * for insufficient lookahead only occur occasionally for performance\n * reasons. Therefore uninitialized memory will be accessed, and\n * conditional jumps will be made that depend on those values.\n * However the length of the match is limited to the lookahead, so\n * the output of deflate is not affected by the uninitialized values.\n */\n\n if (_win[match + best_len] !== scan_end || _win[match + best_len - 1] !== scan_end1 || _win[match] !== _win[scan] || _win[++match] !== _win[scan + 1]) {\n continue;\n }\n\n /* The check at best_len-1 can be removed because it will be made\n * again later. (This heuristic is not always a win.)\n * It is not necessary to compare scan[2] and match[2] since they\n * are always equal when the other bytes match, given that\n * the hash keys are equal and that HASH_BITS >= 8.\n */\n scan += 2;\n match++;\n // Assert(*scan == *match, \"match[2]?\");\n\n /* We check for insufficient lookahead only every 8th comparison;\n * the 256th check will be made at strstart+258.\n */\n do {\n /*jshint noempty:false*/\n } while (_win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && scan < strend);\n\n // Assert(scan <= s->window+(unsigned)(s->window_size-1), \"wild scan\");\n\n len = MAX_MATCH - (strend - scan);\n scan = strend - MAX_MATCH;\n if (len > best_len) {\n s.match_start = cur_match;\n best_len = len;\n if (len >= nice_match) {\n break;\n }\n scan_end1 = _win[scan + best_len - 1];\n scan_end = _win[scan + best_len];\n }\n } while ((cur_match = prev[cur_match & wmask]) > limit && --chain_length !== 0);\n if (best_len <= s.lookahead) {\n return best_len;\n }\n return s.lookahead;\n}\n\n/* ===========================================================================\n * Fill the window when the lookahead becomes insufficient.\n * Updates strstart and lookahead.\n *\n * IN assertion: lookahead < MIN_LOOKAHEAD\n * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD\n * At least one byte has been read, or avail_in == 0; reads are\n * performed for at least two bytes (required for the zip translate_eol\n * option -- not supported here).\n */\nfunction fill_window(s) {\n var _w_size = s.w_size;\n var p, n, m, more, str;\n\n //Assert(s->lookahead < MIN_LOOKAHEAD, \"already enough lookahead\");\n\n do {\n more = s.window_size - s.lookahead - s.strstart;\n\n // JS ints have 32 bit, block below not needed\n /* Deal with !@#$% 64K limit: */\n //if (sizeof(int) <= 2) {\n // if (more == 0 && s->strstart == 0 && s->lookahead == 0) {\n // more = wsize;\n //\n // } else if (more == (unsigned)(-1)) {\n // /* Very unlikely, but possible on 16 bit machine if\n // * strstart == 0 && lookahead == 1 (input done a byte at time)\n // */\n // more--;\n // }\n //}\n\n /* If the window is almost full and there is insufficient lookahead,\n * move the upper half to the lower one to make room in the upper half.\n */\n if (s.strstart >= _w_size + (_w_size - MIN_LOOKAHEAD)) {\n utils.arraySet(s.window, s.window, _w_size, _w_size, 0);\n s.match_start -= _w_size;\n s.strstart -= _w_size;\n /* we now have strstart >= MAX_DIST */\n s.block_start -= _w_size;\n\n /* Slide the hash table (could be avoided with 32 bit values\n at the expense of memory usage). We slide even when level == 0\n to keep the hash table consistent if we switch back to level > 0\n later. (Using level 0 permanently is not an optimal usage of\n zlib, so we don't care about this pathological case.)\n */\n\n n = s.hash_size;\n p = n;\n do {\n m = s.head[--p];\n s.head[p] = m >= _w_size ? m - _w_size : 0;\n } while (--n);\n n = _w_size;\n p = n;\n do {\n m = s.prev[--p];\n s.prev[p] = m >= _w_size ? m - _w_size : 0;\n /* If n is not on any hash chain, prev[n] is garbage but\n * its value will never be used.\n */\n } while (--n);\n more += _w_size;\n }\n if (s.strm.avail_in === 0) {\n break;\n }\n\n /* If there was no sliding:\n * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 &&\n * more == window_size - lookahead - strstart\n * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1)\n * => more >= window_size - 2*WSIZE + 2\n * In the BIG_MEM or MMAP case (not yet supported),\n * window_size == input_size + MIN_LOOKAHEAD &&\n * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD.\n * Otherwise, window_size == 2*WSIZE so more >= 2.\n * If there was sliding, more >= WSIZE. So in all cases, more >= 2.\n */\n //Assert(more >= 2, \"more < 2\");\n n = read_buf(s.strm, s.window, s.strstart + s.lookahead, more);\n s.lookahead += n;\n\n /* Initialize the hash value now that we have some input: */\n if (s.lookahead + s.insert >= MIN_MATCH) {\n str = s.strstart - s.insert;\n s.ins_h = s.window[str];\n\n /* UPDATE_HASH(s, s->ins_h, s->window[str + 1]); */\n s.ins_h = (s.ins_h << s.hash_shift ^ s.window[str + 1]) & s.hash_mask;\n //#if MIN_MATCH != 3\n // Call update_hash() MIN_MATCH-3 more times\n //#endif\n while (s.insert) {\n /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */\n s.ins_h = (s.ins_h << s.hash_shift ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask;\n s.prev[str & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = str;\n str++;\n s.insert--;\n if (s.lookahead + s.insert < MIN_MATCH) {\n break;\n }\n }\n }\n /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage,\n * but this is not important since only literal bytes will be emitted.\n */\n } while (s.lookahead < MIN_LOOKAHEAD && s.strm.avail_in !== 0);\n\n /* If the WIN_INIT bytes after the end of the current data have never been\n * written, then zero those bytes in order to avoid memory check reports of\n * the use of uninitialized (or uninitialised as Julian writes) bytes by\n * the longest match routines. Update the high water mark for the next\n * time through here. WIN_INIT is set to MAX_MATCH since the longest match\n * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead.\n */\n // if (s.high_water < s.window_size) {\n // var curr = s.strstart + s.lookahead;\n // var init = 0;\n //\n // if (s.high_water < curr) {\n // /* Previous high water mark below current data -- zero WIN_INIT\n // * bytes or up to end of window, whichever is less.\n // */\n // init = s.window_size - curr;\n // if (init > WIN_INIT)\n // init = WIN_INIT;\n // zmemzero(s->window + curr, (unsigned)init);\n // s->high_water = curr + init;\n // }\n // else if (s->high_water < (ulg)curr + WIN_INIT) {\n // /* High water mark at or above current data, but below current data\n // * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up\n // * to end of window, whichever is less.\n // */\n // init = (ulg)curr + WIN_INIT - s->high_water;\n // if (init > s->window_size - s->high_water)\n // init = s->window_size - s->high_water;\n // zmemzero(s->window + s->high_water, (unsigned)init);\n // s->high_water += init;\n // }\n // }\n //\n // Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD,\n // \"not enough room for search\");\n}\n\n/* ===========================================================================\n * Copy without compression as much as possible from the input stream, return\n * the current block state.\n * This function does not insert new strings in the dictionary since\n * uncompressible data is probably not useful. This function is used\n * only for the level=0 compression option.\n * NOTE: this function should be optimized to avoid extra copying from\n * window to pending_buf.\n */\nfunction deflate_stored(s, flush) {\n /* Stored blocks are limited to 0xffff bytes, pending_buf is limited\n * to pending_buf_size, and each stored block has a 5 byte header:\n */\n var max_block_size = 0xffff;\n if (max_block_size > s.pending_buf_size - 5) {\n max_block_size = s.pending_buf_size - 5;\n }\n\n /* Copy as much as possible from input to output: */\n for (;;) {\n /* Fill the window as much as possible: */\n if (s.lookahead <= 1) {\n //Assert(s->strstart < s->w_size+MAX_DIST(s) ||\n // s->block_start >= (long)s->w_size, \"slide too late\");\n // if (!(s.strstart < s.w_size + (s.w_size - MIN_LOOKAHEAD) ||\n // s.block_start >= s.w_size)) {\n // throw new Error(\"slide too late\");\n // }\n\n fill_window(s);\n if (s.lookahead === 0 && flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n if (s.lookahead === 0) {\n break;\n }\n /* flush the current block */\n }\n //Assert(s->block_start >= 0L, \"block gone\");\n // if (s.block_start < 0) throw new Error(\"block gone\");\n\n s.strstart += s.lookahead;\n s.lookahead = 0;\n\n /* Emit a stored block if pending_buf will be full: */\n var max_start = s.block_start + max_block_size;\n if (s.strstart === 0 || s.strstart >= max_start) {\n /* strstart == 0 is possible when wraparound on 16-bit machine */\n s.lookahead = s.strstart - max_start;\n s.strstart = max_start;\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n /* Flush if we may have to slide, otherwise block_start may become\n * negative and the data will be gone:\n */\n if (s.strstart - s.block_start >= s.w_size - MIN_LOOKAHEAD) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n s.insert = 0;\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.strstart > s.block_start) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n return BS_NEED_MORE;\n}\n\n/* ===========================================================================\n * Compress as much as possible from the input stream, return the current\n * block state.\n * This function does not perform lazy evaluation of matches and inserts\n * new strings in the dictionary only for unmatched strings or for short\n * matches. It is used only for the fast compression options.\n */\nfunction deflate_fast(s, flush) {\n var hash_head; /* head of the hash chain */\n var bflush; /* set if current block must be flushed */\n\n for (;;) {\n /* Make sure that we always have enough lookahead, except\n * at the end of the input file. We need MAX_MATCH bytes\n * for the next match, plus MIN_MATCH bytes to insert the\n * string following the next match.\n */\n if (s.lookahead < MIN_LOOKAHEAD) {\n fill_window(s);\n if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n if (s.lookahead === 0) {\n break; /* flush the current block */\n }\n }\n\n /* Insert the string window[strstart .. strstart+2] in the\n * dictionary, and set hash_head to the head of the hash chain:\n */\n hash_head = 0 /*NIL*/;\n if (s.lookahead >= MIN_MATCH) {\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = (s.ins_h << s.hash_shift ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n }\n\n /* Find the longest match, discarding those <= prev_length.\n * At this point we have always match_length < MIN_MATCH\n */\n if (hash_head !== 0 /*NIL*/ && s.strstart - hash_head <= s.w_size - MIN_LOOKAHEAD) {\n /* To simplify the code, we prevent matches with the string\n * of window index 0 (in particular we have to avoid a match\n * of the string with itself at the start of the input file).\n */\n s.match_length = longest_match(s, hash_head);\n /* longest_match() sets match_start */\n }\n if (s.match_length >= MIN_MATCH) {\n // check_match(s, s.strstart, s.match_start, s.match_length); // for debug only\n\n /*** _tr_tally_dist(s, s.strstart - s.match_start,\n s.match_length - MIN_MATCH, bflush); ***/\n bflush = trees._tr_tally(s, s.strstart - s.match_start, s.match_length - MIN_MATCH);\n s.lookahead -= s.match_length;\n\n /* Insert new strings in the hash table only if the match length\n * is not too large. This saves time but degrades compression.\n */\n if (s.match_length <= s.max_lazy_match /*max_insert_length*/ && s.lookahead >= MIN_MATCH) {\n s.match_length--; /* string at strstart already in table */\n do {\n s.strstart++;\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = (s.ins_h << s.hash_shift ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n /* strstart never exceeds WSIZE-MAX_MATCH, so there are\n * always MIN_MATCH bytes ahead.\n */\n } while (--s.match_length !== 0);\n s.strstart++;\n } else {\n s.strstart += s.match_length;\n s.match_length = 0;\n s.ins_h = s.window[s.strstart];\n /* UPDATE_HASH(s, s.ins_h, s.window[s.strstart+1]); */\n s.ins_h = (s.ins_h << s.hash_shift ^ s.window[s.strstart + 1]) & s.hash_mask;\n\n //#if MIN_MATCH != 3\n // Call UPDATE_HASH() MIN_MATCH-3 more times\n //#endif\n /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not\n * matter since it will be recomputed at next deflate call.\n */\n }\n } else {\n /* No match, output a literal byte */\n //Tracevv((stderr,\"%c\", s.window[s.strstart]));\n /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart]);\n s.lookahead--;\n s.strstart++;\n }\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n s.insert = s.strstart < MIN_MATCH - 1 ? s.strstart : MIN_MATCH - 1;\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n return BS_BLOCK_DONE;\n}\n\n/* ===========================================================================\n * Same as above, but achieves better compression. We use a lazy\n * evaluation for matches: a match is finally adopted only if there is\n * no better match at the next window position.\n */\nfunction deflate_slow(s, flush) {\n var hash_head; /* head of hash chain */\n var bflush; /* set if current block must be flushed */\n\n var max_insert;\n\n /* Process the input block. */\n for (;;) {\n /* Make sure that we always have enough lookahead, except\n * at the end of the input file. We need MAX_MATCH bytes\n * for the next match, plus MIN_MATCH bytes to insert the\n * string following the next match.\n */\n if (s.lookahead < MIN_LOOKAHEAD) {\n fill_window(s);\n if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n if (s.lookahead === 0) {\n break;\n } /* flush the current block */\n }\n\n /* Insert the string window[strstart .. strstart+2] in the\n * dictionary, and set hash_head to the head of the hash chain:\n */\n hash_head = 0 /*NIL*/;\n if (s.lookahead >= MIN_MATCH) {\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = (s.ins_h << s.hash_shift ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n }\n\n /* Find the longest match, discarding those <= prev_length.\n */\n s.prev_length = s.match_length;\n s.prev_match = s.match_start;\n s.match_length = MIN_MATCH - 1;\n if (hash_head !== 0 /*NIL*/ && s.prev_length < s.max_lazy_match && s.strstart - hash_head <= s.w_size - MIN_LOOKAHEAD /*MAX_DIST(s)*/) {\n /* To simplify the code, we prevent matches with the string\n * of window index 0 (in particular we have to avoid a match\n * of the string with itself at the start of the input file).\n */\n s.match_length = longest_match(s, hash_head);\n /* longest_match() sets match_start */\n\n if (s.match_length <= 5 && (s.strategy === Z_FILTERED || s.match_length === MIN_MATCH && s.strstart - s.match_start > 4096 /*TOO_FAR*/)) {\n /* If prev_match is also MIN_MATCH, match_start is garbage\n * but we will ignore the current match anyway.\n */\n s.match_length = MIN_MATCH - 1;\n }\n }\n /* If there was a match at the previous step and the current\n * match is not better, output the previous match:\n */\n if (s.prev_length >= MIN_MATCH && s.match_length <= s.prev_length) {\n max_insert = s.strstart + s.lookahead - MIN_MATCH;\n /* Do not insert strings in hash table beyond this. */\n\n //check_match(s, s.strstart-1, s.prev_match, s.prev_length);\n\n /***_tr_tally_dist(s, s.strstart - 1 - s.prev_match,\n s.prev_length - MIN_MATCH, bflush);***/\n bflush = trees._tr_tally(s, s.strstart - 1 - s.prev_match, s.prev_length - MIN_MATCH);\n /* Insert in hash table all strings up to the end of the match.\n * strstart-1 and strstart are already inserted. If there is not\n * enough lookahead, the last two strings are not inserted in\n * the hash table.\n */\n s.lookahead -= s.prev_length - 1;\n s.prev_length -= 2;\n do {\n if (++s.strstart <= max_insert) {\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = (s.ins_h << s.hash_shift ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n }\n } while (--s.prev_length !== 0);\n s.match_available = 0;\n s.match_length = MIN_MATCH - 1;\n s.strstart++;\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n } else if (s.match_available) {\n /* If there was no match at the previous position, output a\n * single literal. If there was a match but the current match\n * is longer, truncate the previous match to a single literal.\n */\n //Tracevv((stderr,\"%c\", s->window[s->strstart-1]));\n /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]);\n if (bflush) {\n /*** FLUSH_BLOCK_ONLY(s, 0) ***/\n flush_block_only(s, false);\n /***/\n }\n s.strstart++;\n s.lookahead--;\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n } else {\n /* There is no previous match to compare with, wait for\n * the next step to decide.\n */\n s.match_available = 1;\n s.strstart++;\n s.lookahead--;\n }\n }\n //Assert (flush != Z_NO_FLUSH, \"no flush?\");\n if (s.match_available) {\n //Tracevv((stderr,\"%c\", s->window[s->strstart-1]));\n /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]);\n s.match_available = 0;\n }\n s.insert = s.strstart < MIN_MATCH - 1 ? s.strstart : MIN_MATCH - 1;\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n return BS_BLOCK_DONE;\n}\n\n/* ===========================================================================\n * For Z_RLE, simply look for runs of bytes, generate matches only of distance\n * one. Do not maintain a hash table. (It will be regenerated if this run of\n * deflate switches away from Z_RLE.)\n */\nfunction deflate_rle(s, flush) {\n var bflush; /* set if current block must be flushed */\n var prev; /* byte at distance one to match */\n var scan, strend; /* scan goes up to strend for length of run */\n\n var _win = s.window;\n for (;;) {\n /* Make sure that we always have enough lookahead, except\n * at the end of the input file. We need MAX_MATCH bytes\n * for the longest run, plus one for the unrolled loop.\n */\n if (s.lookahead <= MAX_MATCH) {\n fill_window(s);\n if (s.lookahead <= MAX_MATCH && flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n if (s.lookahead === 0) {\n break;\n } /* flush the current block */\n }\n\n /* See how many times the previous byte repeats */\n s.match_length = 0;\n if (s.lookahead >= MIN_MATCH && s.strstart > 0) {\n scan = s.strstart - 1;\n prev = _win[scan];\n if (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan]) {\n strend = s.strstart + MAX_MATCH;\n do {\n /*jshint noempty:false*/\n } while (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && scan < strend);\n s.match_length = MAX_MATCH - (strend - scan);\n if (s.match_length > s.lookahead) {\n s.match_length = s.lookahead;\n }\n }\n //Assert(scan <= s->window+(uInt)(s->window_size-1), \"wild scan\");\n }\n\n /* Emit match if have run of MIN_MATCH or longer, else emit literal */\n if (s.match_length >= MIN_MATCH) {\n //check_match(s, s.strstart, s.strstart - 1, s.match_length);\n\n /*** _tr_tally_dist(s, 1, s.match_length - MIN_MATCH, bflush); ***/\n bflush = trees._tr_tally(s, 1, s.match_length - MIN_MATCH);\n s.lookahead -= s.match_length;\n s.strstart += s.match_length;\n s.match_length = 0;\n } else {\n /* No match, output a literal byte */\n //Tracevv((stderr,\"%c\", s->window[s->strstart]));\n /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart]);\n s.lookahead--;\n s.strstart++;\n }\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n s.insert = 0;\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n return BS_BLOCK_DONE;\n}\n\n/* ===========================================================================\n * For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table.\n * (It will be regenerated if this run of deflate switches away from Huffman.)\n */\nfunction deflate_huff(s, flush) {\n var bflush; /* set if current block must be flushed */\n\n for (;;) {\n /* Make sure that we have a literal to write. */\n if (s.lookahead === 0) {\n fill_window(s);\n if (s.lookahead === 0) {\n if (flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n break; /* flush the current block */\n }\n }\n\n /* Output a literal byte */\n s.match_length = 0;\n //Tracevv((stderr,\"%c\", s->window[s->strstart]));\n /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart]);\n s.lookahead--;\n s.strstart++;\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n s.insert = 0;\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n return BS_BLOCK_DONE;\n}\n\n/* Values for max_lazy_match, good_match and max_chain_length, depending on\n * the desired pack level (0..9). The values given below have been tuned to\n * exclude worst case performance for pathological files. Better values may be\n * found for specific files.\n */\nfunction Config(good_length, max_lazy, nice_length, max_chain, func) {\n this.good_length = good_length;\n this.max_lazy = max_lazy;\n this.nice_length = nice_length;\n this.max_chain = max_chain;\n this.func = func;\n}\nvar configuration_table;\nconfiguration_table = [/* good lazy nice chain */\nnew Config(0, 0, 0, 0, deflate_stored), /* 0 store only */\nnew Config(4, 4, 8, 4, deflate_fast), /* 1 max speed, no lazy matches */\nnew Config(4, 5, 16, 8, deflate_fast), /* 2 */\nnew Config(4, 6, 32, 32, deflate_fast), /* 3 */\n\nnew Config(4, 4, 16, 16, deflate_slow), /* 4 lazy matches */\nnew Config(8, 16, 32, 32, deflate_slow), /* 5 */\nnew Config(8, 16, 128, 128, deflate_slow), /* 6 */\nnew Config(8, 32, 128, 256, deflate_slow), /* 7 */\nnew Config(32, 128, 258, 1024, deflate_slow), /* 8 */\nnew Config(32, 258, 258, 4096, deflate_slow) /* 9 max compression */];\n\n/* ===========================================================================\n * Initialize the \"longest match\" routines for a new zlib stream\n */\nfunction lm_init(s) {\n s.window_size = 2 * s.w_size;\n\n /*** CLEAR_HASH(s); ***/\n zero(s.head); // Fill with NIL (= 0);\n\n /* Set the default configuration parameters:\n */\n s.max_lazy_match = configuration_table[s.level].max_lazy;\n s.good_match = configuration_table[s.level].good_length;\n s.nice_match = configuration_table[s.level].nice_length;\n s.max_chain_length = configuration_table[s.level].max_chain;\n s.strstart = 0;\n s.block_start = 0;\n s.lookahead = 0;\n s.insert = 0;\n s.match_length = s.prev_length = MIN_MATCH - 1;\n s.match_available = 0;\n s.ins_h = 0;\n}\nfunction DeflateState() {\n this.strm = null; /* pointer back to this zlib stream */\n this.status = 0; /* as the name implies */\n this.pending_buf = null; /* output still pending */\n this.pending_buf_size = 0; /* size of pending_buf */\n this.pending_out = 0; /* next pending byte to output to the stream */\n this.pending = 0; /* nb of bytes in the pending buffer */\n this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */\n this.gzhead = null; /* gzip header information to write */\n this.gzindex = 0; /* where in extra, name, or comment */\n this.method = Z_DEFLATED; /* can only be DEFLATED */\n this.last_flush = -1; /* value of flush param for previous deflate call */\n\n this.w_size = 0; /* LZ77 window size (32K by default) */\n this.w_bits = 0; /* log2(w_size) (8..16) */\n this.w_mask = 0; /* w_size - 1 */\n\n this.window = null;\n /* Sliding window. Input bytes are read into the second half of the window,\n * and move to the first half later to keep a dictionary of at least wSize\n * bytes. With this organization, matches are limited to a distance of\n * wSize-MAX_MATCH bytes, but this ensures that IO is always\n * performed with a length multiple of the block size.\n */\n\n this.window_size = 0;\n /* Actual size of window: 2*wSize, except when the user input buffer\n * is directly used as sliding window.\n */\n\n this.prev = null;\n /* Link to older string with same hash index. To limit the size of this\n * array to 64K, this link is maintained only for the last 32K strings.\n * An index in this array is thus a window index modulo 32K.\n */\n\n this.head = null; /* Heads of the hash chains or NIL. */\n\n this.ins_h = 0; /* hash index of string to be inserted */\n this.hash_size = 0; /* number of elements in hash table */\n this.hash_bits = 0; /* log2(hash_size) */\n this.hash_mask = 0; /* hash_size-1 */\n\n this.hash_shift = 0;\n /* Number of bits by which ins_h must be shifted at each input\n * step. It must be such that after MIN_MATCH steps, the oldest\n * byte no longer takes part in the hash key, that is:\n * hash_shift * MIN_MATCH >= hash_bits\n */\n\n this.block_start = 0;\n /* Window position at the beginning of the current output block. Gets\n * negative when the window is moved backwards.\n */\n\n this.match_length = 0; /* length of best match */\n this.prev_match = 0; /* previous match */\n this.match_available = 0; /* set if previous match exists */\n this.strstart = 0; /* start of string to insert */\n this.match_start = 0; /* start of matching string */\n this.lookahead = 0; /* number of valid bytes ahead in window */\n\n this.prev_length = 0;\n /* Length of the best match at previous step. Matches not greater than this\n * are discarded. This is used in the lazy match evaluation.\n */\n\n this.max_chain_length = 0;\n /* To speed up deflation, hash chains are never searched beyond this\n * length. A higher limit improves compression ratio but degrades the\n * speed.\n */\n\n this.max_lazy_match = 0;\n /* Attempt to find a better match only when the current match is strictly\n * smaller than this value. This mechanism is used only for compression\n * levels >= 4.\n */\n // That's alias to max_lazy_match, don't use directly\n //this.max_insert_length = 0;\n /* Insert new strings in the hash table only if the match length is not\n * greater than this length. This saves time but degrades compression.\n * max_insert_length is used only for compression levels <= 3.\n */\n\n this.level = 0; /* compression level (1..9) */\n this.strategy = 0; /* favor or force Huffman coding*/\n\n this.good_match = 0;\n /* Use a faster search when the previous match is longer than this */\n\n this.nice_match = 0; /* Stop searching when current match exceeds this */\n\n /* used by trees.c: */\n\n /* Didn't use ct_data typedef below to suppress compiler warning */\n\n // struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */\n // struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */\n // struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */\n\n // Use flat array of DOUBLE size, with interleaved fata,\n // because JS does not support effective\n this.dyn_ltree = new utils.Buf16(HEAP_SIZE * 2);\n this.dyn_dtree = new utils.Buf16((2 * D_CODES + 1) * 2);\n this.bl_tree = new utils.Buf16((2 * BL_CODES + 1) * 2);\n zero(this.dyn_ltree);\n zero(this.dyn_dtree);\n zero(this.bl_tree);\n this.l_desc = null; /* desc. for literal tree */\n this.d_desc = null; /* desc. for distance tree */\n this.bl_desc = null; /* desc. for bit length tree */\n\n //ush bl_count[MAX_BITS+1];\n this.bl_count = new utils.Buf16(MAX_BITS + 1);\n /* number of codes at each bit length for an optimal tree */\n\n //int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */\n this.heap = new utils.Buf16(2 * L_CODES + 1); /* heap used to build the Huffman trees */\n zero(this.heap);\n this.heap_len = 0; /* number of elements in the heap */\n this.heap_max = 0; /* element of largest frequency */\n /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used.\n * The same heap array is used to build all trees.\n */\n\n this.depth = new utils.Buf16(2 * L_CODES + 1); //uch depth[2*L_CODES+1];\n zero(this.depth);\n /* Depth of each subtree used as tie breaker for trees of equal frequency\n */\n\n this.l_buf = 0; /* buffer index for literals or lengths */\n\n this.lit_bufsize = 0;\n /* Size of match buffer for literals/lengths. There are 4 reasons for\n * limiting lit_bufsize to 64K:\n * - frequencies can be kept in 16 bit counters\n * - if compression is not successful for the first block, all input\n * data is still in the window so we can still emit a stored block even\n * when input comes from standard input. (This can also be done for\n * all blocks if lit_bufsize is not greater than 32K.)\n * - if compression is not successful for a file smaller than 64K, we can\n * even emit a stored file instead of a stored block (saving 5 bytes).\n * This is applicable only for zip (not gzip or zlib).\n * - creating new Huffman trees less frequently may not provide fast\n * adaptation to changes in the input data statistics. (Take for\n * example a binary file with poorly compressible code followed by\n * a highly compressible string table.) Smaller buffer sizes give\n * fast adaptation but have of course the overhead of transmitting\n * trees more frequently.\n * - I can't count above 4\n */\n\n this.last_lit = 0; /* running index in l_buf */\n\n this.d_buf = 0;\n /* Buffer index for distances. To simplify the code, d_buf and l_buf have\n * the same number of elements. To use different lengths, an extra flag\n * array would be necessary.\n */\n\n this.opt_len = 0; /* bit length of current block with optimal trees */\n this.static_len = 0; /* bit length of current block with static trees */\n this.matches = 0; /* number of string matches in current block */\n this.insert = 0; /* bytes at end of window left to insert */\n\n this.bi_buf = 0;\n /* Output buffer. bits are inserted starting at the bottom (least\n * significant bits).\n */\n this.bi_valid = 0;\n /* Number of valid bits in bi_buf. All bits above the last valid bit\n * are always zero.\n */\n\n // Used for window memory init. We safely ignore it for JS. That makes\n // sense only for pointers and memory check tools.\n //this.high_water = 0;\n /* High water mark offset in window for initialized bytes -- bytes above\n * this are set to zero in order to avoid memory check warnings when\n * longest match routines access bytes past the input. This is then\n * updated to the new high water mark.\n */\n}\nfunction deflateResetKeep(strm) {\n var s;\n if (!strm || !strm.state) {\n return err(strm, Z_STREAM_ERROR);\n }\n strm.total_in = strm.total_out = 0;\n strm.data_type = Z_UNKNOWN;\n s = strm.state;\n s.pending = 0;\n s.pending_out = 0;\n if (s.wrap < 0) {\n s.wrap = -s.wrap;\n /* was made negative by deflate(..., Z_FINISH); */\n }\n s.status = s.wrap ? INIT_STATE : BUSY_STATE;\n strm.adler = s.wrap === 2 ? 0 // crc32(0, Z_NULL, 0)\n : 1; // adler32(0, Z_NULL, 0)\n s.last_flush = Z_NO_FLUSH;\n trees._tr_init(s);\n return Z_OK;\n}\nfunction deflateReset(strm) {\n var ret = deflateResetKeep(strm);\n if (ret === Z_OK) {\n lm_init(strm.state);\n }\n return ret;\n}\nfunction deflateSetHeader(strm, head) {\n if (!strm || !strm.state) {\n return Z_STREAM_ERROR;\n }\n if (strm.state.wrap !== 2) {\n return Z_STREAM_ERROR;\n }\n strm.state.gzhead = head;\n return Z_OK;\n}\nfunction deflateInit2(strm, level, method, windowBits, memLevel, strategy) {\n if (!strm) {\n // === Z_NULL\n return Z_STREAM_ERROR;\n }\n var wrap = 1;\n if (level === Z_DEFAULT_COMPRESSION) {\n level = 6;\n }\n if (windowBits < 0) {\n /* suppress zlib wrapper */\n wrap = 0;\n windowBits = -windowBits;\n } else if (windowBits > 15) {\n wrap = 2; /* write gzip wrapper instead */\n windowBits -= 16;\n }\n if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method !== Z_DEFLATED || windowBits < 8 || windowBits > 15 || level < 0 || level > 9 || strategy < 0 || strategy > Z_FIXED) {\n return err(strm, Z_STREAM_ERROR);\n }\n if (windowBits === 8) {\n windowBits = 9;\n }\n /* until 256-byte window bug fixed */\n\n var s = new DeflateState();\n strm.state = s;\n s.strm = strm;\n s.wrap = wrap;\n s.gzhead = null;\n s.w_bits = windowBits;\n s.w_size = 1 << s.w_bits;\n s.w_mask = s.w_size - 1;\n s.hash_bits = memLevel + 7;\n s.hash_size = 1 << s.hash_bits;\n s.hash_mask = s.hash_size - 1;\n s.hash_shift = ~~((s.hash_bits + MIN_MATCH - 1) / MIN_MATCH);\n s.window = new utils.Buf8(s.w_size * 2);\n s.head = new utils.Buf16(s.hash_size);\n s.prev = new utils.Buf16(s.w_size);\n\n // Don't need mem init magic for JS.\n //s.high_water = 0; /* nothing written to s->window yet */\n\n s.lit_bufsize = 1 << memLevel + 6; /* 16K elements by default */\n\n s.pending_buf_size = s.lit_bufsize * 4;\n\n //overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2);\n //s->pending_buf = (uchf *) overlay;\n s.pending_buf = new utils.Buf8(s.pending_buf_size);\n\n // It is offset from `s.pending_buf` (size is `s.lit_bufsize * 2`)\n //s->d_buf = overlay + s->lit_bufsize/sizeof(ush);\n s.d_buf = 1 * s.lit_bufsize;\n\n //s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize;\n s.l_buf = (1 + 2) * s.lit_bufsize;\n s.level = level;\n s.strategy = strategy;\n s.method = method;\n return deflateReset(strm);\n}\nfunction deflateInit(strm, level) {\n return deflateInit2(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY);\n}\nfunction deflate(strm, flush) {\n var old_flush, s;\n var beg, val; // for gzip header write only\n\n if (!strm || !strm.state || flush > Z_BLOCK || flush < 0) {\n return strm ? err(strm, Z_STREAM_ERROR) : Z_STREAM_ERROR;\n }\n s = strm.state;\n if (!strm.output || !strm.input && strm.avail_in !== 0 || s.status === FINISH_STATE && flush !== Z_FINISH) {\n return err(strm, strm.avail_out === 0 ? Z_BUF_ERROR : Z_STREAM_ERROR);\n }\n s.strm = strm; /* just in case */\n old_flush = s.last_flush;\n s.last_flush = flush;\n\n /* Write the header */\n if (s.status === INIT_STATE) {\n if (s.wrap === 2) {\n // GZIP header\n strm.adler = 0; //crc32(0L, Z_NULL, 0);\n put_byte(s, 31);\n put_byte(s, 139);\n put_byte(s, 8);\n if (!s.gzhead) {\n // s->gzhead == Z_NULL\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, s.level === 9 ? 2 : s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ? 4 : 0);\n put_byte(s, OS_CODE);\n s.status = BUSY_STATE;\n } else {\n put_byte(s, (s.gzhead.text ? 1 : 0) + (s.gzhead.hcrc ? 2 : 0) + (!s.gzhead.extra ? 0 : 4) + (!s.gzhead.name ? 0 : 8) + (!s.gzhead.comment ? 0 : 16));\n put_byte(s, s.gzhead.time & 0xff);\n put_byte(s, s.gzhead.time >> 8 & 0xff);\n put_byte(s, s.gzhead.time >> 16 & 0xff);\n put_byte(s, s.gzhead.time >> 24 & 0xff);\n put_byte(s, s.level === 9 ? 2 : s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ? 4 : 0);\n put_byte(s, s.gzhead.os & 0xff);\n if (s.gzhead.extra && s.gzhead.extra.length) {\n put_byte(s, s.gzhead.extra.length & 0xff);\n put_byte(s, s.gzhead.extra.length >> 8 & 0xff);\n }\n if (s.gzhead.hcrc) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending, 0);\n }\n s.gzindex = 0;\n s.status = EXTRA_STATE;\n }\n } else\n // DEFLATE header\n {\n var header = Z_DEFLATED + (s.w_bits - 8 << 4) << 8;\n var level_flags = -1;\n if (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2) {\n level_flags = 0;\n } else if (s.level < 6) {\n level_flags = 1;\n } else if (s.level === 6) {\n level_flags = 2;\n } else {\n level_flags = 3;\n }\n header |= level_flags << 6;\n if (s.strstart !== 0) {\n header |= PRESET_DICT;\n }\n header += 31 - header % 31;\n s.status = BUSY_STATE;\n putShortMSB(s, header);\n\n /* Save the adler32 of the preset dictionary: */\n if (s.strstart !== 0) {\n putShortMSB(s, strm.adler >>> 16);\n putShortMSB(s, strm.adler & 0xffff);\n }\n strm.adler = 1; // adler32(0L, Z_NULL, 0);\n }\n }\n\n //#ifdef GZIP\n if (s.status === EXTRA_STATE) {\n if (s.gzhead.extra /* != Z_NULL*/) {\n beg = s.pending; /* start of bytes to update crc */\n\n while (s.gzindex < (s.gzhead.extra.length & 0xffff)) {\n if (s.pending === s.pending_buf_size) {\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n flush_pending(strm);\n beg = s.pending;\n if (s.pending === s.pending_buf_size) {\n break;\n }\n }\n put_byte(s, s.gzhead.extra[s.gzindex] & 0xff);\n s.gzindex++;\n }\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n if (s.gzindex === s.gzhead.extra.length) {\n s.gzindex = 0;\n s.status = NAME_STATE;\n }\n } else {\n s.status = NAME_STATE;\n }\n }\n if (s.status === NAME_STATE) {\n if (s.gzhead.name /* != Z_NULL*/) {\n beg = s.pending; /* start of bytes to update crc */\n //int val;\n\n do {\n if (s.pending === s.pending_buf_size) {\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n flush_pending(strm);\n beg = s.pending;\n if (s.pending === s.pending_buf_size) {\n val = 1;\n break;\n }\n }\n // JS specific: little magic to add zero terminator to end of string\n if (s.gzindex < s.gzhead.name.length) {\n val = s.gzhead.name.charCodeAt(s.gzindex++) & 0xff;\n } else {\n val = 0;\n }\n put_byte(s, val);\n } while (val !== 0);\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n if (val === 0) {\n s.gzindex = 0;\n s.status = COMMENT_STATE;\n }\n } else {\n s.status = COMMENT_STATE;\n }\n }\n if (s.status === COMMENT_STATE) {\n if (s.gzhead.comment /* != Z_NULL*/) {\n beg = s.pending; /* start of bytes to update crc */\n //int val;\n\n do {\n if (s.pending === s.pending_buf_size) {\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n flush_pending(strm);\n beg = s.pending;\n if (s.pending === s.pending_buf_size) {\n val = 1;\n break;\n }\n }\n // JS specific: little magic to add zero terminator to end of string\n if (s.gzindex < s.gzhead.comment.length) {\n val = s.gzhead.comment.charCodeAt(s.gzindex++) & 0xff;\n } else {\n val = 0;\n }\n put_byte(s, val);\n } while (val !== 0);\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n if (val === 0) {\n s.status = HCRC_STATE;\n }\n } else {\n s.status = HCRC_STATE;\n }\n }\n if (s.status === HCRC_STATE) {\n if (s.gzhead.hcrc) {\n if (s.pending + 2 > s.pending_buf_size) {\n flush_pending(strm);\n }\n if (s.pending + 2 <= s.pending_buf_size) {\n put_byte(s, strm.adler & 0xff);\n put_byte(s, strm.adler >> 8 & 0xff);\n strm.adler = 0; //crc32(0L, Z_NULL, 0);\n s.status = BUSY_STATE;\n }\n } else {\n s.status = BUSY_STATE;\n }\n }\n //#endif\n\n /* Flush as much pending output as possible */\n if (s.pending !== 0) {\n flush_pending(strm);\n if (strm.avail_out === 0) {\n /* Since avail_out is 0, deflate will be called again with\n * more output space, but possibly with both pending and\n * avail_in equal to zero. There won't be anything to do,\n * but this is not an error situation so make sure we\n * return OK instead of BUF_ERROR at next call of deflate:\n */\n s.last_flush = -1;\n return Z_OK;\n }\n\n /* Make sure there is something to do and avoid duplicate consecutive\n * flushes. For repeated and useless calls with Z_FINISH, we keep\n * returning Z_STREAM_END instead of Z_BUF_ERROR.\n */\n } else if (strm.avail_in === 0 && rank(flush) <= rank(old_flush) && flush !== Z_FINISH) {\n return err(strm, Z_BUF_ERROR);\n }\n\n /* User must not provide more input after the first FINISH: */\n if (s.status === FINISH_STATE && strm.avail_in !== 0) {\n return err(strm, Z_BUF_ERROR);\n }\n\n /* Start a new block or continue the current one.\n */\n if (strm.avail_in !== 0 || s.lookahead !== 0 || flush !== Z_NO_FLUSH && s.status !== FINISH_STATE) {\n var bstate = s.strategy === Z_HUFFMAN_ONLY ? deflate_huff(s, flush) : s.strategy === Z_RLE ? deflate_rle(s, flush) : configuration_table[s.level].func(s, flush);\n if (bstate === BS_FINISH_STARTED || bstate === BS_FINISH_DONE) {\n s.status = FINISH_STATE;\n }\n if (bstate === BS_NEED_MORE || bstate === BS_FINISH_STARTED) {\n if (strm.avail_out === 0) {\n s.last_flush = -1;\n /* avoid BUF_ERROR next call, see above */\n }\n return Z_OK;\n /* If flush != Z_NO_FLUSH && avail_out == 0, the next call\n * of deflate should use the same flush parameter to make sure\n * that the flush is complete. So we don't have to output an\n * empty block here, this will be done at next call. This also\n * ensures that for a very small output buffer, we emit at most\n * one empty block.\n */\n }\n if (bstate === BS_BLOCK_DONE) {\n if (flush === Z_PARTIAL_FLUSH) {\n trees._tr_align(s);\n } else if (flush !== Z_BLOCK) {\n /* FULL_FLUSH or SYNC_FLUSH */\n\n trees._tr_stored_block(s, 0, 0, false);\n /* For a full flush, this empty block will be recognized\n * as a special marker by inflate_sync().\n */\n if (flush === Z_FULL_FLUSH) {\n /*** CLEAR_HASH(s); ***/ /* forget history */\n zero(s.head); // Fill with NIL (= 0);\n\n if (s.lookahead === 0) {\n s.strstart = 0;\n s.block_start = 0;\n s.insert = 0;\n }\n }\n }\n flush_pending(strm);\n if (strm.avail_out === 0) {\n s.last_flush = -1; /* avoid BUF_ERROR at next call, see above */\n return Z_OK;\n }\n }\n }\n //Assert(strm->avail_out > 0, \"bug2\");\n //if (strm.avail_out <= 0) { throw new Error(\"bug2\");}\n\n if (flush !== Z_FINISH) {\n return Z_OK;\n }\n if (s.wrap <= 0) {\n return Z_STREAM_END;\n }\n\n /* Write the trailer */\n if (s.wrap === 2) {\n put_byte(s, strm.adler & 0xff);\n put_byte(s, strm.adler >> 8 & 0xff);\n put_byte(s, strm.adler >> 16 & 0xff);\n put_byte(s, strm.adler >> 24 & 0xff);\n put_byte(s, strm.total_in & 0xff);\n put_byte(s, strm.total_in >> 8 & 0xff);\n put_byte(s, strm.total_in >> 16 & 0xff);\n put_byte(s, strm.total_in >> 24 & 0xff);\n } else {\n putShortMSB(s, strm.adler >>> 16);\n putShortMSB(s, strm.adler & 0xffff);\n }\n flush_pending(strm);\n /* If avail_out is zero, the application will call deflate again\n * to flush the rest.\n */\n if (s.wrap > 0) {\n s.wrap = -s.wrap;\n }\n /* write the trailer only once! */\n return s.pending !== 0 ? Z_OK : Z_STREAM_END;\n}\nfunction deflateEnd(strm) {\n var status;\n if (!strm /*== Z_NULL*/ || !strm.state /*== Z_NULL*/) {\n return Z_STREAM_ERROR;\n }\n status = strm.state.status;\n if (status !== INIT_STATE && status !== EXTRA_STATE && status !== NAME_STATE && status !== COMMENT_STATE && status !== HCRC_STATE && status !== BUSY_STATE && status !== FINISH_STATE) {\n return err(strm, Z_STREAM_ERROR);\n }\n strm.state = null;\n return status === BUSY_STATE ? err(strm, Z_DATA_ERROR) : Z_OK;\n}\n\n/* =========================================================================\n * Initializes the compression dictionary from the given byte\n * sequence without producing any compressed output.\n */\nfunction deflateSetDictionary(strm, dictionary) {\n var dictLength = dictionary.length;\n var s;\n var str, n;\n var wrap;\n var avail;\n var next;\n var input;\n var tmpDict;\n if (!strm /*== Z_NULL*/ || !strm.state /*== Z_NULL*/) {\n return Z_STREAM_ERROR;\n }\n s = strm.state;\n wrap = s.wrap;\n if (wrap === 2 || wrap === 1 && s.status !== INIT_STATE || s.lookahead) {\n return Z_STREAM_ERROR;\n }\n\n /* when using zlib wrappers, compute Adler-32 for provided dictionary */\n if (wrap === 1) {\n /* adler32(strm->adler, dictionary, dictLength); */\n strm.adler = adler32(strm.adler, dictionary, dictLength, 0);\n }\n s.wrap = 0; /* avoid computing Adler-32 in read_buf */\n\n /* if dictionary would fill window, just replace the history */\n if (dictLength >= s.w_size) {\n if (wrap === 0) {\n /* already empty otherwise */\n /*** CLEAR_HASH(s); ***/\n zero(s.head); // Fill with NIL (= 0);\n s.strstart = 0;\n s.block_start = 0;\n s.insert = 0;\n }\n /* use the tail */\n // dictionary = dictionary.slice(dictLength - s.w_size);\n tmpDict = new utils.Buf8(s.w_size);\n utils.arraySet(tmpDict, dictionary, dictLength - s.w_size, s.w_size, 0);\n dictionary = tmpDict;\n dictLength = s.w_size;\n }\n /* insert dictionary into window and hash */\n avail = strm.avail_in;\n next = strm.next_in;\n input = strm.input;\n strm.avail_in = dictLength;\n strm.next_in = 0;\n strm.input = dictionary;\n fill_window(s);\n while (s.lookahead >= MIN_MATCH) {\n str = s.strstart;\n n = s.lookahead - (MIN_MATCH - 1);\n do {\n /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */\n s.ins_h = (s.ins_h << s.hash_shift ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask;\n s.prev[str & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = str;\n str++;\n } while (--n);\n s.strstart = str;\n s.lookahead = MIN_MATCH - 1;\n fill_window(s);\n }\n s.strstart += s.lookahead;\n s.block_start = s.strstart;\n s.insert = s.lookahead;\n s.lookahead = 0;\n s.match_length = s.prev_length = MIN_MATCH - 1;\n s.match_available = 0;\n strm.next_in = next;\n strm.input = input;\n strm.avail_in = avail;\n s.wrap = wrap;\n return Z_OK;\n}\nexports.deflateInit = deflateInit;\nexports.deflateInit2 = deflateInit2;\nexports.deflateReset = deflateReset;\nexports.deflateResetKeep = deflateResetKeep;\nexports.deflateSetHeader = deflateSetHeader;\nexports.deflate = deflate;\nexports.deflateEnd = deflateEnd;\nexports.deflateSetDictionary = deflateSetDictionary;\nexports.deflateInfo = 'pako deflate (from Nodeca project)';\n\n/* Not implemented\nexports.deflateBound = deflateBound;\nexports.deflateCopy = deflateCopy;\nexports.deflateParams = deflateParams;\nexports.deflatePending = deflatePending;\nexports.deflatePrime = deflatePrime;\nexports.deflateTune = deflateTune;\n*/","// String encode/decode helpers\n'use strict';\n\nvar utils = require('./common');\n\n// Quick check if we can use fast array to bin string conversion\n//\n// - apply(Array) can fail on Android 2.2\n// - apply(Uint8Array) can fail on iOS 5.1 Safari\n//\nvar STR_APPLY_OK = true;\nvar STR_APPLY_UIA_OK = true;\ntry {\n String.fromCharCode.apply(null, [0]);\n} catch (__) {\n STR_APPLY_OK = false;\n}\ntry {\n String.fromCharCode.apply(null, new Uint8Array(1));\n} catch (__) {\n STR_APPLY_UIA_OK = false;\n}\n\n// Table with utf8 lengths (calculated by first byte of sequence)\n// Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS,\n// because max possible codepoint is 0x10ffff\nvar _utf8len = new utils.Buf8(256);\nfor (var q = 0; q < 256; q++) {\n _utf8len[q] = q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1;\n}\n_utf8len[254] = _utf8len[254] = 1; // Invalid sequence start\n\n// convert string to array (typed, when possible)\nexports.string2buf = function (str) {\n var buf,\n c,\n c2,\n m_pos,\n i,\n str_len = str.length,\n buf_len = 0;\n\n // count binary size\n for (m_pos = 0; m_pos < str_len; m_pos++) {\n c = str.charCodeAt(m_pos);\n if ((c & 0xfc00) === 0xd800 && m_pos + 1 < str_len) {\n c2 = str.charCodeAt(m_pos + 1);\n if ((c2 & 0xfc00) === 0xdc00) {\n c = 0x10000 + (c - 0xd800 << 10) + (c2 - 0xdc00);\n m_pos++;\n }\n }\n buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4;\n }\n\n // allocate buffer\n buf = new utils.Buf8(buf_len);\n\n // convert\n for (i = 0, m_pos = 0; i < buf_len; m_pos++) {\n c = str.charCodeAt(m_pos);\n if ((c & 0xfc00) === 0xd800 && m_pos + 1 < str_len) {\n c2 = str.charCodeAt(m_pos + 1);\n if ((c2 & 0xfc00) === 0xdc00) {\n c = 0x10000 + (c - 0xd800 << 10) + (c2 - 0xdc00);\n m_pos++;\n }\n }\n if (c < 0x80) {\n /* one byte */\n buf[i++] = c;\n } else if (c < 0x800) {\n /* two bytes */\n buf[i++] = 0xC0 | c >>> 6;\n buf[i++] = 0x80 | c & 0x3f;\n } else if (c < 0x10000) {\n /* three bytes */\n buf[i++] = 0xE0 | c >>> 12;\n buf[i++] = 0x80 | c >>> 6 & 0x3f;\n buf[i++] = 0x80 | c & 0x3f;\n } else {\n /* four bytes */\n buf[i++] = 0xf0 | c >>> 18;\n buf[i++] = 0x80 | c >>> 12 & 0x3f;\n buf[i++] = 0x80 | c >>> 6 & 0x3f;\n buf[i++] = 0x80 | c & 0x3f;\n }\n }\n return buf;\n};\n\n// Helper (used in 2 places)\nfunction buf2binstring(buf, len) {\n // On Chrome, the arguments in a function call that are allowed is `65534`.\n // If the length of the buffer is smaller than that, we can use this optimization,\n // otherwise we will take a slower path.\n if (len < 65534) {\n if (buf.subarray && STR_APPLY_UIA_OK || !buf.subarray && STR_APPLY_OK) {\n return String.fromCharCode.apply(null, utils.shrinkBuf(buf, len));\n }\n }\n var result = '';\n for (var i = 0; i < len; i++) {\n result += String.fromCharCode(buf[i]);\n }\n return result;\n}\n\n// Convert byte array to binary string\nexports.buf2binstring = function (buf) {\n return buf2binstring(buf, buf.length);\n};\n\n// Convert binary string (typed, when possible)\nexports.binstring2buf = function (str) {\n var buf = new utils.Buf8(str.length);\n for (var i = 0, len = buf.length; i < len; i++) {\n buf[i] = str.charCodeAt(i);\n }\n return buf;\n};\n\n// convert array to string\nexports.buf2string = function (buf, max) {\n var i, out, c, c_len;\n var len = max || buf.length;\n\n // Reserve max possible length (2 words per char)\n // NB: by unknown reasons, Array is significantly faster for\n // String.fromCharCode.apply than Uint16Array.\n var utf16buf = new Array(len * 2);\n for (out = 0, i = 0; i < len;) {\n c = buf[i++];\n // quick process ascii\n if (c < 0x80) {\n utf16buf[out++] = c;\n continue;\n }\n c_len = _utf8len[c];\n // skip 5 & 6 byte codes\n if (c_len > 4) {\n utf16buf[out++] = 0xfffd;\n i += c_len - 1;\n continue;\n }\n\n // apply mask on first byte\n c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07;\n // join the rest\n while (c_len > 1 && i < len) {\n c = c << 6 | buf[i++] & 0x3f;\n c_len--;\n }\n\n // terminated by end of string?\n if (c_len > 1) {\n utf16buf[out++] = 0xfffd;\n continue;\n }\n if (c < 0x10000) {\n utf16buf[out++] = c;\n } else {\n c -= 0x10000;\n utf16buf[out++] = 0xd800 | c >> 10 & 0x3ff;\n utf16buf[out++] = 0xdc00 | c & 0x3ff;\n }\n }\n return buf2binstring(utf16buf, out);\n};\n\n// Calculate max possible position in utf8 buffer,\n// that will not break sequence. If that's not possible\n// - (very small limits) return max size as is.\n//\n// buf[] - utf8 bytes array\n// max - length limit (mandatory);\nexports.utf8border = function (buf, max) {\n var pos;\n max = max || buf.length;\n if (max > buf.length) {\n max = buf.length;\n }\n\n // go back from last position, until start of sequence found\n pos = max - 1;\n while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) {\n pos--;\n }\n\n // Very small and broken sequence,\n // return max, because we should return something anyway.\n if (pos < 0) {\n return max;\n }\n\n // If we came to start of buffer - that means buffer is too small,\n // return max too.\n if (pos === 0) {\n return max;\n }\n return pos + _utf8len[buf[pos]] > max ? pos : max;\n};","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\nfunction ZStream() {\n /* next input byte */\n this.input = null; // JS specific, because we have no pointers\n this.next_in = 0;\n /* number of bytes available at input */\n this.avail_in = 0;\n /* total number of input bytes read so far */\n this.total_in = 0;\n /* next output byte should be put there */\n this.output = null; // JS specific, because we have no pointers\n this.next_out = 0;\n /* remaining free space at output */\n this.avail_out = 0;\n /* total number of bytes output so far */\n this.total_out = 0;\n /* last error message, NULL if no error */\n this.msg = '' /*Z_NULL*/;\n /* not visible by applications */\n this.state = null;\n /* best guess about the data type: binary or text */\n this.data_type = 2 /*Z_UNKNOWN*/;\n /* adler32 value of the uncompressed data */\n this.adler = 0;\n}\nmodule.exports = ZStream;","'use strict';\n\nvar zlib_deflate = require('./zlib/deflate');\nvar utils = require('./utils/common');\nvar strings = require('./utils/strings');\nvar msg = require('./zlib/messages');\nvar ZStream = require('./zlib/zstream');\nvar toString = Object.prototype.toString;\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\nvar Z_NO_FLUSH = 0;\nvar Z_FINISH = 4;\nvar Z_OK = 0;\nvar Z_STREAM_END = 1;\nvar Z_SYNC_FLUSH = 2;\nvar Z_DEFAULT_COMPRESSION = -1;\nvar Z_DEFAULT_STRATEGY = 0;\nvar Z_DEFLATED = 8;\n\n/* ===========================================================================*/\n\n/**\n * class Deflate\n *\n * Generic JS-style wrapper for zlib calls. If you don't need\n * streaming behaviour - use more simple functions: [[deflate]],\n * [[deflateRaw]] and [[gzip]].\n **/\n\n/* internal\n * Deflate.chunks -> Array\n *\n * Chunks of output data, if [[Deflate#onData]] not overridden.\n **/\n\n/**\n * Deflate.result -> Uint8Array|Array\n *\n * Compressed result, generated by default [[Deflate#onData]]\n * and [[Deflate#onEnd]] handlers. Filled after you push last chunk\n * (call [[Deflate#push]] with `Z_FINISH` / `true` param) or if you\n * push a chunk with explicit flush (call [[Deflate#push]] with\n * `Z_SYNC_FLUSH` param).\n **/\n\n/**\n * Deflate.err -> Number\n *\n * Error code after deflate finished. 0 (Z_OK) on success.\n * You will not need it in real life, because deflate errors\n * are possible only on wrong options or bad `onData` / `onEnd`\n * custom handlers.\n **/\n\n/**\n * Deflate.msg -> String\n *\n * Error message, if [[Deflate.err]] != 0\n **/\n\n/**\n * new Deflate(options)\n * - options (Object): zlib deflate options.\n *\n * Creates new deflator instance with specified params. Throws exception\n * on bad params. Supported options:\n *\n * - `level`\n * - `windowBits`\n * - `memLevel`\n * - `strategy`\n * - `dictionary`\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information on these.\n *\n * Additional options, for internal needs:\n *\n * - `chunkSize` - size of generated data chunks (16K by default)\n * - `raw` (Boolean) - do raw deflate\n * - `gzip` (Boolean) - create gzip wrapper\n * - `to` (String) - if equal to 'string', then result will be \"binary string\"\n * (each char code [0..255])\n * - `header` (Object) - custom header for gzip\n * - `text` (Boolean) - true if compressed data believed to be text\n * - `time` (Number) - modification time, unix timestamp\n * - `os` (Number) - operation system code\n * - `extra` (Array) - array of bytes with extra data (max 65536)\n * - `name` (String) - file name (binary string)\n * - `comment` (String) - comment (binary string)\n * - `hcrc` (Boolean) - true if header crc should be added\n *\n * ##### Example:\n *\n * ```javascript\n * var pako = require('pako')\n * , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9])\n * , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]);\n *\n * var deflate = new pako.Deflate({ level: 3});\n *\n * deflate.push(chunk1, false);\n * deflate.push(chunk2, true); // true -> last chunk\n *\n * if (deflate.err) { throw new Error(deflate.err); }\n *\n * console.log(deflate.result);\n * ```\n **/\nfunction Deflate(options) {\n if (!(this instanceof Deflate)) return new Deflate(options);\n this.options = utils.assign({\n level: Z_DEFAULT_COMPRESSION,\n method: Z_DEFLATED,\n chunkSize: 16384,\n windowBits: 15,\n memLevel: 8,\n strategy: Z_DEFAULT_STRATEGY,\n to: ''\n }, options || {});\n var opt = this.options;\n if (opt.raw && opt.windowBits > 0) {\n opt.windowBits = -opt.windowBits;\n } else if (opt.gzip && opt.windowBits > 0 && opt.windowBits < 16) {\n opt.windowBits += 16;\n }\n this.err = 0; // error code, if happens (0 = Z_OK)\n this.msg = ''; // error message\n this.ended = false; // used to avoid multiple onEnd() calls\n this.chunks = []; // chunks of compressed data\n\n this.strm = new ZStream();\n this.strm.avail_out = 0;\n var status = zlib_deflate.deflateInit2(this.strm, opt.level, opt.method, opt.windowBits, opt.memLevel, opt.strategy);\n if (status !== Z_OK) {\n throw new Error(msg[status]);\n }\n if (opt.header) {\n zlib_deflate.deflateSetHeader(this.strm, opt.header);\n }\n if (opt.dictionary) {\n var dict;\n // Convert data if needed\n if (typeof opt.dictionary === 'string') {\n // If we need to compress text, change encoding to utf8.\n dict = strings.string2buf(opt.dictionary);\n } else if (toString.call(opt.dictionary) === '[object ArrayBuffer]') {\n dict = new Uint8Array(opt.dictionary);\n } else {\n dict = opt.dictionary;\n }\n status = zlib_deflate.deflateSetDictionary(this.strm, dict);\n if (status !== Z_OK) {\n throw new Error(msg[status]);\n }\n this._dict_set = true;\n }\n}\n\n/**\n * Deflate#push(data[, mode]) -> Boolean\n * - data (Uint8Array|Array|ArrayBuffer|String): input data. Strings will be\n * converted to utf8 byte sequence.\n * - mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes.\n * See constants. Skipped or `false` means Z_NO_FLUSH, `true` means Z_FINISH.\n *\n * Sends input data to deflate pipe, generating [[Deflate#onData]] calls with\n * new compressed chunks. Returns `true` on success. The last data block must have\n * mode Z_FINISH (or `true`). That will flush internal pending buffers and call\n * [[Deflate#onEnd]]. For interim explicit flushes (without ending the stream) you\n * can use mode Z_SYNC_FLUSH, keeping the compression context.\n *\n * On fail call [[Deflate#onEnd]] with error code and return false.\n *\n * We strongly recommend to use `Uint8Array` on input for best speed (output\n * array format is detected automatically). Also, don't skip last param and always\n * use the same type in your code (boolean or number). That will improve JS speed.\n *\n * For regular `Array`-s make sure all elements are [0..255].\n *\n * ##### Example\n *\n * ```javascript\n * push(chunk, false); // push one of data chunks\n * ...\n * push(chunk, true); // push last chunk\n * ```\n **/\nDeflate.prototype.push = function (data, mode) {\n var strm = this.strm;\n var chunkSize = this.options.chunkSize;\n var status, _mode;\n if (this.ended) {\n return false;\n }\n _mode = mode === ~~mode ? mode : mode === true ? Z_FINISH : Z_NO_FLUSH;\n\n // Convert data if needed\n if (typeof data === 'string') {\n // If we need to compress text, change encoding to utf8.\n strm.input = strings.string2buf(data);\n } else if (toString.call(data) === '[object ArrayBuffer]') {\n strm.input = new Uint8Array(data);\n } else {\n strm.input = data;\n }\n strm.next_in = 0;\n strm.avail_in = strm.input.length;\n do {\n if (strm.avail_out === 0) {\n strm.output = new utils.Buf8(chunkSize);\n strm.next_out = 0;\n strm.avail_out = chunkSize;\n }\n status = zlib_deflate.deflate(strm, _mode); /* no bad return value */\n\n if (status !== Z_STREAM_END && status !== Z_OK) {\n this.onEnd(status);\n this.ended = true;\n return false;\n }\n if (strm.avail_out === 0 || strm.avail_in === 0 && (_mode === Z_FINISH || _mode === Z_SYNC_FLUSH)) {\n if (this.options.to === 'string') {\n this.onData(strings.buf2binstring(utils.shrinkBuf(strm.output, strm.next_out)));\n } else {\n this.onData(utils.shrinkBuf(strm.output, strm.next_out));\n }\n }\n } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== Z_STREAM_END);\n\n // Finalize on the last chunk.\n if (_mode === Z_FINISH) {\n status = zlib_deflate.deflateEnd(this.strm);\n this.onEnd(status);\n this.ended = true;\n return status === Z_OK;\n }\n\n // callback interim results if Z_SYNC_FLUSH.\n if (_mode === Z_SYNC_FLUSH) {\n this.onEnd(Z_OK);\n strm.avail_out = 0;\n return true;\n }\n return true;\n};\n\n/**\n * Deflate#onData(chunk) -> Void\n * - chunk (Uint8Array|Array|String): output data. Type of array depends\n * on js engine support. When string output requested, each chunk\n * will be string.\n *\n * By default, stores data blocks in `chunks[]` property and glue\n * those in `onEnd`. Override this handler, if you need another behaviour.\n **/\nDeflate.prototype.onData = function (chunk) {\n this.chunks.push(chunk);\n};\n\n/**\n * Deflate#onEnd(status) -> Void\n * - status (Number): deflate status. 0 (Z_OK) on success,\n * other if not.\n *\n * Called once after you tell deflate that the input stream is\n * complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH)\n * or if an error happened. By default - join collected chunks,\n * free memory and fill `results` / `err` properties.\n **/\nDeflate.prototype.onEnd = function (status) {\n // On success - join\n if (status === Z_OK) {\n if (this.options.to === 'string') {\n this.result = this.chunks.join('');\n } else {\n this.result = utils.flattenChunks(this.chunks);\n }\n }\n this.chunks = [];\n this.err = status;\n this.msg = this.strm.msg;\n};\n\n/**\n * deflate(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to compress.\n * - options (Object): zlib deflate options.\n *\n * Compress `data` with deflate algorithm and `options`.\n *\n * Supported options are:\n *\n * - level\n * - windowBits\n * - memLevel\n * - strategy\n * - dictionary\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information on these.\n *\n * Sugar (options):\n *\n * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify\n * negative windowBits implicitly.\n * - `to` (String) - if equal to 'string', then result will be \"binary string\"\n * (each char code [0..255])\n *\n * ##### Example:\n *\n * ```javascript\n * var pako = require('pako')\n * , data = Uint8Array([1,2,3,4,5,6,7,8,9]);\n *\n * console.log(pako.deflate(data));\n * ```\n **/\nfunction deflate(input, options) {\n var deflator = new Deflate(options);\n deflator.push(input, true);\n\n // That will never happens, if you don't cheat with options :)\n if (deflator.err) {\n throw deflator.msg || msg[deflator.err];\n }\n return deflator.result;\n}\n\n/**\n * deflateRaw(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to compress.\n * - options (Object): zlib deflate options.\n *\n * The same as [[deflate]], but creates raw data, without wrapper\n * (header and adler32 crc).\n **/\nfunction deflateRaw(input, options) {\n options = options || {};\n options.raw = true;\n return deflate(input, options);\n}\n\n/**\n * gzip(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to compress.\n * - options (Object): zlib deflate options.\n *\n * The same as [[deflate]], but create gzip wrapper instead of\n * deflate one.\n **/\nfunction gzip(input, options) {\n options = options || {};\n options.gzip = true;\n return deflate(input, options);\n}\nexports.Deflate = Deflate;\nexports.deflate = deflate;\nexports.deflateRaw = deflateRaw;\nexports.gzip = gzip;","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\n// See state defs from inflate.js\nvar BAD = 30; /* got a data error -- remain here until reset */\nvar TYPE = 12; /* i: waiting for type bits, including last-flag bit */\n\n/*\n Decode literal, length, and distance codes and write out the resulting\n literal and match bytes until either not enough input or output is\n available, an end-of-block is encountered, or a data error is encountered.\n When large enough input and output buffers are supplied to inflate(), for\n example, a 16K input buffer and a 64K output buffer, more than 95% of the\n inflate execution time is spent in this routine.\n\n Entry assumptions:\n\n state.mode === LEN\n strm.avail_in >= 6\n strm.avail_out >= 258\n start >= strm.avail_out\n state.bits < 8\n\n On return, state.mode is one of:\n\n LEN -- ran out of enough output space or enough available input\n TYPE -- reached end of block code, inflate() to interpret next block\n BAD -- error in block data\n\n Notes:\n\n - The maximum input bits used by a length/distance pair is 15 bits for the\n length code, 5 bits for the length extra, 15 bits for the distance code,\n and 13 bits for the distance extra. This totals 48 bits, or six bytes.\n Therefore if strm.avail_in >= 6, then there is enough input to avoid\n checking for available input while decoding.\n\n - The maximum bytes that a single length/distance pair can output is 258\n bytes, which is the maximum length that can be coded. inflate_fast()\n requires strm.avail_out >= 258 for each loop to avoid checking for\n output space.\n */\nmodule.exports = function inflate_fast(strm, start) {\n var state;\n var _in; /* local strm.input */\n var last; /* have enough input while in < last */\n var _out; /* local strm.output */\n var beg; /* inflate()'s initial strm.output */\n var end; /* while out < end, enough space available */\n //#ifdef INFLATE_STRICT\n var dmax; /* maximum distance from zlib header */\n //#endif\n var wsize; /* window size or zero if not using window */\n var whave; /* valid bytes in the window */\n var wnext; /* window write index */\n // Use `s_window` instead `window`, avoid conflict with instrumentation tools\n var s_window; /* allocated sliding window, if wsize != 0 */\n var hold; /* local strm.hold */\n var bits; /* local strm.bits */\n var lcode; /* local strm.lencode */\n var dcode; /* local strm.distcode */\n var lmask; /* mask for first level of length codes */\n var dmask; /* mask for first level of distance codes */\n var here; /* retrieved table entry */\n var op; /* code bits, operation, extra bits, or */\n /* window position, window bytes to copy */\n var len; /* match length, unused bytes */\n var dist; /* match distance */\n var from; /* where to copy match from */\n var from_source;\n var input, output; // JS specific, because we have no pointers\n\n /* copy state to local variables */\n state = strm.state;\n //here = state.here;\n _in = strm.next_in;\n input = strm.input;\n last = _in + (strm.avail_in - 5);\n _out = strm.next_out;\n output = strm.output;\n beg = _out - (start - strm.avail_out);\n end = _out + (strm.avail_out - 257);\n //#ifdef INFLATE_STRICT\n dmax = state.dmax;\n //#endif\n wsize = state.wsize;\n whave = state.whave;\n wnext = state.wnext;\n s_window = state.window;\n hold = state.hold;\n bits = state.bits;\n lcode = state.lencode;\n dcode = state.distcode;\n lmask = (1 << state.lenbits) - 1;\n dmask = (1 << state.distbits) - 1;\n\n /* decode literals and length/distances until end-of-block or not enough\n input data or output space */\n\n top: do {\n if (bits < 15) {\n hold += input[_in++] << bits;\n bits += 8;\n hold += input[_in++] << bits;\n bits += 8;\n }\n here = lcode[hold & lmask];\n dolen: for (;;) {\n // Goto emulation\n op = here >>> 24 /*here.bits*/;\n hold >>>= op;\n bits -= op;\n op = here >>> 16 & 0xff /*here.op*/;\n if (op === 0) {\n /* literal */\n //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?\n // \"inflate: literal '%c'\\n\" :\n // \"inflate: literal 0x%02x\\n\", here.val));\n output[_out++] = here & 0xffff /*here.val*/;\n } else if (op & 16) {\n /* length base */\n len = here & 0xffff /*here.val*/;\n op &= 15; /* number of extra bits */\n if (op) {\n if (bits < op) {\n hold += input[_in++] << bits;\n bits += 8;\n }\n len += hold & (1 << op) - 1;\n hold >>>= op;\n bits -= op;\n }\n //Tracevv((stderr, \"inflate: length %u\\n\", len));\n if (bits < 15) {\n hold += input[_in++] << bits;\n bits += 8;\n hold += input[_in++] << bits;\n bits += 8;\n }\n here = dcode[hold & dmask];\n dodist: for (;;) {\n // goto emulation\n op = here >>> 24 /*here.bits*/;\n hold >>>= op;\n bits -= op;\n op = here >>> 16 & 0xff /*here.op*/;\n if (op & 16) {\n /* distance base */\n dist = here & 0xffff /*here.val*/;\n op &= 15; /* number of extra bits */\n if (bits < op) {\n hold += input[_in++] << bits;\n bits += 8;\n if (bits < op) {\n hold += input[_in++] << bits;\n bits += 8;\n }\n }\n dist += hold & (1 << op) - 1;\n //#ifdef INFLATE_STRICT\n if (dist > dmax) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break top;\n }\n //#endif\n hold >>>= op;\n bits -= op;\n //Tracevv((stderr, \"inflate: distance %u\\n\", dist));\n op = _out - beg; /* max distance in output */\n if (dist > op) {\n /* see if copy from window */\n op = dist - op; /* distance back in window */\n if (op > whave) {\n if (state.sane) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break top;\n }\n\n // (!) This block is disabled in zlib defaults,\n // don't enable it for binary compatibility\n //#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR\n // if (len <= op - whave) {\n // do {\n // output[_out++] = 0;\n // } while (--len);\n // continue top;\n // }\n // len -= op - whave;\n // do {\n // output[_out++] = 0;\n // } while (--op > whave);\n // if (op === 0) {\n // from = _out - dist;\n // do {\n // output[_out++] = output[from++];\n // } while (--len);\n // continue top;\n // }\n //#endif\n }\n from = 0; // window index\n from_source = s_window;\n if (wnext === 0) {\n /* very common case */\n from += wsize - op;\n if (op < len) {\n /* some from window */\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = _out - dist; /* rest from output */\n from_source = output;\n }\n } else if (wnext < op) {\n /* wrap around window */\n from += wsize + wnext - op;\n op -= wnext;\n if (op < len) {\n /* some from end of window */\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = 0;\n if (wnext < len) {\n /* some from start of window */\n op = wnext;\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = _out - dist; /* rest from output */\n from_source = output;\n }\n }\n } else {\n /* contiguous in window */\n from += wnext - op;\n if (op < len) {\n /* some from window */\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = _out - dist; /* rest from output */\n from_source = output;\n }\n }\n while (len > 2) {\n output[_out++] = from_source[from++];\n output[_out++] = from_source[from++];\n output[_out++] = from_source[from++];\n len -= 3;\n }\n if (len) {\n output[_out++] = from_source[from++];\n if (len > 1) {\n output[_out++] = from_source[from++];\n }\n }\n } else {\n from = _out - dist; /* copy direct from output */\n do {\n /* minimum length is three */\n output[_out++] = output[from++];\n output[_out++] = output[from++];\n output[_out++] = output[from++];\n len -= 3;\n } while (len > 2);\n if (len) {\n output[_out++] = output[from++];\n if (len > 1) {\n output[_out++] = output[from++];\n }\n }\n }\n } else if ((op & 64) === 0) {\n /* 2nd level distance code */\n here = dcode[(here & 0xffff /*here.val*/) + (hold & (1 << op) - 1)];\n continue dodist;\n } else {\n strm.msg = 'invalid distance code';\n state.mode = BAD;\n break top;\n }\n break; // need to emulate goto via \"continue\"\n }\n } else if ((op & 64) === 0) {\n /* 2nd level length code */\n here = lcode[(here & 0xffff /*here.val*/) + (hold & (1 << op) - 1)];\n continue dolen;\n } else if (op & 32) {\n /* end-of-block */\n //Tracevv((stderr, \"inflate: end of block\\n\"));\n state.mode = TYPE;\n break top;\n } else {\n strm.msg = 'invalid literal/length code';\n state.mode = BAD;\n break top;\n }\n break; // need to emulate goto via \"continue\"\n }\n } while (_in < last && _out < end);\n\n /* return unused bytes (on entry, bits < 8, so in won't go too far back) */\n len = bits >> 3;\n _in -= len;\n bits -= len << 3;\n hold &= (1 << bits) - 1;\n\n /* update state and return */\n strm.next_in = _in;\n strm.next_out = _out;\n strm.avail_in = _in < last ? 5 + (last - _in) : 5 - (_in - last);\n strm.avail_out = _out < end ? 257 + (end - _out) : 257 - (_out - end);\n state.hold = hold;\n state.bits = bits;\n return;\n};","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\nvar utils = require('../utils/common');\nvar MAXBITS = 15;\nvar ENOUGH_LENS = 852;\nvar ENOUGH_DISTS = 592;\n//var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS);\n\nvar CODES = 0;\nvar LENS = 1;\nvar DISTS = 2;\nvar lbase = [/* Length codes 257..285 base */\n3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0];\nvar lext = [/* Length codes 257..285 extra */\n16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78];\nvar dbase = [/* Distance codes 0..29 base */\n1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577, 0, 0];\nvar dext = [/* Distance codes 0..29 extra */\n16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 64, 64];\nmodule.exports = function inflate_table(type, lens, lens_index, codes, table, table_index, work, opts) {\n var bits = opts.bits;\n //here = opts.here; /* table entry for duplication */\n\n var len = 0; /* a code's length in bits */\n var sym = 0; /* index of code symbols */\n var min = 0,\n max = 0; /* minimum and maximum code lengths */\n var root = 0; /* number of index bits for root table */\n var curr = 0; /* number of index bits for current table */\n var drop = 0; /* code bits to drop for sub-table */\n var left = 0; /* number of prefix codes available */\n var used = 0; /* code entries in table used */\n var huff = 0; /* Huffman code */\n var incr; /* for incrementing code, index */\n var fill; /* index for replicating entries */\n var low; /* low bits for current root entry */\n var mask; /* mask for low root bits */\n var next; /* next available space in table */\n var base = null; /* base value table to use */\n var base_index = 0;\n // var shoextra; /* extra bits table to use */\n var end; /* use base and extra for symbol > end */\n var count = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* number of codes of each length */\n var offs = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* offsets in table for each length */\n var extra = null;\n var extra_index = 0;\n var here_bits, here_op, here_val;\n\n /*\n Process a set of code lengths to create a canonical Huffman code. The\n code lengths are lens[0..codes-1]. Each length corresponds to the\n symbols 0..codes-1. The Huffman code is generated by first sorting the\n symbols by length from short to long, and retaining the symbol order\n for codes with equal lengths. Then the code starts with all zero bits\n for the first code of the shortest length, and the codes are integer\n increments for the same length, and zeros are appended as the length\n increases. For the deflate format, these bits are stored backwards\n from their more natural integer increment ordering, and so when the\n decoding tables are built in the large loop below, the integer codes\n are incremented backwards.\n This routine assumes, but does not check, that all of the entries in\n lens[] are in the range 0..MAXBITS. The caller must assure this.\n 1..MAXBITS is interpreted as that code length. zero means that that\n symbol does not occur in this code.\n The codes are sorted by computing a count of codes for each length,\n creating from that a table of starting indices for each length in the\n sorted table, and then entering the symbols in order in the sorted\n table. The sorted table is work[], with that space being provided by\n the caller.\n The length counts are used for other purposes as well, i.e. finding\n the minimum and maximum length codes, determining if there are any\n codes at all, checking for a valid set of lengths, and looking ahead\n at length counts to determine sub-table sizes when building the\n decoding tables.\n */\n\n /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */\n for (len = 0; len <= MAXBITS; len++) {\n count[len] = 0;\n }\n for (sym = 0; sym < codes; sym++) {\n count[lens[lens_index + sym]]++;\n }\n\n /* bound code lengths, force root to be within code lengths */\n root = bits;\n for (max = MAXBITS; max >= 1; max--) {\n if (count[max] !== 0) {\n break;\n }\n }\n if (root > max) {\n root = max;\n }\n if (max === 0) {\n /* no symbols to code at all */\n //table.op[opts.table_index] = 64; //here.op = (var char)64; /* invalid code marker */\n //table.bits[opts.table_index] = 1; //here.bits = (var char)1;\n //table.val[opts.table_index++] = 0; //here.val = (var short)0;\n table[table_index++] = 1 << 24 | 64 << 16 | 0;\n\n //table.op[opts.table_index] = 64;\n //table.bits[opts.table_index] = 1;\n //table.val[opts.table_index++] = 0;\n table[table_index++] = 1 << 24 | 64 << 16 | 0;\n opts.bits = 1;\n return 0; /* no symbols, but wait for decoding to report error */\n }\n for (min = 1; min < max; min++) {\n if (count[min] !== 0) {\n break;\n }\n }\n if (root < min) {\n root = min;\n }\n\n /* check for an over-subscribed or incomplete set of lengths */\n left = 1;\n for (len = 1; len <= MAXBITS; len++) {\n left <<= 1;\n left -= count[len];\n if (left < 0) {\n return -1;\n } /* over-subscribed */\n }\n if (left > 0 && (type === CODES || max !== 1)) {\n return -1; /* incomplete set */\n }\n\n /* generate offsets into symbol table for each length for sorting */\n offs[1] = 0;\n for (len = 1; len < MAXBITS; len++) {\n offs[len + 1] = offs[len] + count[len];\n }\n\n /* sort symbols by length, by symbol order within each length */\n for (sym = 0; sym < codes; sym++) {\n if (lens[lens_index + sym] !== 0) {\n work[offs[lens[lens_index + sym]]++] = sym;\n }\n }\n\n /*\n Create and fill in decoding tables. In this loop, the table being\n filled is at next and has curr index bits. The code being used is huff\n with length len. That code is converted to an index by dropping drop\n bits off of the bottom. For codes where len is less than drop + curr,\n those top drop + curr - len bits are incremented through all values to\n fill the table with replicated entries.\n root is the number of index bits for the root table. When len exceeds\n root, sub-tables are created pointed to by the root entry with an index\n of the low root bits of huff. This is saved in low to check for when a\n new sub-table should be started. drop is zero when the root table is\n being filled, and drop is root when sub-tables are being filled.\n When a new sub-table is needed, it is necessary to look ahead in the\n code lengths to determine what size sub-table is needed. The length\n counts are used for this, and so count[] is decremented as codes are\n entered in the tables.\n used keeps track of how many table entries have been allocated from the\n provided *table space. It is checked for LENS and DIST tables against\n the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in\n the initial root table size constants. See the comments in inftrees.h\n for more information.\n sym increments through all symbols, and the loop terminates when\n all codes of length max, i.e. all codes, have been processed. This\n routine permits incomplete codes, so another loop after this one fills\n in the rest of the decoding tables with invalid code markers.\n */\n\n /* set up for code type */\n // poor man optimization - use if-else instead of switch,\n // to avoid deopts in old v8\n if (type === CODES) {\n base = extra = work; /* dummy value--not used */\n end = 19;\n } else if (type === LENS) {\n base = lbase;\n base_index -= 257;\n extra = lext;\n extra_index -= 257;\n end = 256;\n } else {\n /* DISTS */\n base = dbase;\n extra = dext;\n end = -1;\n }\n\n /* initialize opts for loop */\n huff = 0; /* starting code */\n sym = 0; /* starting code symbol */\n len = min; /* starting code length */\n next = table_index; /* current table to fill in */\n curr = root; /* current table index bits */\n drop = 0; /* current bits to drop from code for index */\n low = -1; /* trigger new sub-table when len > root */\n used = 1 << root; /* use root table entries */\n mask = used - 1; /* mask for comparing low */\n\n /* check available table space */\n if (type === LENS && used > ENOUGH_LENS || type === DISTS && used > ENOUGH_DISTS) {\n return 1;\n }\n\n /* process all codes and make table entries */\n for (;;) {\n /* create table entry */\n here_bits = len - drop;\n if (work[sym] < end) {\n here_op = 0;\n here_val = work[sym];\n } else if (work[sym] > end) {\n here_op = extra[extra_index + work[sym]];\n here_val = base[base_index + work[sym]];\n } else {\n here_op = 32 + 64; /* end of block */\n here_val = 0;\n }\n\n /* replicate for those indices with low len bits equal to huff */\n incr = 1 << len - drop;\n fill = 1 << curr;\n min = fill; /* save offset to next table */\n do {\n fill -= incr;\n table[next + (huff >> drop) + fill] = here_bits << 24 | here_op << 16 | here_val | 0;\n } while (fill !== 0);\n\n /* backwards increment the len-bit code huff */\n incr = 1 << len - 1;\n while (huff & incr) {\n incr >>= 1;\n }\n if (incr !== 0) {\n huff &= incr - 1;\n huff += incr;\n } else {\n huff = 0;\n }\n\n /* go to next symbol, update count, len */\n sym++;\n if (--count[len] === 0) {\n if (len === max) {\n break;\n }\n len = lens[lens_index + work[sym]];\n }\n\n /* create new sub-table if needed */\n if (len > root && (huff & mask) !== low) {\n /* if first time, transition to sub-tables */\n if (drop === 0) {\n drop = root;\n }\n\n /* increment past last table */\n next += min; /* here min is 1 << curr */\n\n /* determine length of next table */\n curr = len - drop;\n left = 1 << curr;\n while (curr + drop < max) {\n left -= count[curr + drop];\n if (left <= 0) {\n break;\n }\n curr++;\n left <<= 1;\n }\n\n /* check for enough space */\n used += 1 << curr;\n if (type === LENS && used > ENOUGH_LENS || type === DISTS && used > ENOUGH_DISTS) {\n return 1;\n }\n\n /* point entry in root table to sub-table */\n low = huff & mask;\n /*table.op[low] = curr;\n table.bits[low] = root;\n table.val[low] = next - opts.table_index;*/\n table[low] = root << 24 | curr << 16 | next - table_index | 0;\n }\n }\n\n /* fill in remaining table entry if code is incomplete (guaranteed to have\n at most one remaining entry, since if the code is incomplete, the\n maximum code length that was allowed to get this far is one bit) */\n if (huff !== 0) {\n //table.op[next + huff] = 64; /* invalid code marker */\n //table.bits[next + huff] = len - drop;\n //table.val[next + huff] = 0;\n table[next + huff] = len - drop << 24 | 64 << 16 | 0;\n }\n\n /* set return parameters */\n //opts.table_index += used;\n opts.bits = root;\n return 0;\n};","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\nvar utils = require('../utils/common');\nvar adler32 = require('./adler32');\nvar crc32 = require('./crc32');\nvar inflate_fast = require('./inffast');\nvar inflate_table = require('./inftrees');\nvar CODES = 0;\nvar LENS = 1;\nvar DISTS = 2;\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\n/* Allowed flush values; see deflate() and inflate() below for details */\n//var Z_NO_FLUSH = 0;\n//var Z_PARTIAL_FLUSH = 1;\n//var Z_SYNC_FLUSH = 2;\n//var Z_FULL_FLUSH = 3;\nvar Z_FINISH = 4;\nvar Z_BLOCK = 5;\nvar Z_TREES = 6;\n\n/* Return codes for the compression/decompression functions. Negative values\n * are errors, positive values are used for special but normal events.\n */\nvar Z_OK = 0;\nvar Z_STREAM_END = 1;\nvar Z_NEED_DICT = 2;\n//var Z_ERRNO = -1;\nvar Z_STREAM_ERROR = -2;\nvar Z_DATA_ERROR = -3;\nvar Z_MEM_ERROR = -4;\nvar Z_BUF_ERROR = -5;\n//var Z_VERSION_ERROR = -6;\n\n/* The deflate compression method */\nvar Z_DEFLATED = 8;\n\n/* STATES ====================================================================*/\n/* ===========================================================================*/\n\nvar HEAD = 1; /* i: waiting for magic header */\nvar FLAGS = 2; /* i: waiting for method and flags (gzip) */\nvar TIME = 3; /* i: waiting for modification time (gzip) */\nvar OS = 4; /* i: waiting for extra flags and operating system (gzip) */\nvar EXLEN = 5; /* i: waiting for extra length (gzip) */\nvar EXTRA = 6; /* i: waiting for extra bytes (gzip) */\nvar NAME = 7; /* i: waiting for end of file name (gzip) */\nvar COMMENT = 8; /* i: waiting for end of comment (gzip) */\nvar HCRC = 9; /* i: waiting for header crc (gzip) */\nvar DICTID = 10; /* i: waiting for dictionary check value */\nvar DICT = 11; /* waiting for inflateSetDictionary() call */\nvar TYPE = 12; /* i: waiting for type bits, including last-flag bit */\nvar TYPEDO = 13; /* i: same, but skip check to exit inflate on new block */\nvar STORED = 14; /* i: waiting for stored size (length and complement) */\nvar COPY_ = 15; /* i/o: same as COPY below, but only first time in */\nvar COPY = 16; /* i/o: waiting for input or output to copy stored block */\nvar TABLE = 17; /* i: waiting for dynamic block table lengths */\nvar LENLENS = 18; /* i: waiting for code length code lengths */\nvar CODELENS = 19; /* i: waiting for length/lit and distance code lengths */\nvar LEN_ = 20; /* i: same as LEN below, but only first time in */\nvar LEN = 21; /* i: waiting for length/lit/eob code */\nvar LENEXT = 22; /* i: waiting for length extra bits */\nvar DIST = 23; /* i: waiting for distance code */\nvar DISTEXT = 24; /* i: waiting for distance extra bits */\nvar MATCH = 25; /* o: waiting for output space to copy string */\nvar LIT = 26; /* o: waiting for output space to write literal */\nvar CHECK = 27; /* i: waiting for 32-bit check value */\nvar LENGTH = 28; /* i: waiting for 32-bit length (gzip) */\nvar DONE = 29; /* finished check, done -- remain here until reset */\nvar BAD = 30; /* got a data error -- remain here until reset */\nvar MEM = 31; /* got an inflate() memory error -- remain here until reset */\nvar SYNC = 32; /* looking for synchronization bytes to restart inflate() */\n\n/* ===========================================================================*/\n\nvar ENOUGH_LENS = 852;\nvar ENOUGH_DISTS = 592;\n//var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS);\n\nvar MAX_WBITS = 15;\n/* 32K LZ77 window */\nvar DEF_WBITS = MAX_WBITS;\nfunction zswap32(q) {\n return (q >>> 24 & 0xff) + (q >>> 8 & 0xff00) + ((q & 0xff00) << 8) + ((q & 0xff) << 24);\n}\nfunction InflateState() {\n this.mode = 0; /* current inflate mode */\n this.last = false; /* true if processing last block */\n this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */\n this.havedict = false; /* true if dictionary provided */\n this.flags = 0; /* gzip header method and flags (0 if zlib) */\n this.dmax = 0; /* zlib header max distance (INFLATE_STRICT) */\n this.check = 0; /* protected copy of check value */\n this.total = 0; /* protected copy of output count */\n // TODO: may be {}\n this.head = null; /* where to save gzip header information */\n\n /* sliding window */\n this.wbits = 0; /* log base 2 of requested window size */\n this.wsize = 0; /* window size or zero if not using window */\n this.whave = 0; /* valid bytes in the window */\n this.wnext = 0; /* window write index */\n this.window = null; /* allocated sliding window, if needed */\n\n /* bit accumulator */\n this.hold = 0; /* input bit accumulator */\n this.bits = 0; /* number of bits in \"in\" */\n\n /* for string and stored block copying */\n this.length = 0; /* literal or length of data to copy */\n this.offset = 0; /* distance back to copy string from */\n\n /* for table and code decoding */\n this.extra = 0; /* extra bits needed */\n\n /* fixed and dynamic code tables */\n this.lencode = null; /* starting table for length/literal codes */\n this.distcode = null; /* starting table for distance codes */\n this.lenbits = 0; /* index bits for lencode */\n this.distbits = 0; /* index bits for distcode */\n\n /* dynamic table building */\n this.ncode = 0; /* number of code length code lengths */\n this.nlen = 0; /* number of length code lengths */\n this.ndist = 0; /* number of distance code lengths */\n this.have = 0; /* number of code lengths in lens[] */\n this.next = null; /* next available space in codes[] */\n\n this.lens = new utils.Buf16(320); /* temporary storage for code lengths */\n this.work = new utils.Buf16(288); /* work area for code table building */\n\n /*\n because we don't have pointers in js, we use lencode and distcode directly\n as buffers so we don't need codes\n */\n //this.codes = new utils.Buf32(ENOUGH); /* space for code tables */\n this.lendyn = null; /* dynamic table for length/literal codes (JS specific) */\n this.distdyn = null; /* dynamic table for distance codes (JS specific) */\n this.sane = 0; /* if false, allow invalid distance too far */\n this.back = 0; /* bits back of last unprocessed length/lit */\n this.was = 0; /* initial length of match */\n}\nfunction inflateResetKeep(strm) {\n var state;\n if (!strm || !strm.state) {\n return Z_STREAM_ERROR;\n }\n state = strm.state;\n strm.total_in = strm.total_out = state.total = 0;\n strm.msg = ''; /*Z_NULL*/\n if (state.wrap) {\n /* to support ill-conceived Java test suite */\n strm.adler = state.wrap & 1;\n }\n state.mode = HEAD;\n state.last = 0;\n state.havedict = 0;\n state.dmax = 32768;\n state.head = null /*Z_NULL*/;\n state.hold = 0;\n state.bits = 0;\n //state.lencode = state.distcode = state.next = state.codes;\n state.lencode = state.lendyn = new utils.Buf32(ENOUGH_LENS);\n state.distcode = state.distdyn = new utils.Buf32(ENOUGH_DISTS);\n state.sane = 1;\n state.back = -1;\n //Tracev((stderr, \"inflate: reset\\n\"));\n return Z_OK;\n}\nfunction inflateReset(strm) {\n var state;\n if (!strm || !strm.state) {\n return Z_STREAM_ERROR;\n }\n state = strm.state;\n state.wsize = 0;\n state.whave = 0;\n state.wnext = 0;\n return inflateResetKeep(strm);\n}\nfunction inflateReset2(strm, windowBits) {\n var wrap;\n var state;\n\n /* get the state */\n if (!strm || !strm.state) {\n return Z_STREAM_ERROR;\n }\n state = strm.state;\n\n /* extract wrap request from windowBits parameter */\n if (windowBits < 0) {\n wrap = 0;\n windowBits = -windowBits;\n } else {\n wrap = (windowBits >> 4) + 1;\n if (windowBits < 48) {\n windowBits &= 15;\n }\n }\n\n /* set number of window bits, free window if different */\n if (windowBits && (windowBits < 8 || windowBits > 15)) {\n return Z_STREAM_ERROR;\n }\n if (state.window !== null && state.wbits !== windowBits) {\n state.window = null;\n }\n\n /* update state and reset the rest of it */\n state.wrap = wrap;\n state.wbits = windowBits;\n return inflateReset(strm);\n}\nfunction inflateInit2(strm, windowBits) {\n var ret;\n var state;\n if (!strm) {\n return Z_STREAM_ERROR;\n }\n //strm.msg = Z_NULL; /* in case we return an error */\n\n state = new InflateState();\n\n //if (state === Z_NULL) return Z_MEM_ERROR;\n //Tracev((stderr, \"inflate: allocated\\n\"));\n strm.state = state;\n state.window = null /*Z_NULL*/;\n ret = inflateReset2(strm, windowBits);\n if (ret !== Z_OK) {\n strm.state = null /*Z_NULL*/;\n }\n return ret;\n}\nfunction inflateInit(strm) {\n return inflateInit2(strm, DEF_WBITS);\n}\n\n/*\n Return state with length and distance decoding tables and index sizes set to\n fixed code decoding. Normally this returns fixed tables from inffixed.h.\n If BUILDFIXED is defined, then instead this routine builds the tables the\n first time it's called, and returns those tables the first time and\n thereafter. This reduces the size of the code by about 2K bytes, in\n exchange for a little execution time. However, BUILDFIXED should not be\n used for threaded applications, since the rewriting of the tables and virgin\n may not be thread-safe.\n */\nvar virgin = true;\nvar lenfix, distfix; // We have no pointers in JS, so keep tables separate\n\nfunction fixedtables(state) {\n /* build fixed huffman tables if first call (may not be thread safe) */\n if (virgin) {\n var sym;\n lenfix = new utils.Buf32(512);\n distfix = new utils.Buf32(32);\n\n /* literal/length table */\n sym = 0;\n while (sym < 144) {\n state.lens[sym++] = 8;\n }\n while (sym < 256) {\n state.lens[sym++] = 9;\n }\n while (sym < 280) {\n state.lens[sym++] = 7;\n }\n while (sym < 288) {\n state.lens[sym++] = 8;\n }\n inflate_table(LENS, state.lens, 0, 288, lenfix, 0, state.work, {\n bits: 9\n });\n\n /* distance table */\n sym = 0;\n while (sym < 32) {\n state.lens[sym++] = 5;\n }\n inflate_table(DISTS, state.lens, 0, 32, distfix, 0, state.work, {\n bits: 5\n });\n\n /* do this just once */\n virgin = false;\n }\n state.lencode = lenfix;\n state.lenbits = 9;\n state.distcode = distfix;\n state.distbits = 5;\n}\n\n/*\n Update the window with the last wsize (normally 32K) bytes written before\n returning. If window does not exist yet, create it. This is only called\n when a window is already in use, or when output has been written during this\n inflate call, but the end of the deflate stream has not been reached yet.\n It is also called to create a window for dictionary data when a dictionary\n is loaded.\n\n Providing output buffers larger than 32K to inflate() should provide a speed\n advantage, since only the last 32K of output is copied to the sliding window\n upon return from inflate(), and since all distances after the first 32K of\n output will fall in the output data, making match copies simpler and faster.\n The advantage may be dependent on the size of the processor's data caches.\n */\nfunction updatewindow(strm, src, end, copy) {\n var dist;\n var state = strm.state;\n\n /* if it hasn't been done already, allocate space for the window */\n if (state.window === null) {\n state.wsize = 1 << state.wbits;\n state.wnext = 0;\n state.whave = 0;\n state.window = new utils.Buf8(state.wsize);\n }\n\n /* copy state->wsize or less output bytes into the circular window */\n if (copy >= state.wsize) {\n utils.arraySet(state.window, src, end - state.wsize, state.wsize, 0);\n state.wnext = 0;\n state.whave = state.wsize;\n } else {\n dist = state.wsize - state.wnext;\n if (dist > copy) {\n dist = copy;\n }\n //zmemcpy(state->window + state->wnext, end - copy, dist);\n utils.arraySet(state.window, src, end - copy, dist, state.wnext);\n copy -= dist;\n if (copy) {\n //zmemcpy(state->window, end - copy, copy);\n utils.arraySet(state.window, src, end - copy, copy, 0);\n state.wnext = copy;\n state.whave = state.wsize;\n } else {\n state.wnext += dist;\n if (state.wnext === state.wsize) {\n state.wnext = 0;\n }\n if (state.whave < state.wsize) {\n state.whave += dist;\n }\n }\n }\n return 0;\n}\nfunction inflate(strm, flush) {\n var state;\n var input, output; // input/output buffers\n var next; /* next input INDEX */\n var put; /* next output INDEX */\n var have, left; /* available input and output */\n var hold; /* bit buffer */\n var bits; /* bits in bit buffer */\n var _in, _out; /* save starting available input and output */\n var copy; /* number of stored or match bytes to copy */\n var from; /* where to copy match bytes from */\n var from_source;\n var here = 0; /* current decoding table entry */\n var here_bits, here_op, here_val; // paked \"here\" denormalized (JS specific)\n //var last; /* parent table entry */\n var last_bits, last_op, last_val; // paked \"last\" denormalized (JS specific)\n var len; /* length to copy for repeats, bits to drop */\n var ret; /* return code */\n var hbuf = new utils.Buf8(4); /* buffer for gzip header crc calculation */\n var opts;\n var n; // temporary var for NEED_BITS\n\n var order = /* permutation of code lengths */\n [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15];\n if (!strm || !strm.state || !strm.output || !strm.input && strm.avail_in !== 0) {\n return Z_STREAM_ERROR;\n }\n state = strm.state;\n if (state.mode === TYPE) {\n state.mode = TYPEDO;\n } /* skip check */\n\n //--- LOAD() ---\n put = strm.next_out;\n output = strm.output;\n left = strm.avail_out;\n next = strm.next_in;\n input = strm.input;\n have = strm.avail_in;\n hold = state.hold;\n bits = state.bits;\n //---\n\n _in = have;\n _out = left;\n ret = Z_OK;\n inf_leave:\n // goto emulation\n for (;;) {\n switch (state.mode) {\n case HEAD:\n if (state.wrap === 0) {\n state.mode = TYPEDO;\n break;\n }\n //=== NEEDBITS(16);\n while (bits < 16) {\n if (have === 0) {\n break inf_leave;\n }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (state.wrap & 2 && hold === 0x8b1f) {\n /* gzip header */\n state.check = 0 /*crc32(0L, Z_NULL, 0)*/;\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = hold >>> 8 & 0xff;\n state.check = crc32(state.check, hbuf, 2, 0);\n //===//\n\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = FLAGS;\n break;\n }\n state.flags = 0; /* expect zlib header */\n if (state.head) {\n state.head.done = false;\n }\n if (!(state.wrap & 1) || /* check if zlib header allowed */\n (((hold & 0xff /*BITS(8)*/) << 8) + (hold >> 8)) % 31) {\n strm.msg = 'incorrect header check';\n state.mode = BAD;\n break;\n }\n if ((hold & 0x0f /*BITS(4)*/) !== Z_DEFLATED) {\n strm.msg = 'unknown compression method';\n state.mode = BAD;\n break;\n }\n //--- DROPBITS(4) ---//\n hold >>>= 4;\n bits -= 4;\n //---//\n len = (hold & 0x0f /*BITS(4)*/) + 8;\n if (state.wbits === 0) {\n state.wbits = len;\n } else if (len > state.wbits) {\n strm.msg = 'invalid window size';\n state.mode = BAD;\n break;\n }\n state.dmax = 1 << len;\n //Tracev((stderr, \"inflate: zlib header ok\\n\"));\n strm.adler = state.check = 1 /*adler32(0L, Z_NULL, 0)*/;\n state.mode = hold & 0x200 ? DICTID : TYPE;\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n break;\n case FLAGS:\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) {\n break inf_leave;\n }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.flags = hold;\n if ((state.flags & 0xff) !== Z_DEFLATED) {\n strm.msg = 'unknown compression method';\n state.mode = BAD;\n break;\n }\n if (state.flags & 0xe000) {\n strm.msg = 'unknown header flags set';\n state.mode = BAD;\n break;\n }\n if (state.head) {\n state.head.text = hold >> 8 & 1;\n }\n if (state.flags & 0x0200) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = hold >>> 8 & 0xff;\n state.check = crc32(state.check, hbuf, 2, 0);\n //===//\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = TIME;\n /* falls through */\n case TIME:\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) {\n break inf_leave;\n }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (state.head) {\n state.head.time = hold;\n }\n if (state.flags & 0x0200) {\n //=== CRC4(state.check, hold)\n hbuf[0] = hold & 0xff;\n hbuf[1] = hold >>> 8 & 0xff;\n hbuf[2] = hold >>> 16 & 0xff;\n hbuf[3] = hold >>> 24 & 0xff;\n state.check = crc32(state.check, hbuf, 4, 0);\n //===\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = OS;\n /* falls through */\n case OS:\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) {\n break inf_leave;\n }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (state.head) {\n state.head.xflags = hold & 0xff;\n state.head.os = hold >> 8;\n }\n if (state.flags & 0x0200) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = hold >>> 8 & 0xff;\n state.check = crc32(state.check, hbuf, 2, 0);\n //===//\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = EXLEN;\n /* falls through */\n case EXLEN:\n if (state.flags & 0x0400) {\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) {\n break inf_leave;\n }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.length = hold;\n if (state.head) {\n state.head.extra_len = hold;\n }\n if (state.flags & 0x0200) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = hold >>> 8 & 0xff;\n state.check = crc32(state.check, hbuf, 2, 0);\n //===//\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n } else if (state.head) {\n state.head.extra = null /*Z_NULL*/;\n }\n state.mode = EXTRA;\n /* falls through */\n case EXTRA:\n if (state.flags & 0x0400) {\n copy = state.length;\n if (copy > have) {\n copy = have;\n }\n if (copy) {\n if (state.head) {\n len = state.head.extra_len - state.length;\n if (!state.head.extra) {\n // Use untyped array for more convenient processing later\n state.head.extra = new Array(state.head.extra_len);\n }\n utils.arraySet(state.head.extra, input, next,\n // extra field is limited to 65536 bytes\n // - no need for additional size check\n copy, /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/\n len);\n //zmemcpy(state.head.extra + len, next,\n // len + copy > state.head.extra_max ?\n // state.head.extra_max - len : copy);\n }\n if (state.flags & 0x0200) {\n state.check = crc32(state.check, input, copy, next);\n }\n have -= copy;\n next += copy;\n state.length -= copy;\n }\n if (state.length) {\n break inf_leave;\n }\n }\n state.length = 0;\n state.mode = NAME;\n /* falls through */\n case NAME:\n if (state.flags & 0x0800) {\n if (have === 0) {\n break inf_leave;\n }\n copy = 0;\n do {\n // TODO: 2 or 1 bytes?\n len = input[next + copy++];\n /* use constant limit because in js we should not preallocate memory */\n if (state.head && len && state.length < 65536 /*state.head.name_max*/) {\n state.head.name += String.fromCharCode(len);\n }\n } while (len && copy < have);\n if (state.flags & 0x0200) {\n state.check = crc32(state.check, input, copy, next);\n }\n have -= copy;\n next += copy;\n if (len) {\n break inf_leave;\n }\n } else if (state.head) {\n state.head.name = null;\n }\n state.length = 0;\n state.mode = COMMENT;\n /* falls through */\n case COMMENT:\n if (state.flags & 0x1000) {\n if (have === 0) {\n break inf_leave;\n }\n copy = 0;\n do {\n len = input[next + copy++];\n /* use constant limit because in js we should not preallocate memory */\n if (state.head && len && state.length < 65536 /*state.head.comm_max*/) {\n state.head.comment += String.fromCharCode(len);\n }\n } while (len && copy < have);\n if (state.flags & 0x0200) {\n state.check = crc32(state.check, input, copy, next);\n }\n have -= copy;\n next += copy;\n if (len) {\n break inf_leave;\n }\n } else if (state.head) {\n state.head.comment = null;\n }\n state.mode = HCRC;\n /* falls through */\n case HCRC:\n if (state.flags & 0x0200) {\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) {\n break inf_leave;\n }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (hold !== (state.check & 0xffff)) {\n strm.msg = 'header crc mismatch';\n state.mode = BAD;\n break;\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n }\n if (state.head) {\n state.head.hcrc = state.flags >> 9 & 1;\n state.head.done = true;\n }\n strm.adler = state.check = 0;\n state.mode = TYPE;\n break;\n case DICTID:\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) {\n break inf_leave;\n }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n strm.adler = state.check = zswap32(hold);\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = DICT;\n /* falls through */\n case DICT:\n if (state.havedict === 0) {\n //--- RESTORE() ---\n strm.next_out = put;\n strm.avail_out = left;\n strm.next_in = next;\n strm.avail_in = have;\n state.hold = hold;\n state.bits = bits;\n //---\n return Z_NEED_DICT;\n }\n strm.adler = state.check = 1 /*adler32(0L, Z_NULL, 0)*/;\n state.mode = TYPE;\n /* falls through */\n case TYPE:\n if (flush === Z_BLOCK || flush === Z_TREES) {\n break inf_leave;\n }\n /* falls through */\n case TYPEDO:\n if (state.last) {\n //--- BYTEBITS() ---//\n hold >>>= bits & 7;\n bits -= bits & 7;\n //---//\n state.mode = CHECK;\n break;\n }\n //=== NEEDBITS(3); */\n while (bits < 3) {\n if (have === 0) {\n break inf_leave;\n }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.last = hold & 0x01 /*BITS(1)*/;\n //--- DROPBITS(1) ---//\n hold >>>= 1;\n bits -= 1;\n //---//\n\n switch (hold & 0x03 /*BITS(2)*/) {\n case 0:\n /* stored block */\n //Tracev((stderr, \"inflate: stored block%s\\n\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = STORED;\n break;\n case 1:\n /* fixed block */\n fixedtables(state);\n //Tracev((stderr, \"inflate: fixed codes block%s\\n\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = LEN_; /* decode codes */\n if (flush === Z_TREES) {\n //--- DROPBITS(2) ---//\n hold >>>= 2;\n bits -= 2;\n //---//\n break inf_leave;\n }\n break;\n case 2:\n /* dynamic block */\n //Tracev((stderr, \"inflate: dynamic codes block%s\\n\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = TABLE;\n break;\n case 3:\n strm.msg = 'invalid block type';\n state.mode = BAD;\n }\n //--- DROPBITS(2) ---//\n hold >>>= 2;\n bits -= 2;\n //---//\n break;\n case STORED:\n //--- BYTEBITS() ---// /* go to byte boundary */\n hold >>>= bits & 7;\n bits -= bits & 7;\n //---//\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) {\n break inf_leave;\n }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if ((hold & 0xffff) !== (hold >>> 16 ^ 0xffff)) {\n strm.msg = 'invalid stored block lengths';\n state.mode = BAD;\n break;\n }\n state.length = hold & 0xffff;\n //Tracev((stderr, \"inflate: stored length %u\\n\",\n // state.length));\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = COPY_;\n if (flush === Z_TREES) {\n break inf_leave;\n }\n /* falls through */\n case COPY_:\n state.mode = COPY;\n /* falls through */\n case COPY:\n copy = state.length;\n if (copy) {\n if (copy > have) {\n copy = have;\n }\n if (copy > left) {\n copy = left;\n }\n if (copy === 0) {\n break inf_leave;\n }\n //--- zmemcpy(put, next, copy); ---\n utils.arraySet(output, input, next, copy, put);\n //---//\n have -= copy;\n next += copy;\n left -= copy;\n put += copy;\n state.length -= copy;\n break;\n }\n //Tracev((stderr, \"inflate: stored end\\n\"));\n state.mode = TYPE;\n break;\n case TABLE:\n //=== NEEDBITS(14); */\n while (bits < 14) {\n if (have === 0) {\n break inf_leave;\n }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.nlen = (hold & 0x1f /*BITS(5)*/) + 257;\n //--- DROPBITS(5) ---//\n hold >>>= 5;\n bits -= 5;\n //---//\n state.ndist = (hold & 0x1f /*BITS(5)*/) + 1;\n //--- DROPBITS(5) ---//\n hold >>>= 5;\n bits -= 5;\n //---//\n state.ncode = (hold & 0x0f /*BITS(4)*/) + 4;\n //--- DROPBITS(4) ---//\n hold >>>= 4;\n bits -= 4;\n //---//\n //#ifndef PKZIP_BUG_WORKAROUND\n if (state.nlen > 286 || state.ndist > 30) {\n strm.msg = 'too many length or distance symbols';\n state.mode = BAD;\n break;\n }\n //#endif\n //Tracev((stderr, \"inflate: table sizes ok\\n\"));\n state.have = 0;\n state.mode = LENLENS;\n /* falls through */\n case LENLENS:\n while (state.have < state.ncode) {\n //=== NEEDBITS(3);\n while (bits < 3) {\n if (have === 0) {\n break inf_leave;\n }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.lens[order[state.have++]] = hold & 0x07; //BITS(3);\n //--- DROPBITS(3) ---//\n hold >>>= 3;\n bits -= 3;\n //---//\n }\n while (state.have < 19) {\n state.lens[order[state.have++]] = 0;\n }\n // We have separate tables & no pointers. 2 commented lines below not needed.\n //state.next = state.codes;\n //state.lencode = state.next;\n // Switch to use dynamic table\n state.lencode = state.lendyn;\n state.lenbits = 7;\n opts = {\n bits: state.lenbits\n };\n ret = inflate_table(CODES, state.lens, 0, 19, state.lencode, 0, state.work, opts);\n state.lenbits = opts.bits;\n if (ret) {\n strm.msg = 'invalid code lengths set';\n state.mode = BAD;\n break;\n }\n //Tracev((stderr, \"inflate: code lengths ok\\n\"));\n state.have = 0;\n state.mode = CODELENS;\n /* falls through */\n case CODELENS:\n while (state.have < state.nlen + state.ndist) {\n for (;;) {\n here = state.lencode[hold & (1 << state.lenbits) - 1]; /*BITS(state.lenbits)*/\n here_bits = here >>> 24;\n here_op = here >>> 16 & 0xff;\n here_val = here & 0xffff;\n if (here_bits <= bits) {\n break;\n }\n //--- PULLBYTE() ---//\n if (have === 0) {\n break inf_leave;\n }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n if (here_val < 16) {\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n state.lens[state.have++] = here_val;\n } else {\n if (here_val === 16) {\n //=== NEEDBITS(here.bits + 2);\n n = here_bits + 2;\n while (bits < n) {\n if (have === 0) {\n break inf_leave;\n }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n if (state.have === 0) {\n strm.msg = 'invalid bit length repeat';\n state.mode = BAD;\n break;\n }\n len = state.lens[state.have - 1];\n copy = 3 + (hold & 0x03); //BITS(2);\n //--- DROPBITS(2) ---//\n hold >>>= 2;\n bits -= 2;\n //---//\n } else if (here_val === 17) {\n //=== NEEDBITS(here.bits + 3);\n n = here_bits + 3;\n while (bits < n) {\n if (have === 0) {\n break inf_leave;\n }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n len = 0;\n copy = 3 + (hold & 0x07); //BITS(3);\n //--- DROPBITS(3) ---//\n hold >>>= 3;\n bits -= 3;\n //---//\n } else {\n //=== NEEDBITS(here.bits + 7);\n n = here_bits + 7;\n while (bits < n) {\n if (have === 0) {\n break inf_leave;\n }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n len = 0;\n copy = 11 + (hold & 0x7f); //BITS(7);\n //--- DROPBITS(7) ---//\n hold >>>= 7;\n bits -= 7;\n //---//\n }\n if (state.have + copy > state.nlen + state.ndist) {\n strm.msg = 'invalid bit length repeat';\n state.mode = BAD;\n break;\n }\n while (copy--) {\n state.lens[state.have++] = len;\n }\n }\n }\n\n /* handle error breaks in while */\n if (state.mode === BAD) {\n break;\n }\n\n /* check for end-of-block code (better have one) */\n if (state.lens[256] === 0) {\n strm.msg = 'invalid code -- missing end-of-block';\n state.mode = BAD;\n break;\n }\n\n /* build code tables -- note: do not change the lenbits or distbits\n values here (9 and 6) without reading the comments in inftrees.h\n concerning the ENOUGH constants, which depend on those values */\n state.lenbits = 9;\n opts = {\n bits: state.lenbits\n };\n ret = inflate_table(LENS, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts);\n // We have separate tables & no pointers. 2 commented lines below not needed.\n // state.next_index = opts.table_index;\n state.lenbits = opts.bits;\n // state.lencode = state.next;\n\n if (ret) {\n strm.msg = 'invalid literal/lengths set';\n state.mode = BAD;\n break;\n }\n state.distbits = 6;\n //state.distcode.copy(state.codes);\n // Switch to use dynamic table\n state.distcode = state.distdyn;\n opts = {\n bits: state.distbits\n };\n ret = inflate_table(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts);\n // We have separate tables & no pointers. 2 commented lines below not needed.\n // state.next_index = opts.table_index;\n state.distbits = opts.bits;\n // state.distcode = state.next;\n\n if (ret) {\n strm.msg = 'invalid distances set';\n state.mode = BAD;\n break;\n }\n //Tracev((stderr, 'inflate: codes ok\\n'));\n state.mode = LEN_;\n if (flush === Z_TREES) {\n break inf_leave;\n }\n /* falls through */\n case LEN_:\n state.mode = LEN;\n /* falls through */\n case LEN:\n if (have >= 6 && left >= 258) {\n //--- RESTORE() ---\n strm.next_out = put;\n strm.avail_out = left;\n strm.next_in = next;\n strm.avail_in = have;\n state.hold = hold;\n state.bits = bits;\n //---\n inflate_fast(strm, _out);\n //--- LOAD() ---\n put = strm.next_out;\n output = strm.output;\n left = strm.avail_out;\n next = strm.next_in;\n input = strm.input;\n have = strm.avail_in;\n hold = state.hold;\n bits = state.bits;\n //---\n\n if (state.mode === TYPE) {\n state.back = -1;\n }\n break;\n }\n state.back = 0;\n for (;;) {\n here = state.lencode[hold & (1 << state.lenbits) - 1]; /*BITS(state.lenbits)*/\n here_bits = here >>> 24;\n here_op = here >>> 16 & 0xff;\n here_val = here & 0xffff;\n if (here_bits <= bits) {\n break;\n }\n //--- PULLBYTE() ---//\n if (have === 0) {\n break inf_leave;\n }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n if (here_op && (here_op & 0xf0) === 0) {\n last_bits = here_bits;\n last_op = here_op;\n last_val = here_val;\n for (;;) {\n here = state.lencode[last_val + ((hold & (1 << last_bits + last_op) - 1 /*BITS(last.bits + last.op)*/) >> last_bits)];\n here_bits = here >>> 24;\n here_op = here >>> 16 & 0xff;\n here_val = here & 0xffff;\n if (last_bits + here_bits <= bits) {\n break;\n }\n //--- PULLBYTE() ---//\n if (have === 0) {\n break inf_leave;\n }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n //--- DROPBITS(last.bits) ---//\n hold >>>= last_bits;\n bits -= last_bits;\n //---//\n state.back += last_bits;\n }\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n state.back += here_bits;\n state.length = here_val;\n if (here_op === 0) {\n //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?\n // \"inflate: literal '%c'\\n\" :\n // \"inflate: literal 0x%02x\\n\", here.val));\n state.mode = LIT;\n break;\n }\n if (here_op & 32) {\n //Tracevv((stderr, \"inflate: end of block\\n\"));\n state.back = -1;\n state.mode = TYPE;\n break;\n }\n if (here_op & 64) {\n strm.msg = 'invalid literal/length code';\n state.mode = BAD;\n break;\n }\n state.extra = here_op & 15;\n state.mode = LENEXT;\n /* falls through */\n case LENEXT:\n if (state.extra) {\n //=== NEEDBITS(state.extra);\n n = state.extra;\n while (bits < n) {\n if (have === 0) {\n break inf_leave;\n }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.length += hold & (1 << state.extra) - 1 /*BITS(state.extra)*/;\n //--- DROPBITS(state.extra) ---//\n hold >>>= state.extra;\n bits -= state.extra;\n //---//\n state.back += state.extra;\n }\n //Tracevv((stderr, \"inflate: length %u\\n\", state.length));\n state.was = state.length;\n state.mode = DIST;\n /* falls through */\n case DIST:\n for (;;) {\n here = state.distcode[hold & (1 << state.distbits) - 1]; /*BITS(state.distbits)*/\n here_bits = here >>> 24;\n here_op = here >>> 16 & 0xff;\n here_val = here & 0xffff;\n if (here_bits <= bits) {\n break;\n }\n //--- PULLBYTE() ---//\n if (have === 0) {\n break inf_leave;\n }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n if ((here_op & 0xf0) === 0) {\n last_bits = here_bits;\n last_op = here_op;\n last_val = here_val;\n for (;;) {\n here = state.distcode[last_val + ((hold & (1 << last_bits + last_op) - 1 /*BITS(last.bits + last.op)*/) >> last_bits)];\n here_bits = here >>> 24;\n here_op = here >>> 16 & 0xff;\n here_val = here & 0xffff;\n if (last_bits + here_bits <= bits) {\n break;\n }\n //--- PULLBYTE() ---//\n if (have === 0) {\n break inf_leave;\n }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n //--- DROPBITS(last.bits) ---//\n hold >>>= last_bits;\n bits -= last_bits;\n //---//\n state.back += last_bits;\n }\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n state.back += here_bits;\n if (here_op & 64) {\n strm.msg = 'invalid distance code';\n state.mode = BAD;\n break;\n }\n state.offset = here_val;\n state.extra = here_op & 15;\n state.mode = DISTEXT;\n /* falls through */\n case DISTEXT:\n if (state.extra) {\n //=== NEEDBITS(state.extra);\n n = state.extra;\n while (bits < n) {\n if (have === 0) {\n break inf_leave;\n }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.offset += hold & (1 << state.extra) - 1 /*BITS(state.extra)*/;\n //--- DROPBITS(state.extra) ---//\n hold >>>= state.extra;\n bits -= state.extra;\n //---//\n state.back += state.extra;\n }\n //#ifdef INFLATE_STRICT\n if (state.offset > state.dmax) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break;\n }\n //#endif\n //Tracevv((stderr, \"inflate: distance %u\\n\", state.offset));\n state.mode = MATCH;\n /* falls through */\n case MATCH:\n if (left === 0) {\n break inf_leave;\n }\n copy = _out - left;\n if (state.offset > copy) {\n /* copy from window */\n copy = state.offset - copy;\n if (copy > state.whave) {\n if (state.sane) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break;\n }\n // (!) This block is disabled in zlib defaults,\n // don't enable it for binary compatibility\n //#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR\n // Trace((stderr, \"inflate.c too far\\n\"));\n // copy -= state.whave;\n // if (copy > state.length) { copy = state.length; }\n // if (copy > left) { copy = left; }\n // left -= copy;\n // state.length -= copy;\n // do {\n // output[put++] = 0;\n // } while (--copy);\n // if (state.length === 0) { state.mode = LEN; }\n // break;\n //#endif\n }\n if (copy > state.wnext) {\n copy -= state.wnext;\n from = state.wsize - copy;\n } else {\n from = state.wnext - copy;\n }\n if (copy > state.length) {\n copy = state.length;\n }\n from_source = state.window;\n } else {\n /* copy from output */\n from_source = output;\n from = put - state.offset;\n copy = state.length;\n }\n if (copy > left) {\n copy = left;\n }\n left -= copy;\n state.length -= copy;\n do {\n output[put++] = from_source[from++];\n } while (--copy);\n if (state.length === 0) {\n state.mode = LEN;\n }\n break;\n case LIT:\n if (left === 0) {\n break inf_leave;\n }\n output[put++] = state.length;\n left--;\n state.mode = LEN;\n break;\n case CHECK:\n if (state.wrap) {\n //=== NEEDBITS(32);\n while (bits < 32) {\n if (have === 0) {\n break inf_leave;\n }\n have--;\n // Use '|' instead of '+' to make sure that result is signed\n hold |= input[next++] << bits;\n bits += 8;\n }\n //===//\n _out -= left;\n strm.total_out += _out;\n state.total += _out;\n if (_out) {\n strm.adler = state.check = /*UPDATE(state.check, put - _out, _out);*/\n state.flags ? crc32(state.check, output, _out, put - _out) : adler32(state.check, output, _out, put - _out);\n }\n _out = left;\n // NB: crc32 stored as signed 32-bit int, zswap32 returns signed too\n if ((state.flags ? hold : zswap32(hold)) !== state.check) {\n strm.msg = 'incorrect data check';\n state.mode = BAD;\n break;\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n //Tracev((stderr, \"inflate: check matches trailer\\n\"));\n }\n state.mode = LENGTH;\n /* falls through */\n case LENGTH:\n if (state.wrap && state.flags) {\n //=== NEEDBITS(32);\n while (bits < 32) {\n if (have === 0) {\n break inf_leave;\n }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (hold !== (state.total & 0xffffffff)) {\n strm.msg = 'incorrect length check';\n state.mode = BAD;\n break;\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n //Tracev((stderr, \"inflate: length matches trailer\\n\"));\n }\n state.mode = DONE;\n /* falls through */\n case DONE:\n ret = Z_STREAM_END;\n break inf_leave;\n case BAD:\n ret = Z_DATA_ERROR;\n break inf_leave;\n case MEM:\n return Z_MEM_ERROR;\n case SYNC:\n /* falls through */\n default:\n return Z_STREAM_ERROR;\n }\n }\n\n // inf_leave <- here is real place for \"goto inf_leave\", emulated via \"break inf_leave\"\n\n /*\n Return from inflate(), updating the total counts and the check value.\n If there was no progress during the inflate() call, return a buffer\n error. Call updatewindow() to create and/or update the window state.\n Note: a memory error from inflate() is non-recoverable.\n */\n\n //--- RESTORE() ---\n strm.next_out = put;\n strm.avail_out = left;\n strm.next_in = next;\n strm.avail_in = have;\n state.hold = hold;\n state.bits = bits;\n //---\n\n if (state.wsize || _out !== strm.avail_out && state.mode < BAD && (state.mode < CHECK || flush !== Z_FINISH)) {\n if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out)) {\n state.mode = MEM;\n return Z_MEM_ERROR;\n }\n }\n _in -= strm.avail_in;\n _out -= strm.avail_out;\n strm.total_in += _in;\n strm.total_out += _out;\n state.total += _out;\n if (state.wrap && _out) {\n strm.adler = state.check = /*UPDATE(state.check, strm.next_out - _out, _out);*/\n state.flags ? crc32(state.check, output, _out, strm.next_out - _out) : adler32(state.check, output, _out, strm.next_out - _out);\n }\n strm.data_type = state.bits + (state.last ? 64 : 0) + (state.mode === TYPE ? 128 : 0) + (state.mode === LEN_ || state.mode === COPY_ ? 256 : 0);\n if ((_in === 0 && _out === 0 || flush === Z_FINISH) && ret === Z_OK) {\n ret = Z_BUF_ERROR;\n }\n return ret;\n}\nfunction inflateEnd(strm) {\n if (!strm || !strm.state /*|| strm->zfree == (free_func)0*/) {\n return Z_STREAM_ERROR;\n }\n var state = strm.state;\n if (state.window) {\n state.window = null;\n }\n strm.state = null;\n return Z_OK;\n}\nfunction inflateGetHeader(strm, head) {\n var state;\n\n /* check state */\n if (!strm || !strm.state) {\n return Z_STREAM_ERROR;\n }\n state = strm.state;\n if ((state.wrap & 2) === 0) {\n return Z_STREAM_ERROR;\n }\n\n /* save header structure */\n state.head = head;\n head.done = false;\n return Z_OK;\n}\nfunction inflateSetDictionary(strm, dictionary) {\n var dictLength = dictionary.length;\n var state;\n var dictid;\n var ret;\n\n /* check state */\n if (!strm /* == Z_NULL */ || !strm.state /* == Z_NULL */) {\n return Z_STREAM_ERROR;\n }\n state = strm.state;\n if (state.wrap !== 0 && state.mode !== DICT) {\n return Z_STREAM_ERROR;\n }\n\n /* check for correct dictionary identifier */\n if (state.mode === DICT) {\n dictid = 1; /* adler32(0, null, 0)*/\n /* dictid = adler32(dictid, dictionary, dictLength); */\n dictid = adler32(dictid, dictionary, dictLength, 0);\n if (dictid !== state.check) {\n return Z_DATA_ERROR;\n }\n }\n /* copy dictionary to window using updatewindow(), which will amend the\n existing dictionary if appropriate */\n ret = updatewindow(strm, dictionary, dictLength, dictLength);\n if (ret) {\n state.mode = MEM;\n return Z_MEM_ERROR;\n }\n state.havedict = 1;\n // Tracev((stderr, \"inflate: dictionary set\\n\"));\n return Z_OK;\n}\nexports.inflateReset = inflateReset;\nexports.inflateReset2 = inflateReset2;\nexports.inflateResetKeep = inflateResetKeep;\nexports.inflateInit = inflateInit;\nexports.inflateInit2 = inflateInit2;\nexports.inflate = inflate;\nexports.inflateEnd = inflateEnd;\nexports.inflateGetHeader = inflateGetHeader;\nexports.inflateSetDictionary = inflateSetDictionary;\nexports.inflateInfo = 'pako inflate (from Nodeca project)';\n\n/* Not implemented\nexports.inflateCopy = inflateCopy;\nexports.inflateGetDictionary = inflateGetDictionary;\nexports.inflateMark = inflateMark;\nexports.inflatePrime = inflatePrime;\nexports.inflateSync = inflateSync;\nexports.inflateSyncPoint = inflateSyncPoint;\nexports.inflateUndermine = inflateUndermine;\n*/","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\nmodule.exports = {\n /* Allowed flush values; see deflate() and inflate() below for details */\n Z_NO_FLUSH: 0,\n Z_PARTIAL_FLUSH: 1,\n Z_SYNC_FLUSH: 2,\n Z_FULL_FLUSH: 3,\n Z_FINISH: 4,\n Z_BLOCK: 5,\n Z_TREES: 6,\n /* Return codes for the compression/decompression functions. Negative values\n * are errors, positive values are used for special but normal events.\n */\n Z_OK: 0,\n Z_STREAM_END: 1,\n Z_NEED_DICT: 2,\n Z_ERRNO: -1,\n Z_STREAM_ERROR: -2,\n Z_DATA_ERROR: -3,\n //Z_MEM_ERROR: -4,\n Z_BUF_ERROR: -5,\n //Z_VERSION_ERROR: -6,\n\n /* compression levels */\n Z_NO_COMPRESSION: 0,\n Z_BEST_SPEED: 1,\n Z_BEST_COMPRESSION: 9,\n Z_DEFAULT_COMPRESSION: -1,\n Z_FILTERED: 1,\n Z_HUFFMAN_ONLY: 2,\n Z_RLE: 3,\n Z_FIXED: 4,\n Z_DEFAULT_STRATEGY: 0,\n /* Possible values of the data_type field (though see inflate()) */\n Z_BINARY: 0,\n Z_TEXT: 1,\n //Z_ASCII: 1, // = Z_TEXT (deprecated)\n Z_UNKNOWN: 2,\n /* The deflate compression method */\n Z_DEFLATED: 8\n //Z_NULL: null // Use -1 or null inline, depending on var type\n};","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\nfunction GZheader() {\n /* true if compressed data believed to be text */\n this.text = 0;\n /* modification time */\n this.time = 0;\n /* extra flags (not used when writing a gzip file) */\n this.xflags = 0;\n /* operating system */\n this.os = 0;\n /* pointer to extra field or Z_NULL if none */\n this.extra = null;\n /* extra field length (valid if extra != Z_NULL) */\n this.extra_len = 0; // Actually, we don't need it in JS,\n // but leave for few code modifications\n\n //\n // Setup limits is not necessary because in js we should not preallocate memory\n // for inflate use constant limit in 65536 bytes\n //\n\n /* space at extra (only when reading header) */\n // this.extra_max = 0;\n /* pointer to zero-terminated file name or Z_NULL */\n this.name = '';\n /* space at name (only when reading header) */\n // this.name_max = 0;\n /* pointer to zero-terminated comment or Z_NULL */\n this.comment = '';\n /* space at comment (only when reading header) */\n // this.comm_max = 0;\n /* true if there was or will be a header crc */\n this.hcrc = 0;\n /* true when done reading gzip header (not used when writing a gzip file) */\n this.done = false;\n}\nmodule.exports = GZheader;","'use strict';\n\nvar zlib_inflate = require('./zlib/inflate');\nvar utils = require('./utils/common');\nvar strings = require('./utils/strings');\nvar c = require('./zlib/constants');\nvar msg = require('./zlib/messages');\nvar ZStream = require('./zlib/zstream');\nvar GZheader = require('./zlib/gzheader');\nvar toString = Object.prototype.toString;\n\n/**\n * class Inflate\n *\n * Generic JS-style wrapper for zlib calls. If you don't need\n * streaming behaviour - use more simple functions: [[inflate]]\n * and [[inflateRaw]].\n **/\n\n/* internal\n * inflate.chunks -> Array\n *\n * Chunks of output data, if [[Inflate#onData]] not overridden.\n **/\n\n/**\n * Inflate.result -> Uint8Array|Array|String\n *\n * Uncompressed result, generated by default [[Inflate#onData]]\n * and [[Inflate#onEnd]] handlers. Filled after you push last chunk\n * (call [[Inflate#push]] with `Z_FINISH` / `true` param) or if you\n * push a chunk with explicit flush (call [[Inflate#push]] with\n * `Z_SYNC_FLUSH` param).\n **/\n\n/**\n * Inflate.err -> Number\n *\n * Error code after inflate finished. 0 (Z_OK) on success.\n * Should be checked if broken data possible.\n **/\n\n/**\n * Inflate.msg -> String\n *\n * Error message, if [[Inflate.err]] != 0\n **/\n\n/**\n * new Inflate(options)\n * - options (Object): zlib inflate options.\n *\n * Creates new inflator instance with specified params. Throws exception\n * on bad params. Supported options:\n *\n * - `windowBits`\n * - `dictionary`\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information on these.\n *\n * Additional options, for internal needs:\n *\n * - `chunkSize` - size of generated data chunks (16K by default)\n * - `raw` (Boolean) - do raw inflate\n * - `to` (String) - if equal to 'string', then result will be converted\n * from utf8 to utf16 (javascript) string. When string output requested,\n * chunk length can differ from `chunkSize`, depending on content.\n *\n * By default, when no options set, autodetect deflate/gzip data format via\n * wrapper header.\n *\n * ##### Example:\n *\n * ```javascript\n * var pako = require('pako')\n * , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9])\n * , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]);\n *\n * var inflate = new pako.Inflate({ level: 3});\n *\n * inflate.push(chunk1, false);\n * inflate.push(chunk2, true); // true -> last chunk\n *\n * if (inflate.err) { throw new Error(inflate.err); }\n *\n * console.log(inflate.result);\n * ```\n **/\nfunction Inflate(options) {\n if (!(this instanceof Inflate)) return new Inflate(options);\n this.options = utils.assign({\n chunkSize: 16384,\n windowBits: 0,\n to: ''\n }, options || {});\n var opt = this.options;\n\n // Force window size for `raw` data, if not set directly,\n // because we have no header for autodetect.\n if (opt.raw && opt.windowBits >= 0 && opt.windowBits < 16) {\n opt.windowBits = -opt.windowBits;\n if (opt.windowBits === 0) {\n opt.windowBits = -15;\n }\n }\n\n // If `windowBits` not defined (and mode not raw) - set autodetect flag for gzip/deflate\n if (opt.windowBits >= 0 && opt.windowBits < 16 && !(options && options.windowBits)) {\n opt.windowBits += 32;\n }\n\n // Gzip header has no info about windows size, we can do autodetect only\n // for deflate. So, if window size not set, force it to max when gzip possible\n if (opt.windowBits > 15 && opt.windowBits < 48) {\n // bit 3 (16) -> gzipped data\n // bit 4 (32) -> autodetect gzip/deflate\n if ((opt.windowBits & 15) === 0) {\n opt.windowBits |= 15;\n }\n }\n this.err = 0; // error code, if happens (0 = Z_OK)\n this.msg = ''; // error message\n this.ended = false; // used to avoid multiple onEnd() calls\n this.chunks = []; // chunks of compressed data\n\n this.strm = new ZStream();\n this.strm.avail_out = 0;\n var status = zlib_inflate.inflateInit2(this.strm, opt.windowBits);\n if (status !== c.Z_OK) {\n throw new Error(msg[status]);\n }\n this.header = new GZheader();\n zlib_inflate.inflateGetHeader(this.strm, this.header);\n\n // Setup dictionary\n if (opt.dictionary) {\n // Convert data if needed\n if (typeof opt.dictionary === 'string') {\n opt.dictionary = strings.string2buf(opt.dictionary);\n } else if (toString.call(opt.dictionary) === '[object ArrayBuffer]') {\n opt.dictionary = new Uint8Array(opt.dictionary);\n }\n if (opt.raw) {\n //In raw mode we need to set the dictionary early\n status = zlib_inflate.inflateSetDictionary(this.strm, opt.dictionary);\n if (status !== c.Z_OK) {\n throw new Error(msg[status]);\n }\n }\n }\n}\n\n/**\n * Inflate#push(data[, mode]) -> Boolean\n * - data (Uint8Array|Array|ArrayBuffer|String): input data\n * - mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes.\n * See constants. Skipped or `false` means Z_NO_FLUSH, `true` means Z_FINISH.\n *\n * Sends input data to inflate pipe, generating [[Inflate#onData]] calls with\n * new output chunks. Returns `true` on success. The last data block must have\n * mode Z_FINISH (or `true`). That will flush internal pending buffers and call\n * [[Inflate#onEnd]]. For interim explicit flushes (without ending the stream) you\n * can use mode Z_SYNC_FLUSH, keeping the decompression context.\n *\n * On fail call [[Inflate#onEnd]] with error code and return false.\n *\n * We strongly recommend to use `Uint8Array` on input for best speed (output\n * format is detected automatically). Also, don't skip last param and always\n * use the same type in your code (boolean or number). That will improve JS speed.\n *\n * For regular `Array`-s make sure all elements are [0..255].\n *\n * ##### Example\n *\n * ```javascript\n * push(chunk, false); // push one of data chunks\n * ...\n * push(chunk, true); // push last chunk\n * ```\n **/\nInflate.prototype.push = function (data, mode) {\n var strm = this.strm;\n var chunkSize = this.options.chunkSize;\n var dictionary = this.options.dictionary;\n var status, _mode;\n var next_out_utf8, tail, utf8str;\n\n // Flag to properly process Z_BUF_ERROR on testing inflate call\n // when we check that all output data was flushed.\n var allowBufError = false;\n if (this.ended) {\n return false;\n }\n _mode = mode === ~~mode ? mode : mode === true ? c.Z_FINISH : c.Z_NO_FLUSH;\n\n // Convert data if needed\n if (typeof data === 'string') {\n // Only binary strings can be decompressed on practice\n strm.input = strings.binstring2buf(data);\n } else if (toString.call(data) === '[object ArrayBuffer]') {\n strm.input = new Uint8Array(data);\n } else {\n strm.input = data;\n }\n strm.next_in = 0;\n strm.avail_in = strm.input.length;\n do {\n if (strm.avail_out === 0) {\n strm.output = new utils.Buf8(chunkSize);\n strm.next_out = 0;\n strm.avail_out = chunkSize;\n }\n status = zlib_inflate.inflate(strm, c.Z_NO_FLUSH); /* no bad return value */\n\n if (status === c.Z_NEED_DICT && dictionary) {\n status = zlib_inflate.inflateSetDictionary(this.strm, dictionary);\n }\n if (status === c.Z_BUF_ERROR && allowBufError === true) {\n status = c.Z_OK;\n allowBufError = false;\n }\n if (status !== c.Z_STREAM_END && status !== c.Z_OK) {\n this.onEnd(status);\n this.ended = true;\n return false;\n }\n if (strm.next_out) {\n if (strm.avail_out === 0 || status === c.Z_STREAM_END || strm.avail_in === 0 && (_mode === c.Z_FINISH || _mode === c.Z_SYNC_FLUSH)) {\n if (this.options.to === 'string') {\n next_out_utf8 = strings.utf8border(strm.output, strm.next_out);\n tail = strm.next_out - next_out_utf8;\n utf8str = strings.buf2string(strm.output, next_out_utf8);\n\n // move tail\n strm.next_out = tail;\n strm.avail_out = chunkSize - tail;\n if (tail) {\n utils.arraySet(strm.output, strm.output, next_out_utf8, tail, 0);\n }\n this.onData(utf8str);\n } else {\n this.onData(utils.shrinkBuf(strm.output, strm.next_out));\n }\n }\n }\n\n // When no more input data, we should check that internal inflate buffers\n // are flushed. The only way to do it when avail_out = 0 - run one more\n // inflate pass. But if output data not exists, inflate return Z_BUF_ERROR.\n // Here we set flag to process this error properly.\n //\n // NOTE. Deflate does not return error in this case and does not needs such\n // logic.\n if (strm.avail_in === 0 && strm.avail_out === 0) {\n allowBufError = true;\n }\n } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== c.Z_STREAM_END);\n if (status === c.Z_STREAM_END) {\n _mode = c.Z_FINISH;\n }\n\n // Finalize on the last chunk.\n if (_mode === c.Z_FINISH) {\n status = zlib_inflate.inflateEnd(this.strm);\n this.onEnd(status);\n this.ended = true;\n return status === c.Z_OK;\n }\n\n // callback interim results if Z_SYNC_FLUSH.\n if (_mode === c.Z_SYNC_FLUSH) {\n this.onEnd(c.Z_OK);\n strm.avail_out = 0;\n return true;\n }\n return true;\n};\n\n/**\n * Inflate#onData(chunk) -> Void\n * - chunk (Uint8Array|Array|String): output data. Type of array depends\n * on js engine support. When string output requested, each chunk\n * will be string.\n *\n * By default, stores data blocks in `chunks[]` property and glue\n * those in `onEnd`. Override this handler, if you need another behaviour.\n **/\nInflate.prototype.onData = function (chunk) {\n this.chunks.push(chunk);\n};\n\n/**\n * Inflate#onEnd(status) -> Void\n * - status (Number): inflate status. 0 (Z_OK) on success,\n * other if not.\n *\n * Called either after you tell inflate that the input stream is\n * complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH)\n * or if an error happened. By default - join collected chunks,\n * free memory and fill `results` / `err` properties.\n **/\nInflate.prototype.onEnd = function (status) {\n // On success - join\n if (status === c.Z_OK) {\n if (this.options.to === 'string') {\n // Glue & convert here, until we teach pako to send\n // utf8 aligned strings to onData\n this.result = this.chunks.join('');\n } else {\n this.result = utils.flattenChunks(this.chunks);\n }\n }\n this.chunks = [];\n this.err = status;\n this.msg = this.strm.msg;\n};\n\n/**\n * inflate(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * Decompress `data` with inflate/ungzip and `options`. Autodetect\n * format via wrapper header by default. That's why we don't provide\n * separate `ungzip` method.\n *\n * Supported options are:\n *\n * - windowBits\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information.\n *\n * Sugar (options):\n *\n * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify\n * negative windowBits implicitly.\n * - `to` (String) - if equal to 'string', then result will be converted\n * from utf8 to utf16 (javascript) string. When string output requested,\n * chunk length can differ from `chunkSize`, depending on content.\n *\n *\n * ##### Example:\n *\n * ```javascript\n * var pako = require('pako')\n * , input = pako.deflate([1,2,3,4,5,6,7,8,9])\n * , output;\n *\n * try {\n * output = pako.inflate(input);\n * } catch (err)\n * console.log(err);\n * }\n * ```\n **/\nfunction inflate(input, options) {\n var inflator = new Inflate(options);\n inflator.push(input, true);\n\n // That will never happens, if you don't cheat with options :)\n if (inflator.err) {\n throw inflator.msg || msg[inflator.err];\n }\n return inflator.result;\n}\n\n/**\n * inflateRaw(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * The same as [[inflate]], but creates raw data, without wrapper\n * (header and adler32 crc).\n **/\nfunction inflateRaw(input, options) {\n options = options || {};\n options.raw = true;\n return inflate(input, options);\n}\n\n/**\n * ungzip(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * Just shortcut to [[inflate]], because it autodetects format\n * by header.content. Done for convenience.\n **/\n\nexports.Inflate = Inflate;\nexports.inflate = inflate;\nexports.inflateRaw = inflateRaw;\nexports.ungzip = inflate;","// Top level file is just a mixin of submodules & constants\n'use strict';\n\nvar assign = require('./lib/utils/common').assign;\nvar deflate = require('./lib/deflate');\nvar inflate = require('./lib/inflate');\nvar constants = require('./lib/zlib/constants');\nvar pako = {};\nassign(pako, deflate, inflate, constants);\nmodule.exports = pako;","'use strict';\n\nvar USE_TYPEDARRAY = typeof Uint8Array !== 'undefined' && typeof Uint16Array !== 'undefined' && typeof Uint32Array !== 'undefined';\nvar pako = require(\"pako\");\nexports.uncompressInputType = USE_TYPEDARRAY ? \"uint8array\" : \"array\";\nexports.compressInputType = USE_TYPEDARRAY ? \"uint8array\" : \"array\";\nexports.magic = \"\\x08\\x00\";\nexports.compress = function (input, compressionOptions) {\n return pako.deflateRaw(input, {\n level: compressionOptions.level || -1 // default compression\n });\n};\nexports.uncompress = function (input) {\n return pako.inflateRaw(input);\n};","'use strict';\n\nexports.STORE = {\n magic: \"\\x00\\x00\",\n compress: function (content, compressionOptions) {\n return content; // no compression\n },\n uncompress: function (content) {\n return content; // no compression\n },\n compressInputType: null,\n uncompressInputType: null\n};\nexports.DEFLATE = require('./flate');","'use strict';\n\nmodule.exports = function (data, encoding) {\n return new Buffer(data, encoding);\n};\nmodule.exports.test = function (b) {\n return Buffer.isBuffer(b);\n};","'use strict';\n\nvar support = require('./support');\nvar compressions = require('./compressions');\nvar nodeBuffer = require('./nodeBuffer');\n/**\n * Convert a string to a \"binary string\" : a string containing only char codes between 0 and 255.\n * @param {string} str the string to transform.\n * @return {String} the binary string.\n */\nexports.string2binary = function (str) {\n var result = \"\";\n for (var i = 0; i < str.length; i++) {\n result += String.fromCharCode(str.charCodeAt(i) & 0xff);\n }\n return result;\n};\nexports.arrayBuffer2Blob = function (buffer, mimeType) {\n exports.checkSupport(\"blob\");\n mimeType = mimeType || 'application/zip';\n try {\n // Blob constructor\n return new Blob([buffer], {\n type: mimeType\n });\n } catch (e) {\n try {\n // deprecated, browser only, old way\n var Builder = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder || window.MSBlobBuilder;\n var builder = new Builder();\n builder.append(buffer);\n return builder.getBlob(mimeType);\n } catch (e) {\n // well, fuck ?!\n throw new Error(\"Bug : can't construct the Blob.\");\n }\n }\n};\n/**\n * The identity function.\n * @param {Object} input the input.\n * @return {Object} the same input.\n */\nfunction identity(input) {\n return input;\n}\n\n/**\n * Fill in an array with a string.\n * @param {String} str the string to use.\n * @param {Array|ArrayBuffer|Uint8Array|Buffer} array the array to fill in (will be mutated).\n * @return {Array|ArrayBuffer|Uint8Array|Buffer} the updated array.\n */\nfunction stringToArrayLike(str, array) {\n for (var i = 0; i < str.length; ++i) {\n array[i] = str.charCodeAt(i) & 0xFF;\n }\n return array;\n}\n\n/**\n * Transform an array-like object to a string.\n * @param {Array|ArrayBuffer|Uint8Array|Buffer} array the array to transform.\n * @return {String} the result.\n */\nfunction arrayLikeToString(array) {\n // Performances notes :\n // --------------------\n // String.fromCharCode.apply(null, array) is the fastest, see\n // see http://jsperf.com/converting-a-uint8array-to-a-string/2\n // but the stack is limited (and we can get huge arrays !).\n //\n // result += String.fromCharCode(array[i]); generate too many strings !\n //\n // This code is inspired by http://jsperf.com/arraybuffer-to-string-apply-performance/2\n var chunk = 65536;\n var result = [],\n len = array.length,\n type = exports.getTypeOf(array),\n k = 0,\n canUseApply = true;\n try {\n switch (type) {\n case \"uint8array\":\n String.fromCharCode.apply(null, new Uint8Array(0));\n break;\n case \"nodebuffer\":\n String.fromCharCode.apply(null, nodeBuffer(0));\n break;\n }\n } catch (e) {\n canUseApply = false;\n }\n\n // no apply : slow and painful algorithm\n // default browser on android 4.*\n if (!canUseApply) {\n var resultStr = \"\";\n for (var i = 0; i < array.length; i++) {\n resultStr += String.fromCharCode(array[i]);\n }\n return resultStr;\n }\n while (k < len && chunk > 1) {\n try {\n if (type === \"array\" || type === \"nodebuffer\") {\n result.push(String.fromCharCode.apply(null, array.slice(k, Math.min(k + chunk, len))));\n } else {\n result.push(String.fromCharCode.apply(null, array.subarray(k, Math.min(k + chunk, len))));\n }\n k += chunk;\n } catch (e) {\n chunk = Math.floor(chunk / 2);\n }\n }\n return result.join(\"\");\n}\nexports.applyFromCharCode = arrayLikeToString;\n\n/**\n * Copy the data from an array-like to an other array-like.\n * @param {Array|ArrayBuffer|Uint8Array|Buffer} arrayFrom the origin array.\n * @param {Array|ArrayBuffer|Uint8Array|Buffer} arrayTo the destination array which will be mutated.\n * @return {Array|ArrayBuffer|Uint8Array|Buffer} the updated destination array.\n */\nfunction arrayLikeToArrayLike(arrayFrom, arrayTo) {\n for (var i = 0; i < arrayFrom.length; i++) {\n arrayTo[i] = arrayFrom[i];\n }\n return arrayTo;\n}\n\n// a matrix containing functions to transform everything into everything.\nvar transform = {};\n\n// string to ?\ntransform[\"string\"] = {\n \"string\": identity,\n \"array\": function (input) {\n return stringToArrayLike(input, new Array(input.length));\n },\n \"arraybuffer\": function (input) {\n return transform[\"string\"][\"uint8array\"](input).buffer;\n },\n \"uint8array\": function (input) {\n return stringToArrayLike(input, new Uint8Array(input.length));\n },\n \"nodebuffer\": function (input) {\n return stringToArrayLike(input, nodeBuffer(input.length));\n }\n};\n\n// array to ?\ntransform[\"array\"] = {\n \"string\": arrayLikeToString,\n \"array\": identity,\n \"arraybuffer\": function (input) {\n return new Uint8Array(input).buffer;\n },\n \"uint8array\": function (input) {\n return new Uint8Array(input);\n },\n \"nodebuffer\": function (input) {\n return nodeBuffer(input);\n }\n};\n\n// arraybuffer to ?\ntransform[\"arraybuffer\"] = {\n \"string\": function (input) {\n return arrayLikeToString(new Uint8Array(input));\n },\n \"array\": function (input) {\n return arrayLikeToArrayLike(new Uint8Array(input), new Array(input.byteLength));\n },\n \"arraybuffer\": identity,\n \"uint8array\": function (input) {\n return new Uint8Array(input);\n },\n \"nodebuffer\": function (input) {\n return nodeBuffer(new Uint8Array(input));\n }\n};\n\n// uint8array to ?\ntransform[\"uint8array\"] = {\n \"string\": arrayLikeToString,\n \"array\": function (input) {\n return arrayLikeToArrayLike(input, new Array(input.length));\n },\n \"arraybuffer\": function (input) {\n return input.buffer;\n },\n \"uint8array\": identity,\n \"nodebuffer\": function (input) {\n return nodeBuffer(input);\n }\n};\n\n// nodebuffer to ?\ntransform[\"nodebuffer\"] = {\n \"string\": arrayLikeToString,\n \"array\": function (input) {\n return arrayLikeToArrayLike(input, new Array(input.length));\n },\n \"arraybuffer\": function (input) {\n return transform[\"nodebuffer\"][\"uint8array\"](input).buffer;\n },\n \"uint8array\": function (input) {\n return arrayLikeToArrayLike(input, new Uint8Array(input.length));\n },\n \"nodebuffer\": identity\n};\n\n/**\n * Transform an input into any type.\n * The supported output type are : string, array, uint8array, arraybuffer, nodebuffer.\n * If no output type is specified, the unmodified input will be returned.\n * @param {String} outputType the output type.\n * @param {String|Array|ArrayBuffer|Uint8Array|Buffer} input the input to convert.\n * @throws {Error} an Error if the browser doesn't support the requested output type.\n */\nexports.transformTo = function (outputType, input) {\n if (!input) {\n // undefined, null, etc\n // an empty string won't harm.\n input = \"\";\n }\n if (!outputType) {\n return input;\n }\n exports.checkSupport(outputType);\n var inputType = exports.getTypeOf(input);\n var result = transform[inputType][outputType](input);\n return result;\n};\n\n/**\n * Return the type of the input.\n * The type will be in a format valid for JSZip.utils.transformTo : string, array, uint8array, arraybuffer.\n * @param {Object} input the input to identify.\n * @return {String} the (lowercase) type of the input.\n */\nexports.getTypeOf = function (input) {\n if (typeof input === \"string\") {\n return \"string\";\n }\n if (Object.prototype.toString.call(input) === \"[object Array]\") {\n return \"array\";\n }\n if (support.nodebuffer && nodeBuffer.test(input)) {\n return \"nodebuffer\";\n }\n if (support.uint8array && input instanceof Uint8Array) {\n return \"uint8array\";\n }\n if (support.arraybuffer && input instanceof ArrayBuffer) {\n return \"arraybuffer\";\n }\n};\n\n/**\n * Throw an exception if the type is not supported.\n * @param {String} type the type to check.\n * @throws {Error} an Error if the browser doesn't support the requested type.\n */\nexports.checkSupport = function (type) {\n var supported = support[type.toLowerCase()];\n if (!supported) {\n throw new Error(type + \" is not supported by this browser\");\n }\n};\nexports.MAX_VALUE_16BITS = 65535;\nexports.MAX_VALUE_32BITS = -1; // well, \"\\xFF\\xFF\\xFF\\xFF\\xFF\\xFF\\xFF\\xFF\" is parsed as -1\n\n/**\n * Prettify a string read as binary.\n * @param {string} str the string to prettify.\n * @return {string} a pretty string.\n */\nexports.pretty = function (str) {\n var res = '',\n code,\n i;\n for (i = 0; i < (str || \"\").length; i++) {\n code = str.charCodeAt(i);\n res += '\\\\x' + (code < 16 ? \"0\" : \"\") + code.toString(16).toUpperCase();\n }\n return res;\n};\n\n/**\n * Find a compression registered in JSZip.\n * @param {string} compressionMethod the method magic to find.\n * @return {Object|null} the JSZip compression object, null if none found.\n */\nexports.findCompression = function (compressionMethod) {\n for (var method in compressions) {\n if (!compressions.hasOwnProperty(method)) {\n continue;\n }\n if (compressions[method].magic === compressionMethod) {\n return compressions[method];\n }\n }\n return null;\n};\n/**\n* Cross-window, cross-Node-context regular expression detection\n* @param {Object} object Anything\n* @return {Boolean} true if the object is a regular expression,\n* false otherwise\n*/\nexports.isRegExp = function (object) {\n return Object.prototype.toString.call(object) === \"[object RegExp]\";\n};\n\n/**\n * Merge the objects passed as parameters into a new one.\n * @private\n * @param {...Object} var_args All objects to merge.\n * @return {Object} a new object with the data of the others.\n */\nexports.extend = function () {\n var result = {},\n i,\n attr;\n for (i = 0; i < arguments.length; i++) {\n // arguments is not enumerable in some browsers\n for (attr in arguments[i]) {\n if (arguments[i].hasOwnProperty(attr) && typeof result[attr] === \"undefined\") {\n result[attr] = arguments[i][attr];\n }\n }\n }\n return result;\n};","'use strict';\n\nvar utils = require('./utils');\nvar table = [0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3, 0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91, 0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE, 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7, 0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, 0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5, 0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172, 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B, 0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940, 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59, 0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, 0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F, 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, 0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D, 0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A, 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433, 0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, 0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01, 0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, 0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457, 0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C, 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65, 0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, 0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB, 0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0, 0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9, 0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086, 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F, 0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, 0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD, 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, 0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683, 0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8, 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1, 0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, 0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7, 0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC, 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5, 0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252, 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B, 0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, 0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79, 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236, 0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F, 0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D, 0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, 0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713, 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21, 0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E, 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777, 0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, 0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45, 0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2, 0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB, 0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0, 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9, 0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, 0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF, 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94, 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D];\n\n/**\n *\n * Javascript crc32\n * http://www.webtoolkit.info/\n *\n */\nmodule.exports = function crc32(input, crc) {\n if (typeof input === \"undefined\" || !input.length) {\n return 0;\n }\n var isArray = utils.getTypeOf(input) !== \"string\";\n if (typeof crc == \"undefined\") {\n crc = 0;\n }\n var x = 0;\n var y = 0;\n var b = 0;\n crc = crc ^ -1;\n for (var i = 0, iTop = input.length; i < iTop; i++) {\n b = isArray ? input[i] : input.charCodeAt(i);\n y = (crc ^ b) & 0xFF;\n x = table[y];\n crc = crc >>> 8 ^ x;\n }\n return crc ^ -1;\n};\n// vim: set shiftwidth=4 softtabstop=4:","'use strict';\n\nexports.LOCAL_FILE_HEADER = \"PK\\x03\\x04\";\nexports.CENTRAL_FILE_HEADER = \"PK\\x01\\x02\";\nexports.CENTRAL_DIRECTORY_END = \"PK\\x05\\x06\";\nexports.ZIP64_CENTRAL_DIRECTORY_LOCATOR = \"PK\\x06\\x07\";\nexports.ZIP64_CENTRAL_DIRECTORY_END = \"PK\\x06\\x06\";\nexports.DATA_DESCRIPTOR = \"PK\\x07\\x08\";","'use strict';\n\nexports.base64 = false;\nexports.binary = false;\nexports.dir = false;\nexports.createFolders = false;\nexports.date = null;\nexports.compression = null;\nexports.compressionOptions = null;\nexports.comment = null;\nexports.unixPermissions = null;\nexports.dosPermissions = null;","'use strict';\n\nfunction CompressedObject() {\n this.compressedSize = 0;\n this.uncompressedSize = 0;\n this.crc32 = 0;\n this.compressionMethod = null;\n this.compressedContent = null;\n}\nCompressedObject.prototype = {\n /**\n * Return the decompressed content in an unspecified format.\n * The format will depend on the decompressor.\n * @return {Object} the decompressed content.\n */\n getContent: function () {\n return null; // see implementation\n },\n /**\n * Return the compressed content in an unspecified format.\n * The format will depend on the compressed conten source.\n * @return {Object} the compressed content.\n */\n getCompressedContent: function () {\n return null; // see implementation\n }\n};\nmodule.exports = CompressedObject;","'use strict';\n\nvar utils = require('./utils');\nvar support = require('./support');\nvar nodeBuffer = require('./nodeBuffer');\n\n/**\n * The following functions come from pako, from pako/lib/utils/strings\n * released under the MIT license, see pako https://github.com/nodeca/pako/\n */\n\n// Table with utf8 lengths (calculated by first byte of sequence)\n// Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS,\n// because max possible codepoint is 0x10ffff\nvar _utf8len = new Array(256);\nfor (var i = 0; i < 256; i++) {\n _utf8len[i] = i >= 252 ? 6 : i >= 248 ? 5 : i >= 240 ? 4 : i >= 224 ? 3 : i >= 192 ? 2 : 1;\n}\n_utf8len[254] = _utf8len[254] = 1; // Invalid sequence start\n\n// convert string to array (typed, when possible)\nvar string2buf = function (str) {\n var buf,\n c,\n c2,\n m_pos,\n i,\n str_len = str.length,\n buf_len = 0;\n\n // count binary size\n for (m_pos = 0; m_pos < str_len; m_pos++) {\n c = str.charCodeAt(m_pos);\n if ((c & 0xfc00) === 0xd800 && m_pos + 1 < str_len) {\n c2 = str.charCodeAt(m_pos + 1);\n if ((c2 & 0xfc00) === 0xdc00) {\n c = 0x10000 + (c - 0xd800 << 10) + (c2 - 0xdc00);\n m_pos++;\n }\n }\n buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4;\n }\n\n // allocate buffer\n if (support.uint8array) {\n buf = new Uint8Array(buf_len);\n } else {\n buf = new Array(buf_len);\n }\n\n // convert\n for (i = 0, m_pos = 0; i < buf_len; m_pos++) {\n c = str.charCodeAt(m_pos);\n if ((c & 0xfc00) === 0xd800 && m_pos + 1 < str_len) {\n c2 = str.charCodeAt(m_pos + 1);\n if ((c2 & 0xfc00) === 0xdc00) {\n c = 0x10000 + (c - 0xd800 << 10) + (c2 - 0xdc00);\n m_pos++;\n }\n }\n if (c < 0x80) {\n /* one byte */\n buf[i++] = c;\n } else if (c < 0x800) {\n /* two bytes */\n buf[i++] = 0xC0 | c >>> 6;\n buf[i++] = 0x80 | c & 0x3f;\n } else if (c < 0x10000) {\n /* three bytes */\n buf[i++] = 0xE0 | c >>> 12;\n buf[i++] = 0x80 | c >>> 6 & 0x3f;\n buf[i++] = 0x80 | c & 0x3f;\n } else {\n /* four bytes */\n buf[i++] = 0xf0 | c >>> 18;\n buf[i++] = 0x80 | c >>> 12 & 0x3f;\n buf[i++] = 0x80 | c >>> 6 & 0x3f;\n buf[i++] = 0x80 | c & 0x3f;\n }\n }\n return buf;\n};\n\n// Calculate max possible position in utf8 buffer,\n// that will not break sequence. If that's not possible\n// - (very small limits) return max size as is.\n//\n// buf[] - utf8 bytes array\n// max - length limit (mandatory);\nvar utf8border = function (buf, max) {\n var pos;\n max = max || buf.length;\n if (max > buf.length) {\n max = buf.length;\n }\n\n // go back from last position, until start of sequence found\n pos = max - 1;\n while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) {\n pos--;\n }\n\n // Fuckup - very small and broken sequence,\n // return max, because we should return something anyway.\n if (pos < 0) {\n return max;\n }\n\n // If we came to start of buffer - that means vuffer is too small,\n // return max too.\n if (pos === 0) {\n return max;\n }\n return pos + _utf8len[buf[pos]] > max ? pos : max;\n};\n\n// convert array to string\nvar buf2string = function (buf) {\n var str, i, out, c, c_len;\n var len = buf.length;\n\n // Reserve max possible length (2 words per char)\n // NB: by unknown reasons, Array is significantly faster for\n // String.fromCharCode.apply than Uint16Array.\n var utf16buf = new Array(len * 2);\n for (out = 0, i = 0; i < len;) {\n c = buf[i++];\n // quick process ascii\n if (c < 0x80) {\n utf16buf[out++] = c;\n continue;\n }\n c_len = _utf8len[c];\n // skip 5 & 6 byte codes\n if (c_len > 4) {\n utf16buf[out++] = 0xfffd;\n i += c_len - 1;\n continue;\n }\n\n // apply mask on first byte\n c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07;\n // join the rest\n while (c_len > 1 && i < len) {\n c = c << 6 | buf[i++] & 0x3f;\n c_len--;\n }\n\n // terminated by end of string?\n if (c_len > 1) {\n utf16buf[out++] = 0xfffd;\n continue;\n }\n if (c < 0x10000) {\n utf16buf[out++] = c;\n } else {\n c -= 0x10000;\n utf16buf[out++] = 0xd800 | c >> 10 & 0x3ff;\n utf16buf[out++] = 0xdc00 | c & 0x3ff;\n }\n }\n\n // shrinkBuf(utf16buf, out)\n if (utf16buf.length !== out) {\n if (utf16buf.subarray) {\n utf16buf = utf16buf.subarray(0, out);\n } else {\n utf16buf.length = out;\n }\n }\n\n // return String.fromCharCode.apply(null, utf16buf);\n return utils.applyFromCharCode(utf16buf);\n};\n\n// That's all for the pako functions.\n\n/**\n * Transform a javascript string into an array (typed if possible) of bytes,\n * UTF-8 encoded.\n * @param {String} str the string to encode\n * @return {Array|Uint8Array|Buffer} the UTF-8 encoded string.\n */\nexports.utf8encode = function utf8encode(str) {\n if (support.nodebuffer) {\n return nodeBuffer(str, \"utf-8\");\n }\n return string2buf(str);\n};\n\n/**\n * Transform a bytes array (or a representation) representing an UTF-8 encoded\n * string into a javascript string.\n * @param {Array|Uint8Array|Buffer} buf the data de decode\n * @return {String} the decoded string.\n */\nexports.utf8decode = function utf8decode(buf) {\n if (support.nodebuffer) {\n return utils.transformTo(\"nodebuffer\", buf).toString(\"utf-8\");\n }\n buf = utils.transformTo(support.uint8array ? \"uint8array\" : \"array\", buf);\n\n // return buf2string(buf);\n // Chrome prefers to work with \"small\" chunks of data\n // for the method buf2string.\n // Firefox and Chrome has their own shortcut, IE doesn't seem to really care.\n var result = [],\n k = 0,\n len = buf.length,\n chunk = 65536;\n while (k < len) {\n var nextBoundary = utf8border(buf, Math.min(k + chunk, len));\n if (support.uint8array) {\n result.push(buf2string(buf.subarray(k, nextBoundary)));\n } else {\n result.push(buf2string(buf.slice(k, nextBoundary)));\n }\n k = nextBoundary;\n }\n return result.join(\"\");\n};\n// vim: set shiftwidth=4 softtabstop=4:","'use strict';\n\nvar utils = require('./utils');\n\n/**\n * An object to write any content to a string.\n * @constructor\n */\nvar StringWriter = function () {\n this.data = [];\n};\nStringWriter.prototype = {\n /**\n * Append any content to the current string.\n * @param {Object} input the content to add.\n */\n append: function (input) {\n input = utils.transformTo(\"string\", input);\n this.data.push(input);\n },\n /**\n * Finalize the construction an return the result.\n * @return {string} the generated string.\n */\n finalize: function () {\n return this.data.join(\"\");\n }\n};\nmodule.exports = StringWriter;","'use strict';\n\nvar utils = require('./utils');\n\n/**\n * An object to write any content to an Uint8Array.\n * @constructor\n * @param {number} length The length of the array.\n */\nvar Uint8ArrayWriter = function (length) {\n this.data = new Uint8Array(length);\n this.index = 0;\n};\nUint8ArrayWriter.prototype = {\n /**\n * Append any content to the current array.\n * @param {Object} input the content to add.\n */\n append: function (input) {\n if (input.length !== 0) {\n // with an empty Uint8Array, Opera fails with a \"Offset larger than array size\"\n input = utils.transformTo(\"uint8array\", input);\n this.data.set(input, this.index);\n this.index += input.length;\n }\n },\n /**\n * Finalize the construction an return the result.\n * @return {Uint8Array} the generated array.\n */\n finalize: function () {\n return this.data;\n }\n};\nmodule.exports = Uint8ArrayWriter;","'use strict';\n\nvar support = require('./support');\nvar utils = require('./utils');\nvar crc32 = require('./crc32');\nvar signature = require('./signature');\nvar defaults = require('./defaults');\nvar base64 = require('./base64');\nvar compressions = require('./compressions');\nvar CompressedObject = require('./compressedObject');\nvar nodeBuffer = require('./nodeBuffer');\nvar utf8 = require('./utf8');\nvar StringWriter = require('./stringWriter');\nvar Uint8ArrayWriter = require('./uint8ArrayWriter');\n\n/**\n * Returns the raw data of a ZipObject, decompress the content if necessary.\n * @param {ZipObject} file the file to use.\n * @return {String|ArrayBuffer|Uint8Array|Buffer} the data.\n */\nvar getRawData = function (file) {\n if (file._data instanceof CompressedObject) {\n file._data = file._data.getContent();\n file.options.binary = true;\n file.options.base64 = false;\n if (utils.getTypeOf(file._data) === \"uint8array\") {\n var copy = file._data;\n // when reading an arraybuffer, the CompressedObject mechanism will keep it and subarray() a Uint8Array.\n // if we request a file in the same format, we might get the same Uint8Array or its ArrayBuffer (the original zip file).\n file._data = new Uint8Array(copy.length);\n // with an empty Uint8Array, Opera fails with a \"Offset larger than array size\"\n if (copy.length !== 0) {\n file._data.set(copy, 0);\n }\n }\n }\n return file._data;\n};\n\n/**\n * Returns the data of a ZipObject in a binary form. If the content is an unicode string, encode it.\n * @param {ZipObject} file the file to use.\n * @return {String|ArrayBuffer|Uint8Array|Buffer} the data.\n */\nvar getBinaryData = function (file) {\n var result = getRawData(file),\n type = utils.getTypeOf(result);\n if (type === \"string\") {\n if (!file.options.binary) {\n // unicode text !\n // unicode string => binary string is a painful process, check if we can avoid it.\n if (support.nodebuffer) {\n return nodeBuffer(result, \"utf-8\");\n }\n }\n return file.asBinary();\n }\n return result;\n};\n\n/**\n * Transform this._data into a string.\n * @param {function} filter a function String -> String, applied if not null on the result.\n * @return {String} the string representing this._data.\n */\nvar dataToString = function (asUTF8) {\n var result = getRawData(this);\n if (result === null || typeof result === \"undefined\") {\n return \"\";\n }\n // if the data is a base64 string, we decode it before checking the encoding !\n if (this.options.base64) {\n result = base64.decode(result);\n }\n if (asUTF8 && this.options.binary) {\n // JSZip.prototype.utf8decode supports arrays as input\n // skip to array => string step, utf8decode will do it.\n result = out.utf8decode(result);\n } else {\n // no utf8 transformation, do the array => string step.\n result = utils.transformTo(\"string\", result);\n }\n if (!asUTF8 && !this.options.binary) {\n result = utils.transformTo(\"string\", out.utf8encode(result));\n }\n return result;\n};\n/**\n * A simple object representing a file in the zip file.\n * @constructor\n * @param {string} name the name of the file\n * @param {String|ArrayBuffer|Uint8Array|Buffer} data the data\n * @param {Object} options the options of the file\n */\nvar ZipObject = function (name, data, options) {\n this.name = name;\n this.dir = options.dir;\n this.date = options.date;\n this.comment = options.comment;\n this.unixPermissions = options.unixPermissions;\n this.dosPermissions = options.dosPermissions;\n this._data = data;\n this.options = options;\n\n /*\n * This object contains initial values for dir and date.\n * With them, we can check if the user changed the deprecated metadata in\n * `ZipObject#options` or not.\n */\n this._initialMetadata = {\n dir: options.dir,\n date: options.date\n };\n};\nZipObject.prototype = {\n /**\n * Return the content as UTF8 string.\n * @return {string} the UTF8 string.\n */\n asText: function () {\n return dataToString.call(this, true);\n },\n /**\n * Returns the binary content.\n * @return {string} the content as binary.\n */\n asBinary: function () {\n return dataToString.call(this, false);\n },\n /**\n * Returns the content as a nodejs Buffer.\n * @return {Buffer} the content as a Buffer.\n */\n asNodeBuffer: function () {\n var result = getBinaryData(this);\n return utils.transformTo(\"nodebuffer\", result);\n },\n /**\n * Returns the content as an Uint8Array.\n * @return {Uint8Array} the content as an Uint8Array.\n */\n asUint8Array: function () {\n var result = getBinaryData(this);\n return utils.transformTo(\"uint8array\", result);\n },\n /**\n * Returns the content as an ArrayBuffer.\n * @return {ArrayBuffer} the content as an ArrayBufer.\n */\n asArrayBuffer: function () {\n return this.asUint8Array().buffer;\n }\n};\n\n/**\n * Transform an integer into a string in hexadecimal.\n * @private\n * @param {number} dec the number to convert.\n * @param {number} bytes the number of bytes to generate.\n * @returns {string} the result.\n */\nvar decToHex = function (dec, bytes) {\n var hex = \"\",\n i;\n for (i = 0; i < bytes; i++) {\n hex += String.fromCharCode(dec & 0xff);\n dec = dec >>> 8;\n }\n return hex;\n};\n\n/**\n * Transforms the (incomplete) options from the user into the complete\n * set of options to create a file.\n * @private\n * @param {Object} o the options from the user.\n * @return {Object} the complete set of options.\n */\nvar prepareFileAttrs = function (o) {\n o = o || {};\n if (o.base64 === true && (o.binary === null || o.binary === undefined)) {\n o.binary = true;\n }\n o = utils.extend(o, defaults);\n o.date = o.date || new Date();\n if (o.compression !== null) o.compression = o.compression.toUpperCase();\n return o;\n};\n\n/**\n * Add a file in the current folder.\n * @private\n * @param {string} name the name of the file\n * @param {String|ArrayBuffer|Uint8Array|Buffer} data the data of the file\n * @param {Object} o the options of the file\n * @return {Object} the new file.\n */\nvar fileAdd = function (name, data, o) {\n // be sure sub folders exist\n var dataType = utils.getTypeOf(data),\n parent;\n o = prepareFileAttrs(o);\n if (typeof o.unixPermissions === \"string\") {\n o.unixPermissions = parseInt(o.unixPermissions, 8);\n }\n\n // UNX_IFDIR 0040000 see zipinfo.c\n if (o.unixPermissions && o.unixPermissions & 0x4000) {\n o.dir = true;\n }\n // Bit 4 Directory\n if (o.dosPermissions && o.dosPermissions & 0x0010) {\n o.dir = true;\n }\n if (o.dir) {\n name = forceTrailingSlash(name);\n }\n if (o.createFolders && (parent = parentFolder(name))) {\n folderAdd.call(this, parent, true);\n }\n if (o.dir || data === null || typeof data === \"undefined\") {\n o.base64 = false;\n o.binary = false;\n data = null;\n dataType = null;\n } else if (dataType === \"string\") {\n if (o.binary && !o.base64) {\n // optimizedBinaryString == true means that the file has already been filtered with a 0xFF mask\n if (o.optimizedBinaryString !== true) {\n // this is a string, not in a base64 format.\n // Be sure that this is a correct \"binary string\"\n data = utils.string2binary(data);\n }\n }\n } else {\n // arraybuffer, uint8array, ...\n o.base64 = false;\n o.binary = true;\n if (!dataType && !(data instanceof CompressedObject)) {\n throw new Error(\"The data of '\" + name + \"' is in an unsupported format !\");\n }\n\n // special case : it's way easier to work with Uint8Array than with ArrayBuffer\n if (dataType === \"arraybuffer\") {\n data = utils.transformTo(\"uint8array\", data);\n }\n }\n var object = new ZipObject(name, data, o);\n this.files[name] = object;\n return object;\n};\n\n/**\n * Find the parent folder of the path.\n * @private\n * @param {string} path the path to use\n * @return {string} the parent folder, or \"\"\n */\nvar parentFolder = function (path) {\n if (path.slice(-1) == '/') {\n path = path.substring(0, path.length - 1);\n }\n var lastSlash = path.lastIndexOf('/');\n return lastSlash > 0 ? path.substring(0, lastSlash) : \"\";\n};\n\n/**\n * Returns the path with a slash at the end.\n * @private\n * @param {String} path the path to check.\n * @return {String} the path with a trailing slash.\n */\nvar forceTrailingSlash = function (path) {\n // Check the name ends with a /\n if (path.slice(-1) != \"/\") {\n path += \"/\"; // IE doesn't like substr(-1)\n }\n return path;\n};\n/**\n * Add a (sub) folder in the current folder.\n * @private\n * @param {string} name the folder's name\n * @param {boolean=} [createFolders] If true, automatically create sub\n * folders. Defaults to false.\n * @return {Object} the new folder.\n */\nvar folderAdd = function (name, createFolders) {\n createFolders = typeof createFolders !== 'undefined' ? createFolders : false;\n name = forceTrailingSlash(name);\n\n // Does this folder already exist?\n if (!this.files[name]) {\n fileAdd.call(this, name, null, {\n dir: true,\n createFolders: createFolders\n });\n }\n return this.files[name];\n};\n\n/**\n * Generate a JSZip.CompressedObject for a given zipOject.\n * @param {ZipObject} file the object to read.\n * @param {JSZip.compression} compression the compression to use.\n * @param {Object} compressionOptions the options to use when compressing.\n * @return {JSZip.CompressedObject} the compressed result.\n */\nvar generateCompressedObjectFrom = function (file, compression, compressionOptions) {\n var result = new CompressedObject(),\n content;\n\n // the data has not been decompressed, we might reuse things !\n if (file._data instanceof CompressedObject) {\n result.uncompressedSize = file._data.uncompressedSize;\n result.crc32 = file._data.crc32;\n if (result.uncompressedSize === 0 || file.dir) {\n compression = compressions['STORE'];\n result.compressedContent = \"\";\n result.crc32 = 0;\n } else if (file._data.compressionMethod === compression.magic) {\n result.compressedContent = file._data.getCompressedContent();\n } else {\n content = file._data.getContent();\n // need to decompress / recompress\n result.compressedContent = compression.compress(utils.transformTo(compression.compressInputType, content), compressionOptions);\n }\n } else {\n // have uncompressed data\n content = getBinaryData(file);\n if (!content || content.length === 0 || file.dir) {\n compression = compressions['STORE'];\n content = \"\";\n }\n result.uncompressedSize = content.length;\n result.crc32 = crc32(content);\n result.compressedContent = compression.compress(utils.transformTo(compression.compressInputType, content), compressionOptions);\n }\n result.compressedSize = result.compressedContent.length;\n result.compressionMethod = compression.magic;\n return result;\n};\n\n/**\n * Generate the UNIX part of the external file attributes.\n * @param {Object} unixPermissions the unix permissions or null.\n * @param {Boolean} isDir true if the entry is a directory, false otherwise.\n * @return {Number} a 32 bit integer.\n *\n * adapted from http://unix.stackexchange.com/questions/14705/the-zip-formats-external-file-attribute :\n *\n * TTTTsstrwxrwxrwx0000000000ADVSHR\n * ^^^^____________________________ file type, see zipinfo.c (UNX_*)\n * ^^^_________________________ setuid, setgid, sticky\n * ^^^^^^^^^________________ permissions\n * ^^^^^^^^^^______ not used ?\n * ^^^^^^ DOS attribute bits : Archive, Directory, Volume label, System file, Hidden, Read only\n */\nvar generateUnixExternalFileAttr = function (unixPermissions, isDir) {\n var result = unixPermissions;\n if (!unixPermissions) {\n // I can't use octal values in strict mode, hence the hexa.\n // 040775 => 0x41fd\n // 0100664 => 0x81b4\n result = isDir ? 0x41fd : 0x81b4;\n }\n return (result & 0xFFFF) << 16;\n};\n\n/**\n * Generate the DOS part of the external file attributes.\n * @param {Object} dosPermissions the dos permissions or null.\n * @param {Boolean} isDir true if the entry is a directory, false otherwise.\n * @return {Number} a 32 bit integer.\n *\n * Bit 0 Read-Only\n * Bit 1 Hidden\n * Bit 2 System\n * Bit 3 Volume Label\n * Bit 4 Directory\n * Bit 5 Archive\n */\nvar generateDosExternalFileAttr = function (dosPermissions, isDir) {\n // the dir flag is already set for compatibility\n\n return (dosPermissions || 0) & 0x3F;\n};\n\n/**\n * Generate the various parts used in the construction of the final zip file.\n * @param {string} name the file name.\n * @param {ZipObject} file the file content.\n * @param {JSZip.CompressedObject} compressedObject the compressed object.\n * @param {number} offset the current offset from the start of the zip file.\n * @param {String} platform let's pretend we are this platform (change platform dependents fields)\n * @param {Function} encodeFileName the function to encode the file name / comment.\n * @return {object} the zip parts.\n */\nvar generateZipParts = function (name, file, compressedObject, offset, platform, encodeFileName) {\n var data = compressedObject.compressedContent,\n useCustomEncoding = encodeFileName !== utf8.utf8encode,\n encodedFileName = utils.transformTo(\"string\", encodeFileName(file.name)),\n utfEncodedFileName = utils.transformTo(\"string\", utf8.utf8encode(file.name)),\n comment = file.comment || \"\",\n encodedComment = utils.transformTo(\"string\", encodeFileName(comment)),\n utfEncodedComment = utils.transformTo(\"string\", utf8.utf8encode(comment)),\n useUTF8ForFileName = utfEncodedFileName.length !== file.name.length,\n useUTF8ForComment = utfEncodedComment.length !== comment.length,\n o = file.options,\n dosTime,\n dosDate,\n extraFields = \"\",\n unicodePathExtraField = \"\",\n unicodeCommentExtraField = \"\",\n dir,\n date;\n\n // handle the deprecated options.dir\n if (file._initialMetadata.dir !== file.dir) {\n dir = file.dir;\n } else {\n dir = o.dir;\n }\n\n // handle the deprecated options.date\n if (file._initialMetadata.date !== file.date) {\n date = file.date;\n } else {\n date = o.date;\n }\n var extFileAttr = 0;\n var versionMadeBy = 0;\n if (dir) {\n // dos or unix, we set the dos dir flag\n extFileAttr |= 0x00010;\n }\n if (platform === \"UNIX\") {\n versionMadeBy = 0x031E; // UNIX, version 3.0\n extFileAttr |= generateUnixExternalFileAttr(file.unixPermissions, dir);\n } else {\n // DOS or other, fallback to DOS\n versionMadeBy = 0x0014; // DOS, version 2.0\n extFileAttr |= generateDosExternalFileAttr(file.dosPermissions, dir);\n }\n\n // date\n // @see http://www.delorie.com/djgpp/doc/rbinter/it/52/13.html\n // @see http://www.delorie.com/djgpp/doc/rbinter/it/65/16.html\n // @see http://www.delorie.com/djgpp/doc/rbinter/it/66/16.html\n\n dosTime = date.getHours();\n dosTime = dosTime << 6;\n dosTime = dosTime | date.getMinutes();\n dosTime = dosTime << 5;\n dosTime = dosTime | date.getSeconds() / 2;\n dosDate = date.getFullYear() - 1980;\n dosDate = dosDate << 4;\n dosDate = dosDate | date.getMonth() + 1;\n dosDate = dosDate << 5;\n dosDate = dosDate | date.getDate();\n if (useUTF8ForFileName) {\n // set the unicode path extra field. unzip needs at least one extra\n // field to correctly handle unicode path, so using the path is as good\n // as any other information. This could improve the situation with\n // other archive managers too.\n // This field is usually used without the utf8 flag, with a non\n // unicode path in the header (winrar, winzip). This helps (a bit)\n // with the messy Windows' default compressed folders feature but\n // breaks on p7zip which doesn't seek the unicode path extra field.\n // So for now, UTF-8 everywhere !\n unicodePathExtraField =\n // Version\n decToHex(1, 1) +\n // NameCRC32\n decToHex(crc32(encodedFileName), 4) +\n // UnicodeName\n utfEncodedFileName;\n extraFields +=\n // Info-ZIP Unicode Path Extra Field\n \"\\x75\\x70\" +\n // size\n decToHex(unicodePathExtraField.length, 2) +\n // content\n unicodePathExtraField;\n }\n if (useUTF8ForComment) {\n unicodeCommentExtraField =\n // Version\n decToHex(1, 1) +\n // CommentCRC32\n decToHex(this.crc32(encodedComment), 4) +\n // UnicodeName\n utfEncodedComment;\n extraFields +=\n // Info-ZIP Unicode Path Extra Field\n \"\\x75\\x63\" +\n // size\n decToHex(unicodeCommentExtraField.length, 2) +\n // content\n unicodeCommentExtraField;\n }\n var header = \"\";\n\n // version needed to extract\n header += \"\\x0A\\x00\";\n // general purpose bit flag\n // set bit 11 if utf8\n header += !useCustomEncoding && (useUTF8ForFileName || useUTF8ForComment) ? \"\\x00\\x08\" : \"\\x00\\x00\";\n // compression method\n header += compressedObject.compressionMethod;\n // last mod file time\n header += decToHex(dosTime, 2);\n // last mod file date\n header += decToHex(dosDate, 2);\n // crc-32\n header += decToHex(compressedObject.crc32, 4);\n // compressed size\n header += decToHex(compressedObject.compressedSize, 4);\n // uncompressed size\n header += decToHex(compressedObject.uncompressedSize, 4);\n // file name length\n header += decToHex(encodedFileName.length, 2);\n // extra field length\n header += decToHex(extraFields.length, 2);\n var fileRecord = signature.LOCAL_FILE_HEADER + header + encodedFileName + extraFields;\n var dirRecord = signature.CENTRAL_FILE_HEADER +\n // version made by (00: DOS)\n decToHex(versionMadeBy, 2) +\n // file header (common to file and central directory)\n header +\n // file comment length\n decToHex(encodedComment.length, 2) +\n // disk number start\n \"\\x00\\x00\" +\n // internal file attributes TODO\n \"\\x00\\x00\" +\n // external file attributes\n decToHex(extFileAttr, 4) +\n // relative offset of local header\n decToHex(offset, 4) +\n // file name\n encodedFileName +\n // extra field\n extraFields +\n // file comment\n encodedComment;\n return {\n fileRecord: fileRecord,\n dirRecord: dirRecord,\n compressedObject: compressedObject\n };\n};\n\n// return the actual prototype of JSZip\nvar out = {\n /**\n * Read an existing zip and merge the data in the current JSZip object.\n * The implementation is in jszip-load.js, don't forget to include it.\n * @param {String|ArrayBuffer|Uint8Array|Buffer} stream The stream to load\n * @param {Object} options Options for loading the stream.\n * options.base64 : is the stream in base64 ? default : false\n * @return {JSZip} the current JSZip object\n */\n load: function (stream, options) {\n throw new Error(\"Load method is not defined. Is the file jszip-load.js included ?\");\n },\n /**\n * Filter nested files/folders with the specified function.\n * @param {Function} search the predicate to use :\n * function (relativePath, file) {...}\n * It takes 2 arguments : the relative path and the file.\n * @return {Array} An array of matching elements.\n */\n filter: function (search) {\n var result = [],\n filename,\n relativePath,\n file,\n fileClone;\n for (filename in this.files) {\n file = this.files[filename];\n // return a new object, don't let the user mess with our internal objects :)\n fileClone = new ZipObject(file.name, file._data, utils.extend(file.options));\n relativePath = filename.slice(this.root.length, filename.length);\n if (filename.slice(0, this.root.length) === this.root &&\n // the file is in the current root\n search(relativePath, fileClone)) {\n // and the file matches the function\n result.push(fileClone);\n }\n }\n return result;\n },\n /**\n * Add a file to the zip file, or search a file.\n * @param {string|RegExp} name The name of the file to add (if data is defined),\n * the name of the file to find (if no data) or a regex to match files.\n * @param {String|ArrayBuffer|Uint8Array|Buffer} data The file data, either raw or base64 encoded\n * @param {Object} o File options\n * @return {JSZip|Object|Array} this JSZip object (when adding a file),\n * a file (when searching by string) or an array of files (when searching by regex).\n */\n file: function (name, data, o) {\n if (arguments.length === 1) {\n if (utils.isRegExp(name)) {\n var regexp = name;\n return this.filter(function (relativePath, file) {\n return !file.dir && regexp.test(relativePath);\n });\n } else {\n // text\n return this.filter(function (relativePath, file) {\n return !file.dir && relativePath === name;\n })[0] || null;\n }\n } else {\n // more than one argument : we have data !\n name = this.root + name;\n fileAdd.call(this, name, data, o);\n }\n return this;\n },\n /**\n * Add a directory to the zip file, or search.\n * @param {String|RegExp} arg The name of the directory to add, or a regex to search folders.\n * @return {JSZip} an object with the new directory as the root, or an array containing matching folders.\n */\n folder: function (arg) {\n if (!arg) {\n return this;\n }\n if (utils.isRegExp(arg)) {\n return this.filter(function (relativePath, file) {\n return file.dir && arg.test(relativePath);\n });\n }\n\n // else, name is a new folder\n var name = this.root + arg;\n var newFolder = folderAdd.call(this, name);\n\n // Allow chaining by returning a new object with this folder as the root\n var ret = this.clone();\n ret.root = newFolder.name;\n return ret;\n },\n /**\n * Delete a file, or a directory and all sub-files, from the zip\n * @param {string} name the name of the file to delete\n * @return {JSZip} this JSZip object\n */\n remove: function (name) {\n name = this.root + name;\n var file = this.files[name];\n if (!file) {\n // Look for any folders\n if (name.slice(-1) != \"/\") {\n name += \"/\";\n }\n file = this.files[name];\n }\n if (file && !file.dir) {\n // file\n delete this.files[name];\n } else {\n // maybe a folder, delete recursively\n var kids = this.filter(function (relativePath, file) {\n return file.name.slice(0, name.length) === name;\n });\n for (var i = 0; i < kids.length; i++) {\n delete this.files[kids[i].name];\n }\n }\n return this;\n },\n /**\n * Generate the complete zip file\n * @param {Object} options the options to generate the zip file :\n * - base64, (deprecated, use type instead) true to generate base64.\n * - compression, \"STORE\" by default.\n * - type, \"base64\" by default. Values are : string, base64, uint8array, arraybuffer, blob.\n * @return {String|Uint8Array|ArrayBuffer|Buffer|Blob} the zip file\n */\n generate: function (options) {\n options = utils.extend(options || {}, {\n base64: true,\n compression: \"STORE\",\n compressionOptions: null,\n type: \"base64\",\n platform: \"DOS\",\n comment: null,\n mimeType: 'application/zip',\n encodeFileName: utf8.utf8encode\n });\n utils.checkSupport(options.type);\n\n // accept nodejs `process.platform`\n if (options.platform === 'darwin' || options.platform === 'freebsd' || options.platform === 'linux' || options.platform === 'sunos') {\n options.platform = \"UNIX\";\n }\n if (options.platform === 'win32') {\n options.platform = \"DOS\";\n }\n var zipData = [],\n localDirLength = 0,\n centralDirLength = 0,\n writer,\n i,\n encodedComment = utils.transformTo(\"string\", options.encodeFileName(options.comment || this.comment || \"\"));\n\n // first, generate all the zip parts.\n for (var name in this.files) {\n var file = this.files[name];\n var compressionName = file.options.compression || options.compression.toUpperCase();\n var compression = compressions[compressionName];\n if (!compression) {\n throw new Error(compressionName + \" is not a valid compression method !\");\n }\n var compressionOptions = file.options.compressionOptions || options.compressionOptions || {};\n var compressedObject = generateCompressedObjectFrom.call(this, file, compression, compressionOptions);\n var zipPart = generateZipParts.call(this, name, file, compressedObject, localDirLength, options.platform, options.encodeFileName);\n localDirLength += zipPart.fileRecord.length + compressedObject.compressedSize;\n centralDirLength += zipPart.dirRecord.length;\n zipData.push(zipPart);\n }\n var dirEnd = \"\";\n\n // end of central dir signature\n dirEnd = signature.CENTRAL_DIRECTORY_END +\n // number of this disk\n \"\\x00\\x00\" +\n // number of the disk with the start of the central directory\n \"\\x00\\x00\" +\n // total number of entries in the central directory on this disk\n decToHex(zipData.length, 2) +\n // total number of entries in the central directory\n decToHex(zipData.length, 2) +\n // size of the central directory 4 bytes\n decToHex(centralDirLength, 4) +\n // offset of start of central directory with respect to the starting disk number\n decToHex(localDirLength, 4) +\n // .ZIP file comment length\n decToHex(encodedComment.length, 2) +\n // .ZIP file comment\n encodedComment;\n\n // we have all the parts (and the total length)\n // time to create a writer !\n var typeName = options.type.toLowerCase();\n if (typeName === \"uint8array\" || typeName === \"arraybuffer\" || typeName === \"blob\" || typeName === \"nodebuffer\") {\n writer = new Uint8ArrayWriter(localDirLength + centralDirLength + dirEnd.length);\n } else {\n writer = new StringWriter(localDirLength + centralDirLength + dirEnd.length);\n }\n for (i = 0; i < zipData.length; i++) {\n writer.append(zipData[i].fileRecord);\n writer.append(zipData[i].compressedObject.compressedContent);\n }\n for (i = 0; i < zipData.length; i++) {\n writer.append(zipData[i].dirRecord);\n }\n writer.append(dirEnd);\n var zip = writer.finalize();\n switch (options.type.toLowerCase()) {\n // case \"zip is an Uint8Array\"\n case \"uint8array\":\n case \"arraybuffer\":\n case \"nodebuffer\":\n return utils.transformTo(options.type.toLowerCase(), zip);\n case \"blob\":\n return utils.arrayBuffer2Blob(utils.transformTo(\"arraybuffer\", zip), options.mimeType);\n // case \"zip is a string\"\n case \"base64\":\n return options.base64 ? base64.encode(zip) : zip;\n default:\n // case \"string\" :\n return zip;\n }\n },\n /**\n * @deprecated\n * This method will be removed in a future version without replacement.\n */\n crc32: function (input, crc) {\n return crc32(input, crc);\n },\n /**\n * @deprecated\n * This method will be removed in a future version without replacement.\n */\n utf8encode: function (string) {\n return utils.transformTo(\"string\", utf8.utf8encode(string));\n },\n /**\n * @deprecated\n * This method will be removed in a future version without replacement.\n */\n utf8decode: function (input) {\n return utf8.utf8decode(input);\n }\n};\nmodule.exports = out;","'use strict';\n\nvar utils = require('./utils');\nfunction DataReader(data) {\n this.data = null; // type : see implementation\n this.length = 0;\n this.index = 0;\n this.zero = 0;\n}\nDataReader.prototype = {\n /**\n * Check that the offset will not go too far.\n * @param {string} offset the additional offset to check.\n * @throws {Error} an Error if the offset is out of bounds.\n */\n checkOffset: function (offset) {\n this.checkIndex(this.index + offset);\n },\n /**\n * Check that the specifed index will not be too far.\n * @param {string} newIndex the index to check.\n * @throws {Error} an Error if the index is out of bounds.\n */\n checkIndex: function (newIndex) {\n if (this.length < this.zero + newIndex || newIndex < 0) {\n throw new Error(\"End of data reached (data length = \" + this.length + \", asked index = \" + newIndex + \"). Corrupted zip ?\");\n }\n },\n /**\n * Change the index.\n * @param {number} newIndex The new index.\n * @throws {Error} if the new index is out of the data.\n */\n setIndex: function (newIndex) {\n this.checkIndex(newIndex);\n this.index = newIndex;\n },\n /**\n * Skip the next n bytes.\n * @param {number} n the number of bytes to skip.\n * @throws {Error} if the new index is out of the data.\n */\n skip: function (n) {\n this.setIndex(this.index + n);\n },\n /**\n * Get the byte at the specified index.\n * @param {number} i the index to use.\n * @return {number} a byte.\n */\n byteAt: function (i) {\n // see implementations\n },\n /**\n * Get the next number with a given byte size.\n * @param {number} size the number of bytes to read.\n * @return {number} the corresponding number.\n */\n readInt: function (size) {\n var result = 0,\n i;\n this.checkOffset(size);\n for (i = this.index + size - 1; i >= this.index; i--) {\n result = (result << 8) + this.byteAt(i);\n }\n this.index += size;\n return result;\n },\n /**\n * Get the next string with a given byte size.\n * @param {number} size the number of bytes to read.\n * @return {string} the corresponding string.\n */\n readString: function (size) {\n return utils.transformTo(\"string\", this.readData(size));\n },\n /**\n * Get raw data without conversion, bytes.\n * @param {number} size the number of bytes to read.\n * @return {Object} the raw data, implementation specific.\n */\n readData: function (size) {\n // see implementations\n },\n /**\n * Find the last occurence of a zip signature (4 bytes).\n * @param {string} sig the signature to find.\n * @return {number} the index of the last occurence, -1 if not found.\n */\n lastIndexOfSignature: function (sig) {\n // see implementations\n },\n /**\n * Get the next date.\n * @return {Date} the date.\n */\n readDate: function () {\n var dostime = this.readInt(4);\n return new Date((dostime >> 25 & 0x7f) + 1980,\n // year\n (dostime >> 21 & 0x0f) - 1,\n // month\n dostime >> 16 & 0x1f,\n // day\n dostime >> 11 & 0x1f,\n // hour\n dostime >> 5 & 0x3f,\n // minute\n (dostime & 0x1f) << 1); // second\n }\n};\nmodule.exports = DataReader;","'use strict';\n\nvar DataReader = require('./dataReader');\nvar utils = require('./utils');\nfunction StringReader(data, optimizedBinaryString) {\n this.data = data;\n if (!optimizedBinaryString) {\n this.data = utils.string2binary(this.data);\n }\n this.length = this.data.length;\n this.index = 0;\n this.zero = 0;\n}\nStringReader.prototype = new DataReader();\n/**\n * @see DataReader.byteAt\n */\nStringReader.prototype.byteAt = function (i) {\n return this.data.charCodeAt(this.zero + i);\n};\n/**\n * @see DataReader.lastIndexOfSignature\n */\nStringReader.prototype.lastIndexOfSignature = function (sig) {\n return this.data.lastIndexOf(sig) - this.zero;\n};\n/**\n * @see DataReader.readData\n */\nStringReader.prototype.readData = function (size) {\n this.checkOffset(size);\n // this will work because the constructor applied the \"& 0xff\" mask.\n var result = this.data.slice(this.zero + this.index, this.zero + this.index + size);\n this.index += size;\n return result;\n};\nmodule.exports = StringReader;","'use strict';\n\nvar DataReader = require('./dataReader');\nfunction ArrayReader(data) {\n if (data) {\n this.data = data;\n this.length = this.data.length;\n this.index = 0;\n this.zero = 0;\n for (var i = 0; i < this.data.length; i++) {\n data[i] = data[i] & 0xFF;\n }\n }\n}\nArrayReader.prototype = new DataReader();\n/**\n * @see DataReader.byteAt\n */\nArrayReader.prototype.byteAt = function (i) {\n return this.data[this.zero + i];\n};\n/**\n * @see DataReader.lastIndexOfSignature\n */\nArrayReader.prototype.lastIndexOfSignature = function (sig) {\n var sig0 = sig.charCodeAt(0),\n sig1 = sig.charCodeAt(1),\n sig2 = sig.charCodeAt(2),\n sig3 = sig.charCodeAt(3);\n for (var i = this.length - 4; i >= 0; --i) {\n if (this.data[i] === sig0 && this.data[i + 1] === sig1 && this.data[i + 2] === sig2 && this.data[i + 3] === sig3) {\n return i - this.zero;\n }\n }\n return -1;\n};\n/**\n * @see DataReader.readData\n */\nArrayReader.prototype.readData = function (size) {\n this.checkOffset(size);\n if (size === 0) {\n return [];\n }\n var result = this.data.slice(this.zero + this.index, this.zero + this.index + size);\n this.index += size;\n return result;\n};\nmodule.exports = ArrayReader;","'use strict';\n\nvar ArrayReader = require('./arrayReader');\nfunction Uint8ArrayReader(data) {\n if (data) {\n this.data = data;\n this.length = this.data.length;\n this.index = 0;\n this.zero = 0;\n }\n}\nUint8ArrayReader.prototype = new ArrayReader();\n/**\n * @see DataReader.readData\n */\nUint8ArrayReader.prototype.readData = function (size) {\n this.checkOffset(size);\n if (size === 0) {\n // in IE10, when using subarray(idx, idx), we get the array [0x00] instead of [].\n return new Uint8Array(0);\n }\n var result = this.data.subarray(this.zero + this.index, this.zero + this.index + size);\n this.index += size;\n return result;\n};\nmodule.exports = Uint8ArrayReader;","'use strict';\n\nvar Uint8ArrayReader = require('./uint8ArrayReader');\nfunction NodeBufferReader(data) {\n this.data = data;\n this.length = this.data.length;\n this.index = 0;\n this.zero = 0;\n}\nNodeBufferReader.prototype = new Uint8ArrayReader();\n\n/**\n * @see DataReader.readData\n */\nNodeBufferReader.prototype.readData = function (size) {\n this.checkOffset(size);\n var result = this.data.slice(this.zero + this.index, this.zero + this.index + size);\n this.index += size;\n return result;\n};\nmodule.exports = NodeBufferReader;","'use strict';\n\nvar StringReader = require('./stringReader');\nvar utils = require('./utils');\nvar CompressedObject = require('./compressedObject');\nvar jszipProto = require('./object');\nvar support = require('./support');\nvar MADE_BY_DOS = 0x00;\nvar MADE_BY_UNIX = 0x03;\n\n// class ZipEntry {{{\n/**\n * An entry in the zip file.\n * @constructor\n * @param {Object} options Options of the current file.\n * @param {Object} loadOptions Options for loading the stream.\n */\nfunction ZipEntry(options, loadOptions) {\n this.options = options;\n this.loadOptions = loadOptions;\n}\nZipEntry.prototype = {\n /**\n * say if the file is encrypted.\n * @return {boolean} true if the file is encrypted, false otherwise.\n */\n isEncrypted: function () {\n // bit 1 is set\n return (this.bitFlag & 0x0001) === 0x0001;\n },\n /**\n * say if the file has utf-8 filename/comment.\n * @return {boolean} true if the filename/comment is in utf-8, false otherwise.\n */\n useUTF8: function () {\n // bit 11 is set\n return (this.bitFlag & 0x0800) === 0x0800;\n },\n /**\n * Prepare the function used to generate the compressed content from this ZipFile.\n * @param {DataReader} reader the reader to use.\n * @param {number} from the offset from where we should read the data.\n * @param {number} length the length of the data to read.\n * @return {Function} the callback to get the compressed content (the type depends of the DataReader class).\n */\n prepareCompressedContent: function (reader, from, length) {\n return function () {\n var previousIndex = reader.index;\n reader.setIndex(from);\n var compressedFileData = reader.readData(length);\n reader.setIndex(previousIndex);\n return compressedFileData;\n };\n },\n /**\n * Prepare the function used to generate the uncompressed content from this ZipFile.\n * @param {DataReader} reader the reader to use.\n * @param {number} from the offset from where we should read the data.\n * @param {number} length the length of the data to read.\n * @param {JSZip.compression} compression the compression used on this file.\n * @param {number} uncompressedSize the uncompressed size to expect.\n * @return {Function} the callback to get the uncompressed content (the type depends of the DataReader class).\n */\n prepareContent: function (reader, from, length, compression, uncompressedSize) {\n return function () {\n var compressedFileData = utils.transformTo(compression.uncompressInputType, this.getCompressedContent());\n var uncompressedFileData = compression.uncompress(compressedFileData);\n if (uncompressedFileData.length !== uncompressedSize) {\n throw new Error(\"Bug : uncompressed data size mismatch\");\n }\n return uncompressedFileData;\n };\n },\n /**\n * Read the local part of a zip file and add the info in this object.\n * @param {DataReader} reader the reader to use.\n */\n readLocalPart: function (reader) {\n var compression, localExtraFieldsLength;\n\n // we already know everything from the central dir !\n // If the central dir data are false, we are doomed.\n // On the bright side, the local part is scary : zip64, data descriptors, both, etc.\n // The less data we get here, the more reliable this should be.\n // Let's skip the whole header and dash to the data !\n reader.skip(22);\n // in some zip created on windows, the filename stored in the central dir contains \\ instead of /.\n // Strangely, the filename here is OK.\n // I would love to treat these zip files as corrupted (see http://www.info-zip.org/FAQ.html#backslashes\n // or APPNOTE#4.4.17.1, \"All slashes MUST be forward slashes '/'\") but there are a lot of bad zip generators...\n // Search \"unzip mismatching \"local\" filename continuing with \"central\" filename version\" on\n // the internet.\n //\n // I think I see the logic here : the central directory is used to display\n // content and the local directory is used to extract the files. Mixing / and \\\n // may be used to display \\ to windows users and use / when extracting the files.\n // Unfortunately, this lead also to some issues : http://seclists.org/fulldisclosure/2009/Sep/394\n this.fileNameLength = reader.readInt(2);\n localExtraFieldsLength = reader.readInt(2); // can't be sure this will be the same as the central dir\n this.fileName = reader.readData(this.fileNameLength);\n reader.skip(localExtraFieldsLength);\n if (this.compressedSize == -1 || this.uncompressedSize == -1) {\n throw new Error(\"Bug or corrupted zip : didn't get enough informations from the central directory \" + \"(compressedSize == -1 || uncompressedSize == -1)\");\n }\n compression = utils.findCompression(this.compressionMethod);\n if (compression === null) {\n // no compression found\n throw new Error(\"Corrupted zip : compression \" + utils.pretty(this.compressionMethod) + \" unknown (inner file : \" + utils.transformTo(\"string\", this.fileName) + \")\");\n }\n this.decompressed = new CompressedObject();\n this.decompressed.compressedSize = this.compressedSize;\n this.decompressed.uncompressedSize = this.uncompressedSize;\n this.decompressed.crc32 = this.crc32;\n this.decompressed.compressionMethod = this.compressionMethod;\n this.decompressed.getCompressedContent = this.prepareCompressedContent(reader, reader.index, this.compressedSize, compression);\n this.decompressed.getContent = this.prepareContent(reader, reader.index, this.compressedSize, compression, this.uncompressedSize);\n\n // we need to compute the crc32...\n if (this.loadOptions.checkCRC32) {\n this.decompressed = utils.transformTo(\"string\", this.decompressed.getContent());\n if (jszipProto.crc32(this.decompressed) !== this.crc32) {\n throw new Error(\"Corrupted zip : CRC32 mismatch\");\n }\n }\n },\n /**\n * Read the central part of a zip file and add the info in this object.\n * @param {DataReader} reader the reader to use.\n */\n readCentralPart: function (reader) {\n this.versionMadeBy = reader.readInt(2);\n this.versionNeeded = reader.readInt(2);\n this.bitFlag = reader.readInt(2);\n this.compressionMethod = reader.readString(2);\n this.date = reader.readDate();\n this.crc32 = reader.readInt(4);\n this.compressedSize = reader.readInt(4);\n this.uncompressedSize = reader.readInt(4);\n this.fileNameLength = reader.readInt(2);\n this.extraFieldsLength = reader.readInt(2);\n this.fileCommentLength = reader.readInt(2);\n this.diskNumberStart = reader.readInt(2);\n this.internalFileAttributes = reader.readInt(2);\n this.externalFileAttributes = reader.readInt(4);\n this.localHeaderOffset = reader.readInt(4);\n if (this.isEncrypted()) {\n throw new Error(\"Encrypted zip are not supported\");\n }\n this.fileName = reader.readData(this.fileNameLength);\n this.readExtraFields(reader);\n this.parseZIP64ExtraField(reader);\n this.fileComment = reader.readData(this.fileCommentLength);\n },\n /**\n * Parse the external file attributes and get the unix/dos permissions.\n */\n processAttributes: function () {\n this.unixPermissions = null;\n this.dosPermissions = null;\n var madeBy = this.versionMadeBy >> 8;\n\n // Check if we have the DOS directory flag set.\n // We look for it in the DOS and UNIX permissions\n // but some unknown platform could set it as a compatibility flag.\n this.dir = this.externalFileAttributes & 0x0010 ? true : false;\n if (madeBy === MADE_BY_DOS) {\n // first 6 bits (0 to 5)\n this.dosPermissions = this.externalFileAttributes & 0x3F;\n }\n if (madeBy === MADE_BY_UNIX) {\n this.unixPermissions = this.externalFileAttributes >> 16 & 0xFFFF;\n // the octal permissions are in (this.unixPermissions & 0x01FF).toString(8);\n }\n\n // fail safe : if the name ends with a / it probably means a folder\n if (!this.dir && this.fileNameStr.slice(-1) === '/') {\n this.dir = true;\n }\n },\n /**\n * Parse the ZIP64 extra field and merge the info in the current ZipEntry.\n * @param {DataReader} reader the reader to use.\n */\n parseZIP64ExtraField: function (reader) {\n if (!this.extraFields[0x0001]) {\n return;\n }\n\n // should be something, preparing the extra reader\n var extraReader = new StringReader(this.extraFields[0x0001].value);\n\n // I really hope that these 64bits integer can fit in 32 bits integer, because js\n // won't let us have more.\n if (this.uncompressedSize === utils.MAX_VALUE_32BITS) {\n this.uncompressedSize = extraReader.readInt(8);\n }\n if (this.compressedSize === utils.MAX_VALUE_32BITS) {\n this.compressedSize = extraReader.readInt(8);\n }\n if (this.localHeaderOffset === utils.MAX_VALUE_32BITS) {\n this.localHeaderOffset = extraReader.readInt(8);\n }\n if (this.diskNumberStart === utils.MAX_VALUE_32BITS) {\n this.diskNumberStart = extraReader.readInt(4);\n }\n },\n /**\n * Read the central part of a zip file and add the info in this object.\n * @param {DataReader} reader the reader to use.\n */\n readExtraFields: function (reader) {\n var start = reader.index,\n extraFieldId,\n extraFieldLength,\n extraFieldValue;\n this.extraFields = this.extraFields || {};\n while (reader.index < start + this.extraFieldsLength) {\n extraFieldId = reader.readInt(2);\n extraFieldLength = reader.readInt(2);\n extraFieldValue = reader.readString(extraFieldLength);\n this.extraFields[extraFieldId] = {\n id: extraFieldId,\n length: extraFieldLength,\n value: extraFieldValue\n };\n }\n },\n /**\n * Apply an UTF8 transformation if needed.\n */\n handleUTF8: function () {\n var decodeParamType = support.uint8array ? \"uint8array\" : \"array\";\n if (this.useUTF8()) {\n this.fileNameStr = jszipProto.utf8decode(this.fileName);\n this.fileCommentStr = jszipProto.utf8decode(this.fileComment);\n } else {\n var upath = this.findExtraFieldUnicodePath();\n if (upath !== null) {\n this.fileNameStr = upath;\n } else {\n var fileNameByteArray = utils.transformTo(decodeParamType, this.fileName);\n this.fileNameStr = this.loadOptions.decodeFileName(fileNameByteArray);\n }\n var ucomment = this.findExtraFieldUnicodeComment();\n if (ucomment !== null) {\n this.fileCommentStr = ucomment;\n } else {\n var commentByteArray = utils.transformTo(decodeParamType, this.fileComment);\n this.fileCommentStr = this.loadOptions.decodeFileName(commentByteArray);\n }\n }\n },\n /**\n * Find the unicode path declared in the extra field, if any.\n * @return {String} the unicode path, null otherwise.\n */\n findExtraFieldUnicodePath: function () {\n var upathField = this.extraFields[0x7075];\n if (upathField) {\n var extraReader = new StringReader(upathField.value);\n\n // wrong version\n if (extraReader.readInt(1) !== 1) {\n return null;\n }\n\n // the crc of the filename changed, this field is out of date.\n if (jszipProto.crc32(this.fileName) !== extraReader.readInt(4)) {\n return null;\n }\n return jszipProto.utf8decode(extraReader.readString(upathField.length - 5));\n }\n return null;\n },\n /**\n * Find the unicode comment declared in the extra field, if any.\n * @return {String} the unicode comment, null otherwise.\n */\n findExtraFieldUnicodeComment: function () {\n var ucommentField = this.extraFields[0x6375];\n if (ucommentField) {\n var extraReader = new StringReader(ucommentField.value);\n\n // wrong version\n if (extraReader.readInt(1) !== 1) {\n return null;\n }\n\n // the crc of the comment changed, this field is out of date.\n if (jszipProto.crc32(this.fileComment) !== extraReader.readInt(4)) {\n return null;\n }\n return jszipProto.utf8decode(extraReader.readString(ucommentField.length - 5));\n }\n return null;\n }\n};\nmodule.exports = ZipEntry;","'use strict';\n\nvar StringReader = require('./stringReader');\nvar NodeBufferReader = require('./nodeBufferReader');\nvar Uint8ArrayReader = require('./uint8ArrayReader');\nvar ArrayReader = require('./arrayReader');\nvar utils = require('./utils');\nvar sig = require('./signature');\nvar ZipEntry = require('./zipEntry');\nvar support = require('./support');\nvar jszipProto = require('./object');\n// class ZipEntries {{{\n/**\n * All the entries in the zip file.\n * @constructor\n * @param {String|ArrayBuffer|Uint8Array} data the binary stream to load.\n * @param {Object} loadOptions Options for loading the stream.\n */\nfunction ZipEntries(data, loadOptions) {\n this.files = [];\n this.loadOptions = loadOptions;\n if (data) {\n this.load(data);\n }\n}\nZipEntries.prototype = {\n /**\n * Check that the reader is on the speficied signature.\n * @param {string} expectedSignature the expected signature.\n * @throws {Error} if it is an other signature.\n */\n checkSignature: function (expectedSignature) {\n var signature = this.reader.readString(4);\n if (signature !== expectedSignature) {\n throw new Error(\"Corrupted zip or bug : unexpected signature \" + \"(\" + utils.pretty(signature) + \", expected \" + utils.pretty(expectedSignature) + \")\");\n }\n },\n /**\n * Check if the given signature is at the given index.\n * @param {number} askedIndex the index to check.\n * @param {string} expectedSignature the signature to expect.\n * @return {boolean} true if the signature is here, false otherwise.\n */\n isSignature: function (askedIndex, expectedSignature) {\n var currentIndex = this.reader.index;\n this.reader.setIndex(askedIndex);\n var signature = this.reader.readString(4);\n var result = signature === expectedSignature;\n this.reader.setIndex(currentIndex);\n return result;\n },\n /**\n * Read the end of the central directory.\n */\n readBlockEndOfCentral: function () {\n this.diskNumber = this.reader.readInt(2);\n this.diskWithCentralDirStart = this.reader.readInt(2);\n this.centralDirRecordsOnThisDisk = this.reader.readInt(2);\n this.centralDirRecords = this.reader.readInt(2);\n this.centralDirSize = this.reader.readInt(4);\n this.centralDirOffset = this.reader.readInt(4);\n this.zipCommentLength = this.reader.readInt(2);\n // warning : the encoding depends of the system locale\n // On a linux machine with LANG=en_US.utf8, this field is utf8 encoded.\n // On a windows machine, this field is encoded with the localized windows code page.\n var zipComment = this.reader.readData(this.zipCommentLength);\n var decodeParamType = support.uint8array ? \"uint8array\" : \"array\";\n // To get consistent behavior with the generation part, we will assume that\n // this is utf8 encoded unless specified otherwise.\n var decodeContent = utils.transformTo(decodeParamType, zipComment);\n this.zipComment = this.loadOptions.decodeFileName(decodeContent);\n },\n /**\n * Read the end of the Zip 64 central directory.\n * Not merged with the method readEndOfCentral :\n * The end of central can coexist with its Zip64 brother,\n * I don't want to read the wrong number of bytes !\n */\n readBlockZip64EndOfCentral: function () {\n this.zip64EndOfCentralSize = this.reader.readInt(8);\n this.versionMadeBy = this.reader.readString(2);\n this.versionNeeded = this.reader.readInt(2);\n this.diskNumber = this.reader.readInt(4);\n this.diskWithCentralDirStart = this.reader.readInt(4);\n this.centralDirRecordsOnThisDisk = this.reader.readInt(8);\n this.centralDirRecords = this.reader.readInt(8);\n this.centralDirSize = this.reader.readInt(8);\n this.centralDirOffset = this.reader.readInt(8);\n this.zip64ExtensibleData = {};\n var extraDataSize = this.zip64EndOfCentralSize - 44,\n index = 0,\n extraFieldId,\n extraFieldLength,\n extraFieldValue;\n while (index < extraDataSize) {\n extraFieldId = this.reader.readInt(2);\n extraFieldLength = this.reader.readInt(4);\n extraFieldValue = this.reader.readString(extraFieldLength);\n this.zip64ExtensibleData[extraFieldId] = {\n id: extraFieldId,\n length: extraFieldLength,\n value: extraFieldValue\n };\n }\n },\n /**\n * Read the end of the Zip 64 central directory locator.\n */\n readBlockZip64EndOfCentralLocator: function () {\n this.diskWithZip64CentralDirStart = this.reader.readInt(4);\n this.relativeOffsetEndOfZip64CentralDir = this.reader.readInt(8);\n this.disksCount = this.reader.readInt(4);\n if (this.disksCount > 1) {\n throw new Error(\"Multi-volumes zip are not supported\");\n }\n },\n /**\n * Read the local files, based on the offset read in the central part.\n */\n readLocalFiles: function () {\n var i, file;\n for (i = 0; i < this.files.length; i++) {\n file = this.files[i];\n this.reader.setIndex(file.localHeaderOffset);\n this.checkSignature(sig.LOCAL_FILE_HEADER);\n file.readLocalPart(this.reader);\n file.handleUTF8();\n file.processAttributes();\n }\n },\n /**\n * Read the central directory.\n */\n readCentralDir: function () {\n var file;\n this.reader.setIndex(this.centralDirOffset);\n while (this.reader.readString(4) === sig.CENTRAL_FILE_HEADER) {\n file = new ZipEntry({\n zip64: this.zip64\n }, this.loadOptions);\n file.readCentralPart(this.reader);\n this.files.push(file);\n }\n if (this.centralDirRecords !== this.files.length) {\n if (this.centralDirRecords !== 0 && this.files.length === 0) {\n // We expected some records but couldn't find ANY.\n // This is really suspicious, as if something went wrong.\n throw new Error(\"Corrupted zip or bug: expected \" + this.centralDirRecords + \" records in central dir, got \" + this.files.length);\n } else {\n // We found some records but not all.\n // Something is wrong but we got something for the user: no error here.\n // console.warn(\"expected\", this.centralDirRecords, \"records in central dir, got\", this.files.length);\n }\n }\n },\n /**\n * Read the end of central directory.\n */\n readEndOfCentral: function () {\n var offset = this.reader.lastIndexOfSignature(sig.CENTRAL_DIRECTORY_END);\n if (offset < 0) {\n // Check if the content is a truncated zip or complete garbage.\n // A \"LOCAL_FILE_HEADER\" is not required at the beginning (auto\n // extractible zip for example) but it can give a good hint.\n // If an ajax request was used without responseType, we will also\n // get unreadable data.\n var isGarbage = !this.isSignature(0, sig.LOCAL_FILE_HEADER);\n if (isGarbage) {\n throw new Error(\"Can't find end of central directory : is this a zip file ? \" + \"If it is, see http://stuk.github.io/jszip/documentation/howto/read_zip.html\");\n } else {\n throw new Error(\"Corrupted zip : can't find end of central directory\");\n }\n }\n this.reader.setIndex(offset);\n var endOfCentralDirOffset = offset;\n this.checkSignature(sig.CENTRAL_DIRECTORY_END);\n this.readBlockEndOfCentral();\n\n /* extract from the zip spec :\n 4) If one of the fields in the end of central directory\n record is too small to hold required data, the field\n should be set to -1 (0xFFFF or 0xFFFFFFFF) and the\n ZIP64 format record should be created.\n 5) The end of central directory record and the\n Zip64 end of central directory locator record must\n reside on the same disk when splitting or spanning\n an archive.\n */\n if (this.diskNumber === utils.MAX_VALUE_16BITS || this.diskWithCentralDirStart === utils.MAX_VALUE_16BITS || this.centralDirRecordsOnThisDisk === utils.MAX_VALUE_16BITS || this.centralDirRecords === utils.MAX_VALUE_16BITS || this.centralDirSize === utils.MAX_VALUE_32BITS || this.centralDirOffset === utils.MAX_VALUE_32BITS) {\n this.zip64 = true;\n\n /*\n Warning : the zip64 extension is supported, but ONLY if the 64bits integer read from\n the zip file can fit into a 32bits integer. This cannot be solved : Javascript represents\n all numbers as 64-bit double precision IEEE 754 floating point numbers.\n So, we have 53bits for integers and bitwise operations treat everything as 32bits.\n see https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Bitwise_Operators\n and http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf section 8.5\n */\n\n // should look for a zip64 EOCD locator\n offset = this.reader.lastIndexOfSignature(sig.ZIP64_CENTRAL_DIRECTORY_LOCATOR);\n if (offset < 0) {\n throw new Error(\"Corrupted zip : can't find the ZIP64 end of central directory locator\");\n }\n this.reader.setIndex(offset);\n this.checkSignature(sig.ZIP64_CENTRAL_DIRECTORY_LOCATOR);\n this.readBlockZip64EndOfCentralLocator();\n\n // now the zip64 EOCD record\n if (!this.isSignature(this.relativeOffsetEndOfZip64CentralDir, sig.ZIP64_CENTRAL_DIRECTORY_END)) {\n // console.warn(\"ZIP64 end of central directory not where expected.\");\n this.relativeOffsetEndOfZip64CentralDir = this.reader.lastIndexOfSignature(sig.ZIP64_CENTRAL_DIRECTORY_END);\n if (this.relativeOffsetEndOfZip64CentralDir < 0) {\n throw new Error(\"Corrupted zip : can't find the ZIP64 end of central directory\");\n }\n }\n this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir);\n this.checkSignature(sig.ZIP64_CENTRAL_DIRECTORY_END);\n this.readBlockZip64EndOfCentral();\n }\n var expectedEndOfCentralDirOffset = this.centralDirOffset + this.centralDirSize;\n if (this.zip64) {\n expectedEndOfCentralDirOffset += 20; // end of central dir 64 locator\n expectedEndOfCentralDirOffset += 12 /* should not include the leading 12 bytes */ + this.zip64EndOfCentralSize;\n }\n var extraBytes = endOfCentralDirOffset - expectedEndOfCentralDirOffset;\n if (extraBytes > 0) {\n // console.warn(extraBytes, \"extra bytes at beginning or within zipfile\");\n if (this.isSignature(endOfCentralDirOffset, sig.CENTRAL_FILE_HEADER)) {\n // The offsets seem wrong, but we have something at the specified offset.\n // So… we keep it.\n } else {\n // the offset is wrong, update the \"zero\" of the reader\n // this happens if data has been prepended (crx files for example)\n this.reader.zero = extraBytes;\n }\n } else if (extraBytes < 0) {\n throw new Error(\"Corrupted zip: missing \" + Math.abs(extraBytes) + \" bytes.\");\n }\n },\n prepareReader: function (data) {\n var type = utils.getTypeOf(data);\n utils.checkSupport(type);\n if (type === \"string\" && !support.uint8array) {\n this.reader = new StringReader(data, this.loadOptions.optimizedBinaryString);\n } else if (type === \"nodebuffer\") {\n this.reader = new NodeBufferReader(data);\n } else if (support.uint8array) {\n this.reader = new Uint8ArrayReader(utils.transformTo(\"uint8array\", data));\n } else if (support.array) {\n this.reader = new ArrayReader(utils.transformTo(\"array\", data));\n } else {\n throw new Error(\"Unexpected error: unsupported type '\" + type + \"'\");\n }\n },\n /**\n * Read a zip file and create ZipEntries.\n * @param {String|ArrayBuffer|Uint8Array|Buffer} data the binary string representing a zip file.\n */\n load: function (data) {\n this.prepareReader(data);\n this.readEndOfCentral();\n this.readCentralDir();\n this.readLocalFiles();\n }\n};\n// }}} end of ZipEntries\nmodule.exports = ZipEntries;","'use strict';\n\nvar base64 = require('./base64');\nvar utf8 = require('./utf8');\nvar utils = require('./utils');\nvar ZipEntries = require('./zipEntries');\nmodule.exports = function (data, options) {\n var files, zipEntries, i, input;\n options = utils.extend(options || {}, {\n base64: false,\n checkCRC32: false,\n optimizedBinaryString: false,\n createFolders: false,\n decodeFileName: utf8.utf8decode\n });\n if (options.base64) {\n data = base64.decode(data);\n }\n zipEntries = new ZipEntries(data, options);\n files = zipEntries.files;\n for (i = 0; i < files.length; i++) {\n input = files[i];\n this.file(input.fileNameStr, input.decompressed, {\n binary: true,\n optimizedBinaryString: true,\n date: input.date,\n dir: input.dir,\n comment: input.fileCommentStr.length ? input.fileCommentStr : null,\n unixPermissions: input.unixPermissions,\n dosPermissions: input.dosPermissions,\n createFolders: options.createFolders\n });\n }\n if (zipEntries.zipComment.length) {\n this.comment = zipEntries.zipComment;\n }\n return this;\n};","'use strict';\n\nvar utils = require('./utils');\n\n/**\n * @deprecated\n * This function will be removed in a future version without replacement.\n */\nexports.string2binary = function (str) {\n return utils.string2binary(str);\n};\n\n/**\n * @deprecated\n * This function will be removed in a future version without replacement.\n */\nexports.string2Uint8Array = function (str) {\n return utils.transformTo(\"uint8array\", str);\n};\n\n/**\n * @deprecated\n * This function will be removed in a future version without replacement.\n */\nexports.uint8Array2String = function (array) {\n return utils.transformTo(\"string\", array);\n};\n\n/**\n * @deprecated\n * This function will be removed in a future version without replacement.\n */\nexports.string2Blob = function (str) {\n var buffer = utils.transformTo(\"arraybuffer\", str);\n return utils.arrayBuffer2Blob(buffer);\n};\n\n/**\n * @deprecated\n * This function will be removed in a future version without replacement.\n */\nexports.arrayBuffer2Blob = function (buffer) {\n return utils.arrayBuffer2Blob(buffer);\n};\n\n/**\n * @deprecated\n * This function will be removed in a future version without replacement.\n */\nexports.transformTo = function (outputType, input) {\n return utils.transformTo(outputType, input);\n};\n\n/**\n * @deprecated\n * This function will be removed in a future version without replacement.\n */\nexports.getTypeOf = function (input) {\n return utils.getTypeOf(input);\n};\n\n/**\n * @deprecated\n * This function will be removed in a future version without replacement.\n */\nexports.checkSupport = function (type) {\n return utils.checkSupport(type);\n};\n\n/**\n * @deprecated\n * This value will be removed in a future version without replacement.\n */\nexports.MAX_VALUE_16BITS = utils.MAX_VALUE_16BITS;\n\n/**\n * @deprecated\n * This value will be removed in a future version without replacement.\n */\nexports.MAX_VALUE_32BITS = utils.MAX_VALUE_32BITS;\n\n/**\n * @deprecated\n * This function will be removed in a future version without replacement.\n */\nexports.pretty = function (str) {\n return utils.pretty(str);\n};\n\n/**\n * @deprecated\n * This function will be removed in a future version without replacement.\n */\nexports.findCompression = function (compressionMethod) {\n return utils.findCompression(compressionMethod);\n};\n\n/**\n * @deprecated\n * This function will be removed in a future version without replacement.\n */\nexports.isRegExp = function (object) {\n return utils.isRegExp(object);\n};","'use strict';\n\nvar base64 = require('./base64');\n\n/**\nUsage:\n zip = new JSZip();\n zip.file(\"hello.txt\", \"Hello, World!\").file(\"tempfile\", \"nothing\");\n zip.folder(\"images\").file(\"smile.gif\", base64Data, {base64: true});\n zip.file(\"Xmas.txt\", \"Ho ho ho !\", {date : new Date(\"December 25, 2007 00:00:01\")});\n zip.remove(\"tempfile\");\n\n base64zip = zip.generate();\n\n**/\n\n/**\n * Representation a of zip file in js\n * @constructor\n * @param {String=|ArrayBuffer=|Uint8Array=} data the data to load, if any (optional).\n * @param {Object=} options the options for creating this objects (optional).\n */\nfunction JSZip(data, options) {\n // if this constructor is used without `new`, it adds `new` before itself:\n if (!(this instanceof JSZip)) return new JSZip(data, options);\n\n // object containing the files :\n // {\n // \"folder/\" : {...},\n // \"folder/data.txt\" : {...}\n // }\n // NOTE: we use a null prototype because we do not\n // want filenames like \"toString\" coming from a zip file\n // to overwrite methods and attributes in a normal Object.\n this.files = Object.create(null);\n this.comment = null;\n\n // Where we are in the hierarchy\n this.root = \"\";\n if (data) {\n this.load(data, options);\n }\n this.clone = function () {\n var newObj = new JSZip();\n for (var i in this) {\n if (typeof this[i] !== \"function\") {\n newObj[i] = this[i];\n }\n }\n return newObj;\n };\n}\nJSZip.prototype = require('./object');\nJSZip.prototype.load = require('./load');\nJSZip.support = require('./support');\nJSZip.defaults = require('./defaults');\n\n/**\n * @deprecated\n * This namespace will be removed in a future version without replacement.\n */\nJSZip.utils = require('./deprecatedPublicUtils');\nJSZip.base64 = {\n /**\n * @deprecated\n * This method will be removed in a future version without replacement.\n */\n encode: function (input) {\n return base64.encode(input);\n },\n /**\n * @deprecated\n * This method will be removed in a future version without replacement.\n */\n decode: function (input) {\n return base64.decode(input);\n }\n};\nJSZip.compressions = require('./compressions');\nmodule.exports = JSZip;","'use strict';\n\nvar JSZip = require('jszip');\nmodule.exports = function (buffer) {\n var zip = new JSZip(buffer);\n var files = zip.file(/.+/);\n var out = {};\n files.forEach(function (a) {\n if (a.name.slice(-3).toLowerCase() === 'shp' || a.name.slice(-3).toLowerCase() === 'dbf') {\n out[a.name] = a.asNodeBuffer();\n } else {\n out[a.name] = a.asText();\n }\n });\n return out;\n};","'use strict';\n\nvar Mutation = global.MutationObserver || global.WebKitMutationObserver;\nvar scheduleDrain;\n{\n if (Mutation) {\n var called = 0;\n var observer = new Mutation(nextTick);\n var element = global.document.createTextNode('');\n observer.observe(element, {\n characterData: true\n });\n scheduleDrain = function () {\n element.data = called = ++called % 2;\n };\n } else if (!global.setImmediate && typeof global.MessageChannel !== 'undefined') {\n var channel = new global.MessageChannel();\n channel.port1.onmessage = nextTick;\n scheduleDrain = function () {\n channel.port2.postMessage(0);\n };\n } else if ('document' in global && 'onreadystatechange' in global.document.createElement('script')) {\n scheduleDrain = function () {\n // Create a