diff --git a/README.md b/README.md index 48d08ef152c..c881e882abf 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # ![HtmlUnit Logo](https://github.com/HtmlUnit/htmlunit/blob/master/src/site/resources/images/htmlunit.png) -Version 4.15.0 / August 17, 2025 +Version 4.16.0 / August 29, 2025 :heart: [Sponsor](https://github.com/sponsors/rbri) @@ -61,7 +61,7 @@ Add to your `pom.xml`: org.htmlunit htmlunit - 4.15.0 + 4.16.0 ``` @@ -70,7 +70,7 @@ Add to your `pom.xml`: Add to your `build.gradle`: ```groovy -implementation group: 'org.htmlunit', name: 'htmlunit', version: '4.15.0' +implementation group: 'org.htmlunit', name: 'htmlunit', version: '4.16.0' ``` ## Getting Started @@ -220,7 +220,7 @@ Add the snapshot repository and dependency to your `pom.xml`: org.htmlunit htmlunit - 4.15.0-SNAPSHOT + 4.17.0-SNAPSHOT @@ -239,7 +239,7 @@ repositories { } // ... dependencies { - implementation group: 'org.htmlunit', name: 'htmlunit', version: '4.15.0-SNAPSHOT' + implementation group: 'org.htmlunit', name: 'htmlunit', version: '4.17.0-SNAPSHOT' // ... } ``` diff --git a/checkstyle_suppressions.xml b/checkstyle_suppressions.xml index 4f6e265723d..392ee5705aa 100644 --- a/checkstyle_suppressions.xml +++ b/checkstyle_suppressions.xml @@ -6,6 +6,7 @@ + diff --git a/pmd-ruleset.xml b/pmd-ruleset.xml index 0227746ff69..08472ee42f3 100644 --- a/pmd-ruleset.xml +++ b/pmd-ruleset.xml @@ -7,6 +7,7 @@ HtmlUnit rules .*/src/test/resources/.* + .*/src/main/java/org/htmlunit/util/brotli/.* diff --git a/pom.xml b/pom.xml index 1cbf8b0991e..336f2488e1f 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.htmlunit htmlunit - 4.15.0 + 4.16.0 jar HtmlUnit @@ -27,23 +27,23 @@ 8 8 - 4.15.0 - 4.15.0 - 4.15.0 - 4.15.0 - 4.15.0 - 4.15.0 + 4.16.0 + 4.16.0 + 4.16.0 + 4.16.0 + 4.16.0 + 4.16.0 4.5.14 3.18.0 2.20.0 1.3.5 - 0.1.2 + - 4.34.0 - 4.34.0 - selenium-devtools-v138 + 4.35.0 + 4.35.0 + selenium-devtools-v139 5.13.4 @@ -59,8 +59,8 @@ 1.5.6 - 10.26.1 - 4.9.3 + 11.0.0 + 4.9.4 7.16.0 1.4.1 10.0.4 @@ -69,7 +69,7 @@ 0.8.0 3.6.0 3.27.0 - 4.9.3.2 + 4.9.4.0 3.2.8 3.6.1 2.12.1 @@ -1372,11 +1372,11 @@ commons-logging ${commons-logging.version} - + diff --git a/spotbugs-exclude.xml b/spotbugs-exclude.xml index 6fc5a39a6ca..70cc08ccb19 100644 --- a/spotbugs-exclude.xml +++ b/spotbugs-exclude.xml @@ -7,4 +7,9 @@ + + + + + \ No newline at end of file diff --git a/src/changes/changes.xml b/src/changes/changes.xml index c0bf4ec15fb..63493bdd265 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -7,6 +7,55 @@ + + + core-js: infer function names at runtime for computed properties + + + core-js: Several fixes for calling bind() in the interpreter (regression from 4.14.0) + + + core-js: ES2025 ArrayBuffer transfer(), and transferToFixedLength() implemented + + + core-js: internal optimizations to make 'undefined' lookup faster + + + core-js: ES2025 Set methods intersection(), union(), difference(), symmetricDifference(), isSubsetOf(), + isSupersetOf(), and isDisjointFrom() implemented + + + core-js: make Object.assign copy over Symbol properties + + + core-js: some methods should not have a prototype property + + + core-js: ES2025 Promise.try implemented + + + core-js: spread for object literals implemented + + + neko: do not check for bom headers on compressed streams + + + WebClient waitForBackgroundJavaScript(long), waitForBackgroundJavaScriptStartingBefore(long), and + waitForBackgroundJavaScriptStartingBefore(long, long) no longer marked as experimental. + + + Use our own 'fork' of the current brotli source code. This makes some fixes available that are + done in the code base but not release so far. + + + Use our own StringUtils at more places to be comptible with older commons lang versions. + + + Handling of CData sections in XHTML documents improved/fixed. + + + + WebAssert messages reviewed and improved. @@ -14002,7 +14051,7 @@ Upgraded commons-collections to version 3.1 - Upgraded commons-beanutil to version 1.7.0 + Upgraded commons-beanutils to version 1.7.0 Upgraded commons-httpclient to version 2.0.1 diff --git a/src/main/java/org/htmlunit/DefaultPageCreator.java b/src/main/java/org/htmlunit/DefaultPageCreator.java index ea3bcc5f3e2..fcf918e29db 100644 --- a/src/main/java/org/htmlunit/DefaultPageCreator.java +++ b/src/main/java/org/htmlunit/DefaultPageCreator.java @@ -21,7 +21,6 @@ import java.util.Locale; import org.apache.commons.lang3.ArrayUtils; -import org.apache.commons.lang3.StringUtils; import org.htmlunit.html.DomElement; import org.htmlunit.html.Html; import org.htmlunit.html.HtmlPage; @@ -29,6 +28,7 @@ import org.htmlunit.html.parser.HTMLParser; import org.htmlunit.html.parser.neko.HtmlUnitNekoHtmlParser; import org.htmlunit.util.MimeType; +import org.htmlunit.util.StringUtils; import org.htmlunit.xml.XmlPage; /** @@ -156,7 +156,7 @@ public static PageType determinePageType(final String contentType) { */ public static PageType determinePageType(final WebResponse webResponse) throws IOException { final String contentType = webResponse.getContentType(); - if (!StringUtils.isEmpty(contentType)) { + if (!StringUtils.isEmptyOrNull(contentType)) { return determinePageType(contentType); } diff --git a/src/main/java/org/htmlunit/WebClient.java b/src/main/java/org/htmlunit/WebClient.java index 321f22a3e78..dea58210165 100644 --- a/src/main/java/org/htmlunit/WebClient.java +++ b/src/main/java/org/htmlunit/WebClient.java @@ -54,7 +54,6 @@ import java.util.concurrent.ThreadFactory; import java.util.concurrent.ThreadPoolExecutor; -import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.http.NoHttpResponseException; @@ -98,6 +97,7 @@ import org.htmlunit.util.HeaderUtils; import org.htmlunit.util.MimeType; import org.htmlunit.util.NameValuePair; +import org.htmlunit.util.StringUtils; import org.htmlunit.util.UrlUtils; import org.htmlunit.websocket.JettyWebSocketAdapter.JettyWebSocketAdapterFactory; import org.htmlunit.websocket.WebSocketAdapter; @@ -624,13 +624,13 @@ public Page loadWebResponseInto(final WebResponse webResponse, final WebWindow w && (forceAttachmentWithFilename != null || attachmentHandler_.isAttachment(webResponse))) { // check content disposition header for nothing provided - if (StringUtils.isEmpty(forceAttachmentWithFilename)) { + if (StringUtils.isEmptyOrNull(forceAttachmentWithFilename)) { final String disp = webResponse.getResponseHeaderValue(HttpHeader.CONTENT_DISPOSITION); forceAttachmentWithFilename = Attachment.getSuggestedFilename(disp); } if (attachmentHandler_.handleAttachment(webResponse, - StringUtils.isEmpty(forceAttachmentWithFilename) ? null : forceAttachmentWithFilename)) { + StringUtils.isEmptyOrNull(forceAttachmentWithFilename) ? null : forceAttachmentWithFilename)) { // the handling is done by the attachment handler; // do not open a new window return webWindow.getEnclosedPage(); @@ -639,7 +639,8 @@ public Page loadWebResponseInto(final WebResponse webResponse, final WebWindow w final WebWindow w = openWindow(null, null, webWindow); final Page page = pageCreator_.createPage(webResponse, w); attachmentHandler_.handleAttachment(page, - StringUtils.isEmpty(forceAttachmentWithFilename) ? null : forceAttachmentWithFilename); + StringUtils.isEmptyOrNull(forceAttachmentWithFilename) + ? null : forceAttachmentWithFilename); return page; } @@ -1383,8 +1384,9 @@ private static WebResponse makeWebResponseForAboutUrl(final WebRequest webReques return new StringWebResponse("", UrlUtils.URL_ABOUT_BLANK); } - final String urlWithoutQuery = StringUtils.substringBefore(urlString, "?"); - if (!"blank".equalsIgnoreCase(StringUtils.substringAfter(urlWithoutQuery, UrlUtils.ABOUT_SCHEME))) { + final String urlWithoutQuery = org.apache.commons.lang3.StringUtils.substringBefore(urlString, "?"); + if (!"blank".equalsIgnoreCase(org.apache.commons.lang3.StringUtils + .substringAfter(urlWithoutQuery, UrlUtils.ABOUT_SCHEME))) { throw new MalformedURLException(url + " is not supported, only about:blank is supported at the moment."); } return new StringWebResponse("", url); @@ -1423,7 +1425,7 @@ private WebResponse makeWebResponseForFileUrl(final WebRequest webRequest) throw compiledHeaders.add(new NameValuePair(HttpHeader.CONTENT_TYPE, MimeType.TEXT_HTML)); final WebResponseData responseData = new WebResponseData( - org.htmlunit.util.StringUtils + StringUtils .toByteArray("File: " + file.getAbsolutePath(), UTF_8), 404, "Not Found", compiledHeaders); return new WebResponse(responseData, webRequest, 0); @@ -1451,13 +1453,13 @@ private WebResponse makeWebResponseForBlobUrl(final WebRequest webRequest) { final List headers = new ArrayList<>(); final String type = fileOrBlob.getType(); - if (!StringUtils.isEmpty(type)) { + if (!StringUtils.isEmptyOrNull(type)) { headers.add(new NameValuePair(HttpHeader.CONTENT_TYPE, fileOrBlob.getType())); } if (fileOrBlob instanceof org.htmlunit.javascript.host.file.File) { final org.htmlunit.javascript.host.file.File file = (org.htmlunit.javascript.host.file.File) fileOrBlob; final String fileName = file.getName(); - if (!StringUtils.isEmpty(fileName)) { + if (!StringUtils.isEmptyOrNull(fileName)) { // https://datatracker.ietf.org/doc/html/rfc6266#autoid-10 headers.add(new NameValuePair(HttpHeader.CONTENT_DISPOSITION, "inline; filename=\"" + fileName + "\"")); } @@ -2411,24 +2413,46 @@ public void reset() { } /** - *

Experimental API: May be changed in next release - * and may not yet work perfectly!

- * - *

This method blocks until all background JavaScript tasks have finished executing. Background - * JavaScript tasks are JavaScript tasks scheduled for execution via window.setTimeout, - * window.setInterval or asynchronous XMLHttpRequest.

- * - *

If a job is scheduled to begin executing after (now + timeoutMillis), this method will - * wait for timeoutMillis milliseconds and then return a value greater than 0. This - * method will never block longer than timeoutMillis milliseconds.

- * - *

Use this method instead of {@link #waitForBackgroundJavaScriptStartingBefore(long)} if you - * don't know when your background JavaScript is supposed to start executing, but you're fairly sure - * that you know how long it should take to finish executing.

- * - * @param timeoutMillis the maximum amount of time to wait (in milliseconds) - * @return the number of background JavaScript jobs still executing or waiting to be executed when this - * method returns; will be 0 if there are no jobs left to execute + *

Blocks until all background JavaScript tasks have finished executing or until the specified + * timeout is reached, whichever occurs first. Background JavaScript tasks include:

+ *
    + *
  • JavaScript scheduled via window.setTimeout()
  • + *
  • JavaScript scheduled via window.setInterval()
  • + *
  • Asynchronous XMLHttpRequest operations
  • + *
  • Other asynchronous JavaScript operations across all windows managed by this WebClient
  • + *
+ * + *

Timeout Behavior: If background tasks are scheduled to execute after + * (now + timeoutMillis), this method will wait for the full timeout duration + * and then return the number of remaining jobs. The method guarantees it will never block + * longer than the specified timeout.

+ * + *

Use Case: Use this method when you don't know the exact timing of when + * background JavaScript will start, but you have a reasonable estimate of how long all + * tasks should take to complete. For scenarios where you know when tasks should start + * executing, consider using {@link #waitForBackgroundJavaScriptStartingBefore(long)} instead.

+ * + *

Thread Safety: This method is thread-safe and handles concurrent + * modifications to the internal job manager list gracefully.

+ * + *

Example Usage:

+ *

+     * // Wait up to 5 seconds for all background JavaScript to complete
+     * int remainingJobs = webClient.waitForBackgroundJavaScript(5000);
+     * if (remainingJobs == 0) {
+     *     log("All background JavaScript completed");
+     * } else {
+     *     log("Timeout reached, " + remainingJobs + " jobs still pending");
+     * }
+     * 
+ * + * @param timeoutMillis the maximum amount of time to wait in milliseconds; must be positive + * @return the number of background JavaScript jobs still executing or waiting to be executed + * when this method returns; returns 0 if all jobs completed successfully + * within the timeout period + * @throws IllegalArgumentException if timeoutMillis is negative + * @see #waitForBackgroundJavaScriptStartingBefore(long) + * @see #waitForBackgroundJavaScriptStartingBefore(long, long) */ public int waitForBackgroundJavaScript(final long timeoutMillis) { int count = 0; @@ -2461,58 +2485,123 @@ public int waitForBackgroundJavaScript(final long timeoutMillis) { } /** - *

Experimental API: May be changed in next release - * and may not yet work perfectly!

- * - *

This method blocks until all background JavaScript tasks scheduled to start executing before - * (now + delayMillis) have finished executing. Background JavaScript tasks are JavaScript - * tasks scheduled for execution via window.setTimeout, window.setInterval or - * asynchronous XMLHttpRequest.

- * - *

If there is no background JavaScript task currently executing, and there is no background JavaScript - * task scheduled to start executing within the specified time, this method returns immediately -- even - * if there are tasks scheduled to be executed after (now + delayMillis).

- * - *

Note that the total time spent executing a background JavaScript task is never known ahead of - * time, so this method makes no guarantees as to how long it will block.

- * - *

Use this method instead of {@link #waitForBackgroundJavaScript(long)} if you know roughly when - * your background JavaScript is supposed to start executing, but you're not necessarily sure how long - * it will take to execute.

- * - * @param delayMillis the delay which determines the background tasks to wait for (in milliseconds) - * @return the number of background JavaScript jobs still executing or waiting to be executed when this - * method returns; will be 0 if there are no jobs left to execute + *

Blocks until all background JavaScript tasks scheduled to start executing before + * (now + delayMillis) have finished executing. Background JavaScript tasks include:

+ *
    + *
  • JavaScript scheduled via window.setTimeout()
  • + *
  • JavaScript scheduled via window.setInterval()
  • + *
  • Asynchronous XMLHttpRequest operations
  • + *
  • Other asynchronous JavaScript operations across all windows managed by this WebClient
  • + *
+ * + *

Method Behavior:

+ *
    + *
  • If no background JavaScript tasks are currently executing and none are scheduled + * to start within delayMillis, this method returns immediately
  • + *
  • Tasks scheduled to execute after (now + delayMillis) are ignored + * and do not affect the waiting behavior
  • + *
  • The method waits for tasks to complete execution, not just to start
  • + *
  • This method waits indefinitely for qualifying tasks to complete (no timeout)
  • + *
+ * + *

Use Case: This method is ideal when you know approximately when + * background JavaScript should start executing but are uncertain about execution duration. + * Use this when you don't need a timeout and want to ensure all relevant tasks complete. + * For scenarios where you need to wait for all background tasks regardless of timing, + * use {@link #waitForBackgroundJavaScript(long)} instead. For timeout control, use + * {@link #waitForBackgroundJavaScriptStartingBefore(long, long)} instead.

+ * + *

Thread Safety: This method is thread-safe and handles concurrent + * modifications to the internal job manager list gracefully.

+ * + *

Example Usage:

+ *

+     * // Wait indefinitely for JavaScript tasks starting within 1 second
+     * int remainingJobs = webClient.waitForBackgroundJavaScriptStartingBefore(1000);
+     * if (remainingJobs == 0) {
+     *     log("All relevant background JavaScript completed");
+     * } else {
+     *     log("Some tasks may still be pending: " + remainingJobs + " jobs");
+     * }
+     *
+     * // Common pattern: wait for tasks that should start soon
+     * // (useful after triggering an action that schedules JavaScript)
+     * webClient.waitForBackgroundJavaScriptStartingBefore(500);
+     * 
+ * + * @param delayMillis the delay which determines the background tasks to wait for (in milliseconds); + * must be non-negative + * @return the number of background JavaScript jobs still executing or waiting to be executed + * when this method returns; returns 0 if all qualifying jobs completed + * successfully + * @see #waitForBackgroundJavaScript(long) + * @see #waitForBackgroundJavaScriptStartingBefore(long, long) */ public int waitForBackgroundJavaScriptStartingBefore(final long delayMillis) { return waitForBackgroundJavaScriptStartingBefore(delayMillis, -1); } /** - *

Experimental API: May be changed in next release - * and may not yet work perfectly!

- * - *

This method blocks until all background JavaScript tasks scheduled to start executing before - * (now + delayMillis) have finished executing. Background JavaScript tasks are JavaScript - * tasks scheduled for execution via window.setTimeout, window.setInterval or - * asynchronous XMLHttpRequest.

- * - *

If there is no background JavaScript task currently executing, and there is no background JavaScript - * task scheduled to start executing within the specified time, this method returns immediately -- even - * if there are tasks scheduled to be executed after (now + delayMillis).

- * - *

Note that the total time spent executing a background JavaScript task is never known ahead of - * time, so this method makes no guarantees as to how long it will block.

- * - *

Use this method instead of {@link #waitForBackgroundJavaScript(long)} if you know roughly when - * your background JavaScript is supposed to start executing, but you're not necessarily sure how long - * it will take to execute.

- * - * @param delayMillis the delay which determines the background tasks to wait for (in milliseconds) - * @param timeoutMillis the maximum amount of time to wait (in milliseconds); this has to be larger than - * the delayMillis parameter, otherwise the timeout is ignored - * @return the number of background JavaScript jobs still executing or waiting to be executed when this - * method returns; will be 0 if there are no jobs left to execute + *

Blocks until all background JavaScript tasks scheduled to start executing before + * (now + delayMillis) have finished executing, or until the specified timeout + * is reached, whichever occurs first. Background JavaScript tasks include:

+ *
    + *
  • JavaScript scheduled via window.setTimeout()
  • + *
  • JavaScript scheduled via window.setInterval()
  • + *
  • Asynchronous XMLHttpRequest operations
  • + *
  • Other asynchronous JavaScript operations across all windows managed by this WebClient
  • + *
+ * + *

Method Behavior:

+ *
    + *
  • If no background JavaScript tasks are currently executing and none are scheduled + * to start within delayMillis, this method returns immediately
  • + *
  • Tasks scheduled to execute after (now + delayMillis) are ignored + * and do not affect the waiting behavior
  • + *
  • The method waits for tasks to complete execution, not just to start
  • + *
+ * + *

Timeout Behavior:

+ *
    + *
  • If timeoutMillis is negative or less than delayMillis, + * the timeout is ignored and the method waits indefinitely
  • + *
  • When a valid timeout is specified, the method will never block longer than + * timeoutMillis milliseconds
  • + *
  • The timeout applies to the total waiting time, not per task
  • + *
+ * + *

Use Case: This method is ideal when you know approximately when + * background JavaScript should start executing but are uncertain about execution duration. + * For scenarios where you need to wait for all background tasks regardless of timing, + * use {@link #waitForBackgroundJavaScript(long)} instead.

+ * + *

Thread Safety: This method is thread-safe and handles concurrent + * modifications to the internal job manager list gracefully.

+ * + *

Example Usage:

+ *

+     * // Wait for JavaScript tasks starting within 1 second, with 10 second max timeout
+     * int remainingJobs = webClient.waitForBackgroundJavaScriptStartingBefore(1000, 10000);
+     * if (remainingJobs == 0) {
+     *     log("All relevant background JavaScript completed");
+     * } else {
+     *     log("Timeout reached or tasks still pending: " + remainingJobs + " jobs");
+     * }
+     *
+     * // Wait indefinitely for tasks starting within 500ms (timeout ignored)
+     * webClient.waitForBackgroundJavaScriptStartingBefore(500, 100); // timeout < delay
+     * 
+ * + * @param delayMillis the delay which determines the background tasks to wait for (in milliseconds); + * must be non-negative + * @param timeoutMillis the maximum amount of time to wait (in milliseconds); if negative or + * less than delayMillis, the timeout is ignored and the method + * waits indefinitely for qualifying tasks to complete + * @return the number of background JavaScript jobs still executing or waiting to be executed + * when this method returns; returns 0 if all qualifying jobs completed + * successfully within the specified constraints + * @see #waitForBackgroundJavaScript(long) + * @see #waitForBackgroundJavaScriptStartingBefore(long) */ public int waitForBackgroundJavaScriptStartingBefore(final long delayMillis, final long timeoutMillis) { int count = 0; diff --git a/src/main/java/org/htmlunit/WebResponse.java b/src/main/java/org/htmlunit/WebResponse.java index f7f93cdc7c5..e890e479d66 100644 --- a/src/main/java/org/htmlunit/WebResponse.java +++ b/src/main/java/org/htmlunit/WebResponse.java @@ -28,13 +28,13 @@ import org.apache.commons.io.ByteOrderMark; import org.apache.commons.io.IOUtils; import org.apache.commons.io.input.BOMInputStream; -import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.htmlunit.http.HttpStatus; import org.htmlunit.util.EncodingSniffer; import org.htmlunit.util.MimeType; import org.htmlunit.util.NameValuePair; +import org.htmlunit.util.StringUtils; /** * A response from a web server. diff --git a/src/main/java/org/htmlunit/WebResponseData.java b/src/main/java/org/htmlunit/WebResponseData.java index 74196109ea6..5a1f7916017 100644 --- a/src/main/java/org/htmlunit/WebResponseData.java +++ b/src/main/java/org/htmlunit/WebResponseData.java @@ -29,12 +29,12 @@ import org.apache.commons.io.IOUtils; import org.apache.commons.io.input.BOMInputStream; import org.apache.commons.lang3.ArrayUtils; -import org.apache.commons.lang3.Strings; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.brotli.dec.BrotliInputStream; import org.htmlunit.util.MimeType; import org.htmlunit.util.NameValuePair; +import org.htmlunit.util.StringUtils; +import org.htmlunit.util.brotli.BrotliInputStream; /** * Simple data object to simplify WebResponse creation. @@ -101,7 +101,7 @@ private InputStream getStream(final ByteOrderMark... bomHeaders) throws IOExcept final List headers = getResponseHeaders(); final String encoding = getHeader(headers, "content-encoding"); if (encoding != null) { - boolean isGzip = Strings.CI.contains(encoding, "gzip") && !"no-gzip".equals(encoding); + boolean isGzip = StringUtils.containsIgnoreCase(encoding, "gzip") && !"no-gzip".equals(encoding); if ("gzip-only-text/html".equals(encoding)) { isGzip = MimeType.TEXT_HTML.equals(getHeader(headers, "content-type")); } @@ -148,7 +148,7 @@ private InputStream getStream(final ByteOrderMark... bomHeaders) throws IOExcept return stream; } - if (Strings.CI.contains(encoding, "deflate")) { + if (StringUtils.containsIgnoreCase(encoding, "deflate")) { boolean zlibHeader = false; if (stream.markSupported()) { // should be always the case as the content is in a byte[] or in a file stream.mark(2); diff --git a/src/main/java/org/htmlunit/attachment/DownloadingAttachmentHandler.java b/src/main/java/org/htmlunit/attachment/DownloadingAttachmentHandler.java index 92d80ffe9ec..7da2c8549d3 100644 --- a/src/main/java/org/htmlunit/attachment/DownloadingAttachmentHandler.java +++ b/src/main/java/org/htmlunit/attachment/DownloadingAttachmentHandler.java @@ -22,11 +22,11 @@ import java.nio.file.Paths; import org.apache.commons.io.FileUtils; -import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.htmlunit.Page; import org.htmlunit.WebResponse; +import org.htmlunit.util.StringUtils; /** * Implementation of an {@link AttachmentHandler} that mimics how browsers handle attachments, specifically @@ -98,12 +98,12 @@ public void handleAttachment(final Page page, final String attachmentFilename) { private Path determineDestionationFile(final Page page, final String attachmentFilename) { String fileName = attachmentFilename; - if (StringUtils.isAllBlank(fileName)) { + if (StringUtils.isBlank(fileName)) { final String file = page.getWebResponse().getWebRequest().getUrl().getFile(); fileName = file.substring(file.lastIndexOf('/') + 1); } - if (StringUtils.isAllBlank(fileName)) { + if (StringUtils.isBlank(fileName)) { fileName = "download"; } diff --git a/src/main/java/org/htmlunit/css/AbstractCssStyleDeclaration.java b/src/main/java/org/htmlunit/css/AbstractCssStyleDeclaration.java index 80fc46355e9..83529e6bfba 100644 --- a/src/main/java/org/htmlunit/css/AbstractCssStyleDeclaration.java +++ b/src/main/java/org/htmlunit/css/AbstractCssStyleDeclaration.java @@ -265,9 +265,9 @@ public boolean isComputed() { */ public String getBackgroundAttachment() { String value = getStyleAttribute(Definition.BACKGROUND_ATTACHMENT, false); - if (org.apache.commons.lang3.StringUtils.isBlank(value)) { + if (StringUtils.isBlank(value)) { final String bg = getStyleAttribute(Definition.BACKGROUND, true); - if (org.apache.commons.lang3.StringUtils.isNotBlank(bg)) { + if (StringUtils.isNotBlank(bg)) { value = findAttachment(bg); if (value == null) { if (hasFeature(CSS_BACKGROUND_INITIAL) && !isComputed()) { @@ -289,9 +289,9 @@ public String getBackgroundAttachment() { */ public String getBackgroundColor() { String value = getStyleAttribute(Definition.BACKGROUND_COLOR, false); - if (org.apache.commons.lang3.StringUtils.isBlank(value)) { + if (StringUtils.isBlank(value)) { final String bg = getStyleAttribute(Definition.BACKGROUND, false); - if (org.apache.commons.lang3.StringUtils.isBlank(bg)) { + if (StringUtils.isBlank(bg)) { return ""; } value = findColor(bg); @@ -309,7 +309,7 @@ public String getBackgroundColor() { } return value; } - if (org.apache.commons.lang3.StringUtils.isBlank(value)) { + if (StringUtils.isBlank(value)) { return ""; } return value; @@ -321,9 +321,9 @@ public String getBackgroundColor() { */ public String getBackgroundImage() { String value = getStyleAttribute(Definition.BACKGROUND_IMAGE, false); - if (org.apache.commons.lang3.StringUtils.isBlank(value)) { + if (StringUtils.isBlank(value)) { final String bg = getStyleAttribute(Definition.BACKGROUND, false); - if (org.apache.commons.lang3.StringUtils.isNotBlank(bg)) { + if (StringUtils.isNotBlank(bg)) { value = findImageUrl(bg); final boolean backgroundInitial = hasFeature(CSS_BACKGROUND_INITIAL); if (value == null) { @@ -357,12 +357,12 @@ public String getBackgroundPosition() { if (value == null) { return null; } - if (org.apache.commons.lang3.StringUtils.isBlank(value)) { + if (StringUtils.isBlank(value)) { final String bg = getStyleAttribute(Definition.BACKGROUND, false); if (bg == null) { return null; } - if (org.apache.commons.lang3.StringUtils.isNotBlank(bg)) { + if (StringUtils.isNotBlank(bg)) { value = findPosition(bg); final boolean isInitial = hasFeature(CSS_BACKGROUND_INITIAL); if (value == null) { @@ -419,9 +419,9 @@ public String getBackgroundPosition() { */ public String getBackgroundRepeat() { String value = getStyleAttribute(Definition.BACKGROUND_REPEAT, false); - if (org.apache.commons.lang3.StringUtils.isBlank(value)) { + if (StringUtils.isBlank(value)) { final String bg = getStyleAttribute(Definition.BACKGROUND, false); - if (org.apache.commons.lang3.StringUtils.isNotBlank(bg)) { + if (StringUtils.isNotBlank(bg)) { value = findRepeat(bg); if (value == null) { if (hasFeature(CSS_BACKGROUND_INITIAL) && !isComputed()) { @@ -545,7 +545,7 @@ private String getBorderWidth(final Definition borderSideWidth, final Definition value = findBorderWidth(getStyleAttribute(borderSide, false)); if (value == null) { final String borderWidth = getStyleAttribute(Definition.BORDER_WIDTH, false); - if (!org.apache.commons.lang3.StringUtils.isEmpty(borderWidth)) { + if (!StringUtils.isEmptyOrNull(borderWidth)) { final String[] values = StringUtils.splitAtJavaWhitespace(borderWidth); int index = values.length; if (borderSideWidth.name().contains("TOP")) { diff --git a/src/main/java/org/htmlunit/css/ComputedCssStyleDeclaration.java b/src/main/java/org/htmlunit/css/ComputedCssStyleDeclaration.java index 702b704a269..d46edaf43dd 100644 --- a/src/main/java/org/htmlunit/css/ComputedCssStyleDeclaration.java +++ b/src/main/java/org/htmlunit/css/ComputedCssStyleDeclaration.java @@ -43,7 +43,6 @@ import java.util.SortedMap; import java.util.TreeMap; -import org.apache.commons.lang3.StringUtils; import org.htmlunit.BrowserVersion; import org.htmlunit.BrowserVersionFeatures; import org.htmlunit.Page; @@ -148,6 +147,7 @@ import org.htmlunit.html.HtmlVariable; import org.htmlunit.html.HtmlWordBreak; import org.htmlunit.platform.Platform; +import org.htmlunit.util.StringUtils; /** * An object for a CSSStyleDeclaration, which is computed. @@ -274,7 +274,7 @@ public String getStyleAttribute(final String name) { final String value = element.getValue(); if (!"content".equals(name) && !value.contains("url")) { - return org.htmlunit.util.StringUtils.toRootLowerCase(value); + return StringUtils.toRootLowerCase(value); } return value; } @@ -411,7 +411,7 @@ public String getWidth() { @Override public String get(final ComputedCssStyleDeclaration style) { final String value = style.getStyleAttribute(Definition.WIDTH, true); - if (StringUtils.isEmpty(value)) { + if (StringUtils.isEmptyOrNull(value)) { final String position = getStyleAttribute(Definition.POSITION, true); if (ABSOLUTE.equals(position) || FIXED.equals(position)) { final String content = domElem.getVisibleText(); @@ -534,7 +534,7 @@ public String getBackgroundColor() { } final String value = super.getBackgroundColor(); - if (StringUtils.isEmpty(value)) { + if (StringUtils.isEmptyOrNull(value)) { return Definition.BACKGROUND_COLOR.getDefaultComputedValue(getBrowserVersion()); } return CssColors.toRGBColor(value); @@ -583,7 +583,7 @@ public String getBlockSize() { @Override public String get(final ComputedCssStyleDeclaration style) { final String value = style.getStyleAttribute(Definition.HEIGHT, true); - if (StringUtils.isEmpty(value)) { + if (StringUtils.isEmptyOrNull(value)) { final String content = domElem.getVisibleText(); // do this only for small content // at least for empty div's this is more correct @@ -737,7 +737,7 @@ public String getDisplay() { // don't use defaultIfEmpty for performance // (no need to calculate the default if not empty) final String value = getStyleAttribute(Definition.DISPLAY.getAttributeName()); - if (StringUtils.isEmpty(value)) { + if (StringUtils.isEmptyOrNull(value)) { if (domElem instanceof HtmlElement) { return ((HtmlElement) domElem).getDefaultStyleDisplay().value(); } @@ -1570,7 +1570,8 @@ private int getCalculatedWidth() { final DomNode parent = element.getParentNode(); // width is ignored for inline elements - if ((INLINE.equals(display) || StringUtils.isEmpty(styleWidth)) && parent instanceof HtmlElement) { + if ((INLINE.equals(display) || StringUtils.isEmptyOrNull(styleWidth)) + && parent instanceof HtmlElement) { // hack: TODO find a way to specify default values for different tags if (element instanceof HtmlCanvas) { return 300; @@ -1962,11 +1963,11 @@ else if (element instanceof HtmlHeading6) { defaultHeight *= lineCount; } else { - if (element instanceof HtmlSpan && StringUtils.isEmpty(content)) { + if (element instanceof HtmlSpan && StringUtils.isEmptyOrNull(content)) { defaultHeight = 0; } else { - defaultHeight *= StringUtils.countMatches(content, '\n') + 1; + defaultHeight *= org.apache.commons.lang3.StringUtils.countMatches(content, '\n') + 1; } } @@ -2082,11 +2083,11 @@ private boolean isScrollable(final DomElement element, final boolean horizontal, String overflow; if (horizontal) { overflow = getStyleAttribute(Definition.OVERFLOW_X_, false); - if (StringUtils.isEmpty(overflow)) { + if (StringUtils.isEmptyOrNull(overflow)) { overflow = getStyleAttribute(Definition.OVERFLOW_X, false); } // fall back to default - if (StringUtils.isEmpty(overflow)) { + if (StringUtils.isEmptyOrNull(overflow)) { overflow = getStyleAttribute(Definition.OVERFLOW, true); } scrollable = (element instanceof HtmlBody || SCROLL.equals(overflow) || AUTO.equals(overflow)) @@ -2094,11 +2095,11 @@ private boolean isScrollable(final DomElement element, final boolean horizontal, } else { overflow = getStyleAttribute(Definition.OVERFLOW_Y_, false); - if (StringUtils.isEmpty(overflow)) { + if (StringUtils.isEmptyOrNull(overflow)) { overflow = getStyleAttribute(Definition.OVERFLOW_Y, false); } // fall back to default - if (StringUtils.isEmpty(overflow)) { + if (StringUtils.isEmptyOrNull(overflow)) { overflow = getStyleAttribute(Definition.OVERFLOW, true); } diff --git a/src/main/java/org/htmlunit/css/CssStyleSheet.java b/src/main/java/org/htmlunit/css/CssStyleSheet.java index fd3f7f797ee..10b61180670 100644 --- a/src/main/java/org/htmlunit/css/CssStyleSheet.java +++ b/src/main/java/org/htmlunit/css/CssStyleSheet.java @@ -38,8 +38,6 @@ import java.util.regex.Pattern; import org.apache.commons.io.IOUtils; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.Strings; import org.apache.commons.lang3.math.NumberUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -102,6 +100,7 @@ import org.htmlunit.javascript.host.css.MediaList; import org.htmlunit.javascript.host.dom.Document; import org.htmlunit.util.MimeType; +import org.htmlunit.util.StringUtils; import org.htmlunit.util.UrlUtils; /** @@ -353,7 +352,7 @@ public static CssStyleSheet loadStylesheet(final HtmlElement element, final Html final CssStyleSheet sheet; final String contentType = response.getContentType(); - if (StringUtils.isEmpty(contentType) || MimeType.TEXT_CSS.equals(contentType)) { + if (StringUtils.isEmptyOrNull(contentType) || MimeType.TEXT_CSS.equals(contentType)) { try (InputStream in = response.getContentAsStreamWithBomIfApplicable()) { if (in == null) { if (LOG.isWarnEnabled()) { @@ -563,33 +562,33 @@ static boolean selects(final BrowserVersion browserVersion, final AttributeCondition prefixAttributeCondition = (AttributeCondition) condition; final String prefixValue = prefixAttributeCondition.getValue(); if (prefixAttributeCondition.isCaseInSensitive()) { - return !org.htmlunit.util.StringUtils.isEmptyString(prefixValue) - && Strings.CI.startsWith( + return !StringUtils.isEmptyString(prefixValue) + && StringUtils.startsWithIgnoreCase( element.getAttribute(prefixAttributeCondition.getLocalName()), prefixValue); } - return !org.htmlunit.util.StringUtils.isEmptyString(prefixValue) + return !StringUtils.isEmptyString(prefixValue) && element.getAttribute(prefixAttributeCondition.getLocalName()).startsWith(prefixValue); case SUFFIX_ATTRIBUTE_CONDITION: final AttributeCondition suffixAttributeCondition = (AttributeCondition) condition; final String suffixValue = suffixAttributeCondition.getValue(); if (suffixAttributeCondition.isCaseInSensitive()) { - return !org.htmlunit.util.StringUtils.isEmptyString(suffixValue) - && Strings.CI.endsWith( + return !StringUtils.isEmptyString(suffixValue) + && StringUtils.endsWithIgnoreCase( element.getAttribute(suffixAttributeCondition.getLocalName()), suffixValue); } - return !org.htmlunit.util.StringUtils.isEmptyString(suffixValue) + return !StringUtils.isEmptyString(suffixValue) && element.getAttribute(suffixAttributeCondition.getLocalName()).endsWith(suffixValue); case SUBSTRING_ATTRIBUTE_CONDITION: final AttributeCondition substringAttributeCondition = (AttributeCondition) condition; final String substringValue = substringAttributeCondition.getValue(); if (substringAttributeCondition.isCaseInSensitive()) { - return !org.htmlunit.util.StringUtils.isEmptyString(substringValue) - && Strings.CI.contains( + return !StringUtils.isEmptyString(substringValue) + && StringUtils.containsIgnoreCase( element.getAttribute(substringAttributeCondition.getLocalName()), substringValue); } - return !org.htmlunit.util.StringUtils.isEmptyString(substringValue) + return !StringUtils.isEmptyString(substringValue) && element.getAttribute(substringAttributeCondition.getLocalName()).contains(substringValue); case BEGIN_HYPHEN_ATTRIBUTE_CONDITION: @@ -598,8 +597,8 @@ static boolean selects(final BrowserVersion browserVersion, final String a = element.getAttribute(beginHyphenAttributeCondition.getLocalName()); if (beginHyphenAttributeCondition.isCaseInSensitive()) { return selectsHyphenSeparated( - org.htmlunit.util.StringUtils.toRootLowerCase(v), - org.htmlunit.util.StringUtils.toRootLowerCase(a)); + StringUtils.toRootLowerCase(v), + StringUtils.toRootLowerCase(a)); } return selectsHyphenSeparated(v, a); @@ -609,8 +608,8 @@ static boolean selects(final BrowserVersion browserVersion, final String a2 = element.getAttribute(oneOfAttributeCondition.getLocalName()); if (oneOfAttributeCondition.isCaseInSensitive()) { return selectsOneOf( - org.htmlunit.util.StringUtils.toRootLowerCase(v2), - org.htmlunit.util.StringUtils.toRootLowerCase(a2)); + StringUtils.toRootLowerCase(v2), + StringUtils.toRootLowerCase(a2)); } return selectsOneOf(v2, a2); @@ -866,8 +865,8 @@ private static boolean selectsPseudoClass(final BrowserVersion browserVersion, case "placeholder-shown": return element instanceof HtmlInput - && StringUtils.isEmpty(((HtmlInput) element).getValue()) - && StringUtils.isNotEmpty(((HtmlInput) element).getPlaceholder()); + && StringUtils.isEmptyOrNull(((HtmlInput) element).getValue()) + && !StringUtils.isEmptyOrNull(((HtmlInput) element).getPlaceholder()); default: if (value.startsWith("nth-child(")) { @@ -939,7 +938,7 @@ private static boolean getNthElement(final String nth, final int index) { int denominator = 0; if (nIndex != -1) { String value = nth.substring(0, nIndex).trim(); - if (org.htmlunit.util.StringUtils.equalsChar('-', value)) { + if (StringUtils.equalsChar('-', value)) { denominator = -1; } else { @@ -1136,7 +1135,8 @@ private static boolean isValidCondition(final Condition condition, final DomNode } if ("nth-child()".equals(value)) { - final String arg = StringUtils.substringBetween(condition.getValue(), "(", ")").trim(); + final String arg = org.apache.commons.lang3.StringUtils + .substringBetween(condition.getValue(), "(", ")").trim(); return "even".equalsIgnoreCase(arg) || "odd".equalsIgnoreCase(arg) || NTH_NUMERIC.matcher(arg).matches() || NTH_COMPLEX.matcher(arg).matches(); @@ -1547,7 +1547,7 @@ private List selects( if (isActive(index.getMediaList(), element.getPage().getEnclosingWindow())) { final String elementName = element.getLowercaseName(); - final String[] classes = org.htmlunit.util.StringUtils.splitAtJavaWhitespace( + final String[] classes = StringUtils.splitAtJavaWhitespace( element.getAttributeDirect("class")); final Iterator iter = index.getSelectorEntriesIteratorFor(elementName, classes); diff --git a/src/main/java/org/htmlunit/html/DomElement.java b/src/main/java/org/htmlunit/html/DomElement.java index 6d1760742cd..a48ae44ed4e 100644 --- a/src/main/java/org/htmlunit/html/DomElement.java +++ b/src/main/java/org/htmlunit/html/DomElement.java @@ -213,7 +213,7 @@ public boolean hasAttribute(final String attributeName) { * @param priority the new priority of the property; "important"or the empty string if none. */ public void replaceStyleAttribute(final String name, final String value, final String priority) { - if (org.apache.commons.lang3.StringUtils.isBlank(value)) { + if (StringUtils.isBlank(value)) { removeStyleAttribute(name); return; } @@ -635,7 +635,7 @@ public void writeStyleToElement(final Map styleMap) { .append(e.getValue()); final String prio = e.getPriority(); - if (org.apache.commons.lang3.StringUtils.isNotBlank(prio)) { + if (StringUtils.isNotBlank(prio)) { builder.append(" !").append(prio); } builder.append(';'); diff --git a/src/main/java/org/htmlunit/html/DomText.java b/src/main/java/org/htmlunit/html/DomText.java index 3af794f3539..a2969d137f1 100644 --- a/src/main/java/org/htmlunit/html/DomText.java +++ b/src/main/java/org/htmlunit/html/DomText.java @@ -134,7 +134,7 @@ public String getNodeName() { protected boolean printXml(final String indent, final boolean tagBefore, final PrintWriter printWriter) { String data = getData(); boolean tag = tagBefore; - if (org.apache.commons.lang3.StringUtils.isNotBlank(data)) { + if (StringUtils.isNotBlank(data)) { if (!(getParentNode() instanceof HtmlStyle) || !data.startsWith("")) { data = StringUtils.escapeXmlChars(data); } diff --git a/src/main/java/org/htmlunit/html/HtmlAnchor.java b/src/main/java/org/htmlunit/html/HtmlAnchor.java index 6cf7560323f..a737a3002dc 100644 --- a/src/main/java/org/htmlunit/html/HtmlAnchor.java +++ b/src/main/java/org/htmlunit/html/HtmlAnchor.java @@ -23,8 +23,6 @@ import java.util.Map; import org.apache.commons.lang3.ArrayUtils; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.Strings; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.htmlunit.BrowserVersion; @@ -38,6 +36,7 @@ import org.htmlunit.javascript.host.event.Event; import org.htmlunit.javascript.host.html.HTMLElement; import org.htmlunit.protocol.javascript.JavaScriptURLConnection; +import org.htmlunit.util.StringUtils; import org.htmlunit.util.UrlUtils; /** @@ -117,7 +116,7 @@ protected void doClickStateUpdate(final boolean shiftKey, final boolean ctrlKey, } final String downloadAttribute = getDownloadAttribute(); HtmlPage page = (HtmlPage) getPage(); - if (Strings.CI.startsWith(href, JavaScriptURLConnection.JAVASCRIPT_PREFIX)) { + if (StringUtils.startsWithIgnoreCase(href, JavaScriptURLConnection.JAVASCRIPT_PREFIX)) { final StringBuilder builder = new StringBuilder(href.length()); builder.append(JavaScriptURLConnection.JAVASCRIPT_PREFIX); for (int i = JavaScriptURLConnection.JAVASCRIPT_PREFIX.length(); i < href.length(); i++) { @@ -203,7 +202,7 @@ private boolean relContainsNoreferrer() { String rel = getRelAttribute(); if (rel != null) { rel = rel.toLowerCase(Locale.ROOT); - return ArrayUtils.contains(org.htmlunit.util.StringUtils.splitAtBlank(rel), "noreferrer"); + return ArrayUtils.contains(StringUtils.splitAtBlank(rel), "noreferrer"); } return false; } @@ -219,7 +218,7 @@ private boolean relContainsNoreferrer() { public static URL getTargetUrl(final String href, final HtmlPage page) throws MalformedURLException { URL url = page.getFullyQualifiedUrl(href); // fix for empty url - if (StringUtils.isEmpty(href)) { + if (StringUtils.isEmptyOrNull(href)) { url = UrlUtils.getUrlWithNewRef(url, null); } return url; diff --git a/src/main/java/org/htmlunit/html/HtmlArea.java b/src/main/java/org/htmlunit/html/HtmlArea.java index 6dcf7d79267..381639681df 100644 --- a/src/main/java/org/htmlunit/html/HtmlArea.java +++ b/src/main/java/org/htmlunit/html/HtmlArea.java @@ -22,8 +22,6 @@ import java.util.Arrays; import java.util.Map; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.Strings; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.htmlunit.SgmlPage; @@ -32,6 +30,7 @@ import org.htmlunit.WebWindow; import org.htmlunit.javascript.host.event.Event; import org.htmlunit.protocol.javascript.JavaScriptURLConnection; +import org.htmlunit.util.StringUtils; import org.htmlunit.util.geometry.Circle2D; import org.htmlunit.util.geometry.Polygon2D; import org.htmlunit.util.geometry.Rectangle2D; @@ -81,7 +80,7 @@ protected boolean doClickStateUpdate(final boolean shiftKey, final boolean ctrlK final String href = getHrefAttribute().trim(); if (!href.isEmpty()) { final HtmlPage page = (HtmlPage) getPage(); - if (Strings.CI.startsWith(href, JavaScriptURLConnection.JAVASCRIPT_PREFIX)) { + if (org.htmlunit.util.StringUtils.startsWithIgnoreCase(href, JavaScriptURLConnection.JAVASCRIPT_PREFIX)) { page.executeJavaScript( href, "javascript url", getStartLineNumber()); return false; @@ -219,7 +218,7 @@ public final String getTargetAttribute() { * @return {@code true} if the point is contained in this area */ boolean containsPoint(final int x, final int y) { - final String shape = StringUtils.defaultIfEmpty(getShapeAttribute(), SHAPE_RECT); + final String shape = StringUtils.defaultIfEmptyOrNull(getShapeAttribute(), SHAPE_RECT); if ("default".equalsIgnoreCase(shape) && getCoordsAttribute() != null) { return true; @@ -362,7 +361,7 @@ public boolean handles(final Event event) { } private boolean isEmpty() { - final String shape = StringUtils.defaultIfEmpty(getShapeAttribute(), SHAPE_RECT); + final String shape = StringUtils.defaultIfEmptyOrNull(getShapeAttribute(), SHAPE_RECT); if ("default".equalsIgnoreCase(shape) && getCoordsAttribute() != null) { return false; diff --git a/src/main/java/org/htmlunit/html/HtmlButton.java b/src/main/java/org/htmlunit/html/HtmlButton.java index 9e5f5b8b26b..6c2fb55a26d 100644 --- a/src/main/java/org/htmlunit/html/HtmlButton.java +++ b/src/main/java/org/htmlunit/html/HtmlButton.java @@ -23,13 +23,13 @@ import java.util.HashSet; import java.util.Map; -import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.htmlunit.SgmlPage; import org.htmlunit.javascript.host.event.Event; import org.htmlunit.javascript.host.event.MouseEvent; import org.htmlunit.util.NameValuePair; +import org.htmlunit.util.StringUtils; import org.w3c.dom.Node; /** @@ -330,7 +330,7 @@ public final String getOnBlurAttribute() { @Override protected void setAttributeNS(final String namespaceURI, final String qualifiedName, final String attributeValue, final boolean notifyAttributeChangeListeners, final boolean notifyMutationObservers) { - final String qualifiedNameLC = org.htmlunit.util.StringUtils.toRootLowerCase(qualifiedName); + final String qualifiedNameLC = StringUtils.toRootLowerCase(qualifiedName); if (NAME_ATTRIBUTE.equals(qualifiedNameLC)) { if (newNames_.isEmpty()) { newNames_ = new HashSet<>(); @@ -412,7 +412,7 @@ public void setCustomValidity(final String message) { */ @Override public boolean isCustomErrorValidityState() { - return !StringUtils.isEmpty(customValidity_); + return !StringUtils.isEmptyOrNull(customValidity_); } @Override diff --git a/src/main/java/org/htmlunit/html/HtmlColorInput.java b/src/main/java/org/htmlunit/html/HtmlColorInput.java index 1184303ea32..363d1e7c545 100644 --- a/src/main/java/org/htmlunit/html/HtmlColorInput.java +++ b/src/main/java/org/htmlunit/html/HtmlColorInput.java @@ -16,9 +16,9 @@ import java.util.Map; -import org.apache.commons.lang3.StringUtils; import org.htmlunit.SgmlPage; import org.htmlunit.html.impl.Color; +import org.htmlunit.util.StringUtils; /** * Wrapper for the HTML element "input" where type is "color". @@ -57,7 +57,7 @@ public void setDefaultChecked(final boolean defaultChecked) { */ @Override public void setValue(final String newValue) { - if (StringUtils.isEmpty(newValue)) { + if (StringUtils.isEmptyOrNull(newValue)) { super.setValue("#000000"); return; } @@ -73,7 +73,7 @@ protected void valueAttributeChanged(final String attributeValue, final boolean return; } - if (StringUtils.isEmpty(attributeValue)) { + if (StringUtils.isEmptyOrNull(attributeValue)) { setRawValue("#000000"); return; } diff --git a/src/main/java/org/htmlunit/html/HtmlDateInput.java b/src/main/java/org/htmlunit/html/HtmlDateInput.java index e7bac09c29b..149f937ff2a 100644 --- a/src/main/java/org/htmlunit/html/HtmlDateInput.java +++ b/src/main/java/org/htmlunit/html/HtmlDateInput.java @@ -19,8 +19,8 @@ import java.time.format.DateTimeParseException; import java.util.Map; -import org.apache.commons.lang3.StringUtils; import org.htmlunit.SgmlPage; +import org.htmlunit.util.StringUtils; /** * Wrapper for the HTML element "input" where type is "date". @@ -136,7 +136,7 @@ private boolean isMaxValid() { @Override public void setValue(final String newValue) { try { - if (StringUtils.isNotEmpty(newValue)) { + if (!StringUtils.isEmptyOrNull(newValue)) { FORMATTER_.parse(newValue); } super.setValue(newValue); diff --git a/src/main/java/org/htmlunit/html/HtmlDateTimeLocalInput.java b/src/main/java/org/htmlunit/html/HtmlDateTimeLocalInput.java index 6924a61c506..19d404bdd6a 100644 --- a/src/main/java/org/htmlunit/html/HtmlDateTimeLocalInput.java +++ b/src/main/java/org/htmlunit/html/HtmlDateTimeLocalInput.java @@ -19,9 +19,9 @@ import java.time.format.DateTimeParseException; import java.util.Map; -import org.apache.commons.lang3.StringUtils; import org.htmlunit.BrowserVersion; import org.htmlunit.SgmlPage; +import org.htmlunit.util.StringUtils; /** * Wrapper for the HTML element "input" where type is "datetime-local". @@ -60,7 +60,7 @@ public void setDefaultChecked(final boolean defaultChecked) { @Override public void setValue(final String newValue) { try { - if (StringUtils.isNotEmpty(newValue)) { + if (!StringUtils.isEmptyOrNull(newValue)) { FORMATTER_.parse(newValue); } super.setValue(newValue); diff --git a/src/main/java/org/htmlunit/html/HtmlEmailInput.java b/src/main/java/org/htmlunit/html/HtmlEmailInput.java index fb391a50ad0..b77f97d3b23 100644 --- a/src/main/java/org/htmlunit/html/HtmlEmailInput.java +++ b/src/main/java/org/htmlunit/html/HtmlEmailInput.java @@ -17,8 +17,8 @@ import java.util.Map; import java.util.regex.Pattern; -import org.apache.commons.lang3.StringUtils; import org.htmlunit.SgmlPage; +import org.htmlunit.util.StringUtils; /** * Wrapper for the HTML element "input" where type is "email". diff --git a/src/main/java/org/htmlunit/html/HtmlFieldSet.java b/src/main/java/org/htmlunit/html/HtmlFieldSet.java index 90d7a807eaa..5388da876a9 100644 --- a/src/main/java/org/htmlunit/html/HtmlFieldSet.java +++ b/src/main/java/org/htmlunit/html/HtmlFieldSet.java @@ -19,8 +19,8 @@ import java.util.HashSet; import java.util.Map; -import org.apache.commons.lang3.StringUtils; import org.htmlunit.SgmlPage; +import org.htmlunit.util.StringUtils; /** * Wrapper for the HTML element "fieldset". @@ -75,7 +75,7 @@ public void setCustomValidity(final String message) { */ @Override public boolean isCustomErrorValidityState() { - return !StringUtils.isEmpty(customValidity_); + return !StringUtils.isEmptyOrNull(customValidity_); } /** diff --git a/src/main/java/org/htmlunit/html/HtmlFileInput.java b/src/main/java/org/htmlunit/html/HtmlFileInput.java index 93b3cf4d309..40749beda19 100644 --- a/src/main/java/org/htmlunit/html/HtmlFileInput.java +++ b/src/main/java/org/htmlunit/html/HtmlFileInput.java @@ -24,13 +24,13 @@ import java.util.Map; import org.apache.commons.io.FileUtils; -import org.apache.commons.lang3.StringUtils; import org.htmlunit.BrowserVersion; import org.htmlunit.SgmlPage; import org.htmlunit.javascript.host.event.Event; import org.htmlunit.util.KeyDataPair; import org.htmlunit.util.MimeType; import org.htmlunit.util.NameValuePair; +import org.htmlunit.util.StringUtils; /** * Wrapper for the HTML element "input". @@ -110,7 +110,7 @@ public NameValuePair[] getSubmitNameValuePairs() { String contentType; if (contentType_ == null) { contentType = getPage().getWebClient().getBrowserVersion().getUploadMimeType(file); - if (StringUtils.isEmpty(contentType)) { + if (StringUtils.isEmptyOrNull(contentType)) { contentType = MimeType.APPLICATION_OCTET_STREAM; } } @@ -181,7 +181,7 @@ public void setDefaultValue(final String defaultValue) { */ @Override public void setValue(final String newValue) { - if (StringUtils.isEmpty(newValue)) { + if (StringUtils.isEmptyOrNull(newValue)) { setFiles(); return; } diff --git a/src/main/java/org/htmlunit/html/HtmlForm.java b/src/main/java/org/htmlunit/html/HtmlForm.java index 1fb417a067c..97b55cd885d 100644 --- a/src/main/java/org/htmlunit/html/HtmlForm.java +++ b/src/main/java/org/htmlunit/html/HtmlForm.java @@ -34,7 +34,6 @@ import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.Strings; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.htmlunit.BrowserVersion; @@ -159,13 +158,15 @@ && getAttributeDirect(ATTRIBUTE_NOVALIDATE) != ATTRIBUTE_NOT_DEFINED) { } final String action = getActionAttribute().trim(); - if (Strings.CI.startsWith(action, JavaScriptURLConnection.JAVASCRIPT_PREFIX)) { + if (org.htmlunit.util.StringUtils.startsWithIgnoreCase(action, + JavaScriptURLConnection.JAVASCRIPT_PREFIX)) { htmlPage.executeJavaScript(action, "Form action", getStartLineNumber()); return; } } else { - if (Strings.CI.startsWith(getActionAttribute(), JavaScriptURLConnection.JAVASCRIPT_PREFIX)) { + if (org.htmlunit.util.StringUtils.startsWithIgnoreCase(getActionAttribute(), + JavaScriptURLConnection.JAVASCRIPT_PREFIX)) { // The action is JavaScript but JavaScript isn't enabled. return; } @@ -272,7 +273,8 @@ public WebRequest getWebRequest(final SubmittableElement submitElement) { method = HttpMethod.POST; } else { - if (!"get".equalsIgnoreCase(methodAttribute) && StringUtils.isNotBlank(methodAttribute)) { + if (!"get".equalsIgnoreCase(methodAttribute) + && org.htmlunit.util.StringUtils.isNotBlank(methodAttribute)) { notifyIncorrectness("Incorrect submit method >" + getMethodAttribute() + "<. Using >GET<."); } method = HttpMethod.GET; diff --git a/src/main/java/org/htmlunit/html/HtmlImage.java b/src/main/java/org/htmlunit/html/HtmlImage.java index 1955a7eba91..29688205197 100644 --- a/src/main/java/org/htmlunit/html/HtmlImage.java +++ b/src/main/java/org/htmlunit/html/HtmlImage.java @@ -31,7 +31,6 @@ import java.util.Map; import org.apache.commons.io.IOUtils; -import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.htmlunit.BrowserVersion; @@ -50,6 +49,7 @@ import org.htmlunit.platform.Platform; import org.htmlunit.platform.geom.IntDimension2D; import org.htmlunit.platform.image.ImageData; +import org.htmlunit.util.StringUtils; import org.htmlunit.util.UrlUtils; /** @@ -134,7 +134,7 @@ protected void setAttributeNS(final String namespaceURI, final String qualifiedN final boolean notifyAttributeChangeListeners, final boolean notifyMutationObservers) { final HtmlPage htmlPage = getHtmlPageOrNull(); - final String qualifiedNameLC = org.htmlunit.util.StringUtils.toRootLowerCase(qualifiedName); + final String qualifiedNameLC = StringUtils.toRootLowerCase(qualifiedName); if (SRC_ATTRIBUTE.equals(qualifiedNameLC) && value != ATTRIBUTE_NOT_DEFINED && htmlPage != null) { final String oldValue = getAttributeNS(namespaceURI, qualifiedNameLC); if (!oldValue.equals(value)) { @@ -349,7 +349,7 @@ public final String getSrcAttribute() { */ public String getSrc() { final String src = getSrcAttribute(); - if (org.htmlunit.util.StringUtils.isEmptyString(src)) { + if (StringUtils.isEmptyString(src)) { return src; } try { @@ -526,10 +526,11 @@ public int getHeightOrDefault() { final WebClient webClient = getPage().getWebClient(); final BrowserVersion browserVersion = webClient.getBrowserVersion(); - if (StringUtils.isEmpty(src)) { + if (StringUtils.isEmptyOrNull(src)) { return 0; } - if (browserVersion.hasFeature(JS_IMAGE_WIDTH_HEIGHT_RETURNS_16x16_0x0) && StringUtils.isBlank(src)) { + if (browserVersion.hasFeature(JS_IMAGE_WIDTH_HEIGHT_RETURNS_16x16_0x0) + && StringUtils.isBlank(src)) { return 0; } @@ -587,10 +588,11 @@ public int getWidthOrDefault() { final WebClient webClient = getPage().getWebClient(); final BrowserVersion browserVersion = webClient.getBrowserVersion(); - if (StringUtils.isEmpty(src)) { + if (StringUtils.isEmptyOrNull(src)) { return 0; } - if (browserVersion.hasFeature(JS_IMAGE_WIDTH_HEIGHT_RETURNS_16x16_0x0) && StringUtils.isBlank(src)) { + if (browserVersion.hasFeature(JS_IMAGE_WIDTH_HEIGHT_RETURNS_16x16_0x0) + && StringUtils.isBlank(src)) { return 0; } @@ -671,7 +673,7 @@ private void downloadImageIfNeeded() throws IOException { // HTMLIMAGE_BLANK_SRC_AS_EMPTY final String src = getSrcAttribute(); - if (!org.htmlunit.util.StringUtils.isEmptyString(src)) { + if (!StringUtils.isEmptyString(src)) { final HtmlPage page = (HtmlPage) getPage(); final WebClient webClient = page.getWebClient(); final BrowserVersion browser = webClient.getBrowserVersion(); @@ -821,7 +823,7 @@ public boolean isDisplayed() { if (hasFeature(HTMLIMAGE_BLANK_SRC_AS_EMPTY) && StringUtils.isBlank(src)) { return false; } - if (hasFeature(HTMLIMAGE_EMPTY_SRC_DISPLAY_FALSE) && StringUtils.isEmpty(src)) { + if (hasFeature(HTMLIMAGE_EMPTY_SRC_DISPLAY_FALSE) && StringUtils.isEmptyOrNull(src)) { return false; } diff --git a/src/main/java/org/htmlunit/html/HtmlImageInput.java b/src/main/java/org/htmlunit/html/HtmlImageInput.java index fcbf85ab0ce..09a2a42b543 100644 --- a/src/main/java/org/htmlunit/html/HtmlImageInput.java +++ b/src/main/java/org/htmlunit/html/HtmlImageInput.java @@ -23,7 +23,6 @@ import java.util.Map; import org.apache.commons.io.IOUtils; -import org.apache.commons.lang3.StringUtils; import org.htmlunit.BrowserVersion; import org.htmlunit.ElementNotFoundException; import org.htmlunit.Page; @@ -33,6 +32,7 @@ import org.htmlunit.WebResponse; import org.htmlunit.javascript.host.event.Event; import org.htmlunit.util.NameValuePair; +import org.htmlunit.util.StringUtils; /** * Wrapper for the HTML element "input". @@ -75,7 +75,7 @@ public NameValuePair[] getSubmitNameValuePairs() { final String name = getNameAttribute(); final String prefix; // a clicked image without name sends parameter x and y - if (StringUtils.isEmpty(name)) { + if (StringUtils.isEmptyOrNull(name)) { prefix = ""; } else { @@ -214,7 +214,7 @@ public void setSrcAttribute(final String src) { private void downloadImageIfNeeded() throws IOException { if (!downloaded_) { final String src = getSrc(); - if (!org.htmlunit.util.StringUtils.isEmptyString(src)) { + if (!StringUtils.isEmptyString(src)) { final HtmlPage page = (HtmlPage) getPage(); final WebClient webClient = page.getWebClient(); diff --git a/src/main/java/org/htmlunit/html/HtmlInput.java b/src/main/java/org/htmlunit/html/HtmlInput.java index 3473b74ac81..6328ef37093 100644 --- a/src/main/java/org/htmlunit/html/HtmlInput.java +++ b/src/main/java/org/htmlunit/html/HtmlInput.java @@ -26,7 +26,6 @@ import java.util.Locale; import java.util.Map; -import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.htmlunit.BrowserVersion; @@ -43,6 +42,7 @@ import org.htmlunit.javascript.host.event.MouseEvent; import org.htmlunit.javascript.host.html.HTMLInputElement; import org.htmlunit.util.NameValuePair; +import org.htmlunit.util.StringUtils; import org.xml.sax.helpers.AttributesImpl; /** @@ -632,7 +632,7 @@ static Page executeOnChangeHandlerIfAppropriate(final HtmlElement htmlElement) { @Override protected void setAttributeNS(final String namespaceURI, final String qualifiedName, final String attributeValue, final boolean notifyAttributeChangeListeners, final boolean notifyMutationObservers) { - final String qualifiedNameLC = org.htmlunit.util.StringUtils.toRootLowerCase(qualifiedName); + final String qualifiedNameLC = StringUtils.toRootLowerCase(qualifiedName); if (NAME_ATTRIBUTE.equals(qualifiedNameLC)) { if (newNames_.isEmpty()) { newNames_ = new HashSet<>(); @@ -1000,12 +1000,12 @@ private boolean isPatternValid() { } final String pattern = getPattern(); - if (StringUtils.isEmpty(pattern)) { + if (StringUtils.isEmptyOrNull(pattern)) { return true; } final String value = getValue(); - if (StringUtils.isEmpty(value)) { + if (StringUtils.isEmptyOrNull(value)) { return true; } if (!isBlankPatternValidated() && StringUtils.isBlank(value)) { @@ -1062,7 +1062,7 @@ public boolean isSubmitable() { @Override public boolean isCustomErrorValidityState() { - return !StringUtils.isEmpty(customValidity_); + return !StringUtils.isEmptyOrNull(customValidity_); } @Override @@ -1125,7 +1125,7 @@ public final void setFormNoValidate(final boolean noValidate) { public final String getType() { final BrowserVersion browserVersion = getPage().getWebClient().getBrowserVersion(); String type = getTypeAttribute(); - type = org.htmlunit.util.StringUtils.toRootLowerCase(type); + type = StringUtils.toRootLowerCase(type); return isSupported(type, browserVersion) ? type : "text"; } @@ -1148,8 +1148,7 @@ public HtmlInput changeType(String newType, final boolean setThroughAttribute) { final WebClient webClient = page.getWebClient(); final BrowserVersion browser = webClient.getBrowserVersion(); if (!currentType.equalsIgnoreCase(newType)) { - if (!isSupported(org.htmlunit.util.StringUtils - .toRootLowerCase(newType), browser)) { + if (!isSupported(StringUtils.toRootLowerCase(newType), browser)) { if (setThroughAttribute) { newType = "text"; } diff --git a/src/main/java/org/htmlunit/html/HtmlLink.java b/src/main/java/org/htmlunit/html/HtmlLink.java index 58b0dd33bb5..ba2f61b3fd8 100644 --- a/src/main/java/org/htmlunit/html/HtmlLink.java +++ b/src/main/java/org/htmlunit/html/HtmlLink.java @@ -214,13 +214,13 @@ public WebResponse getWebResponse(final boolean downloadIfNeeded, WebRequest req && webclient.getBrowserVersion() .hasFeature(HTMLLINK_CHECK_RESPONSE_TYPE_FOR_STYLESHEET)) { - if (org.apache.commons.lang3.StringUtils.isNotBlank(type) + if (StringUtils.isNotBlank(type) && !MimeType.TEXT_CSS.equals(type)) { return null; } final String respType = response.getContentType(); - if (org.apache.commons.lang3.StringUtils.isNotBlank(respType) + if (StringUtils.isNotBlank(respType) && !MimeType.TEXT_CSS.equals(respType)) { executeEvent(Event.TYPE_ERROR); return response; @@ -393,7 +393,7 @@ public boolean isModulePreloadLink() { public boolean isActiveStyleSheetLink() { if (isStyleSheetLink()) { final String media = getMediaAttribute(); - if (org.apache.commons.lang3.StringUtils.isBlank(media)) { + if (StringUtils.isBlank(media)) { return true; } diff --git a/src/main/java/org/htmlunit/html/HtmlMap.java b/src/main/java/org/htmlunit/html/HtmlMap.java index d7a7f2638fe..438d71c6c00 100644 --- a/src/main/java/org/htmlunit/html/HtmlMap.java +++ b/src/main/java/org/htmlunit/html/HtmlMap.java @@ -16,8 +16,8 @@ import java.util.Map; -import org.apache.commons.lang3.StringUtils; import org.htmlunit.SgmlPage; +import org.htmlunit.util.StringUtils; /** * Wrapper for the HTML element "map". diff --git a/src/main/java/org/htmlunit/html/HtmlMedia.java b/src/main/java/org/htmlunit/html/HtmlMedia.java index 3adf013ca07..1c8d19579d2 100644 --- a/src/main/java/org/htmlunit/html/HtmlMedia.java +++ b/src/main/java/org/htmlunit/html/HtmlMedia.java @@ -17,8 +17,8 @@ import java.net.MalformedURLException; import java.util.Map; -import org.apache.commons.lang3.StringUtils; import org.htmlunit.SgmlPage; +import org.htmlunit.util.StringUtils; /** * HTML Media element, e.g. {@link HtmlAudio} or {@link HtmlVideo}. @@ -47,7 +47,7 @@ public class HtmlMedia extends HtmlElement { * @return "probably", "maybe", or "". The current implementation returns "" */ public String canPlayType(final String type) { - if (StringUtils.isAllBlank(type)) { + if (StringUtils.isBlank(type)) { return ""; } diff --git a/src/main/java/org/htmlunit/html/HtmlNumberInput.java b/src/main/java/org/htmlunit/html/HtmlNumberInput.java index 4292478ac0d..4321cd8bd37 100644 --- a/src/main/java/org/htmlunit/html/HtmlNumberInput.java +++ b/src/main/java/org/htmlunit/html/HtmlNumberInput.java @@ -96,7 +96,7 @@ protected void doType(final char c, final boolean lastType) { public String getValue() { final String raw = getRawValue(); - if (StringUtils.isBlank(raw)) { + if (org.htmlunit.util.StringUtils.isBlank(raw)) { return ""; } @@ -133,7 +133,7 @@ public boolean isValid() { } String rawValue = getRawValue(); - if (StringUtils.isBlank(rawValue)) { + if (org.htmlunit.util.StringUtils.isBlank(rawValue)) { return true; } diff --git a/src/main/java/org/htmlunit/html/HtmlObject.java b/src/main/java/org/htmlunit/html/HtmlObject.java index f077a862402..da7c35858f6 100644 --- a/src/main/java/org/htmlunit/html/HtmlObject.java +++ b/src/main/java/org/htmlunit/html/HtmlObject.java @@ -16,11 +16,11 @@ import java.util.Map; -import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.htmlunit.SgmlPage; import org.htmlunit.javascript.host.html.HTMLObjectElement; +import org.htmlunit.util.StringUtils; import org.htmlunit.xml.XmlPage; /** @@ -312,7 +312,7 @@ public void setCustomValidity(final String message) { @Override public boolean isCustomErrorValidityState() { - return !StringUtils.isEmpty(customValidity_); + return !StringUtils.isEmptyOrNull(customValidity_); } @Override diff --git a/src/main/java/org/htmlunit/html/HtmlOutput.java b/src/main/java/org/htmlunit/html/HtmlOutput.java index b2d12b10e70..3a1349ea504 100644 --- a/src/main/java/org/htmlunit/html/HtmlOutput.java +++ b/src/main/java/org/htmlunit/html/HtmlOutput.java @@ -19,8 +19,8 @@ import java.util.HashSet; import java.util.Map; -import org.apache.commons.lang3.StringUtils; import org.htmlunit.SgmlPage; +import org.htmlunit.util.StringUtils; /** * Wrapper for the HTML element "output". @@ -87,7 +87,7 @@ public boolean isValid() { */ @Override public boolean isCustomErrorValidityState() { - return !StringUtils.isEmpty(customValidity_); + return !org.htmlunit.util.StringUtils.isEmptyOrNull(customValidity_); } @Override diff --git a/src/main/java/org/htmlunit/html/HtmlPage.java b/src/main/java/org/htmlunit/html/HtmlPage.java index b5d236be33c..cb27d7ec8cc 100644 --- a/src/main/java/org/htmlunit/html/HtmlPage.java +++ b/src/main/java/org/htmlunit/html/HtmlPage.java @@ -43,7 +43,6 @@ import java.util.concurrent.ConcurrentHashMap; import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.Strings; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.htmlunit.Cache; @@ -939,7 +938,8 @@ public ScriptResult executeJavaScript(String sourceCode, final String sourceName return new ScriptResult(JavaScriptEngine.UNDEFINED); } - if (Strings.CI.startsWith(sourceCode, JavaScriptURLConnection.JAVASCRIPT_PREFIX)) { + if (org.htmlunit.util.StringUtils.startsWithIgnoreCase(sourceCode, + JavaScriptURLConnection.JAVASCRIPT_PREFIX)) { sourceCode = sourceCode.substring(JavaScriptURLConnection.JAVASCRIPT_PREFIX.length()).trim(); if (sourceCode.startsWith("return ")) { sourceCode = sourceCode.substring("return ".length()); @@ -979,7 +979,7 @@ JavaScriptLoadResult loadExternalJavaScriptFile(final String srcAttribute, final throws FailingHttpStatusCodeException { final WebClient client = getWebClient(); - if (StringUtils.isBlank(srcAttribute) || !client.isJavaScriptEnabled()) { + if (org.htmlunit.util.StringUtils.isBlank(srcAttribute) || !client.isJavaScriptEnabled()) { return JavaScriptLoadResult.NOOP; } @@ -1396,7 +1396,7 @@ private void executeRefreshIfNeeded() throws IOException { } } - if (StringUtils.isBlank(urlPart)) { + if (org.htmlunit.util.StringUtils.isBlank(urlPart)) { //content='10; URL=' is treated as content='10' url = getUrl(); } @@ -2346,7 +2346,7 @@ else if (baseUrl_ != null) { } else { final String href = base_.getHrefAttribute().trim(); - if (StringUtils.isEmpty(href)) { + if (org.htmlunit.util.StringUtils.isEmptyOrNull(href)) { baseUrl = getUrl(); } else { diff --git a/src/main/java/org/htmlunit/html/HtmlSelect.java b/src/main/java/org/htmlunit/html/HtmlSelect.java index a72f1c359b0..4a654360012 100644 --- a/src/main/java/org/htmlunit/html/HtmlSelect.java +++ b/src/main/java/org/htmlunit/html/HtmlSelect.java @@ -23,7 +23,6 @@ import java.util.List; import java.util.Map; -import org.apache.commons.lang3.StringUtils; import org.htmlunit.ElementNotFoundException; import org.htmlunit.Page; import org.htmlunit.SgmlPage; @@ -31,6 +30,7 @@ import org.htmlunit.javascript.host.event.Event; import org.htmlunit.javascript.host.event.MouseEvent; import org.htmlunit.util.NameValuePair; +import org.htmlunit.util.StringUtils; import org.w3c.dom.Node; /** @@ -660,7 +660,7 @@ public final String getOnChangeAttribute() { @Override protected void setAttributeNS(final String namespaceURI, final String qualifiedName, final String attributeValue, final boolean notifyAttributeChangeListeners, final boolean notifyMutationObservers) { - final String qualifiedNameLC = org.htmlunit.util.StringUtils.toRootLowerCase(qualifiedName); + final String qualifiedNameLC = StringUtils.toRootLowerCase(qualifiedName); if (DomElement.NAME_ATTRIBUTE.equals(qualifiedNameLC)) { if (newNames_.isEmpty()) { newNames_ = new HashSet<>(); @@ -800,7 +800,7 @@ public boolean isValid() { */ @Override public boolean isCustomErrorValidityState() { - return !StringUtils.isEmpty(customValidity_); + return !StringUtils.isEmptyOrNull(customValidity_); } @Override diff --git a/src/main/java/org/htmlunit/html/HtmlTextArea.java b/src/main/java/org/htmlunit/html/HtmlTextArea.java index 8bb9afbbd71..b5f272a302b 100644 --- a/src/main/java/org/htmlunit/html/HtmlTextArea.java +++ b/src/main/java/org/htmlunit/html/HtmlTextArea.java @@ -20,13 +20,13 @@ import java.util.HashSet; import java.util.Map; -import org.apache.commons.lang3.StringUtils; import org.htmlunit.SgmlPage; import org.htmlunit.html.impl.SelectableTextInput; import org.htmlunit.html.impl.SelectableTextSelectionDelegate; import org.htmlunit.javascript.host.event.Event; import org.htmlunit.javascript.host.event.MouseEvent; import org.htmlunit.util.NameValuePair; +import org.htmlunit.util.StringUtils; import org.w3c.dom.Node; /** @@ -432,7 +432,7 @@ protected boolean printXml(final String indent, final boolean tagBefore, final P printOpeningTagContentAsXml(printWriter); printWriter.print(">"); - printWriter.print(org.htmlunit.util.StringUtils.escapeXml(getText())); + printWriter.print(StringUtils.escapeXml(getText())); printWriter.print(""); return true; } @@ -518,7 +518,7 @@ public boolean isReadOnly() { @Override protected void setAttributeNS(final String namespaceURI, final String qualifiedName, final String attributeValue, final boolean notifyAttributeChangeListeners, final boolean notifyMutationObservers) { - final String qualifiedNameLC = org.htmlunit.util.StringUtils.toRootLowerCase(qualifiedName); + final String qualifiedNameLC = StringUtils.toRootLowerCase(qualifiedName); if (DomElement.NAME_ATTRIBUTE.equals(qualifiedNameLC)) { if (newNames_.isEmpty()) { newNames_ = new HashSet<>(); @@ -630,7 +630,7 @@ public boolean isValid() { */ @Override public boolean isCustomErrorValidityState() { - return !StringUtils.isEmpty(customValidity_); + return !StringUtils.isEmptyOrNull(customValidity_); } @Override diff --git a/src/main/java/org/htmlunit/html/HtmlTimeInput.java b/src/main/java/org/htmlunit/html/HtmlTimeInput.java index 74f38e37021..fbe6ed95798 100644 --- a/src/main/java/org/htmlunit/html/HtmlTimeInput.java +++ b/src/main/java/org/htmlunit/html/HtmlTimeInput.java @@ -23,9 +23,9 @@ import java.util.Locale; import java.util.Map; -import org.apache.commons.lang3.StringUtils; import org.htmlunit.BrowserVersion; import org.htmlunit.SgmlPage; +import org.htmlunit.util.StringUtils; /** * Wrapper for the HTML element "input" where type is "time". diff --git a/src/main/java/org/htmlunit/html/HtmlUrlInput.java b/src/main/java/org/htmlunit/html/HtmlUrlInput.java index a94157b7e26..8fde0600153 100644 --- a/src/main/java/org/htmlunit/html/HtmlUrlInput.java +++ b/src/main/java/org/htmlunit/html/HtmlUrlInput.java @@ -16,8 +16,8 @@ import java.util.Map; -import org.apache.commons.lang3.StringUtils; import org.htmlunit.SgmlPage; +import org.htmlunit.util.StringUtils; /** * Wrapper for the HTML element "input" where type is "url". diff --git a/src/main/java/org/htmlunit/html/HtmlWeekInput.java b/src/main/java/org/htmlunit/html/HtmlWeekInput.java index c94a7423dea..9b6f0ab1492 100644 --- a/src/main/java/org/htmlunit/html/HtmlWeekInput.java +++ b/src/main/java/org/htmlunit/html/HtmlWeekInput.java @@ -22,9 +22,9 @@ import java.time.format.DateTimeParseException; import java.util.Map; -import org.apache.commons.lang3.StringUtils; import org.htmlunit.BrowserVersion; import org.htmlunit.SgmlPage; +import org.htmlunit.util.StringUtils; /** * Wrapper for the HTML element "input" where type is "week". @@ -63,7 +63,7 @@ public void setDefaultChecked(final boolean defaultChecked) { @Override public void setValue(final String newValue) { if (!hasFeature(HTMLINPUT_TYPE_WEEK_SUPPORTED) - || StringUtils.isEmpty(newValue)) { + || StringUtils.isEmptyOrNull(newValue)) { super.setValue(newValue); return; } diff --git a/src/main/java/org/htmlunit/html/ScriptElementSupport.java b/src/main/java/org/htmlunit/html/ScriptElementSupport.java index 801fb7f55e3..b0645c68272 100644 --- a/src/main/java/org/htmlunit/html/ScriptElementSupport.java +++ b/src/main/java/org/htmlunit/html/ScriptElementSupport.java @@ -18,8 +18,6 @@ import java.nio.charset.Charset; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.Strings; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.htmlunit.FailingHttpStatusCodeException; @@ -37,6 +35,7 @@ import org.htmlunit.protocol.javascript.JavaScriptURLConnection; import org.htmlunit.util.EncodingSniffer; import org.htmlunit.util.MimeType; +import org.htmlunit.util.StringUtils; import org.htmlunit.xml.XmlPage; /** @@ -293,12 +292,12 @@ private static boolean isExecutionNeeded(final ScriptElement script, final boole public static boolean isJavaScript(String typeAttribute, final String languageAttribute) { typeAttribute = typeAttribute.trim(); - if (StringUtils.isNotEmpty(typeAttribute)) { + if (!StringUtils.isEmptyOrNull(typeAttribute)) { return MimeType.isJavascriptMimeType(typeAttribute); } - if (StringUtils.isNotEmpty(languageAttribute)) { - return Strings.CI.startsWith(languageAttribute, "javascript"); + if (!StringUtils.isEmptyOrNull(languageAttribute)) { + return org.htmlunit.util.StringUtils.startsWithIgnoreCase(languageAttribute, "javascript"); } return true; } diff --git a/src/main/java/org/htmlunit/html/XmlSerializer.java b/src/main/java/org/htmlunit/html/XmlSerializer.java index 14f9d99e324..41ff1bf91c0 100644 --- a/src/main/java/org/htmlunit/html/XmlSerializer.java +++ b/src/main/java/org/htmlunit/html/XmlSerializer.java @@ -281,7 +281,7 @@ private static String getFileExtension(final Page enclosedPage) { protected Map getAttributesFor(final HtmlLink link) throws IOException { final Map map = createAttributesCopyWithClonedAttribute(link, "href"); final DomAttr hrefAttr = map.get("href"); - if (hrefAttr != null && StringUtils.isNotBlank(hrefAttr.getValue())) { + if (hrefAttr != null && org.htmlunit.util.StringUtils.isNotBlank(hrefAttr.getValue())) { final String protocol = link.getWebRequest().getUrl().getProtocol(); if ("http".equals(protocol) || "https".equals(protocol)) { try { @@ -312,7 +312,7 @@ protected Map getAttributesFor(final HtmlLink link) throws IOEx protected Map getAttributesFor(final HtmlImage image) { final Map map = createAttributesCopyWithClonedAttribute(image, DomElement.SRC_ATTRIBUTE); final DomAttr srcAttr = map.get(DomElement.SRC_ATTRIBUTE); - if (srcAttr != null && StringUtils.isNotBlank(srcAttr.getValue())) { + if (srcAttr != null && org.htmlunit.util.StringUtils.isNotBlank(srcAttr.getValue())) { try { final WebResponse response = image.getWebResponse(true); diff --git a/src/main/java/org/htmlunit/html/parser/neko/HtmlUnitNekoDOMBuilder.java b/src/main/java/org/htmlunit/html/parser/neko/HtmlUnitNekoDOMBuilder.java index cd61bd95e6c..98d3dab145b 100644 --- a/src/main/java/org/htmlunit/html/parser/neko/HtmlUnitNekoDOMBuilder.java +++ b/src/main/java/org/htmlunit/html/parser/neko/HtmlUnitNekoDOMBuilder.java @@ -40,6 +40,7 @@ import org.htmlunit.cyberneko.xerces.xni.XNIException; import org.htmlunit.cyberneko.xerces.xni.parser.XMLInputSource; import org.htmlunit.cyberneko.xerces.xni.parser.XMLParserConfiguration; +import org.htmlunit.html.DomCDataSection; import org.htmlunit.html.DomComment; import org.htmlunit.html.DomDocumentType; import org.htmlunit.html.DomElement; @@ -546,7 +547,7 @@ private void handleCharacters() { final String textValue = characters_.toString(); characters_.clear(); - if (org.apache.commons.lang3.StringUtils.isBlank(textValue)) { + if (StringUtils.isBlank(textValue)) { appendChild(currentNode_, new DomText(page_, textValue)); return; } @@ -630,7 +631,11 @@ public void comment(final char[] ch, final int start, final int length) { /** {@inheritDoc} */ @Override public void endCDATA() { - // nothing to do + final String data = characters_.toString(); + characters_.clear(); + + final DomCDataSection cdataSection = new DomCDataSection(page_, data); + appendChild(currentNode_, cdataSection); } /** {@inheritDoc} */ @@ -648,7 +653,7 @@ public void endEntity(final String name) { /** {@inheritDoc} */ @Override public void startCDATA() { - // nothing to do + handleCharacters(); } /** {@inheritDoc} */ diff --git a/src/main/java/org/htmlunit/html/parser/neko/HtmlUnitNekoHtmlParser.java b/src/main/java/org/htmlunit/html/parser/neko/HtmlUnitNekoHtmlParser.java index 24c79cb8ea7..5860d00976c 100644 --- a/src/main/java/org/htmlunit/html/parser/neko/HtmlUnitNekoHtmlParser.java +++ b/src/main/java/org/htmlunit/html/parser/neko/HtmlUnitNekoHtmlParser.java @@ -155,6 +155,7 @@ public void parse(final WebClient webClient, final WebResponse webResponse, fina domBuilder.setFeature(HTMLScanner.ALLOW_SELFCLOSING_TAGS, true); domBuilder.setFeature(HTMLScanner.SCRIPT_STRIP_CDATA_DELIMS, true); domBuilder.setFeature(HTMLScanner.STYLE_STRIP_CDATA_DELIMS, true); + domBuilder.setFeature(HTMLScanner.CDATA_SECTIONS, true); domBuilder.setFeature(HTMLScanner.CDATA_EARLY_CLOSING, false); } diff --git a/src/main/java/org/htmlunit/html/serializer/HtmlSerializerInnerOuterText.java b/src/main/java/org/htmlunit/html/serializer/HtmlSerializerInnerOuterText.java index 455b1656f10..6f394f90ae8 100644 --- a/src/main/java/org/htmlunit/html/serializer/HtmlSerializerInnerOuterText.java +++ b/src/main/java/org/htmlunit/html/serializer/HtmlSerializerInnerOuterText.java @@ -16,7 +16,6 @@ import static org.htmlunit.BrowserVersionFeatures.JS_INNER_TEXT_SVG_NL; -import org.apache.commons.lang3.StringUtils; import org.htmlunit.BrowserVersion; import org.htmlunit.SgmlPage; import org.htmlunit.WebWindow; @@ -40,6 +39,7 @@ import org.htmlunit.html.ScriptElement; import org.htmlunit.html.serializer.HtmlSerializerInnerOuterText.HtmlSerializerTextBuilder.Mode; import org.htmlunit.svg.SvgTitle; +import org.htmlunit.util.StringUtils; /** * Special serializer to generate the output we need @@ -261,7 +261,7 @@ private static Mode whiteSpaceStyle(final DomNode domNode, final Mode defaultMod window.getComputedStyle((DomElement) domNode, null); final String value = style.getStyleAttribute(Definition.WHITE_SPACE, false); - if (StringUtils.isNoneEmpty(value)) { + if (!StringUtils.isEmptyOrNull(value)) { if ("normal".equalsIgnoreCase(value)) { return Mode.WHITE_SPACE_NORMAL; } diff --git a/src/main/java/org/htmlunit/html/serializer/HtmlSerializerVisibleText.java b/src/main/java/org/htmlunit/html/serializer/HtmlSerializerVisibleText.java index cc3b345eabb..33bd616afb0 100644 --- a/src/main/java/org/htmlunit/html/serializer/HtmlSerializerVisibleText.java +++ b/src/main/java/org/htmlunit/html/serializer/HtmlSerializerVisibleText.java @@ -18,12 +18,12 @@ import java.util.List; -import org.apache.commons.lang3.StringUtils; import org.htmlunit.Page; import org.htmlunit.SgmlPage; import org.htmlunit.WebWindow; import org.htmlunit.css.ComputedCssStyleDeclaration; import org.htmlunit.css.StyleAttributes.Definition; +import org.htmlunit.html.DomCDataSection; import org.htmlunit.html.DomComment; import org.htmlunit.html.DomElement; import org.htmlunit.html.DomNode; @@ -58,6 +58,7 @@ import org.htmlunit.html.HtmlUnorderedList; import org.htmlunit.html.TableRowGroup; import org.htmlunit.html.serializer.HtmlSerializerVisibleText.HtmlSerializerTextBuilder.Mode; +import org.htmlunit.util.StringUtils; /** * Special serializer to generate the output we need @@ -105,7 +106,10 @@ protected void appendChildren(final HtmlSerializerTextBuilder builder, final Dom * @param mode the {@link Mode} to use for processing */ protected void appendNode(final HtmlSerializerTextBuilder builder, final DomNode node, final Mode mode) { - if (node instanceof DomText) { + if (node instanceof DomCDataSection) { + // ignore + } + else if (node instanceof DomText) { appendText(builder, (DomText) node, mode); } else if (node instanceof DomComment) { @@ -683,7 +687,7 @@ protected Mode whiteSpaceStyle(final DomNode domNode, final Mode defaultMode) { if (node instanceof DomElement) { final ComputedCssStyleDeclaration style = window.getComputedStyle((DomElement) node, null); final String value = style.getStyleAttribute(Definition.WHITE_SPACE, false); - if (StringUtils.isNoneEmpty(value)) { + if (!StringUtils.isEmptyOrNull(value)) { if ("normal".equalsIgnoreCase(value)) { return Mode.WHITE_SPACE_NORMAL; } @@ -716,7 +720,7 @@ protected Mode updateWhiteSpaceStyle(final DomNode domNode, final Mode defaultMo if (domNode instanceof DomElement) { final ComputedCssStyleDeclaration style = window.getComputedStyle((DomElement) domNode, null); final String value = style.getStyleAttribute(Definition.WHITE_SPACE, false); - if (StringUtils.isNoneEmpty(value)) { + if (!StringUtils.isEmptyOrNull(value)) { if ("normal".equalsIgnoreCase(value)) { return Mode.WHITE_SPACE_NORMAL; } diff --git a/src/main/java/org/htmlunit/httpclient/HtmlUnitBrowserCompatCookieSpec.java b/src/main/java/org/htmlunit/httpclient/HtmlUnitBrowserCompatCookieSpec.java index 977ce63d5d2..b603f2fde92 100644 --- a/src/main/java/org/htmlunit/httpclient/HtmlUnitBrowserCompatCookieSpec.java +++ b/src/main/java/org/htmlunit/httpclient/HtmlUnitBrowserCompatCookieSpec.java @@ -23,7 +23,6 @@ import java.util.List; import java.util.Locale; -import org.apache.commons.lang3.StringUtils; import org.apache.http.FormattedHeader; import org.apache.http.Header; import org.apache.http.HeaderElement; @@ -47,6 +46,7 @@ import org.apache.http.message.TokenParser; import org.apache.http.util.CharArrayBuffer; import org.htmlunit.BrowserVersion; +import org.htmlunit.util.StringUtils; /** * Customized BrowserCompatSpec for HtmlUnit. diff --git a/src/main/java/org/htmlunit/httpclient/HtmlUnitSameSiteHandler.java b/src/main/java/org/htmlunit/httpclient/HtmlUnitSameSiteHandler.java index f9fb0fe5485..6a905599c0b 100644 --- a/src/main/java/org/htmlunit/httpclient/HtmlUnitSameSiteHandler.java +++ b/src/main/java/org/htmlunit/httpclient/HtmlUnitSameSiteHandler.java @@ -14,13 +14,13 @@ */ package org.htmlunit.httpclient; -import org.apache.commons.lang3.StringUtils; import org.apache.http.cookie.CommonCookieAttributeHandler; import org.apache.http.cookie.Cookie; import org.apache.http.cookie.CookieOrigin; import org.apache.http.cookie.MalformedCookieException; import org.apache.http.cookie.SetCookie; import org.apache.http.impl.cookie.BasicClientCookie; +import org.htmlunit.util.StringUtils; /** * Customized CookieAttributeHandler for handling of the samesite attribute. diff --git a/src/main/java/org/htmlunit/javascript/JavaScriptEngine.java b/src/main/java/org/htmlunit/javascript/JavaScriptEngine.java index 5c68f040dea..ced5366e785 100644 --- a/src/main/java/org/htmlunit/javascript/JavaScriptEngine.java +++ b/src/main/java/org/htmlunit/javascript/JavaScriptEngine.java @@ -30,7 +30,6 @@ import java.util.Map; import java.util.Map.Entry; -import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.htmlunit.BrowserVersion; @@ -79,6 +78,7 @@ import org.htmlunit.javascript.host.intl.Intl; import org.htmlunit.javascript.host.xml.FormData; import org.htmlunit.javascript.polyfill.Polyfill; +import org.htmlunit.util.StringUtils; /** * A wrapper for the Rhino JavaScript engine @@ -290,7 +290,7 @@ public static void configureScope(final HtmlUnitScriptable jsScope, final String jsClassName = config.getClassName(); Scriptable prototype = prototypesPerJSName.get(jsClassName); final String extendedClassName = - StringUtils.isEmpty(config.getExtendedClassName()) ? null : config.getExtendedClassName(); + StringUtils.isEmptyOrNull(config.getExtendedClassName()) ? null : config.getExtendedClassName(); // setup the prototypes if (config == scopeConfig) { diff --git a/src/main/java/org/htmlunit/javascript/host/Element.java b/src/main/java/org/htmlunit/javascript/host/Element.java index 2967bea2042..1e8a4b6ca2b 100644 --- a/src/main/java/org/htmlunit/javascript/host/Element.java +++ b/src/main/java/org/htmlunit/javascript/host/Element.java @@ -42,6 +42,7 @@ import org.htmlunit.css.ElementCssStyleDeclaration; import org.htmlunit.cssparser.parser.CSSException; import org.htmlunit.html.DomAttr; +import org.htmlunit.html.DomCDataSection; import org.htmlunit.html.DomCharacterData; import org.htmlunit.html.DomComment; import org.htmlunit.html.DomElement; @@ -1008,6 +1009,9 @@ protected void printNode(final StringBuilder builder, final DomNode node, final builder.append(""); } } + else if (node instanceof DomCDataSection) { + builder.append(""); + } else if (node instanceof DomCharacterData) { // Remove whitespace sequences, possibly escape XML characters. String s = node.getNodeValue(); diff --git a/src/main/java/org/htmlunit/javascript/host/History.java b/src/main/java/org/htmlunit/javascript/host/History.java index 3601a72c9b3..26986d17acd 100644 --- a/src/main/java/org/htmlunit/javascript/host/History.java +++ b/src/main/java/org/htmlunit/javascript/host/History.java @@ -18,7 +18,6 @@ import java.net.MalformedURLException; import java.net.URL; -import org.apache.commons.lang3.StringUtils; import org.htmlunit.WebWindow; import org.htmlunit.html.HtmlPage; import org.htmlunit.javascript.HtmlUnitScriptable; @@ -28,6 +27,7 @@ import org.htmlunit.javascript.configuration.JsxFunction; import org.htmlunit.javascript.configuration.JsxGetter; import org.htmlunit.javascript.configuration.JsxSetter; +import org.htmlunit.util.StringUtils; /** * A JavaScript object for the client's browsing history. diff --git a/src/main/java/org/htmlunit/javascript/host/Location.java b/src/main/java/org/htmlunit/javascript/host/Location.java index 8bc57f34a0d..1a41596e5df 100644 --- a/src/main/java/org/htmlunit/javascript/host/Location.java +++ b/src/main/java/org/htmlunit/javascript/host/Location.java @@ -22,8 +22,6 @@ import java.net.MalformedURLException; import java.net.URL; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.Strings; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.htmlunit.BrowserVersion; @@ -39,6 +37,7 @@ import org.htmlunit.javascript.host.event.Event; import org.htmlunit.javascript.host.event.HashChangeEvent; import org.htmlunit.protocol.javascript.JavaScriptURLConnection; +import org.htmlunit.util.StringUtils; import org.htmlunit.util.UrlUtils; /** @@ -307,7 +306,7 @@ public void setHref(final String newLocation) throws IOException { URL url = page.getFullyQualifiedUrl(newLocation); // fix for empty url - if (StringUtils.isEmpty(newLocation)) { + if (StringUtils.isEmptyOrNull(newLocation)) { url = UrlUtils.getUrlWithNewRef(url, null); } @@ -334,11 +333,11 @@ public void setHref(final String newLocation) throws IOException { public String getSearch() { final URL url = getUrl(); final String search = url.getQuery(); - if (StringUtils.isEmpty(search)) { + if (StringUtils.isEmptyOrNull(search)) { return ""; } - if (Strings.CI.startsWith(url.getProtocol(), UrlUtils.ABOUT) + if (StringUtils.startsWithIgnoreCase(url.getProtocol(), UrlUtils.ABOUT) && window_.getWebWindow().getWebClient().getBrowserVersion() .hasFeature(JS_LOCATION_IGNORE_QUERY_FOR_ABOUT_PROTOCOL)) { return ""; @@ -368,7 +367,7 @@ public String getHash() { hash = decodeHash(hash); } - if (StringUtils.isEmpty(hash)) { + if (StringUtils.isEmptyOrNull(hash)) { // nothing to do } else { diff --git a/src/main/java/org/htmlunit/javascript/host/MessagePort.java b/src/main/java/org/htmlunit/javascript/host/MessagePort.java index a258692c40c..4f8f638daee 100644 --- a/src/main/java/org/htmlunit/javascript/host/MessagePort.java +++ b/src/main/java/org/htmlunit/javascript/host/MessagePort.java @@ -105,8 +105,9 @@ public void postMessage(final String message, final Object transfer) { final Window w = getWindow(); final WebWindow webWindow = w.getWebWindow(); final Page page = webWindow.getEnclosedPage(); - final URL currentURL = page.getUrl(); + final MessageEvent event = new MessageEvent(); + final URL currentURL = page.getUrl(); final String origin = currentURL.getProtocol() + "://" + currentURL.getHost() + ':' + currentURL.getPort(); event.initMessageEvent(Event.TYPE_MESSAGE, false, false, message, origin, "", w, transfer); event.setParentScope(port_); diff --git a/src/main/java/org/htmlunit/javascript/host/Navigator.java b/src/main/java/org/htmlunit/javascript/host/Navigator.java index 5639079b1a9..eded151f891 100644 --- a/src/main/java/org/htmlunit/javascript/host/Navigator.java +++ b/src/main/java/org/htmlunit/javascript/host/Navigator.java @@ -22,7 +22,6 @@ import java.util.ArrayList; -import org.apache.commons.lang3.StringUtils; import org.htmlunit.WebClient; import org.htmlunit.corejs.javascript.Scriptable; import org.htmlunit.javascript.HtmlUnitScriptable; @@ -34,6 +33,7 @@ import org.htmlunit.javascript.host.geo.Geolocation; import org.htmlunit.javascript.host.media.MediaDevices; import org.htmlunit.javascript.host.network.NetworkInformation; +import org.htmlunit.util.StringUtils; /** * A JavaScript object for {@code Navigator}. @@ -106,16 +106,16 @@ public String getLanguage() { @JsxGetter public Scriptable getLanguages() { final String acceptLang = getBrowserVersion().getAcceptLanguageHeader(); - if (StringUtils.isEmpty(acceptLang)) { + if (StringUtils.isEmptyOrNull(acceptLang)) { return JavaScriptEngine.newArray(this, 0); } final ArrayList res = new ArrayList<>(); final String[] parts = org.htmlunit.util.StringUtils.splitAtComma(acceptLang); for (final String part : parts) { - if (!StringUtils.isEmpty(part)) { - final String lang = StringUtils.substringBefore(part, ";").trim(); - if (!StringUtils.isEmpty(part)) { + if (!StringUtils.isEmptyOrNull(part)) { + final String lang = org.apache.commons.lang3.StringUtils.substringBefore(part, ";").trim(); + if (!StringUtils.isEmptyOrNull(part)) { res.add(lang); } } diff --git a/src/main/java/org/htmlunit/javascript/host/URL.java b/src/main/java/org/htmlunit/javascript/host/URL.java index 0de3ba46250..bdbdc23a9c0 100644 --- a/src/main/java/org/htmlunit/javascript/host/URL.java +++ b/src/main/java/org/htmlunit/javascript/host/URL.java @@ -66,7 +66,7 @@ public void jsConstructor(final String url, final Object base) { } try { - if (StringUtils.isBlank(baseStr)) { + if (org.htmlunit.util.StringUtils.isBlank(baseStr)) { url_ = UrlUtils.toUrlUnsafe(url); } else { @@ -134,7 +134,7 @@ public void setHash(final String fragment) throws MalformedURLException { if (url_ == null) { return; } - url_ = UrlUtils.getUrlWithNewRef(url_, StringUtils.isEmpty(fragment) ? null : fragment); + url_ = UrlUtils.getUrlWithNewRef(url_, org.htmlunit.util.StringUtils.isEmptyOrNull(fragment) ? null : fragment); } /** @@ -161,7 +161,7 @@ public void setHost(final String host) throws MalformedURLException { } String newHost = StringUtils.substringBefore(host, ':'); - if (StringUtils.isEmpty(newHost)) { + if (org.htmlunit.util.StringUtils.isEmptyOrNull(newHost)) { return; } @@ -190,7 +190,7 @@ public void setHost(final String host) throws MalformedURLException { url_ = UrlUtils.getUrlWithNewHost(url_, newHost); final String newPort = StringUtils.substringAfter(host, ':'); - if (StringUtils.isNotBlank(newHost)) { + if (org.htmlunit.util.StringUtils.isNotBlank(newHost)) { try { url_ = UrlUtils.getUrlWithNewHostAndPort(url_, newHost, Integer.parseInt(newPort)); } @@ -225,11 +225,11 @@ public String getHostname() { @JsxSetter public void setHostname(final String hostname) throws MalformedURLException { if (getBrowserVersion().hasFeature(JS_ANCHOR_HOSTNAME_IGNORE_BLANK)) { - if (!StringUtils.isBlank(hostname)) { + if (!org.htmlunit.util.StringUtils.isBlank(hostname)) { url_ = UrlUtils.getUrlWithNewHost(url_, hostname); } } - else if (!StringUtils.isEmpty(hostname)) { + else if (!org.htmlunit.util.StringUtils.isEmptyOrNull(hostname)) { url_ = UrlUtils.getUrlWithNewHost(url_, hostname); } } @@ -513,7 +513,7 @@ public Object getDefaultValue(final Class hint) { return super.getDefaultValue(hint); } - if (StringUtils.isEmpty(url_.getPath())) { + if (org.htmlunit.util.StringUtils.isEmptyOrNull(url_.getPath())) { return url_.toExternalForm() + "/"; } return url_.toExternalForm(); @@ -534,7 +534,7 @@ public String toJSON() { */ @JsxFunction(functionName = "toString") public String jsToString() { - if (StringUtils.isEmpty(url_.getPath())) { + if (org.htmlunit.util.StringUtils.isEmptyOrNull(url_.getPath())) { try { return UrlUtils.getUrlWithNewPath(url_, "/").toExternalForm(); } diff --git a/src/main/java/org/htmlunit/javascript/host/URLSearchParams.java b/src/main/java/org/htmlunit/javascript/host/URLSearchParams.java index 7e8f851c54d..3a4bd17b30a 100644 --- a/src/main/java/org/htmlunit/javascript/host/URLSearchParams.java +++ b/src/main/java/org/htmlunit/javascript/host/URLSearchParams.java @@ -246,7 +246,7 @@ private static List splitQuery(String params) { final List splitted = new ArrayList<>(); params = StringUtils.stripStart(params, "?"); - if (StringUtils.isEmpty(params)) { + if (org.htmlunit.util.StringUtils.isEmptyOrNull(params)) { return splitted; } diff --git a/src/main/java/org/htmlunit/javascript/host/Window.java b/src/main/java/org/htmlunit/javascript/host/Window.java index 03c4861449e..c40e1d75d4a 100644 --- a/src/main/java/org/htmlunit/javascript/host/Window.java +++ b/src/main/java/org/htmlunit/javascript/host/Window.java @@ -35,7 +35,6 @@ import java.util.function.Predicate; import java.util.function.Supplier; -import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.htmlunit.AlertHandler; @@ -116,6 +115,7 @@ import org.htmlunit.javascript.host.performance.Performance; import org.htmlunit.javascript.host.speech.SpeechSynthesis; import org.htmlunit.javascript.host.xml.XMLDocument; +import org.htmlunit.util.StringUtils; import org.htmlunit.util.UrlUtils; import org.htmlunit.xml.XmlPage; @@ -445,7 +445,7 @@ public WindowProxy open(final Object url, final Object name, final Object featur } // if specified name is the name of an existing window, then hold it - if (StringUtils.isEmpty(urlString) && !org.htmlunit.util.StringUtils.isEmptyString(windowName)) { + if (StringUtils.isEmptyOrNull(urlString) && !StringUtils.isEmptyString(windowName)) { try { final WebWindow webWindow = webClient.getWebWindowByName(windowName); return getProxy(webWindow); @@ -2000,9 +2000,9 @@ public static void postMessage(final Context context, final Scriptable scope, final Page page = webWindow.getEnclosedPage(); final URL senderURL = page.getUrl(); - if (!org.htmlunit.util.StringUtils.equalsChar('*', targetOrigin)) { + if (!StringUtils.equalsChar('*', targetOrigin)) { final URL targetURL; - if (org.htmlunit.util.StringUtils.equalsChar('/', targetOrigin)) { + if (StringUtils.equalsChar('/', targetOrigin)) { targetURL = senderURL; } else { diff --git a/src/main/java/org/htmlunit/javascript/host/css/CSSStyleDeclaration.java b/src/main/java/org/htmlunit/javascript/host/css/CSSStyleDeclaration.java index 418b18615d0..48c9dd75d31 100644 --- a/src/main/java/org/htmlunit/javascript/host/css/CSSStyleDeclaration.java +++ b/src/main/java/org/htmlunit/javascript/host/css/CSSStyleDeclaration.java @@ -38,7 +38,6 @@ import java.util.Set; import org.apache.commons.lang3.ArrayUtils; -import org.apache.commons.lang3.StringUtils; import org.htmlunit.BrowserVersion; import org.htmlunit.corejs.javascript.Scriptable; import org.htmlunit.corejs.javascript.ScriptableObject; @@ -58,6 +57,7 @@ import org.htmlunit.javascript.configuration.JsxSetter; import org.htmlunit.javascript.configuration.JsxSymbol; import org.htmlunit.javascript.host.Element; +import org.htmlunit.util.StringUtils; /** * A JavaScript object for {@code CSSStyleDeclaration}. @@ -1180,7 +1180,7 @@ public Object get(final String name, final Scriptable start) { return value; } - final String camel = org.htmlunit.util.StringUtils.cssCamelize(name); + final String camel = StringUtils.cssCamelize(name); if (!name.equals(camel)) { value = prototype.get(camel, start); if (value != Scriptable.NOT_FOUND) { @@ -1249,7 +1249,7 @@ public void put(final String name, final Scriptable start, final Object value) { prototype.put(name, start, value); return; } - final String camel = org.htmlunit.util.StringUtils.cssCamelize(name); + final String camel = StringUtils.cssCamelize(name); if (!name.equals(camel) && prototype.get(camel, start) != Scriptable.NOT_FOUND) { prototype.put(camel, start, value); return; @@ -1800,7 +1800,7 @@ public String getZIndex() { @JsxSetter public void setZIndex(final Object zIndex) { // empty - if (zIndex == null || StringUtils.isEmpty(zIndex.toString())) { + if (zIndex == null || StringUtils.isEmptyOrNull(zIndex.toString())) { setStyleAttribute(Definition.Z_INDEX_.getAttributeName(), ""); return; } @@ -1834,7 +1834,7 @@ public void setZIndex(final Object zIndex) { @JsxFunction public String getPropertyValue(final String name) { if (name != null && name.contains("-")) { - final Object value = getProperty(this, org.htmlunit.util.StringUtils.cssCamelize(name)); + final Object value = getProperty(this, StringUtils.cssCamelize(name)); if (value instanceof String) { return (String) value; } @@ -1863,7 +1863,7 @@ public String getPropertyPriority(final String name) { @JsxFunction public void setProperty(final String name, final Object value, final String important) { String imp = ""; - if (!StringUtils.isEmpty(important) && !"null".equals(important)) { + if (!StringUtils.isEmptyOrNull(important) && !"null".equals(important)) { if (!StyleElement.PRIORITY_IMPORTANT.equalsIgnoreCase(important)) { return; } @@ -1973,7 +1973,7 @@ private void setStyleLengthAttribute(final String name, final Object value, fina valueString = ""; } - if (StringUtils.isEmpty(valueString)) { + if (StringUtils.isEmptyOrNull(valueString)) { setStyleAttribute(name, valueString, important); return; } diff --git a/src/main/java/org/htmlunit/javascript/host/css/ComputedCSSStyleDeclaration.java b/src/main/java/org/htmlunit/javascript/host/css/ComputedCSSStyleDeclaration.java index e86e9f7f6cf..861c817f187 100644 --- a/src/main/java/org/htmlunit/javascript/host/css/ComputedCSSStyleDeclaration.java +++ b/src/main/java/org/htmlunit/javascript/host/css/ComputedCSSStyleDeclaration.java @@ -27,6 +27,7 @@ import org.htmlunit.javascript.configuration.JsxSymbol; import org.htmlunit.javascript.configuration.JsxSymbolConstant; import org.htmlunit.javascript.host.Element; +import org.htmlunit.util.StringUtils; /** * An object for a CSSStyleDeclaration, which is computed. @@ -540,7 +541,7 @@ public String getZIndex() { @Override public String getPropertyValue(final String name) { // need to invoke the getter to take care of the default value - final Object property = getProperty(this, org.htmlunit.util.StringUtils.cssCamelize(name)); + final Object property = getProperty(this, StringUtils.cssCamelize(name)); if (property == NOT_FOUND) { return super.getPropertyValue(name); } diff --git a/src/main/java/org/htmlunit/javascript/host/dom/DOMTokenList.java b/src/main/java/org/htmlunit/javascript/host/dom/DOMTokenList.java index d39d11f3771..99ecc6ea51c 100644 --- a/src/main/java/org/htmlunit/javascript/host/dom/DOMTokenList.java +++ b/src/main/java/org/htmlunit/javascript/host/dom/DOMTokenList.java @@ -112,7 +112,7 @@ public void setValue(final String value) { @JsxGetter public int getLength() { final String value = getValue(); - if (StringUtils.isBlank(value)) { + if (org.htmlunit.util.StringUtils.isBlank(value)) { return 0; } @@ -154,7 +154,7 @@ public static void add(final Context context, final Scriptable scope, for (final Object arg : args) { final String token = JavaScriptEngine.toString(arg); - if (StringUtils.isEmpty(token)) { + if (org.htmlunit.util.StringUtils.isEmptyOrNull(token)) { throw JavaScriptEngine.asJavaScriptException( (HtmlUnitScriptable) getTopLevelScope(thisObj), "DOMTokenList: add() does not support empty tokens", @@ -200,7 +200,7 @@ public static void remove(final Context context, final Scriptable scope, for (final Object arg : args) { final String token = JavaScriptEngine.toString(arg); - if (StringUtils.isEmpty(token)) { + if (org.htmlunit.util.StringUtils.isEmptyOrNull(token)) { throw JavaScriptEngine.asJavaScriptException( (HtmlUnitScriptable) getTopLevelScope(thisObj), "DOMTokenList: remove() does not support empty tokens", @@ -228,7 +228,7 @@ public static void remove(final Context context, final Scriptable scope, */ @JsxFunction public boolean replace(final String oldToken, final String newToken) { - if (StringUtils.isEmpty(oldToken)) { + if (org.htmlunit.util.StringUtils.isEmptyOrNull(oldToken)) { throw JavaScriptEngine.asJavaScriptException( getWindow(), "Empty oldToken not allowed", @@ -241,7 +241,7 @@ public boolean replace(final String oldToken, final String newToken) { DOMException.INVALID_CHARACTER_ERR); } - if (StringUtils.isEmpty(newToken)) { + if (org.htmlunit.util.StringUtils.isEmptyOrNull(newToken)) { throw JavaScriptEngine.asJavaScriptException( getWindow(), "Empty newToken not allowed", @@ -276,7 +276,7 @@ public boolean replace(final String oldToken, final String newToken) { */ @JsxFunction public boolean toggle(final String token) { - if (StringUtils.isEmpty(token)) { + if (org.htmlunit.util.StringUtils.isEmptyOrNull(token)) { throw JavaScriptEngine.asJavaScriptException( getWindow(), "DOMTokenList: toggle() does not support empty tokens", @@ -308,11 +308,11 @@ public boolean toggle(final String token) { */ @JsxFunction public boolean contains(final String token) { - if (StringUtils.isBlank(token)) { + if (org.htmlunit.util.StringUtils.isBlank(token)) { return false; } - if (StringUtils.isEmpty(token)) { + if (org.htmlunit.util.StringUtils.isEmptyOrNull(token)) { throw JavaScriptEngine.reportRuntimeError("DOMTokenList: contains() does not support empty tokens"); } if (StringUtils.containsAny(token, WHITESPACE_CHARS)) { @@ -336,7 +336,7 @@ public String item(final int index) { } final String value = getValue(); - if (StringUtils.isEmpty(value)) { + if (org.htmlunit.util.StringUtils.isEmptyOrNull(value)) { return null; } @@ -365,7 +365,7 @@ public Object[] getIds() { final Object[] normalIds = super.getIds(); final String value = getValue(); - if (StringUtils.isEmpty(value)) { + if (org.htmlunit.util.StringUtils.isEmptyOrNull(value)) { return normalIds; } @@ -411,7 +411,7 @@ public void forEach(final Object callback) { } final String value = getValue(); - if (StringUtils.isEmpty(value)) { + if (org.htmlunit.util.StringUtils.isEmptyOrNull(value)) { return; } @@ -460,7 +460,7 @@ private void updateAttribute(final String value) { } private static List split(final String value) { - if (StringUtils.isEmpty(value)) { + if (org.htmlunit.util.StringUtils.isEmptyOrNull(value)) { return new ArrayList<>(); } diff --git a/src/main/java/org/htmlunit/javascript/host/dom/Document.java b/src/main/java/org/htmlunit/javascript/host/dom/Document.java index b409b07ac88..8eafc0cdc85 100644 --- a/src/main/java/org/htmlunit/javascript/host/dom/Document.java +++ b/src/main/java/org/htmlunit/javascript/host/dom/Document.java @@ -44,7 +44,6 @@ import java.util.UUID; import java.util.function.Predicate; -import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.htmlunit.HttpHeader; @@ -127,6 +126,7 @@ import org.htmlunit.javascript.host.html.HTMLElement; import org.htmlunit.javascript.host.html.HTMLFrameSetElement; import org.htmlunit.util.Cookie; +import org.htmlunit.util.StringUtils; import org.htmlunit.util.UrlUtils; import org.htmlunit.xpath.xml.utils.PrefixResolver; import org.w3c.dom.CDATASection; @@ -723,7 +723,7 @@ public HtmlUnitScriptable createElementNS(final String namespaceURI, final Strin public HTMLCollection getElementsByTagName(final String tagName) { final HTMLCollection collection = new HTMLCollection(getDomNodeOrDie(), false); - if (org.htmlunit.util.StringUtils.equalsChar('*', tagName)) { + if (StringUtils.equalsChar('*', tagName)) { collection.setIsMatchingPredicate((Predicate & Serializable) node -> true); } else { diff --git a/src/main/java/org/htmlunit/javascript/host/file/Blob.java b/src/main/java/org/htmlunit/javascript/host/file/Blob.java index 7d3fce2fba9..3bf5270da37 100644 --- a/src/main/java/org/htmlunit/javascript/host/file/Blob.java +++ b/src/main/java/org/htmlunit/javascript/host/file/Blob.java @@ -22,7 +22,6 @@ import java.nio.charset.Charset; import java.util.Locale; -import org.apache.commons.lang3.StringUtils; import org.htmlunit.BrowserVersion; import org.htmlunit.HttpHeader; import org.htmlunit.WebRequest; @@ -41,6 +40,7 @@ import org.htmlunit.javascript.host.ReadableStream; import org.htmlunit.util.KeyDataPair; import org.htmlunit.util.MimeType; +import org.htmlunit.util.StringUtils; /** * A JavaScript object for {@code Blob}. @@ -451,7 +451,7 @@ public void fillRequest(final WebRequest webRequest) { */ public KeyDataPair getKeyDataPair(final String name, final String fileName) { String contentType = getType(); - if (StringUtils.isEmpty(contentType)) { + if (StringUtils.isEmptyOrNull(contentType)) { contentType = MimeType.APPLICATION_OCTET_STREAM; } diff --git a/src/main/java/org/htmlunit/javascript/host/file/FileReader.java b/src/main/java/org/htmlunit/javascript/host/file/FileReader.java index a2de02792e1..e11654292d3 100644 --- a/src/main/java/org/htmlunit/javascript/host/file/FileReader.java +++ b/src/main/java/org/htmlunit/javascript/host/file/FileReader.java @@ -22,7 +22,6 @@ import java.util.Locale; import org.apache.commons.io.Charsets; -import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.htmlunit.corejs.javascript.Function; @@ -39,6 +38,7 @@ import org.htmlunit.javascript.host.event.EventTarget; import org.htmlunit.protocol.data.DataURLConnection; import org.htmlunit.util.MimeType; +import org.htmlunit.util.StringUtils; /** * A JavaScript object for {@code FileReader}. @@ -109,7 +109,7 @@ public void readAsDataURL(final Object object) throws IOException { final String value = new String(Base64.getEncoder().encode(bytes), StandardCharsets.US_ASCII); String contentType = ((Blob) object).getType(); - if (StringUtils.isEmpty(contentType)) { + if (StringUtils.isEmptyOrNull(contentType)) { contentType = MimeType.APPLICATION_OCTET_STREAM; } diff --git a/src/main/java/org/htmlunit/javascript/host/html/HTMLAnchorElement.java b/src/main/java/org/htmlunit/javascript/host/html/HTMLAnchorElement.java index d3e114430aa..05c287036fd 100644 --- a/src/main/java/org/htmlunit/javascript/host/html/HTMLAnchorElement.java +++ b/src/main/java/org/htmlunit/javascript/host/html/HTMLAnchorElement.java @@ -213,7 +213,7 @@ public void setRev(final String rel) { @JsxGetter public String getReferrerPolicy() { String attrib = getDomNodeOrDie().getAttribute("referrerPolicy"); - if (StringUtils.isEmpty(attrib)) { + if (org.htmlunit.util.StringUtils.isEmptyOrNull(attrib)) { return ""; } attrib = attrib.toLowerCase(Locale.ROOT); @@ -376,11 +376,11 @@ public String getHostname() { @JsxSetter public void setHostname(final String hostname) throws Exception { if (getBrowserVersion().hasFeature(JS_ANCHOR_HOSTNAME_IGNORE_BLANK)) { - if (!StringUtils.isBlank(hostname)) { + if (!org.htmlunit.util.StringUtils.isBlank(hostname)) { setUrl(UrlUtils.getUrlWithNewHost(getUrl(), hostname)); } } - else if (!StringUtils.isEmpty(hostname)) { + else if (!org.htmlunit.util.StringUtils.isEmptyOrNull(hostname)) { setUrl(UrlUtils.getUrlWithNewHost(getUrl(), hostname)); } } diff --git a/src/main/java/org/htmlunit/javascript/host/html/HTMLElement.java b/src/main/java/org/htmlunit/javascript/host/html/HTMLElement.java index 0860f72c79f..c66455c4787 100644 --- a/src/main/java/org/htmlunit/javascript/host/html/HTMLElement.java +++ b/src/main/java/org/htmlunit/javascript/host/html/HTMLElement.java @@ -446,7 +446,7 @@ public void setOuterText(final Object value) { final DomNode domNode = getDomNodeOrDie(); final SgmlPage page = domNode.getPage(); - if (StringUtils.isEmpty(valueString)) { + if (org.htmlunit.util.StringUtils.isEmptyOrNull(valueString)) { domNode.getParentNode().insertBefore(new DomText(page, ""), domNode); } else { diff --git a/src/main/java/org/htmlunit/javascript/host/intl/DateTimeFormat.java b/src/main/java/org/htmlunit/javascript/host/intl/DateTimeFormat.java index 5da304f8c20..e1a4e39cf92 100644 --- a/src/main/java/org/htmlunit/javascript/host/intl/DateTimeFormat.java +++ b/src/main/java/org/htmlunit/javascript/host/intl/DateTimeFormat.java @@ -27,7 +27,6 @@ import java.util.Map; import java.util.concurrent.ConcurrentHashMap; -import org.apache.commons.lang3.StringUtils; import org.htmlunit.BrowserVersion; import org.htmlunit.corejs.javascript.Context; import org.htmlunit.corejs.javascript.Function; @@ -40,6 +39,7 @@ import org.htmlunit.javascript.configuration.JsxConstructor; import org.htmlunit.javascript.configuration.JsxFunction; import org.htmlunit.javascript.host.Window; +import org.htmlunit.util.StringUtils; /** * A JavaScript object for {@code DateTimeFormat}. @@ -303,7 +303,7 @@ public Scriptable resolvedOptions() { final Scriptable options = cx.newObject(getParentScope()); options.put("timeZone", options, cx.getTimeZone().getID()); - if (StringUtils.isEmpty(formatter_.locale_)) { + if (StringUtils.isEmptyOrNull(formatter_.locale_)) { options.put("locale", options, cx.getLocale().toLanguageTag()); } else { diff --git a/src/main/java/org/htmlunit/javascript/host/worker/WorkerNavigator.java b/src/main/java/org/htmlunit/javascript/host/worker/WorkerNavigator.java index fab7f586674..a1e80565477 100644 --- a/src/main/java/org/htmlunit/javascript/host/worker/WorkerNavigator.java +++ b/src/main/java/org/htmlunit/javascript/host/worker/WorkerNavigator.java @@ -111,16 +111,16 @@ public String getLanguage() { @JsxGetter public Scriptable getLanguages() { final String acceptLang = getBrowserVersion().getAcceptLanguageHeader(); - if (StringUtils.isEmpty(acceptLang)) { + if (org.htmlunit.util.StringUtils.isEmptyOrNull(acceptLang)) { return JavaScriptEngine.newArray(this, 0); } final ArrayList res = new ArrayList<>(); final String[] parts = org.htmlunit.util.StringUtils.splitAtComma(acceptLang); for (final String part : parts) { - if (!StringUtils.isEmpty(part)) { + if (!org.htmlunit.util.StringUtils.isEmptyOrNull(part)) { final String lang = StringUtils.substringBefore(part, ";").trim(); - if (!StringUtils.isEmpty(part)) { + if (!org.htmlunit.util.StringUtils.isEmptyOrNull(part)) { res.add(lang); } } diff --git a/src/main/java/org/htmlunit/javascript/host/xml/FormData.java b/src/main/java/org/htmlunit/javascript/host/xml/FormData.java index b4fa70f5992..cc419148985 100644 --- a/src/main/java/org/htmlunit/javascript/host/xml/FormData.java +++ b/src/main/java/org/htmlunit/javascript/host/xml/FormData.java @@ -19,7 +19,6 @@ import java.util.Iterator; import java.util.List; -import org.apache.commons.lang3.StringUtils; import org.htmlunit.FormEncodingType; import org.htmlunit.WebRequest; import org.htmlunit.corejs.javascript.Context; @@ -37,6 +36,7 @@ import org.htmlunit.javascript.host.file.File; import org.htmlunit.javascript.host.html.HTMLFormElement; import org.htmlunit.util.NameValuePair; +import org.htmlunit.util.StringUtils; /** * A JavaScript object for {@code FormData}. @@ -186,7 +186,7 @@ public void append(final String name, final Object value, final Object filename) */ @JsxFunction(functionName = "delete") public void delete_js(final String name) { - if (StringUtils.isEmpty(name)) { + if (StringUtils.isEmptyOrNull(name)) { return; } @@ -199,7 +199,7 @@ public void delete_js(final String name) { */ @JsxFunction public String get(final String name) { - if (StringUtils.isEmpty(name)) { + if (StringUtils.isEmptyOrNull(name)) { return null; } @@ -217,7 +217,7 @@ public String get(final String name) { */ @JsxFunction public Scriptable getAll(final String name) { - if (StringUtils.isEmpty(name)) { + if (StringUtils.isEmptyOrNull(name)) { return JavaScriptEngine.newArray(this, 0); } @@ -238,7 +238,7 @@ public Scriptable getAll(final String name) { */ @JsxFunction public boolean has(final String name) { - if (StringUtils.isEmpty(name)) { + if (StringUtils.isEmptyOrNull(name)) { return false; } @@ -259,7 +259,7 @@ public boolean has(final String name) { */ @JsxFunction public void set(final String name, final Object value, final Object filename) { - if (StringUtils.isEmpty(name)) { + if (StringUtils.isEmptyOrNull(name)) { return; } diff --git a/src/main/java/org/htmlunit/javascript/host/xml/XMLDocument.java b/src/main/java/org/htmlunit/javascript/host/xml/XMLDocument.java index 9573ec766fd..c13fa5d1641 100644 --- a/src/main/java/org/htmlunit/javascript/host/xml/XMLDocument.java +++ b/src/main/java/org/htmlunit/javascript/host/xml/XMLDocument.java @@ -18,7 +18,6 @@ import java.io.Serializable; import java.util.function.Predicate; -import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.htmlunit.StringWebResponse; @@ -38,6 +37,7 @@ import org.htmlunit.javascript.host.dom.Document; import org.htmlunit.javascript.host.html.HTMLCollection; import org.htmlunit.svg.SvgElement; +import org.htmlunit.util.StringUtils; import org.htmlunit.xml.XmlPage; /** @@ -100,7 +100,7 @@ public XMLDocument(final WebWindow enclosingWindow) { public boolean loadXML(final String strXML) { final WebWindow webWindow = getWindow().getWebWindow(); try { - if (StringUtils.isEmpty(strXML)) { + if (StringUtils.isEmptyOrNull(strXML)) { throw new IOException("Error parsing XML '" + strXML + "'"); } diff --git a/src/main/java/org/htmlunit/javascript/host/xml/XMLHttpRequest.java b/src/main/java/org/htmlunit/javascript/host/xml/XMLHttpRequest.java index ea4690d29de..53ded08d9c4 100644 --- a/src/main/java/org/htmlunit/javascript/host/xml/XMLHttpRequest.java +++ b/src/main/java/org/htmlunit/javascript/host/xml/XMLHttpRequest.java @@ -388,7 +388,7 @@ else if (RESPONSE_TYPE_DOCUMENT.equals(responseType_)) { if (webResponse_ != null) { String contentType = webResponse_.getContentType(); - if (StringUtils.isEmpty(contentType)) { + if (org.htmlunit.util.StringUtils.isEmptyOrNull(contentType)) { contentType = MimeType.TEXT_XML; } return buildResponseXML(contentType); @@ -521,7 +521,7 @@ public Object getResponseXML() { } String contentType = webResponse_.getContentType(); - if (StringUtils.isEmpty(contentType)) { + if (org.htmlunit.util.StringUtils.isEmptyOrNull(contentType)) { contentType = MimeType.TEXT_XML; } diff --git a/src/main/java/org/htmlunit/platform/font/AwtFontUtil.java b/src/main/java/org/htmlunit/platform/font/AwtFontUtil.java index e46f93ccab1..63b48d13f4d 100644 --- a/src/main/java/org/htmlunit/platform/font/AwtFontUtil.java +++ b/src/main/java/org/htmlunit/platform/font/AwtFontUtil.java @@ -36,7 +36,7 @@ public int countLines(final String content, final int pixelWidth, final String f final int fontSizeInt = CssPixelValueConverter.pixelValue(fontSize); final FontRenderContext fontRenderCtx = new FontRenderContext(null, false, true); for (final String line : lines) { - if (StringUtils.isBlank(line)) { + if (org.htmlunit.util.StringUtils.isBlank(line)) { lineCount++; } else { diff --git a/src/main/java/org/htmlunit/util/EncodingSniffer.java b/src/main/java/org/htmlunit/util/EncodingSniffer.java index 1e4047d34e7..1953505db73 100644 --- a/src/main/java/org/htmlunit/util/EncodingSniffer.java +++ b/src/main/java/org/htmlunit/util/EncodingSniffer.java @@ -31,7 +31,6 @@ import org.apache.commons.io.ByteOrderMark; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.ArrayUtils; -import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.htmlunit.HttpHeader; @@ -712,7 +711,7 @@ int getUpdatedIndex() { * @return the normalized encoding name or null if not found */ public static String translateEncodingLabel(final String encodingLabel) { - if (StringUtils.isEmpty(encodingLabel)) { + if (StringUtils.isEmptyOrNull(encodingLabel)) { return null; } diff --git a/src/main/java/org/htmlunit/util/HeaderUtils.java b/src/main/java/org/htmlunit/util/HeaderUtils.java index 7f1a4103700..9d8ac848441 100644 --- a/src/main/java/org/htmlunit/util/HeaderUtils.java +++ b/src/main/java/org/htmlunit/util/HeaderUtils.java @@ -17,7 +17,6 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.apache.commons.lang3.Strings; import org.htmlunit.HttpHeader; import org.htmlunit.WebResponse; @@ -110,10 +109,10 @@ public static boolean containsMaxAge(final WebResponse response) { */ public static boolean containsMaxAgeOrSMaxage(final WebResponse response) { final String cacheControl = response.getResponseHeaderValue(HttpHeader.CACHE_CONTROL); - if (Strings.CI.contains(cacheControl, CACHE_CONTROL_MAX_AGE)) { + if (StringUtils.containsIgnoreCase(cacheControl, CACHE_CONTROL_MAX_AGE)) { return true; } - return Strings.CI.contains(cacheControl, CACHE_CONTROL_S_MAXAGE); + return StringUtils.containsIgnoreCase(cacheControl, CACHE_CONTROL_S_MAXAGE); } /** @@ -153,6 +152,6 @@ private static long directiveValue(final WebResponse response, final Pattern pat private static boolean containsCacheControlValue(final WebResponse response, final String value) { final String cacheControl = response.getResponseHeaderValue(HttpHeader.CACHE_CONTROL); - return Strings.CI.contains(cacheControl, value); + return StringUtils.containsIgnoreCase(cacheControl, value); } } diff --git a/src/main/java/org/htmlunit/util/StringUtils.java b/src/main/java/org/htmlunit/util/StringUtils.java index f75b9cc2ff8..f6ce4f39357 100644 --- a/src/main/java/org/htmlunit/util/StringUtils.java +++ b/src/main/java/org/htmlunit/util/StringUtils.java @@ -70,6 +70,77 @@ public static boolean isEmptyString(final CharSequence s) { return s != null && s.length() == 0; } + /** + * Returns true if the param is null or empty. + * + * @param s the string to check + * @return true if the param is null or empty + */ + public static boolean isEmptyOrNull(final CharSequence s) { + return s == null || s.length() == 0; + } + + /** + * Returns either the passed in CharSequence, or if the CharSequence is + * empty or {@code null}, the default value. + * + * @param the kind of CharSequence + * @param s the CharSequence to check + * @param defaultString the default to return if the input is empty or null + * @return the passed in CharSequence, or the defaultString + */ + public static T defaultIfEmptyOrNull(final T s, final T defaultString) { + return isEmptyOrNull(s) ? defaultString : s; + } + + /** + * Tests if a CharSequence is null, empty, or contains only whitespace. + * + * @param s the CharSequence to check + * @return true if a CharSequence is null, empty, or contains only whitespace + */ + public static boolean isBlank(final CharSequence s) { + if (s == null) { + return true; + } + + final int length = s.length(); + if (length == 0) { + return true; + } + + for (int i = 0; i < length; i++) { + if (!Character.isWhitespace(s.charAt(i))) { + return false; + } + } + return true; + } + + /** + * Tests if a CharSequence is NOT null, empty, or contains only whitespace. + * + * @param s the CharSequence to check + * @return false if a CharSequence is null, empty, or contains only whitespace + */ + public static boolean isNotBlank(final CharSequence s) { + if (s == null) { + return false; + } + + final int length = s.length(); + if (length == 0) { + return false; + } + + for (int i = 0; i < length; i++) { + if (!Character.isWhitespace(s.charAt(i))) { + return true; + } + } + return false; + } + /** * @param expected the char that we expect * @param s the string to check @@ -80,8 +151,10 @@ public static boolean equalsChar(final char expected, final CharSequence s) { } /** + * Tests if a CharSequence starts with a specified prefix. + * * @param s the string to check - * @param expectedStart the string that we expect at the beginning + * @param expectedStart the string that we expect at the beginning (has to be not null and not empty) * @return true if the provided string has only one char and this matches the expectation */ public static boolean startsWithIgnoreCase(final String s, final String expectedStart) { @@ -99,6 +172,66 @@ public static boolean startsWithIgnoreCase(final String s, final String expected return s.regionMatches(true, 0, expectedStart, 0, expectedStart.length()); } + /** + * Tests if a CharSequence ends with a specified prefix. + * + * @param s the string to check + * @param expectedEnd the string that we expect at the end (has to be not null and not empty) + * @return true if the provided string has only one char and this matches the expectation + */ + public static boolean endsWithIgnoreCase(final String s, final String expectedEnd) { + if (expectedEnd == null) { + throw new IllegalArgumentException("Expected end string can't be null or empty"); + } + + final int expectedEndLength = expectedEnd.length(); + if (expectedEndLength == 0) { + throw new IllegalArgumentException("Expected end string can't be null or empty"); + } + + if (s == null) { + return false; + } + if (s == expectedEnd) { + return true; + } + + return s.regionMatches(true, s.length() - expectedEndLength, expectedEnd, 0, expectedEndLength); + } + + /** + * Tests if a CharSequence ends with a specified prefix. + * + * @param s the string to check + * @param expected the string that we expect to be a substring (has to be not null and not empty) + * @return true if the provided string has only one char and this matches the expectation + */ + public static boolean containsIgnoreCase(final String s, final String expected) { + if (expected == null) { + throw new IllegalArgumentException("Expected string can't be null or empty"); + } + + final int expectedLength = expected.length(); + if (expectedLength == 0) { + throw new IllegalArgumentException("Expected string can't be null or empty"); + } + + if (s == null) { + return false; + } + if (s == expected) { + return true; + } + + final int max = s.length() - expectedLength; + for (int i = 0; i <= max; i++) { + if (s.regionMatches(true, i, expected, 0, expectedLength)) { + return true; + } + } + return false; + } + /** * Escapes the characters '<', '>' and '&' into their XML entity equivalents. * @@ -625,7 +758,7 @@ public static String[] splitAtComma(final String str) { * Splits the provided text into an array, using comma or blank as the * separator. * - * @param str the String to parse, may be null + * @param str the String to parse, may be null * @return an array of parsed Strings, an empty array if null String input */ public static String[] splitAtCommaOrBlank(final String str) { diff --git a/src/main/java/org/htmlunit/util/UrlUtils.java b/src/main/java/org/htmlunit/util/UrlUtils.java index ae43d1c6804..8d99ad1b271 100644 --- a/src/main/java/org/htmlunit/util/UrlUtils.java +++ b/src/main/java/org/htmlunit/util/UrlUtils.java @@ -236,7 +236,7 @@ public static URL toUrlUnsafe(final String url) throws MalformedURLException { if (protocol.isEmpty() || UrlUtils.isNormalUrlProtocol(protocol)) { final URL response = new URL(url); if (response.getProtocol().startsWith("http") - && org.apache.commons.lang3.StringUtils.isEmpty(response.getHost())) { + && StringUtils.isEmptyOrNull(response.getHost())) { throw new MalformedURLException("Missing host name in url: " + url); } return response; @@ -247,7 +247,7 @@ public static URL toUrlUnsafe(final String url) throws MalformedURLException { } if (ABOUT.equals(protocol)) { - if (org.apache.commons.lang3.Strings.CI.equals(ABOUT_BLANK, url)) { + if (ABOUT_BLANK.equalsIgnoreCase(url)) { return URL_ABOUT_BLANK; } return new URL(null, url, ABOUT_HANDLER); @@ -536,7 +536,7 @@ public static URL getUrlWithProtocolAndAuthority(final URL u) throws MalformedUR public static URL getUrlWithNewUserName(final URL u, final String newUserName) throws MalformedURLException { String newUserInfo = newUserName == null ? "" : newUserName; final String userInfo = u.getUserInfo(); - if (org.apache.commons.lang3.StringUtils.isNotBlank(userInfo)) { + if (StringUtils.isNotBlank(userInfo)) { final int colonIdx = userInfo.indexOf(':'); if (colonIdx > -1) { newUserInfo = newUserInfo + userInfo.substring(colonIdx); @@ -557,7 +557,7 @@ public static URL getUrlWithNewUserPassword(final URL u, final String newUserPas throws MalformedURLException { String newUserInfo = newUserPassword == null ? "" : ':' + newUserPassword; final String userInfo = u.getUserInfo(); - if (org.apache.commons.lang3.StringUtils.isNotBlank(userInfo)) { + if (StringUtils.isNotBlank(userInfo)) { final int colonIdx = userInfo.indexOf(':'); if (colonIdx > -1) { newUserInfo = userInfo.substring(0, colonIdx) + newUserInfo; diff --git a/src/main/java/org/htmlunit/util/brotli/BitReader.java b/src/main/java/org/htmlunit/util/brotli/BitReader.java new file mode 100644 index 00000000000..3f3e70b80c0 --- /dev/null +++ b/src/main/java/org/htmlunit/util/brotli/BitReader.java @@ -0,0 +1,312 @@ +/* Copyright 2015 Google Inc. All Rights Reserved. + + Distributed under MIT license. + See file LICENSE for detail or copy at https://opensource.org/licenses/MIT +*/ + +package org.htmlunit.util.brotli; + +import static org.htmlunit.util.brotli.BrotliError.BROTLI_ERROR; +import static org.htmlunit.util.brotli.BrotliError.BROTLI_ERROR_CORRUPTED_PADDING_BITS; +import static org.htmlunit.util.brotli.BrotliError.BROTLI_ERROR_READ_AFTER_END; +import static org.htmlunit.util.brotli.BrotliError.BROTLI_ERROR_TRUNCATED_INPUT; +import static org.htmlunit.util.brotli.BrotliError.BROTLI_ERROR_UNUSED_BYTES_AFTER_END; +import static org.htmlunit.util.brotli.BrotliError.BROTLI_OK; +import static org.htmlunit.util.brotli.BrotliError.BROTLI_PANIC_UNALIGNED_COPY_BYTES; + +/** + * Bit reading helpers. + */ +final class BitReader { + + // Possible values: {5, 6}. 5 corresponds to 32-bit build, 6 to 64-bit. This value is used for + // JIT conditional compilation. + private static final int LOG_BITNESS = Utils.getLogBintness(); + + // Not only Java compiler prunes "if (const false)" code, but JVM as well. + // Code under "if (BIT_READER_DEBUG != 0)" have zero performance impact (outside unit tests). + private static final int BIT_READER_DEBUG = Utils.isDebugMode(); + + static final int BITNESS = 1 << LOG_BITNESS; + + private static final int BYTENESS = BITNESS / 8; + private static final int CAPACITY = 4096; + // After encountering the end of the input stream, this amount of zero bytes will be appended. + private static final int SLACK = 64; + private static final int BUFFER_SIZE = CAPACITY + SLACK; + // Don't bother to replenish the buffer while this number of bytes is available. + private static final int SAFEGUARD = 36; + private static final int WATERLINE = CAPACITY - SAFEGUARD; + + // "Half" refers to "half of native integer type", i.e. on 64-bit machines it is 32-bit type, + // on 32-bit machines it is 16-bit. + private static final int HALF_BITNESS = BITNESS / 2; + private static final int HALF_SIZE = BYTENESS / 2; + private static final int HALVES_CAPACITY = CAPACITY / HALF_SIZE; + private static final int HALF_BUFFER_SIZE = BUFFER_SIZE / HALF_SIZE; + + private static final int LOG_HALF_SIZE = LOG_BITNESS - 4; + + static final int HALF_WATERLINE = WATERLINE / HALF_SIZE; + + /** + * Fills up the input buffer. + * + *

Should not be called if there are at least 36 bytes present after current position. + * + *

After encountering the end of the input stream, 64 additional zero bytes are copied to the + * buffer. + */ + static int readMoreInput(State s) { + if (s.endOfStreamReached != 0) { + if (halfAvailable(s) >= -2) { + return BROTLI_OK; + } + return Utils.makeError(s, BROTLI_ERROR_TRUNCATED_INPUT); + } + final int readOffset = s.halfOffset << LOG_HALF_SIZE; + int bytesInBuffer = CAPACITY - readOffset; + // Move unused bytes to the head of the buffer. + Utils.copyBytesWithin(s.byteBuffer, 0, readOffset, CAPACITY); + s.halfOffset = 0; + while (bytesInBuffer < CAPACITY) { + final int spaceLeft = CAPACITY - bytesInBuffer; + final int len = Utils.readInput(s, s.byteBuffer, bytesInBuffer, spaceLeft); + // EOF is -1 in Java, but 0 in C#. + if (len < BROTLI_ERROR) { + return len; + } + if (len <= 0) { + s.endOfStreamReached = 1; + s.tailBytes = bytesInBuffer; + bytesInBuffer += HALF_SIZE - 1; + break; + } + bytesInBuffer += len; + } + bytesToNibbles(s, bytesInBuffer); + return BROTLI_OK; + } + + static int checkHealth(State s, int endOfStream) { + if (s.endOfStreamReached == 0) { + return BROTLI_OK; + } + final int byteOffset = (s.halfOffset << LOG_HALF_SIZE) + ((s.bitOffset + 7) >> 3) - BYTENESS; + if (byteOffset > s.tailBytes) { + return Utils.makeError(s, BROTLI_ERROR_READ_AFTER_END); + } + if ((endOfStream != 0) && (byteOffset != s.tailBytes)) { + return Utils.makeError(s, BROTLI_ERROR_UNUSED_BYTES_AFTER_END); + } + return BROTLI_OK; + } + + static void assertAccumulatorHealthy(State s) { + if (s.bitOffset > BITNESS) { + throw new IllegalStateException("Accumulator underloaded: " + s.bitOffset); + } + } + + static void fillBitWindow(State s) { + if (BIT_READER_DEBUG != 0) { + assertAccumulatorHealthy(s); + } + if (s.bitOffset >= HALF_BITNESS) { + // Same as doFillBitWindow. JVM fails to inline it. + if (BITNESS == 64) { + s.accumulator64 = ((long) s.intBuffer[s.halfOffset++] << HALF_BITNESS) + | Utils.shr64(s.accumulator64, HALF_BITNESS); + } else { + s.accumulator32 = (s.shortBuffer[s.halfOffset++] << HALF_BITNESS) + | Utils.shr32(s.accumulator32, HALF_BITNESS); + } + s.bitOffset -= HALF_BITNESS; + } + } + + static void doFillBitWindow(State s) { + if (BIT_READER_DEBUG != 0) { + assertAccumulatorHealthy(s); + } + if (BITNESS == 64) { + s.accumulator64 = ((long) s.intBuffer[s.halfOffset++] << HALF_BITNESS) + | Utils.shr64(s.accumulator64, HALF_BITNESS); + } else { + s.accumulator32 = (s.shortBuffer[s.halfOffset++] << HALF_BITNESS) + | Utils.shr32(s.accumulator32, HALF_BITNESS); + } + s.bitOffset -= HALF_BITNESS; + } + + static int peekBits(State s) { + if (BITNESS == 64) { + return (int) Utils.shr64(s.accumulator64, s.bitOffset); + } + return Utils.shr32(s.accumulator32, s.bitOffset); + } + + /** + * Fetches bits from accumulator. + * + * WARNING: accumulator MUST contain at least the specified amount of bits, + * otherwise BitReader will become broken. + */ + static int readFewBits(State s, int n) { + final int v = peekBits(s) & ((1 << n) - 1); + s.bitOffset += n; + return v; + } + + static int readBits(State s, int n) { + if (HALF_BITNESS >= 24) { + return readFewBits(s, n); + } + return (n <= 16) ? readFewBits(s, n) : readManyBits(s, n); + } + + private static int readManyBits(State s, int n) { + final int low = readFewBits(s, 16); + doFillBitWindow(s); + return low | (readFewBits(s, n - 16) << 16); + } + + static int initBitReader(State s) { + s.byteBuffer = new byte[BUFFER_SIZE]; + if (BITNESS == 64) { + s.accumulator64 = 0; + s.intBuffer = new int[HALF_BUFFER_SIZE]; + } else { + s.accumulator32 = 0; + s.shortBuffer = new short[HALF_BUFFER_SIZE]; + } + s.bitOffset = BITNESS; + s.halfOffset = HALVES_CAPACITY; + s.endOfStreamReached = 0; + return prepare(s); + } + + private static int prepare(State s) { + if (s.halfOffset > BitReader.HALF_WATERLINE) { + final int result = readMoreInput(s); + if (result != BROTLI_OK) { + return result; + } + } + int health = checkHealth(s, 0); + if (health != BROTLI_OK) { + return health; + } + doFillBitWindow(s); + doFillBitWindow(s); + return BROTLI_OK; + } + + static int reload(State s) { + if (s.bitOffset == BITNESS) { + return prepare(s); + } + return BROTLI_OK; + } + + static int jumpToByteBoundary(State s) { + final int padding = (BITNESS - s.bitOffset) & 7; + if (padding != 0) { + final int paddingBits = readFewBits(s, padding); + if (paddingBits != 0) { + return Utils.makeError(s, BROTLI_ERROR_CORRUPTED_PADDING_BITS); + } + } + return BROTLI_OK; + } + + static int halfAvailable(State s) { + int limit = HALVES_CAPACITY; + if (s.endOfStreamReached != 0) { + limit = (s.tailBytes + (HALF_SIZE - 1)) >> LOG_HALF_SIZE; + } + return limit - s.halfOffset; + } + + static int copyRawBytes(State s, byte[] data, int offset, int length) { + int pos = offset; + int len = length; + if ((s.bitOffset & 7) != 0) { + return Utils.makeError(s, BROTLI_PANIC_UNALIGNED_COPY_BYTES); + } + + // Drain accumulator. + while ((s.bitOffset != BITNESS) && (len != 0)) { + data[pos++] = (byte) peekBits(s); + s.bitOffset += 8; + len--; + } + if (len == 0) { + return BROTLI_OK; + } + + // Get data from shadow buffer with "sizeof(int)" granularity. + final int copyNibbles = Utils.min(halfAvailable(s), len >> LOG_HALF_SIZE); + if (copyNibbles > 0) { + final int readOffset = s.halfOffset << LOG_HALF_SIZE; + final int delta = copyNibbles << LOG_HALF_SIZE; + Utils.copyBytes(data, pos, s.byteBuffer, readOffset, readOffset + delta); + pos += delta; + len -= delta; + s.halfOffset += copyNibbles; + } + if (len == 0) { + return BROTLI_OK; + } + + // Read tail bytes. + if (halfAvailable(s) > 0) { + // length = 1..3 + fillBitWindow(s); + while (len != 0) { + data[pos++] = (byte) peekBits(s); + s.bitOffset += 8; + len--; + } + return checkHealth(s, 0); + } + + // Now it is possible to copy bytes directly. + while (len > 0) { + final int chunkLen = Utils.readInput(s, data, pos, len); + // EOF is -1 in Java, but 0 in C#. + if (len < BROTLI_ERROR) { + return len; + } + if (chunkLen <= 0) { + return Utils.makeError(s, BROTLI_ERROR_TRUNCATED_INPUT); + } + pos += chunkLen; + len -= chunkLen; + } + return BROTLI_OK; + } + + /** + * Translates bytes to halves (int/short). + */ + static void bytesToNibbles(State s, int byteLen) { + final byte[] byteBuffer = s.byteBuffer; + final int halfLen = byteLen >> LOG_HALF_SIZE; + if (BITNESS == 64) { + final int[] intBuffer = s.intBuffer; + for (int i = 0; i < halfLen; ++i) { + intBuffer[i] = (byteBuffer[i * 4] & 0xFF) + | ((byteBuffer[(i * 4) + 1] & 0xFF) << 8) + | ((byteBuffer[(i * 4) + 2] & 0xFF) << 16) + | ((byteBuffer[(i * 4) + 3] & 0xFF) << 24); + } + } else { + final short[] shortBuffer = s.shortBuffer; + for (int i = 0; i < halfLen; ++i) { + shortBuffer[i] = (short) ((byteBuffer[i * 2] & 0xFF) + | ((byteBuffer[(i * 2) + 1] & 0xFF) << 8)); + } + } + } +} diff --git a/src/main/java/org/htmlunit/util/brotli/BrotliError.java b/src/main/java/org/htmlunit/util/brotli/BrotliError.java new file mode 100644 index 00000000000..7ca9342202f --- /dev/null +++ b/src/main/java/org/htmlunit/util/brotli/BrotliError.java @@ -0,0 +1,47 @@ +/* Copyright 2025 Google Inc. All Rights Reserved. + + Distributed under MIT license. + See file LICENSE for detail or copy at https://opensource.org/licenses/MIT +*/ + +package org.htmlunit.util.brotli; + +/** + * Possible errors from decoder. + */ +public class BrotliError { + public static final int BROTLI_OK = 0; + public static final int BROTLI_OK_DONE = BROTLI_OK + 1; + public static final int BROTLI_OK_NEED_MORE_OUTPUT = BROTLI_OK + 2; + + // It is important that actual error codes are LESS than -1! + public static final int BROTLI_ERROR = -1; + public static final int BROTLI_ERROR_CORRUPTED_CODE_LENGTH_TABLE = BROTLI_ERROR - 1; + public static final int BROTLI_ERROR_CORRUPTED_CONTEXT_MAP = BROTLI_ERROR - 2; + public static final int BROTLI_ERROR_CORRUPTED_HUFFMAN_CODE_HISTOGRAM = BROTLI_ERROR - 3; + public static final int BROTLI_ERROR_CORRUPTED_PADDING_BITS = BROTLI_ERROR - 4; + public static final int BROTLI_ERROR_CORRUPTED_RESERVED_BIT = BROTLI_ERROR - 5; + public static final int BROTLI_ERROR_DUPLICATE_SIMPLE_HUFFMAN_SYMBOL = BROTLI_ERROR - 6; + public static final int BROTLI_ERROR_EXUBERANT_NIBBLE = BROTLI_ERROR - 7; + public static final int BROTLI_ERROR_INVALID_BACKWARD_REFERENCE = BROTLI_ERROR - 8; + public static final int BROTLI_ERROR_INVALID_METABLOCK_LENGTH = BROTLI_ERROR - 9; + public static final int BROTLI_ERROR_INVALID_WINDOW_BITS = BROTLI_ERROR - 10; + public static final int BROTLI_ERROR_NEGATIVE_DISTANCE = BROTLI_ERROR - 11; + public static final int BROTLI_ERROR_READ_AFTER_END = BROTLI_ERROR - 12; + public static final int BROTLI_ERROR_READ_FAILED = BROTLI_ERROR - 13; + public static final int BROTLI_ERROR_SYMBOL_OUT_OF_RANGE = BROTLI_ERROR - 14; + public static final int BROTLI_ERROR_TRUNCATED_INPUT = BROTLI_ERROR - 15; + public static final int BROTLI_ERROR_UNUSED_BYTES_AFTER_END = BROTLI_ERROR - 16; + public static final int BROTLI_ERROR_UNUSED_HUFFMAN_SPACE = BROTLI_ERROR - 17; + + public static final int BROTLI_PANIC = -21; + public static final int BROTLI_PANIC_ALREADY_CLOSED = BROTLI_PANIC - 1; + public static final int BROTLI_PANIC_MAX_DISTANCE_TOO_SMALL = BROTLI_PANIC - 2; + public static final int BROTLI_PANIC_STATE_NOT_FRESH = BROTLI_PANIC - 3; + public static final int BROTLI_PANIC_STATE_NOT_INITIALIZED = BROTLI_PANIC - 4; + public static final int BROTLI_PANIC_STATE_NOT_UNINITIALIZED = BROTLI_PANIC - 5; + public static final int BROTLI_PANIC_TOO_MANY_DICTIONARY_CHUNKS = BROTLI_PANIC - 6; + public static final int BROTLI_PANIC_UNEXPECTED_STATE = BROTLI_PANIC - 7; + public static final int BROTLI_PANIC_UNREACHABLE = BROTLI_PANIC - 8; + public static final int BROTLI_PANIC_UNALIGNED_COPY_BYTES = BROTLI_PANIC - 9; +} diff --git a/src/main/java/org/htmlunit/util/brotli/BrotliInputStream.java b/src/main/java/org/htmlunit/util/brotli/BrotliInputStream.java new file mode 100644 index 00000000000..cbe28bfddf5 --- /dev/null +++ b/src/main/java/org/htmlunit/util/brotli/BrotliInputStream.java @@ -0,0 +1,174 @@ +/* Copyright 2015 Google Inc. All Rights Reserved. + + Distributed under MIT license. + See file LICENSE for detail or copy at https://opensource.org/licenses/MIT +*/ + +package org.htmlunit.util.brotli; + +import java.io.IOException; +import java.io.InputStream; + +/** + * {@link InputStream} decorator that decompresses brotli data. + * + *

Not thread-safe. + */ +public class BrotliInputStream extends InputStream { + + public static final int DEFAULT_INTERNAL_BUFFER_SIZE = 256; + + /** + * Value expected by InputStream contract when stream is over. + * + * In Java it is -1. + * In C# it is 0 (should be patched during transpilation). + */ + private static final int END_OF_STREAM_MARKER = -1; + + /** + * Internal buffer used for efficient byte-by-byte reading. + */ + private byte[] buffer; + + /** + * Number of decoded but still unused bytes in internal buffer. + */ + private int remainingBufferBytes; + + /** + * Next unused byte offset. + */ + private int bufferOffset; + + /** + * Decoder state. + */ + private final State state = new State(); + + /** + * Creates a {@link InputStream} wrapper that decompresses brotli data. + * + *

For byte-by-byte reading ({@link #read()}) internal buffer with + * {@link #DEFAULT_INTERNAL_BUFFER_SIZE} size is allocated and used. + * + *

Will block the thread until first {@link BitReader#CAPACITY} bytes of data of source + * are available. + * + * @param source underlying data source + * @throws IOException in case of corrupted data or source stream problems + */ + public BrotliInputStream(InputStream source) throws IOException { + this(source, DEFAULT_INTERNAL_BUFFER_SIZE); + } + + /** + * Creates a {@link InputStream} wrapper that decompresses brotli data. + * + *

For byte-by-byte reading ({@link #read()}) internal buffer of specified size is + * allocated and used. + * + *

Will block the thread until first {@link BitReader#CAPACITY} bytes of data of source + * are available. + * + * @param source compressed data source + * @param byteReadBufferSize size of internal buffer used in case of + * byte-by-byte reading + * @throws IOException in case of corrupted data or source stream problems + */ + public BrotliInputStream(InputStream source, int byteReadBufferSize) throws IOException { + if (byteReadBufferSize <= 0) { + throw new IllegalArgumentException("Bad buffer size:" + byteReadBufferSize); + } else if (source == null) { + throw new IllegalArgumentException("source is null"); + } + this.buffer = new byte[byteReadBufferSize]; + this.remainingBufferBytes = 0; + this.bufferOffset = 0; + try { + state.input = source; + Decode.initState(state); + } catch (BrotliRuntimeException ex) { + throw new IOException("Brotli decoder initialization failed", ex); + } + } + + public void attachDictionaryChunk(byte[] data) { + Decode.attachDictionaryChunk(state, data); + } + + public void enableEagerOutput() { + Decode.enableEagerOutput(state); + } + + public void enableLargeWindow() { + Decode.enableLargeWindow(state); + } + + /** + * {@inheritDoc} + */ + @Override + public void close() throws IOException { + Decode.close(state); + Utils.closeInput(state); + } + + /** + * {@inheritDoc} + */ + @Override + public int read() throws IOException { + if (bufferOffset >= remainingBufferBytes) { + remainingBufferBytes = read(buffer, 0, buffer.length); + bufferOffset = 0; + if (remainingBufferBytes == END_OF_STREAM_MARKER) { + // Both Java and C# return the same value for EOF on single-byte read. + return -1; + } + } + return buffer[bufferOffset++] & 0xFF; + } + + /** + * {@inheritDoc} + */ + @Override + public int read(byte[] destBuffer, int destOffset, int destLen) throws IOException { + if (destOffset < 0) { + throw new IllegalArgumentException("Bad offset: " + destOffset); + } else if (destLen < 0) { + throw new IllegalArgumentException("Bad length: " + destLen); + } else if (destOffset + destLen > destBuffer.length) { + throw new IllegalArgumentException( + "Buffer overflow: " + (destOffset + destLen) + " > " + destBuffer.length); + } else if (destLen == 0) { + return 0; + } + int copyLen = Math.max(remainingBufferBytes - bufferOffset, 0); + if (copyLen != 0) { + copyLen = Math.min(copyLen, destLen); + System.arraycopy(buffer, bufferOffset, destBuffer, destOffset, copyLen); + bufferOffset += copyLen; + destOffset += copyLen; + destLen -= copyLen; + if (destLen == 0) { + return copyLen; + } + } + try { + state.output = destBuffer; + state.outputOffset = destOffset; + state.outputLength = destLen; + state.outputUsed = 0; + Decode.decompress(state); + copyLen += state.outputUsed; + copyLen = (copyLen > 0) ? copyLen : END_OF_STREAM_MARKER; + return copyLen; + } catch (BrotliRuntimeException ex) { + throw new IOException("Brotli stream decoding failed", ex); + } + + // <{[INJECTED CODE]}> + } +} diff --git a/src/main/java/org/htmlunit/util/brotli/BrotliRuntimeException.java b/src/main/java/org/htmlunit/util/brotli/BrotliRuntimeException.java new file mode 100644 index 00000000000..5078c5da342 --- /dev/null +++ b/src/main/java/org/htmlunit/util/brotli/BrotliRuntimeException.java @@ -0,0 +1,21 @@ +/* Copyright 2015 Google Inc. All Rights Reserved. + + Distributed under MIT license. + See file LICENSE for detail or copy at https://opensource.org/licenses/MIT +*/ + +package org.htmlunit.util.brotli; + +/** + * Unchecked exception used internally. + */ +class BrotliRuntimeException extends RuntimeException { + + BrotliRuntimeException(String message) { + super(message); + } + + BrotliRuntimeException(String message, Throwable cause) { + super(message, cause); + } +} diff --git a/src/main/java/org/htmlunit/util/brotli/Context.java b/src/main/java/org/htmlunit/util/brotli/Context.java new file mode 100644 index 00000000000..73f2365e5c9 --- /dev/null +++ b/src/main/java/org/htmlunit/util/brotli/Context.java @@ -0,0 +1,58 @@ +/* Copyright 2015 Google Inc. All Rights Reserved. + + Distributed under MIT license. + See file LICENSE for detail or copy at https://opensource.org/licenses/MIT +*/ + +package org.htmlunit.util.brotli; + +/** + * Common context lookup table for all context modes. + */ +final class Context { + + static final int[] LOOKUP = new int[2048]; + + private static final String UTF_MAP = " !! ! \"#$##%#$&'##(#)#+++++++++" + + "+((&*'##,---,---,-----,-----,-----&#'###.///.///./////./////./////&#'# "; + private static final String UTF_RLE = "A/* ': & : $ \u0081 @"; + + private static void unpackLookupTable(int[] lookup, String utfMap, String utfRle) { + // LSB6, MSB6, SIGNED + for (int i = 0; i < 256; ++i) { + lookup[i] = i & 0x3F; + lookup[512 + i] = i >> 2; + lookup[1792 + i] = 2 + (i >> 6); + } + // UTF8 + for (int i = 0; i < 128; ++i) { + lookup[1024 + i] = 4 * (utfMap.charAt(i) - 32); + } + for (int i = 0; i < 64; ++i) { + lookup[1152 + i] = i & 1; + lookup[1216 + i] = 2 + (i & 1); + } + int offset = 1280; + for (int k = 0; k < 19; ++k) { + final int value = k & 3; + final int rep = utfRle.charAt(k) - 32; + for (int i = 0; i < rep; ++i) { + lookup[offset++] = value; + } + } + // SIGNED + for (int i = 0; i < 16; ++i) { + lookup[1792 + i] = 1; + lookup[2032 + i] = 6; + } + lookup[1792] = 0; + lookup[2047] = 7; + for (int i = 0; i < 256; ++i) { + lookup[1536 + i] = lookup[1792 + i] << 3; + } + } + + static { + unpackLookupTable(LOOKUP, UTF_MAP, UTF_RLE); + } +} diff --git a/src/main/java/org/htmlunit/util/brotli/Decode.java b/src/main/java/org/htmlunit/util/brotli/Decode.java new file mode 100644 index 00000000000..50e1cd87395 --- /dev/null +++ b/src/main/java/org/htmlunit/util/brotli/Decode.java @@ -0,0 +1,1574 @@ +/* Copyright 2015 Google Inc. All Rights Reserved. + + Distributed under MIT license. + See file LICENSE for detail or copy at https://opensource.org/licenses/MIT +*/ + +package org.htmlunit.util.brotli; + +import static org.htmlunit.util.brotli.BrotliError.BROTLI_ERROR_CORRUPTED_CODE_LENGTH_TABLE; +import static org.htmlunit.util.brotli.BrotliError.BROTLI_ERROR_CORRUPTED_CONTEXT_MAP; +import static org.htmlunit.util.brotli.BrotliError.BROTLI_ERROR_CORRUPTED_HUFFMAN_CODE_HISTOGRAM; +import static org.htmlunit.util.brotli.BrotliError.BROTLI_ERROR_CORRUPTED_RESERVED_BIT; +import static org.htmlunit.util.brotli.BrotliError.BROTLI_ERROR_DUPLICATE_SIMPLE_HUFFMAN_SYMBOL; +import static org.htmlunit.util.brotli.BrotliError.BROTLI_ERROR_EXUBERANT_NIBBLE; +import static org.htmlunit.util.brotli.BrotliError.BROTLI_ERROR_INVALID_BACKWARD_REFERENCE; +import static org.htmlunit.util.brotli.BrotliError.BROTLI_ERROR_INVALID_METABLOCK_LENGTH; +import static org.htmlunit.util.brotli.BrotliError.BROTLI_ERROR_INVALID_WINDOW_BITS; +import static org.htmlunit.util.brotli.BrotliError.BROTLI_ERROR_NEGATIVE_DISTANCE; +import static org.htmlunit.util.brotli.BrotliError.BROTLI_ERROR_SYMBOL_OUT_OF_RANGE; +import static org.htmlunit.util.brotli.BrotliError.BROTLI_ERROR_UNUSED_HUFFMAN_SPACE; +import static org.htmlunit.util.brotli.BrotliError.BROTLI_OK; +import static org.htmlunit.util.brotli.BrotliError.BROTLI_OK_DONE; +import static org.htmlunit.util.brotli.BrotliError.BROTLI_OK_NEED_MORE_OUTPUT; +import static org.htmlunit.util.brotli.BrotliError.BROTLI_PANIC_ALREADY_CLOSED; +import static org.htmlunit.util.brotli.BrotliError.BROTLI_PANIC_MAX_DISTANCE_TOO_SMALL; +import static org.htmlunit.util.brotli.BrotliError.BROTLI_PANIC_STATE_NOT_FRESH; +import static org.htmlunit.util.brotli.BrotliError.BROTLI_PANIC_STATE_NOT_INITIALIZED; +import static org.htmlunit.util.brotli.BrotliError.BROTLI_PANIC_STATE_NOT_UNINITIALIZED; +import static org.htmlunit.util.brotli.BrotliError.BROTLI_PANIC_TOO_MANY_DICTIONARY_CHUNKS; +import static org.htmlunit.util.brotli.BrotliError.BROTLI_PANIC_UNEXPECTED_STATE; +import static org.htmlunit.util.brotli.BrotliError.BROTLI_PANIC_UNREACHABLE; + +import java.nio.ByteBuffer; + +/** + * API for Brotli decompression. + */ +final class Decode { + + static final int MIN_LARGE_WINDOW_BITS = 10; + /* Maximum was chosen to be 30 to allow efficient decoder implementation. + * Format allows bigger window, but Java does not support 2G+ arrays. */ + static final int MAX_LARGE_WINDOW_BITS = 30; + + //---------------------------------------------------------------------------- + // RunningState + //---------------------------------------------------------------------------- + // NB: negative values are used for errors. + private static final int UNINITIALIZED = 0; + private static final int INITIALIZED = 1; + private static final int BLOCK_START = 2; + private static final int COMPRESSED_BLOCK_START = 3; + private static final int MAIN_LOOP = 4; + private static final int READ_METADATA = 5; + private static final int COPY_UNCOMPRESSED = 6; + private static final int INSERT_LOOP = 7; + private static final int COPY_LOOP = 8; + private static final int USE_DICTIONARY = 9; + private static final int FINISHED = 10; + private static final int CLOSED = 11; + private static final int INIT_WRITE = 12; + private static final int WRITE = 13; + private static final int COPY_FROM_COMPOUND_DICTIONARY = 14; + + private static final int DEFAULT_CODE_LENGTH = 8; + private static final int CODE_LENGTH_REPEAT_CODE = 16; + private static final int NUM_LITERAL_CODES = 256; + private static final int NUM_COMMAND_CODES = 704; + private static final int NUM_BLOCK_LENGTH_CODES = 26; + private static final int LITERAL_CONTEXT_BITS = 6; + private static final int DISTANCE_CONTEXT_BITS = 2; + + private static final int CD_BLOCK_MAP_BITS = 8; + private static final int HUFFMAN_TABLE_BITS = 8; + private static final int HUFFMAN_TABLE_MASK = 0xFF; + + /** + * Maximum possible Huffman table size for an alphabet size of (index * 32), + * max code length 15 and root table bits 8. + * The biggest alphabet is "command" - 704 symbols. Though "distance" alphabet could theoretically + * outreach that limit (for 62 extra bit distances), practically it is limited by + * MAX_ALLOWED_DISTANCE and never gets bigger than 544 symbols. + */ + static final int[] MAX_HUFFMAN_TABLE_SIZE = { + 256, 402, 436, 468, 500, 534, 566, 598, 630, 662, 694, 726, 758, 790, 822, + 854, 886, 920, 952, 984, 1016, 1048, 1080 + }; + + private static final int HUFFMAN_TABLE_SIZE_26 = 396; + private static final int HUFFMAN_TABLE_SIZE_258 = 632; + + private static final int CODE_LENGTH_CODES = 18; + private static final int[] CODE_LENGTH_CODE_ORDER = { + 1, 2, 3, 4, 0, 5, 17, 6, 16, 7, 8, 9, 10, 11, 12, 13, 14, 15, + }; + + private static final int NUM_DISTANCE_SHORT_CODES = 16; + private static final int[] DISTANCE_SHORT_CODE_INDEX_OFFSET = { + 0, 3, 2, 1, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3 + }; + + private static final int[] DISTANCE_SHORT_CODE_VALUE_OFFSET = { + 0, 0, 0, 0, -1, 1, -2, 2, -3, 3, -1, 1, -2, 2, -3, 3 + }; + + /** + * Static Huffman code for the code length code lengths. + */ + private static final int[] FIXED_TABLE = { + 0x020000, 0x020004, 0x020003, 0x030002, 0x020000, 0x020004, 0x020003, 0x040001, + 0x020000, 0x020004, 0x020003, 0x030002, 0x020000, 0x020004, 0x020003, 0x040005 + }; + + // TODO(eustas): generalize. + static final int MAX_TRANSFORMED_WORD_LENGTH = 5 + 24 + 8; + + private static final int MAX_DISTANCE_BITS = 24; + private static final int MAX_LARGE_WINDOW_DISTANCE_BITS = 62; + + /** + * Safe distance limit. + * + * Limit ((1 << 31) - 4) allows safe distance calculation without overflows, + * given the distance alphabet size is limited to corresponding size. + */ + private static final int MAX_ALLOWED_DISTANCE = 0x7FFFFFFC; + + //---------------------------------------------------------------------------- + // Prefix code LUT. + //---------------------------------------------------------------------------- + static final int[] BLOCK_LENGTH_OFFSET = { + 1, 5, 9, 13, 17, 25, 33, 41, 49, 65, 81, 97, 113, 145, 177, 209, 241, 305, 369, 497, + 753, 1265, 2289, 4337, 8433, 16625 + }; + + static final int[] BLOCK_LENGTH_N_BITS = { + 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 7, 8, 9, 10, 11, 12, 13, 24 + }; + + static final short[] INSERT_LENGTH_N_BITS = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x03, 0x03, + 0x04, 0x04, 0x05, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0C, 0x0E, 0x18 + }; + + static final short[] COPY_LENGTH_N_BITS = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, + 0x03, 0x03, 0x04, 0x04, 0x05, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x18 + }; + + // Each command is represented with 4x16-bit values: + // * [insertLenExtraBits, copyLenExtraBits] + // * insertLenOffset + // * copyLenOffset + // * distanceContext + static final short[] CMD_LOOKUP = new short[NUM_COMMAND_CODES * 4]; + + static { + unpackCommandLookupTable(CMD_LOOKUP); + } + + private static int log2floor(int i) { + // REQUIRED: i > 0 + int result = -1; + int step = 16; + int v = i; + while (step > 0) { + int next = v >> step; + if (next != 0) { + result += step; + v = next; + } + step = step >> 1; + } + return result + v; + } + + private static int calculateDistanceAlphabetSize(int npostfix, int ndirect, int maxndistbits) { + return NUM_DISTANCE_SHORT_CODES + ndirect + 2 * (maxndistbits << npostfix); + } + + // TODO(eustas): add a correctness test for this function when + // large-window and dictionary are implemented. + private static int calculateDistanceAlphabetLimit(State s, int maxDistance, int npostfix, int ndirect) { + if (maxDistance < ndirect + (2 << npostfix)) { + return Utils.makeError(s, BROTLI_PANIC_MAX_DISTANCE_TOO_SMALL); + } + final int offset = ((maxDistance - ndirect) >> npostfix) + 4; + final int ndistbits = log2floor(offset) - 1; + final int group = ((ndistbits - 1) << 1) | ((offset >> ndistbits) & 1); + return ((group - 1) << npostfix) + (1 << npostfix) + ndirect + NUM_DISTANCE_SHORT_CODES; + } + + private static void unpackCommandLookupTable(short[] cmdLookup) { + final int[] insertLengthOffsets = new int[24]; + final int[] copyLengthOffsets = new int[24]; + copyLengthOffsets[0] = 2; + for (int i = 0; i < 23; ++i) { + insertLengthOffsets[i + 1] = insertLengthOffsets[i] + (1 << INSERT_LENGTH_N_BITS[i]); + copyLengthOffsets[i + 1] = copyLengthOffsets[i] + (1 << COPY_LENGTH_N_BITS[i]); + } + + for (int cmdCode = 0; cmdCode < NUM_COMMAND_CODES; ++cmdCode) { + int rangeIdx = cmdCode >> 6; + /* -4 turns any regular distance code to negative. */ + int distanceContextOffset = -4; + if (rangeIdx >= 2) { + rangeIdx -= 2; + distanceContextOffset = 0; + } + final int insertCode = (((0x29850 >> (rangeIdx * 2)) & 0x3) << 3) | ((cmdCode >> 3) & 7); + final int copyCode = (((0x26244 >> (rangeIdx * 2)) & 0x3) << 3) | (cmdCode & 7); + final int copyLengthOffset = copyLengthOffsets[copyCode]; + final int distanceContext = distanceContextOffset + Utils.min(copyLengthOffset, 5) - 2; + final int index = cmdCode * 4; + cmdLookup[index + 0] = + (short) + (INSERT_LENGTH_N_BITS[insertCode] | (COPY_LENGTH_N_BITS[copyCode] << 8)); + cmdLookup[index + 1] = (short) insertLengthOffsets[insertCode]; + cmdLookup[index + 2] = (short) copyLengthOffsets[copyCode]; + cmdLookup[index + 3] = (short) distanceContext; + } + } + + /** + * Reads brotli stream header and parses "window bits". + * + * @param s initialized state, before any read is performed. + * @return -1 if header is invalid + */ + private static int decodeWindowBits(State s) { + /* Change the meaning of flag. Before that step it means "decoder must be capable of reading + * "large-window" brotli stream. After this step it means that "large-window" feature + * is actually detected. Despite the window size could be same as before (lgwin = 10..24), + * encoded distances are allowed to be much greater, thus bigger dictionary could be used. */ + final int largeWindowEnabled = s.isLargeWindow; + s.isLargeWindow = 0; + + BitReader.fillBitWindow(s); + if (BitReader.readFewBits(s, 1) == 0) { + return 16; + } + int n = BitReader.readFewBits(s, 3); + if (n != 0) { + return 17 + n; + } + n = BitReader.readFewBits(s, 3); + if (n != 0) { + if (n == 1) { + if (largeWindowEnabled == 0) { + /* Reserved value in regular brotli stream. */ + return -1; + } + s.isLargeWindow = 1; + /* Check "reserved" bit for future (post-large-window) extensions. */ + if (BitReader.readFewBits(s, 1) == 1) { + return -1; + } + n = BitReader.readFewBits(s, 6); + if (n < MIN_LARGE_WINDOW_BITS || n > MAX_LARGE_WINDOW_BITS) { + /* Encoded window bits value is too small or too big. */ + return -1; + } + return n; + } + return 8 + n; + } + return 17; + } + + /** + * Switch decoder to "eager" mode. + * + * In "eager" mode decoder returns as soon as there is enough data to fill output buffer. + * + * @param s initialized state, before any read is performed. + */ + static int enableEagerOutput(State s) { + if (s.runningState != INITIALIZED) { + return Utils.makeError(s, BROTLI_PANIC_STATE_NOT_FRESH); + } + s.isEager = 1; + return BROTLI_OK; + } + + static int enableLargeWindow(State s) { + if (s.runningState != INITIALIZED) { + return Utils.makeError(s, BROTLI_PANIC_STATE_NOT_FRESH); + } + s.isLargeWindow = 1; + return BROTLI_OK; + } + + // TODO(eustas): do we need byte views? + static int attachDictionaryChunk(State s, byte[] data) { + if (s.runningState != INITIALIZED) { + return Utils.makeError(s, BROTLI_PANIC_STATE_NOT_FRESH); + } + if (s.cdNumChunks == 0) { + s.cdChunks = new byte[16][]; + s.cdChunkOffsets = new int[16]; + s.cdBlockBits = -1; + } + if (s.cdNumChunks == 15) { + return Utils.makeError(s, BROTLI_PANIC_TOO_MANY_DICTIONARY_CHUNKS); + } + s.cdChunks[s.cdNumChunks] = data; + s.cdNumChunks++; + s.cdTotalSize += data.length; + s.cdChunkOffsets[s.cdNumChunks] = s.cdTotalSize; + return BROTLI_OK; + } + + /** + * Associate input with decoder state. + * + * @param s uninitialized state without associated input + */ + static int initState(State s) { + if (s.runningState != UNINITIALIZED) { + return Utils.makeError(s, BROTLI_PANIC_STATE_NOT_UNINITIALIZED); + } + /* 6 trees + 1 extra "offset" slot to simplify table decoding logic. */ + s.blockTrees = new int[7 + 3 * (HUFFMAN_TABLE_SIZE_258 + HUFFMAN_TABLE_SIZE_26)]; + s.blockTrees[0] = 7; + s.distRbIdx = 3; + int result = calculateDistanceAlphabetLimit(s, MAX_ALLOWED_DISTANCE, 3, 15 << 3); + if (result < BROTLI_OK) { + return result; + } + final int maxDistanceAlphabetLimit = result; + s.distExtraBits = new byte[maxDistanceAlphabetLimit]; + s.distOffset = new int[maxDistanceAlphabetLimit]; + result = BitReader.initBitReader(s); + if (result < BROTLI_OK) { + return result; + } + s.runningState = INITIALIZED; + return BROTLI_OK; + } + + static int close(State s) { + if (s.runningState == UNINITIALIZED) { + return Utils.makeError(s, BROTLI_PANIC_STATE_NOT_INITIALIZED); + } + if (s.runningState > 0) { + s.runningState = CLOSED; + } + return BROTLI_OK; + } + + /** + * Decodes a number in the range [0..255], by reading 1 - 11 bits. + */ + private static int decodeVarLenUnsignedByte(State s) { + BitReader.fillBitWindow(s); + if (BitReader.readFewBits(s, 1) != 0) { + final int n = BitReader.readFewBits(s, 3); + if (n == 0) { + return 1; + } + return BitReader.readFewBits(s, n) + (1 << n); + } + return 0; + } + + private static int decodeMetaBlockLength(State s) { + BitReader.fillBitWindow(s); + s.inputEnd = BitReader.readFewBits(s, 1); + s.metaBlockLength = 0; + s.isUncompressed = 0; + s.isMetadata = 0; + if ((s.inputEnd != 0) && BitReader.readFewBits(s, 1) != 0) { + return BROTLI_OK; + } + final int sizeNibbles = BitReader.readFewBits(s, 2) + 4; + if (sizeNibbles == 7) { + s.isMetadata = 1; + if (BitReader.readFewBits(s, 1) != 0) { + return Utils.makeError(s, BROTLI_ERROR_CORRUPTED_RESERVED_BIT); + } + final int sizeBytes = BitReader.readFewBits(s, 2); + if (sizeBytes == 0) { + return BROTLI_OK; + } + for (int i = 0; i < sizeBytes; ++i) { + BitReader.fillBitWindow(s); + final int bits = BitReader.readFewBits(s, 8); + if (bits == 0 && i + 1 == sizeBytes && sizeBytes > 1) { + return Utils.makeError(s, BROTLI_ERROR_EXUBERANT_NIBBLE); + } + s.metaBlockLength += bits << (i * 8); + } + } else { + for (int i = 0; i < sizeNibbles; ++i) { + BitReader.fillBitWindow(s); + final int bits = BitReader.readFewBits(s, 4); + if (bits == 0 && i + 1 == sizeNibbles && sizeNibbles > 4) { + return Utils.makeError(s, BROTLI_ERROR_EXUBERANT_NIBBLE); + } + s.metaBlockLength += bits << (i * 4); + } + } + s.metaBlockLength++; + if (s.inputEnd == 0) { + s.isUncompressed = BitReader.readFewBits(s, 1); + } + return BROTLI_OK; + } + + /** + * Decodes the next Huffman code from bit-stream. + */ + private static int readSymbol(int[] tableGroup, int tableIdx, State s) { + int offset = tableGroup[tableIdx]; + final int v = BitReader.peekBits(s); + offset += v & HUFFMAN_TABLE_MASK; + final int bits = tableGroup[offset] >> 16; + final int sym = tableGroup[offset] & 0xFFFF; + if (bits <= HUFFMAN_TABLE_BITS) { + s.bitOffset += bits; + return sym; + } + offset += sym; + final int mask = (1 << bits) - 1; + offset += Utils.shr32(v & mask, HUFFMAN_TABLE_BITS); + s.bitOffset += ((tableGroup[offset] >> 16) + HUFFMAN_TABLE_BITS); + return tableGroup[offset] & 0xFFFF; + } + + private static int readBlockLength(int[] tableGroup, int tableIdx, State s) { + BitReader.fillBitWindow(s); + final int code = readSymbol(tableGroup, tableIdx, s); + final int n = BLOCK_LENGTH_N_BITS[code]; + BitReader.fillBitWindow(s); + return BLOCK_LENGTH_OFFSET[code] + BitReader.readBits(s, n); + } + + private static void moveToFront(int[] v, int index) { + int i = index; + final int value = v[i]; + while (i > 0) { + v[i] = v[i - 1]; + i--; + } + v[0] = value; + } + + private static void inverseMoveToFrontTransform(byte[] v, int vLen) { + final int[] mtf = new int[256]; + for (int i = 0; i < 256; ++i) { + mtf[i] = i; + } + for (int i = 0; i < vLen; ++i) { + final int index = v[i] & 0xFF; + v[i] = (byte) mtf[index]; + if (index != 0) { + moveToFront(mtf, index); + } + } + } + + private static int readHuffmanCodeLengths( + int[] codeLengthCodeLengths, int numSymbols, int[] codeLengths, State s) { + int symbol = 0; + int prevCodeLen = DEFAULT_CODE_LENGTH; + int repeat = 0; + int repeatCodeLen = 0; + int space = 32768; + final int[] table = new int[32 + 1]; /* Speculative single entry table group. */ + final int tableIdx = table.length - 1; + Huffman.buildHuffmanTable(table, tableIdx, 5, codeLengthCodeLengths, CODE_LENGTH_CODES); + + while (symbol < numSymbols && space > 0) { + if (s.halfOffset > BitReader.HALF_WATERLINE) { + final int result = BitReader.readMoreInput(s); + if (result < BROTLI_OK) { + return result; + } + } + BitReader.fillBitWindow(s); + final int p = BitReader.peekBits(s) & 31; + s.bitOffset += table[p] >> 16; + final int codeLen = table[p] & 0xFFFF; + if (codeLen < CODE_LENGTH_REPEAT_CODE) { + repeat = 0; + codeLengths[symbol++] = codeLen; + if (codeLen != 0) { + prevCodeLen = codeLen; + space -= 32768 >> codeLen; + } + } else { + final int extraBits = codeLen - 14; + int newLen = 0; + if (codeLen == CODE_LENGTH_REPEAT_CODE) { + newLen = prevCodeLen; + } + if (repeatCodeLen != newLen) { + repeat = 0; + repeatCodeLen = newLen; + } + final int oldRepeat = repeat; + if (repeat > 0) { + repeat -= 2; + repeat = repeat << extraBits; + } + BitReader.fillBitWindow(s); + repeat += BitReader.readFewBits(s, extraBits) + 3; + final int repeatDelta = repeat - oldRepeat; + if (symbol + repeatDelta > numSymbols) { + return Utils.makeError(s, BROTLI_ERROR_CORRUPTED_CODE_LENGTH_TABLE); + } + for (int i = 0; i < repeatDelta; ++i) { + codeLengths[symbol++] = repeatCodeLen; + } + if (repeatCodeLen != 0) { + space -= repeatDelta << (15 - repeatCodeLen); + } + } + } + if (space != 0) { + return Utils.makeError(s, BROTLI_ERROR_UNUSED_HUFFMAN_SPACE); + } + // TODO(eustas): Pass max_symbol to Huffman table builder instead? + Utils.fillIntsWithZeroes(codeLengths, symbol, numSymbols); + return BROTLI_OK; + } + + private static int checkDupes(State s, int[] symbols, int length) { + for (int i = 0; i < length - 1; ++i) { + for (int j = i + 1; j < length; ++j) { + if (symbols[i] == symbols[j]) { + return Utils.makeError(s, BROTLI_ERROR_DUPLICATE_SIMPLE_HUFFMAN_SYMBOL); + } + } + } + return BROTLI_OK; + } + + /** + * Reads up to 4 symbols directly and applies predefined histograms. + */ + private static int readSimpleHuffmanCode(int alphabetSizeMax, int alphabetSizeLimit, + int[] tableGroup, int tableIdx, State s) { + // TODO(eustas): Avoid allocation? + final int[] codeLengths = new int[alphabetSizeLimit]; + final int[] symbols = new int[4]; + + final int maxBits = 1 + log2floor(alphabetSizeMax - 1); + + final int numSymbols = BitReader.readFewBits(s, 2) + 1; + for (int i = 0; i < numSymbols; ++i) { + BitReader.fillBitWindow(s); + final int symbol = BitReader.readFewBits(s, maxBits); + if (symbol >= alphabetSizeLimit) { + return Utils.makeError(s, BROTLI_ERROR_SYMBOL_OUT_OF_RANGE); + } + symbols[i] = symbol; + } + final int result = checkDupes(s, symbols, numSymbols); + if (result < BROTLI_OK) { + return result; + } + + int histogramId = numSymbols; + if (numSymbols == 4) { + histogramId += BitReader.readFewBits(s, 1); + } + + switch (histogramId) { + case 1: + codeLengths[symbols[0]] = 1; + break; + + case 2: + codeLengths[symbols[0]] = 1; + codeLengths[symbols[1]] = 1; + break; + + case 3: + codeLengths[symbols[0]] = 1; + codeLengths[symbols[1]] = 2; + codeLengths[symbols[2]] = 2; + break; + + case 4: // uniform 4-symbol histogram + codeLengths[symbols[0]] = 2; + codeLengths[symbols[1]] = 2; + codeLengths[symbols[2]] = 2; + codeLengths[symbols[3]] = 2; + break; + + case 5: // prioritized 4-symbol histogram + codeLengths[symbols[0]] = 1; + codeLengths[symbols[1]] = 2; + codeLengths[symbols[2]] = 3; + codeLengths[symbols[3]] = 3; + break; + + default: + break; + } + + // TODO(eustas): Use specialized version? + return Huffman.buildHuffmanTable( + tableGroup, tableIdx, HUFFMAN_TABLE_BITS, codeLengths, alphabetSizeLimit); + } + + // Decode Huffman-coded code lengths. + private static int readComplexHuffmanCode(int alphabetSizeLimit, int skip, + int[] tableGroup, int tableIdx, State s) { + // TODO(eustas): Avoid allocation? + final int[] codeLengths = new int[alphabetSizeLimit]; + final int[] codeLengthCodeLengths = new int[CODE_LENGTH_CODES]; + int space = 32; + int numCodes = 0; + for (int i = skip; i < CODE_LENGTH_CODES; ++i) { + final int codeLenIdx = CODE_LENGTH_CODE_ORDER[i]; + BitReader.fillBitWindow(s); + final int p = BitReader.peekBits(s) & 15; + // TODO(eustas): Demultiplex FIXED_TABLE. + s.bitOffset += FIXED_TABLE[p] >> 16; + final int v = FIXED_TABLE[p] & 0xFFFF; + codeLengthCodeLengths[codeLenIdx] = v; + if (v != 0) { + space -= (32 >> v); + numCodes++; + if (space <= 0) { + break; + } + } + } + if (space != 0 && numCodes != 1) { + return Utils.makeError(s, BROTLI_ERROR_CORRUPTED_HUFFMAN_CODE_HISTOGRAM); + } + + final int result = readHuffmanCodeLengths(codeLengthCodeLengths, alphabetSizeLimit, codeLengths, s); + if (result < BROTLI_OK) { + return result; + } + + return Huffman.buildHuffmanTable( + tableGroup, tableIdx, HUFFMAN_TABLE_BITS, codeLengths, alphabetSizeLimit); + } + + /** + * Decodes Huffman table from bit-stream. + * + * @return number of slots used by resulting Huffman table + */ + private static int readHuffmanCode(int alphabetSizeMax, int alphabetSizeLimit, + int[] tableGroup, int tableIdx, State s) { + if (s.halfOffset > BitReader.HALF_WATERLINE) { + final int result = BitReader.readMoreInput(s); + if (result < BROTLI_OK) { + return result; + } + } + BitReader.fillBitWindow(s); + final int simpleCodeOrSkip = BitReader.readFewBits(s, 2); + if (simpleCodeOrSkip == 1) { + return readSimpleHuffmanCode(alphabetSizeMax, alphabetSizeLimit, tableGroup, tableIdx, s); + } + return readComplexHuffmanCode(alphabetSizeLimit, simpleCodeOrSkip, tableGroup, tableIdx, s); + } + + private static int decodeContextMap(int contextMapSize, byte[] contextMap, State s) { + int result; + if (s.halfOffset > BitReader.HALF_WATERLINE) { + result = BitReader.readMoreInput(s); + if (result < BROTLI_OK) { + return result; + } + } + final int numTrees = decodeVarLenUnsignedByte(s) + 1; + + if (numTrees == 1) { + Utils.fillBytesWithZeroes(contextMap, 0, contextMapSize); + return numTrees; + } + + BitReader.fillBitWindow(s); + final int useRleForZeros = BitReader.readFewBits(s, 1); + int maxRunLengthPrefix = 0; + if (useRleForZeros != 0) { + maxRunLengthPrefix = BitReader.readFewBits(s, 4) + 1; + } + final int alphabetSize = numTrees + maxRunLengthPrefix; + final int tableSize = MAX_HUFFMAN_TABLE_SIZE[(alphabetSize + 31) >> 5]; + /* Speculative single entry table group. */ + final int[] table = new int[tableSize + 1]; + final int tableIdx = table.length - 1; + result = readHuffmanCode(alphabetSize, alphabetSize, table, tableIdx, s); + if (result < BROTLI_OK) { + return result; + } + int i = 0; + while (i < contextMapSize) { + if (s.halfOffset > BitReader.HALF_WATERLINE) { + result = BitReader.readMoreInput(s); + if (result < BROTLI_OK) { + return result; + } + } + BitReader.fillBitWindow(s); + final int code = readSymbol(table, tableIdx, s); + if (code == 0) { + contextMap[i] = 0; + i++; + } else if (code <= maxRunLengthPrefix) { + BitReader.fillBitWindow(s); + int reps = (1 << code) + BitReader.readFewBits(s, code); + while (reps != 0) { + if (i >= contextMapSize) { + return Utils.makeError(s, BROTLI_ERROR_CORRUPTED_CONTEXT_MAP); + } + contextMap[i] = 0; + i++; + reps--; + } + } else { + contextMap[i] = (byte) (code - maxRunLengthPrefix); + i++; + } + } + BitReader.fillBitWindow(s); + if (BitReader.readFewBits(s, 1) == 1) { + inverseMoveToFrontTransform(contextMap, contextMapSize); + } + return numTrees; + } + + private static int decodeBlockTypeAndLength(State s, int treeType, int numBlockTypes) { + final int[] ringBuffers = s.rings; + final int offset = 4 + treeType * 2; + BitReader.fillBitWindow(s); + int blockType = readSymbol(s.blockTrees, 2 * treeType, s); + final int result = readBlockLength(s.blockTrees, 2 * treeType + 1, s); + + if (blockType == 1) { + blockType = ringBuffers[offset + 1] + 1; + } else if (blockType == 0) { + blockType = ringBuffers[offset]; + } else { + blockType -= 2; + } + if (blockType >= numBlockTypes) { + blockType -= numBlockTypes; + } + ringBuffers[offset] = ringBuffers[offset + 1]; + ringBuffers[offset + 1] = blockType; + return result; + } + + private static void decodeLiteralBlockSwitch(State s) { + s.literalBlockLength = decodeBlockTypeAndLength(s, 0, s.numLiteralBlockTypes); + final int literalBlockType = s.rings[5]; + s.contextMapSlice = literalBlockType << LITERAL_CONTEXT_BITS; + s.literalTreeIdx = s.contextMap[s.contextMapSlice] & 0xFF; + final int contextMode = s.contextModes[literalBlockType]; + s.contextLookupOffset1 = contextMode << 9; + s.contextLookupOffset2 = s.contextLookupOffset1 + 256; + } + + private static void decodeCommandBlockSwitch(State s) { + s.commandBlockLength = decodeBlockTypeAndLength(s, 1, s.numCommandBlockTypes); + s.commandTreeIdx = s.rings[7]; + } + + private static void decodeDistanceBlockSwitch(State s) { + s.distanceBlockLength = decodeBlockTypeAndLength(s, 2, s.numDistanceBlockTypes); + s.distContextMapSlice = s.rings[9] << DISTANCE_CONTEXT_BITS; + } + + private static void maybeReallocateRingBuffer(State s) { + int newSize = s.maxRingBufferSize; + if (newSize > s.expectedTotalSize) { + /* TODO(eustas): Handle 2GB+ cases more gracefully. */ + final int minimalNewSize = s.expectedTotalSize; + while ((newSize >> 1) > minimalNewSize) { + newSize = newSize >> 1; + } + if ((s.inputEnd == 0) && newSize < 16384 && s.maxRingBufferSize >= 16384) { + newSize = 16384; + } + } + if (newSize <= s.ringBufferSize) { + return; + } + final int ringBufferSizeWithSlack = newSize + MAX_TRANSFORMED_WORD_LENGTH; + final byte[] newBuffer = new byte[ringBufferSizeWithSlack]; + final byte[] oldBuffer = s.ringBuffer; + if (oldBuffer.length != 0) { + Utils.copyBytes(newBuffer, 0, oldBuffer, 0, s.ringBufferSize); + } + s.ringBuffer = newBuffer; + s.ringBufferSize = newSize; + } + + private static int readNextMetablockHeader(State s) { + if (s.inputEnd != 0) { + s.nextRunningState = FINISHED; + s.runningState = INIT_WRITE; + return BROTLI_OK; + } + // TODO(eustas): Reset? Do we need this? + s.literalTreeGroup = new int[0]; + s.commandTreeGroup = new int[0]; + s.distanceTreeGroup = new int[0]; + + int result; + if (s.halfOffset > BitReader.HALF_WATERLINE) { + result = BitReader.readMoreInput(s); + if (result < BROTLI_OK) { + return result; + } + } + result = decodeMetaBlockLength(s); + if (result < BROTLI_OK) { + return result; + } + if ((s.metaBlockLength == 0) && (s.isMetadata == 0)) { + return BROTLI_OK; + } + if ((s.isUncompressed != 0) || (s.isMetadata != 0)) { + result = BitReader.jumpToByteBoundary(s); + if (result < BROTLI_OK) { + return result; + } + if (s.isMetadata == 0) { + s.runningState = COPY_UNCOMPRESSED; + } else { + s.runningState = READ_METADATA; + } + } else { + s.runningState = COMPRESSED_BLOCK_START; + } + + if (s.isMetadata != 0) { + return BROTLI_OK; + } + s.expectedTotalSize += s.metaBlockLength; + if (s.expectedTotalSize > 1 << 30) { + s.expectedTotalSize = 1 << 30; + } + if (s.ringBufferSize < s.maxRingBufferSize) { + maybeReallocateRingBuffer(s); + } + return BROTLI_OK; + } + + private static int readMetablockPartition(State s, int treeType, int numBlockTypes) { + int offset = s.blockTrees[2 * treeType]; + if (numBlockTypes <= 1) { + s.blockTrees[2 * treeType + 1] = offset; + s.blockTrees[2 * treeType + 2] = offset; + return 1 << 28; + } + + final int blockTypeAlphabetSize = numBlockTypes + 2; + int result = readHuffmanCode( + blockTypeAlphabetSize, blockTypeAlphabetSize, s.blockTrees, 2 * treeType, s); + if (result < BROTLI_OK) { + return result; + } + offset += result; + s.blockTrees[2 * treeType + 1] = offset; + + final int blockLengthAlphabetSize = NUM_BLOCK_LENGTH_CODES; + result = readHuffmanCode( + blockLengthAlphabetSize, blockLengthAlphabetSize, s.blockTrees, 2 * treeType + 1, s); + if (result < BROTLI_OK) { + return result; + } + offset += result; + s.blockTrees[2 * treeType + 2] = offset; + + return readBlockLength(s.blockTrees, 2 * treeType + 1, s); + } + + private static void calculateDistanceLut(State s, int alphabetSizeLimit) { + final byte[] distExtraBits = s.distExtraBits; + final int[] distOffset = s.distOffset; + final int npostfix = s.distancePostfixBits; + final int ndirect = s.numDirectDistanceCodes; + final int postfix = 1 << npostfix; + int bits = 1; + int half = 0; + + /* Skip short codes. */ + int i = NUM_DISTANCE_SHORT_CODES; + + /* Fill direct codes. */ + for (int j = 0; j < ndirect; ++j) { + distExtraBits[i] = 0; + distOffset[i] = j + 1; + ++i; + } + + /* Fill regular distance codes. */ + while (i < alphabetSizeLimit) { + final int base = ndirect + ((((2 + half) << bits) - 4) << npostfix) + 1; + /* Always fill the complete group. */ + for (int j = 0; j < postfix; ++j) { + distExtraBits[i] = (byte) bits; + distOffset[i] = base + j; + ++i; + } + bits = bits + half; + half = half ^ 1; + } + } + + private static int readMetablockHuffmanCodesAndContextMaps(State s) { + s.numLiteralBlockTypes = decodeVarLenUnsignedByte(s) + 1; + int result = readMetablockPartition(s, 0, s.numLiteralBlockTypes); + if (result < BROTLI_OK) { + return result; + } + s.literalBlockLength = result; + s.numCommandBlockTypes = decodeVarLenUnsignedByte(s) + 1; + result = readMetablockPartition(s, 1, s.numCommandBlockTypes); + if (result < BROTLI_OK) { + return result; + } + s.commandBlockLength = result; + s.numDistanceBlockTypes = decodeVarLenUnsignedByte(s) + 1; + result = readMetablockPartition(s, 2, s.numDistanceBlockTypes); + if (result < BROTLI_OK) { + return result; + } + s.distanceBlockLength = result; + + if (s.halfOffset > BitReader.HALF_WATERLINE) { + result = BitReader.readMoreInput(s); + if (result < BROTLI_OK) { + return result; + } + } + BitReader.fillBitWindow(s); + s.distancePostfixBits = BitReader.readFewBits(s, 2); + s.numDirectDistanceCodes = BitReader.readFewBits(s, 4) << s.distancePostfixBits; + // TODO(eustas): Reuse? + s.contextModes = new byte[s.numLiteralBlockTypes]; + int i = 0; + while (i < s.numLiteralBlockTypes) { + /* Ensure that less than 256 bits read between readMoreInput. */ + final int limit = Utils.min(i + 96, s.numLiteralBlockTypes); + while (i < limit) { + BitReader.fillBitWindow(s); + s.contextModes[i] = (byte) BitReader.readFewBits(s, 2); + i++; + } + if (s.halfOffset > BitReader.HALF_WATERLINE) { + result = BitReader.readMoreInput(s); + if (result < BROTLI_OK) { + return result; + } + } + } + + // TODO(eustas): Reuse? + final int contextMapLength = s.numLiteralBlockTypes << LITERAL_CONTEXT_BITS; + s.contextMap = new byte[contextMapLength]; + result = decodeContextMap(contextMapLength, s.contextMap, s); + if (result < BROTLI_OK) { + return result; + } + final int numLiteralTrees = result; + s.trivialLiteralContext = 1; + for (int j = 0; j < contextMapLength; ++j) { + if (s.contextMap[j] != j >> LITERAL_CONTEXT_BITS) { + s.trivialLiteralContext = 0; + break; + } + } + + // TODO(eustas): Reuse? + s.distContextMap = new byte[s.numDistanceBlockTypes << DISTANCE_CONTEXT_BITS]; + result = decodeContextMap(s.numDistanceBlockTypes << DISTANCE_CONTEXT_BITS, + s.distContextMap, s); + if (result < BROTLI_OK) { + return result; + } + final int numDistTrees = result; + + s.literalTreeGroup = new int[huffmanTreeGroupAllocSize(NUM_LITERAL_CODES, numLiteralTrees)]; + result = decodeHuffmanTreeGroup( + NUM_LITERAL_CODES, NUM_LITERAL_CODES, numLiteralTrees, s, s.literalTreeGroup); + if (result < BROTLI_OK) { + return result; + } + s.commandTreeGroup = + new int[huffmanTreeGroupAllocSize(NUM_COMMAND_CODES, s.numCommandBlockTypes)]; + result = decodeHuffmanTreeGroup( + NUM_COMMAND_CODES, NUM_COMMAND_CODES, s.numCommandBlockTypes, s, s.commandTreeGroup); + if (result < BROTLI_OK) { + return result; + } + int distanceAlphabetSizeMax = calculateDistanceAlphabetSize( + s.distancePostfixBits, s.numDirectDistanceCodes, MAX_DISTANCE_BITS); + int distanceAlphabetSizeLimit = distanceAlphabetSizeMax; + if (s.isLargeWindow == 1) { + distanceAlphabetSizeMax = calculateDistanceAlphabetSize( + s.distancePostfixBits, s.numDirectDistanceCodes, MAX_LARGE_WINDOW_DISTANCE_BITS); + result = calculateDistanceAlphabetLimit( + s, MAX_ALLOWED_DISTANCE, s.distancePostfixBits, s.numDirectDistanceCodes); + if (result < BROTLI_OK) { + return result; + } + distanceAlphabetSizeLimit = result; + } + s.distanceTreeGroup = + new int[huffmanTreeGroupAllocSize(distanceAlphabetSizeLimit, numDistTrees)]; + result = decodeHuffmanTreeGroup( + distanceAlphabetSizeMax, distanceAlphabetSizeLimit, numDistTrees, s, s.distanceTreeGroup); + if (result < BROTLI_OK) { + return result; + } + calculateDistanceLut(s, distanceAlphabetSizeLimit); + + s.contextMapSlice = 0; + s.distContextMapSlice = 0; + s.contextLookupOffset1 = s.contextModes[0] * 512; + s.contextLookupOffset2 = s.contextLookupOffset1 + 256; + s.literalTreeIdx = 0; + s.commandTreeIdx = 0; + + s.rings[4] = 1; + s.rings[5] = 0; + s.rings[6] = 1; + s.rings[7] = 0; + s.rings[8] = 1; + s.rings[9] = 0; + return BROTLI_OK; + } + + private static int copyUncompressedData(State s) { + final byte[] ringBuffer = s.ringBuffer; + int result; + + // Could happen if block ends at ring buffer end. + if (s.metaBlockLength <= 0) { + result = BitReader.reload(s); + if (result < BROTLI_OK) { + return result; + } + s.runningState = BLOCK_START; + return BROTLI_OK; + } + + final int chunkLength = Utils.min(s.ringBufferSize - s.pos, s.metaBlockLength); + result = BitReader.copyRawBytes(s, ringBuffer, s.pos, chunkLength); + if (result < BROTLI_OK) { + return result; + } + s.metaBlockLength -= chunkLength; + s.pos += chunkLength; + if (s.pos == s.ringBufferSize) { + s.nextRunningState = COPY_UNCOMPRESSED; + s.runningState = INIT_WRITE; + return BROTLI_OK; + } + + result = BitReader.reload(s); + if (result < BROTLI_OK) { + return result; + } + s.runningState = BLOCK_START; + return BROTLI_OK; + } + + private static int writeRingBuffer(State s) { + final int toWrite = Utils.min(s.outputLength - s.outputUsed, + s.ringBufferBytesReady - s.ringBufferBytesWritten); + // TODO(eustas): DCHECK(toWrite >= 0) + if (toWrite != 0) { + Utils.copyBytes(s.output, s.outputOffset + s.outputUsed, s.ringBuffer, + s.ringBufferBytesWritten, s.ringBufferBytesWritten + toWrite); + s.outputUsed += toWrite; + s.ringBufferBytesWritten += toWrite; + } + + if (s.outputUsed < s.outputLength) { + return BROTLI_OK; + } + return BROTLI_OK_NEED_MORE_OUTPUT; + } + + private static int huffmanTreeGroupAllocSize(int alphabetSizeLimit, int n) { + final int maxTableSize = MAX_HUFFMAN_TABLE_SIZE[(alphabetSizeLimit + 31) >> 5]; + return n + n * maxTableSize; + } + + private static int decodeHuffmanTreeGroup(int alphabetSizeMax, int alphabetSizeLimit, + int n, State s, int[] group) { + int next = n; + for (int i = 0; i < n; ++i) { + group[i] = next; + final int result = readHuffmanCode(alphabetSizeMax, alphabetSizeLimit, group, i, s); + if (result < BROTLI_OK) { + return result; + } + next += result; + } + return BROTLI_OK; + } + + // Returns offset in ringBuffer that should trigger WRITE when filled. + private static int calculateFence(State s) { + int result = s.ringBufferSize; + if (s.isEager != 0) { + result = Utils.min(result, s.ringBufferBytesWritten + s.outputLength - s.outputUsed); + } + return result; + } + + private static int doUseDictionary(State s, int fence) { + if (s.distance > MAX_ALLOWED_DISTANCE) { + return Utils.makeError(s, BROTLI_ERROR_INVALID_BACKWARD_REFERENCE); + } + final int address = s.distance - s.maxDistance - 1 - s.cdTotalSize; + if (address < 0) { + final int result = initializeCompoundDictionaryCopy(s, -address - 1, s.copyLength); + if (result < BROTLI_OK) { + return result; + } + s.runningState = COPY_FROM_COMPOUND_DICTIONARY; + } else { + // Force lazy dictionary initialization. + final ByteBuffer dictionaryData = Dictionary.getData(); + final int wordLength = s.copyLength; + if (wordLength > Dictionary.MAX_DICTIONARY_WORD_LENGTH) { + return Utils.makeError(s, BROTLI_ERROR_INVALID_BACKWARD_REFERENCE); + } + final int shift = Dictionary.sizeBits[wordLength]; + if (shift == 0) { + return Utils.makeError(s, BROTLI_ERROR_INVALID_BACKWARD_REFERENCE); + } + int offset = Dictionary.offsets[wordLength]; + final int mask = (1 << shift) - 1; + final int wordIdx = address & mask; + final int transformIdx = address >> shift; + offset += wordIdx * wordLength; + final Transform.Transforms transforms = Transform.RFC_TRANSFORMS; + if (transformIdx >= transforms.numTransforms) { + return Utils.makeError(s, BROTLI_ERROR_INVALID_BACKWARD_REFERENCE); + } + final int len = Transform.transformDictionaryWord(s.ringBuffer, s.pos, dictionaryData, + offset, wordLength, transforms, transformIdx); + s.pos += len; + s.metaBlockLength -= len; + if (s.pos >= fence) { + s.nextRunningState = MAIN_LOOP; + s.runningState = INIT_WRITE; + return BROTLI_OK; + } + s.runningState = MAIN_LOOP; + } + return BROTLI_OK; + } + + private static void initializeCompoundDictionary(State s) { + s.cdBlockMap = new byte[1 << CD_BLOCK_MAP_BITS]; + int blockBits = CD_BLOCK_MAP_BITS; + // If this function is executed, then s.cdTotalSize > 0. + while (((s.cdTotalSize - 1) >> blockBits) != 0) { + blockBits++; + } + blockBits -= CD_BLOCK_MAP_BITS; + s.cdBlockBits = blockBits; + int cursor = 0; + int index = 0; + while (cursor < s.cdTotalSize) { + while (s.cdChunkOffsets[index + 1] < cursor) { + index++; + } + s.cdBlockMap[cursor >> blockBits] = (byte) index; + cursor += 1 << blockBits; + } + } + + private static int initializeCompoundDictionaryCopy(State s, int address, int length) { + if (s.cdBlockBits == -1) { + initializeCompoundDictionary(s); + } + int index = s.cdBlockMap[address >> s.cdBlockBits]; + while (address >= s.cdChunkOffsets[index + 1]) { + index++; + } + if (s.cdTotalSize > address + length) { + return Utils.makeError(s, BROTLI_ERROR_INVALID_BACKWARD_REFERENCE); + } + /* Update the recent distances cache */ + s.distRbIdx = (s.distRbIdx + 1) & 0x3; + s.rings[s.distRbIdx] = s.distance; + s.metaBlockLength -= length; + s.cdBrIndex = index; + s.cdBrOffset = address - s.cdChunkOffsets[index]; + s.cdBrLength = length; + s.cdBrCopied = 0; + return BROTLI_OK; + } + + private static int copyFromCompoundDictionary(State s, int fence) { + int pos = s.pos; + final int origPos = pos; + while (s.cdBrLength != s.cdBrCopied) { + final int space = fence - pos; + final int chunkLength = s.cdChunkOffsets[s.cdBrIndex + 1] - s.cdChunkOffsets[s.cdBrIndex]; + final int remChunkLength = chunkLength - s.cdBrOffset; + int length = s.cdBrLength - s.cdBrCopied; + if (length > remChunkLength) { + length = remChunkLength; + } + if (length > space) { + length = space; + } + Utils.copyBytes( + s.ringBuffer, pos, s.cdChunks[s.cdBrIndex], s.cdBrOffset, s.cdBrOffset + length); + pos += length; + s.cdBrOffset += length; + s.cdBrCopied += length; + if (length == remChunkLength) { + s.cdBrIndex++; + s.cdBrOffset = 0; + } + if (pos >= fence) { + break; + } + } + return pos - origPos; + } + + /** + * Actual decompress implementation. + */ + static int decompress(State s) { + int result; + if (s.runningState == UNINITIALIZED) { + return Utils.makeError(s, BROTLI_PANIC_STATE_NOT_INITIALIZED); + } + if (s.runningState < 0) { + return Utils.makeError(s, BROTLI_PANIC_UNEXPECTED_STATE); + } + if (s.runningState == CLOSED) { + return Utils.makeError(s, BROTLI_PANIC_ALREADY_CLOSED); + } + if (s.runningState == INITIALIZED) { + final int windowBits = decodeWindowBits(s); + if (windowBits == -1) { /* Reserved case for future expansion. */ + return Utils.makeError(s, BROTLI_ERROR_INVALID_WINDOW_BITS); + } + s.maxRingBufferSize = 1 << windowBits; + s.maxBackwardDistance = s.maxRingBufferSize - 16; + s.runningState = BLOCK_START; + } + + int fence = calculateFence(s); + int ringBufferMask = s.ringBufferSize - 1; + byte[] ringBuffer = s.ringBuffer; + + while (s.runningState != FINISHED) { + // TODO(eustas): extract cases to methods for the better readability. + switch (s.runningState) { + case BLOCK_START: + if (s.metaBlockLength < 0) { + return Utils.makeError(s, BROTLI_ERROR_INVALID_METABLOCK_LENGTH); + } + result = readNextMetablockHeader(s); + if (result < BROTLI_OK) { + return result; + } + /* Ring-buffer would be reallocated here. */ + fence = calculateFence(s); + ringBufferMask = s.ringBufferSize - 1; + ringBuffer = s.ringBuffer; + continue; + + case COMPRESSED_BLOCK_START: { + result = readMetablockHuffmanCodesAndContextMaps(s); + if (result < BROTLI_OK) { + return result; + } + s.runningState = MAIN_LOOP; + continue; + } + + case MAIN_LOOP: + if (s.metaBlockLength <= 0) { + s.runningState = BLOCK_START; + continue; + } + if (s.halfOffset > BitReader.HALF_WATERLINE) { + result = BitReader.readMoreInput(s); + if (result < BROTLI_OK) { + return result; + } + } + if (s.commandBlockLength == 0) { + decodeCommandBlockSwitch(s); + } + s.commandBlockLength--; + BitReader.fillBitWindow(s); + final int cmdCode = readSymbol(s.commandTreeGroup, s.commandTreeIdx, s) << 2; + final int insertAndCopyExtraBits = CMD_LOOKUP[cmdCode]; + final int insertLengthOffset = CMD_LOOKUP[cmdCode + 1]; + final int copyLengthOffset = CMD_LOOKUP[cmdCode + 2]; + s.distanceCode = CMD_LOOKUP[cmdCode + 3]; + BitReader.fillBitWindow(s); + { + final int insertLengthExtraBits = insertAndCopyExtraBits & 0xFF; + s.insertLength = insertLengthOffset + BitReader.readBits(s, insertLengthExtraBits); + } + BitReader.fillBitWindow(s); + { + final int copyLengthExtraBits = insertAndCopyExtraBits >> 8; + s.copyLength = copyLengthOffset + BitReader.readBits(s, copyLengthExtraBits); + } + + s.j = 0; + s.runningState = INSERT_LOOP; + continue; + + case INSERT_LOOP: + if (s.trivialLiteralContext != 0) { + while (s.j < s.insertLength) { + if (s.halfOffset > BitReader.HALF_WATERLINE) { + result = BitReader.readMoreInput(s); + if (result < BROTLI_OK) { + return result; + } + } + if (s.literalBlockLength == 0) { + decodeLiteralBlockSwitch(s); + } + s.literalBlockLength--; + BitReader.fillBitWindow(s); + ringBuffer[s.pos] = (byte) readSymbol(s.literalTreeGroup, s.literalTreeIdx, s); + s.pos++; + s.j++; + if (s.pos >= fence) { + s.nextRunningState = INSERT_LOOP; + s.runningState = INIT_WRITE; + break; + } + } + } else { + int prevByte1 = ringBuffer[(s.pos - 1) & ringBufferMask] & 0xFF; + int prevByte2 = ringBuffer[(s.pos - 2) & ringBufferMask] & 0xFF; + while (s.j < s.insertLength) { + if (s.halfOffset > BitReader.HALF_WATERLINE) { + result = BitReader.readMoreInput(s); + if (result < BROTLI_OK) { + return result; + } + } + if (s.literalBlockLength == 0) { + decodeLiteralBlockSwitch(s); + } + final int literalContext = Context.LOOKUP[s.contextLookupOffset1 + prevByte1] + | Context.LOOKUP[s.contextLookupOffset2 + prevByte2]; + final int literalTreeIdx = + s.contextMap[s.contextMapSlice + literalContext] & 0xFF; + s.literalBlockLength--; + prevByte2 = prevByte1; + BitReader.fillBitWindow(s); + prevByte1 = readSymbol(s.literalTreeGroup, literalTreeIdx, s); + ringBuffer[s.pos] = (byte) prevByte1; + s.pos++; + s.j++; + if (s.pos >= fence) { + s.nextRunningState = INSERT_LOOP; + s.runningState = INIT_WRITE; + break; + } + } + } + if (s.runningState != INSERT_LOOP) { + continue; + } + s.metaBlockLength -= s.insertLength; + if (s.metaBlockLength <= 0) { + s.runningState = MAIN_LOOP; + continue; + } + int distanceCode = s.distanceCode; + if (distanceCode < 0) { + // distanceCode in untouched; assigning it 0 won't affect distance ring buffer rolling. + s.distance = s.rings[s.distRbIdx]; + } else { + if (s.halfOffset > BitReader.HALF_WATERLINE) { + result = BitReader.readMoreInput(s); + if (result < BROTLI_OK) { + return result; + } + } + if (s.distanceBlockLength == 0) { + decodeDistanceBlockSwitch(s); + } + s.distanceBlockLength--; + BitReader.fillBitWindow(s); + final int distTreeIdx = + s.distContextMap[s.distContextMapSlice + distanceCode] & 0xFF; + distanceCode = readSymbol(s.distanceTreeGroup, distTreeIdx, s); + if (distanceCode < NUM_DISTANCE_SHORT_CODES) { + final int index = + (s.distRbIdx + DISTANCE_SHORT_CODE_INDEX_OFFSET[distanceCode]) & 0x3; + s.distance = s.rings[index] + DISTANCE_SHORT_CODE_VALUE_OFFSET[distanceCode]; + if (s.distance < 0) { + return Utils.makeError(s, BROTLI_ERROR_NEGATIVE_DISTANCE); + } + } else { + final int extraBits = s.distExtraBits[distanceCode]; + int bits; + if (s.bitOffset + extraBits <= BitReader.BITNESS) { + bits = BitReader.readFewBits(s, extraBits); + } else { + BitReader.fillBitWindow(s); + bits = BitReader.readBits(s, extraBits); + } + s.distance = s.distOffset[distanceCode] + (bits << s.distancePostfixBits); + } + } + + if (s.maxDistance != s.maxBackwardDistance + && s.pos < s.maxBackwardDistance) { + s.maxDistance = s.pos; + } else { + s.maxDistance = s.maxBackwardDistance; + } + + if (s.distance > s.maxDistance) { + s.runningState = USE_DICTIONARY; + continue; + } + + if (distanceCode > 0) { + s.distRbIdx = (s.distRbIdx + 1) & 0x3; + s.rings[s.distRbIdx] = s.distance; + } + + if (s.copyLength > s.metaBlockLength) { + return Utils.makeError(s, BROTLI_ERROR_INVALID_BACKWARD_REFERENCE); + } + s.j = 0; + s.runningState = COPY_LOOP; + continue; + + case COPY_LOOP: + int src = (s.pos - s.distance) & ringBufferMask; + int dst = s.pos; + final int copyLength = s.copyLength - s.j; + final int srcEnd = src + copyLength; + final int dstEnd = dst + copyLength; + if ((srcEnd < ringBufferMask) && (dstEnd < ringBufferMask)) { + if (copyLength < 12 || (srcEnd > dst && dstEnd > src)) { + final int numQuads = (copyLength + 3) >> 2; + for (int k = 0; k < numQuads; ++k) { + ringBuffer[dst++] = ringBuffer[src++]; + ringBuffer[dst++] = ringBuffer[src++]; + ringBuffer[dst++] = ringBuffer[src++]; + ringBuffer[dst++] = ringBuffer[src++]; + } + } else { + Utils.copyBytesWithin(ringBuffer, dst, src, srcEnd); + } + s.j += copyLength; + s.metaBlockLength -= copyLength; + s.pos += copyLength; + } else { + while (s.j < s.copyLength) { + ringBuffer[s.pos] = + ringBuffer[(s.pos - s.distance) & ringBufferMask]; + s.metaBlockLength--; + s.pos++; + s.j++; + if (s.pos >= fence) { + s.nextRunningState = COPY_LOOP; + s.runningState = INIT_WRITE; + break; + } + } + } + if (s.runningState == COPY_LOOP) { + s.runningState = MAIN_LOOP; + } + continue; + + case USE_DICTIONARY: + result = doUseDictionary(s, fence); + if (result < BROTLI_OK) { + return result; + } + continue; + + case COPY_FROM_COMPOUND_DICTIONARY: + s.pos += copyFromCompoundDictionary(s, fence); + if (s.pos >= fence) { + s.nextRunningState = COPY_FROM_COMPOUND_DICTIONARY; + s.runningState = INIT_WRITE; + return BROTLI_OK_NEED_MORE_OUTPUT; + } + s.runningState = MAIN_LOOP; + continue; + + case READ_METADATA: + while (s.metaBlockLength > 0) { + if (s.halfOffset > BitReader.HALF_WATERLINE) { + result = BitReader.readMoreInput(s); + if (result < BROTLI_OK) { + return result; + } + } + // Optimize + BitReader.fillBitWindow(s); + BitReader.readFewBits(s, 8); + s.metaBlockLength--; + } + s.runningState = BLOCK_START; + continue; + + case COPY_UNCOMPRESSED: + result = copyUncompressedData(s); + if (result < BROTLI_OK) { + return result; + } + continue; + + case INIT_WRITE: + s.ringBufferBytesReady = Utils.min(s.pos, s.ringBufferSize); + s.runningState = WRITE; + continue; + + case WRITE: + result = writeRingBuffer(s); + if (result != BROTLI_OK) { + // Output buffer is full. + return result; + } + if (s.pos >= s.maxBackwardDistance) { + s.maxDistance = s.maxBackwardDistance; + } + // Wrap the ringBuffer. + if (s.pos >= s.ringBufferSize) { + if (s.pos > s.ringBufferSize) { + Utils.copyBytesWithin(ringBuffer, 0, s.ringBufferSize, s.pos); + } + s.pos = s.pos & ringBufferMask; + s.ringBufferBytesWritten = 0; + } + s.runningState = s.nextRunningState; + continue; + + default: + return Utils.makeError(s, BROTLI_PANIC_UNEXPECTED_STATE); + } + } + if (s.runningState != FINISHED) { + return Utils.makeError(s, BROTLI_PANIC_UNREACHABLE); + } + if (s.metaBlockLength < 0) { + return Utils.makeError(s, BROTLI_ERROR_INVALID_METABLOCK_LENGTH); + } + result = BitReader.jumpToByteBoundary(s); + if (result != BROTLI_OK) { + return result; + } + result = BitReader.checkHealth(s, 1); + if (result != BROTLI_OK) { + return result; + } + return BROTLI_OK_DONE; + } +} diff --git a/src/main/java/org/htmlunit/util/brotli/Dictionary.java b/src/main/java/org/htmlunit/util/brotli/Dictionary.java new file mode 100644 index 00000000000..a7a0bf6f5d3 --- /dev/null +++ b/src/main/java/org/htmlunit/util/brotli/Dictionary.java @@ -0,0 +1,103 @@ +/* Copyright 2015 Google Inc. All Rights Reserved. + + Distributed under MIT license. + See file LICENSE for detail or copy at https://opensource.org/licenses/MIT +*/ + +package org.htmlunit.util.brotli; + +import java.nio.ByteBuffer; + +/** + * Collection of static dictionary words. + * + *

Dictionary content is loaded from binary resource when {@link #getData()} is executed for the + * first time. Consequently, it saves memory and CPU in case dictionary is not required. + * + *

One possible drawback is that multiple threads that need dictionary data may be blocked (only + * once in each classworld). To avoid this, it is enough to call {@link #getData()} proactively. + */ +public final class Dictionary { + static final int MIN_DICTIONARY_WORD_LENGTH = 4; + static final int MAX_DICTIONARY_WORD_LENGTH = 31; + + private static ByteBuffer data = ByteBuffer.allocateDirect(0); + static final int[] offsets = new int[32]; + static final int[] sizeBits = new int[32]; + + private static class DataLoader { + static final boolean OK; + + static { + boolean ok = true; + try { + Class.forName(Dictionary.class.getPackage().getName() + ".DictionaryData"); + } catch (Throwable ex) { + ok = false; + } + OK = ok; + } + } + + private static final int DICTIONARY_DEBUG = Utils.isDebugMode(); + + public static void setData(ByteBuffer newData, int[] newSizeBits) { + if (DICTIONARY_DEBUG != 0) { + if ((Utils.isDirect(newData) == 0) || (Utils.isReadOnly(newData) == 0)) { + throw new BrotliRuntimeException("newData must be a direct read-only byte buffer"); + } + // TODO: is that so? + if (newSizeBits.length > MAX_DICTIONARY_WORD_LENGTH) { + throw new BrotliRuntimeException( + "sizeBits length must be at most " + String.valueOf(MAX_DICTIONARY_WORD_LENGTH)); + } + for (int i = 0; i < MIN_DICTIONARY_WORD_LENGTH; ++i) { + if (newSizeBits[i] != 0) { + throw new BrotliRuntimeException( + "first " + String.valueOf(MIN_DICTIONARY_WORD_LENGTH) + " must be 0"); + } + } + } + final int[] dictionaryOffsets = Dictionary.offsets; + final int[] dictionarySizeBits = Dictionary.sizeBits; + for (int i = 0; i < newSizeBits.length; ++i) { + dictionarySizeBits[i] = newSizeBits[i]; + } + int pos = 0; + for (int i = 0; i < newSizeBits.length; ++i) { + dictionaryOffsets[i] = pos; + final int bits = dictionarySizeBits[i]; + if (bits != 0) { + pos += i << (bits & 31); + if (DICTIONARY_DEBUG != 0) { + if (bits >= 31) { + throw new BrotliRuntimeException("newSizeBits values must be less than 31"); + } + if (pos <= 0 || pos > newData.capacity()) { + throw new BrotliRuntimeException("newSizeBits is inconsistent: overflow"); + } + } + } + } + for (int i = newSizeBits.length; i < 32; ++i) { + dictionaryOffsets[i] = pos; + } + if (DICTIONARY_DEBUG != 0) { + if (pos != newData.capacity()) { + throw new BrotliRuntimeException("newSizeBits is inconsistent: underflow"); + } + } + Dictionary.data = newData; + } + + public static ByteBuffer getData() { + if (data.capacity() != 0) { + return data; + } + if (!DataLoader.OK) { + throw new BrotliRuntimeException("brotli dictionary is not set"); + } + /* Might have been set when {@link DictionaryData} was loaded.*/ + return data; + } +} diff --git a/src/main/java/org/htmlunit/util/brotli/DictionaryData.java b/src/main/java/org/htmlunit/util/brotli/DictionaryData.java new file mode 100644 index 00000000000..70214f779c5 --- /dev/null +++ b/src/main/java/org/htmlunit/util/brotli/DictionaryData.java @@ -0,0 +1,80 @@ +/* Copyright 2015 Google Inc. All Rights Reserved. + + Distributed under MIT license. + See file LICENSE for detail or copy at https://opensource.org/licenses/MIT +*/ + +package org.htmlunit.util.brotli; + +import java.nio.ByteBuffer; + +/** + * Built-in dictionary data. + * + * When this class is loaded, it sets its data: {@link Dictionary#setData(ByteBuffer)}. + */ +final class DictionaryData { + private static final String DATA0 = "wjnfgltmojefofewab`h`lgfgbwbpkltlmozpjwf`jwzlsfmivpwojhfeqfftlqhwf{wzfbqlufqalgzolufelqnallhsobzojufojmfkfosklnfpjgfnlqftlqgolmdwkfnujftejmgsbdfgbzpevookfbgwfqnfb`kbqfbeqlnwqvfnbqhbaofvslmkjdkgbwfobmgmftpfufmmf{w`bpfalwkslpwvpfgnbgfkbmgkfqftkbwmbnfOjmhaoldpjyfabpfkfognbhfnbjmvpfq$*#(klogfmgptjwkMftpqfbgtfqfpjdmwbhfkbufdbnfpffm`boosbwktfoosovpnfmvejonsbqwiljmwkjpojpwdllgmffgtbzptfpwilapnjmgboploldlqj`kvpfpobpwwfbnbqnzellghjmdtjoofbpwtbqgafpwejqfSbdfhmltbtbz-smdnlufwkbmolbgdjufpfoemlwfnv`keffgnbmzql`hj`lmlm`follhkjgfgjfgKlnfqvofklpwbib{jmel`ovaobtpofppkboeplnfpv`kylmf233&lmfp`bqfWjnfqb`faovfelvqtffheb`fklsfdbufkbqgolpwtkfmsbqhhfswsbpppkjsqllnKWNOsobmWzsfglmfpbufhffseobdojmhplogejufwllhqbwfwltmivnswkvpgbqh`bqgejofefbqpwbzhjoowkbweboobvwlfufq-`lnwbohpklsulwfgffsnlgfqfpwwvqmalqmabmgefooqlpfvqo+phjmqlof`lnfb`wpbdfpnffwdlog-isdjwfnubqzefowwkfmpfmggqlsUjft`lsz2-3!?,b=pwlsfopfojfpwlvqsb`h-djesbpw`pp!pfwp6s{8-ip<73s{je#+pllmpfbwmlmfwvafyfqlpfmwqffgeb`wjmwldjewkbqn2;s{`bnfkjooalogyllnuljgfbpzqjmdejoosfbhjmjw`lpw0s{8ib`hwbdpajwpqloofgjwhmftmfbq?\"..dqltIPLMgvwzMbnfpbofzlv#olwpsbjmibyy`logfzfpejpkttt-qjphwbapsqfu23s{qjpf16s{Aovfgjmd033/abooelqgfbqmtjogal{-ebjqob`hufqpsbjqivmfwf`kje+\"sj`hfujo'+! tbqnolqgglfpsvoo/333jgfbgqbtkvdfpslwevmgavqmkqfe`foohfzpwj`hklvqolppevfo21s{pvjwgfboQPP!bdfgdqfzDFW!fbpfbjnpdjqobjgp;s{8mbuzdqjgwjsp :::tbqpobgz`bqp*8#~sksolpfmvooubpwtjmgQPP#tfbqqfozaffmpbnfgvhfmbpb`bsftjpkdvoeW109kjwppolwdbwfhj`haovqwkfz26s{$$*8*8!=npjftjmpajqgplqwafwbpffhW2;9lqgpwqffnboo53s{ebqn\u000ElupalzpX3^-$*8!SLPWafbqhjgp*8~~nbqzwfmg+VH*rvbgyk9\n.pjy....sqls$*8\u000EojewW2:9uj`fbmgzgfaw=QPPsllomf`haoltW259gllqfuboW249ofwpebjolqbosloomlub`lopdfmf#\u000Elxplewqlnfwjooqlpp?k0=slvqebgfsjmh?wq=njmj*\u007F\"+njmfyk9\u0004abqpkfbq33*8njoh#..=jqlmeqfggjphtfmwpljosvwp,ip,klozW119JPAMW139bgbnpffp?k1=iplm$/#$`lmwW129#QPPollsbpjbnllm?,s=plvoOJMFelqw`bqwW279?k2=;3s{\"..?:s{8W379njhf975Ymj`fjm`kZlqhqj`fyk9\b$**8svqfnbdfsbqbwlmfalmg904Y\\le\\$^*8333/yk9\u000Bwbmhzbqgaltoavpk965YIbub03s{\t\u007F~\t&@0&907YifeeF[SJ`bpkujpbdloepmltyk9\u0005rvfq-`pppj`hnfbwnjm-ajmggfookjqfsj`pqfmw905YKWWS.132elwltloeFMG#{al{967YALGZgj`h8\t~\tf{jw906Yubqpafbw$~*8gjfw:::8bmmf~~?,Xj^-Obmdhn.^tjqfwlzpbggppfbobof{8\t\n~f`klmjmf-lqd336*wlmziftppbmgofdpqlle333*#133tjmfdfbqgldpallwdbqz`vwpwzofwfnswjlm-{no`l`hdbmd'+$-63s{Sk-Gnjp`bobmolbmgfphnjofqzbmvmj{gjp`*8~\tgvpw`ojs*-\t\t43s{.133GUGp4^=?wbsfgfnlj((*tbdffvqlskjolswpklofEBRpbpjm.15WobapsfwpVQO#avoh`llh8~\u000E\tKFBGX3^*baaqivbm+2:;ofpkwtjm?,j=plmzdvzpev`hsjsf\u007F.\t\"331*mgltX2^8X^8\tOld#pbow\u000E\t\n\nabmdwqjnabwk*x\u000E\t33s{\t~*8hl9\u0000effpbg=\u000Ep9,,#X^8wloosovd+*x\tx\u000E\t#-ip$133sgvboalbw-ISD*8\t~rvlw*8\t\t$*8\t\u000E\t~\u000E1327132613251324132;132:13131312131113101317131613151314131;131:130313021301130013071306130513041320132113221323133:133;133413351336133713301331133213332:::2::;2::42::52::62::72::02::12::22::32:;:2:;;2:;42:;52:;62:;72:;02:;12:;22:;32:4:2:4;2:442:452:462:472:402:412:422:432:5:2:5;2:542:552:562:572:502:512:522:532:6:2:6;2:642:652:662:672:602:612:622:632333231720:73333::::`lnln/Mpfpwffpwbsfqlwlglkb`f`bgbb/]lajfmg/Abbp/Aujgb`bpllwqlelqlplollwqb`vbogjilpjgldqbmwjslwfnbgfafbodlrv/Efpwlmbgbwqfpsl`l`bpbabilwlgbpjmlbdvbsvfpvmlpbmwfgj`fovjpfoobnbzlylmbbnlqsjpllaqb`oj`foolgjlpklqb`bpj<[<\\!sbqhpnlvpfNlpw#---?,bnlmdaqbjmalgz#mlmf8abpfg`bqqzgqbewqfefqsbdf\\klnf-nfwfqgfobzgqfbnsqlufiljmw?,wq=gqvdp?\"..#bsqjojgfboboofmf{b`welqwk`lgfpoldj`Ujft#pffnpaobmhslqwp#+133pbufg\\ojmhdlbopdqbmwdqffhklnfpqjmdpqbwfg03s{8tklpfsbqpf+*8!#Aol`hojmv{ilmfpsj{fo$*8!=*8je+.ofewgbujgklqpfEl`vpqbjpfal{fpWqb`hfnfmw?,fn=abq!=-pq`>wltfqbow>!`baofkfmqz17s{8pfwvsjwbozpkbqsnjmlqwbpwftbmwpwkjp-qfpfwtkffodjqop,`pp,233&8`ovappwveeajaofulwfp#2333hlqfb~*8\u000E\tabmgprvfvf>#x~8;3s{8`hjmdx\u000E\t\n\nbkfbg`ol`hjqjpkojhf#qbwjlpwbwpElqn!zbkll*X3^8Balvwejmgp?,k2=gfavdwbphpVQO#>`foop~*+*821s{8sqjnfwfoopwvqmp3{533-isd!psbjmafb`kwb{fpnj`qlbmdfo..=?,djewppwfuf.ojmhalgz-~*8\t\nnlvmw#+2::EBR?,qldfqeqbmh@obpp1;s{8effgp?k2=?p`lwwwfpwp11s{8gqjmh*#\u007F\u007F#oftjppkboo 30:8#elq#olufgtbpwf33s{8ib9\u000Fnpjnlm?elmwqfsoznffwpvmwfq`kfbswjdkwAqbmg*#\">#gqfpp`ojspqllnplmhfznlajonbjm-Mbnf#sobwfevmmzwqffp`ln,!2-isdtnlgfsbqbnPWBQWofew#jggfm/#132*8\t~\telqn-ujqvp`kbjqwqbmptlqpwSbdfpjwjlmsbw`k?\"..\tl.`b`ejqnpwlvqp/333#bpjbmj((*xbglaf$*X3^jg>23alwk8nfmv#-1-nj-smd!hfujm`lb`k@kjogaqv`f1-isdVQO*(-isd\u007Fpvjwfpoj`fkbqqz213!#ptffwwq=\u000E\tmbnf>gjfdlsbdf#ptjpp..=\t\t eee8!=Old-`ln!wqfbwpkffw*#%%#27s{8poffsmwfmwejofgib9\u000Fojg>!`Mbnf!tlqpfpklwp.al{.gfowb\t%ow8afbqp97;Y?gbwb.qvqbo?,b=#psfmgabhfqpklsp>#!!8sks!=`wjlm20s{8aqjbmkfoolpjyf>l>&1E#iljmnbzaf?jnd#jnd!=/#eipjnd!#!*X3^NWlsAWzsf!mftozGbmph`yf`kwqbjohmltp?,k6=ebr!=yk.`m23*8\t.2!*8wzsf>aovfpwqvozgbujp-ip$8=\u000E\t?\"pwffo#zlv#k1=\u000E\telqn#ifpvp233&#nfmv-\u000E\t\n\u000E\ttbofpqjphpvnfmwggjmda.ojhwfb`kdje!#ufdbpgbmphffpwjpkrjspvlnjplaqfgfpgffmwqfwlglpsvfgfb/]lpfpw/Mwjfmfkbpwblwqlpsbqwfglmgfmvfulkb`fqelqnbnjpnlnfilqnvmglbrv/Ag/Abpp/_olbzvgbef`kbwlgbpwbmwlnfmlpgbwlplwqbppjwjlnv`klbklqbovdbqnbzlqfpwlpklqbpwfmfqbmwfpelwlpfpwbpsb/Apmvfubpbovgelqlpnfgjlrvjfmnfpfpslgfq`kjofpfq/Muf`fpgf`jqilp/Efpwbqufmwbdqvslkf`klfoolpwfmdlbnjdl`lpbpmjufodfmwfnjpnbbjqfpivojlwfnbpkb`jbebulqivmjlojaqfsvmwlavfmlbvwlqbaqjoavfmbwf{wlnbqylpbafqojpwbovfdl`/_nlfmfqlivfdlsfq/Vkbafqfpwlzmvm`bnvifqubolqevfqbojaqldvpwbjdvboulwlp`bplpdv/Absvfglplnlpbujplvpwfggfafmml`kfavp`bebowbfvqlppfqjfgj`kl`vqpl`obuf`bpbpof/_msobylobqdllaqbpujpwbbslzlivmwlwqbwbujpwl`qfbq`bnslkfnlp`jm`l`bqdlsjplplqgfmkb`fm/Mqfbgjp`lsfgql`fq`bsvfgbsbsfonfmlq/Vwjo`obqlilqdf`boofslmfqwbqgfmbgjfnbq`bpjdvffoobppjdol`l`kfnlwlpnbgqf`obpfqfpwlmj/]lrvfgbsbpbqabm`lkjilpujbifsbaol/Epwfujfmfqfjmlgfibqelmgl`bmbomlqwfofwqb`bvpbwlnbqnbmlpovmfpbvwlpujoobufmglsfpbqwjslpwfmdbnbq`loofubsbgqfvmjglubnlpylmbpbnalpabmgbnbqjbbavplnv`kbpvajqqjlibujujqdqbgl`kj`bboo/Ailufmgj`kbfpwbmwbofppbojqpvfolsfplpejmfpoobnbavp`l/Epwboofdbmfdqlsobybkvnlqsbdbqivmwbglaofjpobpalopbab/]lkbaobov`kb/mqfbgj`fmivdbqmlwbpuboofboo/M`bqdbglolqbabilfpw/Edvpwlnfmwfnbqjlejqnb`lpwlej`kbsobwbkldbqbqwfpofzfpbrvfonvpflabpfpsl`lpnjwbg`jfol`kj`lnjfgldbmbqpbmwlfwbsbgfafpsobzbqfgfppjfwf`lqwf`lqfbgvgbpgfpflujfilgfpfbbdvbp%rvlw8glnbjm`lnnlmpwbwvpfufmwpnbpwfqpzpwfnb`wjlmabmmfqqfnlufp`qloovsgbwfdolabonfgjvnejowfqmvnafq`kbmdfqfpvowsvaoj`p`qffm`kllpfmlqnbowqbufojppvfpplvq`fwbqdfwpsqjmdnlgvofnlajofptjw`ksklwlpalqgfqqfdjlmjwpfoepl`jbob`wjuf`lovnmqf`lqgelooltwjwof=fjwkfqofmdwkebnjozeqjfmgobzlvwbvwklq`qfbwfqfujftpvnnfqpfqufqsobzfgsobzfqf{sbmgsloj`zelqnbwglvaofsljmwppfqjfpsfqplmojujmdgfpjdmnlmwkpelq`fpvmjrvftfjdkwsflsoffmfqdzmbwvqfpfbq`kejdvqfkbujmd`vpwlnleepfwofwwfqtjmgltpvanjwqfmgfqdqlvspvsolbgkfbowknfwklgujgflpp`klloevwvqfpkbgltgfabwfubovfpLaif`wlwkfqpqjdkwpofbdvf`kqlnfpjnsofmlwj`fpkbqfgfmgjmdpfbplmqfslqwlmojmfprvbqfavwwlmjnbdfpfmbaofnlujmdobwfpwtjmwfqEqbm`fsfqjlgpwqlmdqfsfbwOlmglmgfwbjoelqnfggfnbmgpf`vqfsbppfgwlddofsob`fpgfuj`fpwbwj``jwjfppwqfbnzfooltbwwb`hpwqffweojdkwkjggfmjmel!=lsfmfgvpfevouboofz`bvpfpofbgfqpf`qfwpf`lmggbnbdfpslqwpf{`fswqbwjmdpjdmfgwkjmdpfeef`wejfogppwbwfpleej`fujpvbofgjwlqulovnfQfslqwnvpfvnnlujfpsbqfmwb``fppnlpwoznlwkfq!#jg>!nbqhfwdqlvmg`kbm`fpvqufzafelqfpznalonlnfmwpsff`knlwjlmjmpjgfnbwwfq@fmwfqlaif`wf{jpwpnjggofFvqlsfdqltwkofdb`znbmmfqfmlvdk`bqffqbmptfqlqjdjmslqwbo`ojfmwpfof`wqbmgln`olpfgwlsj`p`lnjmdebwkfqlswjlmpjnsozqbjpfgfp`bsf`klpfm`kvq`kgfejmfqfbplm`lqmfqlvwsvwnfnlqzjeqbnfsloj`fnlgfopMvnafqgvqjmdleefqppwzofphjoofgojpwfg`boofgpjoufqnbqdjmgfofwfafwwfqaqltpfojnjwpDolabopjmdoftjgdfw`fmwfqavgdfwmltqbs`qfgjw`objnpfmdjmfpbefwz`klj`fpsjqjw.pwzofpsqfbgnbhjmdmffgfgqvppjbsofbpff{wfmwP`qjswaqlhfmbooltp`kbqdfgjujgfeb`wlqnfnafq.abpfgwkflqz`lmejdbqlvmgtlqhfgkfosfg@kvq`kjnsb`wpklvogbotbzpoldl!#alwwlnojpw!=*xubq#sqfej{lqbmdfKfbgfq-svpk+`lvsofdbqgfmaqjgdfobvm`kQfujftwbhjmdujpjlmojwwofgbwjmdAvwwlmafbvwzwkfnfpelqdlwPfbq`kbm`klqbonlpwolbgfg@kbmdfqfwvqmpwqjmdqfolbgNlajofjm`lnfpvssozPlvq`flqgfqpujftfg%maps8`lvqpfBalvw#jpobmg?kwno#`llhjfmbnf>!bnbylmnlgfqmbguj`fjm?,b=9#Wkf#gjboldklvpfpAFDJM#Nf{j`lpwbqwp`fmwqfkfjdkwbggjmdJpobmgbppfwpFnsjqfP`kllofeelqwgjqf`wmfbqoznbmvboPfof`w-\t\tLmfiljmfgnfmv!=SkjojsbtbqgpkbmgofjnslqwLeej`fqfdbqgphjoopmbwjlmPslqwpgfdqfftffhoz#+f-d-afkjmggl`wlqolddfgvmjwfg?,a=?,afdjmpsobmwpbppjpwbqwjpwjppvfg033s{\u007F`bmbgbbdfm`zp`kfnfqfnbjmAqbyjopbnsofoldl!=afzlmg.p`bofb``fswpfqufgnbqjmfEllwfq`bnfqb?,k2=\t\\elqn!ofbufppwqfpp!#,=\u000E\t-dje!#lmolbgolbgfqL{elqgpjpwfqpvqujuojpwfmefnbofGfpjdmpjyf>!bssfbowf{w!=ofufopwkbmhpkjdkfqelq`fgbmjnbobmzlmfBeqj`bbdqffgqf`fmwSflsof?aq#,=tlmgfqsqj`fpwvqmfg\u007F\u007F#x~8nbjm!=jmojmfpvmgbztqbs!=ebjofg`fmpvpnjmvwfafb`lmrvlwfp263s{\u007Ffpwbwfqfnlwffnbjo!ojmhfgqjdkw8pjdmboelqnbo2-kwnopjdmvssqjm`feolbw9-smd!#elqvn-B``fppsbsfqpplvmgpf{wfmgKfjdkwpojgfqVWE.;!%bns8#Afelqf-#TjwkpwvgjlltmfqpnbmbdfsqlejwiRvfqzbmmvbosbqbnpalvdkwebnlvpdlldofolmdfqj((*#xjpqbfopbzjmdgf`jgfklnf!=kfbgfqfmpvqfaqbm`ksjf`fpaol`h8pwbwfgwls!=?qb`jmdqfpjyf..%dw8sb`jwzpf{vboavqfbv-isd!#23/333lawbjmwjwofpbnlvmw/#Jm`-`lnfgznfmv!#ozqj`pwlgbz-jmgffg`lvmwz\\oldl-EbnjozollhfgNbqhfwopf#jeSobzfqwvqhfz*8ubq#elqfpwdjujmdfqqlqpGlnbjm~fopfxjmpfqwAold?,ellwfqoldjm-ebpwfqbdfmwp?algz#23s{#3sqbdnbeqjgbzivmjlqgloobqsob`fg`lufqpsovdjm6/333#sbdf!=alpwlm-wfpw+bubwbqwfpwfg\\`lvmwelqvnpp`kfnbjmgf{/ejoofgpkbqfpqfbgfqbofqw+bssfbqPvanjwojmf!=algz!=\t)#WkfWklvdkpffjmdifqpfzMftp?,ufqjezf{sfqwjmivqztjgwk>@llhjfPWBQW#b`qlpp\\jnbdfwkqfbgmbwjufsl`hfwal{!=\tPzpwfn#Gbujg`bm`fqwbaofpsqlufgBsqjo#qfboozgqjufqjwfn!=nlqf!=albqgp`lolqp`bnsvpejqpw#\u007F\u007F#X^8nfgjb-dvjwbqejmjpktjgwk9pkltfgLwkfq#-sks!#bppvnfobzfqptjoplmpwlqfpqfojfeptfgfm@vpwlnfbpjoz#zlvq#Pwqjmd\t\tTkjowbzolq`ofbq9qfplqweqfm`kwklvdk!*#(#!?algz=avzjmdaqbmgpNfnafqmbnf!=lssjmdpf`wlq6s{8!=upsb`fslpwfqnbilq#`leeffnbqwjmnbwvqfkbssfm?,mbu=hbmpbpojmh!=Jnbdfp>ebopftkjof#kpsb`f3%bns8#\t\tJm##sltfqSlophj.`lolqilqgbmAlwwlnPwbqw#.`lvmw1-kwnomftp!=32-isdLmojmf.qjdkwnjoofqpfmjlqJPAM#33/333#dvjgfpubovf*f`wjlmqfsbjq-{no!##qjdkwp-kwno.aol`hqfdF{s9klufqtjwkjmujqdjmsklmfp?,wq=\u000Evpjmd#\t\nubq#=$*8\t\n?,wg=\t?,wq=\tabkbpbaqbpjodbofdlnbdzbqslophjpqsphj4]4C5d\bTA\nzk\u000BBl\bQ\u007F\u000BUm\u0005Gx\bSM\nmC\bTA\twQ\nd}\bW@\bTl\bTF\ti@\tcT\u000BBM\u000B|j\u0004BV\tqw\tcC\bWI\npa\tfM\n{Z\u0005{X\bTF\bVV\bVK\t\u007Fm\u0004kF\t[]\bPm\bTv\nsI\u000Bpg\t[I\bQp\u0004mx\u000B_W\n^M\npe\u000BQ}\u000BGu\nel\npe\u0004Ch\u0004BV\bTA\tSo\nzk\u000BGL\u000BxD\nd[\u0005Jz\u0005MY\bQp\u0004li\nfl\npC\u0005{B\u0005Nt\u000BwT\ti_\bTg\u0004QQ\n|p\u000BXN\bQS\u000BxD\u0004QC\bWZ\tpD\u000BVS\bTW\u0005Nt\u0004Yh\nzu\u0004Kj\u0005N}\twr\tHa\n_D\tj`\u000BQ}\u000BWp\nxZ\u0004{c\tji\tBU\nbD\u0004a|\tTn\tpV\nZd\nmC\u000BEV\u0005{X\tc}\tTo\bWl\bUd\tIQ\tcg\u000Bxs\nXW\twR\u000Bek\tc}\t]y\tJn\nrp\neg\npV\nz\\\u0005{W\npl\nz\\\nzU\tPc\t`{\bV@\nc|\bRw\ti_\bVb\nwX\tHv\u0004Su\bTF\u000B_W\u000BWs\u000BsI\u0005m\u007F\nTT\ndc\tUS\t}f\tiZ\bWz\tc}\u0004MD\tBe\tiD\u000B@@\bTl\bPv\t}t\u0004Sw\u0004M`\u000BnU\tkW\u000Bed\nqo\u000BxY\tA|\bTz\u000By`\u0004BR\u0004BM\tia\u0004XU\nyu\u0004n^\tfL\tiI\nXW\tfD\bWz\bW@\tyj\t\u007Fm\tav\tBN\u000Bb\\\tpD\bTf\nY[\tJn\bQy\t[^\u000BWc\u000Byu\u0004Dl\u0004CJ\u000BWj\u000BHR\t`V\u000BuW\tQy\np@\u000BGu\u0005pl\u0004Jm\bW[\nLP\nxC\n`m\twQ\u0005ui\u0005\u007FR\nbI\twQ\tBZ\tWV\u0004BR\npg\tcg\u0005ti\u0004CW\n_y\tRg\bQa\u000BQB\u000BWc\nYb\u0005le\ngE\u0004Su\nL[\tQ\u007F\tea\tdj\u000B]W\nb~\u0004M`\twL\bTV\bVH\nt\u007F\npl\t|b\u0005s_\bU|\bTa\u0004oQ\u0005lv\u0004Sk\u0004M`\bTv\u000BK}\nfl\tcC\u0004oQ\u0004BR\tHk\t|d\bQp\tHK\tBZ\u000BHR\bPv\u000BLx\u000BEZ\bT\u007F\bTv\tiD\u0005oD\u0005MU\u000BwB\u0004Su\u0005k`\u0004St\ntC\tPl\tKg\noi\tjY\u000BxY\u0004h}\nzk\bWZ\t\u007Fm\u000Be`\tTB\tfE\nzk\t`z\u0004Yh\nV|\tHK\tAJ\tAJ\bUL\tp\\\tql\nYc\u0004Kd\nfy\u0004Yh\t[I\u000BDg\u0004Jm\n]n\nlb\bUd\n{Z\tlu\tfs\u0004oQ\bTW\u0004Jm\u000BwB\tea\u0004Yh\u0004BC\tsb\tTn\nzU\n_y\u000BxY\tQ]\ngw\u0004mt\tO\\\ntb\bWW\bQy\tmI\tV[\ny\\\naB\u000BRb\twQ\n]Q\u0004QJ\bWg\u000BWa\bQj\ntC\bVH\nYm\u000Bxs\bVK\nel\bWI\u000BxY\u0004Cq\ntR\u000BHV\bTl\bVw\tay\bQa\bVV\t}t\tdj\nr|\tp\\\twR\n{i\nTT\t[I\ti[\tAJ\u000Bxs\u000B_W\td{\u000BQ}\tcg\tTz\tA|\tCj\u000BLm\u0005N}\u0005m\u007F\nbK\tdZ\tp\\\t`V\tsV\np@\tiD\twQ\u000BQ}\bTf\u0005ka\u0004Jm\u000B@@\bV`\tzp\n@N\u0004Sw\tiI\tcg\noi\u0004Su\bVw\u0004lo\u0004Cy\tc}\u000Bb\\\tsU\u0004BA\bWI\bTf\nxS\tVp\nd|\bTV\u000BbC\tNo\u0005Ju\nTC\t|`\n{Z\tD]\bU|\tc}\u0005lm\bTl\tBv\tPl\tc}\bQp\t\u007Fm\nLk\tkj\n@N\u0004Sb\u0004KO\tj_\tp\\\nzU\bTl\bTg\bWI\tcf\u0004XO\bWW\ndz\u0004li\tBN\nd[\bWO\u0004MD\u000BKC\tdj\tI_\bVV\ny\\\u000BLm\u0005xl\txB\tkV\u000Bb\\\u000BJW\u000BVS\tVx\u000BxD\td{\u0004MD\bTa\t|`\u000BPz\u0004R}\u000BWs\u0004BM\nsI\u0004CN\bTa\u0004Jm\npe\ti_\npV\nrh\tRd\tHv\n~A\nxR\u000BWh\u000BWk\nxS\u000BAz\u000BwX\nbI\u0004oQ\tfw\nqI\nV|\nun\u0005z\u007F\u000Bpg\td\\\u000BoA\u0005{D\ti_\u0005xB\bT\u007F\t`V\u0005qr\tTT\u0004g]\u0004CA\u000BuR\tVJ\tT`\npw\u000BRb\tI_\nCx\u0004Ro\u000BsI\u0004Cj\u0004Kh\tBv\tWV\u0004BB\u0005oD\u0005{D\nhc\u0004Km\u000B^R\tQE\n{I\np@\nc|\u0005Gt\tc}\u0004Dl\nzU\u0005qN\tsV\u0005k}\tHh\u000B|j\nqo\u0005u|\tQ]\u000Bek\u0005\u007FZ\u0004M`\u0004St\npe\tdj\bVG\u000BeE\t\u007Fm\u000BWc\u0004|I\n[W\tfL\bT\u007F\tBZ\u0004Su\u000BKa\u0004Cq\u0005Nt\u0004Y[\nqI\bTv\tfM\ti@\t}f\u0004B\\\tQy\u000BBl\bWg\u0004XD\u0005kc\u000Bx[\bVV\tQ]\t\u007Fa\tPy\u000BxD\nfI\t}f\u0005oD\tdj\tSG\u0005ls\t~D\u0004CN\n{Z\t\\v\n_D\nhc\u000Bx_\u0004C[\tAJ\nLM\tVx\u0004CI\tbj\tc^\tcF\ntC\u0004Sx\twr\u0004XA\bU\\\t|a\u000BK\\\bTV\bVj\nd|\tfs\u0004CX\ntb\bRw\tVx\tAE\tA|\bT\u007F\u0005Nt\u000BDg\tVc\bTl\u0004d@\npo\t\u007FM\tcF\npe\tiZ\tBo\bSq\nfH\u0004l`\bTx\bWf\tHE\u000BF{\tcO\tfD\nlm\u000BfZ\nlm\u000BeU\tdG\u0004BH\bTV\tSi\u0005MW\nwX\nz\\\t\\c\u0004CX\nd}\tl}\bQp\bTV\tF~\bQ\u007F\t`i\ng@\u0005nO\bUd\bTl\nL[\twQ\tji\ntC\t|J\nLU\naB\u000BxY\u0004Kj\tAJ\u0005uN\ti[\npe\u0004Sk\u000BDg\u000Bx]\bVb\bVV\nea\tkV\nqI\bTa\u0004Sk\nAO\tpD\ntb\nts\nyi\bVg\ti_\u000B_W\nLk\u0005Nt\tyj\tfM\u0004R\u007F\tiI\bTl\u000BwX\tsV\u000BMl\nyu\tAJ\bVj\u0004KO\tWV\u000BA}\u000BW\u007F\nrp\tiD\u000B|o\u0005lv\u000BsI\u0004BM\td~\tCU\bVb\u0004eV\npC\u000BwT\tj`\tc}\u000Bxs\u000Bps\u000Bvh\tWV\u000BGg\u000BAe\u000BVK\u000B]W\trg\u000BWc\u0005F`\tBr\u000Bb\\\tdZ\bQp\nqI\u0004kF\nLk\u000BAR\bWI\bTg\tbs\tdw\n{L\n_y\tiZ\bTA\tlg\bVV\bTl\tdk\n`k\ta{\ti_\u0005{A\u0005wj\twN\u000B@@\bTe\ti_\n_D\twL\nAH\u000BiK\u000Bek\n[]\tp_\tyj\bTv\tUS\t[r\n{I\nps\u0005Gt\u000BVK\npl\u0004S}\u000BWP\t|d\u0004MD\u000BHV\bT\u007F\u0004R}\u0004M`\bTV\bVH\u0005lv\u0004Ch\bW[\u0004Ke\tR{\u000B^R\tab\tBZ\tVA\tB`\nd|\nhs\u0004Ke\tBe\u0004Oi\tR{\td\\\u0005nB\bWZ\tdZ\tVJ\u0005Os\t\u007Fm\u0004uQ\u000BhZ\u0004Q@\u0004QQ\nfI\bW[\u0004B\\\u0004li\nzU\nMd\u0004M`\nxS\bVV\n\\}\u000BxD\t\u007Fm\bTp\u0004IS\nc|\tkV\u0005i~\tV{\u000BhZ\t|b\bWt\n@R\u000BoA\u000BnU\bWI\tea\tB`\tiD\tc}\tTz\u0004BR\u000BQB\u0005Nj\tCP\t[I\bTv\t`W\u0005uN\u000Bpg\u000Bpg\u000BWc\tiT\tbs\twL\tU_\tc\\\t|h\u000BKa\tNr\tfL\nq|\nzu\nz\\\tNr\bUg\t|b\u0004m`\bTv\nyd\nrp\bWf\tUX\u0004BV\nzk\nd}\twQ\t}f\u0004Ce\u000Bed\bTW\bSB\nxU\tcn\bTb\ne\u007F\ta\\\tSG\bU|\npV\nN\\\u0004Kn\u000BnU\tAt\tpD\u000B^R\u000BIr\u0004b[\tR{\tdE\u000BxD\u000BWK\u000BWA\bQL\bW@\u0004Su\bUd\nDM\tPc\u0004CA\u0004Dl\u0004oQ\tHs\u0005wi\u0004ub\n\u007Fa\bQp\u0005Ob\nLP\bTl\u0004Y[\u000BK}\tAJ\bQ\u007F\u0004n^\u000BsA\bSM\nqM\bWZ\n^W\u000Bz{\u0004S|\tfD\bVK\bTv\bPv\u0004BB\tCP\u0004dF\tid\u000Bxs\u0004mx\u000Bws\tcC\ntC\tyc\u0005M`\u000BW\u007F\nrh\bQp\u000BxD\u0004\\o\nsI\u0004_k\nzu\u0004kF\tfD\u0004Xs\u0004XO\tjp\bTv\u0004BS\u0005{B\tBr\nzQ\nbI\tc{\u0004BD\u0004BV\u0005nO\bTF\tca\u0005Jd\tfL\tPV\tI_\nlK\u0004`o\twX\npa\tgu\bP}\u0005{^\bWf\n{I\tBN\npa\u0004Kl\u000Bpg\tcn\tfL\u000Bvh\u0004Cq\bTl\u000BnU\bSq\u0004Cm\twR\bUJ\npe\nyd\nYg\u0004Cy\u000BKW\tfD\nea\u0004oQ\tj_\tBv\u0004nM\u000BID\bTa\nzA\u0005pl\n]n\bTa\tR{\tfr\n_y\bUg\u0005{X\u0005kk\u000BxD\u0004|I\u0005xl\nfy\u0004Ce\u000BwB\nLk\u000Bd]\noi\n}h\tQ]\npe\bVw\u0004Hk\u0004OQ\nzk\tAJ\npV\bPv\ny\\\tA{\u0004Oi\bSB\u0004XA\u000BeE\tjp\nq}\tiD\u0005qN\u000B^R\t\u007Fm\tiZ\tBr\bVg\noi\n\\X\tU_\nc|\u000BHV\bTf\tTn\u0004\\N\u0004\\N\nuB\u0005lv\nyu\tTd\bTf\bPL\u000B]W\tdG\nA`\nw^\ngI\npe\tdw\nz\\\u0005ia\bWZ\tcF\u0004Jm\n{Z\bWO\u0004_k\u0004Df\u0004RR\td\\\bVV\u000Bxs\u0004BN\u0005ti\u0004lm\tTd\t]y\u000BHV\tSo\u000B|j\u0004XX\tA|\u000BZ^\u000BGu\bTW\u0005M`\u0004kF\u000BhZ\u000BVK\tdG\u000BBl\tay\nxU\u0005qE\u0005nO\bVw\nqI\u0004CX\ne\u007F\tPl\bWO\u000BLm\tdL\u0005uH\u0004Cm\tdT\u0004fn\u000BwB\u0005ka\u000BnU\n@M\nyT\tHv\t\\}\u0004Kh\td~\u0004Yh\u0005k}\neR\td\\\bWI\t|b\tHK\tiD\bTW\u0005MY\npl\bQ_\twr\u000BAx\tHE\bTg\bSq\u0005vp\u000Bb\\\bWO\nOl\nsI\nfy\u000BID\t\\c\n{Z\n^~\npe\nAO\tTT\u000Bxv\u0004k_\bWO\u000B|j\u000BwB\tQy\ti@\tPl\tHa\tdZ\u0005k}\u0004ra\tUT\u000BJc\u000Bed\np@\tQN\nd|\tkj\tHk\u0004M`\noi\twr\td\\\nlq\no_\nlb\nL[\tac\u0004BB\u0004BH\u0004Cm\npl\tIQ\bVK\u000Bxs\n`e\u000BiK\npa\u0004Oi\tUS\bTp\tfD\nPG\u0005kk\u0004XA\nz\\\neg\u000BWh\twR\u0005qN\nqS\tcn\u0004lo\nxS\n^W\tBU\nt\u007F\tHE\tp\\\tfF\tfw\bVV\bW@\tak\u000BVK\u0005ls\tVJ\bVV\u000BeE\u0004\\o\nyX\nYm\u0004M`\u0005lL\nd|\nzk\tA{\u0005sE\twQ\u0004XT\nt\u007F\tPl\t]y\u000BwT\u0005{p\u0004MD\u000Bb\\\tQ]\u0004Kj\tJn\nAH\u000BRb\tBU\tHK\t\\c\nfI\u0005m\u007F\nqM\n@R\tSo\noi\u0004BT\tHv\n_y\u0004Kh\tBZ\t]i\bUJ\tV{\u0004Sr\nbI\u000BGg\ta_\bTR\nfI\nfl\t[K\tII\u0004S|\u000BuW\tiI\bWI\nqI\u000B|j\u0004BV\bVg\bWZ\u0004kF\u000Bx]\bTA\tab\tfr\ti@\tJd\tJd\u000Bps\nAO\bTa\u0005xu\tiD\nzk\t|d\t|`\bW[\tlP\tdG\bVV\u000Bw}\u000BqO\ti[\bQ\u007F\bTz\u000BVF\twN\u0005ts\tdw\bTv\neS\ngi\tNr\u0005yS\npe\bVV\bSq\n`m\tyj\tBZ\u000BWX\bSB\tc\\\nUR\t[J\tc_\u0004nM\bWQ\u000BAx\nMd\tBr\u0005ui\u000BxY\bSM\u000BWc\u000B|j\u000Bxs\t}Q\tBO\bPL\bWW\tfM\nAO\tPc\u000BeU\u0004e^\bTg\nqI\tac\bPv\tcF\u0004oQ\tQ\u007F\u000BhZ\u0005ka\nz\\\tiK\tBU\n`k\tCP\u0004S|\u0004M`\n{I\tS{\u0004_O\tBZ\u0004Zi\u0004Sk\tps\tp\\\nYu\n]s\nxC\bWt\nbD\tkV\u000BGu\u0005yS\nqA\t[r\neK\u0004M`\tdZ\u0005lL\bUg\bTl\nbD\tUS\u000Bb\\\tpV\ncc\u0004S\\\tct\t`z\bPL\u000BWs\nA`\neg\bSq\u0005uE\u0004CR\u000BDg\t`W\u000Bz{\u000BWc\u0004Sk\u0004Sk\tbW\bUg\tea\nxZ\tiI\tUX\tVJ\nqn\tS{\u000BRb\bTQ\npl\u0005Gt\u000BuW\u0005uj\npF\nqI\tfL\t[I\tia\u0004XO\nyu\u000BDg\u000Bed\tq{\u0004VG\bQ\u007F\u0005ka\tVj\tkV\txB\nd|\np@\tQN\tPc\tps\u0004]j\tkV\toU\bTp\nzU\u0005nB\u000BB]\ta{\bV@\n]n\u0004m`\tcz\tR{\u0004m`\bQa\u000BwT\bSM\u0005MY\u0005qN\tdj\u0005~s\u000BQ}\u0005MY\u000BMB\tBv\twR\bRg\u000BQ}\tql\u000BKC\nrm\u0005xu\u0004CC\u000BwB\u000Bvh\tBq\u0004Xq\npV\ti_\u0005Ob\u0005uE\nbd\nqo\u000B{i\nC~\tBL\u000BeE\u0005uH\bVj\u0004Ey\u0004Gz\u000BzR\u000B{i\tcf\n{Z\n]n\u0004XA\u000BGu\u000BnU\thS\u000BGI\nCc\tHE\bTA\tHB\u0004BH\u0004Cj\nCc\bTF\tHE\nXI\tA{\bQ\u007F\tc\\\u000BmO\u000BWX\nfH\np@\u0005MY\bTF\nlK\tBt\nzU\tTT\u0004Km\u000BwT\npV\ndt\u000ByI\tVx\tQ\u007F\tRg\tTd\nzU\bRS\nLM\twA\u0004nM\tTn\ndS\t]g\nLc\u000BwB\t}t\t[I\tCP\u0004kX\u000BFm\u000BhZ\u0005m\u007F\ti[\np@\u000BQ}\u000BW\u007F\t|d\nMO\nMd\tf_\tfD\tcJ\tHz\u000BRb\tio\tPy\u0004Y[\nxU\tct\u000B@@\tww\bPv\u0004BM\u0004FF\ntb\u0005v|\u000BKm\tBq\tBq\u0004Kh\u0004`o\nZd\u0004XU\ti]\t|`\tSt\u0004B\\\bQ\u007F\u000B_W\tTJ\nqI\t|a\tA{\u000BuP\u0004MD\tPl\nxR\tfL\u000Bws\tc{\td\\\bV`\neg\tHK\u0005kc\nd|\bVV\ny\\\u0005kc\ti]\bVG\t`V\tss\tI_\tAE\tbs\tdu\nel\tpD\u000BW\u007F\nqs\u0005lv\bSM\u0004Zi\u000BVK\u0005ia\u000BQB\tQ\u007F\n{Z\bPt\u000BKl\nlK\nhs\ndS\bVK\u0005mf\nd^\tkV\tcO\nc|\bVH\t\\]\bTv\bSq\tmI\u000BDg\tVJ\tcn\ny\\\bVg\bTv\nyX\bTF\t]]\bTp\noi\nhs\u000BeU\nBf\tdj\u0005Mr\n|p\t\\g\t]r\bVb\u0005{D\nd[\u0004XN\tfM\tO\\\u0005s_\tcf\tiZ\u0004XN\u000BWc\tqv\n`m\tU^\u0005oD\nd|\u000BGg\tdE\u000Bwf\u0004lo\u0004u}\nd|\u0005oQ\t`i\u0004Oi\u000BxD\ndZ\nCx\u0004Yw\nzk\ntb\ngw\tyj\tB`\nyX\u000Bps\ntC\u000BpP\u000Bqw\bPu\bPX\tDm\npw\u0005Nj\tss\taG\u000Bxs\bPt\noL\u0004Gz\tOk\ti@\ti]\u0004eC\tIQ\tii\tdj\u000B@J\t|d\u0005uh\bWZ\u000BeU\u000BnU\bTa\tcC\u0004g]\nzk\u0004Yh\bVK\nLU\np@\ntb\ntR\tCj\u000BNP\ti@\bP{\n\\}\n{c\nwX\tfL\bVG\tc{\t|`\tAJ\t|C\tfD\u0005ln\t|d\tbs\nqI\u0005{B\u000BAx\np@\nzk\u000BRb\u0005Os\u000BWS\u0004e^\u000BD_\tBv\u000BWd\bVb\u000Bxs\u000BeE\bRw\n]n\n|p\u000Bg|\tfw\u0005kc\bTI\u0005ka\n\\T\u0004Sp\tju\u000Bps\npe\u0005u|\u000BGr\bVe\tCU\u0004]M\u0004XU\u000BxD\bTa\tIQ\u000BWq\tCU\tam\tdj\bSo\u0004Sw\u000BnU\u0004Ch\tQ]\u0005s_\bPt\tfS\bTa\t\\}\n@O\u0004Yc\tUZ\bTx\npe\u000BnU\nzU\t|}\tiD\nz\\\bSM\u000BxD\u0004BR\nzQ\tQN\u0004]M\u0004Yh\nLP\u000BFm\u000BLX\u0005vc\u000Bql\u0005ka\tHK\bVb\ntC\nCy\bTv\nuV\u0004oQ\t`z\t[I\tB`\u000BRb\tyj\tsb\u000BWs\bTl\tkV\u000Bed\ne\u007F\u0005lL\u000BxN\t\u007Fm\nJn\tjY\u000BxD\bVb\bSq\u000Byu\twL\u000BXL\bTA\tpg\tAt\tnD\u0004XX\twR\npl\nhw\u0005yS\nps\tcO\bW[\u000B|j\u0004XN\tsV\tp\\\tBe\nb~\nAJ\n]e\u0005k`\u0005qN\tdw\tWV\tHE\u000BEV\u0005Jz\tid\tB`\tzh\u0005E]\tfD\bTg\u0005qN\bTa\tja\u0004Cv\bSM\nhc\bUe\u0005t_\tie\u0004g]\twQ\nPn\bVB\tjw\bVg\u000BbE\tBZ\u000BRH\bP{\tjp\n\\}\ta_\tcC\t|a\u000BD]\tBZ\ti[\tfD\u000BxW\no_\td\\\n_D\ntb\t\\c\tAJ\nlK\u0004oQ\u0004lo\u000BLx\u000BM@\bWZ\u0004Kn\u000Bpg\nTi\nIv\n|r\u000B@}\u0005Jz\u0005Lm\u0005Wh\u0005k}\u0005ln\u000BxD\n]s\u0004gc\u000Bps\tBr\bTW\u000BBM\u0005tZ\nBY\u0004DW\tjf\u000BSW\u0004C}\nqo\tdE\tmv\tIQ\bPP\bUb\u0005lv\u0004BC\nzQ\t[I\u000Bgl\nig\bUs\u0004BT\u000BbC\bSq\tsU\tiW\nJn\tSY\tHK\trg\npV\u000BID\u000B|j\u0004KO\t`S\t|a`vbmglfmujbqnbgqjgavp`bqjmj`jlwjfnslslqrvf`vfmwbfpwbglsvfgfmivfdlp`lmwqbfpw/Mmmlnaqfwjfmfmsfqejonbmfqbbnjdlp`jvgbg`fmwqlbvmrvfsvfgfpgfmwqlsqjnfqsqf`jlpfd/Vmavfmlpuloufqsvmwlppfnbmbkba/Abbdlpwlmvfulpvmjglp`bqolpfrvjslmj/]lpnv`klpbodvmb`lqqfljnbdfmsbqwjqbqqjabnbq/Abklnaqffnsoflufqgbg`bnajlnv`kbpevfqlmsbpbglo/Amfbsbqf`fmvfubp`vqplpfpwbabrvjfqlojaqlp`vbmwlb``fplnjdvfoubqjlp`vbwqlwjfmfpdqvslppfq/Mmfvqlsbnfgjlpeqfmwfb`fq`bgfn/Mplefqwb`l`kfpnlgfoljwbojbofwqbpbod/Vm`lnsqb`vbofpf{jpwf`vfqslpjfmglsqfmpboofdbqujbifpgjmfqlnvq`jbslgq/Msvfpwlgjbqjlsvfaolrvjfqfnbmvfosqlsjl`qjpjp`jfqwlpfdvqlnvfqwfevfmwf`fqqbqdqbmgffef`wlsbqwfpnfgjgbsqlsjbleqf`fwjfqqbf.nbjoubqjbpelqnbpevwvqllaifwlpfdvjqqjfpdlmlqnbpnjpnlp/Vmj`l`bnjmlpjwjlpqby/_mgfajglsqvfabwlofglwfm/Abifp/Vpfpsfql`l`jmblqjdfmwjfmgb`jfmwl`/Mgjykbaobqpfq/Abobwjmbevfqybfpwjoldvfqqbfmwqbq/E{jwlo/_sfybdfmgbu/Agflfujwbqsbdjmbnfwqlpibujfqsbgqfpe/M`jo`bafyb/Mqfbppbojgbfmu/Alibs/_mbavplpajfmfpwf{wlpoofubqsvfgbmevfqwf`ln/Vm`obpfpkvnbmlwfmjglajoablvmjgbgfpw/Mpfgjwbq`qfbgl2%bns8Kjpwlqz#>#mft#@fmwqbovsgbwfgPsf`jboMfwtlqhqfrvjqf`lnnfmwtbqmjmd@loofdfwlloabqqfnbjmpaf`bvpffof`wfgGfvwp`kejmbm`ftlqhfqprvj`hozafwtffmf{b`wozpfwwjmdgjpfbpfPl`jfwztfbslmpf{kjajw%ow8\"..@lmwqlo`obppfp`lufqfglvwojmfbwwb`hpgfuj`fp+tjmgltsvqslpfwjwof>!Nlajof#hjoojmdpkltjmdJwbojbmgqlssfgkfbujozfeef`wp.2$^*8\t`lmejqn@vqqfmwbgubm`fpkbqjmdlsfmjmdgqbtjmdajoojlmlqgfqfgDfqnbmzqfobwfg?,elqn=jm`ovgftkfwkfqgfejmfgP`jfm`f`bwboldBqwj`ofavwwlmpobqdfpwvmjelqnilvqmfzpjgfabq@kj`bdlklojgbzDfmfqbosbppbdf/%rvlw8bmjnbwfeffojmdbqqjufgsbppjmdmbwvqboqlvdkoz-\t\tWkf#avw#mlwgfmpjwzAqjwbjm@kjmfpfob`h#lewqjavwfJqfobmg!#gbwb.eb`wlqpqf`fjufwkbw#jpOjaqbqzkvpabmgjm#eb`wbeebjqp@kbqofpqbgj`boaqlvdkwejmgjmdobmgjmd9obmd>!qfwvqm#ofbgfqpsobmmfgsqfnjvnsb`hbdfBnfqj`bFgjwjlm^%rvlw8Nfppbdfmffg#wlubovf>!`lnsof{ollhjmdpwbwjlmafojfufpnboofq.nlajofqf`lqgptbmw#wlhjmg#leEjqfel{zlv#bqfpjnjobqpwvgjfgnb{jnvnkfbgjmdqbsjgoz`ojnbwfhjmdglnfnfqdfgbnlvmwpelvmgfgsjlmffqelqnvobgzmbpwzklt#wl#Pvsslqwqfufmvff`lmlnzQfpvowpaqlwkfqplogjfqobqdfoz`boojmd-%rvlw8B``lvmwFgtbqg#pfdnfmwQlafqw#feelqwpSb`jej`ofbqmfgvs#tjwkkfjdkw9tf#kbufBmdfofpmbwjlmp\\pfbq`kbssojfgb`rvjqfnbppjufdqbmwfg9#ebopfwqfbwfgajddfpwafmfejwgqjujmdPwvgjfpnjmjnvnsfqkbspnlqmjmdpfoojmdjp#vpfgqfufqpfubqjbmw#qlof>!njppjmdb`kjfufsqlnlwfpwvgfmwplnflmff{wqfnfqfpwlqfalwwln9fuloufgboo#wkfpjwfnbsfmdojpktbz#wl##Bvdvpwpznalop@lnsbmznbwwfqpnvpj`bobdbjmpwpfqujmd~*+*8\u000E\tsbznfmwwqlvaof`lm`fsw`lnsbqfsbqfmwpsobzfqpqfdjlmpnlmjwlq#$$Wkf#tjmmjmdf{solqfbgbswfgDboofqzsqlgv`fbajojwzfmkbm`f`bqffqp*-#Wkf#`loof`wPfbq`k#bm`jfmwf{jpwfgellwfq#kbmgofqsqjmwfg`lmplofFbpwfqmf{slqwptjmgltp@kbmmfojoofdbomfvwqbopvddfpw\\kfbgfqpjdmjmd-kwno!=pfwwofgtfpwfqm`bvpjmd.tfahjw`objnfgIvpwj`f`kbswfquj`wjnpWklnbp#nlyjoobsqlnjpfsbqwjfpfgjwjlmlvwpjgf9ebopf/kvmgqfgLoznsj`\\avwwlmbvwklqpqfb`kfg`kqlmj`gfnbmgppf`lmgpsqlwf`wbglswfgsqfsbqfmfjwkfqdqfbwozdqfbwfqlufqboojnsqluf`lnnbmgpsf`jbopfbq`k-tlqpkjsevmgjmdwklvdkwkjdkfpwjmpwfbgvwjojwzrvbqwfq@vowvqfwfpwjmd`ofbqozf{slpfgAqltpfqojafqbo~#`bw`kSqlif`wf{bnsofkjgf+*8EolqjgbbmptfqpbooltfgFnsfqlqgfefmpfpfqjlvpeqffglnPfufqbo.avwwlmEvqwkfqlvw#le#\">#mvoowqbjmfgGfmnbqhuljg+3*,boo-ipsqfufmwQfrvfpwPwfskfm\t\tTkfm#lapfquf?,k1=\u000E\tNlgfqm#sqlujgf!#bow>!alqgfqp-\t\tElq#\t\tNbmz#bqwjpwpsltfqfgsfqelqnej`wjlmwzsf#lenfgj`bowj`hfwplsslpfg@lvm`jotjwmfppivpwj`fDflqdf#Afodjvn---?,b=wtjwwfqmlwbaoztbjwjmdtbqebqf#Lwkfq#qbmhjmdskqbpfpnfmwjlmpvqujufp`klobq?,s=\u000E\t#@lvmwqzjdmlqfgolpp#leivpw#bpDflqdjbpwqbmdf?kfbg=?pwlssfg2$^*8\u000E\tjpobmgpmlwbaofalqgfq9ojpw#le`bqqjfg233/333?,k0=\t#pfufqboaf`lnfppfof`w#tfggjmd33-kwnonlmbq`klee#wkfwfb`kfqkjdkoz#ajloldzojef#lelq#fufmqjpf#le%qbrvl8sovplmfkvmwjmd+wklvdkGlvdobpiljmjmd`jq`ofpElq#wkfBm`jfmwUjfwmbnufkj`ofpv`k#bp`qzpwboubovf#>Tjmgltpfmilzfgb#pnboobppvnfg?b#jg>!elqfjdm#Boo#qjklt#wkfGjpsobzqfwjqfgkltfufqkjggfm8abwwofppffhjmd`b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qslqwpff#wkfpl#wkbwNj`kbfoPzpwfnpSqldqbnp/#bmg##tjgwk>f%rvlw8wqbgjmdofew!=\tsfqplmpDlogfm#Beebjqpdqbnnbqelqnjmdgfpwqlzjgfb#le`bpf#lelogfpw#wkjp#jp-pq`#>#`bqwllmqfdjpwq@lnnlmpNvpojnpTkbw#jpjm#nbmznbqhjmdqfufbopJmgffg/frvbooz,pklt\\blvwgllqfp`bsf+Bvpwqjbdfmfwj`pzpwfn/Jm#wkf#pjwwjmdKf#boplJpobmgpB`bgfnz\t\n\n?\"..Gbmjfo#ajmgjmdaol`h!=jnslpfgvwjojyfBaqbkbn+f{`fswxtjgwk9svwwjmd*-kwno+\u007F\u007F#X^8\tGBWBX#)hjw`kfmnlvmwfgb`wvbo#gjbof`wnbjmoz#\\aobmh$jmpwboof{sfqwpje+wzsfJw#bopl%`lsz8#!=Wfqnpalqm#jmLswjlmpfbpwfqmwbohjmd`lm`fqmdbjmfg#lmdljmdivpwjez`qjwj`peb`wlqzjwp#ltmbppbvowjmujwfgobpwjmdkjp#ltmkqfe>!,!#qfo>!gfufols`lm`fqwgjbdqbngloobqp`ovpwfqsksbo`lklo*8~*+*8vpjmd#b=?psbm=ufppfopqfujuboBggqfppbnbwfvqbmgqljgboofdfgjoomfpptbohjmd`fmwfqprvbojeznbw`kfpvmjejfgf{wjm`wGfefmpfgjfg#jm\t\n?\"..#`vpwlnpojmhjmdOjwwof#Allh#lefufmjmdnjm-iptfbqjmdBoo#Qjd8\t~*+*8qbjpjmd#Bopl/#`qv`jbobalvw!=gf`obqf..=\t?p`ejqfel{bp#nv`kbssojfpjmgf{/#p/#avw#wzsf#>#\t\u000E\t?\"..wltbqgpQf`lqgpSqjubwfElqfjdmSqfnjfq`klj`fpUjqwvboqfwvqmp@lnnfmwSltfqfgjmojmf8slufqwz`kbnafqOjujmd#ulovnfpBmwklmzoldjm!#QfobwfgF`lmlnzqfb`kfp`vwwjmddqbujwzojef#jm@kbswfq.pkbgltMlwbaof?,wg=\u000E\t#qfwvqmpwbgjvntjgdfwpubqzjmdwqbufopkfog#aztkl#bqftlqh#jmeb`vowzbmdvobqtkl#kbgbjqslqwwltm#le\t\tPlnf#$`oj`h$`kbqdfphfztlqgjw#tjoo`jwz#le+wkjp*8Bmgqft#vmjrvf#`kf`hfglq#nlqf033s{8#qfwvqm8qpjlm>!sovdjmptjwkjm#kfqpfoePwbwjlmEfgfqboufmwvqfsvaojpkpfmw#wlwfmpjlmb`wqfpp`lnf#wlejmdfqpGvhf#lesflsof/f{soljwtkbw#jpkbqnlmzb#nbilq!9!kwwsjm#kjp#nfmv!=\tnlmwkozleej`fq`lvm`jodbjmjmdfufm#jmPvnnbqzgbwf#leolzbowzejwmfppbmg#tbpfnsfqlqpvsqfnfPf`lmg#kfbqjmdQvppjbmolmdfpwBoafqwbobwfqbopfw#le#pnboo!=-bssfmggl#tjwkefgfqboabmh#leafmfbwkGfpsjwf@bsjwbodqlvmgp*/#bmg#sfq`fmwjw#eqln`olpjmd`lmwbjmJmpwfbgejewffmbp#tfoo-zbkll-qfpslmgejdkwfqlap`vqfqfeof`wlqdbmj`>#Nbwk-fgjwjmdlmojmf#sbggjmdb#tkloflmfqqlqzfbq#lefmg#le#abqqjfqtkfm#jwkfbgfq#klnf#leqfpvnfgqfmbnfgpwqlmd=kfbwjmdqfwbjmp`olvgeqtbz#le#Nbq`k#2hmltjmdjm#sbqwAfwtffmofpplmp`olpfpwujqwvboojmhp!=`qlppfgFMG#..=ebnlvp#btbqgfgOj`fmpfKfbowk#ebjqoz#tfbowkznjmjnboBeqj`bm`lnsfwfobafo!=pjmdjmdebqnfqpAqbpjo*gjp`vppqfsob`fDqfdlqzelmw#`lsvqpvfgbssfbqpnbhf#vsqlvmgfgalwk#leaol`hfgpbt#wkfleej`fp`lolvqpje+gl`vtkfm#kffmelq`fsvpk+evBvdvpw#VWE.;!=Ebmwbpzjm#nlpwjmivqfgVpvboozebqnjmd`olpvqflaif`w#gfefm`fvpf#le#Nfgj`bo?algz=\tfujgfmwaf#vpfghfz@lgfpj{wffmJpobnj` 333333fmwjqf#tjgfoz#b`wjuf#+wzsflelmf#`bm`lolq#>psfbhfqf{wfmgpSkzpj`pwfqqbjm?walgz=evmfqboujftjmdnjggof#`qj`hfwsqlskfwpkjewfggl`wlqpQvppfoo#wbqdfw`lnsb`wbodfaqbpl`jbo.avoh#lenbm#bmg?,wg=\t#kf#ofew*-ubo+*ebopf*8oldj`boabmhjmdklnf#wlmbnjmd#Bqjylmb`qfgjwp*8\t~*8\telvmgfqjm#wvqm@loojmpafelqf#Avw#wkf`kbqdfgWjwof!=@bswbjmpsfoofgdlggfppWbd#..=Bggjmd9avw#tbpQf`fmw#sbwjfmwab`h#jm>ebopf%Ojm`lomtf#hmlt@lvmwfqIvgbjpnp`qjsw#bowfqfg$^*8\t##kbp#wkfvm`ofbqFufmw$/alwk#jmmlw#boo\t\t?\"..#sob`jmdkbqg#wl#`fmwfqplqw#le`ojfmwppwqffwpAfqmbqgbppfqwpwfmg#wlebmwbpzgltm#jmkbqalvqEqffglniftfoqz,balvw--pfbq`kofdfmgpjp#nbgfnlgfqm#lmoz#lmlmoz#wljnbdf!#ojmfbq#sbjmwfqbmg#mlwqbqfoz#b`qlmzngfojufqpklqwfq33%bns8bp#nbmztjgwk>!,)#?\"X@wjwof#>le#wkf#oltfpw#sj`hfg#fp`bsfgvpfp#lesflsofp#Svaoj`Nbwwkftwb`wj`pgbnbdfgtbz#elqobtp#lefbpz#wl#tjmgltpwqlmd##pjnsof~`bw`k+pfufmwkjmelal{tfmw#wlsbjmwfg`jwjyfmJ#glm$wqfwqfbw-#Plnf#tt-!*8\talnajmdnbjowl9nbgf#jm-#Nbmz#`bqqjfp\u007F\u007Fx~8tjtlqh#lepzmlmzngfefbwpebulqfglswj`bosbdfWqbvmofpp#pfmgjmdofew!=?`lnP`lqBoo#wkfiRvfqz-wlvqjpw@obppj`ebopf!#Tjokfonpvavqapdfmvjmfajpklsp-psojw+dolabo#elooltpalgz#lemlnjmbo@lmwb`wpf`vobqofew#wl`kjfeoz.kjggfm.abmmfq?,oj=\t\t-#Tkfm#jm#alwkgjpnjppF{solqfbotbzp#ujb#wkfpsb/]lotfoebqfqvojmd#bqqbmdf`bswbjmkjp#plmqvof#lekf#wllhjwpfoe/>3%bns8+`boofgpbnsofpwl#nbhf`ln,sbdNbqwjm#Hfmmfgzb``fswpevoo#lekbmgofgAfpjgfp,,..=?,baof#wlwbqdfwpfppfm`fkjn#wl#jwp#az#`lnnlm-njmfqbowl#wbhftbzp#wlp-lqd,obgujpfgsfmbowzpjnsof9je#wkfzOfwwfqpb#pklqwKfqafqwpwqjhfp#dqlvsp-ofmdwkeojdkwplufqobspoltoz#ofppfq#pl`jbo#?,s=\t\n\njw#jmwlqbmhfg#qbwf#levo=\u000E\t##bwwfnswsbjq#lenbhf#jwHlmwbhwBmwlmjlkbujmd#qbwjmdp#b`wjufpwqfbnpwqbssfg!*-`pp+klpwjofofbg#wlojwwof#dqlvsp/Sj`wvqf..=\u000E\t\u000E\t#qltp>!#laif`wjmufqpf?ellwfq@vpwlnU=?_,p`qploujmd@kbnafqpobufqztlvmgfgtkfqfbp\">#$vmgelq#boosbqwoz#.qjdkw9Bqbajbmab`hfg#`fmwvqzvmjw#lenlajof.Fvqlsf/jp#klnfqjph#legfpjqfg@ojmwlm`lpw#lebdf#le#af`lnf#mlmf#les%rvlw8Njggof#fbg$*X3@qjwj`ppwvgjlp=%`lsz8dqlvs!=bppfnaonbhjmd#sqfppfgtjgdfw-sp9!#<#qfavjowaz#plnfElqnfq#fgjwlqpgfobzfg@bmlmj`kbg#wkfsvpkjmd`obpp>!avw#bqfsbqwjboAbazolmalwwln#`bqqjfq@lnnbmgjwp#vpfBp#tjwk`lvqpfpb#wkjqggfmlwfpbopl#jmKlvpwlm13s{8!=b``vpfgglvaof#dlbo#leEbnlvp#*-ajmg+sqjfpwp#Lmojmfjm#Ivozpw#(#!d`lmpvowgf`jnbokfosevoqfujufgjp#ufqzq$($jsw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oltjmdobpwfg#qjpf#jmDfmfpjpujft#leqjpjmd#pffn#wlavw#jm#ab`hjmdkf#tjoodjufm#bdjujmd#`jwjfp-eolt#le#Obwfq#boo#avwKjdktbzlmoz#azpjdm#lekf#glfpgjeefqpabwwfqz%bns8obpjmdofpwkqfbwpjmwfdfqwbhf#lmqfevpfg`boofg#>VP%bnsPff#wkfmbwjufpaz#wkjppzpwfn-kfbg#le9klufq/ofpajbmpvqmbnfbmg#boo`lnnlm,kfbgfq\\\\sbqbnpKbqubqg,sj{fo-qfnlubopl#olmdqlof#leiljmwozphzp`qbVmj`lgfaq#,=\u000E\tBwobmwbmv`ofvp@lvmwz/svqfoz#`lvmw!=fbpjoz#avjog#blm`oj`hb#djufmsljmwfqk%rvlw8fufmwp#fopf#x\tgjwjlmpmlt#wkf/#tjwk#nbm#tkllqd,Tfalmf#bmg`buboqzKf#gjfgpfbwwof33/333#xtjmgltkbuf#wlje+tjmgbmg#jwpplofoz#n%rvlw8qfmftfgGfwqljwbnlmdpwfjwkfq#wkfn#jmPfmbwlqVp?,b=?Hjmd#leEqbm`jp.sqlgv`kf#vpfgbqw#bmgkjn#bmgvpfg#azp`lqjmdbw#klnfwl#kbufqfobwfpjajojwzeb`wjlmAveebolojmh!=?tkbw#kfeqff#wl@jwz#le`lnf#jmpf`wlqp`lvmwfglmf#gbzmfqulvpprvbqf#~8je+dljm#tkbwjnd!#bojp#lmozpfbq`k,wvfpgbzollpfozPlolnlmpf{vbo#.#?b#kqnfgjvn!GL#MLW#Eqbm`f/tjwk#b#tbq#bmgpf`lmg#wbhf#b#=\u000E\t\u000E\t\u000E\tnbqhfw-kjdktbzglmf#jm`wjujwz!obpw!=laojdfgqjpf#wl!vmgfejnbgf#wl#Fbqoz#sqbjpfgjm#jwp#elq#kjpbwkofwfIvsjwfqZbkll\"#wfqnfg#pl#nbmzqfbooz#p-#Wkf#b#tlnbmgjqf`w#qjdkw!#aj`z`ofb`jmd>!gbz#bmgpwbwjmdQbwkfq/kjd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fmpfmwjglujpjwbpw/Awvol`lml`fqpfdvmgl`lmpfileqbm`jbnjmvwlppfdvmgbwfmfnlpfef`wlpn/Mobdbpfpj/_mqfujpwbdqbmbgb`lnsqbqjmdqfpldbq`/Abb``j/_mf`vbglqrvjfmfpjm`ovplgfafq/Mnbwfqjbklnaqfpnvfpwqbslgq/Abnb/]bmb/Vowjnbfpwbnlplej`jbowbnajfmmjmd/Vmpbovglpslgfnlpnfilqbqslpjwjlmavpjmfppklnfsbdfpf`vqjwzobmdvbdfpwbmgbqg`bnsbjdmefbwvqfp`bwfdlqzf{wfqmbo`kjogqfmqfpfqufgqfpfbq`kf{`kbmdfebulqjwfwfnsobwfnjojwbqzjmgvpwqzpfquj`fpnbwfqjbosqlgv`wpy.jmgf{9`lnnfmwpplewtbqf`lnsofwf`bofmgbqsobwelqnbqwj`ofpqfrvjqfgnlufnfmwrvfpwjlmavjogjmdslojwj`pslppjaofqfojdjlmskzpj`boeffgab`hqfdjpwfqsj`wvqfpgjpbaofgsqlwl`lobvgjfm`fpfwwjmdpb`wjujwzfofnfmwpofbqmjmdbmzwkjmdbapwqb`wsqldqfpplufqujftnbdbyjmff`lmlnj`wqbjmjmdsqfppvqfubqjlvp#?pwqlmd=sqlsfqwzpklssjmdwldfwkfqbgubm`fgafkbujlqgltmolbgefbwvqfgellwaboopfof`wfgObmdvbdfgjpwbm`fqfnfnafqwqb`hjmdsbpptlqgnlgjejfgpwvgfmwpgjqf`wozejdkwjmdmlqwkfqmgbwbabpfefpwjuboaqfbhjmdol`bwjlmjmwfqmfwgqlsgltmsqb`wj`ffujgfm`fevm`wjlmnbqqjbdfqfpslmpfsqlaofnpmfdbwjufsqldqbnpbmbozpjpqfofbpfgabmmfq!=svq`kbpfsloj`jfpqfdjlmbo`qfbwjufbqdvnfmwallhnbqhqfefqqfq`kfnj`bogjujpjlm`booab`hpfsbqbwfsqlif`wp`lmeoj`wkbqgtbqfjmwfqfpwgfojufqznlvmwbjmlawbjmfg>#ebopf8elq+ubq#b``fswfg`bsb`jwz`lnsvwfqjgfmwjwzbjq`qbewfnsolzfgsqlslpfgglnfpwj`jm`ovgfpsqlujgfgklpsjwboufqwj`bo`loobspfbssqlb`ksbqwmfqpoldl!=?bgbvdkwfqbvwklq!#`vowvqboebnjojfp,jnbdfp,bppfnaozsltfqevowfb`kjmdejmjpkfggjpwqj`w`qjwj`bo`dj.ajm,svqslpfpqfrvjqfpfof`wjlmaf`lnjmdsqlujgfpb`bgfnj`f{fq`jpfb`wvbooznfgj`jmf`lmpwbmwb``jgfmwNbdbyjmfgl`vnfmwpwbqwjmdalwwln!=lapfqufg9#%rvlw8f{wfmgfgsqfujlvpPlewtbqf`vpwlnfqgf`jpjlmpwqfmdwkgfwbjofgpojdkwozsobmmjmdwf{wbqfb`vqqfm`zfufqzlmfpwqbjdkwwqbmpefqslpjwjufsqlgv`fgkfqjwbdfpkjssjmdbaplovwfqf`fjufgqfofubmwavwwlm!#ujlofm`fbmztkfqfafmfejwpobvm`kfgqf`fmwozboojbm`felooltfgnvowjsofavoofwjmjm`ovgfgl``vqqfgjmwfqmbo'+wkjp*-qfsvaoj`=?wq=?wg`lmdqfppqf`lqgfgvowjnbwfplovwjlm?vo#jg>!gjp`lufqKlnf?,b=tfapjwfpmfwtlqhpbowklvdkfmwjqfoznfnlqjbonfppbdfp`lmwjmvfb`wjuf!=plnftkbwuj`wlqjbTfpwfqm##wjwof>!Ol`bwjlm`lmwqb`wujpjwlqpGltmolbgtjwklvw#qjdkw!=\tnfbpvqfptjgwk#>#ubqjbaofjmuloufgujqdjmjbmlqnboozkbssfmfgb``lvmwppwbmgjmdmbwjlmboQfdjpwfqsqfsbqfg`lmwqlopb``vqbwfajqwkgbzpwqbwfdzleej`jbodqbskj`p`qjnjmboslppjaoz`lmpvnfqSfqplmbopsfbhjmdubojgbwfb`kjfufg-isd!#,=nb`kjmfp?,k1=\t##hfztlqgpeqjfmgozaqlwkfqp`lnajmfglqjdjmbo`lnslpfgf{sf`wfgbgfr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f!#pjyf>!sbdfMbnfnjggof!#!#,=?,b=kjggfm!=pfrvfm`fsfqplmbolufqeoltlsjmjlmpjoojmljpojmhp!=\t\n?wjwof=ufqpjlmppbwvqgbzwfqnjmbojwfnsqlsfmdjmffqpf`wjlmpgfpjdmfqsqlslpbo>!ebopf!Fpsb/]loqfofbpfppvanjw!#fq%rvlw8bggjwjlmpznswlnplqjfmwfgqfplvq`fqjdkw!=?sofbpvqfpwbwjlmpkjpwlqz-ofbujmd##alqgfq>`lmwfmwp`fmwfq!=-\t\tPlnf#gjqf`wfgpvjwbaofavodbqjb-pklt+*8gfpjdmfgDfmfqbo#`lm`fswpF{bnsofptjoojbnpLqjdjmbo!=?psbm=pfbq`k!=lsfqbwlqqfrvfpwpb#%rvlw8booltjmdGl`vnfmwqfujpjlm-#\t\tWkf#zlvqpfoe@lmwb`w#nj`kjdbmFmdojpk#`lovnajbsqjlqjwzsqjmwjmdgqjmhjmdeb`jojwzqfwvqmfg@lmwfmw#leej`fqpQvppjbm#dfmfqbwf.;;6:.2!jmgj`bwfebnjojbq#rvbojwznbqdjm93#`lmwfmwujftslqw`lmwb`wp.wjwof!=slqwbaof-ofmdwk#fojdjaofjmuloufpbwobmwj`lmolbg>!gfebvow-pvssojfgsbznfmwpdolppbqz\t\tBewfq#dvjgbm`f?,wg=?wgfm`lgjmdnjggof!=`bnf#wl#gjpsobzpp`lwwjpkilmbwkbmnbilqjwztjgdfwp-`ojmj`bowkbjobmgwfb`kfqp?kfbg=\t\nbeef`wfgpvsslqwpsljmwfq8wlPwqjmd?,pnboo=lhobklnbtjoo#af#jmufpwlq3!#bow>!klojgbzpQfplvq`foj`fmpfg#+tkj`k#-#Bewfq#`lmpjgfqujpjwjmdf{solqfqsqjnbqz#pfbq`k!#bmgqljg!rvj`hoz#nffwjmdpfpwjnbwf8qfwvqm#8`lolq9 #kfjdkw>bssqlubo/#%rvlw8#`kf`hfg-njm-ip!nbdmfwj`=?,b=?,kelqf`bpw-#Tkjof#wkvqpgbzgufqwjpf%fb`vwf8kbp@obppfubovbwflqgfqjmdf{jpwjmdsbwjfmwp#Lmojmf#`lolqbglLswjlmp!`bnsafoo?\"..#fmg?,psbm=??aq#,=\u000E\t\\slsvsp\u007Fp`jfm`fp/%rvlw8#rvbojwz#Tjmgltp#bppjdmfgkfjdkw9#?a#`obppof%rvlw8#ubovf>!#@lnsbmzf{bnsofp?jeqbnf#afojfufpsqfpfmwpnbqpkboosbqw#le#sqlsfqoz*-\t\tWkf#wb{lmlnznv`k#le#?,psbm=\t!#gbwb.pqwvdv/Fpp`qlooWl#sqlif`w?kfbg=\u000E\tbwwlqmfzfnskbpjppslmplqpebm`zal{tlqog$p#tjogojef`kf`hfg>pfppjlmpsqldqbnns{8elmw.#Sqlif`wilvqmbopafojfufgub`bwjlmwklnsplmojdkwjmdbmg#wkf#psf`jbo#alqgfq>3`kf`hjmd?,walgz=?avwwlm#@lnsofwf`ofbqej{\t?kfbg=\tbqwj`of#?pf`wjlmejmgjmdpqlof#jm#slsvobq##L`wlafqtfapjwf#f{slpvqfvpfg#wl##`kbmdfplsfqbwfg`oj`hjmdfmwfqjmd`lnnbmgpjmelqnfg#mvnafqp##?,gju=`qfbwjmdlmPvanjwnbqzobmg`loofdfpbmbozwj`ojpwjmdp`lmwb`w-olddfgJmbgujplqzpjaojmdp`lmwfmw!p%rvlw8*p-#Wkjp#sb`hbdfp`kf`hal{pvddfpwpsqfdmbmwwlnlqqltpsb`jmd>j`lm-smdibsbmfpf`lgfabpfavwwlm!=dbnaojmdpv`k#bp#/#tkjof#?,psbm=#njpplvqjpslqwjmdwls92s{#-?,psbm=wfmpjlmptjgwk>!1obyzolbgmlufnafqvpfg#jm#kfjdkw>!`qjsw!=\t%maps8?,?wq=?wg#kfjdkw91,sqlgv`w`lvmwqz#jm`ovgf#ellwfq!#%ow8\"..#wjwof!=?,irvfqz-?,elqn=\t+\u000BBl\bQ\u007F*+\u000BUm\u0005Gx*kqubwphjjwbojbmlqln/Nm(ow/Pq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frvjfqfw/E`mj`lgfafq/Abujujfmgbejmbmybpbgfobmwfevm`jlmb`lmpfilpgje/A`jo`jvgbgfpbmwjdvbpbubmybgbw/Eqnjmlvmjgbgfpp/Mm`kfy`bnsb/]bplewlmj`qfujpwbp`lmwjfmfpf`wlqfpnlnfmwlpeb`vowbg`q/Egjwlgjufqpbppvsvfpwleb`wlqfppfdvmglpsfrvf/]b<_!?,pfof`w=Bvpwqbojb!#`obpp>!pjwvbwjlmbvwklqjwzelooltjmdsqjnbqjozlsfqbwjlm`kboofmdfgfufolsfgbmlmznlvpevm`wjlm#evm`wjlmp`lnsbmjfppwqv`wvqfbdqffnfmw!#wjwof>!slwfmwjbofgv`bwjlmbqdvnfmwppf`lmgbqz`lszqjdkwobmdvbdfpf{`ovpjuf`lmgjwjlm?,elqn=\u000E\tpwbwfnfmwbwwfmwjlmAjldqbskz~#fopf#x\tplovwjlmptkfm#wkf#Bmbozwj`pwfnsobwfpgbmdfqlvppbwfoojwfgl`vnfmwpsvaojpkfqjnslqwbmwsqlwlwzsfjmeovfm`f%qbrvl8?,feef`wjufdfmfqboozwqbmpelqnafbvwjevowqbmpslqwlqdbmjyfgsvaojpkfgsqlnjmfmwvmwjo#wkfwkvnambjoMbwjlmbo#-el`vp+*8lufq#wkf#njdqbwjlmbmmlvm`fgellwfq!=\tf{`fswjlmofpp#wkbmf{sfmpjufelqnbwjlmeqbnftlqhwfqqjwlqzmgj`bwjlm`vqqfmwoz`obppMbnf`qjwj`jpnwqbgjwjlmfopftkfqfBof{bmgfqbssljmwfgnbwfqjbopaqlbg`bpwnfmwjlmfgbeejojbwf?,lswjlm=wqfbwnfmwgjeefqfmw,gfebvow-Sqfpjgfmwlm`oj`h>!ajldqbskzlwkfqtjpfsfqnbmfmwEqbm/KbjpKlooztllgf{sbmpjlmpwbmgbqgp?,pwzof=\tqfgv`wjlmGf`fnafq#sqfefqqfg@bnaqjgdflsslmfmwpAvpjmfpp#`lmevpjlm=\t?wjwof=sqfpfmwfgf{sobjmfgglfp#mlw#tlqogtjgfjmwfqeb`fslpjwjlmpmftpsbsfq?,wbaof=\tnlvmwbjmpojhf#wkf#fppfmwjboejmbm`jbopfof`wjlmb`wjlm>!,babmglmfgFgv`bwjlmsbqpfJmw+pwbajojwzvmbaof#wl?,wjwof=\tqfobwjlmpMlwf#wkbwfeej`jfmwsfqelqnfgwtl#zfbqpPjm`f#wkfwkfqfelqftqbssfq!=bowfqmbwfjm`qfbpfgAbwwof#lesfq`fjufgwqzjmd#wlmf`fppbqzslqwqbzfgfof`wjlmpFojybafwk?,jeqbnf=gjp`lufqzjmpvqbm`fp-ofmdwk8ofdfmgbqzDfldqbskz`bmgjgbwf`lqslqbwfplnfwjnfppfquj`fp-jmkfqjwfg?,pwqlmd=@lnnvmjwzqfojdjlvpol`bwjlmp@lnnjwwffavjogjmdpwkf#tlqogml#olmdfqafdjmmjmdqfefqfm`f`bmmlw#afeqfrvfm`zwzsj`boozjmwl#wkf#qfobwjuf8qf`lqgjmdsqfpjgfmwjmjwjboozwf`kmjrvfwkf#lwkfqjw#`bm#aff{jpwfm`fvmgfqojmfwkjp#wjnfwfofsklmfjwfnp`lsfsqb`wj`fpbgubmwbdf*8qfwvqm#Elq#lwkfqsqlujgjmdgfnl`qb`zalwk#wkf#f{wfmpjufpveefqjmdpvsslqwfg`lnsvwfqp#evm`wjlmsqb`wj`bopbjg#wkbwjw#nbz#afFmdojpk?,eqln#wkf#p`kfgvofggltmolbgp?,obafo=\tpvpsf`wfgnbqdjm9#3psjqjwvbo?,kfbg=\t\tnj`qlplewdqbgvboozgjp`vppfgkf#af`bnff{f`vwjufirvfqz-ipklvpfklog`lmejqnfgsvq`kbpfgojwfqboozgfpwqlzfgvs#wl#wkfubqjbwjlmqfnbjmjmdjw#jp#mlw`fmwvqjfpIbsbmfpf#bnlmd#wkf`lnsofwfgbodlqjwknjmwfqfpwpqfafoojlmvmgfejmfgfm`lvqbdfqfpjybaofjmuloujmdpfmpjwjufvmjufqpbosqlujpjlm+bowklvdkefbwvqjmd`lmgv`wfg*/#tkj`k#`lmwjmvfg.kfbgfq!=Efaqvbqz#mvnfqlvp#lufqeolt9`lnslmfmweqbdnfmwpf{`foofmw`lopsbm>!wf`kmj`bomfbq#wkf#Bgubm`fg#plvq`f#lef{sqfppfgKlmd#Hlmd#Eb`fallhnvowjsof#nf`kbmjpnfofubwjlmleefmpjuf?,elqn=\t\npslmplqfggl`vnfmw-lq#%rvlw8wkfqf#bqfwklpf#tklnlufnfmwpsql`fppfpgjeej`vowpvanjwwfgqf`lnnfmg`lmujm`fgsqlnlwjmd!#tjgwk>!-qfsob`f+`obppj`bo`lbojwjlmkjp#ejqpwgf`jpjlmpbppjpwbmwjmgj`bwfgfulovwjlm.tqbssfq!fmlvdk#wlbolmd#wkfgfojufqfg..=\u000E\t?\"..Bnfqj`bm#sqlwf`wfgMlufnafq#?,pwzof=?evqmjwvqfJmwfqmfw##lmaovq>!pvpsfmgfgqf`jsjfmwabpfg#lm#Nlqflufq/balojpkfg`loof`wfgtfqf#nbgffnlwjlmbofnfqdfm`zmbqqbwjufbgul`bwfps{8alqgfq`lnnjwwfggjq>!owq!fnsolzffpqfpfbq`k-#pfof`wfgpv``fpplq`vpwlnfqpgjpsobzfgPfswfnafqbgg@obpp+Eb`fallh#pvddfpwfgbmg#obwfqlsfqbwjmdfobalqbwfPlnfwjnfpJmpwjwvwf`fqwbjmozjmpwboofgelooltfqpIfqvpbofnwkfz#kbuf`lnsvwjmddfmfqbwfgsqlujm`fpdvbqbmwffbqajwqbqzqf`ldmjyftbmwfg#wls{8tjgwk9wkflqz#leafkbujlvqTkjof#wkffpwjnbwfgafdbm#wl#jw#af`bnfnbdmjwvgfnvpw#kbufnlqf#wkbmGjqf`wlqzf{wfmpjlmpf`qfwbqzmbwvqboozl``vqqjmdubqjbaofpdjufm#wkfsobwelqn-?,obafo=?ebjofg#wl`lnslvmgphjmgp#le#pl`jfwjfpbolmdpjgf#..%dw8\t\tplvwktfpwwkf#qjdk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btbz#eqlnnlof`vobqsqf`jpfozgjpploufgVmgfq#wkfufqpjlm>!=%maps8?,Jw#jp#wkf#Wkjp#jp#tjoo#kbuflqdbmjpnpplnf#wjnfEqjfgqj`ktbp#ejqpwwkf#lmoz#eb`w#wkbwelqn#jg>!sqf`fgjmdWf`kmj`boskzpj`jpwl``vqp#jmmbujdbwlqpf`wjlm!=psbm#jg>!plvdkw#wlafolt#wkfpvqujujmd~?,pwzof=kjp#gfbwkbp#jm#wkf`bvpfg#azsbqwjboozf{jpwjmd#vpjmd#wkftbp#djufmb#ojpw#leofufop#lemlwjlm#leLeej`jbo#gjpnjppfgp`jfmwjpwqfpfnaofpgvsoj`bwff{solpjufqf`lufqfgboo#lwkfqdboofqjfpxsbggjmd9sflsof#leqfdjlm#lebggqfppfpbppl`jbwfjnd#bow>!jm#nlgfqmpklvog#afnfwklg#leqfslqwjmdwjnfpwbnsmffgfg#wlwkf#Dqfbwqfdbqgjmdpffnfg#wlujftfg#bpjnsb`w#lmjgfb#wkbwwkf#Tlqogkfjdkw#lef{sbmgjmdWkfpf#bqf`vqqfmw!=`bqfevooznbjmwbjmp`kbqdf#le@obppj`bobggqfppfgsqfgj`wfgltmfqpkjs?gju#jg>!qjdkw!=\u000E\tqfpjgfm`fofbuf#wkf`lmwfmw!=bqf#lewfm##~*+*8\u000E\tsqlabaoz#Sqlefpplq.avwwlm!#qfpslmgfgpbzp#wkbwkbg#wl#afsob`fg#jmKvmdbqjbmpwbwvp#lepfqufp#bpVmjufqpbof{f`vwjlmbddqfdbwfelq#tkj`kjmef`wjlmbdqffg#wlkltfufq/#slsvobq!=sob`fg#lm`lmpwqv`wfof`wlqbopznalo#lejm`ovgjmdqfwvqm#wlbq`kjwf`w@kqjpwjbmsqfujlvp#ojujmd#jmfbpjfq#wlsqlefpplq\t%ow8\"..#feef`w#lebmbozwj`ptbp#wbhfmtkfqf#wkfwllh#lufqafojfe#jmBeqjhbbmpbp#ebq#bpsqfufmwfgtlqh#tjwkb#psf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hfp#wkfnv`k#ofppBnfqj`bmp-\t\tBewfq#/#avw#wkfNvpfvn#leolvjpjbmb+eqln#wkfnjmmfplwbsbqwj`ofpb#sql`fppGlnjmj`bmulovnf#leqfwvqmjmdgfefmpjuf33s{\u007Fqjdknbgf#eqlnnlvpflufq!#pwzof>!pwbwfp#le+tkj`k#jp`lmwjmvfpEqbm`jp`lavjogjmd#tjwklvw#btjwk#plnftkl#tlvogb#elqn#leb#sbqw#leafelqf#jwhmltm#bp##Pfquj`fpol`bwjlm#bmg#lewfmnfbpvqjmdbmg#jw#jpsbsfqab`hubovfp#le\u000E\t?wjwof=>#tjmglt-gfwfqnjmffq%rvlw8#sobzfg#azbmg#fbqoz?,`fmwfq=eqln#wkjpwkf#wkqffsltfq#bmgle#%rvlw8jmmfqKWNO?b#kqfe>!z9jmojmf8@kvq`k#lewkf#fufmwufqz#kjdkleej`jbo#.kfjdkw9#`lmwfmw>!,`dj.ajm,wl#`qfbwfbeqjhbbmpfpsfqbmwleqbm/Kbjpobwujf)Mvojfwvuj)_(`f)Mwjmb(af)Mwjmb\fUh\fT{\fTN\n{I\np@\u0004Fr\u000BBl\bQ\u007F\tA{\u000BUm\u0005Gx\tA{\u0001yp\u0006YA\u0000zX\bTV\bWl\bUd\u0004BM\u000BB{\npV\u000B@x\u0004B\\\np@\u0004Db\u0004Gz\tal\npa\tfM\tuD\bV~\u0004mx\u000BQ}\ndS\tp\\\bVK\bS]\bU|\u0005oD\tkV\u000Bed\u000BHR\nb~\u0004M`\nJp\u0005oD\u0004|Q\nLP\u0004Sw\bTl\nAI\nxC\bWt\tBq\u0005F`\u0004Cm\u000BLm\tKx\t}t\bPv\ny\\\naB\tV\u007F\nZd\u0004XU\u0004li\tfr\ti@\tBH\u0004BD\u0004BV\t`V\n[]\tp_\tTn\n~A\nxR\tuD\t`{\bV@\tTn\tHK\tAJ\u000Bxs\u0004Zf\nqI\u0004Zf\u000BBM\u000B|j\t}t\bSM\nmC\u000BQ}pfquj`jlpbqw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d?s#`obpp>!wf`kmloldzab`hdqlvmg?b#`obpp>!nbmbdfnfmw%`lsz8#132ibubP`qjsw`kbqb`wfqpaqfbg`qvnawkfnpfoufpklqjylmwbodlufqmnfmw@bojelqmjbb`wjujwjfpgjp`lufqfgMbujdbwjlmwqbmpjwjlm`lmmf`wjlmmbujdbwjlmbssfbqbm`f?,wjwof=?n`kf`hal{!#wf`kmjrvfpsqlwf`wjlmbssbqfmwozbp#tfoo#bpvmw$/#$VB.qfplovwjlmlsfqbwjlmpwfofujpjlmwqbmpobwfgTbpkjmdwlmmbujdbwlq-#>#tjmglt-jnsqfppjlm%ow8aq%dw8ojwfqbwvqfslsvobwjlmad`lolq>! fpsf`jbooz#`lmwfmw>!sqlgv`wjlmmftpofwwfqsqlsfqwjfpgfejmjwjlmofbgfqpkjsWf`kmloldzSbqojbnfmw`lnsbqjplmvo#`obpp>!-jmgf{Le+!`lm`ovpjlmgjp`vppjlm`lnslmfmwpajloldj`boQfulovwjlm\\`lmwbjmfqvmgfqpwllgmlp`qjsw=?sfqnjppjlmfb`k#lwkfqbwnlpskfqf#lmel`vp>!?elqn#jg>!sql`fppjmdwkjp-ubovfdfmfqbwjlm@lmefqfm`fpvapfrvfmwtfoo.hmltmubqjbwjlmpqfsvwbwjlmskfmlnfmlmgjp`jsojmfoldl-smd!#+gl`vnfmw/alvmgbqjfpf{sqfppjlmpfwwofnfmwAb`hdqlvmglvw#le#wkffmwfqsqjpf+!kwwsp9!#vmfp`bsf+!sbpptlqg!#gfnl`qbwj`?b#kqfe>!,tqbssfq!=\tnfnafqpkjsojmdvjpwj`s{8sbggjmdskjolplskzbppjpwbm`fvmjufqpjwzeb`jojwjfpqf`ldmjyfgsqfefqfm`fje#+wzsflenbjmwbjmfgul`bavobqzkzslwkfpjp-pvanjw+*8%bns8maps8bmmlwbwjlmafkjmg#wkfElvmgbwjlmsvaojpkfq!bppvnswjlmjmwqlgv`fg`lqqvswjlmp`jfmwjpwpf{soj`jwozjmpwfbg#legjnfmpjlmp#lm@oj`h>!`lmpjgfqfggfsbqwnfmwl``vsbwjlmpllm#bewfqjmufpwnfmwsqlmlvm`fgjgfmwjejfgf{sfqjnfmwNbmbdfnfmwdfldqbskj`!#kfjdkw>!ojmh#qfo>!-qfsob`f+,gfsqfppjlm`lmefqfm`fsvmjpknfmwfojnjmbwfgqfpjpwbm`fbgbswbwjlmlsslpjwjlmtfoo#hmltmpvssofnfmwgfwfqnjmfgk2#`obpp>!3s{8nbqdjmnf`kbmj`bopwbwjpwj`p`fofaqbwfgDlufqmnfmw\t\tGvqjmd#wgfufolsfqpbqwjej`jbofrvjubofmwlqjdjmbwfg@lnnjppjlmbwwb`knfmw?psbm#jg>!wkfqf#tfqfMfgfqobmgpafzlmg#wkfqfdjpwfqfgilvqmbojpweqfrvfmwozboo#le#wkfobmd>!fm!#?,pwzof=\u000E\tbaplovwf8#pvsslqwjmdf{wqfnfoz#nbjmpwqfbn?,pwqlmd=#slsvobqjwzfnsolznfmw?,wbaof=\u000E\t#`lopsbm>!?,elqn=\t##`lmufqpjlmbalvw#wkf#?,s=?,gju=jmwfdqbwfg!#obmd>!fmSlqwvdvfpfpvapwjwvwfjmgjujgvbojnslppjaofnvowjnfgjbbonlpw#boos{#plojg# bsbqw#eqlnpvaif`w#wljm#Fmdojpk`qjwj`jyfgf{`fsw#elqdvjgfojmfplqjdjmboozqfnbqhbaofwkf#pf`lmgk1#`obpp>!?b#wjwof>!+jm`ovgjmdsbqbnfwfqpsqlkjajwfg>#!kwws9,,gj`wjlmbqzsfq`fswjlmqfulovwjlmelvmgbwjlms{8kfjdkw9pv``fppevopvsslqwfqpnjoofmmjvnkjp#ebwkfqwkf#%rvlw8ml.qfsfbw8`lnnfq`jbojmgvpwqjbofm`lvqbdfgbnlvmw#le#vmleej`jbofeej`jfm`zQfefqfm`fp`llqgjmbwfgjp`objnfqf{sfgjwjlmgfufolsjmd`bo`vobwfgpjnsojejfgofdjwjnbwfpvapwqjmd+3!#`obpp>!`lnsofwfozjoovpwqbwfejuf#zfbqpjmpwqvnfmwSvaojpkjmd2!#`obpp>!spz`kloldz`lmejgfm`fmvnafq#le#bapfm`f#leel`vpfg#lmiljmfg#wkfpwqv`wvqfpsqfujlvpoz=?,jeqbnf=lm`f#bdbjmavw#qbwkfqjnnjdqbmwple#`lvqpf/b#dqlvs#leOjwfqbwvqfVmojhf#wkf?,b=%maps8\tevm`wjlm#jw#tbp#wkf@lmufmwjlmbvwlnlajofSqlwfpwbmwbddqfppjufbewfq#wkf#Pjnjobqoz/!#,=?,gju=`loof`wjlm\u000E\tevm`wjlmujpjajojwzwkf#vpf#leulovmwffqpbwwqb`wjlmvmgfq#wkf#wkqfbwfmfg)?\"X@GBWBXjnslqwbm`fjm#dfmfqbowkf#obwwfq?,elqn=\t?,-jmgf{Le+$j#>#38#j#?gjeefqfm`fgfulwfg#wlwqbgjwjlmppfbq`k#elqvowjnbwfozwlvqmbnfmwbwwqjavwfppl.`boofg#~\t?,pwzof=fubovbwjlmfnskbpjyfgb``fppjaof?,pf`wjlm=pv``fppjlmbolmd#tjwkNfbmtkjof/jmgvpwqjfp?,b=?aq#,=kbp#af`lnfbpsf`wp#leWfofujpjlmpveej`jfmwabphfwabooalwk#pjgfp`lmwjmvjmdbm#bqwj`of?jnd#bow>!bgufmwvqfpkjp#nlwkfqnbm`kfpwfqsqjm`jsofpsbqwj`vobq`lnnfmwbqzfeef`wp#legf`jgfg#wl!=?pwqlmd=svaojpkfqpIlvqmbo#legjeej`vowzeb`jojwbwfb``fswbaofpwzof-`pp!\nevm`wjlm#jmmlubwjlm=@lszqjdkwpjwvbwjlmptlvog#kbufavpjmfppfpGj`wjlmbqzpwbwfnfmwplewfm#vpfgsfqpjpwfmwjm#Ibmvbqz`lnsqjpjmd?,wjwof=\t\ngjsolnbwj``lmwbjmjmdsfqelqnjmdf{wfmpjlmpnbz#mlw#af`lm`fsw#le#lm`oj`h>!Jw#jp#boplejmbm`jbo#nbhjmd#wkfOv{fnalvqdbggjwjlmbobqf#`boofgfmdbdfg#jm!p`qjsw!*8avw#jw#tbpfof`wqlmj`lmpvanjw>!\t?\"..#Fmg#fof`wqj`boleej`jboozpvddfpwjlmwls#le#wkfvmojhf#wkfBvpwqbojbmLqjdjmboozqfefqfm`fp\t?,kfbg=\u000E\tqf`ldmjpfgjmjwjbojyfojnjwfg#wlBof{bmgqjbqfwjqfnfmwBgufmwvqfpelvq#zfbqp\t\t%ow8\"..#jm`qfbpjmdgf`lqbwjlmk0#`obpp>!lqjdjmp#lelaojdbwjlmqfdvobwjlm`obppjejfg+evm`wjlm+bgubmwbdfpafjmd#wkf#kjpwlqjbmp?abpf#kqfeqfsfbwfgoztjoojmd#wl`lnsbqbaofgfpjdmbwfgmlnjmbwjlmevm`wjlmbojmpjgf#wkfqfufobwjlmfmg#le#wkfp#elq#wkf#bvwklqjyfgqfevpfg#wlwbhf#sob`fbvwlmlnlvp`lnsqlnjpfslojwj`bo#qfpwbvqbmwwtl#le#wkfEfaqvbqz#1rvbojwz#leptelaif`w-vmgfqpwbmgmfbqoz#bootqjwwfm#azjmwfqujftp!#tjgwk>!2tjwkgqbtboeolbw9ofewjp#vpvbooz`bmgjgbwfpmftpsbsfqpnzpwfqjlvpGfsbqwnfmwafpw#hmltmsbqojbnfmwpvssqfppfg`lmufmjfmwqfnfnafqfggjeefqfmw#pzpwfnbwj`kbp#ofg#wlsqlsbdbmgb`lmwqloofgjmeovfm`fp`fqfnlmjbosql`objnfgSqlwf`wjlmoj#`obpp>!P`jfmwjej``obpp>!ml.wqbgfnbqhpnlqf#wkbm#tjgfpsqfbgOjafqbwjlmwllh#sob`fgbz#le#wkfbp#olmd#bpjnsqjplmfgBggjwjlmbo\t?kfbg=\t?nObalqbwlqzMlufnafq#1f{`fswjlmpJmgvpwqjboubqjfwz#leeolbw9#ofeGvqjmd#wkfbppfppnfmwkbuf#affm#gfbop#tjwkPwbwjpwj`pl``vqqfm`f,vo=?,gju=`ofbqej{!=wkf#svaoj`nbmz#zfbqptkj`k#tfqflufq#wjnf/pzmlmznlvp`lmwfmw!=\tsqfpvnbaozkjp#ebnjozvpfqBdfmw-vmf{sf`wfgjm`ovgjmd#`kboofmdfgb#njmlqjwzvmgfejmfg!afolmdp#wlwbhfm#eqlnjm#L`wlafqslpjwjlm9#pbjg#wl#afqfojdjlvp#Efgfqbwjlm#qltpsbm>!lmoz#b#eftnfbmw#wkbwofg#wl#wkf..=\u000E\t?gju#?ejfogpfw=Bq`kajpkls#`obpp>!mlafjmd#vpfgbssqlb`kfpsqjujofdfpmlp`qjsw=\tqfpvowp#jmnbz#af#wkfFbpwfq#fddnf`kbmjpnpqfbplmbaofSlsvobwjlm@loof`wjlmpfof`wfg!=mlp`qjsw=\u000E,jmgf{-sksbqqjubo#le.ippgh$**8nbmbdfg#wljm`lnsofwf`bpvbowjfp`lnsofwjlm@kqjpwjbmpPfswfnafq#bqjwknfwj`sql`fgvqfpnjdkw#kbufSqlgv`wjlmjw#bssfbqpSkjolplskzeqjfmgpkjsofbgjmd#wldjujmd#wkfwltbqg#wkfdvbqbmwffggl`vnfmwfg`lolq9 333ujgfl#dbnf`lnnjppjlmqfeof`wjmd`kbmdf#wkfbppl`jbwfgpbmp.pfqjelmhfzsqfpp8#sbggjmd9Kf#tbp#wkfvmgfqozjmdwzsj`booz#/#bmg#wkf#pq`Fofnfmwpv``fppjufpjm`f#wkf#pklvog#af#mfwtlqhjmdb``lvmwjmdvpf#le#wkfoltfq#wkbmpkltp#wkbw?,psbm=\t\n\n`lnsobjmwp`lmwjmvlvprvbmwjwjfpbpwqlmlnfqkf#gjg#mlwgvf#wl#jwpbssojfg#wlbm#bufqbdffeelqwp#wlwkf#evwvqfbwwfnsw#wlWkfqfelqf/`bsbajojwzQfsvaoj`bmtbp#elqnfgFof`wqlmj`hjolnfwfqp`kboofmdfpsvaojpkjmdwkf#elqnfqjmgjdfmlvpgjqf`wjlmppvapjgjbqz`lmpsjqb`zgfwbjop#lebmg#jm#wkfbeelqgbaofpvapwbm`fpqfbplm#elq`lmufmwjlmjwfnwzsf>!baplovwfozpvsslpfgozqfnbjmfg#bbwwqb`wjufwqbufoojmdpfsbqbwfozel`vpfp#lmfofnfmwbqzbssoj`baofelvmg#wkbwpwzofpkffwnbmvp`qjswpwbmgp#elq#ml.qfsfbw+plnfwjnfp@lnnfq`jbojm#Bnfqj`bvmgfqwbhfmrvbqwfq#lebm#f{bnsofsfqplmboozjmgf{-sks!owqOjfvwfmbmw\t?gju#jg>!wkfz#tlvogbajojwz#lenbgf#vs#lemlwfg#wkbw`ofbq#wkbwbqdvf#wkbwwl#bmlwkfq`kjogqfm$psvqslpf#leelqnvobwfgabpfg#vslmwkf#qfdjlmpvaif`w#lesbppfmdfqpslppfppjlm-\t\tJm#wkf#Afelqf#wkfbewfqtbqgp`vqqfmwoz#b`qlpp#wkfp`jfmwjej``lnnvmjwz-`bsjwbojpnjm#Dfqnbmzqjdkw.tjmdwkf#pzpwfnPl`jfwz#leslojwj`jbmgjqf`wjlm9tfmw#lm#wlqfnlubo#le#Mft#Zlqh#bsbqwnfmwpjmgj`bwjlmgvqjmd#wkfvmofpp#wkfkjpwlqj`bokbg#affm#bgfejmjwjufjmdqfgjfmwbwwfmgbm`f@fmwfq#elqsqlnjmfm`fqfbgzPwbwfpwqbwfdjfpavw#jm#wkfbp#sbqw#le`lmpwjwvwf`objn#wkbwobalqbwlqz`lnsbwjaofebjovqf#le/#pv`k#bp#afdbm#tjwkvpjmd#wkf#wl#sqlujgfefbwvqf#leeqln#tkj`k,!#`obpp>!dfloldj`bopfufqbo#legfojafqbwfjnslqwbmw#klogp#wkbwjmd%rvlw8#ubojdm>wlswkf#Dfqnbmlvwpjgf#lemfdlwjbwfgkjp#`bqffqpfsbqbwjlmjg>!pfbq`ktbp#`boofgwkf#elvqwkqf`qfbwjlmlwkfq#wkbmsqfufmwjlmtkjof#wkf#fgv`bwjlm/`lmmf`wjmdb``vqbwfoztfqf#avjowtbp#hjoofgbdqffnfmwpnv`k#nlqf#Gvf#wl#wkftjgwk9#233plnf#lwkfqHjmdgln#lewkf#fmwjqfebnlvp#elqwl#`lmmf`wlaif`wjufpwkf#Eqfm`ksflsof#bmgefbwvqfg!=jp#pbjg#wlpwqv`wvqboqfefqfmgvnnlpw#lewfmb#pfsbqbwf.=\t?gju#jg#Leej`jbo#tlqogtjgf-bqjb.obafowkf#sobmfwbmg#jw#tbpg!#ubovf>!ollhjmd#bwafmfej`jbobqf#jm#wkfnlmjwlqjmdqfslqwfgozwkf#nlgfqmtlqhjmd#lmbooltfg#wltkfqf#wkf#jmmlubwjuf?,b=?,gju=plvmgwqb`hpfbq`kElqnwfmg#wl#afjmsvw#jg>!lsfmjmd#leqfpwqj`wfgbglswfg#azbggqfppjmdwkfloldjbmnfwklgp#leubqjbmw#le@kqjpwjbm#ufqz#obqdfbvwlnlwjufaz#ebq#wkfqbmdf#eqlnsvqpvjw#leeloolt#wkfaqlvdkw#wljm#Fmdobmgbdqff#wkbwb``vpfg#le`lnfp#eqlnsqfufmwjmdgju#pwzof>kjp#lq#kfqwqfnfmglvpeqffgln#le`lm`fqmjmd3#2fn#2fn8Abphfwaboo,pwzof-`ppbm#fbqojfqfufm#bewfq,!#wjwof>!-`ln,jmgf{wbhjmd#wkfsjwwpavqdk`lmwfmw!=\u000E?p`qjsw=+ewvqmfg#lvwkbujmd#wkf?,psbm=\u000E\t#l``bpjlmboaf`bvpf#jwpwbqwfg#wlskzpj`booz=?,gju=\t##`qfbwfg#az@vqqfmwoz/#ad`lolq>!wbajmgf{>!gjpbpwqlvpBmbozwj`p#bopl#kbp#b=?gju#jg>!?,pwzof=\t?`boofg#elqpjmdfq#bmg-pq`#>#!,,ujlobwjlmpwkjp#sljmw`lmpwbmwozjp#ol`bwfgqf`lqgjmdpg#eqln#wkfmfgfqobmgpslqwvdv/Fp;N;};D;u;F5m4K4]4_7`gfpbqqlool`lnfmwbqjlfgv`b`j/_mpfswjfnaqfqfdjpwqbglgjqf``j/_mvaj`b`j/_msvaoj`jgbgqfpsvfpwbpqfpvowbglpjnslqwbmwfqfpfqubglpbqw/A`volpgjefqfmwfppjdvjfmwfpqfs/Vaoj`bpjwvb`j/_mnjmjpwfqjlsqjub`jgbggjqf`wlqjlelqnb`j/_mslaob`j/_msqfpjgfmwf`lmw"; + private static final String DATA1 = "fmjglpb``fplqjlpwf`kmlqbwjsfqplmbofp`bwfdlq/Abfpsf`jbofpgjpslmjaofb`wvbojgbgqfefqfm`jbuboobglojgajaojlwf`bqfob`jlmfp`bofmgbqjlslo/Awj`bpbmwfqjlqfpgl`vnfmwlpmbwvqbofybnbwfqjbofpgjefqfm`jbf`lm/_nj`bwqbmpslqwfqlgq/Advfysbqwj`jsbqfm`vfmwqbmgjp`vpj/_mfpwqv`wvqbevmgb`j/_meqf`vfmwfpsfqnbmfmwfwlwbonfmwf!2s{#plojg# -dje!#bow>!wqbmpsbqfmwjmelqnbwjlmbssoj`bwjlm!#lm`oj`h>!fpwbaojpkfgbgufqwjpjmd-smd!#bow>!fmujqlmnfmwsfqelqnbm`fbssqlsqjbwf%bns8ngbpk8jnnfgjbwfoz?,pwqlmd=?,qbwkfq#wkbmwfnsfqbwvqfgfufolsnfmw`lnsfwjwjlmsob`fklogfqujpjajojwz9`lszqjdkw!=3!#kfjdkw>!fufm#wklvdkqfsob`fnfmwgfpwjmbwjlm@lqslqbwjlm?vo#`obpp>!Bppl`jbwjlmjmgjujgvbopsfqpsf`wjufpfwWjnflvw+vqo+kwws9,,nbwkfnbwj`pnbqdjm.wls9fufmwvbooz#gfp`qjswjlm*#ml.qfsfbw`loof`wjlmp-ISD\u007Fwkvna\u007Fsbqwj`jsbwf,kfbg=?algzeolbw9ofew8?oj#`obpp>!kvmgqfgp#le\t\tKltfufq/#`lnslpjwjlm`ofbq9alwk8`llsfqbwjlmtjwkjm#wkf#obafo#elq>!alqgfq.wls9Mft#Yfbobmgqf`lnnfmgfgsklwldqbskzjmwfqfpwjmd%ow8pvs%dw8`lmwqlufqpzMfwkfqobmgpbowfqmbwj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k#vpfg#jm#wkfgfpwqv`wjlmslppjajojwzpwbqwjmd#jmwtl#lq#nlqff{sqfppjlmppvalqgjmbwfobqdfq#wkbmkjpwlqz#bmg?,lswjlm=\u000E\t@lmwjmfmwbofojnjmbwjmdtjoo#mlw#afsqb`wj`f#lejm#eqlmw#lepjwf#le#wkffmpvqf#wkbwwl#`qfbwf#bnjppjppjssjslwfmwjboozlvwpwbmgjmdafwwfq#wkbmtkbw#jp#mltpjwvbwfg#jmnfwb#mbnf>!WqbgjwjlmbopvddfpwjlmpWqbmpobwjlmwkf#elqn#lebwnlpskfqj`jgfloldj`bofmwfqsqjpfp`bo`vobwjmdfbpw#le#wkfqfnmbmwp#lesovdjmpsbdf,jmgf{-sks!Wkjp#jp#wkf#?b#kqfe>!,slsvobqjyfgjmuloufg#jmbqf#vpfg#wlbmg#pfufqbonbgf#az#wkfpffnp#wl#afojhfoz#wkbwSbofpwjmjbmmbnfg#bewfqjw#kbg#affmnlpw#`lnnlmwl#qfefq#wlavw#wkjp#jp`lmpf`vwjufwfnslqbqjozJm#dfmfqbo/`lmufmwjlmpwbhfp#sob`fpvagjujpjlmwfqqjwlqjbolsfqbwjlmbosfqnbmfmwoztbp#obqdfozlvwaqfbh#lejm#wkf#sbpwelooltjmd#b#{nomp9ld>!=?b#`obpp>!`obpp>!wf{w@lmufqpjlm#nbz#af#vpfgnbmveb`wvqfbewfq#afjmd`ofbqej{!=\trvfpwjlm#letbp#fof`wfgwl#af`lnf#baf`bvpf#le#plnf#sflsofjmpsjqfg#azpv``fppevo#b#wjnf#tkfmnlqf#`lnnlmbnlmdpw#wkfbm#leej`jbotjgwk9233&8wf`kmloldz/tbp#bglswfgwl#hffs#wkfpfwwofnfmwpojuf#ajqwkpjmgf{-kwno!@lmmf`wj`vwbppjdmfg#wl%bns8wjnfp8b``lvmw#elqbojdm>qjdkwwkf#`lnsbmzbotbzp#affmqfwvqmfg#wljmuloufnfmwAf`bvpf#wkfwkjp#sfqjlg!#mbnf>!r!#`lmejmfg#wlb#qfpvow#leubovf>!!#,=jp#b`wvboozFmujqlmnfmw\u000E\t?,kfbg=\u000E\t@lmufqpfoz/=\t?gju#jg>!3!#tjgwk>!2jp#sqlabaozkbuf#af`lnf`lmwqloojmdwkf#sqlaofn`jwjyfmp#leslojwj`jbmpqfb`kfg#wkfbp#fbqoz#bp9mlmf8#lufq?wbaof#`fooubojgjwz#legjqf`woz#wllmnlvpfgltmtkfqf#jw#jptkfm#jw#tbpnfnafqp#le#qfobwjlm#wlb``lnnlgbwfbolmd#tjwk#Jm#wkf#obwfwkf#Fmdojpkgfoj`jlvp!=wkjp#jp#mlwwkf#sqfpfmwje#wkfz#bqfbmg#ejmboozb#nbwwfq#le\u000E\t\n?,gju=\u000E\t\u000E\t?,p`qjsw=ebpwfq#wkbmnbilqjwz#lebewfq#tkj`k`lnsbqbwjufwl#nbjmwbjmjnsqluf#wkfbtbqgfg#wkffq!#`obpp>!eqbnfalqgfqqfpwlqbwjlmjm#wkf#pbnfbmbozpjp#lewkfjq#ejqpwGvqjmd#wkf#`lmwjmfmwbopfrvfm`f#leevm`wjlm+*xelmw.pjyf9#tlqh#lm#wkf?,p`qjsw=\t?afdjmp#tjwkibubp`qjsw9`lmpwjwvfmwtbp#elvmgfgfrvjojaqjvnbppvnf#wkbwjp#djufm#azmffgp#wl#af`llqgjmbwfpwkf#ubqjlvpbqf#sbqw#lelmoz#jm#wkfpf`wjlmp#lejp#b#`lnnlmwkflqjfp#legjp`lufqjfpbppl`jbwjlmfgdf#le#wkfpwqfmdwk#leslpjwjlm#jmsqfpfmw.gbzvmjufqpboozwl#elqn#wkfavw#jmpwfbg`lqslqbwjlmbwwb`kfg#wljp#`lnnlmozqfbplmp#elq#%rvlw8wkf#`bm#af#nbgftbp#baof#wltkj`k#nfbmpavw#gjg#mlwlmNlvpfLufqbp#slppjaoflsfqbwfg#az`lnjmd#eqlnwkf#sqjnbqzbggjwjlm#leelq#pfufqbowqbmpefqqfgb#sfqjlg#lebqf#baof#wlkltfufq/#jwpklvog#kbufnv`k#obqdfq\t\n?,p`qjsw=bglswfg#wkfsqlsfqwz#legjqf`wfg#azfeef`wjufoztbp#aqlvdkw`kjogqfm#leSqldqbnnjmdolmdfq#wkbmnbmvp`qjswptbq#bdbjmpwaz#nfbmp#lebmg#nlpw#lepjnjobq#wl#sqlsqjfwbqzlqjdjmbwjmdsqfpwjdjlvpdqbnnbwj`bof{sfqjfm`f-wl#nbhf#wkfJw#tbp#bopljp#elvmg#jm`lnsfwjwlqpjm#wkf#V-P-qfsob`f#wkfaqlvdkw#wkf`bo`vobwjlmeboo#le#wkfwkf#dfmfqbosqb`wj`boozjm#klmlq#leqfofbpfg#jmqfpjgfmwjbobmg#plnf#lehjmd#le#wkfqfb`wjlm#wl2pw#Fbqo#le`vowvqf#bmgsqjm`jsbooz?,wjwof=\t##wkfz#`bm#afab`h#wl#wkfplnf#le#kjpf{slpvqf#wlbqf#pjnjobqelqn#le#wkfbggEbulqjwf`jwjyfmpkjssbqw#jm#wkfsflsof#tjwkjm#sqb`wj`fwl#`lmwjmvf%bns8njmvp8bssqlufg#az#wkf#ejqpw#booltfg#wkfbmg#elq#wkfevm`wjlmjmdsobzjmd#wkfplovwjlm#wlkfjdkw>!3!#jm#kjp#allhnlqf#wkbm#belooltp#wkf`qfbwfg#wkfsqfpfm`f#jm%maps8?,wg=mbwjlmbojpwwkf#jgfb#leb#`kbqb`wfqtfqf#elq`fg#`obpp>!awmgbzp#le#wkfefbwvqfg#jmpkltjmd#wkfjmwfqfpw#jmjm#sob`f#lewvqm#le#wkfwkf#kfbg#leOlqg#le#wkfslojwj`boozkbp#jwp#ltmFgv`bwjlmbobssqlubo#leplnf#le#wkffb`k#lwkfq/afkbujlq#lebmg#af`bvpfbmg#bmlwkfqbssfbqfg#lmqf`lqgfg#jmaob`h%rvlw8nbz#jm`ovgfwkf#tlqog$p`bm#ofbg#wlqfefqp#wl#balqgfq>!3!#dlufqmnfmw#tjmmjmd#wkfqfpvowfg#jm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kf#Bnfqj`bmpwqv`wvqf#le,jmgf{-kwno#svaojpkfg#jmpsbm#`obpp>!!=?b#kqfe>!,jmwqlgv`wjlmafolmdjmd#wl`objnfg#wkbw`lmpfrvfm`fp?nfwb#mbnf>!Dvjgf#wl#wkflufqtkfonjmdbdbjmpw#wkf#`lm`fmwqbwfg/\t-mlmwlv`k#lapfqubwjlmp?,b=\t?,gju=\te#+gl`vnfmw-alqgfq9#2s{#xelmw.pjyf92wqfbwnfmw#le3!#kfjdkw>!2nlgjej`bwjlmJmgfsfmgfm`fgjujgfg#jmwldqfbwfq#wkbmb`kjfufnfmwpfpwbaojpkjmdIbubP`qjsw!#mfufqwkfofpppjdmjej`bm`fAqlbg`bpwjmd=%maps8?,wg=`lmwbjmfq!=\tpv`k#bp#wkf#jmeovfm`f#leb#sbqwj`vobqpq`>$kwws9,,mbujdbwjlm!#kboe#le#wkf#pvapwbmwjbo#%maps8?,gju=bgubmwbdf#legjp`lufqz#leevmgbnfmwbo#nfwqlslojwbmwkf#lsslpjwf!#{no9obmd>!gfojafqbwfozbojdm>`fmwfqfulovwjlm#lesqfpfqubwjlmjnsqlufnfmwpafdjmmjmd#jmIfpvp#@kqjpwSvaoj`bwjlmpgjpbdqffnfmwwf{w.bojdm9q/#evm`wjlm+*pjnjobqjwjfpalgz=?,kwno=jp#`vqqfmwozboskbafwj`bojp#plnfwjnfpwzsf>!jnbdf,nbmz#le#wkf#eolt9kjggfm8bubjobaof#jmgfp`qjaf#wkff{jpwfm`f#leboo#lufq#wkfwkf#Jmwfqmfw\n?vo#`obpp>!jmpwboobwjlmmfjdkalqkllgbqnfg#elq`fpqfgv`jmd#wkf`lmwjmvfp#wlMlmfwkfofpp/wfnsfqbwvqfp\t\n\n?b#kqfe>!`olpf#wl#wkff{bnsofp#le#jp#balvw#wkf+pff#afolt*-!#jg>!pfbq`ksqlefppjlmbojp#bubjobaofwkf#leej`jbo\n\n?,p`qjsw=\t\t\n\n?gju#jg>!b``fofqbwjlmwkqlv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?kfbg=\u000E\t?tfqf#`qfbwfgnlqf#dfmfqbojmelqnbwjlm#vpfg#elq#wkfjmgfsfmgfmw#wkf#Jnsfqjbo`lnslmfmw#lewl#wkf#mlqwkjm`ovgf#wkf#@lmpwqv`wjlmpjgf#le#wkf#tlvog#mlw#afelq#jmpwbm`fjmufmwjlm#lenlqf#`lnsof{`loof`wjufozab`hdqlvmg9#wf{w.bojdm9#jwp#lqjdjmbojmwl#b``lvmwwkjp#sql`fppbm#f{wfmpjufkltfufq/#wkfwkfz#bqf#mlwqfif`wfg#wkf`qjwj`jpn#legvqjmd#tkj`ksqlabaoz#wkfwkjp#bqwj`of+evm`wjlm+*xJw#pklvog#afbm#bdqffnfmwb``jgfmwboozgjeefqp#eqlnBq`kjwf`wvqfafwwfq#hmltmbqqbmdfnfmwpjmeovfm`f#lmbwwfmgfg#wkfjgfmwj`bo#wlplvwk#le#wkfsbpp#wkqlvdk{no!#wjwof>!tfjdkw9alog8`qfbwjmd#wkfgjpsobz9mlmfqfsob`fg#wkf?jnd#pq`>!,jkwwsp9,,ttt-Tlqog#Tbq#JJwfpwjnlmjbopelvmg#jm#wkfqfrvjqfg#wl#bmg#wkbw#wkfafwtffm#wkf#tbp#gfpjdmfg`lmpjpwp#le#`lmpjgfqbaozsvaojpkfg#azwkf#obmdvbdf@lmpfqubwjlm`lmpjpwfg#leqfefq#wl#wkfab`h#wl#wkf#`pp!#nfgjb>!Sflsof#eqln#bubjobaof#lmsqlufg#wl#afpvddfpwjlmp!tbp#hmltm#bpubqjfwjfp#leojhfoz#wl#af`lnsqjpfg#lepvsslqw#wkf#kbmgp#le#wkf`lvsofg#tjwk`lmmf`w#bmg#alqgfq9mlmf8sfqelqnbm`fpafelqf#afjmdobwfq#af`bnf`bo`vobwjlmplewfm#`boofgqfpjgfmwp#lenfbmjmd#wkbw=?oj#`obpp>!fujgfm`f#elqf{sobmbwjlmpfmujqlmnfmwp!=?,b=?,gju=tkj`k#booltpJmwqlgv`wjlmgfufolsfg#azb#tjgf#qbmdflm#afkboe#leubojdm>!wls!sqjm`jsof#lebw#wkf#wjnf/?,mlp`qjsw=\u000Epbjg#wl#kbufjm#wkf#ejqpwtkjof#lwkfqpkzslwkfwj`boskjolplskfqpsltfq#le#wkf`lmwbjmfg#jmsfqelqnfg#azjmbajojwz#wltfqf#tqjwwfmpsbm#pwzof>!jmsvw#mbnf>!wkf#rvfpwjlmjmwfmgfg#elqqfif`wjlm#lejnsojfp#wkbwjmufmwfg#wkfwkf#pwbmgbqgtbp#sqlabaozojmh#afwtffmsqlefpplq#lejmwfqb`wjlmp`kbmdjmd#wkfJmgjbm#L`fbm#`obpp>!obpwtlqhjmd#tjwk$kwws9,,ttt-zfbqp#afelqfWkjp#tbp#wkfqf`qfbwjlmbofmwfqjmd#wkfnfbpvqfnfmwpbm#f{wqfnfozubovf#le#wkfpwbqw#le#wkf\t?,p`qjsw=\t\tbm#feelqw#wljm`qfbpf#wkfwl#wkf#plvwkpsb`jmd>!3!=pveej`jfmwozwkf#Fvqlsfbm`lmufqwfg#wl`ofbqWjnflvwgjg#mlw#kbuf`lmpfrvfmwozelq#wkf#mf{wf{wfmpjlm#lef`lmlnj`#bmgbowklvdk#wkfbqf#sqlgv`fgbmg#tjwk#wkfjmpveej`jfmwdjufm#az#wkfpwbwjmd#wkbwf{sfmgjwvqfp?,psbm=?,b=\twklvdkw#wkbwlm#wkf#abpjp`foosbggjmd>jnbdf#le#wkfqfwvqmjmd#wljmelqnbwjlm/pfsbqbwfg#azbppbppjmbwfgp!#`lmwfmw>!bvwklqjwz#lemlqwktfpwfqm?,gju=\t?gju#!=?,gju=\u000E\t##`lmpvowbwjlm`lnnvmjwz#lewkf#mbwjlmbojw#pklvog#afsbqwj`jsbmwp#bojdm>!ofewwkf#dqfbwfpwpfof`wjlm#lepvsfqmbwvqbogfsfmgfmw#lmjp#nfmwjlmfgbooltjmd#wkftbp#jmufmwfgb``lnsbmzjmdkjp#sfqplmbobubjobaof#bwpwvgz#le#wkflm#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oz#avwwlm#wzsf>!wkf#mvnafq#lewkf#lqjdjmbo#`lnsqfkfmpjufqfefqp#wl#wkf?,vo=\t?,gju=\tskjolplskj`bool`bwjlm-kqfetbp#svaojpkfgPbm#Eqbm`jp`l+evm`wjlm+*x\t?gju#jg>!nbjmplskjpwj`bwfgnbwkfnbwj`bo#,kfbg=\u000E\t?algzpvddfpwp#wkbwgl`vnfmwbwjlm`lm`fmwqbwjlmqfobwjlmpkjspnbz#kbuf#affm+elq#f{bnsof/Wkjp#bqwj`of#jm#plnf#`bpfpsbqwp#le#wkf#gfejmjwjlm#leDqfbw#Aqjwbjm#`foosbggjmd>frvjubofmw#wlsob`fklogfq>!8#elmw.pjyf9#ivpwjej`bwjlmafojfufg#wkbwpveefqfg#eqlnbwwfnswfg#wl#ofbgfq#le#wkf`qjsw!#pq`>!,+evm`wjlm+*#xbqf#bubjobaof\t\n?ojmh#qfo>!#pq`>$kwws9,,jmwfqfpwfg#jm`lmufmwjlmbo#!#bow>!!#,=?,bqf#dfmfqboozkbp#bopl#affmnlpw#slsvobq#`lqqfpslmgjmd`qfgjwfg#tjwkwzof>!alqgfq9?,b=?,psbm=?,-dje!#tjgwk>!?jeqbnf#pq`>!wbaof#`obpp>!jmojmf.aol`h8b``lqgjmd#wl#wldfwkfq#tjwkbssql{jnbwfozsbqojbnfmwbqznlqf#bmg#nlqfgjpsobz9mlmf8wqbgjwjlmboozsqfglnjmbmwoz%maps8\u007F%maps8%maps8?,psbm=#`foopsb`jmd>?jmsvw#mbnf>!lq!#`lmwfmw>!`lmwqlufqpjbosqlsfqwz>!ld9,{.pkl`htbuf.gfnlmpwqbwjlmpvqqlvmgfg#azMfufqwkfofpp/tbp#wkf#ejqpw`lmpjgfqbaof#Bowklvdk#wkf#`loobalqbwjlmpklvog#mlw#afsqlslqwjlm#le?psbm#pwzof>!hmltm#bp#wkf#pklqwoz#bewfqelq#jmpwbm`f/gfp`qjafg#bp#,kfbg=\t?algz#pwbqwjmd#tjwkjm`qfbpjmdoz#wkf#eb`w#wkbwgjp`vppjlm#lenjggof#le#wkfbm#jmgjujgvbogjeej`vow#wl#sljmw#le#ujftklnlpf{vbojwzb``fswbm`f#le?,psbm=?,gju=nbmveb`wvqfqplqjdjm#le#wkf`lnnlmoz#vpfgjnslqwbm`f#legfmlnjmbwjlmpab`hdqlvmg9# ofmdwk#le#wkfgfwfqnjmbwjlmb#pjdmjej`bmw!#alqgfq>!3!=qfulovwjlmbqzsqjm`jsofp#lejp#`lmpjgfqfgtbp#gfufolsfgJmgl.Fvqlsfbmuvomfqbaof#wlsqlslmfmwp#lebqf#plnfwjnfp`olpfq#wl#wkfMft#Zlqh#@jwz#mbnf>!pfbq`kbwwqjavwfg#wl`lvqpf#le#wkfnbwkfnbwj`jbmaz#wkf#fmg#lebw#wkf#fmg#le!#alqgfq>!3!#wf`kmloldj`bo-qfnluf@obpp+aqbm`k#le#wkffujgfm`f#wkbw\"Xfmgje^..=\u000E\tJmpwjwvwf#le#jmwl#b#pjmdofqfpsf`wjufoz-bmg#wkfqfelqfsqlsfqwjfp#lejp#ol`bwfg#jmplnf#le#tkj`kWkfqf#jp#bopl`lmwjmvfg#wl#bssfbqbm`f#le#%bns8mgbpk8#gfp`qjafp#wkf`lmpjgfqbwjlmbvwklq#le#wkfjmgfsfmgfmwozfrvjssfg#tjwkglfp#mlw#kbuf?,b=?b#kqfe>!`lmevpfg#tjwk?ojmh#kqfe>!,bw#wkf#bdf#lebssfbq#jm#wkfWkfpf#jm`ovgfqfdbqgofpp#le`lvog#af#vpfg#pwzof>%rvlw8pfufqbo#wjnfpqfsqfpfmw#wkfalgz=\t?,kwno=wklvdkw#wl#afslsvobwjlm#leslppjajojwjfpsfq`fmwbdf#leb``fpp#wl#wkfbm#bwwfnsw#wlsqlgv`wjlm#leirvfqz,irvfqzwtl#gjeefqfmwafolmd#wl#wkffpwbaojpknfmwqfsob`jmd#wkfgfp`qjswjlm!#gfwfqnjmf#wkfbubjobaof#elqB``lqgjmd#wl#tjgf#qbmdf#le\n?gju#`obpp>!nlqf#`lnnlmozlqdbmjpbwjlmpevm`wjlmbojwztbp#`lnsofwfg#%bns8ngbpk8#sbqwj`jsbwjlmwkf#`kbqb`wfqbm#bggjwjlmbobssfbqp#wl#afeb`w#wkbw#wkfbm#f{bnsof#lepjdmjej`bmwozlmnlvpflufq>!af`bvpf#wkfz#bpzm`#>#wqvf8sqlaofnp#tjwkpffnp#wl#kbufwkf#qfpvow#le#pq`>!kwws9,,ebnjojbq#tjwkslppfppjlm#leevm`wjlm#+*#xwllh#sob`f#jmbmg#plnfwjnfppvapwbmwjbooz?psbm=?,psbm=jp#lewfm#vpfgjm#bm#bwwfnswdqfbw#gfbo#leFmujqlmnfmwbopv``fppevooz#ujqwvbooz#boo13wk#`fmwvqz/sqlefppjlmbopmf`fppbqz#wl#gfwfqnjmfg#az`lnsbwjajojwzaf`bvpf#jw#jpGj`wjlmbqz#lenlgjej`bwjlmpWkf#elooltjmdnbz#qfefq#wl9@lmpfrvfmwoz/Jmwfqmbwjlmbobowklvdk#plnfwkbw#tlvog#aftlqog$p#ejqpw`obppjejfg#bpalwwln#le#wkf+sbqwj`vobqozbojdm>!ofew!#nlpw#`lnnlmozabpjp#elq#wkfelvmgbwjlm#le`lmwqjavwjlmpslsvobqjwz#le`fmwfq#le#wkfwl#qfgv`f#wkfivqjpgj`wjlmpbssql{jnbwjlm#lmnlvpflvw>!Mft#Wfpwbnfmw`loof`wjlm#le?,psbm=?,b=?,jm#wkf#Vmjwfgejon#gjqf`wlq.pwqj`w-gwg!=kbp#affm#vpfgqfwvqm#wl#wkfbowklvdk#wkjp`kbmdf#jm#wkfpfufqbo#lwkfqavw#wkfqf#bqfvmsqf`fgfmwfgjp#pjnjobq#wlfpsf`jbooz#jmtfjdkw9#alog8jp#`boofg#wkf`lnsvwbwjlmbojmgj`bwf#wkbwqfpwqj`wfg#wl\n?nfwb#mbnf>!bqf#wzsj`booz`lmeoj`w#tjwkKltfufq/#wkf#Bm#f{bnsof#le`lnsbqfg#tjwkrvbmwjwjfp#leqbwkfq#wkbm#b`lmpwfoobwjlmmf`fppbqz#elqqfslqwfg#wkbwpsf`jej`bwjlmslojwj`bo#bmg%maps8%maps8?qfefqfm`fp#wlwkf#pbnf#zfbqDlufqmnfmw#ledfmfqbwjlm#lekbuf#mlw#affmpfufqbo#zfbqp`lnnjwnfmw#wl\n\n?vo#`obpp>!ujpvbojybwjlm2:wk#`fmwvqz/sqb`wjwjlmfqpwkbw#kf#tlvogbmg#`lmwjmvfgl``vsbwjlm#lejp#gfejmfg#bp`fmwqf#le#wkfwkf#bnlvmw#le=?gju#pwzof>!frvjubofmw#legjeefqfmwjbwfaqlvdkw#balvwnbqdjm.ofew9#bvwlnbwj`boozwklvdkw#le#bpPlnf#le#wkfpf\t?gju#`obpp>!jmsvw#`obpp>!qfsob`fg#tjwkjp#lmf#le#wkffgv`bwjlm#bmgjmeovfm`fg#azqfsvwbwjlm#bp\t?nfwb#mbnf>!b``lnnlgbwjlm?,gju=\t?,gju=obqdf#sbqw#leJmpwjwvwf#elqwkf#pl.`boofg#bdbjmpw#wkf#Jm#wkjp#`bpf/tbp#bssljmwfg`objnfg#wl#afKltfufq/#wkjpGfsbqwnfmw#lewkf#qfnbjmjmdfeef`w#lm#wkfsbqwj`vobqoz#gfbo#tjwk#wkf\t?gju#pwzof>!bonlpw#botbzpbqf#`vqqfmwozf{sqfppjlm#leskjolplskz#leelq#nlqf#wkbm`jujojybwjlmplm#wkf#jpobmgpfof`wfgJmgf{`bm#qfpvow#jm!#ubovf>!!#,=wkf#pwqv`wvqf#,=?,b=?,gju=Nbmz#le#wkfpf`bvpfg#az#wkfle#wkf#Vmjwfgpsbm#`obpp>!n`bm#af#wqb`fgjp#qfobwfg#wlaf`bnf#lmf#lejp#eqfrvfmwozojujmd#jm#wkfwkflqfwj`boozElooltjmd#wkfQfulovwjlmbqzdlufqmnfmw#jmjp#gfwfqnjmfgwkf#slojwj`bojmwqlgv`fg#jmpveej`jfmw#wlgfp`qjswjlm!=pklqw#pwlqjfppfsbqbwjlm#lebp#wl#tkfwkfqhmltm#elq#jwptbp#jmjwjboozgjpsobz9aol`hjp#bm#f{bnsofwkf#sqjm`jsbo`lmpjpwp#le#bqf`ldmjyfg#bp,algz=?,kwno=b#pvapwbmwjboqf`lmpwqv`wfgkfbg#le#pwbwfqfpjpwbm`f#wlvmgfqdqbgvbwfWkfqf#bqf#wtldqbujwbwjlmbobqf#gfp`qjafgjmwfmwjlmboozpfqufg#bp#wkf`obpp>!kfbgfqlsslpjwjlm#wlevmgbnfmwboozglnjmbwfg#wkfbmg#wkf#lwkfqboojbm`f#tjwktbp#elq`fg#wlqfpsf`wjufoz/bmg#slojwj`bojm#pvsslqw#lesflsof#jm#wkf13wk#`fmwvqz-bmg#svaojpkfgolbg@kbqwafbwwl#vmgfqpwbmgnfnafq#pwbwfpfmujqlmnfmwboejqpw#kboe#le`lvmwqjfp#bmgbq`kjwf`wvqboaf#`lmpjgfqfg`kbqb`wfqjyfg`ofbqJmwfqubobvwklqjwbwjufEfgfqbwjlm#letbp#pv``ffgfgbmg#wkfqf#bqfb#`lmpfrvfm`fwkf#Sqfpjgfmwbopl#jm`ovgfgeqff#plewtbqfpv``fppjlm#legfufolsfg#wkftbp#gfpwqlzfgbtbz#eqln#wkf8\t?,p`qjsw=\t?bowklvdk#wkfzelooltfg#az#bnlqf#sltfqevoqfpvowfg#jm#bVmjufqpjwz#leKltfufq/#nbmzwkf#sqfpjgfmwKltfufq/#plnfjp#wklvdkw#wlvmwjo#wkf#fmgtbp#bmmlvm`fgbqf#jnslqwbmwbopl#jm`ovgfp=?jmsvw#wzsf>wkf#`fmwfq#le#GL#MLW#BOWFQvpfg#wl#qfefqwkfnfp,wkbw#kbg#affmwkf#abpjp#elqkbp#gfufolsfgjm#wkf#pvnnfq`lnsbqbwjufozgfp`qjafg#wkfpv`k#bp#wklpfwkf#qfpvowjmdjp#jnslppjaofubqjlvp#lwkfqPlvwk#Beqj`bmkbuf#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=?tbp#gjp`lufqfg!#wzsf>!wf{w!#*8\t?,p`qjsw=\t\tGfsbqwnfmw#le#f``ofpjbpwj`bowkfqf#kbp#affmqfpvowjmd#eqln?,algz=?,kwno=kbp#mfufq#affmwkf#ejqpw#wjnfjm#qfpslmpf#wlbvwlnbwj`booz#?,gju=\t\t?gju#jtbp#`lmpjgfqfgsfq`fmw#le#wkf!#,=?,b=?,gju=`loof`wjlm#le#gfp`fmgfg#eqlnpf`wjlm#le#wkfb``fsw.`kbqpfwwl#af#`lmevpfgnfnafq#le#wkf#sbggjmd.qjdkw9wqbmpobwjlm#lejmwfqsqfwbwjlm#kqfe>$kwws9,,tkfwkfq#lq#mlwWkfqf#bqf#boplwkfqf#bqf#nbmzb#pnboo#mvnafqlwkfq#sbqwp#lejnslppjaof#wl##`obpp>!avwwlmol`bwfg#jm#wkf-#Kltfufq/#wkfbmg#fufmwvboozBw#wkf#fmg#le#af`bvpf#le#jwpqfsqfpfmwp#wkf?elqn#b`wjlm>!#nfwklg>!slpw!jw#jp#slppjaofnlqf#ojhfoz#wlbm#jm`qfbpf#jmkbuf#bopl#affm`lqqfpslmgp#wlbmmlvm`fg#wkbwbojdm>!qjdkw!=nbmz#`lvmwqjfpelq#nbmz#zfbqpfbqojfpw#hmltmaf`bvpf#jw#tbpsw!=?,p`qjsw=\u000E#ubojdm>!wls!#jmkbajwbmwp#leelooltjmd#zfbq\u000E\t?gju#`obpp>!njoojlm#sflsof`lmwqlufqpjbo#`lm`fqmjmd#wkfbqdvf#wkbw#wkfdlufqmnfmw#bmgb#qfefqfm`f#wlwqbmpefqqfg#wlgfp`qjajmd#wkf#pwzof>!`lolq9bowklvdk#wkfqfafpw#hmltm#elqpvanjw!#mbnf>!nvowjsoj`bwjlmnlqf#wkbm#lmf#qf`ldmjwjlm#le@lvm`jo#le#wkffgjwjlm#le#wkf##?nfwb#mbnf>!Fmwfqwbjmnfmw#btbz#eqln#wkf#8nbqdjm.qjdkw9bw#wkf#wjnf#lejmufpwjdbwjlmp`lmmf`wfg#tjwkbmg#nbmz#lwkfqbowklvdk#jw#jpafdjmmjmd#tjwk#?psbm#`obpp>!gfp`fmgbmwp#le?psbm#`obpp>!j#bojdm>!qjdkw!?,kfbg=\t?algz#bpsf`wp#le#wkfkbp#pjm`f#affmFvqlsfbm#Vmjlmqfnjmjp`fmw#lenlqf#gjeej`vowUj`f#Sqfpjgfmw`lnslpjwjlm#lesbppfg#wkqlvdknlqf#jnslqwbmwelmw.pjyf922s{f{sobmbwjlm#lewkf#`lm`fsw#letqjwwfm#jm#wkf\n?psbm#`obpp>!jp#lmf#le#wkf#qfpfnaobm`f#wllm#wkf#dqlvmgptkj`k#`lmwbjmpjm`ovgjmd#wkf#gfejmfg#az#wkfsvaoj`bwjlm#lenfbmp#wkbw#wkflvwpjgf#le#wkfpvsslqw#le#wkf?jmsvw#`obpp>!?psbm#`obpp>!w+Nbwk-qbmgln+*nlpw#sqlnjmfmwgfp`qjswjlm#le@lmpwbmwjmlsoftfqf#svaojpkfg?gju#`obpp>!pfbssfbqp#jm#wkf2!#kfjdkw>!2!#nlpw#jnslqwbmwtkj`k#jm`ovgfptkj`k#kbg#affmgfpwqv`wjlm#lewkf#slsvobwjlm\t\n?gju#`obpp>!slppjajojwz#leplnfwjnfp#vpfgbssfbq#wl#kbufpv``fpp#le#wkfjmwfmgfg#wl#afsqfpfmw#jm#wkfpwzof>!`ofbq9a\u000E\t?,p`qjsw=\u000E\t?tbp#elvmgfg#jmjmwfqujft#tjwk\\jg!#`lmwfmw>!`bsjwbo#le#wkf\u000E\t?ojmh#qfo>!pqfofbpf#le#wkfsljmw#lvw#wkbw{NOKwwsQfrvfpwbmg#pvapfrvfmwpf`lmg#obqdfpwufqz#jnslqwbmwpsf`jej`bwjlmppvqeb`f#le#wkfbssojfg#wl#wkfelqfjdm#sloj`z\\pfwGlnbjmMbnffpwbaojpkfg#jmjp#afojfufg#wlJm#bggjwjlm#wlnfbmjmd#le#wkfjp#mbnfg#bewfqwl#s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qwk#Bnfqj`bm#wkf#mbnf#le#wkfjmwfqsqfwbwjlmpwkf#wqbgjwjlmbogfufolsnfmw#le#eqfrvfmwoz#vpfgb#`loof`wjlm#leufqz#pjnjobq#wlpvqqlvmgjmd#wkff{bnsof#le#wkjpbojdm>!`fmwfq!=tlvog#kbuf#affmjnbdf\\`bswjlm#>bwwb`kfg#wl#wkfpvddfpwjmd#wkbwjm#wkf#elqn#le#jmuloufg#jm#wkfjp#gfqjufg#eqlnmbnfg#bewfq#wkfJmwqlgv`wjlm#wlqfpwqj`wjlmp#lm#pwzof>!tjgwk9#`bm#af#vpfg#wl#wkf#`qfbwjlm#lenlpw#jnslqwbmw#jmelqnbwjlm#bmgqfpvowfg#jm#wkf`loobspf#le#wkfWkjp#nfbmp#wkbwfofnfmwp#le#wkftbp#qfsob`fg#azbmbozpjp#le#wkfjmpsjqbwjlm#elqqfdbqgfg#bp#wkfnlpw#pv``fppevohmltm#bp#%rvlw8b#`lnsqfkfmpjufKjpwlqz#le#wkf#tfqf#`lmpjgfqfgqfwvqmfg#wl#wkfbqf#qfefqqfg#wlVmplvq`fg#jnbdf=\t\n?gju#`obpp>!`lmpjpwp#le#wkfpwlsSqlsbdbwjlmjmwfqfpw#jm#wkfbubjobajojwz#lebssfbqp#wl#kbuffof`wqlnbdmfwj`fmbaofPfquj`fp+evm`wjlm#le#wkfJw#jp#jnslqwbmw?,p`qjsw=?,gju=evm`wjlm+*xubq#qfobwjuf#wl#wkfbp#b#qfpvow#le#wkf#slpjwjlm#leElq#f{bnsof/#jm#nfwklg>!slpw!#tbp#elooltfg#az%bns8ngbpk8#wkfwkf#bssoj`bwjlmip!=?,p`qjsw=\u000E\tvo=?,gju=?,gju=bewfq#wkf#gfbwktjwk#qfpsf`w#wlpwzof>!sbggjmd9jp#sbqwj`vobqozgjpsobz9jmojmf8#wzsf>!pvanjw!#jp#gjujgfg#jmwl\bTA\nzk#+\u000BBl\bQ\u007F*qfpslmpbajojgbgbgnjmjpwqb`j/_m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p`qloojmd>!ml!#alqgfq.`loobspf9bppl`jbwfg#tjwk#Abkbpb#JmglmfpjbFmdojpk#obmdvbdf?wf{w#{no9psb`f>-dje!#alqgfq>!3!?,algz=\t?,kwno=\tlufqeolt9kjggfm8jnd#pq`>!kwws9,,bggFufmwOjpwfmfqqfpslmpjaof#elq#p-ip!=?,p`qjsw=\t,ebuj`lm-j`l!#,=lsfqbwjmd#pzpwfn!#pwzof>!tjgwk92wbqdfw>!\\aobmh!=Pwbwf#Vmjufqpjwzwf{w.bojdm9ofew8\tgl`vnfmw-tqjwf+/#jm`ovgjmd#wkf#bqlvmg#wkf#tlqog*8\u000E\t?,p`qjsw=\u000E\t?!#pwzof>!kfjdkw98lufqeolt9kjggfmnlqf#jmelqnbwjlmbm#jmwfqmbwjlmbob#nfnafq#le#wkf#lmf#le#wkf#ejqpw`bm#af#elvmg#jm#?,gju=\t\n\n?,gju=\tgjpsobz9#mlmf8!=!#,=\t?ojmh#qfo>!\t##+evm`wjlm+*#xwkf#26wk#`fmwvqz-sqfufmwGfebvow+obqdf#mvnafq#le#Azybmwjmf#Fnsjqf-isd\u007Fwkvna\u007Fofew\u007Fubpw#nbilqjwz#lenbilqjwz#le#wkf##bojdm>!`fmwfq!=Vmjufqpjwz#Sqfppglnjmbwfg#az#wkfPf`lmg#Tlqog#Tbqgjpwqjavwjlm#le#pwzof>!slpjwjlm9wkf#qfpw#le#wkf#`kbqb`wfqjyfg#az#qfo>!mleloolt!=gfqjufp#eqln#wkfqbwkfq#wkbm#wkf#b#`lnajmbwjlm#lepwzof>!tjgwk9233Fmdojpk.psfbhjmd`lnsvwfq#p`jfm`falqgfq>!3!#bow>!wkf#f{jpwfm`f#leGfnl`qbwj`#Sbqwz!#pwzof>!nbqdjm.Elq#wkjp#qfbplm/-ip!=?,p`qjsw=\t\npAzWbdMbnf+p*X3^ip!=?,p`qjsw=\u000E\t?-ip!=?,p`qjsw=\u000E\tojmh#qfo>!j`lm!#$#bow>$$#`obpp>$elqnbw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zofpkffw!#?,p`qjsw=\t?p`qjsw#wzsf>>#gl`vnfmw-`qfbwfFofnfm?b#wbqdfw>!\\aobmh!#kqfe>#gl`vnfmw-dfwFofnfmwpAjmsvw#wzsf>!wf{w!#mbnf>b-wzsf#>#$wf{w,ibubp`qjmsvw#wzsf>!kjggfm!#mbnfkwno8#`kbqpfw>vwe.;!#,=gwg!=\t?kwno#{nomp>!kwws.,,T0@,,GWG#KWNO#7-32#WfmwpAzWbdMbnf+$p`qjsw$*jmsvw#wzsf>!kjggfm!#mbn?p`qjsw#wzsf>!wf{w,ibubp!#pwzof>!gjpsobz9mlmf8!=gl`vnfmw-dfwFofnfmwAzJg+>gl`vnfmw-`qfbwfFofnfmw+$#wzsf>$wf{w,ibubp`qjsw$jmsvw#wzsf>!wf{w!#mbnf>!g-dfwFofnfmwpAzWbdMbnf+pmj`bo!#kqfe>!kwws9,,ttt-@,,GWG#KWNO#7-32#Wqbmpjw?pwzof#wzsf>!wf{w,`pp!=\t\t?pwzof#wzsf>!wf{w,`pp!=jlmbo-gwg!=\t?kwno#{nomp>kwws.frvju>!@lmwfmw.Wzsfgjmd>!3!#`foopsb`jmd>!3!kwno8#`kbqpfw>vwe.;!#,=\t#pwzof>!gjpsobz9mlmf8!=??oj=?b#kqfe>!kwws9,,ttt-#wzsf>$wf{w,ibubp`qjsw$=> 1; + for (int i = 0; i < n; ++i) { + final int skip = skipFlipRunes[2 * i] - 36; + final int flip = skipFlipRunes[2 * i + 1] - 36; + for (int j = 0; j < skip; ++j) { + dict[offset] = (byte) (dict[offset] ^ 3); + offset++; + } + for (int j = 0; j < flip; ++j) { + dict[offset] = (byte) (dict[offset] ^ 236); + offset++; + } + } + + for (int i = 0; i < sizeBitsData.length(); ++i) { + sizeBits[i] = sizeBitsData.charAt(i) - 65; + } + + dictionary.put(dict); + } + + static { + final ByteBuffer dictionaryData = ByteBuffer.allocateDirect(122784); + final int[] dictionarySizeBits = new int[25]; + unpackDictionaryData( + dictionaryData, DATA0, DATA1, SKIP_FLIP, dictionarySizeBits, SIZE_BITS_DATA); + Utils.flipBuffer(dictionaryData); + Dictionary.setData(Utils.asReadOnlyBuffer(dictionaryData), dictionarySizeBits); + } +} diff --git a/src/main/java/org/htmlunit/util/brotli/Huffman.java b/src/main/java/org/htmlunit/util/brotli/Huffman.java new file mode 100644 index 00000000000..f24aec1e5b0 --- /dev/null +++ b/src/main/java/org/htmlunit/util/brotli/Huffman.java @@ -0,0 +1,143 @@ +/* Copyright 2015 Google Inc. All Rights Reserved. + + Distributed under MIT license. + See file LICENSE for detail or copy at https://opensource.org/licenses/MIT +*/ + +package org.htmlunit.util.brotli; + +/** + * Utilities for building Huffman decoding tables. + */ +final class Huffman { + + private static final int MAX_LENGTH = 15; + + /** + * Returns reverse(reverse(key, len) + 1, len). + * + *

reverse(key, len) is the bit-wise reversal of the len least significant bits of key. + */ + private static int getNextKey(int key, int len) { + int step = 1 << (len - 1); + while ((key & step) != 0) { + step = step >> 1; + } + return (key & (step - 1)) + step; + } + + /** + * Stores {@code item} in {@code table[0], table[step], table[2 * step] .., table[end]}. + * + *

Assumes that end is an integer multiple of step. + */ + private static void replicateValue(int[] table, int offset, int step, int end, int item) { + int pos = end; + while (pos > 0) { + pos -= step; + table[offset + pos] = item; + } + } + + /** + * @param count histogram of bit lengths for the remaining symbols, + * @param len code length of the next processed symbol. + * @return table width of the next 2nd level table. + */ + private static int nextTableBitSize(int[] count, int len, int rootBits) { + int bits = len; + int left = 1 << (bits - rootBits); + while (bits < MAX_LENGTH) { + left -= count[bits]; + if (left <= 0) { + break; + } + bits++; + left = left << 1; + } + return bits - rootBits; + } + + /** + * Builds Huffman lookup table assuming code lengths are in symbol order. + * + * @return number of slots used by resulting Huffman table + */ + static int buildHuffmanTable(int[] tableGroup, int tableIdx, int rootBits, int[] codeLengths, + int codeLengthsSize) { + final int tableOffset = tableGroup[tableIdx]; + final int[] sorted = new int[codeLengthsSize]; // Symbols sorted by code length. + // TODO(eustas): fill with zeroes? + final int[] count = new int[MAX_LENGTH + 1]; // Number of codes of each length. + final int[] offset = new int[MAX_LENGTH + 1]; // Offsets in sorted table for each length. + + // Build histogram of code lengths. + for (int sym = 0; sym < codeLengthsSize; ++sym) { + count[codeLengths[sym]]++; + } + + // Generate offsets into sorted symbol table by code length. + offset[1] = 0; + for (int len = 1; len < MAX_LENGTH; ++len) { + offset[len + 1] = offset[len] + count[len]; + } + + // Sort symbols by length, by symbol order within each length. + for (int sym = 0; sym < codeLengthsSize; ++sym) { + if (codeLengths[sym] != 0) { + sorted[offset[codeLengths[sym]]++] = sym; + } + } + + int tableBits = rootBits; + int tableSize = 1 << tableBits; + int totalSize = tableSize; + + // Special case code with only one value. + if (offset[MAX_LENGTH] == 1) { + for (int k = 0; k < totalSize; ++k) { + tableGroup[tableOffset + k] = sorted[0]; + } + return totalSize; + } + + // Fill in root table. + int key = 0; // Reversed prefix code. + int symbol = 0; + int step = 1; + for (int len = 1; len <= rootBits; ++len) { + step = step << 1; + while (count[len] > 0) { + replicateValue(tableGroup, tableOffset + key, step, tableSize, + len << 16 | sorted[symbol++]); + key = getNextKey(key, len); + count[len]--; + } + } + + // Fill in 2nd level tables and add pointers to root table. + final int mask = totalSize - 1; + int low = -1; + int currentOffset = tableOffset; + step = 1; + for (int len = rootBits + 1; len <= MAX_LENGTH; ++len) { + step = step << 1; + while (count[len] > 0) { + if ((key & mask) != low) { + currentOffset += tableSize; + tableBits = nextTableBitSize(count, len, rootBits); + tableSize = 1 << tableBits; + totalSize += tableSize; + low = key & mask; + tableGroup[tableOffset + low] = + (tableBits + rootBits) << 16 | (currentOffset - tableOffset - low); + } + replicateValue(tableGroup, currentOffset + (key >> rootBits), step, tableSize, + (len - rootBits) << 16 | sorted[symbol++]); + key = getNextKey(key, len); + count[len]--; + } + } + return totalSize; + } +} diff --git a/src/main/java/org/htmlunit/util/brotli/State.java b/src/main/java/org/htmlunit/util/brotli/State.java new file mode 100644 index 00000000000..1679aecc91c --- /dev/null +++ b/src/main/java/org/htmlunit/util/brotli/State.java @@ -0,0 +1,100 @@ +/* Copyright 2015 Google Inc. All Rights Reserved. + + Distributed under MIT license. + See file LICENSE for detail or copy at https://opensource.org/licenses/MIT +*/ + +package org.htmlunit.util.brotli; + +import java.io.InputStream; + +final class State { + byte[] ringBuffer; + byte[] contextModes; + byte[] contextMap; + byte[] distContextMap; + byte[] distExtraBits; + byte[] output; + byte[] byteBuffer; // BitReader + + short[] shortBuffer; // BitReader + + int[] intBuffer; // BitReader + int[] rings; + int[] blockTrees; + int[] literalTreeGroup; + int[] commandTreeGroup; + int[] distanceTreeGroup; + int[] distOffset; + + long accumulator64; // BitReader: pre-fetched bits. + + int runningState; // Default value is 0 == Decode.UNINITIALIZED + int nextRunningState; + int accumulator32; // BitReader: pre-fetched bits. + int bitOffset; // BitReader: bit-reading position in accumulator. + int halfOffset; // BitReader: offset of next item in intBuffer/shortBuffer. + int tailBytes; // BitReader: number of bytes in unfinished half. + int endOfStreamReached; // BitReader: input stream is finished. + int metaBlockLength; + int inputEnd; + int isUncompressed; + int isMetadata; + int literalBlockLength; + int numLiteralBlockTypes; + int commandBlockLength; + int numCommandBlockTypes; + int distanceBlockLength; + int numDistanceBlockTypes; + int pos; + int maxDistance; + int distRbIdx; + int trivialLiteralContext; + int literalTreeIdx; + int commandTreeIdx; + int j; + int insertLength; + int contextMapSlice; + int distContextMapSlice; + int contextLookupOffset1; + int contextLookupOffset2; + int distanceCode; + int numDirectDistanceCodes; + int distancePostfixBits; + int distance; + int copyLength; + int maxBackwardDistance; + int maxRingBufferSize; + int ringBufferSize; + int expectedTotalSize; + int outputOffset; + int outputLength; + int outputUsed; + int ringBufferBytesWritten; + int ringBufferBytesReady; + int isEager; + int isLargeWindow; + + // Compound dictionary + int cdNumChunks; + int cdTotalSize; + int cdBrIndex; + int cdBrOffset; + int cdBrLength; + int cdBrCopied; + byte[][] cdChunks; + int[] cdChunkOffsets; + int cdBlockBits; + byte[] cdBlockMap; + + InputStream input = Utils.makeEmptyInput(); // BitReader + + State() { + this.ringBuffer = new byte[0]; + this.rings = new int[10]; + this.rings[0] = 16; + this.rings[1] = 15; + this.rings[2] = 11; + this.rings[3] = 4; + } +} diff --git a/src/main/java/org/htmlunit/util/brotli/Transform.java b/src/main/java/org/htmlunit/util/brotli/Transform.java new file mode 100644 index 00000000000..cab195cf6b3 --- /dev/null +++ b/src/main/java/org/htmlunit/util/brotli/Transform.java @@ -0,0 +1,239 @@ +/* Copyright 2015 Google Inc. All Rights Reserved. + + Distributed under MIT license. + See file LICENSE for detail or copy at https://opensource.org/licenses/MIT +*/ + +package org.htmlunit.util.brotli; + +import java.nio.ByteBuffer; + +/** + * Transformations on dictionary words. + * + * Transform descriptor is a triplet: {prefix, operator, suffix}. + * "prefix" and "suffix" are short strings inserted before and after transformed dictionary word. + * "operator" is applied to dictionary word itself. + * + * Some operators has "built-in" parameters, i.e. parameter is defined by operator ordinal. Other + * operators have "external" parameters, supplied via additional table encoded in shared dictionary. + * + * Operators: + * - IDENTITY (0): dictionary word is inserted "as is" + * - OMIT_LAST_N (1 - 9): last N octets of dictionary word are not inserted; N == ordinal + * - OMIT_FIRST_M (12-20): first M octets of dictionary word are not inserted; M == ordinal - 11 + * - UPPERCASE_FIRST (10): first "scalar" is XOR'ed with number 32 + * - UPPERCASE_ALL (11): all "scalars" are XOR'ed with number 32 + * - SHIFT_FIRST (21): first "scalar" is shifted by number form parameter table + * - SHIFT_ALL (22): all "scalar" is shifted by number form parameter table + * + * Here "scalar" is a variable length character coding similar to UTF-8 encoding. + * UPPERCASE_XXX / SHIFT_XXX operators were designed to change the case of UTF-8 encoded characters. + * While UPPERCASE_XXX works well only on ASCII charset, SHIFT is much more generic and could be + * used for most (all?) alphabets. + */ +@SuppressWarnings("all") +final class Transform { + + static final class Transforms { + final int numTransforms; + final int[] triplets; + final byte[] prefixSuffixStorage; + final int[] prefixSuffixHeads; + final short[] params; + + Transforms(int numTransforms, int prefixSuffixLen, int prefixSuffixCount) { + this.numTransforms = numTransforms; + this.triplets = new int[numTransforms * 3]; + this.params = new short[numTransforms]; + this.prefixSuffixStorage = new byte[prefixSuffixLen]; + this.prefixSuffixHeads = new int[prefixSuffixCount + 1]; + } + } + + static final int NUM_RFC_TRANSFORMS = 121; + static final Transforms RFC_TRANSFORMS = new Transforms(NUM_RFC_TRANSFORMS, 167, 50); + + private static final int OMIT_FIRST_LAST_LIMIT = 9; + + private static final int IDENTITY = 0; + private static final int OMIT_LAST_BASE = IDENTITY + 1 - 1; // there is no OMIT_LAST_0. + private static final int UPPERCASE_FIRST = OMIT_LAST_BASE + OMIT_FIRST_LAST_LIMIT + 1; + private static final int UPPERCASE_ALL = UPPERCASE_FIRST + 1; + private static final int OMIT_FIRST_BASE = UPPERCASE_ALL + 1 - 1; // there is no OMIT_FIRST_0. + private static final int SHIFT_FIRST = OMIT_FIRST_BASE + OMIT_FIRST_LAST_LIMIT + 1; + private static final int SHIFT_ALL = SHIFT_FIRST + 1; + + // Bundle of 0-terminated strings. + private static final String PREFIX_SUFFIX_SRC = "# #s #, #e #.# the #.com/#\u00C2\u00A0# of # and" + + " # in # to #\"#\">#\n#]# for # a # that #. # with #'# from # by #. The # on # as # is #ing" + + " #\n\t#:#ed #(# at #ly #=\"# of the #. This #,# not #er #al #='#ful #ive #less #est #ize #" + + "ous #"; + private static final String TRANSFORMS_SRC = " !! ! , *! &! \" ! ) * * - ! # ! #!*! " + + "+ ,$ ! - % . / # 0 1 . \" 2 3!* 4% ! # / 5 6 7 8 0 1 & $ 9 + : " + + " ; < ' != > ?! 4 @ 4 2 & A *# ( B C& ) % ) !*# *-% A +! *. D! %' & E *6 F " + + " G% ! *A *% H! D I!+! J!+ K +- *4! A L!*4 M N +6 O!*% +.! K *G P +%( ! G *D +D " + + " Q +# *K!*G!+D!+# +G +A +4!+% +K!+4!*D!+K!*K"; + + private static void unpackTransforms(byte[] prefixSuffix, + int[] prefixSuffixHeads, int[] transforms, String prefixSuffixSrc, String transformsSrc) { + final int[] prefixSuffixBytes = Utils.toUtf8Runes(prefixSuffixSrc); + final int n = prefixSuffixBytes.length; + int index = 1; + int j = 0; + for (int i = 0; i < n; ++i) { + final int c = prefixSuffixBytes[i]; + if (c == 35) { // == # + prefixSuffixHeads[index++] = j; + } else { + prefixSuffix[j++] = (byte) c; + } + } + + for (int i = 0; i < NUM_RFC_TRANSFORMS * 3; ++i) { + transforms[i] = transformsSrc.charAt(i) - 32; + } + } + + static { + unpackTransforms(RFC_TRANSFORMS.prefixSuffixStorage, RFC_TRANSFORMS.prefixSuffixHeads, + RFC_TRANSFORMS.triplets, PREFIX_SUFFIX_SRC, TRANSFORMS_SRC); + } + + static int transformDictionaryWord(byte[] dst, int dstOffset, ByteBuffer src, int srcOffset, + int wordLen, Transforms transforms, int transformIndex) { + int offset = dstOffset; + final int[] triplets = transforms.triplets; + final byte[] prefixSuffixStorage = transforms.prefixSuffixStorage; + final int[] prefixSuffixHeads = transforms.prefixSuffixHeads; + final int transformOffset = 3 * transformIndex; + final int prefixIdx = triplets[transformOffset]; + final int transformType = triplets[transformOffset + 1]; + final int suffixIdx = triplets[transformOffset + 2]; + int prefix = prefixSuffixHeads[prefixIdx]; + final int prefixEnd = prefixSuffixHeads[prefixIdx + 1]; + int suffix = prefixSuffixHeads[suffixIdx]; + final int suffixEnd = prefixSuffixHeads[suffixIdx + 1]; + + int omitFirst = transformType - OMIT_FIRST_BASE; + int omitLast = transformType - OMIT_LAST_BASE; + if (omitFirst < 1 || omitFirst > OMIT_FIRST_LAST_LIMIT) { + omitFirst = 0; + } + if (omitLast < 1 || omitLast > OMIT_FIRST_LAST_LIMIT) { + omitLast = 0; + } + + // Copy prefix. + while (prefix != prefixEnd) { + dst[offset++] = prefixSuffixStorage[prefix++]; + } + + int len = wordLen; + // Copy trimmed word. + if (omitFirst > len) { + omitFirst = len; + } + int dictOffset = srcOffset + omitFirst; + len -= omitFirst; + len -= omitLast; + int i = len; + while (i > 0) { + dst[offset++] = src.get(dictOffset++); + i--; + } + + // Ferment. + if (transformType == UPPERCASE_FIRST || transformType == UPPERCASE_ALL) { + int uppercaseOffset = offset - len; + if (transformType == UPPERCASE_FIRST) { + len = 1; + } + while (len > 0) { + final int c0 = dst[uppercaseOffset] & 0xFF; + if (c0 < 0xC0) { + if (c0 >= 97 && c0 <= 122) { // in [a..z] range + dst[uppercaseOffset] = (byte) (dst[uppercaseOffset] ^ 32); + } + uppercaseOffset += 1; + len -= 1; + } else if (c0 < 0xE0) { + dst[uppercaseOffset + 1] = (byte) (dst[uppercaseOffset + 1] ^ 32); + uppercaseOffset += 2; + len -= 2; + } else { + dst[uppercaseOffset + 2] = (byte) (dst[uppercaseOffset + 2] ^ 5); + uppercaseOffset += 3; + len -= 3; + } + } + } else if (transformType == SHIFT_FIRST || transformType == SHIFT_ALL) { + int shiftOffset = offset - len; + final int param = transforms.params[transformIndex]; + /* Limited sign extension: scalar < (1 << 24). */ + int scalar = (param & 0x7FFF) + (0x1000000 - (param & 0x8000)); + while (len > 0) { + int step = 1; + final int c0 = dst[shiftOffset] & 0xFF; + if (c0 < 0x80) { + /* 1-byte rune / 0sssssss / 7 bit scalar (ASCII). */ + scalar += c0; + dst[shiftOffset] = (byte) (scalar & 0x7F); + } else if (c0 < 0xC0) { + /* Continuation / 10AAAAAA. */ + } else if (c0 < 0xE0) { + /* 2-byte rune / 110sssss AAssssss / 11 bit scalar. */ + if (len >= 2) { + final int c1 = dst[shiftOffset + 1]; + scalar += (c1 & 0x3F) | ((c0 & 0x1F) << 6); + dst[shiftOffset] = (byte) (0xC0 | ((scalar >> 6) & 0x1F)); + dst[shiftOffset + 1] = (byte) ((c1 & 0xC0) | (scalar & 0x3F)); + step = 2; + } else { + step = len; + } + } else if (c0 < 0xF0) { + /* 3-byte rune / 1110ssss AAssssss BBssssss / 16 bit scalar. */ + if (len >= 3) { + final int c1 = dst[shiftOffset + 1]; + final int c2 = dst[shiftOffset + 2]; + scalar += (c2 & 0x3F) | ((c1 & 0x3F) << 6) | ((c0 & 0x0F) << 12); + dst[shiftOffset] = (byte) (0xE0 | ((scalar >> 12) & 0x0F)); + dst[shiftOffset + 1] = (byte) ((c1 & 0xC0) | ((scalar >> 6) & 0x3F)); + dst[shiftOffset + 2] = (byte) ((c2 & 0xC0) | (scalar & 0x3F)); + step = 3; + } else { + step = len; + } + } else if (c0 < 0xF8) { + /* 4-byte rune / 11110sss AAssssss BBssssss CCssssss / 21 bit scalar. */ + if (len >= 4) { + final int c1 = dst[shiftOffset + 1]; + final int c2 = dst[shiftOffset + 2]; + final int c3 = dst[shiftOffset + 3]; + scalar += (c3 & 0x3F) | ((c2 & 0x3F) << 6) | ((c1 & 0x3F) << 12) | ((c0 & 0x07) << 18); + dst[shiftOffset] = (byte) (0xF0 | ((scalar >> 18) & 0x07)); + dst[shiftOffset + 1] = (byte) ((c1 & 0xC0) | ((scalar >> 12) & 0x3F)); + dst[shiftOffset + 2] = (byte) ((c2 & 0xC0) | ((scalar >> 6) & 0x3F)); + dst[shiftOffset + 3] = (byte) ((c3 & 0xC0) | (scalar & 0x3F)); + step = 4; + } else { + step = len; + } + } + shiftOffset += step; + len -= step; + if (transformType == SHIFT_FIRST) { + len = 0; + } + } + } + + // Copy suffix. + while (suffix != suffixEnd) { + dst[offset++] = prefixSuffixStorage[suffix++]; + } + + return offset - dstOffset; + } +} diff --git a/src/main/java/org/htmlunit/util/brotli/Utils.java b/src/main/java/org/htmlunit/util/brotli/Utils.java new file mode 100644 index 00000000000..985f7df5a0e --- /dev/null +++ b/src/main/java/org/htmlunit/util/brotli/Utils.java @@ -0,0 +1,164 @@ +/* Copyright 2015 Google Inc. All Rights Reserved. + + Distributed under MIT license. + See file LICENSE for detail or copy at https://opensource.org/licenses/MIT +*/ + +package org.htmlunit.util.brotli; + +import static org.htmlunit.util.brotli.BrotliError.BROTLI_ERROR_READ_FAILED; +import static org.htmlunit.util.brotli.BrotliError.BROTLI_OK; +import static org.htmlunit.util.brotli.BrotliError.BROTLI_PANIC; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.nio.Buffer; +import java.nio.ByteBuffer; + +/** + * A set of utility methods. + */ +@SuppressWarnings("all") +final class Utils { + + private static final byte[] BYTE_ZEROES = new byte[1024]; + + private static final int[] INT_ZEROES = new int[1024]; + + /** + * Fills byte array with zeroes. + * + *

Current implementation uses {@link System#arraycopy}, so it should be used for length not + * less than 16. + * + * @param dest array to fill with zeroes + * @param start the first item to fill + * @param end the last item to fill (exclusive) + */ + static void fillBytesWithZeroes(byte[] dest, int start, int end) { + int cursor = start; + while (cursor < end) { + int step = Math.min(cursor + 1024, end) - cursor; + System.arraycopy(BYTE_ZEROES, 0, dest, cursor, step); + cursor += step; + } + } + + /** + * Fills int array with zeroes. + * + *

Current implementation uses {@link System#arraycopy}, so it should be used for length not + * less than 16. + * + * @param dest array to fill with zeroes + * @param start the first item to fill + * @param end the last item to fill (exclusive) + */ + static void fillIntsWithZeroes(int[] dest, int start, int end) { + int cursor = start; + while (cursor < end) { + int step = Math.min(cursor + 1024, end) - cursor; + System.arraycopy(INT_ZEROES, 0, dest, cursor, step); + cursor += step; + } + } + + static void copyBytes(byte[] dst, int target, byte[] src, int start, int end) { + System.arraycopy(src, start, dst, target, end - start); + } + + static void copyBytesWithin(byte[] bytes, int target, int start, int end) { + System.arraycopy(bytes, start, bytes, target, end - start); + } + + static int readInput(State s, byte[] dst, int offset, int length) { + try { + return s.input.read(dst, offset, length); + } catch (IOException e) { + return makeError(s, BROTLI_ERROR_READ_FAILED); + } + } + + static InputStream makeEmptyInput() { + return new ByteArrayInputStream(new byte[0]); + } + + static void closeInput(State s) throws IOException { + s.input.close(); + s.input = makeEmptyInput(); + } + + static byte[] toUsAsciiBytes(String src) { + try { + // NB: String#getBytes(String) is present in JDK 1.1, while other variants require JDK 1.6 and + // above. + return src.getBytes("US-ASCII"); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(e); // cannot happen + } + } + + static int[] toUtf8Runes(String src) { + int[] result = new int[src.length()]; + for (int i = 0; i < src.length(); i++) { + result[i] = src.charAt(i); + } + return result; + } + + static ByteBuffer asReadOnlyBuffer(ByteBuffer src) { + return src.asReadOnlyBuffer(); + } + + static int isReadOnly(ByteBuffer src) { + return src.isReadOnly() ? 1 : 0; + } + + static int isDirect(ByteBuffer src) { + return src.isDirect() ? 1 : 0; + } + + // Crazy pills factory: code compiled for JDK8 does not work on JRE9. + static void flipBuffer(Buffer buffer) { + buffer.flip(); + } + + static int isDebugMode() { + boolean assertsEnabled = Boolean.parseBoolean(System.getProperty("BROTLI_ENABLE_ASSERTS")); + return assertsEnabled ? 1 : 0; + } + + // See BitReader.LOG_BITNESS + static int getLogBintness() { + boolean isLongExpensive = Boolean.parseBoolean(System.getProperty("BROTLI_32_BIT_CPU")); + return isLongExpensive ? 5 : 6; + } + + static int shr32(int x, int y) { + return x >>> y; + } + + static long shr64(long x, int y) { + return x >>> y; + } + + static int min(int a, int b) { + return Math.min(a, b); + } + + static int makeError(State s, int code) { + if (code >= BROTLI_OK) { + return code; + } + if (s.runningState >= 0) { + s.runningState = code; // Only the first error is remembered. + } + // TODO(eustas): expand codes to messages, if ever necessary. + if (code <= BROTLI_PANIC) { + throw new IllegalStateException("Brotli error code: " + code); + } + throw new BrotliRuntimeException("Error code: " + code); + } +} diff --git a/src/site/xdoc/index.xml b/src/site/xdoc/index.xml index e210b4110a3..8a950f9a87c 100644 --- a/src/site/xdoc/index.xml +++ b/src/site/xdoc/index.xml @@ -92,9 +92,9 @@

-
Latest release August 17, 2025
+
Latest release August 29, 2025
-

version 4.15.0

+

version 4.16.0

Source code
@@ -220,14 +220,14 @@ org.htmlunit htmlunit - 4.15.0 + 4.16.0 ]]>

For gradle, you would add: +implementation group: 'org.htmlunit', name: 'htmlunit', version: '4.16.0']]>

diff --git a/src/test/java/org/htmlunit/CodeStyleTest.java b/src/test/java/org/htmlunit/CodeStyleTest.java index 1615975ca77..6061a8bfa9c 100644 --- a/src/test/java/org/htmlunit/CodeStyleTest.java +++ b/src/test/java/org/htmlunit/CodeStyleTest.java @@ -128,6 +128,7 @@ private void addAll(final File dir, final List files) throws IOException { for (final File child : children) { if (child.isDirectory() && !".git".equals(child.getName()) + && !"brotli".equals(child.getName()) && !("test".equals(dir.getName()) && "resources".equals(child.getName()))) { addAll(child, files); } diff --git a/src/test/java/org/htmlunit/ExternalTest.java b/src/test/java/org/htmlunit/ExternalTest.java index 77795535f44..7984e86c5d6 100644 --- a/src/test/java/org/htmlunit/ExternalTest.java +++ b/src/test/java/org/htmlunit/ExternalTest.java @@ -86,8 +86,27 @@ public void pom() throws Exception { final List lines = FileUtils.readLines(new File("pom.xml"), ISO_8859_1); final List wrongVersions = new LinkedList<>(); + boolean inComment = false; for (int i = 0; i < lines.size(); i++) { - final String line = lines.get(i); + String line = lines.get(i); + + String cleaned = ""; + if (!inComment) { + final int startIdx = line.indexOf(""); + if (endIdx != -1) { + cleaned += line.substring(endIdx + 3, line.length()); + inComment = false; + } + line = cleaned; + } + if (line.trim().equals("")) { processProperties(lines, i + 1, properties); } diff --git a/src/test/java/org/htmlunit/WebDriverTestCase.java b/src/test/java/org/htmlunit/WebDriverTestCase.java index a87d25fbf6f..248e089f510 100644 --- a/src/test/java/org/htmlunit/WebDriverTestCase.java +++ b/src/test/java/org/htmlunit/WebDriverTestCase.java @@ -88,7 +88,7 @@ import org.openqa.selenium.chrome.ChromeDriverService; import org.openqa.selenium.chrome.ChromeOptions; import org.openqa.selenium.devtools.DevTools; -import org.openqa.selenium.devtools.v138.emulation.Emulation; +import org.openqa.selenium.devtools.v139.emulation.Emulation; import org.openqa.selenium.edge.EdgeDriver; import org.openqa.selenium.edge.EdgeDriverService; import org.openqa.selenium.edge.EdgeOptions; diff --git a/src/test/java/org/htmlunit/archunit/ArchitectureTest.java b/src/test/java/org/htmlunit/archunit/ArchitectureTest.java index bebf52d24c8..101fa50aa46 100644 --- a/src/test/java/org/htmlunit/archunit/ArchitectureTest.java +++ b/src/test/java/org/htmlunit/archunit/ArchitectureTest.java @@ -61,6 +61,7 @@ public class ArchitectureTest { .that().haveNameMatching(".*Util.?") .and().doNotHaveFullyQualifiedName("org.htmlunit.cssparser.util.ParserUtils") .and().doNotHaveFullyQualifiedName("org.htmlunit.http.HttpUtils") + .and().doNotHaveFullyQualifiedName("org.htmlunit.util.brotli.Utils") .and().doNotHaveFullyQualifiedName("org.htmlunit.platform.font.AwtFontUtil") .and().doNotHaveFullyQualifiedName("org.htmlunit.platform.font.FontUtil") @@ -87,6 +88,56 @@ public class ArchitectureTest { .and().resideOutsideOfPackage("org.htmlunit.jetty..") .should().dependOnClassesThat().resideInAnyPackage("java.awt.."); + /** + * Do not use org.apache.commons.lang3.StringUtils.isEmpty(CharSequence). + */ + @ArchTest + public static final ArchRule apacheStringUtilsIsEmptyRule = noClasses() + .should().callMethod(org.apache.commons.lang3.StringUtils.class, "isEmpty", CharSequence.class); + + /** + * Do not use org.apache.commons.lang3.StringUtils.isBlank(CharSequence). + */ + @ArchTest + public static final ArchRule apacheStringUtilsIsBlankRule = noClasses() + .should().callMethod(org.apache.commons.lang3.StringUtils.class, "isBlank", CharSequence.class); + + /** + * Do not use org.apache.commons.lang3.StringUtils.isNotBlank(CharSequence). + */ + @ArchTest + public static final ArchRule apacheStringUtilsIsNotBlankRule = noClasses() + .should().callMethod(org.apache.commons.lang3.StringUtils.class, "isNotBlank", CharSequence.class); + + /** + * Do not use org.apache.commons.lang3.Strings.startsWith(CharSequence, CharSequence). + */ + @ArchTest + public static final ArchRule apacheStringsStartsWithRule = noClasses() + .should().callMethod(org.apache.commons.lang3.Strings.class, "startsWith", CharSequence.class, CharSequence.class); + + /** + * Do not use org.apache.commons.lang3.Strings.endsWith(CharSequence, CharSequence). + */ + @ArchTest + public static final ArchRule apacheStringsEndsWithRule = noClasses() + .should().callMethod(org.apache.commons.lang3.Strings.class, "endsWith", CharSequence.class, CharSequence.class); + + /** + * Do not use org.apache.commons.lang3.Strings.contains(CharSequence, CharSequence). + */ + @ArchTest + public static final ArchRule apacheStringsContainsRule = noClasses() + .should().callMethod(org.apache.commons.lang3.Strings.class, "contains", CharSequence.class, CharSequence.class); + + /** + * Do not use org.apache.commons.lang3.StringUtils.toRootLowerCase(String). + */ + @ArchTest + public static final ArchRule apacheStringstoRootLowerCaseRule = noClasses() + .should().callMethod(org.apache.commons.lang3.StringUtils.class, "toRootLowerCase", String.class); + + /** * The jetty websocket stuff is only used by one class. */ diff --git a/src/test/java/org/htmlunit/html/XHtmlPage2Test.java b/src/test/java/org/htmlunit/html/XHtmlPage2Test.java index fa2af3f52b9..a975e91df4c 100644 --- a/src/test/java/org/htmlunit/html/XHtmlPage2Test.java +++ b/src/test/java/org/htmlunit/html/XHtmlPage2Test.java @@ -91,18 +91,18 @@ public void selfClosingTextarea() throws Exception { @Alerts({"beforeafter", "

beforeafter
", "beforeinsideafter"}) - @HtmlUnitNYI(CHROME = {"beforeafter", - "
beforeafter
", - "beforeafter"}, - EDGE = {"beforeafter", - "
beforeafter
", - "beforeafter"}, - FF = {"beforeafter", - "
beforeafter
", - "beforeafter"}, - FF_ESR = {"beforeafter", - "
beforeafter
", - "beforeafter"}) + @HtmlUnitNYI(CHROME = {"beforeafter", + "
beforeafter
", + "beforeinsideafter"}, + EDGE = {"beforeafter", + "
beforeafter
", + "beforeinsideafter"}, + FF = {"beforeafter", + "
beforeafter
", + "beforeinsideafter"}, + FF_ESR = {"beforeafter", + "
beforeafter
", + "beforeinsideafter"}) public void cdata() throws Exception { final String html = "\n" @@ -141,18 +141,18 @@ public void cdata() throws Exception { @Alerts({"before]]>after", "
before
]]>after", "before
after"}) - @HtmlUnitNYI(CHROME = {"beforeafter", - "
beforeafter
", - "beforeafter"}, - EDGE = {"beforeafter", - "
beforeafter
", - "beforeafter"}, - FF = {"beforeafter", - "
beforeafter
", - "beforeafter"}, - FF_ESR = {"beforeafter", - "
beforeafter
", - "beforeafter"}) + @HtmlUnitNYI(CHROME = {"before]]>after", + "
before
]]>after", + "before
after"}, + EDGE = {"before]]>after", + "
before
]]>after", + "before
after"}, + FF = {"before]]>after", + "
before
]]>after", + "before
after"}, + FF_ESR = {"before]]>after", + "
before
]]>after", + "before
after"}) public void earlyClosingCdata() throws Exception { final String html = "\n" diff --git a/src/test/java/org/htmlunit/javascript/FunctionsTest.java b/src/test/java/org/htmlunit/javascript/FunctionsTest.java index 29c037c4792..da0cfd4b581 100644 --- a/src/test/java/org/htmlunit/javascript/FunctionsTest.java +++ b/src/test/java/org/htmlunit/javascript/FunctionsTest.java @@ -281,4 +281,101 @@ public void applyToCallSetsCorrectFunctionThis() throws Exception { loadPageVerifyTitle2(html); } + + /** + * @throws Exception if the test fails + */ + @Test + @Alerts("abcd / undefined") + public void boundWithoutArgs() throws Exception { + final String html = DOCTYPE_HTML + + "\n" + + "\n" + + "\n" + + ""; + + loadPageVerifyTitle2(html); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Alerts("abcd / world") + public void boundWithArg() throws Exception { + final String html = DOCTYPE_HTML + + "\n" + + "\n" + + "\n" + + ""; + + loadPageVerifyTitle2(html); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Alerts("world") + public void bound() throws Exception { + final String html = DOCTYPE_HTML + + "\n" + + "\n" + + "\n" + + ""; + + loadPageVerifyTitle2(html); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Alerts({"f1", "f2", "f3", "f4", "f5", + "f6", "g", "3", "[foo]", ""}) + public void name() throws Exception { + final String html = DOCTYPE_HTML + + "\n" + + "\n" + + "\n" + + ""; + + loadPageVerifyTitle2(html); + } } diff --git a/src/test/java/org/htmlunit/javascript/NativeArrayBufferTest.java b/src/test/java/org/htmlunit/javascript/NativeArrayBufferTest.java new file mode 100644 index 00000000000..d8a3470034c --- /dev/null +++ b/src/test/java/org/htmlunit/javascript/NativeArrayBufferTest.java @@ -0,0 +1,103 @@ +/* + * Copyright (c) 2002-2025 Gargoyle Software Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.htmlunit.javascript; + +import org.htmlunit.WebDriverTestCase; +import org.htmlunit.junit.annotation.Alerts; +import org.junit.jupiter.api.Test; + +/** + * Tests for NativeArrayBuffer. + * + * @author Ronald Brill + */ +public class NativeArrayBufferTest extends WebDriverTestCase { + + /** + * @throws Exception if the test fails + */ + @Test + @Alerts({"true", "8", "2", "4", + "4", "2", "undefined", + "8", "2", "0"}) + public void transfer() throws Exception { + final String html = DOCTYPE_HTML + + "\n" + + "\n" + + "\n" + + ""; + + loadPageVerifyTitle2(html); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Alerts({"8", "2", "4"}) + public void transferToFixedLength() throws Exception { + final String html = DOCTYPE_HTML + + "\n" + + "\n" + + "\n" + + ""; + + loadPageVerifyTitle2(html); + } +} diff --git a/src/test/java/org/htmlunit/javascript/NativeObjectTest.java b/src/test/java/org/htmlunit/javascript/NativeObjectTest.java index da0c5141a69..0ad33f1d74c 100644 --- a/src/test/java/org/htmlunit/javascript/NativeObjectTest.java +++ b/src/test/java/org/htmlunit/javascript/NativeObjectTest.java @@ -471,4 +471,27 @@ public void definePropertyUsingConsString() throws Exception { loadPageVerifyTitle2(html); } + + /** + * @throws Exception if the test fails + */ + @Test + @Alerts("val1-val2") + public void objectAssignCopiesSymbols() throws Exception { + final String html = DOCTYPE_HTML + + "\n" + + "\n" + + "\n" + + ""; + + loadPageVerifyTitle2(html); + } } diff --git a/src/test/java/org/htmlunit/javascript/NativeSetTest.java b/src/test/java/org/htmlunit/javascript/NativeSetTest.java new file mode 100644 index 00000000000..10fdd25659b --- /dev/null +++ b/src/test/java/org/htmlunit/javascript/NativeSetTest.java @@ -0,0 +1,174 @@ +/* + * Copyright (c) 2002-2025 Gargoyle Software Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.htmlunit.javascript; + +import org.htmlunit.WebDriverTestCase; +import org.htmlunit.junit.annotation.Alerts; +import org.junit.jupiter.api.Test; + +/** + * Tests for NativeSet. + * + * @author Ronald Brill + */ +public class NativeSetTest extends WebDriverTestCase { + + /** + * @throws Exception if the test fails + */ + @Test + @Alerts("1,9") + public void intersection() throws Exception { + final String html = DOCTYPE_HTML + + "\n" + + "\n" + + "\n" + + ""; + + loadPageVerifyTitle2(html); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Alerts("1,2,4,6,8,9") + public void union() throws Exception { + final String html = DOCTYPE_HTML + + "\n" + + "\n" + + "\n" + + ""; + + loadPageVerifyTitle2(html); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Alerts("3,5,7") + public void difference() throws Exception { + final String html = DOCTYPE_HTML + + "\n" + + "\n" + + "\n" + + ""; + + loadPageVerifyTitle2(html); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Alerts("1,2,6,8,9") + public void symmetricDifference() throws Exception { + final String html = DOCTYPE_HTML + + "\n" + + "\n" + + "\n" + + ""; + + loadPageVerifyTitle2(html); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Alerts("true") + public void isSubsetOf() throws Exception { + final String html = DOCTYPE_HTML + + "\n" + + "\n" + + "\n" + + ""; + + loadPageVerifyTitle2(html); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Alerts("true") + public void isSupersetOf() throws Exception { + final String html = DOCTYPE_HTML + + "\n" + + "\n" + + "\n" + + ""; + + loadPageVerifyTitle2(html); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Alerts("true") + public void isDisjointFrom() throws Exception { + final String html = DOCTYPE_HTML + + "\n" + + "\n" + + "\n" + + ""; + + loadPageVerifyTitle2(html); + } +} diff --git a/src/test/java/org/htmlunit/junit/ErrorOutputChecker.java b/src/test/java/org/htmlunit/junit/ErrorOutputChecker.java index 9a3c6574911..cba5ffed70a 100644 --- a/src/test/java/org/htmlunit/junit/ErrorOutputChecker.java +++ b/src/test/java/org/htmlunit/junit/ErrorOutputChecker.java @@ -50,6 +50,9 @@ public class ErrorOutputChecker implements BeforeEachCallback, AfterEachCallback Pattern.compile(".*com.caucho.quercus.servlet.QuercusServlet initImpl\r?\n"), Pattern.compile(".*QuercusServlet starting as QuercusServletImpl\r?\n"), Pattern.compile(".*Quercus finished initialization in \\d*ms\r?\n"), + + // XSLT + Pattern.compile("ERROR: 'Use of the extension function .*\r?\n"), }; @Override diff --git a/src/test/java/org/htmlunit/libraries/Jasmine3x9x0SmokeTest.java b/src/test/java/org/htmlunit/libraries/Jasmine3x9x0SmokeTest.java deleted file mode 100644 index 24989809c26..00000000000 --- a/src/test/java/org/htmlunit/libraries/Jasmine3x9x0SmokeTest.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2002-2025 Gargoyle Software Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.htmlunit.libraries; - -import org.eclipse.jetty.server.Server; -import org.htmlunit.WebClient; -import org.htmlunit.WebServerTestCase; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; - -/** - * A simple smoke test for jasmine 3.9.0. - * See issue #1001 for more. - * - * @author Ronald Brill - */ -public class Jasmine3x9x0SmokeTest extends WebServerTestCase { - - /** The server. */ - protected static Server SERVER_; - - /** - * @throws Exception if an error occurs - */ - @BeforeAll - public static void startSesrver() throws Exception { - SERVER_ = WebServerTestCase.createWebServer("src/test/resources/libraries/jasmine/jasmine_3.9.0", null); - } - - /** - * @throws Exception if an error occurs - */ - @AfterAll - public static void stopServer() throws Exception { - if (SERVER_ != null) { - SERVER_.stop(); - SERVER_.destroy(); - SERVER_ = null; - } - } - - /** - * @throws Exception if an error occurs - */ - @Test - public void shouldTestJavaScript() throws Exception { - final WebClient webClient = getWebClient(); - - webClient.getPage(URL_FIRST + "smoketest.html"); - } -} diff --git a/src/test/java/org/htmlunit/util/StringUtilsTest.java b/src/test/java/org/htmlunit/util/StringUtilsTest.java index ac2a3fbc87c..ecb7d9fcd01 100644 --- a/src/test/java/org/htmlunit/util/StringUtilsTest.java +++ b/src/test/java/org/htmlunit/util/StringUtilsTest.java @@ -45,6 +45,67 @@ public void isEmptyString() throws Exception { assertFalse(StringUtils.isEmptyString("string")); } + /** + * @throws Exception if the test fails + */ + @Test + public void isEmptyOrNull() throws Exception { + assertTrue(StringUtils.isEmptyOrNull(null)); + assertTrue(StringUtils.isEmptyOrNull("")); + assertFalse(StringUtils.isEmptyOrNull(" ")); + assertFalse(StringUtils.isEmptyOrNull("\t")); + assertFalse(StringUtils.isEmptyOrNull("\r")); + assertFalse(StringUtils.isEmptyOrNull("\n")); + assertFalse(StringUtils.isEmptyOrNull("string")); + } + + + /** + * @throws Exception if the test fails + */ + @Test + public void defaultIfEmptyOrNull() throws Exception { + assertEquals("X", StringUtils.defaultIfEmptyOrNull(null, "X")); + assertEquals("X", StringUtils.defaultIfEmptyOrNull("", "X")); + + assertEquals(" ", StringUtils.defaultIfEmptyOrNull(" ", "X")); + assertEquals("a", StringUtils.defaultIfEmptyOrNull("a", "X")); + } + + /** + * @throws Exception if the test fails + */ + @Test + public void isBlank() throws Exception { + assertTrue(StringUtils.isBlank(null)); + assertTrue(StringUtils.isBlank("")); + assertTrue(StringUtils.isBlank(" ")); + assertTrue(StringUtils.isBlank("\t")); + assertTrue(StringUtils.isBlank("\r")); + assertTrue(StringUtils.isBlank("\n")); + + assertFalse(StringUtils.isBlank("x")); + assertFalse(StringUtils.isBlank("string")); + assertFalse(StringUtils.isBlank(" x")); + } + + /** + * @throws Exception if the test fails + */ + @Test + public void isNotBlank() throws Exception { + assertFalse(StringUtils.isNotBlank(null)); + assertFalse(StringUtils.isNotBlank("")); + assertFalse(StringUtils.isNotBlank(" ")); + assertFalse(StringUtils.isNotBlank("\t")); + assertFalse(StringUtils.isNotBlank("\r")); + assertFalse(StringUtils.isNotBlank("\n")); + + assertTrue(StringUtils.isNotBlank("x")); + assertTrue(StringUtils.isNotBlank("string")); + assertTrue(StringUtils.isNotBlank(" x")); + } + /** * @throws Exception if the test fails */ @@ -64,8 +125,10 @@ public void equalsChar() throws Exception { */ @Test public void startsWithIgnoreCase() throws Exception { + assertTrue(StringUtils.startsWithIgnoreCase("abcd", "a")); assertTrue(StringUtils.startsWithIgnoreCase("abcd", "ab")); assertTrue(StringUtils.startsWithIgnoreCase("abcd", "abcd")); + assertTrue(StringUtils.startsWithIgnoreCase("abcd", "A")); assertTrue(StringUtils.startsWithIgnoreCase("abcd", "AB")); assertTrue(StringUtils.startsWithIgnoreCase("Abcd", "abCd")); @@ -81,6 +144,74 @@ public void startsWithIgnoreCase() throws Exception { Assertions.assertThrows(IllegalArgumentException.class, () -> StringUtils.startsWithIgnoreCase("", "")); } + /** + * @throws Exception if the test fails + */ + @Test + public void endsWithIgnoreCase() throws Exception { + assertTrue(StringUtils.endsWithIgnoreCase("abcd", "d")); + assertTrue(StringUtils.endsWithIgnoreCase("abcd", "cd")); + assertTrue(StringUtils.endsWithIgnoreCase("abcd", "abcd")); + assertTrue(StringUtils.endsWithIgnoreCase("abcd", "D")); + assertTrue(StringUtils.endsWithIgnoreCase("abcd", "CD")); + assertTrue(StringUtils.endsWithIgnoreCase("Abcd", "abCd")); + + assertFalse(StringUtils.endsWithIgnoreCase("AB", "x")); + assertFalse(StringUtils.endsWithIgnoreCase("AB", "xxzOO")); + assertFalse(StringUtils.endsWithIgnoreCase("", "x")); + assertFalse(StringUtils.endsWithIgnoreCase("abcd", "bc")); + + assertFalse(StringUtils.endsWithIgnoreCase(null, "x")); + + Assertions.assertThrows(IllegalArgumentException.class, () -> StringUtils.endsWithIgnoreCase("AB", null)); + Assertions.assertThrows(IllegalArgumentException.class, () -> StringUtils.endsWithIgnoreCase("AB", "")); + Assertions.assertThrows(IllegalArgumentException.class, () -> StringUtils.endsWithIgnoreCase("", "")); + } + + /** + * @throws Exception if the test fails + */ + @Test + public void containsIgnoreCase() throws Exception { + assertTrue(StringUtils.containsIgnoreCase("abcd", "a")); + assertTrue(StringUtils.containsIgnoreCase("abcd", "b")); + assertTrue(StringUtils.containsIgnoreCase("abcd", "c")); + assertTrue(StringUtils.containsIgnoreCase("abcd", "d")); + assertTrue(StringUtils.containsIgnoreCase("abcd", "A")); + assertTrue(StringUtils.containsIgnoreCase("abcd", "B")); + assertTrue(StringUtils.containsIgnoreCase("abcd", "C")); + assertTrue(StringUtils.containsIgnoreCase("abcd", "D")); + assertTrue(StringUtils.containsIgnoreCase("abcd", "cd")); + assertTrue(StringUtils.containsIgnoreCase("abcd", "Cd")); + assertTrue(StringUtils.containsIgnoreCase("abcd", "abcd")); + assertTrue(StringUtils.containsIgnoreCase("abcd", "D")); + assertTrue(StringUtils.containsIgnoreCase("abcd", "CD")); + assertTrue(StringUtils.containsIgnoreCase("Abcd", "abCd")); + + assertFalse(StringUtils.containsIgnoreCase("AB", "x")); + assertFalse(StringUtils.containsIgnoreCase("AB", "xxzOO")); + assertFalse(StringUtils.containsIgnoreCase("", "x")); + assertFalse(StringUtils.containsIgnoreCase("abcd", "bd")); + + assertFalse(StringUtils.containsIgnoreCase(null, "x")); + + Assertions.assertThrows(IllegalArgumentException.class, () -> StringUtils.containsIgnoreCase("AB", null)); + Assertions.assertThrows(IllegalArgumentException.class, () -> StringUtils.containsIgnoreCase("AB", "")); + Assertions.assertThrows(IllegalArgumentException.class, () -> StringUtils.containsIgnoreCase("", "")); + } + + /** + * @throws Exception if the test fails + */ + @Test + public void toRootLowerCase() throws Exception { + assertEquals("abcd", StringUtils.toRootLowerCase("abcd")); + assertEquals("abcd", StringUtils.toRootLowerCase("ABcD")); + + assertEquals("", StringUtils.toRootLowerCase("")); + assertNull(StringUtils.toRootLowerCase(null)); + } + /** * @throws Exception if the test fails */ diff --git a/src/test/resources/libraries/jasmine/jasmine_3.9.0/boot0.js b/src/test/resources/libraries/jasmine/jasmine_3.9.0/boot0.js deleted file mode 100644 index ca72e4962eb..00000000000 --- a/src/test/resources/libraries/jasmine/jasmine_3.9.0/boot0.js +++ /dev/null @@ -1,42 +0,0 @@ -/** - This file starts the process of "booting" Jasmine. It initializes Jasmine, - makes its globals available, and creates the env. This file should be loaded - after `jasmine.js` and `jasmine_html.js`, but before `boot1.js` or any project - source files or spec files are loaded. - */ -(function() { - var jasmineRequire = window.jasmineRequire || require('./jasmine.js'); - - /** - * ## Require & Instantiate - * - * Require Jasmine's core files. Specifically, this requires and attaches all of Jasmine's code to the `jasmine` reference. - */ - var jasmine = jasmineRequire.core(jasmineRequire), - global = jasmine.getGlobal(); - global.jasmine = jasmine; - - /** - * Since this is being run in a browser and the results should populate to an HTML page, require the HTML-specific Jasmine code, injecting the same reference. - */ - jasmineRequire.html(jasmine); - - /** - * Create the Jasmine environment. This is used to run all specs in a project. - */ - var env = jasmine.getEnv(); - - /** - * ## The Global Interface - * - * Build up the functions that will be exposed as the Jasmine public interface. A project can customize, rename or alias any of these functions as desired, provided the implementation remains unchanged. - */ - var jasmineInterface = jasmineRequire.interface(jasmine, env); - - /** - * Add all of the Jasmine global/public interface to the global scope, so a project can use the public interface directly. For example, calling `describe` in specs instead of `jasmine.getEnv().describe`. - */ - for (var property in jasmineInterface) { - global[property] = jasmineInterface[property]; - } -}()); diff --git a/src/test/resources/libraries/jasmine/jasmine_3.9.0/boot1.js b/src/test/resources/libraries/jasmine/jasmine_3.9.0/boot1.js deleted file mode 100644 index 5df04bb85fb..00000000000 --- a/src/test/resources/libraries/jasmine/jasmine_3.9.0/boot1.js +++ /dev/null @@ -1,111 +0,0 @@ -/** - This file finishes "booting" Jasmine, performing all of the necessary - initialization before executing the loaded environment and all of a project's - specs. This file should be loaded after `boot0.js` but before any project - source files or spec files are loaded. Thus this file can also be used to - customize Jasmine for a project. - - If a project is using Jasmine via the standalone distribution, this file can - be customized directly. If you only wish to configure the Jasmine env, you - can load another file that calls `jasmine.getEnv().configure({...})` - after `boot0.js` is loaded and before this file is loaded. - */ - -(function() { - var env = jasmine.getEnv(); - - /** - * ## Runner Parameters - * - * More browser specific code - wrap the query string in an object and to allow for getting/setting parameters from the runner user interface. - */ - - var queryString = new jasmine.QueryString({ - getWindowLocation: function() { return window.location; } - }); - - var filterSpecs = !!queryString.getParam("spec"); - - var config = { - failFast: queryString.getParam("failFast"), - oneFailurePerSpec: queryString.getParam("oneFailurePerSpec"), - hideDisabled: queryString.getParam("hideDisabled") - }; - - var random = queryString.getParam("random"); - - if (random !== undefined && random !== "") { - config.random = random; - } - - var seed = queryString.getParam("seed"); - if (seed) { - config.seed = seed; - } - - /** - * ## Reporters - * The `HtmlReporter` builds all of the HTML UI for the runner page. This reporter paints the dots, stars, and x's for specs, as well as all spec names and all failures (if any). - */ - var htmlReporter = new jasmine.HtmlReporter({ - env: env, - navigateWithNewParam: function(key, value) { return queryString.navigateWithNewParam(key, value); }, - addToExistingQueryString: function(key, value) { return queryString.fullStringWithNewParam(key, value); }, - getContainer: function() { return document.body; }, - createElement: function() { return document.createElement.apply(document, arguments); }, - createTextNode: function() { return document.createTextNode.apply(document, arguments); }, - timer: new jasmine.Timer(), - filterSpecs: filterSpecs - }); - - /** - * The `jsApiReporter` also receives spec results, and is used by any environment that needs to extract the results from JavaScript. - */ - env.addReporter(jsApiReporter); - env.addReporter(htmlReporter); - - /** - * Filter which specs will be run by matching the start of the full name against the `spec` query param. - */ - var specFilter = new jasmine.HtmlSpecFilter({ - filterString: function() { return queryString.getParam("spec"); } - }); - - config.specFilter = function(spec) { - return specFilter.matches(spec.getFullName()); - }; - - env.configure(config); - - /** - * Setting up timing functions to be able to be overridden. Certain browsers (Safari, IE 8, phantomjs) require this hack. - */ - window.setTimeout = window.setTimeout; - window.setInterval = window.setInterval; - window.clearTimeout = window.clearTimeout; - window.clearInterval = window.clearInterval; - - /** - * ## Execution - * - * Replace the browser window's `onload`, ensure it's called, and then run all of the loaded specs. This includes initializing the `HtmlReporter` instance and then executing the loaded Jasmine environment. All of this will happen after all of the specs are loaded. - */ - var currentWindowOnload = window.onload; - - window.onload = function() { - if (currentWindowOnload) { - currentWindowOnload(); - } - htmlReporter.initialize(); - env.execute(); - }; - - /** - * Helper function for readability above. - */ - function extend(destination, source) { - for (var property in source) destination[property] = source[property]; - return destination; - } - -}()); diff --git a/src/test/resources/libraries/jasmine/jasmine_3.9.0/jasmine-html.js b/src/test/resources/libraries/jasmine/jasmine_3.9.0/jasmine-html.js deleted file mode 100644 index 8399eda4229..00000000000 --- a/src/test/resources/libraries/jasmine/jasmine_3.9.0/jasmine-html.js +++ /dev/null @@ -1,856 +0,0 @@ -/* -Copyright (c) 2008-2021 Pivotal Labs - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ -var jasmineRequire = window.jasmineRequire || require('./jasmine.js'); - -jasmineRequire.html = function(j$) { - j$.ResultsNode = jasmineRequire.ResultsNode(); - j$.HtmlReporter = jasmineRequire.HtmlReporter(j$); - j$.QueryString = jasmineRequire.QueryString(); - j$.HtmlSpecFilter = jasmineRequire.HtmlSpecFilter(); -}; - -jasmineRequire.HtmlReporter = function(j$) { - function ResultsStateBuilder() { - this.topResults = new j$.ResultsNode({}, '', null); - this.currentParent = this.topResults; - this.specsExecuted = 0; - this.failureCount = 0; - this.pendingSpecCount = 0; - } - - ResultsStateBuilder.prototype.suiteStarted = function(result) { - this.currentParent.addChild(result, 'suite'); - this.currentParent = this.currentParent.last(); - }; - - ResultsStateBuilder.prototype.suiteDone = function(result) { - this.currentParent.updateResult(result); - if (this.currentParent !== this.topResults) { - this.currentParent = this.currentParent.parent; - } - - if (result.status === 'failed') { - this.failureCount++; - } - }; - - ResultsStateBuilder.prototype.specStarted = function(result) {}; - - ResultsStateBuilder.prototype.specDone = function(result) { - this.currentParent.addChild(result, 'spec'); - - if (result.status !== 'excluded') { - this.specsExecuted++; - } - - if (result.status === 'failed') { - this.failureCount++; - } - - if (result.status == 'pending') { - this.pendingSpecCount++; - } - }; - - function HtmlReporter(options) { - var config = function() { - return (options.env && options.env.configuration()) || {}; - }, - getContainer = options.getContainer, - createElement = options.createElement, - createTextNode = options.createTextNode, - navigateWithNewParam = options.navigateWithNewParam || function() {}, - addToExistingQueryString = - options.addToExistingQueryString || defaultQueryString, - filterSpecs = options.filterSpecs, - htmlReporterMain, - symbols, - deprecationWarnings = []; - - this.initialize = function() { - clearPrior(); - htmlReporterMain = createDom( - 'div', - { className: 'jasmine_html-reporter' }, - createDom( - 'div', - { className: 'jasmine-banner' }, - createDom('a', { - className: 'jasmine-title', - href: 'http://jasmine.github.io/', - target: '_blank' - }), - createDom('span', { className: 'jasmine-version' }, j$.version) - ), - createDom('ul', { className: 'jasmine-symbol-summary' }), - createDom('div', { className: 'jasmine-alert' }), - createDom( - 'div', - { className: 'jasmine-results' }, - createDom('div', { className: 'jasmine-failures' }) - ) - ); - getContainer().appendChild(htmlReporterMain); - }; - - var totalSpecsDefined; - this.jasmineStarted = function(options) { - totalSpecsDefined = options.totalSpecsDefined || 0; - }; - - var summary = createDom('div', { className: 'jasmine-summary' }); - - var stateBuilder = new ResultsStateBuilder(); - - this.suiteStarted = function(result) { - stateBuilder.suiteStarted(result); - }; - - this.suiteDone = function(result) { - stateBuilder.suiteDone(result); - - if (result.status === 'failed') { - failures.push(failureDom(result)); - } - addDeprecationWarnings(result, 'suite'); - }; - - this.specStarted = function(result) { - stateBuilder.specStarted(result); - }; - - var failures = []; - this.specDone = function(result) { - stateBuilder.specDone(result); - - if (noExpectations(result)) { - var noSpecMsg = "Spec '" + result.fullName + "' has no expectations."; - if (result.status === 'failed') { - console.error(noSpecMsg); - } else { - console.warn(noSpecMsg); - } - } - - if (!symbols) { - symbols = find('.jasmine-symbol-summary'); - } - - symbols.appendChild( - createDom('li', { - className: this.displaySpecInCorrectFormat(result), - id: 'spec_' + result.id, - title: result.fullName - }) - ); - - if (result.status === 'failed') { - failures.push(failureDom(result)); - } - - addDeprecationWarnings(result, 'spec'); - }; - - this.displaySpecInCorrectFormat = function(result) { - return noExpectations(result) && result.status === 'passed' - ? 'jasmine-empty' - : this.resultStatus(result.status); - }; - - this.resultStatus = function(status) { - if (status === 'excluded') { - return config().hideDisabled - ? 'jasmine-excluded-no-display' - : 'jasmine-excluded'; - } - return 'jasmine-' + status; - }; - - this.jasmineDone = function(doneResult) { - var banner = find('.jasmine-banner'); - var alert = find('.jasmine-alert'); - var order = doneResult && doneResult.order; - var i; - alert.appendChild( - createDom( - 'span', - { className: 'jasmine-duration' }, - 'finished in ' + doneResult.totalTime / 1000 + 's' - ) - ); - - banner.appendChild(optionsMenu(config())); - - if (stateBuilder.specsExecuted < totalSpecsDefined) { - var skippedMessage = - 'Ran ' + - stateBuilder.specsExecuted + - ' of ' + - totalSpecsDefined + - ' specs - run all'; - // include window.location.pathname to fix issue with karma-jasmine-html-reporter in angular: see https://github.com/jasmine/jasmine/issues/1906 - var skippedLink = - (window.location.pathname || '') + - addToExistingQueryString('spec', ''); - alert.appendChild( - createDom( - 'span', - { className: 'jasmine-bar jasmine-skipped' }, - createDom( - 'a', - { href: skippedLink, title: 'Run all specs' }, - skippedMessage - ) - ) - ); - } - var statusBarMessage = ''; - var statusBarClassName = 'jasmine-overall-result jasmine-bar '; - var globalFailures = (doneResult && doneResult.failedExpectations) || []; - var failed = stateBuilder.failureCount + globalFailures.length > 0; - - if (totalSpecsDefined > 0 || failed) { - statusBarMessage += - pluralize('spec', stateBuilder.specsExecuted) + - ', ' + - pluralize('failure', stateBuilder.failureCount); - if (stateBuilder.pendingSpecCount) { - statusBarMessage += - ', ' + pluralize('pending spec', stateBuilder.pendingSpecCount); - } - } - - if (doneResult.overallStatus === 'passed') { - statusBarClassName += ' jasmine-passed '; - } else if (doneResult.overallStatus === 'incomplete') { - statusBarClassName += ' jasmine-incomplete '; - statusBarMessage = - 'Incomplete: ' + - doneResult.incompleteReason + - ', ' + - statusBarMessage; - } else { - statusBarClassName += ' jasmine-failed '; - } - - var seedBar; - if (order && order.random) { - seedBar = createDom( - 'span', - { className: 'jasmine-seed-bar' }, - ', randomized with seed ', - createDom( - 'a', - { - title: 'randomized with seed ' + order.seed, - href: seedHref(order.seed) - }, - order.seed - ) - ); - } - - alert.appendChild( - createDom( - 'span', - { className: statusBarClassName }, - statusBarMessage, - seedBar - ) - ); - - var errorBarClassName = 'jasmine-bar jasmine-errored'; - var afterAllMessagePrefix = 'AfterAll '; - - for (i = 0; i < globalFailures.length; i++) { - alert.appendChild( - createDom( - 'span', - { className: errorBarClassName }, - globalFailureMessage(globalFailures[i]) - ) - ); - } - - function globalFailureMessage(failure) { - if (failure.globalErrorType === 'load') { - var prefix = 'Error during loading: ' + failure.message; - - if (failure.filename) { - return ( - prefix + ' in ' + failure.filename + ' line ' + failure.lineno - ); - } else { - return prefix; - } - } else { - return afterAllMessagePrefix + failure.message; - } - } - - addDeprecationWarnings(doneResult); - - for (i = 0; i < deprecationWarnings.length; i++) { - var context; - - switch (deprecationWarnings[i].runnableType) { - case 'spec': - context = '(in spec: ' + deprecationWarnings[i].runnableName + ')'; - break; - case 'suite': - context = '(in suite: ' + deprecationWarnings[i].runnableName + ')'; - break; - default: - context = ''; - } - - alert.appendChild( - createDom( - 'span', - { className: 'jasmine-bar jasmine-warning' }, - 'DEPRECATION: ' + deprecationWarnings[i].message, - createDom('br'), - context - ) - ); - } - - var results = find('.jasmine-results'); - results.appendChild(summary); - - summaryList(stateBuilder.topResults, summary); - - if (failures.length) { - alert.appendChild( - createDom( - 'span', - { className: 'jasmine-menu jasmine-bar jasmine-spec-list' }, - createDom('span', {}, 'Spec List | '), - createDom( - 'a', - { className: 'jasmine-failures-menu', href: '#' }, - 'Failures' - ) - ) - ); - alert.appendChild( - createDom( - 'span', - { className: 'jasmine-menu jasmine-bar jasmine-failure-list' }, - createDom( - 'a', - { className: 'jasmine-spec-list-menu', href: '#' }, - 'Spec List' - ), - createDom('span', {}, ' | Failures ') - ) - ); - - find('.jasmine-failures-menu').onclick = function() { - setMenuModeTo('jasmine-failure-list'); - return false; - }; - find('.jasmine-spec-list-menu').onclick = function() { - setMenuModeTo('jasmine-spec-list'); - return false; - }; - - setMenuModeTo('jasmine-failure-list'); - - var failureNode = find('.jasmine-failures'); - for (i = 0; i < failures.length; i++) { - failureNode.appendChild(failures[i]); - } - } - }; - - return this; - - function failureDom(result) { - var failure = createDom( - 'div', - { className: 'jasmine-spec-detail jasmine-failed' }, - failureDescription(result, stateBuilder.currentParent), - createDom('div', { className: 'jasmine-messages' }) - ); - var messages = failure.childNodes[1]; - - for (var i = 0; i < result.failedExpectations.length; i++) { - var expectation = result.failedExpectations[i]; - messages.appendChild( - createDom( - 'div', - { className: 'jasmine-result-message' }, - expectation.message - ) - ); - messages.appendChild( - createDom( - 'div', - { className: 'jasmine-stack-trace' }, - expectation.stack - ) - ); - } - - if (result.failedExpectations.length === 0) { - messages.appendChild( - createDom( - 'div', - { className: 'jasmine-result-message' }, - 'Spec has no expectations' - ) - ); - } - - return failure; - } - - function summaryList(resultsTree, domParent) { - var specListNode; - for (var i = 0; i < resultsTree.children.length; i++) { - var resultNode = resultsTree.children[i]; - if (filterSpecs && !hasActiveSpec(resultNode)) { - continue; - } - if (resultNode.type === 'suite') { - var suiteListNode = createDom( - 'ul', - { className: 'jasmine-suite', id: 'suite-' + resultNode.result.id }, - createDom( - 'li', - { - className: - 'jasmine-suite-detail jasmine-' + resultNode.result.status - }, - createDom( - 'a', - { href: specHref(resultNode.result) }, - resultNode.result.description - ) - ) - ); - - summaryList(resultNode, suiteListNode); - domParent.appendChild(suiteListNode); - } - if (resultNode.type === 'spec') { - if (domParent.getAttribute('class') !== 'jasmine-specs') { - specListNode = createDom('ul', { className: 'jasmine-specs' }); - domParent.appendChild(specListNode); - } - var specDescription = resultNode.result.description; - if (noExpectations(resultNode.result)) { - specDescription = 'SPEC HAS NO EXPECTATIONS ' + specDescription; - } - if ( - resultNode.result.status === 'pending' && - resultNode.result.pendingReason !== '' - ) { - specDescription = - specDescription + - ' PENDING WITH MESSAGE: ' + - resultNode.result.pendingReason; - } - specListNode.appendChild( - createDom( - 'li', - { - className: 'jasmine-' + resultNode.result.status, - id: 'spec-' + resultNode.result.id - }, - createDom( - 'a', - { href: specHref(resultNode.result) }, - specDescription - ) - ) - ); - } - } - } - - function optionsMenu(config) { - var optionsMenuDom = createDom( - 'div', - { className: 'jasmine-run-options' }, - createDom('span', { className: 'jasmine-trigger' }, 'Options'), - createDom( - 'div', - { className: 'jasmine-payload' }, - createDom( - 'div', - { className: 'jasmine-stop-on-failure' }, - createDom('input', { - className: 'jasmine-fail-fast', - id: 'jasmine-fail-fast', - type: 'checkbox' - }), - createDom( - 'label', - { className: 'jasmine-label', for: 'jasmine-fail-fast' }, - 'stop execution on spec failure' - ) - ), - createDom( - 'div', - { className: 'jasmine-throw-failures' }, - createDom('input', { - className: 'jasmine-throw', - id: 'jasmine-throw-failures', - type: 'checkbox' - }), - createDom( - 'label', - { className: 'jasmine-label', for: 'jasmine-throw-failures' }, - 'stop spec on expectation failure' - ) - ), - createDom( - 'div', - { className: 'jasmine-random-order' }, - createDom('input', { - className: 'jasmine-random', - id: 'jasmine-random-order', - type: 'checkbox' - }), - createDom( - 'label', - { className: 'jasmine-label', for: 'jasmine-random-order' }, - 'run tests in random order' - ) - ), - createDom( - 'div', - { className: 'jasmine-hide-disabled' }, - createDom('input', { - className: 'jasmine-disabled', - id: 'jasmine-hide-disabled', - type: 'checkbox' - }), - createDom( - 'label', - { className: 'jasmine-label', for: 'jasmine-hide-disabled' }, - 'hide disabled tests' - ) - ) - ) - ); - - var failFastCheckbox = optionsMenuDom.querySelector('#jasmine-fail-fast'); - failFastCheckbox.checked = config.stopOnSpecFailure; - failFastCheckbox.onclick = function() { - navigateWithNewParam('failFast', !config.stopOnSpecFailure); - }; - - var throwCheckbox = optionsMenuDom.querySelector( - '#jasmine-throw-failures' - ); - throwCheckbox.checked = config.stopSpecOnExpectationFailure; - throwCheckbox.onclick = function() { - navigateWithNewParam( - 'oneFailurePerSpec', - !config.stopSpecOnExpectationFailure - ); - }; - - var randomCheckbox = optionsMenuDom.querySelector( - '#jasmine-random-order' - ); - randomCheckbox.checked = config.random; - randomCheckbox.onclick = function() { - navigateWithNewParam('random', !config.random); - }; - - var hideDisabled = optionsMenuDom.querySelector('#jasmine-hide-disabled'); - hideDisabled.checked = config.hideDisabled; - hideDisabled.onclick = function() { - navigateWithNewParam('hideDisabled', !config.hideDisabled); - }; - - var optionsTrigger = optionsMenuDom.querySelector('.jasmine-trigger'), - optionsPayload = optionsMenuDom.querySelector('.jasmine-payload'), - isOpen = /\bjasmine-open\b/; - - optionsTrigger.onclick = function() { - if (isOpen.test(optionsPayload.className)) { - optionsPayload.className = optionsPayload.className.replace( - isOpen, - '' - ); - } else { - optionsPayload.className += ' jasmine-open'; - } - }; - - return optionsMenuDom; - } - - function failureDescription(result, suite) { - var wrapper = createDom( - 'div', - { className: 'jasmine-description' }, - createDom( - 'a', - { title: result.description, href: specHref(result) }, - result.description - ) - ); - var suiteLink; - - while (suite && suite.parent) { - wrapper.insertBefore(createTextNode(' > '), wrapper.firstChild); - suiteLink = createDom( - 'a', - { href: suiteHref(suite) }, - suite.result.description - ); - wrapper.insertBefore(suiteLink, wrapper.firstChild); - - suite = suite.parent; - } - - return wrapper; - } - - function suiteHref(suite) { - var els = []; - - while (suite && suite.parent) { - els.unshift(suite.result.description); - suite = suite.parent; - } - - // include window.location.pathname to fix issue with karma-jasmine-html-reporter in angular: see https://github.com/jasmine/jasmine/issues/1906 - return ( - (window.location.pathname || '') + - addToExistingQueryString('spec', els.join(' ')) - ); - } - - function addDeprecationWarnings(result, runnableType) { - if (result && result.deprecationWarnings) { - for (var i = 0; i < result.deprecationWarnings.length; i++) { - var warning = result.deprecationWarnings[i].message; - if (!j$.util.arrayContains(warning)) { - deprecationWarnings.push({ - message: warning, - runnableName: result.fullName, - runnableType: runnableType - }); - } - } - } - } - - function find(selector) { - return getContainer().querySelector('.jasmine_html-reporter ' + selector); - } - - function clearPrior() { - // return the reporter - var oldReporter = find(''); - - if (oldReporter) { - getContainer().removeChild(oldReporter); - } - } - - function createDom(type, attrs, childrenVarArgs) { - var el = createElement(type); - - for (var i = 2; i < arguments.length; i++) { - var child = arguments[i]; - - if (typeof child === 'string') { - el.appendChild(createTextNode(child)); - } else { - if (child) { - el.appendChild(child); - } - } - } - - for (var attr in attrs) { - if (attr == 'className') { - el[attr] = attrs[attr]; - } else { - el.setAttribute(attr, attrs[attr]); - } - } - - return el; - } - - function pluralize(singular, count) { - var word = count == 1 ? singular : singular + 's'; - - return '' + count + ' ' + word; - } - - function specHref(result) { - // include window.location.pathname to fix issue with karma-jasmine-html-reporter in angular: see https://github.com/jasmine/jasmine/issues/1906 - return ( - (window.location.pathname || '') + - addToExistingQueryString('spec', result.fullName) - ); - } - - function seedHref(seed) { - // include window.location.pathname to fix issue with karma-jasmine-html-reporter in angular: see https://github.com/jasmine/jasmine/issues/1906 - return ( - (window.location.pathname || '') + - addToExistingQueryString('seed', seed) - ); - } - - function defaultQueryString(key, value) { - return '?' + key + '=' + value; - } - - function setMenuModeTo(mode) { - htmlReporterMain.setAttribute('class', 'jasmine_html-reporter ' + mode); - } - - function noExpectations(result) { - var allExpectations = - result.failedExpectations.length + result.passedExpectations.length; - - return ( - allExpectations === 0 && - (result.status === 'passed' || result.status === 'failed') - ); - } - - function hasActiveSpec(resultNode) { - if (resultNode.type == 'spec' && resultNode.result.status != 'excluded') { - return true; - } - - if (resultNode.type == 'suite') { - for (var i = 0, j = resultNode.children.length; i < j; i++) { - if (hasActiveSpec(resultNode.children[i])) { - return true; - } - } - } - } - } - - return HtmlReporter; -}; - -jasmineRequire.HtmlSpecFilter = function() { - function HtmlSpecFilter(options) { - var filterString = - options && - options.filterString() && - options.filterString().replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&'); - var filterPattern = new RegExp(filterString); - - this.matches = function(specName) { - return filterPattern.test(specName); - }; - } - - return HtmlSpecFilter; -}; - -jasmineRequire.ResultsNode = function() { - function ResultsNode(result, type, parent) { - this.result = result; - this.type = type; - this.parent = parent; - - this.children = []; - - this.addChild = function(result, type) { - this.children.push(new ResultsNode(result, type, this)); - }; - - this.last = function() { - return this.children[this.children.length - 1]; - }; - - this.updateResult = function(result) { - this.result = result; - }; - } - - return ResultsNode; -}; - -jasmineRequire.QueryString = function() { - function QueryString(options) { - this.navigateWithNewParam = function(key, value) { - options.getWindowLocation().search = this.fullStringWithNewParam( - key, - value - ); - }; - - this.fullStringWithNewParam = function(key, value) { - var paramMap = queryStringToParamMap(); - paramMap[key] = value; - return toQueryString(paramMap); - }; - - this.getParam = function(key) { - return queryStringToParamMap()[key]; - }; - - return this; - - function toQueryString(paramMap) { - var qStrPairs = []; - for (var prop in paramMap) { - qStrPairs.push( - encodeURIComponent(prop) + '=' + encodeURIComponent(paramMap[prop]) - ); - } - return '?' + qStrPairs.join('&'); - } - - function queryStringToParamMap() { - var paramStr = options.getWindowLocation().search.substring(1), - params = [], - paramMap = {}; - - if (paramStr.length > 0) { - params = paramStr.split('&'); - for (var i = 0; i < params.length; i++) { - var p = params[i].split('='); - var value = decodeURIComponent(p[1]); - if (value === 'true' || value === 'false') { - value = JSON.parse(value); - } - paramMap[decodeURIComponent(p[0])] = value; - } - } - - return paramMap; - } - } - - return QueryString; -}; diff --git a/src/test/resources/libraries/jasmine/jasmine_3.9.0/jasmine.js b/src/test/resources/libraries/jasmine/jasmine_3.9.0/jasmine.js deleted file mode 100644 index 67ae3805099..00000000000 --- a/src/test/resources/libraries/jasmine/jasmine_3.9.0/jasmine.js +++ /dev/null @@ -1,9876 +0,0 @@ -/* -Copyright (c) 2008-2021 Pivotal Labs - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ -// eslint-disable-next-line no-unused-vars -var getJasmineRequireObj = (function(jasmineGlobal) { - var jasmineRequire; - - if ( - typeof module !== 'undefined' && - module.exports && - typeof exports !== 'undefined' - ) { - if (typeof global !== 'undefined') { - jasmineGlobal = global; - } else { - jasmineGlobal = {}; - } - jasmineRequire = exports; - } else { - if ( - typeof window !== 'undefined' && - typeof window.toString === 'function' && - window.toString() === '[object GjsGlobal]' - ) { - jasmineGlobal = window; - } - jasmineRequire = jasmineGlobal.jasmineRequire = {}; - } - - function getJasmineRequire() { - return jasmineRequire; - } - - getJasmineRequire().core = function(jRequire) { - var j$ = {}; - - jRequire.base(j$, jasmineGlobal); - j$.util = jRequire.util(j$); - j$.errors = jRequire.errors(); - j$.formatErrorMsg = jRequire.formatErrorMsg(); - j$.Any = jRequire.Any(j$); - j$.Anything = jRequire.Anything(j$); - j$.CallTracker = jRequire.CallTracker(j$); - j$.MockDate = jRequire.MockDate(); - j$.getClearStack = jRequire.clearStack(j$); - j$.Clock = jRequire.Clock(); - j$.DelayedFunctionScheduler = jRequire.DelayedFunctionScheduler(j$); - j$.Env = jRequire.Env(j$); - j$.StackTrace = jRequire.StackTrace(j$); - j$.ExceptionFormatter = jRequire.ExceptionFormatter(j$); - j$.ExpectationFilterChain = jRequire.ExpectationFilterChain(); - j$.Expector = jRequire.Expector(j$); - j$.Expectation = jRequire.Expectation(j$); - j$.buildExpectationResult = jRequire.buildExpectationResult(j$); - j$.JsApiReporter = jRequire.JsApiReporter(j$); - j$.asymmetricEqualityTesterArgCompatShim = jRequire.asymmetricEqualityTesterArgCompatShim( - j$ - ); - j$.makePrettyPrinter = jRequire.makePrettyPrinter(j$); - j$.pp = j$.makePrettyPrinter(); - j$.MatchersUtil = jRequire.MatchersUtil(j$); - j$.matchersUtil = new j$.MatchersUtil({ - customTesters: [], - pp: j$.pp - }); - - j$.ObjectContaining = jRequire.ObjectContaining(j$); - j$.ArrayContaining = jRequire.ArrayContaining(j$); - j$.ArrayWithExactContents = jRequire.ArrayWithExactContents(j$); - j$.MapContaining = jRequire.MapContaining(j$); - j$.SetContaining = jRequire.SetContaining(j$); - j$.QueueRunner = jRequire.QueueRunner(j$); - j$.ReportDispatcher = jRequire.ReportDispatcher(j$); - j$.Spec = jRequire.Spec(j$); - j$.Spy = jRequire.Spy(j$); - j$.SpyFactory = jRequire.SpyFactory(j$); - j$.SpyRegistry = jRequire.SpyRegistry(j$); - j$.SpyStrategy = jRequire.SpyStrategy(j$); - j$.StringMatching = jRequire.StringMatching(j$); - j$.UserContext = jRequire.UserContext(j$); - j$.Suite = jRequire.Suite(j$); - j$.Timer = jRequire.Timer(); - j$.TreeProcessor = jRequire.TreeProcessor(); - j$.version = jRequire.version(); - j$.Order = jRequire.Order(); - j$.DiffBuilder = jRequire.DiffBuilder(j$); - j$.NullDiffBuilder = jRequire.NullDiffBuilder(j$); - j$.ObjectPath = jRequire.ObjectPath(j$); - j$.MismatchTree = jRequire.MismatchTree(j$); - j$.GlobalErrors = jRequire.GlobalErrors(j$); - - j$.Truthy = jRequire.Truthy(j$); - j$.Falsy = jRequire.Falsy(j$); - j$.Empty = jRequire.Empty(j$); - j$.NotEmpty = jRequire.NotEmpty(j$); - - j$.matchers = jRequire.requireMatchers(jRequire, j$); - j$.asyncMatchers = jRequire.requireAsyncMatchers(jRequire, j$); - - return j$; - }; - - return getJasmineRequire; -})(this); - -getJasmineRequireObj().requireMatchers = function(jRequire, j$) { - var availableMatchers = [ - 'nothing', - 'toBe', - 'toBeCloseTo', - 'toBeDefined', - 'toBeInstanceOf', - 'toBeFalse', - 'toBeFalsy', - 'toBeGreaterThan', - 'toBeGreaterThanOrEqual', - 'toBeLessThan', - 'toBeLessThanOrEqual', - 'toBeNaN', - 'toBeNegativeInfinity', - 'toBeNull', - 'toBePositiveInfinity', - 'toBeTrue', - 'toBeTruthy', - 'toBeUndefined', - 'toContain', - 'toEqual', - 'toHaveSize', - 'toHaveBeenCalled', - 'toHaveBeenCalledBefore', - 'toHaveBeenCalledOnceWith', - 'toHaveBeenCalledTimes', - 'toHaveBeenCalledWith', - 'toHaveClass', - 'toMatch', - 'toThrow', - 'toThrowError', - 'toThrowMatching' - ], - matchers = {}; - - for (var i = 0; i < availableMatchers.length; i++) { - var name = availableMatchers[i]; - matchers[name] = jRequire[name](j$); - } - - return matchers; -}; - -getJasmineRequireObj().base = function(j$, jasmineGlobal) { - j$.unimplementedMethod_ = function() { - throw new Error('unimplemented method'); - }; - - /** - * Maximum object depth the pretty printer will print to. - * Set this to a lower value to speed up pretty printing if you have large objects. - * @name jasmine.MAX_PRETTY_PRINT_DEPTH - * @since 1.3.0 - */ - j$.MAX_PRETTY_PRINT_DEPTH = 8; - /** - * Maximum number of array elements to display when pretty printing objects. - * This will also limit the number of keys and values displayed for an object. - * Elements past this number will be ellipised. - * @name jasmine.MAX_PRETTY_PRINT_ARRAY_LENGTH - * @since 2.7.0 - */ - j$.MAX_PRETTY_PRINT_ARRAY_LENGTH = 50; - /** - * Maximum number of characters to display when pretty printing objects. - * Characters past this number will be ellipised. - * @name jasmine.MAX_PRETTY_PRINT_CHARS - * @since 2.9.0 - */ - j$.MAX_PRETTY_PRINT_CHARS = 1000; - /** - * Default number of milliseconds Jasmine will wait for an asynchronous spec to complete. - * @name jasmine.DEFAULT_TIMEOUT_INTERVAL - * @since 1.3.0 - */ - j$.DEFAULT_TIMEOUT_INTERVAL = 5000; - - j$.getGlobal = function() { - return jasmineGlobal; - }; - - /** - * Get the currently booted Jasmine Environment. - * - * @name jasmine.getEnv - * @since 1.3.0 - * @function - * @return {Env} - */ - j$.getEnv = function(options) { - var env = (j$.currentEnv_ = j$.currentEnv_ || new j$.Env(options)); - //jasmine. singletons in here (setTimeout blah blah). - return env; - }; - - j$.isArray_ = function(value) { - return j$.isA_('Array', value); - }; - - j$.isObject_ = function(value) { - return ( - !j$.util.isUndefined(value) && value !== null && j$.isA_('Object', value) - ); - }; - - j$.isString_ = function(value) { - return j$.isA_('String', value); - }; - - j$.isNumber_ = function(value) { - return j$.isA_('Number', value); - }; - - j$.isFunction_ = function(value) { - return j$.isA_('Function', value); - }; - - j$.isAsyncFunction_ = function(value) { - return j$.isA_('AsyncFunction', value); - }; - - j$.isGeneratorFunction_ = function(value) { - return j$.isA_('GeneratorFunction', value); - }; - - j$.isTypedArray_ = function(value) { - return ( - j$.isA_('Float32Array', value) || - j$.isA_('Float64Array', value) || - j$.isA_('Int16Array', value) || - j$.isA_('Int32Array', value) || - j$.isA_('Int8Array', value) || - j$.isA_('Uint16Array', value) || - j$.isA_('Uint32Array', value) || - j$.isA_('Uint8Array', value) || - j$.isA_('Uint8ClampedArray', value) - ); - }; - - j$.isA_ = function(typeName, value) { - return j$.getType_(value) === '[object ' + typeName + ']'; - }; - - j$.isError_ = function(value) { - if (!value) { - return false; - } - - if (value instanceof Error) { - return true; - } - if ( - typeof window !== 'undefined' && - typeof window.trustedTypes !== 'undefined' - ) { - return ( - typeof value.stack === 'string' && typeof value.message === 'string' - ); - } - if (value && value.constructor && value.constructor.constructor) { - var valueGlobal = value.constructor.constructor('return this'); - if (j$.isFunction_(valueGlobal)) { - valueGlobal = valueGlobal(); - } - - if (valueGlobal.Error && value instanceof valueGlobal.Error) { - return true; - } - } - return false; - }; - - j$.isAsymmetricEqualityTester_ = function(obj) { - return obj ? j$.isA_('Function', obj.asymmetricMatch) : false; - }; - - j$.getType_ = function(value) { - return Object.prototype.toString.apply(value); - }; - - j$.isDomNode = function(obj) { - // Node is a function, because constructors - return typeof jasmineGlobal.Node !== 'undefined' - ? obj instanceof jasmineGlobal.Node - : obj !== null && - typeof obj === 'object' && - typeof obj.nodeType === 'number' && - typeof obj.nodeName === 'string'; - // return obj.nodeType > 0; - }; - - j$.isMap = function(obj) { - return ( - obj !== null && - typeof obj !== 'undefined' && - typeof jasmineGlobal.Map !== 'undefined' && - obj.constructor === jasmineGlobal.Map - ); - }; - - j$.isSet = function(obj) { - return ( - obj !== null && - typeof obj !== 'undefined' && - typeof jasmineGlobal.Set !== 'undefined' && - obj.constructor === jasmineGlobal.Set - ); - }; - - j$.isWeakMap = function(obj) { - return ( - obj !== null && - typeof obj !== 'undefined' && - typeof jasmineGlobal.WeakMap !== 'undefined' && - obj.constructor === jasmineGlobal.WeakMap - ); - }; - - j$.isURL = function(obj) { - return ( - obj !== null && - typeof obj !== 'undefined' && - typeof jasmineGlobal.URL !== 'undefined' && - obj.constructor === jasmineGlobal.URL - ); - }; - - j$.isDataView = function(obj) { - return ( - obj !== null && - typeof obj !== 'undefined' && - typeof jasmineGlobal.DataView !== 'undefined' && - obj.constructor === jasmineGlobal.DataView - ); - }; - - j$.isPromise = function(obj) { - return ( - typeof jasmineGlobal.Promise !== 'undefined' && - !!obj && - obj.constructor === jasmineGlobal.Promise - ); - }; - - j$.isPromiseLike = function(obj) { - return !!obj && j$.isFunction_(obj.then); - }; - - j$.fnNameFor = function(func) { - if (func.name) { - return func.name; - } - - var matches = - func.toString().match(/^\s*function\s*(\w+)\s*\(/) || - func.toString().match(/^\s*\[object\s*(\w+)Constructor\]/); - - return matches ? matches[1] : ''; - }; - - j$.isPending_ = function(promise) { - var sentinel = {}; - // eslint-disable-next-line compat/compat - return Promise.race([promise, Promise.resolve(sentinel)]).then( - function(result) { - return result === sentinel; - }, - function() { - return false; - } - ); - }; - - /** - * Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}), - * that will succeed if the actual value being compared is an instance of the specified class/constructor. - * @name jasmine.any - * @since 1.3.0 - * @function - * @param {Constructor} clazz - The constructor to check against. - */ - j$.any = function(clazz) { - return new j$.Any(clazz); - }; - - /** - * Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}), - * that will succeed if the actual value being compared is not `null` and not `undefined`. - * @name jasmine.anything - * @since 2.2.0 - * @function - */ - j$.anything = function() { - return new j$.Anything(); - }; - - /** - * Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}), - * that will succeed if the actual value being compared is `true` or anything truthy. - * @name jasmine.truthy - * @since 3.1.0 - * @function - */ - j$.truthy = function() { - return new j$.Truthy(); - }; - - /** - * Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}), - * that will succeed if the actual value being compared is `null`, `undefined`, `0`, `false` or anything falsey. - * @name jasmine.falsy - * @since 3.1.0 - * @function - */ - j$.falsy = function() { - return new j$.Falsy(); - }; - - /** - * Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}), - * that will succeed if the actual value being compared is empty. - * @name jasmine.empty - * @since 3.1.0 - * @function - */ - j$.empty = function() { - return new j$.Empty(); - }; - - /** - * Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}), - * that will succeed if the actual value being compared is not empty. - * @name jasmine.notEmpty - * @since 3.1.0 - * @function - */ - j$.notEmpty = function() { - return new j$.NotEmpty(); - }; - - /** - * Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}), - * that will succeed if the actual value being compared contains at least the keys and values. - * @name jasmine.objectContaining - * @since 1.3.0 - * @function - * @param {Object} sample - The subset of properties that _must_ be in the actual. - */ - j$.objectContaining = function(sample) { - return new j$.ObjectContaining(sample); - }; - - /** - * Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}), - * that will succeed if the actual value is a `String` that matches the `RegExp` or `String`. - * @name jasmine.stringMatching - * @since 2.2.0 - * @function - * @param {RegExp|String} expected - */ - j$.stringMatching = function(expected) { - return new j$.StringMatching(expected); - }; - - /** - * Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}), - * that will succeed if the actual value is an `Array` that contains at least the elements in the sample. - * @name jasmine.arrayContaining - * @since 2.2.0 - * @function - * @param {Array} sample - */ - j$.arrayContaining = function(sample) { - return new j$.ArrayContaining(sample); - }; - - /** - * Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}), - * that will succeed if the actual value is an `Array` that contains all of the elements in the sample in any order. - * @name jasmine.arrayWithExactContents - * @since 2.8.0 - * @function - * @param {Array} sample - */ - j$.arrayWithExactContents = function(sample) { - return new j$.ArrayWithExactContents(sample); - }; - - /** - * Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}), - * that will succeed if every key/value pair in the sample passes the deep equality comparison - * with at least one key/value pair in the actual value being compared - * @name jasmine.mapContaining - * @since 3.5.0 - * @function - * @param {Map} sample - The subset of items that _must_ be in the actual. - */ - j$.mapContaining = function(sample) { - return new j$.MapContaining(sample); - }; - - /** - * Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}), - * that will succeed if every item in the sample passes the deep equality comparison - * with at least one item in the actual value being compared - * @name jasmine.setContaining - * @since 3.5.0 - * @function - * @param {Set} sample - The subset of items that _must_ be in the actual. - */ - j$.setContaining = function(sample) { - return new j$.SetContaining(sample); - }; - - /** - * Determines whether the provided function is a Jasmine spy. - * @name jasmine.isSpy - * @since 2.0.0 - * @function - * @param {Function} putativeSpy - The function to check. - * @return {Boolean} - */ - j$.isSpy = function(putativeSpy) { - if (!putativeSpy) { - return false; - } - return ( - putativeSpy.and instanceof j$.SpyStrategy && - putativeSpy.calls instanceof j$.CallTracker - ); - }; -}; - -getJasmineRequireObj().util = function(j$) { - var util = {}; - - util.inherit = function(childClass, parentClass) { - var Subclass = function() {}; - Subclass.prototype = parentClass.prototype; - childClass.prototype = new Subclass(); - }; - - util.argsToArray = function(args) { - var arrayOfArgs = []; - for (var i = 0; i < args.length; i++) { - arrayOfArgs.push(args[i]); - } - return arrayOfArgs; - }; - - util.isUndefined = function(obj) { - return obj === void 0; - }; - - util.arrayContains = function(array, search) { - var i = array.length; - while (i--) { - if (array[i] === search) { - return true; - } - } - return false; - }; - - util.clone = function(obj) { - if (Object.prototype.toString.apply(obj) === '[object Array]') { - return obj.slice(); - } - - var cloned = {}; - for (var prop in obj) { - if (obj.hasOwnProperty(prop)) { - cloned[prop] = obj[prop]; - } - } - - return cloned; - }; - - util.cloneArgs = function(args) { - var clonedArgs = []; - var argsAsArray = j$.util.argsToArray(args); - for (var i = 0; i < argsAsArray.length; i++) { - var str = Object.prototype.toString.apply(argsAsArray[i]), - primitives = /^\[object (Boolean|String|RegExp|Number)/; - - // All falsey values are either primitives, `null`, or `undefined. - if (!argsAsArray[i] || str.match(primitives)) { - clonedArgs.push(argsAsArray[i]); - } else { - clonedArgs.push(j$.util.clone(argsAsArray[i])); - } - } - return clonedArgs; - }; - - util.getPropertyDescriptor = function(obj, methodName) { - var descriptor, - proto = obj; - - do { - descriptor = Object.getOwnPropertyDescriptor(proto, methodName); - proto = Object.getPrototypeOf(proto); - } while (!descriptor && proto); - - return descriptor; - }; - - util.objectDifference = function(obj, toRemove) { - var diff = {}; - - for (var key in obj) { - if (util.has(obj, key) && !util.has(toRemove, key)) { - diff[key] = obj[key]; - } - } - - return diff; - }; - - util.has = function(obj, key) { - return Object.prototype.hasOwnProperty.call(obj, key); - }; - - util.errorWithStack = function errorWithStack() { - // Don't throw and catch if we don't have to, because it makes it harder - // for users to debug their code with exception breakpoints. - var error = new Error(); - - if (error.stack) { - return error; - } - - // But some browsers (e.g. Phantom) only provide a stack trace if we throw. - try { - throw new Error(); - } catch (e) { - return e; - } - }; - - function callerFile() { - var trace = new j$.StackTrace(util.errorWithStack()); - return trace.frames[2].file; - } - - util.jasmineFile = (function() { - var result; - - return function() { - if (!result) { - result = callerFile(); - } - - return result; - }; - })(); - - function StopIteration() {} - StopIteration.prototype = Object.create(Error.prototype); - StopIteration.prototype.constructor = StopIteration; - - // useful for maps and sets since `forEach` is the only IE11-compatible way to iterate them - util.forEachBreakable = function(iterable, iteratee) { - function breakLoop() { - throw new StopIteration(); - } - - try { - iterable.forEach(function(value, key) { - iteratee(breakLoop, value, key, iterable); - }); - } catch (error) { - if (!(error instanceof StopIteration)) throw error; - } - }; - - return util; -}; - -getJasmineRequireObj().Spec = function(j$) { - /** - * @interface Spec - * @see Configuration#specFilter - */ - function Spec(attrs) { - this.expectationFactory = attrs.expectationFactory; - this.asyncExpectationFactory = attrs.asyncExpectationFactory; - this.resultCallback = attrs.resultCallback || function() {}; - /** - * The unique ID of this spec. - * @name Spec#id - * @readonly - * @type {string} - */ - this.id = attrs.id; - /** - * The description passed to the {@link it} that created this spec. - * @name Spec#description - * @readonly - * @type {string} - */ - this.description = attrs.description || ''; - this.queueableFn = attrs.queueableFn; - this.beforeAndAfterFns = - attrs.beforeAndAfterFns || - function() { - return { befores: [], afters: [] }; - }; - this.userContext = - attrs.userContext || - function() { - return {}; - }; - this.onStart = attrs.onStart || function() {}; - this.getSpecName = - attrs.getSpecName || - function() { - return ''; - }; - this.expectationResultFactory = - attrs.expectationResultFactory || function() {}; - this.queueRunnerFactory = attrs.queueRunnerFactory || function() {}; - this.catchingExceptions = - attrs.catchingExceptions || - function() { - return true; - }; - this.throwOnExpectationFailure = !!attrs.throwOnExpectationFailure; - this.timer = attrs.timer || new j$.Timer(); - - if (!this.queueableFn.fn) { - this.pend(); - } - - /** - * @typedef SpecResult - * @property {Int} id - The unique id of this spec. - * @property {String} description - The description passed to the {@link it} that created this spec. - * @property {String} fullName - The full description including all ancestors of this spec. - * @property {Expectation[]} failedExpectations - The list of expectations that failed during execution of this spec. - * @property {Expectation[]} passedExpectations - The list of expectations that passed during execution of this spec. - * @property {Expectation[]} deprecationWarnings - The list of deprecation warnings that occurred during execution this spec. - * @property {String} pendingReason - If the spec is {@link pending}, this will be the reason. - * @property {String} status - Once the spec has completed, this string represents the pass/fail status of this spec. - * @property {number} duration - The time in ms used by the spec execution, including any before/afterEach. - * @property {Object} properties - User-supplied properties, if any, that were set using {@link Env#setSpecProperty} - */ - this.result = { - id: this.id, - description: this.description, - fullName: this.getFullName(), - failedExpectations: [], - passedExpectations: [], - deprecationWarnings: [], - pendingReason: '', - duration: null, - properties: null - }; - } - - Spec.prototype.addExpectationResult = function(passed, data, isError) { - var expectationResult = this.expectationResultFactory(data); - if (passed) { - this.result.passedExpectations.push(expectationResult); - } else { - this.result.failedExpectations.push(expectationResult); - - if (this.throwOnExpectationFailure && !isError) { - throw new j$.errors.ExpectationFailed(); - } - } - }; - - Spec.prototype.setSpecProperty = function(key, value) { - this.result.properties = this.result.properties || {}; - this.result.properties[key] = value; - }; - - Spec.prototype.expect = function(actual) { - return this.expectationFactory(actual, this); - }; - - Spec.prototype.expectAsync = function(actual) { - return this.asyncExpectationFactory(actual, this); - }; - - Spec.prototype.execute = function(onComplete, excluded, failSpecWithNoExp) { - var self = this; - - var onStart = { - fn: function(done) { - self.timer.start(); - self.onStart(self, done); - } - }; - - var complete = { - fn: function(done) { - self.queueableFn.fn = null; - self.result.status = self.status(excluded, failSpecWithNoExp); - self.result.duration = self.timer.elapsed(); - self.resultCallback(self.result, done); - } - }; - - var fns = this.beforeAndAfterFns(); - var regularFns = fns.befores.concat(this.queueableFn); - - var runnerConfig = { - isLeaf: true, - queueableFns: regularFns, - cleanupFns: fns.afters, - onException: function() { - self.onException.apply(self, arguments); - }, - onComplete: function() { - onComplete( - self.result.status === 'failed' && - new j$.StopExecutionError('spec failed') - ); - }, - userContext: this.userContext() - }; - - if (this.markedPending || excluded === true) { - runnerConfig.queueableFns = []; - runnerConfig.cleanupFns = []; - } - - runnerConfig.queueableFns.unshift(onStart); - runnerConfig.cleanupFns.push(complete); - - this.queueRunnerFactory(runnerConfig); - }; - - Spec.prototype.onException = function onException(e) { - if (Spec.isPendingSpecException(e)) { - this.pend(extractCustomPendingMessage(e)); - return; - } - - if (e instanceof j$.errors.ExpectationFailed) { - return; - } - - this.addExpectationResult( - false, - { - matcherName: '', - passed: false, - expected: '', - actual: '', - error: e - }, - true - ); - }; - - Spec.prototype.pend = function(message) { - this.markedPending = true; - if (message) { - this.result.pendingReason = message; - } - }; - - Spec.prototype.getResult = function() { - this.result.status = this.status(); - return this.result; - }; - - Spec.prototype.status = function(excluded, failSpecWithNoExpectations) { - if (excluded === true) { - return 'excluded'; - } - - if (this.markedPending) { - return 'pending'; - } - - if ( - this.result.failedExpectations.length > 0 || - (failSpecWithNoExpectations && - this.result.failedExpectations.length + - this.result.passedExpectations.length === - 0) - ) { - return 'failed'; - } - - return 'passed'; - }; - - /** - * The full description including all ancestors of this spec. - * @name Spec#getFullName - * @function - * @returns {string} - */ - Spec.prototype.getFullName = function() { - return this.getSpecName(this); - }; - - Spec.prototype.addDeprecationWarning = function(deprecation) { - if (typeof deprecation === 'string') { - deprecation = { message: deprecation }; - } - this.result.deprecationWarnings.push( - this.expectationResultFactory(deprecation) - ); - }; - - var extractCustomPendingMessage = function(e) { - var fullMessage = e.toString(), - boilerplateStart = fullMessage.indexOf(Spec.pendingSpecExceptionMessage), - boilerplateEnd = - boilerplateStart + Spec.pendingSpecExceptionMessage.length; - - return fullMessage.substr(boilerplateEnd); - }; - - Spec.pendingSpecExceptionMessage = '=> marked Pending'; - - Spec.isPendingSpecException = function(e) { - return !!( - e && - e.toString && - e.toString().indexOf(Spec.pendingSpecExceptionMessage) !== -1 - ); - }; - - return Spec; -}; - -if (typeof window == void 0 && typeof exports == 'object') { - /* globals exports */ - exports.Spec = jasmineRequire.Spec; -} - -/*jshint bitwise: false*/ - -getJasmineRequireObj().Order = function() { - function Order(options) { - this.random = 'random' in options ? options.random : true; - var seed = (this.seed = options.seed || generateSeed()); - this.sort = this.random ? randomOrder : naturalOrder; - - function naturalOrder(items) { - return items; - } - - function randomOrder(items) { - var copy = items.slice(); - copy.sort(function(a, b) { - return jenkinsHash(seed + a.id) - jenkinsHash(seed + b.id); - }); - return copy; - } - - function generateSeed() { - return String(Math.random()).slice(-5); - } - - // Bob Jenkins One-at-a-Time Hash algorithm is a non-cryptographic hash function - // used to get a different output when the key changes slightly. - // We use your return to sort the children randomly in a consistent way when - // used in conjunction with a seed - - function jenkinsHash(key) { - var hash, i; - for (hash = i = 0; i < key.length; ++i) { - hash += key.charCodeAt(i); - hash += hash << 10; - hash ^= hash >> 6; - } - hash += hash << 3; - hash ^= hash >> 11; - hash += hash << 15; - return hash; - } - } - - return Order; -}; - -getJasmineRequireObj().Env = function(j$) { - /** - * @class Env - * @since 2.0.0 - * @classdesc The Jasmine environment.
- * _Note:_ Do not construct this directly. You can obtain the Env instance by - * calling {@link jasmine.getEnv}. - * @hideconstructor - */ - function Env(options) { - options = options || {}; - - var self = this; - var global = options.global || j$.getGlobal(); - var customPromise; - - var totalSpecsDefined = 0; - - var realSetTimeout = global.setTimeout; - var realClearTimeout = global.clearTimeout; - var clearStack = j$.getClearStack(global); - this.clock = new j$.Clock( - global, - function() { - return new j$.DelayedFunctionScheduler(); - }, - new j$.MockDate(global) - ); - - var runnableResources = {}; - - var currentSpec = null; - var currentlyExecutingSuites = []; - var currentDeclarationSuite = null; - var hasFailures = false; - - /** - * This represents the available options to configure Jasmine. - * Options that are not provided will use their default values. - * @see Env#configure - * @interface Configuration - * @since 3.3.0 - */ - var config = { - /** - * Whether to randomize spec execution order - * @name Configuration#random - * @since 3.3.0 - * @type Boolean - * @default true - */ - random: true, - /** - * Seed to use as the basis of randomization. - * Null causes the seed to be determined randomly at the start of execution. - * @name Configuration#seed - * @since 3.3.0 - * @type (number|string) - * @default null - */ - seed: null, - /** - * Whether to stop execution of the suite after the first spec failure - * @name Configuration#failFast - * @since 3.3.0 - * @type Boolean - * @default false - * @deprecated Use the `stopOnSpecFailure` config property instead. - */ - failFast: false, - /** - * Whether to stop execution of the suite after the first spec failure - * @name Configuration#stopOnSpecFailure - * @since 3.9.0 - * @type Boolean - * @default false - */ - stopOnSpecFailure: false, - /** - * Whether to fail the spec if it ran no expectations. By default - * a spec that ran no expectations is reported as passed. Setting this - * to true will report such spec as a failure. - * @name Configuration#failSpecWithNoExpectations - * @since 3.5.0 - * @type Boolean - * @default false - */ - failSpecWithNoExpectations: false, - /** - * Whether to cause specs to only have one expectation failure. - * @name Configuration#oneFailurePerSpec - * @since 3.3.0 - * @type Boolean - * @default false - * @deprecated Use the `stopSpecOnExpectationFailure` config property instead. - */ - oneFailurePerSpec: false, - /** - * Whether to cause specs to only have one expectation failure. - * @name Configuration#stopSpecOnExpectationFailure - * @since 3.3.0 - * @type Boolean - * @default false - */ - stopSpecOnExpectationFailure: false, - /** - * A function that takes a spec and returns true if it should be executed - * or false if it should be skipped. - * @callback SpecFilter - * @param {Spec} spec - The spec that the filter is being applied to. - * @return boolean - */ - /** - * Function to use to filter specs - * @name Configuration#specFilter - * @since 3.3.0 - * @type SpecFilter - * @default A function that always returns true. - */ - specFilter: function() { - return true; - }, - /** - * Whether or not reporters should hide disabled specs from their output. - * Currently only supported by Jasmine's HTMLReporter - * @name Configuration#hideDisabled - * @since 3.3.0 - * @type Boolean - * @default false - */ - hideDisabled: false, - /** - * Set to provide a custom promise library that Jasmine will use if it needs - * to create a promise. If not set, it will default to whatever global Promise - * library is available (if any). - * @name Configuration#Promise - * @since 3.5.0 - * @type function - * @default undefined - */ - Promise: undefined - }; - - var currentSuite = function() { - return currentlyExecutingSuites[currentlyExecutingSuites.length - 1]; - }; - - var currentRunnable = function() { - return currentSpec || currentSuite(); - }; - - var globalErrors = null; - - var installGlobalErrors = function() { - if (globalErrors) { - return; - } - - globalErrors = new j$.GlobalErrors(); - globalErrors.install(); - }; - - if (!options.suppressLoadErrors) { - installGlobalErrors(); - globalErrors.pushListener(function( - message, - filename, - lineno, - colNo, - err - ) { - topSuite.result.failedExpectations.push({ - passed: false, - globalErrorType: 'load', - message: message, - stack: err && err.stack, - filename: filename, - lineno: lineno - }); - }); - } - - /** - * Configure your jasmine environment - * @name Env#configure - * @since 3.3.0 - * @argument {Configuration} configuration - * @function - */ - this.configure = function(configuration) { - var booleanProps = [ - 'random', - 'failSpecWithNoExpectations', - 'hideDisabled' - ]; - - booleanProps.forEach(function(prop) { - if (typeof configuration[prop] !== 'undefined') { - config[prop] = !!configuration[prop]; - } - }); - - if (typeof configuration.failFast !== 'undefined') { - if (typeof configuration.stopOnSpecFailure !== 'undefined') { - if (configuration.stopOnSpecFailure !== configuration.failFast) { - throw new Error( - 'stopOnSpecFailure and failFast are aliases for ' + - "each other. Don't set failFast if you also set stopOnSpecFailure." - ); - } - } - - config.failFast = configuration.failFast; - config.stopOnSpecFailure = configuration.failFast; - } else if (typeof configuration.stopOnSpecFailure !== 'undefined') { - config.failFast = configuration.stopOnSpecFailure; - config.stopOnSpecFailure = configuration.stopOnSpecFailure; - } - - if (typeof configuration.oneFailurePerSpec !== 'undefined') { - if (typeof configuration.stopSpecOnExpectationFailure !== 'undefined') { - if ( - configuration.stopSpecOnExpectationFailure !== - configuration.oneFailurePerSpec - ) { - throw new Error( - 'stopSpecOnExpectationFailure and oneFailurePerSpec are aliases for ' + - "each other. Don't set oneFailurePerSpec if you also set stopSpecOnExpectationFailure." - ); - } - } - - config.oneFailurePerSpec = configuration.oneFailurePerSpec; - config.stopSpecOnExpectationFailure = configuration.oneFailurePerSpec; - } else if ( - typeof configuration.stopSpecOnExpectationFailure !== 'undefined' - ) { - config.oneFailurePerSpec = configuration.stopSpecOnExpectationFailure; - config.stopSpecOnExpectationFailure = - configuration.stopSpecOnExpectationFailure; - } - - if (configuration.specFilter) { - config.specFilter = configuration.specFilter; - } - - if (typeof configuration.seed !== 'undefined') { - config.seed = configuration.seed; - } - - // Don't use hasOwnProperty to check for Promise existence because Promise - // can be initialized to undefined, either explicitly or by using the - // object returned from Env#configuration. In particular, Karma does this. - if (configuration.Promise) { - if ( - typeof configuration.Promise.resolve === 'function' && - typeof configuration.Promise.reject === 'function' - ) { - customPromise = configuration.Promise; - } else { - throw new Error( - 'Custom promise library missing `resolve`/`reject` functions' - ); - } - } - }; - - /** - * Get the current configuration for your jasmine environment - * @name Env#configuration - * @since 3.3.0 - * @function - * @returns {Configuration} - */ - this.configuration = function() { - var result = {}; - for (var property in config) { - result[property] = config[property]; - } - return result; - }; - - Object.defineProperty(this, 'specFilter', { - get: function() { - self.deprecated( - 'Getting specFilter directly from Env is deprecated and will be removed in a future version of Jasmine, please check the specFilter option from `configuration`' - ); - return config.specFilter; - }, - set: function(val) { - self.deprecated( - 'Setting specFilter directly on Env is deprecated and will be removed in a future version of Jasmine, please use the specFilter option in `configure`' - ); - config.specFilter = val; - } - }); - - this.setDefaultSpyStrategy = function(defaultStrategyFn) { - if (!currentRunnable()) { - throw new Error( - 'Default spy strategy must be set in a before function or a spec' - ); - } - runnableResources[ - currentRunnable().id - ].defaultStrategyFn = defaultStrategyFn; - }; - - this.addSpyStrategy = function(name, fn) { - if (!currentRunnable()) { - throw new Error( - 'Custom spy strategies must be added in a before function or a spec' - ); - } - runnableResources[currentRunnable().id].customSpyStrategies[name] = fn; - }; - - this.addCustomEqualityTester = function(tester) { - if (!currentRunnable()) { - throw new Error( - 'Custom Equalities must be added in a before function or a spec' - ); - } - runnableResources[currentRunnable().id].customEqualityTesters.push( - tester - ); - }; - - this.addMatchers = function(matchersToAdd) { - if (!currentRunnable()) { - throw new Error( - 'Matchers must be added in a before function or a spec' - ); - } - var customMatchers = - runnableResources[currentRunnable().id].customMatchers; - - for (var matcherName in matchersToAdd) { - customMatchers[matcherName] = matchersToAdd[matcherName]; - } - }; - - this.addAsyncMatchers = function(matchersToAdd) { - if (!currentRunnable()) { - throw new Error( - 'Async Matchers must be added in a before function or a spec' - ); - } - var customAsyncMatchers = - runnableResources[currentRunnable().id].customAsyncMatchers; - - for (var matcherName in matchersToAdd) { - customAsyncMatchers[matcherName] = matchersToAdd[matcherName]; - } - }; - - this.addCustomObjectFormatter = function(formatter) { - if (!currentRunnable()) { - throw new Error( - 'Custom object formatters must be added in a before function or a spec' - ); - } - - runnableResources[currentRunnable().id].customObjectFormatters.push( - formatter - ); - }; - - j$.Expectation.addCoreMatchers(j$.matchers); - j$.Expectation.addAsyncCoreMatchers(j$.asyncMatchers); - - var nextSpecId = 0; - var getNextSpecId = function() { - return 'spec' + nextSpecId++; - }; - - var nextSuiteId = 0; - var getNextSuiteId = function() { - return 'suite' + nextSuiteId++; - }; - - var makePrettyPrinter = function() { - var customObjectFormatters = - runnableResources[currentRunnable().id].customObjectFormatters; - return j$.makePrettyPrinter(customObjectFormatters); - }; - - var makeMatchersUtil = function() { - var customEqualityTesters = - runnableResources[currentRunnable().id].customEqualityTesters; - return new j$.MatchersUtil({ - customTesters: customEqualityTesters, - pp: makePrettyPrinter() - }); - }; - - var expectationFactory = function(actual, spec) { - var customEqualityTesters = - runnableResources[spec.id].customEqualityTesters; - - return j$.Expectation.factory({ - matchersUtil: makeMatchersUtil(), - customEqualityTesters: customEqualityTesters, - customMatchers: runnableResources[spec.id].customMatchers, - actual: actual, - addExpectationResult: addExpectationResult - }); - - function addExpectationResult(passed, result) { - return spec.addExpectationResult(passed, result); - } - }; - - function recordLateExpectation(runable, runableType, result) { - var delayedExpectationResult = {}; - Object.keys(result).forEach(function(k) { - delayedExpectationResult[k] = result[k]; - }); - delayedExpectationResult.passed = false; - delayedExpectationResult.globalErrorType = 'lateExpectation'; - delayedExpectationResult.message = - runableType + - ' "' + - runable.getFullName() + - '" ran a "' + - result.matcherName + - '" expectation after it finished.\n'; - - if (result.message) { - delayedExpectationResult.message += - 'Message: "' + result.message + '"\n'; - } - - delayedExpectationResult.message += - 'Did you forget to return or await the result of expectAsync?'; - - topSuite.result.failedExpectations.push(delayedExpectationResult); - } - - var asyncExpectationFactory = function(actual, spec, runableType) { - return j$.Expectation.asyncFactory({ - matchersUtil: makeMatchersUtil(), - customEqualityTesters: runnableResources[spec.id].customEqualityTesters, - customAsyncMatchers: runnableResources[spec.id].customAsyncMatchers, - actual: actual, - addExpectationResult: addExpectationResult - }); - - function addExpectationResult(passed, result) { - if (currentRunnable() !== spec) { - recordLateExpectation(spec, runableType, result); - } - return spec.addExpectationResult(passed, result); - } - }; - var suiteAsyncExpectationFactory = function(actual, suite) { - return asyncExpectationFactory(actual, suite, 'Suite'); - }; - - var specAsyncExpectationFactory = function(actual, suite) { - return asyncExpectationFactory(actual, suite, 'Spec'); - }; - - var defaultResourcesForRunnable = function(id, parentRunnableId) { - var resources = { - spies: [], - customEqualityTesters: [], - customMatchers: {}, - customAsyncMatchers: {}, - customSpyStrategies: {}, - defaultStrategyFn: undefined, - customObjectFormatters: [] - }; - - if (runnableResources[parentRunnableId]) { - resources.customEqualityTesters = j$.util.clone( - runnableResources[parentRunnableId].customEqualityTesters - ); - resources.customMatchers = j$.util.clone( - runnableResources[parentRunnableId].customMatchers - ); - resources.customAsyncMatchers = j$.util.clone( - runnableResources[parentRunnableId].customAsyncMatchers - ); - resources.customObjectFormatters = j$.util.clone( - runnableResources[parentRunnableId].customObjectFormatters - ); - resources.defaultStrategyFn = - runnableResources[parentRunnableId].defaultStrategyFn; - } - - runnableResources[id] = resources; - }; - - var clearResourcesForRunnable = function(id) { - spyRegistry.clearSpies(); - delete runnableResources[id]; - }; - - var beforeAndAfterFns = function(suite) { - return function() { - var befores = [], - afters = []; - - while (suite) { - befores = befores.concat(suite.beforeFns); - afters = afters.concat(suite.afterFns); - - suite = suite.parentSuite; - } - - return { - befores: befores.reverse(), - afters: afters - }; - }; - }; - - var getSpecName = function(spec, suite) { - var fullName = [spec.description], - suiteFullName = suite.getFullName(); - - if (suiteFullName !== '') { - fullName.unshift(suiteFullName); - } - return fullName.join(' '); - }; - - // TODO: we may just be able to pass in the fn instead of wrapping here - var buildExpectationResult = j$.buildExpectationResult, - exceptionFormatter = new j$.ExceptionFormatter(), - expectationResultFactory = function(attrs) { - attrs.messageFormatter = exceptionFormatter.message; - attrs.stackFormatter = exceptionFormatter.stack; - - return buildExpectationResult(attrs); - }; - - /** - * Sets whether Jasmine should throw an Error when an expectation fails. - * This causes a spec to only have one expectation failure. - * @name Env#throwOnExpectationFailure - * @since 2.3.0 - * @function - * @param {Boolean} value Whether to throw when a expectation fails - * @deprecated Use the `stopSpecOnExpectationFailure` option with {@link Env#configure} - */ - this.throwOnExpectationFailure = function(value) { - this.deprecated( - 'Setting throwOnExpectationFailure directly on Env is deprecated and ' + - 'will be removed in a future version of Jasmine. Please use the ' + - 'stopSpecOnExpectationFailure option in `configure`.' - ); - this.configure({ oneFailurePerSpec: !!value }); - }; - - this.throwingExpectationFailures = function() { - this.deprecated( - 'Getting throwingExpectationFailures directly from Env is deprecated ' + - 'and will be removed in a future version of Jasmine. Please check ' + - 'the stopSpecOnExpectationFailure option from `configuration`.' - ); - return config.oneFailurePerSpec; - }; - - /** - * Set whether to stop suite execution when a spec fails - * @name Env#stopOnSpecFailure - * @since 2.7.0 - * @function - * @param {Boolean} value Whether to stop suite execution when a spec fails - * @deprecated Use the `stopOnSpecFailure` option with {@link Env#configure} - */ - this.stopOnSpecFailure = function(value) { - this.deprecated( - 'Setting stopOnSpecFailure directly is deprecated and will be ' + - 'removed in a future version of Jasmine. Please use the ' + - 'stopOnSpecFailure option in `configure`.' - ); - this.configure({ stopOnSpecFailure: !!value }); - }; - - this.stoppingOnSpecFailure = function() { - this.deprecated( - 'Getting stoppingOnSpecFailure directly from Env is deprecated and ' + - 'will be removed in a future version of Jasmine. Please check the ' + - 'stopOnSpecFailure option from `configuration`.' - ); - return config.failFast; - }; - - /** - * Set whether to randomize test execution order - * @name Env#randomizeTests - * @since 2.4.0 - * @function - * @param {Boolean} value Whether to randomize execution order - * @deprecated Use the `random` option with {@link Env#configure} - */ - this.randomizeTests = function(value) { - this.deprecated( - 'Setting randomizeTests directly is deprecated and will be removed in a future version of Jasmine, please use the random option in `configure`' - ); - config.random = !!value; - }; - - this.randomTests = function() { - this.deprecated( - 'Getting randomTests directly from Env is deprecated and will be removed in a future version of Jasmine, please check the random option from `configuration`' - ); - return config.random; - }; - - /** - * Set the random number seed for spec randomization - * @name Env#seed - * @since 2.4.0 - * @function - * @param {Number} value The seed value - * @deprecated Use the `seed` option with {@link Env#configure} - */ - this.seed = function(value) { - this.deprecated( - 'Setting seed directly is deprecated and will be removed in a future version of Jasmine, please use the seed option in `configure`' - ); - if (value) { - config.seed = value; - } - return config.seed; - }; - - this.hidingDisabled = function(value) { - this.deprecated( - 'Getting hidingDisabled directly from Env is deprecated and will be removed in a future version of Jasmine, please check the hideDisabled option from `configuration`' - ); - return config.hideDisabled; - }; - - /** - * @name Env#hideDisabled - * @since 3.2.0 - * @function - * @deprecated Use the `hideDisabled` option with {@link Env#configure} - */ - this.hideDisabled = function(value) { - this.deprecated( - 'Setting hideDisabled directly is deprecated and will be removed in a future version of Jasmine, please use the hideDisabled option in `configure`' - ); - config.hideDisabled = !!value; - }; - - this.deprecated = function(deprecation) { - var runnable = currentRunnable() || topSuite; - var context; - - if (runnable === topSuite) { - context = ''; - } else if (runnable === currentSuite()) { - context = ' (in suite: ' + runnable.getFullName() + ')'; - } else { - context = ' (in spec: ' + runnable.getFullName() + ')'; - } - - runnable.addDeprecationWarning(deprecation); - if ( - typeof console !== 'undefined' && - typeof console.error === 'function' - ) { - console.error('DEPRECATION: ' + deprecation + context); - } - }; - - var queueRunnerFactory = function(options, args) { - var failFast = false; - if (options.isLeaf) { - failFast = config.stopSpecOnExpectationFailure; - } else if (!options.isReporter) { - failFast = config.stopOnSpecFailure; - } - options.clearStack = options.clearStack || clearStack; - options.timeout = { - setTimeout: realSetTimeout, - clearTimeout: realClearTimeout - }; - options.fail = self.fail; - options.globalErrors = globalErrors; - options.completeOnFirstError = failFast; - options.onException = - options.onException || - function(e) { - (currentRunnable() || topSuite).onException(e); - }; - options.deprecated = self.deprecated; - - new j$.QueueRunner(options).execute(args); - }; - - var topSuite = new j$.Suite({ - env: this, - id: getNextSuiteId(), - description: 'Jasmine__TopLevel__Suite', - expectationFactory: expectationFactory, - asyncExpectationFactory: suiteAsyncExpectationFactory, - expectationResultFactory: expectationResultFactory - }); - defaultResourcesForRunnable(topSuite.id); - currentDeclarationSuite = topSuite; - - /** - * Provides the root suite, through which all suites and specs can be - * accessed. - * @function - * @name Env#topSuite - * @return {Suite} the root suite - */ - this.topSuite = function() { - return topSuite; - }; - - /** - * This represents the available reporter callback for an object passed to {@link Env#addReporter}. - * @interface Reporter - * @see custom_reporter - */ - var reporter = new j$.ReportDispatcher( - [ - /** - * `jasmineStarted` is called after all of the specs have been loaded, but just before execution starts. - * @function - * @name Reporter#jasmineStarted - * @param {JasmineStartedInfo} suiteInfo Information about the full Jasmine suite that is being run - * @param {Function} [done] Used to specify to Jasmine that this callback is asynchronous and Jasmine should wait until it has been called before moving on. - * @returns {} Optionally return a Promise instead of using `done` to cause Jasmine to wait for completion. - * @see async - */ - 'jasmineStarted', - /** - * When the entire suite has finished execution `jasmineDone` is called - * @function - * @name Reporter#jasmineDone - * @param {JasmineDoneInfo} suiteInfo Information about the full Jasmine suite that just finished running. - * @param {Function} [done] Used to specify to Jasmine that this callback is asynchronous and Jasmine should wait until it has been called before moving on. - * @returns {} Optionally return a Promise instead of using `done` to cause Jasmine to wait for completion. - * @see async - */ - 'jasmineDone', - /** - * `suiteStarted` is invoked when a `describe` starts to run - * @function - * @name Reporter#suiteStarted - * @param {SuiteResult} result Information about the individual {@link describe} being run - * @param {Function} [done] Used to specify to Jasmine that this callback is asynchronous and Jasmine should wait until it has been called before moving on. - * @returns {} Optionally return a Promise instead of using `done` to cause Jasmine to wait for completion. - * @see async - */ - 'suiteStarted', - /** - * `suiteDone` is invoked when all of the child specs and suites for a given suite have been run - * - * While jasmine doesn't require any specific functions, not defining a `suiteDone` will make it impossible for a reporter to know when a suite has failures in an `afterAll`. - * @function - * @name Reporter#suiteDone - * @param {SuiteResult} result - * @param {Function} [done] Used to specify to Jasmine that this callback is asynchronous and Jasmine should wait until it has been called before moving on. - * @returns {} Optionally return a Promise instead of using `done` to cause Jasmine to wait for completion. - * @see async - */ - 'suiteDone', - /** - * `specStarted` is invoked when an `it` starts to run (including associated `beforeEach` functions) - * @function - * @name Reporter#specStarted - * @param {SpecResult} result Information about the individual {@link it} being run - * @param {Function} [done] Used to specify to Jasmine that this callback is asynchronous and Jasmine should wait until it has been called before moving on. - * @returns {} Optionally return a Promise instead of using `done` to cause Jasmine to wait for completion. - * @see async - */ - 'specStarted', - /** - * `specDone` is invoked when an `it` and its associated `beforeEach` and `afterEach` functions have been run. - * - * While jasmine doesn't require any specific functions, not defining a `specDone` will make it impossible for a reporter to know when a spec has failed. - * @function - * @name Reporter#specDone - * @param {SpecResult} result - * @param {Function} [done] Used to specify to Jasmine that this callback is asynchronous and Jasmine should wait until it has been called before moving on. - * @returns {} Optionally return a Promise instead of using `done` to cause Jasmine to wait for completion. - * @see async - */ - 'specDone' - ], - queueRunnerFactory - ); - - /** - * Executes the specs. - * - * If called with no parameters or with a falsy value as the first parameter, - * all specs will be executed except those that are excluded by a - * [spec filter]{@link Configuration#specFilter} or other mechanism. If the - * first parameter is a list of spec/suite IDs, only those specs/suites will - * be run. - * - * Both parameters are optional, but a completion callback is only valid as - * the second parameter. To specify a completion callback but not a list of - * specs/suites to run, pass null or undefined as the first parameter. - * - * execute should not be called more than once. - * - * If the environment supports promises, execute will return a promise that - * is resolved after the suite finishes executing. The promise will be - * resolved (not rejected) as long as the suite runs to completion. Use a - * {@link Reporter} to determine whether or not the suite passed. - * - * @name Env#execute - * @since 2.0.0 - * @function - * @param {(string[])=} runnablesToRun IDs of suites and/or specs to run - * @param {Function=} onComplete Function that will be called after all specs have run - * @return {Promise} - */ - this.execute = function(runnablesToRun, onComplete) { - installGlobalErrors(); - - if (!runnablesToRun) { - if (focusedRunnables.length) { - runnablesToRun = focusedRunnables; - } else { - runnablesToRun = [topSuite.id]; - } - } - - var order = new j$.Order({ - random: config.random, - seed: config.seed - }); - - var processor = new j$.TreeProcessor({ - tree: topSuite, - runnableIds: runnablesToRun, - queueRunnerFactory: queueRunnerFactory, - failSpecWithNoExpectations: config.failSpecWithNoExpectations, - nodeStart: function(suite, next) { - currentlyExecutingSuites.push(suite); - defaultResourcesForRunnable(suite.id, suite.parentSuite.id); - reporter.suiteStarted(suite.result, next); - suite.startTimer(); - }, - nodeComplete: function(suite, result, next) { - if (suite !== currentSuite()) { - throw new Error('Tried to complete the wrong suite'); - } - - clearResourcesForRunnable(suite.id); - currentlyExecutingSuites.pop(); - - if (result.status === 'failed') { - hasFailures = true; - } - suite.endTimer(); - reporter.suiteDone(result, next); - }, - orderChildren: function(node) { - return order.sort(node.children); - }, - excludeNode: function(spec) { - return !config.specFilter(spec); - } - }); - - if (!processor.processTree().valid) { - throw new Error( - 'Invalid order: would cause a beforeAll or afterAll to be run multiple times' - ); - } - - var jasmineTimer = new j$.Timer(); - jasmineTimer.start(); - - var Promise = customPromise || global.Promise; - - if (Promise) { - return new Promise(function(resolve) { - runAll(function() { - if (onComplete) { - onComplete(); - } - - resolve(); - }); - }); - } else { - runAll(function() { - if (onComplete) { - onComplete(); - } - }); - } - - function runAll(done) { - /** - * Information passed to the {@link Reporter#jasmineStarted} event. - * @typedef JasmineStartedInfo - * @property {Int} totalSpecsDefined - The total number of specs defined in this suite. - * @property {Order} order - Information about the ordering (random or not) of this execution of the suite. - */ - reporter.jasmineStarted( - { - totalSpecsDefined: totalSpecsDefined, - order: order - }, - function() { - currentlyExecutingSuites.push(topSuite); - - processor.execute(function() { - clearResourcesForRunnable(topSuite.id); - currentlyExecutingSuites.pop(); - var overallStatus, incompleteReason; - - if ( - hasFailures || - topSuite.result.failedExpectations.length > 0 - ) { - overallStatus = 'failed'; - } else if (focusedRunnables.length > 0) { - overallStatus = 'incomplete'; - incompleteReason = 'fit() or fdescribe() was found'; - } else if (totalSpecsDefined === 0) { - overallStatus = 'incomplete'; - incompleteReason = 'No specs found'; - } else { - overallStatus = 'passed'; - } - - /** - * Information passed to the {@link Reporter#jasmineDone} event. - * @typedef JasmineDoneInfo - * @property {OverallStatus} overallStatus - The overall result of the suite: 'passed', 'failed', or 'incomplete'. - * @property {Int} totalTime - The total time (in ms) that it took to execute the suite - * @property {IncompleteReason} incompleteReason - Explanation of why the suite was incomplete. - * @property {Order} order - Information about the ordering (random or not) of this execution of the suite. - * @property {Expectation[]} failedExpectations - List of expectations that failed in an {@link afterAll} at the global level. - * @property {Expectation[]} deprecationWarnings - List of deprecation warnings that occurred at the global level. - */ - reporter.jasmineDone( - { - overallStatus: overallStatus, - totalTime: jasmineTimer.elapsed(), - incompleteReason: incompleteReason, - order: order, - failedExpectations: topSuite.result.failedExpectations, - deprecationWarnings: topSuite.result.deprecationWarnings - }, - done - ); - }); - } - ); - } - }; - - /** - * Add a custom reporter to the Jasmine environment. - * @name Env#addReporter - * @since 2.0.0 - * @function - * @param {Reporter} reporterToAdd The reporter to be added. - * @see custom_reporter - */ - this.addReporter = function(reporterToAdd) { - reporter.addReporter(reporterToAdd); - }; - - /** - * Provide a fallback reporter if no other reporters have been specified. - * @name Env#provideFallbackReporter - * @since 2.5.0 - * @function - * @param {Reporter} reporterToAdd The reporter - * @see custom_reporter - */ - this.provideFallbackReporter = function(reporterToAdd) { - reporter.provideFallbackReporter(reporterToAdd); - }; - - /** - * Clear all registered reporters - * @name Env#clearReporters - * @since 2.5.2 - * @function - */ - this.clearReporters = function() { - reporter.clearReporters(); - }; - - var spyFactory = new j$.SpyFactory( - function getCustomStrategies() { - var runnable = currentRunnable(); - - if (runnable) { - return runnableResources[runnable.id].customSpyStrategies; - } - - return {}; - }, - function getDefaultStrategyFn() { - var runnable = currentRunnable(); - - if (runnable) { - return runnableResources[runnable.id].defaultStrategyFn; - } - - return undefined; - }, - function getPromise() { - return customPromise || global.Promise; - } - ); - - var spyRegistry = new j$.SpyRegistry({ - currentSpies: function() { - if (!currentRunnable()) { - throw new Error( - 'Spies must be created in a before function or a spec' - ); - } - return runnableResources[currentRunnable().id].spies; - }, - createSpy: function(name, originalFn) { - return self.createSpy(name, originalFn); - } - }); - - /** - * Configures whether Jasmine should allow the same function to be spied on - * more than once during the execution of a spec. By default, spying on - * a function that is already a spy will cause an error. - * @name Env#allowRespy - * @function - * @since 2.5.0 - * @param {boolean} allow Whether to allow respying - */ - this.allowRespy = function(allow) { - spyRegistry.allowRespy(allow); - }; - - this.spyOn = function() { - return spyRegistry.spyOn.apply(spyRegistry, arguments); - }; - - this.spyOnProperty = function() { - return spyRegistry.spyOnProperty.apply(spyRegistry, arguments); - }; - - this.spyOnAllFunctions = function() { - return spyRegistry.spyOnAllFunctions.apply(spyRegistry, arguments); - }; - - this.createSpy = function(name, originalFn) { - if (arguments.length === 1 && j$.isFunction_(name)) { - originalFn = name; - name = originalFn.name; - } - - return spyFactory.createSpy(name, originalFn); - }; - - this.createSpyObj = function(baseName, methodNames, propertyNames) { - return spyFactory.createSpyObj(baseName, methodNames, propertyNames); - }; - - var ensureIsFunction = function(fn, caller) { - if (!j$.isFunction_(fn)) { - throw new Error( - caller + ' expects a function argument; received ' + j$.getType_(fn) - ); - } - }; - - var ensureIsFunctionOrAsync = function(fn, caller) { - if (!j$.isFunction_(fn) && !j$.isAsyncFunction_(fn)) { - throw new Error( - caller + ' expects a function argument; received ' + j$.getType_(fn) - ); - } - }; - - function ensureIsNotNested(method) { - var runnable = currentRunnable(); - if (runnable !== null && runnable !== undefined) { - throw new Error( - "'" + method + "' should only be used in 'describe' function" - ); - } - } - - var suiteFactory = function(description) { - var suite = new j$.Suite({ - env: self, - id: getNextSuiteId(), - description: description, - parentSuite: currentDeclarationSuite, - timer: new j$.Timer(), - expectationFactory: expectationFactory, - asyncExpectationFactory: suiteAsyncExpectationFactory, - expectationResultFactory: expectationResultFactory, - throwOnExpectationFailure: config.oneFailurePerSpec - }); - - return suite; - }; - - this.describe = function(description, specDefinitions) { - ensureIsNotNested('describe'); - ensureIsFunction(specDefinitions, 'describe'); - var suite = suiteFactory(description); - if (specDefinitions.length > 0) { - throw new Error('describe does not expect any arguments'); - } - if (currentDeclarationSuite.markedPending) { - suite.pend(); - } - addSpecsToSuite(suite, specDefinitions); - return suite; - }; - - this.xdescribe = function(description, specDefinitions) { - ensureIsNotNested('xdescribe'); - ensureIsFunction(specDefinitions, 'xdescribe'); - var suite = suiteFactory(description); - suite.pend(); - addSpecsToSuite(suite, specDefinitions); - return suite; - }; - - var focusedRunnables = []; - - this.fdescribe = function(description, specDefinitions) { - ensureIsNotNested('fdescribe'); - ensureIsFunction(specDefinitions, 'fdescribe'); - var suite = suiteFactory(description); - suite.isFocused = true; - - focusedRunnables.push(suite.id); - unfocusAncestor(); - addSpecsToSuite(suite, specDefinitions); - - return suite; - }; - - function addSpecsToSuite(suite, specDefinitions) { - var parentSuite = currentDeclarationSuite; - parentSuite.addChild(suite); - currentDeclarationSuite = suite; - - var declarationError = null; - try { - specDefinitions.call(suite); - } catch (e) { - declarationError = e; - } - - if (declarationError) { - suite.onException(declarationError); - } - - currentDeclarationSuite = parentSuite; - } - - function findFocusedAncestor(suite) { - while (suite) { - if (suite.isFocused) { - return suite.id; - } - suite = suite.parentSuite; - } - - return null; - } - - function unfocusAncestor() { - var focusedAncestor = findFocusedAncestor(currentDeclarationSuite); - if (focusedAncestor) { - for (var i = 0; i < focusedRunnables.length; i++) { - if (focusedRunnables[i] === focusedAncestor) { - focusedRunnables.splice(i, 1); - break; - } - } - } - } - - var specFactory = function(description, fn, suite, timeout) { - totalSpecsDefined++; - var spec = new j$.Spec({ - id: getNextSpecId(), - beforeAndAfterFns: beforeAndAfterFns(suite), - expectationFactory: expectationFactory, - asyncExpectationFactory: specAsyncExpectationFactory, - resultCallback: specResultCallback, - getSpecName: function(spec) { - return getSpecName(spec, suite); - }, - onStart: specStarted, - description: description, - expectationResultFactory: expectationResultFactory, - queueRunnerFactory: queueRunnerFactory, - userContext: function() { - return suite.clonedSharedUserContext(); - }, - queueableFn: { - fn: fn, - timeout: timeout || 0 - }, - throwOnExpectationFailure: config.oneFailurePerSpec, - timer: new j$.Timer() - }); - return spec; - - function specResultCallback(result, next) { - clearResourcesForRunnable(spec.id); - currentSpec = null; - - if (result.status === 'failed') { - hasFailures = true; - } - - reporter.specDone(result, next); - } - - function specStarted(spec, next) { - currentSpec = spec; - defaultResourcesForRunnable(spec.id, suite.id); - reporter.specStarted(spec.result, next); - } - }; - - this.it = function(description, fn, timeout) { - ensureIsNotNested('it'); - // it() sometimes doesn't have a fn argument, so only check the type if - // it's given. - if (arguments.length > 1 && typeof fn !== 'undefined') { - ensureIsFunctionOrAsync(fn, 'it'); - } - var spec = specFactory(description, fn, currentDeclarationSuite, timeout); - if (currentDeclarationSuite.markedPending) { - spec.pend(); - } - currentDeclarationSuite.addChild(spec); - return spec; - }; - - this.xit = function(description, fn, timeout) { - ensureIsNotNested('xit'); - // xit(), like it(), doesn't always have a fn argument, so only check the - // type when needed. - if (arguments.length > 1 && typeof fn !== 'undefined') { - ensureIsFunctionOrAsync(fn, 'xit'); - } - var spec = this.it.apply(this, arguments); - spec.pend('Temporarily disabled with xit'); - return spec; - }; - - this.fit = function(description, fn, timeout) { - ensureIsNotNested('fit'); - ensureIsFunctionOrAsync(fn, 'fit'); - var spec = specFactory(description, fn, currentDeclarationSuite, timeout); - currentDeclarationSuite.addChild(spec); - focusedRunnables.push(spec.id); - unfocusAncestor(); - return spec; - }; - - /** - * Sets a user-defined property that will be provided to reporters as part of the properties field of {@link SpecResult} - * @name Env#setSpecProperty - * @since 3.6.0 - * @function - * @param {String} key The name of the property - * @param {*} value The value of the property - */ - this.setSpecProperty = function(key, value) { - if (!currentRunnable() || currentRunnable() == currentSuite()) { - throw new Error( - "'setSpecProperty' was used when there was no current spec" - ); - } - currentRunnable().setSpecProperty(key, value); - }; - - /** - * Sets a user-defined property that will be provided to reporters as part of the properties field of {@link SuiteResult} - * @name Env#setSuiteProperty - * @since 3.6.0 - * @function - * @param {String} key The name of the property - * @param {*} value The value of the property - */ - this.setSuiteProperty = function(key, value) { - if (!currentSuite()) { - throw new Error( - "'setSuiteProperty' was used when there was no current suite" - ); - } - currentSuite().setSuiteProperty(key, value); - }; - - this.expect = function(actual) { - if (!currentRunnable()) { - throw new Error( - "'expect' was used when there was no current spec, this could be because an asynchronous test timed out" - ); - } - - return currentRunnable().expect(actual); - }; - - this.expectAsync = function(actual) { - if (!currentRunnable()) { - throw new Error( - "'expectAsync' was used when there was no current spec, this could be because an asynchronous test timed out" - ); - } - - return currentRunnable().expectAsync(actual); - }; - - this.beforeEach = function(beforeEachFunction, timeout) { - ensureIsNotNested('beforeEach'); - ensureIsFunctionOrAsync(beforeEachFunction, 'beforeEach'); - currentDeclarationSuite.beforeEach({ - fn: beforeEachFunction, - timeout: timeout || 0 - }); - }; - - this.beforeAll = function(beforeAllFunction, timeout) { - ensureIsNotNested('beforeAll'); - ensureIsFunctionOrAsync(beforeAllFunction, 'beforeAll'); - currentDeclarationSuite.beforeAll({ - fn: beforeAllFunction, - timeout: timeout || 0 - }); - }; - - this.afterEach = function(afterEachFunction, timeout) { - ensureIsNotNested('afterEach'); - ensureIsFunctionOrAsync(afterEachFunction, 'afterEach'); - afterEachFunction.isCleanup = true; - currentDeclarationSuite.afterEach({ - fn: afterEachFunction, - timeout: timeout || 0 - }); - }; - - this.afterAll = function(afterAllFunction, timeout) { - ensureIsNotNested('afterAll'); - ensureIsFunctionOrAsync(afterAllFunction, 'afterAll'); - currentDeclarationSuite.afterAll({ - fn: afterAllFunction, - timeout: timeout || 0 - }); - }; - - this.pending = function(message) { - var fullMessage = j$.Spec.pendingSpecExceptionMessage; - if (message) { - fullMessage += message; - } - throw fullMessage; - }; - - this.fail = function(error) { - if (!currentRunnable()) { - throw new Error( - "'fail' was used when there was no current spec, this could be because an asynchronous test timed out" - ); - } - - var message = 'Failed'; - if (error) { - message += ': '; - if (error.message) { - message += error.message; - } else if (j$.isString_(error)) { - message += error; - } else { - // pretty print all kind of objects. This includes arrays. - message += makePrettyPrinter()(error); - } - } - - currentRunnable().addExpectationResult(false, { - matcherName: '', - passed: false, - expected: '', - actual: '', - message: message, - error: error && error.message ? error : null - }); - - if (config.oneFailurePerSpec) { - throw new Error(message); - } - }; - - this.cleanup_ = function() { - if (globalErrors) { - globalErrors.uninstall(); - } - }; - } - - return Env; -}; - -getJasmineRequireObj().JsApiReporter = function(j$) { - /** - * @name jsApiReporter - * @classdesc {@link Reporter} added by default in `boot.js` to record results for retrieval in javascript code. An instance is made available as `jsApiReporter` on the global object. - * @class - * @hideconstructor - */ - function JsApiReporter(options) { - var timer = options.timer || new j$.Timer(), - status = 'loaded'; - - this.started = false; - this.finished = false; - this.runDetails = {}; - - this.jasmineStarted = function() { - this.started = true; - status = 'started'; - timer.start(); - }; - - var executionTime; - - this.jasmineDone = function(runDetails) { - this.finished = true; - this.runDetails = runDetails; - executionTime = timer.elapsed(); - status = 'done'; - }; - - /** - * Get the current status for the Jasmine environment. - * @name jsApiReporter#status - * @since 2.0.0 - * @function - * @return {String} - One of `loaded`, `started`, or `done` - */ - this.status = function() { - return status; - }; - - var suites = [], - suites_hash = {}; - - this.suiteStarted = function(result) { - suites_hash[result.id] = result; - }; - - this.suiteDone = function(result) { - storeSuite(result); - }; - - /** - * Get the results for a set of suites. - * - * Retrievable in slices for easier serialization. - * @name jsApiReporter#suiteResults - * @since 2.1.0 - * @function - * @param {Number} index - The position in the suites list to start from. - * @param {Number} length - Maximum number of suite results to return. - * @return {SuiteResult[]} - */ - this.suiteResults = function(index, length) { - return suites.slice(index, index + length); - }; - - function storeSuite(result) { - suites.push(result); - suites_hash[result.id] = result; - } - - /** - * Get all of the suites in a single object, with their `id` as the key. - * @name jsApiReporter#suites - * @since 2.0.0 - * @function - * @return {Object} - Map of suite id to {@link SuiteResult} - */ - this.suites = function() { - return suites_hash; - }; - - var specs = []; - - this.specDone = function(result) { - specs.push(result); - }; - - /** - * Get the results for a set of specs. - * - * Retrievable in slices for easier serialization. - * @name jsApiReporter#specResults - * @since 2.0.0 - * @function - * @param {Number} index - The position in the specs list to start from. - * @param {Number} length - Maximum number of specs results to return. - * @return {SpecResult[]} - */ - this.specResults = function(index, length) { - return specs.slice(index, index + length); - }; - - /** - * Get all spec results. - * @name jsApiReporter#specs - * @since 2.0.0 - * @function - * @return {SpecResult[]} - */ - this.specs = function() { - return specs; - }; - - /** - * Get the number of milliseconds it took for the full Jasmine suite to run. - * @name jsApiReporter#executionTime - * @since 2.0.0 - * @function - * @return {Number} - */ - this.executionTime = function() { - return executionTime; - }; - } - - return JsApiReporter; -}; - -getJasmineRequireObj().Any = function(j$) { - function Any(expectedObject) { - if (typeof expectedObject === 'undefined') { - throw new TypeError( - 'jasmine.any() expects to be passed a constructor function. ' + - 'Please pass one or use jasmine.anything() to match any object.' - ); - } - this.expectedObject = expectedObject; - } - - Any.prototype.asymmetricMatch = function(other) { - if (this.expectedObject == String) { - return typeof other == 'string' || other instanceof String; - } - - if (this.expectedObject == Number) { - return typeof other == 'number' || other instanceof Number; - } - - if (this.expectedObject == Function) { - return typeof other == 'function' || other instanceof Function; - } - - if (this.expectedObject == Object) { - return other !== null && typeof other == 'object'; - } - - if (this.expectedObject == Boolean) { - return typeof other == 'boolean'; - } - - /* jshint -W122 */ - /* global Symbol */ - if (typeof Symbol != 'undefined' && this.expectedObject == Symbol) { - return typeof other == 'symbol'; - } - /* jshint +W122 */ - - return other instanceof this.expectedObject; - }; - - Any.prototype.jasmineToString = function() { - return ''; - }; - - return Any; -}; - -getJasmineRequireObj().Anything = function(j$) { - function Anything() {} - - Anything.prototype.asymmetricMatch = function(other) { - return !j$.util.isUndefined(other) && other !== null; - }; - - Anything.prototype.jasmineToString = function() { - return ''; - }; - - return Anything; -}; - -getJasmineRequireObj().ArrayContaining = function(j$) { - function ArrayContaining(sample) { - this.sample = sample; - } - - ArrayContaining.prototype.asymmetricMatch = function(other, matchersUtil) { - if (!j$.isArray_(this.sample)) { - throw new Error( - 'You must provide an array to arrayContaining, not ' + - j$.pp(this.sample) + - '.' - ); - } - - // If the actual parameter is not an array, we can fail immediately, since it couldn't - // possibly be an "array containing" anything. However, we also want an empty sample - // array to match anything, so we need to double-check we aren't in that case - if (!j$.isArray_(other) && this.sample.length > 0) { - return false; - } - - for (var i = 0; i < this.sample.length; i++) { - var item = this.sample[i]; - if (!matchersUtil.contains(other, item)) { - return false; - } - } - - return true; - }; - - ArrayContaining.prototype.jasmineToString = function(pp) { - return ''; - }; - - return ArrayContaining; -}; - -getJasmineRequireObj().ArrayWithExactContents = function(j$) { - function ArrayWithExactContents(sample) { - this.sample = sample; - } - - ArrayWithExactContents.prototype.asymmetricMatch = function( - other, - matchersUtil - ) { - if (!j$.isArray_(this.sample)) { - throw new Error( - 'You must provide an array to arrayWithExactContents, not ' + - j$.pp(this.sample) + - '.' - ); - } - - if (this.sample.length !== other.length) { - return false; - } - - for (var i = 0; i < this.sample.length; i++) { - var item = this.sample[i]; - if (!matchersUtil.contains(other, item)) { - return false; - } - } - - return true; - }; - - ArrayWithExactContents.prototype.jasmineToString = function(pp) { - return ''; - }; - - return ArrayWithExactContents; -}; - -getJasmineRequireObj().Empty = function(j$) { - function Empty() {} - - Empty.prototype.asymmetricMatch = function(other) { - if (j$.isString_(other) || j$.isArray_(other) || j$.isTypedArray_(other)) { - return other.length === 0; - } - - if (j$.isMap(other) || j$.isSet(other)) { - return other.size === 0; - } - - if (j$.isObject_(other)) { - return Object.keys(other).length === 0; - } - return false; - }; - - Empty.prototype.jasmineToString = function() { - return ''; - }; - - return Empty; -}; - -getJasmineRequireObj().Falsy = function(j$) { - function Falsy() {} - - Falsy.prototype.asymmetricMatch = function(other) { - return !other; - }; - - Falsy.prototype.jasmineToString = function() { - return ''; - }; - - return Falsy; -}; - -getJasmineRequireObj().MapContaining = function(j$) { - function MapContaining(sample) { - if (!j$.isMap(sample)) { - throw new Error( - 'You must provide a map to `mapContaining`, not ' + j$.pp(sample) - ); - } - - this.sample = sample; - } - - MapContaining.prototype.asymmetricMatch = function(other, matchersUtil) { - if (!j$.isMap(other)) return false; - - var hasAllMatches = true; - j$.util.forEachBreakable(this.sample, function(breakLoop, value, key) { - // for each key/value pair in `sample` - // there should be at least one pair in `other` whose key and value both match - var hasMatch = false; - j$.util.forEachBreakable(other, function(oBreakLoop, oValue, oKey) { - if ( - matchersUtil.equals(oKey, key) && - matchersUtil.equals(oValue, value) - ) { - hasMatch = true; - oBreakLoop(); - } - }); - if (!hasMatch) { - hasAllMatches = false; - breakLoop(); - } - }); - - return hasAllMatches; - }; - - MapContaining.prototype.jasmineToString = function(pp) { - return ''; - }; - - return MapContaining; -}; - -getJasmineRequireObj().NotEmpty = function(j$) { - function NotEmpty() {} - - NotEmpty.prototype.asymmetricMatch = function(other) { - if (j$.isString_(other) || j$.isArray_(other) || j$.isTypedArray_(other)) { - return other.length !== 0; - } - - if (j$.isMap(other) || j$.isSet(other)) { - return other.size !== 0; - } - - if (j$.isObject_(other)) { - return Object.keys(other).length !== 0; - } - - return false; - }; - - NotEmpty.prototype.jasmineToString = function() { - return ''; - }; - - return NotEmpty; -}; - -getJasmineRequireObj().ObjectContaining = function(j$) { - function ObjectContaining(sample) { - this.sample = sample; - } - - function getPrototype(obj) { - if (Object.getPrototypeOf) { - return Object.getPrototypeOf(obj); - } - - if (obj.constructor.prototype == obj) { - return null; - } - - return obj.constructor.prototype; - } - - function hasProperty(obj, property) { - if (!obj || typeof obj !== 'object') { - return false; - } - - if (Object.prototype.hasOwnProperty.call(obj, property)) { - return true; - } - - return hasProperty(getPrototype(obj), property); - } - - ObjectContaining.prototype.asymmetricMatch = function(other, matchersUtil) { - if (typeof this.sample !== 'object') { - throw new Error( - "You must provide an object to objectContaining, not '" + - this.sample + - "'." - ); - } - if (typeof other !== 'object') { - return false; - } - - for (var property in this.sample) { - if ( - !hasProperty(other, property) || - !matchersUtil.equals(this.sample[property], other[property]) - ) { - return false; - } - } - - return true; - }; - - ObjectContaining.prototype.valuesForDiff_ = function(other, pp) { - if (!j$.isObject_(other)) { - return { - self: this.jasmineToString(pp), - other: other - }; - } - - var filteredOther = {}; - Object.keys(this.sample).forEach(function(k) { - // eq short-circuits comparison of objects that have different key sets, - // so include all keys even if undefined. - filteredOther[k] = other[k]; - }); - - return { - self: this.sample, - other: filteredOther - }; - }; - - ObjectContaining.prototype.jasmineToString = function(pp) { - return ''; - }; - - return ObjectContaining; -}; - -getJasmineRequireObj().SetContaining = function(j$) { - function SetContaining(sample) { - if (!j$.isSet(sample)) { - throw new Error( - 'You must provide a set to `setContaining`, not ' + j$.pp(sample) - ); - } - - this.sample = sample; - } - - SetContaining.prototype.asymmetricMatch = function(other, matchersUtil) { - if (!j$.isSet(other)) return false; - - var hasAllMatches = true; - j$.util.forEachBreakable(this.sample, function(breakLoop, item) { - // for each item in `sample` there should be at least one matching item in `other` - // (not using `matchersUtil.contains` because it compares set members by reference, - // not by deep value equality) - var hasMatch = false; - j$.util.forEachBreakable(other, function(oBreakLoop, oItem) { - if (matchersUtil.equals(oItem, item)) { - hasMatch = true; - oBreakLoop(); - } - }); - if (!hasMatch) { - hasAllMatches = false; - breakLoop(); - } - }); - - return hasAllMatches; - }; - - SetContaining.prototype.jasmineToString = function(pp) { - return ''; - }; - - return SetContaining; -}; - -getJasmineRequireObj().StringMatching = function(j$) { - function StringMatching(expected) { - if (!j$.isString_(expected) && !j$.isA_('RegExp', expected)) { - throw new Error('Expected is not a String or a RegExp'); - } - - this.regexp = new RegExp(expected); - } - - StringMatching.prototype.asymmetricMatch = function(other) { - return this.regexp.test(other); - }; - - StringMatching.prototype.jasmineToString = function() { - return ''; - }; - - return StringMatching; -}; - -getJasmineRequireObj().Truthy = function(j$) { - function Truthy() {} - - Truthy.prototype.asymmetricMatch = function(other) { - return !!other; - }; - - Truthy.prototype.jasmineToString = function() { - return ''; - }; - - return Truthy; -}; - -getJasmineRequireObj().asymmetricEqualityTesterArgCompatShim = function(j$) { - /* - Older versions of Jasmine passed an array of custom equality testers as the - second argument to each asymmetric equality tester's `asymmetricMatch` - method. Newer versions will pass a `MatchersUtil` instance. The - asymmetricEqualityTesterArgCompatShim allows for a graceful migration from - the old interface to the new by "being" both an array of custom equality - testers and a `MatchersUtil` at the same time. - - This code should be removed in the next major release. - */ - - var likelyArrayProps = [ - 'concat', - 'constructor', - 'copyWithin', - 'entries', - 'every', - 'fill', - 'filter', - 'find', - 'findIndex', - 'flat', - 'flatMap', - 'forEach', - 'includes', - 'indexOf', - 'join', - 'keys', - 'lastIndexOf', - 'length', - 'map', - 'pop', - 'push', - 'reduce', - 'reduceRight', - 'reverse', - 'shift', - 'slice', - 'some', - 'sort', - 'splice', - 'toLocaleString', - 'toSource', - 'toString', - 'unshift', - 'values' - ]; - - function asymmetricEqualityTesterArgCompatShim( - matchersUtil, - customEqualityTesters - ) { - var self = Object.create(matchersUtil), - props, - i, - k; - - copy(self, customEqualityTesters, 'length'); - - for (i = 0; i < customEqualityTesters.length; i++) { - copy(self, customEqualityTesters, i); - } - - var props = arrayProps(); - - for (i = 0; i < props.length; i++) { - k = props[i]; - // Skip length (dealt with above), and anything that collides with - // MatchesUtil e.g. an Array.prototype.contains method added by user code - if (k !== 'length' && !self[k]) { - copy(self, Array.prototype, k); - } - } - - return self; - } - - function copy(dest, src, propName) { - Object.defineProperty(dest, propName, { - get: function() { - return src[propName]; - } - }); - } - - function arrayProps() { - var props, a, k; - - if (!Object.getOwnPropertyDescriptors) { - return likelyArrayProps.filter(function(k) { - return Array.prototype.hasOwnProperty(k); - }); - } - - props = Object.getOwnPropertyDescriptors(Array.prototype); // eslint-disable-line compat/compat - a = []; - - for (k in props) { - a.push(k); - } - - return a; - } - - return asymmetricEqualityTesterArgCompatShim; -}; - -getJasmineRequireObj().CallTracker = function(j$) { - /** - * @namespace Spy#calls - * @since 2.0.0 - */ - function CallTracker() { - var calls = []; - var opts = {}; - - this.track = function(context) { - if (opts.cloneArgs) { - context.args = j$.util.cloneArgs(context.args); - } - calls.push(context); - }; - - /** - * Check whether this spy has been invoked. - * @name Spy#calls#any - * @since 2.0.0 - * @function - * @return {Boolean} - */ - this.any = function() { - return !!calls.length; - }; - - /** - * Get the number of invocations of this spy. - * @name Spy#calls#count - * @since 2.0.0 - * @function - * @return {Integer} - */ - this.count = function() { - return calls.length; - }; - - /** - * Get the arguments that were passed to a specific invocation of this spy. - * @name Spy#calls#argsFor - * @since 2.0.0 - * @function - * @param {Integer} index The 0-based invocation index. - * @return {Array} - */ - this.argsFor = function(index) { - var call = calls[index]; - return call ? call.args : []; - }; - - /** - * Get the "this" object that was passed to a specific invocation of this spy. - * @name Spy#calls#thisFor - * @function - * @param {Integer} index The 0-based invocation index. - * @return {Object?} - */ - this.thisFor = function(index) { - var call = calls[index]; - return call ? call.object : undefined; - }; - - /** - * Get the raw calls array for this spy. - * @name Spy#calls#all - * @since 2.0.0 - * @function - * @return {Spy.callData[]} - */ - this.all = function() { - return calls; - }; - - /** - * Get all of the arguments for each invocation of this spy in the order they were received. - * @name Spy#calls#allArgs - * @since 2.0.0 - * @function - * @return {Array} - */ - this.allArgs = function() { - var callArgs = []; - for (var i = 0; i < calls.length; i++) { - callArgs.push(calls[i].args); - } - - return callArgs; - }; - - /** - * Get the first invocation of this spy. - * @name Spy#calls#first - * @since 2.0.0 - * @function - * @return {ObjecSpy.callData} - */ - this.first = function() { - return calls[0]; - }; - - /** - * Get the most recent invocation of this spy. - * @name Spy#calls#mostRecent - * @since 2.0.0 - * @function - * @return {ObjecSpy.callData} - */ - this.mostRecent = function() { - return calls[calls.length - 1]; - }; - - /** - * Reset this spy as if it has never been called. - * @name Spy#calls#reset - * @since 2.0.0 - * @function - */ - this.reset = function() { - calls = []; - }; - - /** - * Set this spy to do a shallow clone of arguments passed to each invocation. - * @name Spy#calls#saveArgumentsByValue - * @since 2.5.0 - * @function - */ - this.saveArgumentsByValue = function() { - opts.cloneArgs = true; - }; - } - - return CallTracker; -}; - -getJasmineRequireObj().clearStack = function(j$) { - var maxInlineCallCount = 10; - - function messageChannelImpl(global, setTimeout) { - var channel = new global.MessageChannel(), - head = {}, - tail = head; - - var taskRunning = false; - channel.port1.onmessage = function() { - head = head.next; - var task = head.task; - delete head.task; - - if (taskRunning) { - global.setTimeout(task, 0); - } else { - try { - taskRunning = true; - task(); - } finally { - taskRunning = false; - } - } - }; - - var currentCallCount = 0; - return function clearStack(fn) { - currentCallCount++; - - if (currentCallCount < maxInlineCallCount) { - tail = tail.next = { task: fn }; - channel.port2.postMessage(0); - } else { - currentCallCount = 0; - setTimeout(fn); - } - }; - } - - function getClearStack(global) { - var currentCallCount = 0; - var realSetTimeout = global.setTimeout; - var setTimeoutImpl = function clearStack(fn) { - Function.prototype.apply.apply(realSetTimeout, [global, [fn, 0]]); - }; - - if (j$.isFunction_(global.setImmediate)) { - var realSetImmediate = global.setImmediate; - return function(fn) { - currentCallCount++; - - if (currentCallCount < maxInlineCallCount) { - realSetImmediate(fn); - } else { - currentCallCount = 0; - - setTimeoutImpl(fn); - } - }; - } else if (!j$.util.isUndefined(global.MessageChannel)) { - return messageChannelImpl(global, setTimeoutImpl); - } else { - return setTimeoutImpl; - } - } - - return getClearStack; -}; - -getJasmineRequireObj().Clock = function() { - /* global process */ - var NODE_JS = - typeof process !== 'undefined' && - process.versions && - typeof process.versions.node === 'string'; - - /** - * @class Clock - * @classdesc Jasmine's mock clock is used when testing time dependent code.
- * _Note:_ Do not construct this directly. You can get the current clock with - * {@link jasmine.clock}. - * @hideconstructor - */ - function Clock(global, delayedFunctionSchedulerFactory, mockDate) { - var self = this, - realTimingFunctions = { - setTimeout: global.setTimeout, - clearTimeout: global.clearTimeout, - setInterval: global.setInterval, - clearInterval: global.clearInterval - }, - fakeTimingFunctions = { - setTimeout: setTimeout, - clearTimeout: clearTimeout, - setInterval: setInterval, - clearInterval: clearInterval - }, - installed = false, - delayedFunctionScheduler, - timer; - - self.FakeTimeout = FakeTimeout; - - /** - * Install the mock clock over the built-in methods. - * @name Clock#install - * @since 2.0.0 - * @function - * @return {Clock} - */ - self.install = function() { - if (!originalTimingFunctionsIntact()) { - throw new Error( - 'Jasmine Clock was unable to install over custom global timer functions. Is the clock already installed?' - ); - } - replace(global, fakeTimingFunctions); - timer = fakeTimingFunctions; - delayedFunctionScheduler = delayedFunctionSchedulerFactory(); - installed = true; - - return self; - }; - - /** - * Uninstall the mock clock, returning the built-in methods to their places. - * @name Clock#uninstall - * @since 2.0.0 - * @function - */ - self.uninstall = function() { - delayedFunctionScheduler = null; - mockDate.uninstall(); - replace(global, realTimingFunctions); - - timer = realTimingFunctions; - installed = false; - }; - - /** - * Execute a function with a mocked Clock - * - * The clock will be {@link Clock#install|install}ed before the function is called and {@link Clock#uninstall|uninstall}ed in a `finally` after the function completes. - * @name Clock#withMock - * @since 2.3.0 - * @function - * @param {Function} closure The function to be called. - */ - self.withMock = function(closure) { - this.install(); - try { - closure(); - } finally { - this.uninstall(); - } - }; - - /** - * Instruct the installed Clock to also mock the date returned by `new Date()` - * @name Clock#mockDate - * @since 2.1.0 - * @function - * @param {Date} [initialDate=now] The `Date` to provide. - */ - self.mockDate = function(initialDate) { - mockDate.install(initialDate); - }; - - self.setTimeout = function(fn, delay, params) { - return Function.prototype.apply.apply(timer.setTimeout, [ - global, - arguments - ]); - }; - - self.setInterval = function(fn, delay, params) { - return Function.prototype.apply.apply(timer.setInterval, [ - global, - arguments - ]); - }; - - self.clearTimeout = function(id) { - return Function.prototype.call.apply(timer.clearTimeout, [global, id]); - }; - - self.clearInterval = function(id) { - return Function.prototype.call.apply(timer.clearInterval, [global, id]); - }; - - /** - * Tick the Clock forward, running any enqueued timeouts along the way - * @name Clock#tick - * @since 1.3.0 - * @function - * @param {int} millis The number of milliseconds to tick. - */ - self.tick = function(millis) { - if (installed) { - delayedFunctionScheduler.tick(millis, function(millis) { - mockDate.tick(millis); - }); - } else { - throw new Error( - 'Mock clock is not installed, use jasmine.clock().install()' - ); - } - }; - - return self; - - function originalTimingFunctionsIntact() { - return ( - global.setTimeout === realTimingFunctions.setTimeout && - global.clearTimeout === realTimingFunctions.clearTimeout && - global.setInterval === realTimingFunctions.setInterval && - global.clearInterval === realTimingFunctions.clearInterval - ); - } - - function replace(dest, source) { - for (var prop in source) { - dest[prop] = source[prop]; - } - } - - function setTimeout(fn, delay) { - if (!NODE_JS) { - return delayedFunctionScheduler.scheduleFunction( - fn, - delay, - argSlice(arguments, 2) - ); - } - - var timeout = new FakeTimeout(); - - delayedFunctionScheduler.scheduleFunction( - fn, - delay, - argSlice(arguments, 2), - false, - timeout - ); - - return timeout; - } - - function clearTimeout(id) { - return delayedFunctionScheduler.removeFunctionWithId(id); - } - - function setInterval(fn, interval) { - if (!NODE_JS) { - return delayedFunctionScheduler.scheduleFunction( - fn, - interval, - argSlice(arguments, 2), - true - ); - } - - var timeout = new FakeTimeout(); - - delayedFunctionScheduler.scheduleFunction( - fn, - interval, - argSlice(arguments, 2), - true, - timeout - ); - - return timeout; - } - - function clearInterval(id) { - return delayedFunctionScheduler.removeFunctionWithId(id); - } - - function argSlice(argsObj, n) { - return Array.prototype.slice.call(argsObj, n); - } - } - - /** - * Mocks Node.js Timeout class - */ - function FakeTimeout() {} - - FakeTimeout.prototype.ref = function() { - return this; - }; - - FakeTimeout.prototype.unref = function() { - return this; - }; - - return Clock; -}; - -getJasmineRequireObj().DelayedFunctionScheduler = function(j$) { - function DelayedFunctionScheduler() { - var self = this; - var scheduledLookup = []; - var scheduledFunctions = {}; - var currentTime = 0; - var delayedFnCount = 0; - var deletedKeys = []; - - self.tick = function(millis, tickDate) { - millis = millis || 0; - var endTime = currentTime + millis; - - runScheduledFunctions(endTime, tickDate); - currentTime = endTime; - }; - - self.scheduleFunction = function( - funcToCall, - millis, - params, - recurring, - timeoutKey, - runAtMillis - ) { - var f; - if (typeof funcToCall === 'string') { - /* jshint evil: true */ - f = function() { - return eval(funcToCall); - }; - /* jshint evil: false */ - } else { - f = funcToCall; - } - - millis = millis || 0; - timeoutKey = timeoutKey || ++delayedFnCount; - runAtMillis = runAtMillis || currentTime + millis; - - var funcToSchedule = { - runAtMillis: runAtMillis, - funcToCall: f, - recurring: recurring, - params: params, - timeoutKey: timeoutKey, - millis: millis - }; - - if (runAtMillis in scheduledFunctions) { - scheduledFunctions[runAtMillis].push(funcToSchedule); - } else { - scheduledFunctions[runAtMillis] = [funcToSchedule]; - scheduledLookup.push(runAtMillis); - scheduledLookup.sort(function(a, b) { - return a - b; - }); - } - - return timeoutKey; - }; - - self.removeFunctionWithId = function(timeoutKey) { - deletedKeys.push(timeoutKey); - - for (var runAtMillis in scheduledFunctions) { - var funcs = scheduledFunctions[runAtMillis]; - var i = indexOfFirstToPass(funcs, function(func) { - return func.timeoutKey === timeoutKey; - }); - - if (i > -1) { - if (funcs.length === 1) { - delete scheduledFunctions[runAtMillis]; - deleteFromLookup(runAtMillis); - } else { - funcs.splice(i, 1); - } - - // intervals get rescheduled when executed, so there's never more - // than a single scheduled function with a given timeoutKey - break; - } - } - }; - - return self; - - function indexOfFirstToPass(array, testFn) { - var index = -1; - - for (var i = 0; i < array.length; ++i) { - if (testFn(array[i])) { - index = i; - break; - } - } - - return index; - } - - function deleteFromLookup(key) { - var value = Number(key); - var i = indexOfFirstToPass(scheduledLookup, function(millis) { - return millis === value; - }); - - if (i > -1) { - scheduledLookup.splice(i, 1); - } - } - - function reschedule(scheduledFn) { - self.scheduleFunction( - scheduledFn.funcToCall, - scheduledFn.millis, - scheduledFn.params, - true, - scheduledFn.timeoutKey, - scheduledFn.runAtMillis + scheduledFn.millis - ); - } - - function forEachFunction(funcsToRun, callback) { - for (var i = 0; i < funcsToRun.length; ++i) { - callback(funcsToRun[i]); - } - } - - function runScheduledFunctions(endTime, tickDate) { - tickDate = tickDate || function() {}; - if (scheduledLookup.length === 0 || scheduledLookup[0] > endTime) { - tickDate(endTime - currentTime); - return; - } - - do { - deletedKeys = []; - var newCurrentTime = scheduledLookup.shift(); - tickDate(newCurrentTime - currentTime); - - currentTime = newCurrentTime; - - var funcsToRun = scheduledFunctions[currentTime]; - - delete scheduledFunctions[currentTime]; - - forEachFunction(funcsToRun, function(funcToRun) { - if (funcToRun.recurring) { - reschedule(funcToRun); - } - }); - - forEachFunction(funcsToRun, function(funcToRun) { - if (j$.util.arrayContains(deletedKeys, funcToRun.timeoutKey)) { - // skip a timeoutKey deleted whilst we were running - return; - } - funcToRun.funcToCall.apply(null, funcToRun.params || []); - }); - deletedKeys = []; - } while ( - scheduledLookup.length > 0 && - // checking first if we're out of time prevents setTimeout(0) - // scheduled in a funcToRun from forcing an extra iteration - currentTime !== endTime && - scheduledLookup[0] <= endTime - ); - - // ran out of functions to call, but still time left on the clock - if (currentTime !== endTime) { - tickDate(endTime - currentTime); - } - } - } - - return DelayedFunctionScheduler; -}; - -getJasmineRequireObj().errors = function() { - function ExpectationFailed() {} - - ExpectationFailed.prototype = new Error(); - ExpectationFailed.prototype.constructor = ExpectationFailed; - - return { - ExpectationFailed: ExpectationFailed - }; -}; - -getJasmineRequireObj().ExceptionFormatter = function(j$) { - var ignoredProperties = [ - 'name', - 'message', - 'stack', - 'fileName', - 'sourceURL', - 'line', - 'lineNumber', - 'column', - 'description', - 'jasmineMessage' - ]; - - function ExceptionFormatter(options) { - var jasmineFile = (options && options.jasmineFile) || j$.util.jasmineFile(); - this.message = function(error) { - var message = ''; - - if (error.jasmineMessage) { - message += error.jasmineMessage; - } else if (error.name && error.message) { - message += error.name + ': ' + error.message; - } else if (error.message) { - message += error.message; - } else { - message += error.toString() + ' thrown'; - } - - if (error.fileName || error.sourceURL) { - message += ' in ' + (error.fileName || error.sourceURL); - } - - if (error.line || error.lineNumber) { - message += ' (line ' + (error.line || error.lineNumber) + ')'; - } - - return message; - }; - - this.stack = function(error) { - if (!error || !error.stack) { - return null; - } - - var stackTrace = new j$.StackTrace(error); - var lines = filterJasmine(stackTrace); - var result = ''; - - if (stackTrace.message) { - lines.unshift(stackTrace.message); - } - - result += formatProperties(error); - result += lines.join('\n'); - - return result; - }; - - function filterJasmine(stackTrace) { - var result = [], - jasmineMarker = - stackTrace.style === 'webkit' ? '' : ' at '; - - stackTrace.frames.forEach(function(frame) { - if (frame.file !== jasmineFile) { - result.push(frame.raw); - } else if (result[result.length - 1] !== jasmineMarker) { - result.push(jasmineMarker); - } - }); - - return result; - } - - function formatProperties(error) { - if (!(error instanceof Object)) { - return; - } - - var result = {}; - var empty = true; - - for (var prop in error) { - if (j$.util.arrayContains(ignoredProperties, prop)) { - continue; - } - result[prop] = error[prop]; - empty = false; - } - - if (!empty) { - return 'error properties: ' + j$.pp(result) + '\n'; - } - - return ''; - } - } - - return ExceptionFormatter; -}; - -getJasmineRequireObj().Expectation = function(j$) { - /** - * Matchers that come with Jasmine out of the box. - * @namespace matchers - */ - function Expectation(options) { - this.expector = new j$.Expector(options); - - var customMatchers = options.customMatchers || {}; - for (var matcherName in customMatchers) { - this[matcherName] = wrapSyncCompare( - matcherName, - customMatchers[matcherName] - ); - } - } - - /** - * Add some context for an {@link expect} - * @function - * @name matchers#withContext - * @since 3.3.0 - * @param {String} message - Additional context to show when the matcher fails - * @return {matchers} - */ - Expectation.prototype.withContext = function withContext(message) { - return addFilter(this, new ContextAddingFilter(message)); - }; - - /** - * Invert the matcher following this {@link expect} - * @member - * @name matchers#not - * @since 1.3.0 - * @type {matchers} - * @example - * expect(something).not.toBe(true); - */ - Object.defineProperty(Expectation.prototype, 'not', { - get: function() { - return addFilter(this, syncNegatingFilter); - } - }); - - /** - * Asynchronous matchers that operate on an actual value which is a promise, - * and return a promise. - * - * Most async matchers will wait indefinitely for the promise to be resolved - * or rejected, resulting in a spec timeout if that never happens. If you - * expect that the promise will already be resolved or rejected at the time - * the matcher is called, you can use the {@link async-matchers#already} - * modifier to get a faster failure with a more helpful message. - * - * Note: Specs must await the result of each async matcher, return the - * promise returned by the matcher, or return a promise that's derived from - * the one returned by the matcher. Otherwise the matcher will not be - * evaluated before the spec completes. - * - * @example - * // Good - * await expectAsync(aPromise).toBeResolved(); - * @example - * // Good - * return expectAsync(aPromise).toBeResolved(); - * @example - * // Good - * return expectAsync(aPromise).toBeResolved() - * .then(function() { - * // more spec code - * }); - * @example - * // Bad - * expectAsync(aPromise).toBeResolved(); - * @namespace async-matchers - */ - function AsyncExpectation(options) { - var global = options.global || j$.getGlobal(); - this.expector = new j$.Expector(options); - - if (!global.Promise) { - throw new Error( - 'expectAsync is unavailable because the environment does not support promises.' - ); - } - - var customAsyncMatchers = options.customAsyncMatchers || {}; - for (var matcherName in customAsyncMatchers) { - this[matcherName] = wrapAsyncCompare( - matcherName, - customAsyncMatchers[matcherName] - ); - } - } - - /** - * Add some context for an {@link expectAsync} - * @function - * @name async-matchers#withContext - * @since 3.3.0 - * @param {String} message - Additional context to show when the async matcher fails - * @return {async-matchers} - */ - AsyncExpectation.prototype.withContext = function withContext(message) { - return addFilter(this, new ContextAddingFilter(message)); - }; - - /** - * Invert the matcher following this {@link expectAsync} - * @member - * @name async-matchers#not - * @type {async-matchers} - * @example - * await expectAsync(myPromise).not.toBeResolved(); - * @example - * return expectAsync(myPromise).not.toBeResolved(); - */ - Object.defineProperty(AsyncExpectation.prototype, 'not', { - get: function() { - return addFilter(this, asyncNegatingFilter); - } - }); - - /** - * Fail as soon as possible if the actual is pending. - * Otherwise evaluate the matcher. - * @member - * @name async-matchers#already - * @type {async-matchers} - * @example - * await expectAsync(myPromise).already.toBeResolved(); - * @example - * return expectAsync(myPromise).already.toBeResolved(); - */ - Object.defineProperty(AsyncExpectation.prototype, 'already', { - get: function() { - return addFilter(this, expectSettledPromiseFilter); - } - }); - - function wrapSyncCompare(name, matcherFactory) { - return function() { - var result = this.expector.compare(name, matcherFactory, arguments); - this.expector.processResult(result); - }; - } - - function wrapAsyncCompare(name, matcherFactory) { - return function() { - var self = this; - - // Capture the call stack here, before we go async, so that it will contain - // frames that are relevant to the user instead of just parts of Jasmine. - var errorForStack = j$.util.errorWithStack(); - - return this.expector - .compare(name, matcherFactory, arguments) - .then(function(result) { - self.expector.processResult(result, errorForStack); - }); - }; - } - - function addCoreMatchers(prototype, matchers, wrapper) { - for (var matcherName in matchers) { - var matcher = matchers[matcherName]; - prototype[matcherName] = wrapper(matcherName, matcher); - } - } - - function addFilter(source, filter) { - var result = Object.create(source); - result.expector = source.expector.addFilter(filter); - return result; - } - - function negatedFailureMessage(result, matcherName, args, matchersUtil) { - if (result.message) { - if (j$.isFunction_(result.message)) { - return result.message(); - } else { - return result.message; - } - } - - args = args.slice(); - args.unshift(true); - args.unshift(matcherName); - return matchersUtil.buildFailureMessage.apply(matchersUtil, args); - } - - function negate(result) { - result.pass = !result.pass; - return result; - } - - var syncNegatingFilter = { - selectComparisonFunc: function(matcher) { - function defaultNegativeCompare() { - return negate(matcher.compare.apply(null, arguments)); - } - - return matcher.negativeCompare || defaultNegativeCompare; - }, - buildFailureMessage: negatedFailureMessage - }; - - var asyncNegatingFilter = { - selectComparisonFunc: function(matcher) { - function defaultNegativeCompare() { - return matcher.compare.apply(this, arguments).then(negate); - } - - return matcher.negativeCompare || defaultNegativeCompare; - }, - buildFailureMessage: negatedFailureMessage - }; - - var expectSettledPromiseFilter = { - selectComparisonFunc: function(matcher) { - return function(actual) { - var matcherArgs = arguments; - - return j$.isPending_(actual).then(function(isPending) { - if (isPending) { - return { - pass: false, - message: - 'Expected a promise to be settled (via ' + - 'expectAsync(...).already) but it was pending.' - }; - } else { - return matcher.compare.apply(null, matcherArgs); - } - }); - }; - } - }; - - function ContextAddingFilter(message) { - this.message = message; - } - - ContextAddingFilter.prototype.modifyFailureMessage = function(msg) { - var nl = msg.indexOf('\n'); - - if (nl === -1) { - return this.message + ': ' + msg; - } else { - return this.message + ':\n' + indent(msg); - } - }; - - function indent(s) { - return s.replace(/^/gm, ' '); - } - - return { - factory: function(options) { - return new Expectation(options || {}); - }, - addCoreMatchers: function(matchers) { - addCoreMatchers(Expectation.prototype, matchers, wrapSyncCompare); - }, - asyncFactory: function(options) { - return new AsyncExpectation(options || {}); - }, - addAsyncCoreMatchers: function(matchers) { - addCoreMatchers(AsyncExpectation.prototype, matchers, wrapAsyncCompare); - } - }; -}; - -getJasmineRequireObj().ExpectationFilterChain = function() { - function ExpectationFilterChain(maybeFilter, prev) { - this.filter_ = maybeFilter; - this.prev_ = prev; - } - - ExpectationFilterChain.prototype.addFilter = function(filter) { - return new ExpectationFilterChain(filter, this); - }; - - ExpectationFilterChain.prototype.selectComparisonFunc = function(matcher) { - return this.callFirst_('selectComparisonFunc', arguments).result; - }; - - ExpectationFilterChain.prototype.buildFailureMessage = function( - result, - matcherName, - args, - matchersUtil - ) { - return this.callFirst_('buildFailureMessage', arguments).result; - }; - - ExpectationFilterChain.prototype.modifyFailureMessage = function(msg) { - var result = this.callFirst_('modifyFailureMessage', arguments).result; - return result || msg; - }; - - ExpectationFilterChain.prototype.callFirst_ = function(fname, args) { - var prevResult; - - if (this.prev_) { - prevResult = this.prev_.callFirst_(fname, args); - - if (prevResult.found) { - return prevResult; - } - } - - if (this.filter_ && this.filter_[fname]) { - return { - found: true, - result: this.filter_[fname].apply(this.filter_, args) - }; - } - - return { found: false }; - }; - - return ExpectationFilterChain; -}; - -//TODO: expectation result may make more sense as a presentation of an expectation. -getJasmineRequireObj().buildExpectationResult = function(j$) { - function buildExpectationResult(options) { - var messageFormatter = options.messageFormatter || function() {}, - stackFormatter = options.stackFormatter || function() {}; - - /** - * @typedef Expectation - * @property {String} matcherName - The name of the matcher that was executed for this expectation. - * @property {String} message - The failure message for the expectation. - * @property {String} stack - The stack trace for the failure if available. - * @property {Boolean} passed - Whether the expectation passed or failed. - * @property {Object} expected - If the expectation failed, what was the expected value. - * @property {Object} actual - If the expectation failed, what actual value was produced. - */ - var result = { - matcherName: options.matcherName, - message: message(), - stack: stack(), - passed: options.passed - }; - - if (!result.passed) { - result.expected = options.expected; - result.actual = options.actual; - - if (options.error && !j$.isString_(options.error)) { - if ('code' in options.error) { - result.code = options.error.code; - } - - if ( - options.error.code === 'ERR_ASSERTION' && - options.expected === '' && - options.actual === '' - ) { - result.expected = options.error.expected; - result.actual = options.error.actual; - result.matcherName = 'assert ' + options.error.operator; - } - } - } - - return result; - - function message() { - if (options.passed) { - return 'Passed.'; - } else if (options.message) { - return options.message; - } else if (options.error) { - return messageFormatter(options.error); - } - return ''; - } - - function stack() { - if (options.passed) { - return ''; - } - - var error = options.error; - if (!error) { - if (options.errorForStack) { - error = options.errorForStack; - } else if (options.stack) { - error = options; - } else { - try { - throw new Error(message()); - } catch (e) { - error = e; - } - } - } - return stackFormatter(error); - } - } - - return buildExpectationResult; -}; - -getJasmineRequireObj().Expector = function(j$) { - function Expector(options) { - this.matchersUtil = options.matchersUtil || { - buildFailureMessage: function() {} - }; - this.customEqualityTesters = options.customEqualityTesters || []; - this.actual = options.actual; - this.addExpectationResult = options.addExpectationResult || function() {}; - this.filters = new j$.ExpectationFilterChain(); - } - - Expector.prototype.instantiateMatcher = function( - matcherName, - matcherFactory, - args - ) { - this.matcherName = matcherName; - this.args = Array.prototype.slice.call(args, 0); - this.expected = this.args.slice(0); - - this.args.unshift(this.actual); - - var matcher = matcherFactory(this.matchersUtil, this.customEqualityTesters); - var comparisonFunc = this.filters.selectComparisonFunc(matcher); - return comparisonFunc || matcher.compare; - }; - - Expector.prototype.buildMessage = function(result) { - var self = this; - - if (result.pass) { - return ''; - } - - var msg = this.filters.buildFailureMessage( - result, - this.matcherName, - this.args, - this.matchersUtil, - defaultMessage - ); - return this.filters.modifyFailureMessage(msg || defaultMessage()); - - function defaultMessage() { - if (!result.message) { - var args = self.args.slice(); - args.unshift(false); - args.unshift(self.matcherName); - return self.matchersUtil.buildFailureMessage.apply( - self.matchersUtil, - args - ); - } else if (j$.isFunction_(result.message)) { - return result.message(); - } else { - return result.message; - } - } - }; - - Expector.prototype.compare = function(matcherName, matcherFactory, args) { - var matcherCompare = this.instantiateMatcher( - matcherName, - matcherFactory, - args - ); - return matcherCompare.apply(null, this.args); - }; - - Expector.prototype.addFilter = function(filter) { - var result = Object.create(this); - result.filters = this.filters.addFilter(filter); - return result; - }; - - Expector.prototype.processResult = function(result, errorForStack) { - var message = this.buildMessage(result); - - if (this.expected.length === 1) { - this.expected = this.expected[0]; - } - - this.addExpectationResult(result.pass, { - matcherName: this.matcherName, - passed: result.pass, - message: message, - error: errorForStack ? undefined : result.error, - errorForStack: errorForStack || undefined, - actual: this.actual, - expected: this.expected // TODO: this may need to be arrayified/sliced - }); - }; - - return Expector; -}; - -getJasmineRequireObj().formatErrorMsg = function() { - function generateErrorMsg(domain, usage) { - var usageDefinition = usage ? '\nUsage: ' + usage : ''; - - return function errorMsg(msg) { - return domain + ' : ' + msg + usageDefinition; - }; - } - - return generateErrorMsg; -}; - -getJasmineRequireObj().GlobalErrors = function(j$) { - function GlobalErrors(global) { - var handlers = []; - global = global || j$.getGlobal(); - - var onerror = function onerror() { - var handler = handlers[handlers.length - 1]; - - if (handler) { - handler.apply(null, Array.prototype.slice.call(arguments, 0)); - } else { - throw arguments[0]; - } - }; - - this.originalHandlers = {}; - this.jasmineHandlers = {}; - this.installOne_ = function installOne_(errorType, jasmineMessage) { - function taggedOnError(error) { - var substituteMsg; - - if (j$.isError_(error)) { - error.jasmineMessage = jasmineMessage + ': ' + error; - } else { - if (error) { - substituteMsg = jasmineMessage + ': ' + error; - } else { - substituteMsg = jasmineMessage + ' with no error or message'; - } - - if (errorType === 'unhandledRejection') { - substituteMsg += - '\n' + - '(Tip: to get a useful stack trace, use ' + - 'Promise.reject(new Error(...)) instead of Promise.reject(' + - (error ? '...' : '') + - ').)'; - } - - error = new Error(substituteMsg); - } - - var handler = handlers[handlers.length - 1]; - - if (handler) { - handler(error); - } else { - throw error; - } - } - - this.originalHandlers[errorType] = global.process.listeners(errorType); - this.jasmineHandlers[errorType] = taggedOnError; - - global.process.removeAllListeners(errorType); - global.process.on(errorType, taggedOnError); - - this.uninstall = function uninstall() { - var errorTypes = Object.keys(this.originalHandlers); - for (var iType = 0; iType < errorTypes.length; iType++) { - var errorType = errorTypes[iType]; - global.process.removeListener( - errorType, - this.jasmineHandlers[errorType] - ); - for (var i = 0; i < this.originalHandlers[errorType].length; i++) { - global.process.on(errorType, this.originalHandlers[errorType][i]); - } - delete this.originalHandlers[errorType]; - delete this.jasmineHandlers[errorType]; - } - }; - }; - - this.install = function install() { - if ( - global.process && - global.process.listeners && - j$.isFunction_(global.process.on) - ) { - this.installOne_('uncaughtException', 'Uncaught exception'); - this.installOne_('unhandledRejection', 'Unhandled promise rejection'); - } else { - var originalHandler = global.onerror; - global.onerror = onerror; - - var browserRejectionHandler = function browserRejectionHandler(event) { - if (j$.isError_(event.reason)) { - event.reason.jasmineMessage = - 'Unhandled promise rejection: ' + event.reason; - global.onerror(event.reason); - } else { - global.onerror('Unhandled promise rejection: ' + event.reason); - } - }; - - if (global.addEventListener) { - global.addEventListener( - 'unhandledrejection', - browserRejectionHandler - ); - } - - this.uninstall = function uninstall() { - global.onerror = originalHandler; - if (global.removeEventListener) { - global.removeEventListener( - 'unhandledrejection', - browserRejectionHandler - ); - } - }; - } - }; - - this.pushListener = function pushListener(listener) { - handlers.push(listener); - }; - - this.popListener = function popListener(listener) { - if (!listener) { - throw new Error('popListener expects a listener'); - } - - handlers.pop(); - }; - } - - return GlobalErrors; -}; - -/* eslint-disable compat/compat */ -getJasmineRequireObj().toBePending = function(j$) { - /** - * Expect a promise to be pending, i.e. the promise is neither resolved nor rejected. - * @function - * @async - * @name async-matchers#toBePending - * @since 3.6 - * @example - * await expectAsync(aPromise).toBePending(); - */ - return function toBePending() { - return { - compare: function(actual) { - if (!j$.isPromiseLike(actual)) { - throw new Error('Expected toBePending to be called on a promise.'); - } - var want = {}; - return Promise.race([actual, Promise.resolve(want)]).then( - function(got) { - return { pass: want === got }; - }, - function() { - return { pass: false }; - } - ); - } - }; - }; -}; - -getJasmineRequireObj().toBeRejected = function(j$) { - /** - * Expect a promise to be rejected. - * @function - * @async - * @name async-matchers#toBeRejected - * @since 3.1.0 - * @example - * await expectAsync(aPromise).toBeRejected(); - * @example - * return expectAsync(aPromise).toBeRejected(); - */ - return function toBeRejected() { - return { - compare: function(actual) { - if (!j$.isPromiseLike(actual)) { - throw new Error('Expected toBeRejected to be called on a promise.'); - } - return actual.then( - function() { - return { pass: false }; - }, - function() { - return { pass: true }; - } - ); - } - }; - }; -}; - -getJasmineRequireObj().toBeRejectedWith = function(j$) { - /** - * Expect a promise to be rejected with a value equal to the expected, using deep equality comparison. - * @function - * @async - * @name async-matchers#toBeRejectedWith - * @since 3.3.0 - * @param {Object} expected - Value that the promise is expected to be rejected with - * @example - * await expectAsync(aPromise).toBeRejectedWith({prop: 'value'}); - * @example - * return expectAsync(aPromise).toBeRejectedWith({prop: 'value'}); - */ - return function toBeRejectedWith(matchersUtil) { - return { - compare: function(actualPromise, expectedValue) { - if (!j$.isPromiseLike(actualPromise)) { - throw new Error( - 'Expected toBeRejectedWith to be called on a promise.' - ); - } - - function prefix(passed) { - return ( - 'Expected a promise ' + - (passed ? 'not ' : '') + - 'to be rejected with ' + - matchersUtil.pp(expectedValue) - ); - } - - return actualPromise.then( - function() { - return { - pass: false, - message: prefix(false) + ' but it was resolved.' - }; - }, - function(actualValue) { - if (matchersUtil.equals(actualValue, expectedValue)) { - return { - pass: true, - message: prefix(true) + '.' - }; - } else { - return { - pass: false, - message: - prefix(false) + - ' but it was rejected with ' + - matchersUtil.pp(actualValue) + - '.' - }; - } - } - ); - } - }; - }; -}; - -getJasmineRequireObj().toBeRejectedWithError = function(j$) { - /** - * Expect a promise to be rejected with a value matched to the expected - * @function - * @async - * @name async-matchers#toBeRejectedWithError - * @since 3.5.0 - * @param {Error} [expected] - `Error` constructor the object that was thrown needs to be an instance of. If not provided, `Error` will be used. - * @param {RegExp|String} [message] - The message that should be set on the thrown `Error` - * @example - * await expectAsync(aPromise).toBeRejectedWithError(MyCustomError, 'Error message'); - * await expectAsync(aPromise).toBeRejectedWithError(MyCustomError, /Error message/); - * await expectAsync(aPromise).toBeRejectedWithError(MyCustomError); - * await expectAsync(aPromise).toBeRejectedWithError('Error message'); - * return expectAsync(aPromise).toBeRejectedWithError(/Error message/); - */ - return function toBeRejectedWithError(matchersUtil) { - return { - compare: function(actualPromise, arg1, arg2) { - if (!j$.isPromiseLike(actualPromise)) { - throw new Error( - 'Expected toBeRejectedWithError to be called on a promise.' - ); - } - - var expected = getExpectedFromArgs(arg1, arg2, matchersUtil); - - return actualPromise.then( - function() { - return { - pass: false, - message: 'Expected a promise to be rejected but it was resolved.' - }; - }, - function(actualValue) { - return matchError(actualValue, expected, matchersUtil); - } - ); - } - }; - }; - - function matchError(actual, expected, matchersUtil) { - if (!j$.isError_(actual)) { - return fail(expected, 'rejected with ' + matchersUtil.pp(actual)); - } - - if (!(actual instanceof expected.error)) { - return fail( - expected, - 'rejected with type ' + j$.fnNameFor(actual.constructor) - ); - } - - var actualMessage = actual.message; - - if ( - actualMessage === expected.message || - typeof expected.message === 'undefined' - ) { - return pass(expected); - } - - if ( - expected.message instanceof RegExp && - expected.message.test(actualMessage) - ) { - return pass(expected); - } - - return fail(expected, 'rejected with ' + matchersUtil.pp(actual)); - } - - function pass(expected) { - return { - pass: true, - message: - 'Expected a promise not to be rejected with ' + - expected.printValue + - ', but it was.' - }; - } - - function fail(expected, message) { - return { - pass: false, - message: - 'Expected a promise to be rejected with ' + - expected.printValue + - ' but it was ' + - message + - '.' - }; - } - - function getExpectedFromArgs(arg1, arg2, matchersUtil) { - var error, message; - - if (isErrorConstructor(arg1)) { - error = arg1; - message = arg2; - } else { - error = Error; - message = arg1; - } - - return { - error: error, - message: message, - printValue: - j$.fnNameFor(error) + - (typeof message === 'undefined' ? '' : ': ' + matchersUtil.pp(message)) - }; - } - - function isErrorConstructor(value) { - return ( - typeof value === 'function' && - (value === Error || j$.isError_(value.prototype)) - ); - } -}; - -getJasmineRequireObj().toBeResolved = function(j$) { - /** - * Expect a promise to be resolved. - * @function - * @async - * @name async-matchers#toBeResolved - * @since 3.1.0 - * @example - * await expectAsync(aPromise).toBeResolved(); - * @example - * return expectAsync(aPromise).toBeResolved(); - */ - return function toBeResolved(matchersUtil) { - return { - compare: function(actual) { - if (!j$.isPromiseLike(actual)) { - throw new Error('Expected toBeResolved to be called on a promise.'); - } - - return actual.then( - function() { - return { pass: true }; - }, - function(e) { - return { - pass: false, - message: - 'Expected a promise to be resolved but it was ' + - 'rejected with ' + - matchersUtil.pp(e) + - '.' - }; - } - ); - } - }; - }; -}; - -getJasmineRequireObj().toBeResolvedTo = function(j$) { - /** - * Expect a promise to be resolved to a value equal to the expected, using deep equality comparison. - * @function - * @async - * @name async-matchers#toBeResolvedTo - * @since 3.1.0 - * @param {Object} expected - Value that the promise is expected to resolve to - * @example - * await expectAsync(aPromise).toBeResolvedTo({prop: 'value'}); - * @example - * return expectAsync(aPromise).toBeResolvedTo({prop: 'value'}); - */ - return function toBeResolvedTo(matchersUtil) { - return { - compare: function(actualPromise, expectedValue) { - if (!j$.isPromiseLike(actualPromise)) { - throw new Error('Expected toBeResolvedTo to be called on a promise.'); - } - - function prefix(passed) { - return ( - 'Expected a promise ' + - (passed ? 'not ' : '') + - 'to be resolved to ' + - matchersUtil.pp(expectedValue) - ); - } - - return actualPromise.then( - function(actualValue) { - if (matchersUtil.equals(actualValue, expectedValue)) { - return { - pass: true, - message: prefix(true) + '.' - }; - } else { - return { - pass: false, - message: - prefix(false) + - ' but it was resolved to ' + - matchersUtil.pp(actualValue) + - '.' - }; - } - }, - function(e) { - return { - pass: false, - message: - prefix(false) + - ' but it was rejected with ' + - matchersUtil.pp(e) + - '.' - }; - } - ); - } - }; - }; -}; - -getJasmineRequireObj().DiffBuilder = function(j$) { - return function DiffBuilder(config) { - var prettyPrinter = (config || {}).prettyPrinter || j$.makePrettyPrinter(), - mismatches = new j$.MismatchTree(), - path = new j$.ObjectPath(), - actualRoot = undefined, - expectedRoot = undefined; - - return { - setRoots: function(actual, expected) { - actualRoot = actual; - expectedRoot = expected; - }, - - recordMismatch: function(formatter) { - mismatches.add(path, formatter); - }, - - getMessage: function() { - var messages = []; - - mismatches.traverse(function(path, isLeaf, formatter) { - var actualCustom, - expectedCustom, - useCustom, - derefResult = dereferencePath( - path, - actualRoot, - expectedRoot, - prettyPrinter - ), - actual = derefResult.actual, - expected = derefResult.expected; - - if (formatter) { - messages.push(formatter(actual, expected, path, prettyPrinter)); - return true; - } - - actualCustom = prettyPrinter.customFormat_(actual); - expectedCustom = prettyPrinter.customFormat_(expected); - useCustom = !( - j$.util.isUndefined(actualCustom) && - j$.util.isUndefined(expectedCustom) - ); - - if (useCustom) { - messages.push( - wrapPrettyPrinted(actualCustom, expectedCustom, path) - ); - return false; // don't recurse further - } - - if (isLeaf) { - messages.push( - defaultFormatter(actual, expected, path, prettyPrinter) - ); - } - - return true; - }); - - return messages.join('\n'); - }, - - withPath: function(pathComponent, block) { - var oldPath = path; - path = path.add(pathComponent); - block(); - path = oldPath; - } - }; - - function defaultFormatter(actual, expected, path, prettyPrinter) { - return wrapPrettyPrinted( - prettyPrinter(actual), - prettyPrinter(expected), - path - ); - } - - function wrapPrettyPrinted(actual, expected, path) { - return ( - 'Expected ' + - path + - (path.depth() ? ' = ' : '') + - actual + - ' to equal ' + - expected + - '.' - ); - } - }; - - function dereferencePath(objectPath, actual, expected, pp) { - function handleAsymmetricExpected() { - if ( - j$.isAsymmetricEqualityTester_(expected) && - j$.isFunction_(expected.valuesForDiff_) - ) { - var asymmetricResult = expected.valuesForDiff_(actual, pp); - expected = asymmetricResult.self; - actual = asymmetricResult.other; - } - } - - var i; - handleAsymmetricExpected(); - - for (i = 0; i < objectPath.components.length; i++) { - actual = actual[objectPath.components[i]]; - expected = expected[objectPath.components[i]]; - handleAsymmetricExpected(); - } - - return { actual: actual, expected: expected }; - } -}; - -getJasmineRequireObj().MatchersUtil = function(j$) { - // TODO: convert all uses of j$.pp to use the injected pp - - /** - * @class MatchersUtil - * @classdesc Utilities for use in implementing matchers.
- * _Note:_ Do not construct this directly. Jasmine will construct one and - * pass it to matchers and asymmetric equality testers. - * @hideconstructor - */ - function MatchersUtil(options) { - options = options || {}; - this.customTesters_ = options.customTesters || []; - /** - * Formats a value for use in matcher failure messages and similar contexts, - * taking into account the current set of custom value formatters. - * @function - * @name MatchersUtil#pp - * @since 3.6.0 - * @param {*} value The value to pretty-print - * @return {string} The pretty-printed value - */ - this.pp = options.pp || function() {}; - } - - /** - * Determines whether `haystack` contains `needle`, using the same comparison - * logic as {@link MatchersUtil#equals}. - * @function - * @name MatchersUtil#contains - * @since 2.0.0 - * @param {*} haystack The collection to search - * @param {*} needle The value to search for - * @param [customTesters] An array of custom equality testers - * @returns {boolean} True if `needle` was found in `haystack` - */ - MatchersUtil.prototype.contains = function(haystack, needle, customTesters) { - if (j$.isSet(haystack)) { - return haystack.has(needle); - } - - if ( - Object.prototype.toString.apply(haystack) === '[object Array]' || - (!!haystack && !haystack.indexOf) - ) { - for (var i = 0; i < haystack.length; i++) { - if (this.equals(haystack[i], needle, customTesters)) { - return true; - } - } - return false; - } - - return !!haystack && haystack.indexOf(needle) >= 0; - }; - - MatchersUtil.prototype.buildFailureMessage = function() { - var self = this; - var args = Array.prototype.slice.call(arguments, 0), - matcherName = args[0], - isNot = args[1], - actual = args[2], - expected = args.slice(3), - englishyPredicate = matcherName.replace(/[A-Z]/g, function(s) { - return ' ' + s.toLowerCase(); - }); - - var message = - 'Expected ' + - self.pp(actual) + - (isNot ? ' not ' : ' ') + - englishyPredicate; - - if (expected.length > 0) { - for (var i = 0; i < expected.length; i++) { - if (i > 0) { - message += ','; - } - message += ' ' + self.pp(expected[i]); - } - } - - return message + '.'; - }; - - MatchersUtil.prototype.asymmetricDiff_ = function( - a, - b, - aStack, - bStack, - customTesters, - diffBuilder - ) { - if (j$.isFunction_(b.valuesForDiff_)) { - var values = b.valuesForDiff_(a, this.pp); - this.eq_( - values.other, - values.self, - aStack, - bStack, - customTesters, - diffBuilder - ); - } else { - diffBuilder.recordMismatch(); - } - }; - - MatchersUtil.prototype.asymmetricMatch_ = function( - a, - b, - aStack, - bStack, - customTesters, - diffBuilder - ) { - var asymmetricA = j$.isAsymmetricEqualityTester_(a), - asymmetricB = j$.isAsymmetricEqualityTester_(b), - shim, - result; - - if (asymmetricA === asymmetricB) { - return undefined; - } - - shim = j$.asymmetricEqualityTesterArgCompatShim(this, customTesters); - - if (asymmetricA) { - result = a.asymmetricMatch(b, shim); - if (!result) { - diffBuilder.recordMismatch(); - } - return result; - } - - if (asymmetricB) { - result = b.asymmetricMatch(a, shim); - if (!result) { - this.asymmetricDiff_(a, b, aStack, bStack, customTesters, diffBuilder); - } - return result; - } - }; - - /** - * Determines whether two values are deeply equal to each other. - * @function - * @name MatchersUtil#equals - * @since 2.0.0 - * @param {*} a The first value to compare - * @param {*} b The second value to compare - * @param [customTesters] An array of custom equality testers - * @returns {boolean} True if the values are equal - */ - MatchersUtil.prototype.equals = function( - a, - b, - customTestersOrDiffBuilder, - diffBuilderOrNothing - ) { - var customTesters, diffBuilder; - - if (isDiffBuilder(customTestersOrDiffBuilder)) { - diffBuilder = customTestersOrDiffBuilder; - } else { - customTesters = customTestersOrDiffBuilder; - diffBuilder = diffBuilderOrNothing; - } - - customTesters = customTesters || this.customTesters_; - diffBuilder = diffBuilder || j$.NullDiffBuilder(); - diffBuilder.setRoots(a, b); - - return this.eq_(a, b, [], [], customTesters, diffBuilder); - }; - - // Equality function lovingly adapted from isEqual in - // [Underscore](http://underscorejs.org) - MatchersUtil.prototype.eq_ = function( - a, - b, - aStack, - bStack, - customTesters, - diffBuilder - ) { - var result = true, - self = this, - i; - - var asymmetricResult = this.asymmetricMatch_( - a, - b, - aStack, - bStack, - customTesters, - diffBuilder - ); - if (!j$.util.isUndefined(asymmetricResult)) { - return asymmetricResult; - } - - for (i = 0; i < customTesters.length; i++) { - var customTesterResult = customTesters[i](a, b); - if (!j$.util.isUndefined(customTesterResult)) { - if (!customTesterResult) { - diffBuilder.recordMismatch(); - } - return customTesterResult; - } - } - - if (a instanceof Error && b instanceof Error) { - result = a.message == b.message; - if (!result) { - diffBuilder.recordMismatch(); - } - return result; - } - - // Identical objects are equal. `0 === -0`, but they aren't identical. - // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal). - if (a === b) { - result = a !== 0 || 1 / a == 1 / b; - if (!result) { - diffBuilder.recordMismatch(); - } - return result; - } - // A strict comparison is necessary because `null == undefined`. - if (a === null || b === null) { - result = a === b; - if (!result) { - diffBuilder.recordMismatch(); - } - return result; - } - var className = Object.prototype.toString.call(a); - if (className != Object.prototype.toString.call(b)) { - diffBuilder.recordMismatch(); - return false; - } - switch (className) { - // Strings, numbers, dates, and booleans are compared by value. - case '[object String]': - // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is - // equivalent to `new String("5")`. - result = a == String(b); - if (!result) { - diffBuilder.recordMismatch(); - } - return result; - case '[object Number]': - // `NaN`s are equivalent, but non-reflexive. An `egal` comparison is performed for - // other numeric values. - result = - a != +a ? b != +b : a === 0 && b === 0 ? 1 / a == 1 / b : a == +b; - if (!result) { - diffBuilder.recordMismatch(); - } - return result; - case '[object Date]': - case '[object Boolean]': - // Coerce dates and booleans to numeric primitive values. Dates are compared by their - // millisecond representations. Note that invalid dates with millisecond representations - // of `NaN` are not equivalent. - result = +a == +b; - if (!result) { - diffBuilder.recordMismatch(); - } - return result; - case '[object ArrayBuffer]': - // If we have an instance of ArrayBuffer the Uint8Array ctor - // will be defined as well - return self.eq_( - new Uint8Array(a), // eslint-disable-line compat/compat - new Uint8Array(b), // eslint-disable-line compat/compat - aStack, - bStack, - customTesters, - diffBuilder - ); - // RegExps are compared by their source patterns and flags. - case '[object RegExp]': - return ( - a.source == b.source && - a.global == b.global && - a.multiline == b.multiline && - a.ignoreCase == b.ignoreCase - ); - } - if (typeof a != 'object' || typeof b != 'object') { - diffBuilder.recordMismatch(); - return false; - } - - var aIsDomNode = j$.isDomNode(a); - var bIsDomNode = j$.isDomNode(b); - if (aIsDomNode && bIsDomNode) { - // At first try to use DOM3 method isEqualNode - result = a.isEqualNode(b); - if (!result) { - diffBuilder.recordMismatch(); - } - return result; - } - if (aIsDomNode || bIsDomNode) { - diffBuilder.recordMismatch(); - return false; - } - - var aIsPromise = j$.isPromise(a); - var bIsPromise = j$.isPromise(b); - if (aIsPromise && bIsPromise) { - return a === b; - } - - // Assume equality for cyclic structures. The algorithm for detecting cyclic - // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`. - var length = aStack.length; - while (length--) { - // Linear search. Performance is inversely proportional to the number of - // unique nested structures. - if (aStack[length] == a) { - return bStack[length] == b; - } - } - // Add the first object to the stack of traversed objects. - aStack.push(a); - bStack.push(b); - var size = 0; - // Recursively compare objects and arrays. - // Compare array lengths to determine if a deep comparison is necessary. - if (className == '[object Array]') { - var aLength = a.length; - var bLength = b.length; - - diffBuilder.withPath('length', function() { - if (aLength !== bLength) { - diffBuilder.recordMismatch(); - result = false; - } - }); - - for (i = 0; i < aLength || i < bLength; i++) { - diffBuilder.withPath(i, function() { - if (i >= bLength) { - diffBuilder.recordMismatch( - actualArrayIsLongerFormatter.bind(null, self.pp) - ); - result = false; - } else { - result = - self.eq_( - i < aLength ? a[i] : void 0, - i < bLength ? b[i] : void 0, - aStack, - bStack, - customTesters, - diffBuilder - ) && result; - } - }); - } - if (!result) { - return false; - } - } else if (j$.isMap(a) && j$.isMap(b)) { - if (a.size != b.size) { - diffBuilder.recordMismatch(); - return false; - } - - var keysA = []; - var keysB = []; - a.forEach(function(valueA, keyA) { - keysA.push(keyA); - }); - b.forEach(function(valueB, keyB) { - keysB.push(keyB); - }); - - // For both sets of keys, check they map to equal values in both maps. - // Keep track of corresponding keys (in insertion order) in order to handle asymmetric obj keys. - var mapKeys = [keysA, keysB]; - var cmpKeys = [keysB, keysA]; - var mapIter, mapKey, mapValueA, mapValueB; - var cmpIter, cmpKey; - for (i = 0; result && i < mapKeys.length; i++) { - mapIter = mapKeys[i]; - cmpIter = cmpKeys[i]; - - for (var j = 0; result && j < mapIter.length; j++) { - mapKey = mapIter[j]; - cmpKey = cmpIter[j]; - mapValueA = a.get(mapKey); - - // Only use the cmpKey when one of the keys is asymmetric and the corresponding key matches, - // otherwise explicitly look up the mapKey in the other Map since we want keys with unique - // obj identity (that are otherwise equal) to not match. - if ( - j$.isAsymmetricEqualityTester_(mapKey) || - (j$.isAsymmetricEqualityTester_(cmpKey) && - this.eq_( - mapKey, - cmpKey, - aStack, - bStack, - customTesters, - j$.NullDiffBuilder() - )) - ) { - mapValueB = b.get(cmpKey); - } else { - mapValueB = b.get(mapKey); - } - result = this.eq_( - mapValueA, - mapValueB, - aStack, - bStack, - customTesters, - j$.NullDiffBuilder() - ); - } - } - - if (!result) { - diffBuilder.recordMismatch(); - return false; - } - } else if (j$.isSet(a) && j$.isSet(b)) { - if (a.size != b.size) { - diffBuilder.recordMismatch(); - return false; - } - - var valuesA = []; - a.forEach(function(valueA) { - valuesA.push(valueA); - }); - var valuesB = []; - b.forEach(function(valueB) { - valuesB.push(valueB); - }); - - // For both sets, check they are all contained in the other set - var setPairs = [[valuesA, valuesB], [valuesB, valuesA]]; - var stackPairs = [[aStack, bStack], [bStack, aStack]]; - var baseValues, baseValue, baseStack; - var otherValues, otherValue, otherStack; - var found; - var prevStackSize; - for (i = 0; result && i < setPairs.length; i++) { - baseValues = setPairs[i][0]; - otherValues = setPairs[i][1]; - baseStack = stackPairs[i][0]; - otherStack = stackPairs[i][1]; - // For each value in the base set... - for (var k = 0; result && k < baseValues.length; k++) { - baseValue = baseValues[k]; - found = false; - // ... test that it is present in the other set - for (var l = 0; !found && l < otherValues.length; l++) { - otherValue = otherValues[l]; - prevStackSize = baseStack.length; - // compare by value equality - found = this.eq_( - baseValue, - otherValue, - baseStack, - otherStack, - customTesters, - j$.NullDiffBuilder() - ); - if (!found && prevStackSize !== baseStack.length) { - baseStack.splice(prevStackSize); - otherStack.splice(prevStackSize); - } - } - result = result && found; - } - } - - if (!result) { - diffBuilder.recordMismatch(); - return false; - } - } else if (j$.isURL(a) && j$.isURL(b)) { - // URLs have no enumrable properties, so the default object comparison - // would consider any two URLs to be equal. - return a.toString() === b.toString(); - } else { - // Objects with different constructors are not equivalent, but `Object`s - // or `Array`s from different frames are. - var aCtor = a.constructor, - bCtor = b.constructor; - if ( - aCtor !== bCtor && - isFunction(aCtor) && - isFunction(bCtor) && - a instanceof aCtor && - b instanceof bCtor && - !(aCtor instanceof aCtor && bCtor instanceof bCtor) - ) { - diffBuilder.recordMismatch( - constructorsAreDifferentFormatter.bind(null, this.pp) - ); - return false; - } - } - - // Deep compare objects. - var aKeys = keys(a, className == '[object Array]'), - key; - size = aKeys.length; - - // Ensure that both objects contain the same number of properties before comparing deep equality. - if (keys(b, className == '[object Array]').length !== size) { - diffBuilder.recordMismatch( - objectKeysAreDifferentFormatter.bind(null, this.pp) - ); - return false; - } - - for (i = 0; i < size; i++) { - key = aKeys[i]; - // Deep compare each member - if (!j$.util.has(b, key)) { - diffBuilder.recordMismatch( - objectKeysAreDifferentFormatter.bind(null, this.pp) - ); - result = false; - continue; - } - - diffBuilder.withPath(key, function() { - if ( - !self.eq_(a[key], b[key], aStack, bStack, customTesters, diffBuilder) - ) { - result = false; - } - }); - } - - if (!result) { - return false; - } - - // Remove the first object from the stack of traversed objects. - aStack.pop(); - bStack.pop(); - - return result; - }; - - function keys(obj, isArray) { - var allKeys = Object.keys - ? Object.keys(obj) - : (function(o) { - var keys = []; - for (var key in o) { - if (j$.util.has(o, key)) { - keys.push(key); - } - } - return keys; - })(obj); - - if (!isArray) { - return allKeys; - } - - if (allKeys.length === 0) { - return allKeys; - } - - var extraKeys = []; - for (var i = 0; i < allKeys.length; i++) { - if (!/^[0-9]+$/.test(allKeys[i])) { - extraKeys.push(allKeys[i]); - } - } - - return extraKeys; - } - - function isFunction(obj) { - return typeof obj === 'function'; - } - - function objectKeysAreDifferentFormatter(pp, actual, expected, path) { - var missingProperties = j$.util.objectDifference(expected, actual), - extraProperties = j$.util.objectDifference(actual, expected), - missingPropertiesMessage = formatKeyValuePairs(pp, missingProperties), - extraPropertiesMessage = formatKeyValuePairs(pp, extraProperties), - messages = []; - - if (!path.depth()) { - path = 'object'; - } - - if (missingPropertiesMessage.length) { - messages.push( - 'Expected ' + path + ' to have properties' + missingPropertiesMessage - ); - } - - if (extraPropertiesMessage.length) { - messages.push( - 'Expected ' + path + ' not to have properties' + extraPropertiesMessage - ); - } - - return messages.join('\n'); - } - - function constructorsAreDifferentFormatter(pp, actual, expected, path) { - if (!path.depth()) { - path = 'object'; - } - - return ( - 'Expected ' + - path + - ' to be a kind of ' + - j$.fnNameFor(expected.constructor) + - ', but was ' + - pp(actual) + - '.' - ); - } - - function actualArrayIsLongerFormatter(pp, actual, expected, path) { - return ( - 'Unexpected ' + - path + - (path.depth() ? ' = ' : '') + - pp(actual) + - ' in array.' - ); - } - - function formatKeyValuePairs(pp, obj) { - var formatted = ''; - for (var key in obj) { - formatted += '\n ' + key + ': ' + pp(obj[key]); - } - return formatted; - } - - function isDiffBuilder(obj) { - return obj && typeof obj.recordMismatch === 'function'; - } - - return MatchersUtil; -}; - -/** - * @interface AsymmetricEqualityTester - * @classdesc An asymmetric equality tester is an object that can match multiple - * objects. Examples include jasmine.any() and jasmine.stringMatching(). - * User-defined asymmetric equality testers can also be defined and used in - * expectations. - * @see custom_asymmetric_equality_testers - * @since 2.0.0 - */ -/** - * Determines whether a value matches this tester - * @function - * @name AsymmetricEqualityTester#asymmetricMatch - * @param value {any} The value to test - * @param matchersUtil {MatchersUtil} utilities for testing equality, etc - * @return {Boolean} - */ -/** - * Returns a string representation of this tester to use in matcher failure messages - * @function - * @name AsymmetricEqualityTester#jasmineToString - * @param pp {function} Function that takes a value and returns a pretty-printed representation - * @return {String} - */ - -getJasmineRequireObj().MismatchTree = function(j$) { - /* - To be able to apply custom object formatters at all possible levels of an - object graph, DiffBuilder needs to be able to know not just where the - mismatch occurred but also all ancestors of the mismatched value in both - the expected and actual object graphs. MismatchTree maintains that context - and provides it via the traverse method. - */ - function MismatchTree(path) { - this.path = path || new j$.ObjectPath([]); - this.formatter = undefined; - this.children = []; - this.isMismatch = false; - } - - MismatchTree.prototype.add = function(path, formatter) { - var key, child; - - if (path.depth() === 0) { - this.formatter = formatter; - this.isMismatch = true; - } else { - key = path.components[0]; - path = path.shift(); - child = this.child(key); - - if (!child) { - child = new MismatchTree(this.path.add(key)); - this.children.push(child); - } - - child.add(path, formatter); - } - }; - - MismatchTree.prototype.traverse = function(visit) { - var i, - hasChildren = this.children.length > 0; - - if (this.isMismatch || hasChildren) { - if (visit(this.path, !hasChildren, this.formatter)) { - for (i = 0; i < this.children.length; i++) { - this.children[i].traverse(visit); - } - } - } - }; - - MismatchTree.prototype.child = function(key) { - var i, pathEls; - - for (i = 0; i < this.children.length; i++) { - pathEls = this.children[i].path.components; - if (pathEls[pathEls.length - 1] === key) { - return this.children[i]; - } - } - }; - - return MismatchTree; -}; - -getJasmineRequireObj().nothing = function() { - /** - * {@link expect} nothing explicitly. - * @function - * @name matchers#nothing - * @since 2.8.0 - * @example - * expect().nothing(); - */ - function nothing() { - return { - compare: function() { - return { - pass: true - }; - } - }; - } - - return nothing; -}; - -getJasmineRequireObj().NullDiffBuilder = function(j$) { - return function() { - return { - withPath: function(_, block) { - block(); - }, - setRoots: function() {}, - recordMismatch: function() {} - }; - }; -}; - -getJasmineRequireObj().ObjectPath = function(j$) { - function ObjectPath(components) { - this.components = components || []; - } - - ObjectPath.prototype.toString = function() { - if (this.components.length) { - return '$' + map(this.components, formatPropertyAccess).join(''); - } else { - return ''; - } - }; - - ObjectPath.prototype.add = function(component) { - return new ObjectPath(this.components.concat([component])); - }; - - ObjectPath.prototype.shift = function() { - return new ObjectPath(this.components.slice(1)); - }; - - ObjectPath.prototype.depth = function() { - return this.components.length; - }; - - function formatPropertyAccess(prop) { - if (typeof prop === 'number') { - return '[' + prop + ']'; - } - - if (isValidIdentifier(prop)) { - return '.' + prop; - } - - return "['" + prop + "']"; - } - - function map(array, fn) { - var results = []; - for (var i = 0; i < array.length; i++) { - results.push(fn(array[i])); - } - return results; - } - - function isValidIdentifier(string) { - return /^[A-Za-z\$_][A-Za-z0-9\$_]*$/.test(string); - } - - return ObjectPath; -}; - -getJasmineRequireObj().requireAsyncMatchers = function(jRequire, j$) { - var availableMatchers = [ - 'toBePending', - 'toBeResolved', - 'toBeRejected', - 'toBeResolvedTo', - 'toBeRejectedWith', - 'toBeRejectedWithError' - ], - matchers = {}; - - for (var i = 0; i < availableMatchers.length; i++) { - var name = availableMatchers[i]; - matchers[name] = jRequire[name](j$); - } - - return matchers; -}; - -getJasmineRequireObj().toBe = function(j$) { - /** - * {@link expect} the actual value to be `===` to the expected value. - * @function - * @name matchers#toBe - * @since 1.3.0 - * @param {Object} expected - The expected value to compare against. - * @example - * expect(thing).toBe(realThing); - */ - function toBe(matchersUtil) { - var tip = - ' Tip: To check for deep equality, use .toEqual() instead of .toBe().'; - - return { - compare: function(actual, expected) { - var result = { - pass: actual === expected - }; - - if (typeof expected === 'object') { - result.message = - matchersUtil.buildFailureMessage( - 'toBe', - result.pass, - actual, - expected - ) + tip; - } - - return result; - } - }; - } - - return toBe; -}; - -getJasmineRequireObj().toBeCloseTo = function() { - /** - * {@link expect} the actual value to be within a specified precision of the expected value. - * @function - * @name matchers#toBeCloseTo - * @since 1.3.0 - * @param {Object} expected - The expected value to compare against. - * @param {Number} [precision=2] - The number of decimal points to check. - * @example - * expect(number).toBeCloseTo(42.2, 3); - */ - function toBeCloseTo() { - return { - compare: function(actual, expected, precision) { - if (precision !== 0) { - precision = precision || 2; - } - - if (expected === null || actual === null) { - throw new Error( - 'Cannot use toBeCloseTo with null. Arguments evaluated to: ' + - 'expect(' + - actual + - ').toBeCloseTo(' + - expected + - ').' - ); - } - - var pow = Math.pow(10, precision + 1); - var delta = Math.abs(expected - actual); - var maxDelta = Math.pow(10, -precision) / 2; - - return { - pass: Math.round(delta * pow) <= maxDelta * pow - }; - } - }; - } - - return toBeCloseTo; -}; - -getJasmineRequireObj().toBeDefined = function() { - /** - * {@link expect} the actual value to be defined. (Not `undefined`) - * @function - * @name matchers#toBeDefined - * @since 1.3.0 - * @example - * expect(result).toBeDefined(); - */ - function toBeDefined() { - return { - compare: function(actual) { - return { - pass: void 0 !== actual - }; - } - }; - } - - return toBeDefined; -}; - -getJasmineRequireObj().toBeFalse = function() { - /** - * {@link expect} the actual value to be `false`. - * @function - * @name matchers#toBeFalse - * @since 3.5.0 - * @example - * expect(result).toBeFalse(); - */ - function toBeFalse() { - return { - compare: function(actual) { - return { - pass: actual === false - }; - } - }; - } - - return toBeFalse; -}; - -getJasmineRequireObj().toBeFalsy = function() { - /** - * {@link expect} the actual value to be falsy - * @function - * @name matchers#toBeFalsy - * @since 2.0.0 - * @example - * expect(result).toBeFalsy(); - */ - function toBeFalsy() { - return { - compare: function(actual) { - return { - pass: !actual - }; - } - }; - } - - return toBeFalsy; -}; - -getJasmineRequireObj().toBeGreaterThan = function() { - /** - * {@link expect} the actual value to be greater than the expected value. - * @function - * @name matchers#toBeGreaterThan - * @since 2.0.0 - * @param {Number} expected - The value to compare against. - * @example - * expect(result).toBeGreaterThan(3); - */ - function toBeGreaterThan() { - return { - compare: function(actual, expected) { - return { - pass: actual > expected - }; - } - }; - } - - return toBeGreaterThan; -}; - -getJasmineRequireObj().toBeGreaterThanOrEqual = function() { - /** - * {@link expect} the actual value to be greater than or equal to the expected value. - * @function - * @name matchers#toBeGreaterThanOrEqual - * @since 2.0.0 - * @param {Number} expected - The expected value to compare against. - * @example - * expect(result).toBeGreaterThanOrEqual(25); - */ - function toBeGreaterThanOrEqual() { - return { - compare: function(actual, expected) { - return { - pass: actual >= expected - }; - } - }; - } - - return toBeGreaterThanOrEqual; -}; - -getJasmineRequireObj().toBeInstanceOf = function(j$) { - var usageError = j$.formatErrorMsg( - '', - 'expect(value).toBeInstanceOf()' - ); - - /** - * {@link expect} the actual to be an instance of the expected class - * @function - * @name matchers#toBeInstanceOf - * @since 3.5.0 - * @param {Object} expected - The class or constructor function to check for - * @example - * expect('foo').toBeInstanceOf(String); - * expect(3).toBeInstanceOf(Number); - * expect(new Error()).toBeInstanceOf(Error); - */ - function toBeInstanceOf(matchersUtil) { - return { - compare: function(actual, expected) { - var actualType = - actual && actual.constructor - ? j$.fnNameFor(actual.constructor) - : matchersUtil.pp(actual), - expectedType = expected - ? j$.fnNameFor(expected) - : matchersUtil.pp(expected), - expectedMatcher, - pass; - - try { - expectedMatcher = new j$.Any(expected); - pass = expectedMatcher.asymmetricMatch(actual); - } catch (error) { - throw new Error( - usageError('Expected value is not a constructor function') - ); - } - - if (pass) { - return { - pass: true, - message: - 'Expected instance of ' + - actualType + - ' not to be an instance of ' + - expectedType - }; - } else { - return { - pass: false, - message: - 'Expected instance of ' + - actualType + - ' to be an instance of ' + - expectedType - }; - } - } - }; - } - - return toBeInstanceOf; -}; - -getJasmineRequireObj().toBeLessThan = function() { - /** - * {@link expect} the actual value to be less than the expected value. - * @function - * @name matchers#toBeLessThan - * @since 2.0.0 - * @param {Number} expected - The expected value to compare against. - * @example - * expect(result).toBeLessThan(0); - */ - function toBeLessThan() { - return { - compare: function(actual, expected) { - return { - pass: actual < expected - }; - } - }; - } - - return toBeLessThan; -}; - -getJasmineRequireObj().toBeLessThanOrEqual = function() { - /** - * {@link expect} the actual value to be less than or equal to the expected value. - * @function - * @name matchers#toBeLessThanOrEqual - * @since 2.0.0 - * @param {Number} expected - The expected value to compare against. - * @example - * expect(result).toBeLessThanOrEqual(123); - */ - function toBeLessThanOrEqual() { - return { - compare: function(actual, expected) { - return { - pass: actual <= expected - }; - } - }; - } - - return toBeLessThanOrEqual; -}; - -getJasmineRequireObj().toBeNaN = function(j$) { - /** - * {@link expect} the actual value to be `NaN` (Not a Number). - * @function - * @name matchers#toBeNaN - * @since 1.3.0 - * @example - * expect(thing).toBeNaN(); - */ - function toBeNaN(matchersUtil) { - return { - compare: function(actual) { - var result = { - pass: actual !== actual - }; - - if (result.pass) { - result.message = 'Expected actual not to be NaN.'; - } else { - result.message = function() { - return 'Expected ' + matchersUtil.pp(actual) + ' to be NaN.'; - }; - } - - return result; - } - }; - } - - return toBeNaN; -}; - -getJasmineRequireObj().toBeNegativeInfinity = function(j$) { - /** - * {@link expect} the actual value to be `-Infinity` (-infinity). - * @function - * @name matchers#toBeNegativeInfinity - * @since 2.6.0 - * @example - * expect(thing).toBeNegativeInfinity(); - */ - function toBeNegativeInfinity(matchersUtil) { - return { - compare: function(actual) { - var result = { - pass: actual === Number.NEGATIVE_INFINITY - }; - - if (result.pass) { - result.message = 'Expected actual not to be -Infinity.'; - } else { - result.message = function() { - return 'Expected ' + matchersUtil.pp(actual) + ' to be -Infinity.'; - }; - } - - return result; - } - }; - } - - return toBeNegativeInfinity; -}; - -getJasmineRequireObj().toBeNull = function() { - /** - * {@link expect} the actual value to be `null`. - * @function - * @name matchers#toBeNull - * @since 1.3.0 - * @example - * expect(result).toBeNull(); - */ - function toBeNull() { - return { - compare: function(actual) { - return { - pass: actual === null - }; - } - }; - } - - return toBeNull; -}; - -getJasmineRequireObj().toBePositiveInfinity = function(j$) { - /** - * {@link expect} the actual value to be `Infinity` (infinity). - * @function - * @name matchers#toBePositiveInfinity - * @since 2.6.0 - * @example - * expect(thing).toBePositiveInfinity(); - */ - function toBePositiveInfinity(matchersUtil) { - return { - compare: function(actual) { - var result = { - pass: actual === Number.POSITIVE_INFINITY - }; - - if (result.pass) { - result.message = 'Expected actual not to be Infinity.'; - } else { - result.message = function() { - return 'Expected ' + matchersUtil.pp(actual) + ' to be Infinity.'; - }; - } - - return result; - } - }; - } - - return toBePositiveInfinity; -}; - -getJasmineRequireObj().toBeTrue = function() { - /** - * {@link expect} the actual value to be `true`. - * @function - * @name matchers#toBeTrue - * @since 3.5.0 - * @example - * expect(result).toBeTrue(); - */ - function toBeTrue() { - return { - compare: function(actual) { - return { - pass: actual === true - }; - } - }; - } - - return toBeTrue; -}; - -getJasmineRequireObj().toBeTruthy = function() { - /** - * {@link expect} the actual value to be truthy. - * @function - * @name matchers#toBeTruthy - * @since 2.0.0 - * @example - * expect(thing).toBeTruthy(); - */ - function toBeTruthy() { - return { - compare: function(actual) { - return { - pass: !!actual - }; - } - }; - } - - return toBeTruthy; -}; - -getJasmineRequireObj().toBeUndefined = function() { - /** - * {@link expect} the actual value to be `undefined`. - * @function - * @name matchers#toBeUndefined - * @since 1.3.0 - * @example - * expect(result).toBeUndefined(): - */ - function toBeUndefined() { - return { - compare: function(actual) { - return { - pass: void 0 === actual - }; - } - }; - } - - return toBeUndefined; -}; - -getJasmineRequireObj().toContain = function() { - /** - * {@link expect} the actual value to contain a specific value. - * @function - * @name matchers#toContain - * @since 2.0.0 - * @param {Object} expected - The value to look for. - * @example - * expect(array).toContain(anElement); - * expect(string).toContain(substring); - */ - function toContain(matchersUtil) { - return { - compare: function(actual, expected) { - return { - pass: matchersUtil.contains(actual, expected) - }; - } - }; - } - - return toContain; -}; - -getJasmineRequireObj().toEqual = function(j$) { - /** - * {@link expect} the actual value to be equal to the expected, using deep equality comparison. - * @function - * @name matchers#toEqual - * @since 1.3.0 - * @param {Object} expected - Expected value - * @example - * expect(bigObject).toEqual({"foo": ['bar', 'baz']}); - */ - function toEqual(matchersUtil) { - return { - compare: function(actual, expected) { - var result = { - pass: false - }, - diffBuilder = j$.DiffBuilder({ prettyPrinter: matchersUtil.pp }); - - result.pass = matchersUtil.equals(actual, expected, diffBuilder); - - // TODO: only set error message if test fails - result.message = diffBuilder.getMessage(); - - return result; - } - }; - } - - return toEqual; -}; - -getJasmineRequireObj().toHaveBeenCalled = function(j$) { - var getErrorMsg = j$.formatErrorMsg( - '', - 'expect().toHaveBeenCalled()' - ); - - /** - * {@link expect} the actual (a {@link Spy}) to have been called. - * @function - * @name matchers#toHaveBeenCalled - * @since 1.3.0 - * @example - * expect(mySpy).toHaveBeenCalled(); - * expect(mySpy).not.toHaveBeenCalled(); - */ - function toHaveBeenCalled(matchersUtil) { - return { - compare: function(actual) { - var result = {}; - - if (!j$.isSpy(actual)) { - throw new Error( - getErrorMsg( - 'Expected a spy, but got ' + matchersUtil.pp(actual) + '.' - ) - ); - } - - if (arguments.length > 1) { - throw new Error( - getErrorMsg('Does not take arguments, use toHaveBeenCalledWith') - ); - } - - result.pass = actual.calls.any(); - - result.message = result.pass - ? 'Expected spy ' + actual.and.identity + ' not to have been called.' - : 'Expected spy ' + actual.and.identity + ' to have been called.'; - - return result; - } - }; - } - - return toHaveBeenCalled; -}; - -getJasmineRequireObj().toHaveBeenCalledBefore = function(j$) { - var getErrorMsg = j$.formatErrorMsg( - '', - 'expect().toHaveBeenCalledBefore()' - ); - - /** - * {@link expect} the actual value (a {@link Spy}) to have been called before another {@link Spy}. - * @function - * @name matchers#toHaveBeenCalledBefore - * @since 2.6.0 - * @param {Spy} expected - {@link Spy} that should have been called after the `actual` {@link Spy}. - * @example - * expect(mySpy).toHaveBeenCalledBefore(otherSpy); - */ - function toHaveBeenCalledBefore(matchersUtil) { - return { - compare: function(firstSpy, latterSpy) { - if (!j$.isSpy(firstSpy)) { - throw new Error( - getErrorMsg( - 'Expected a spy, but got ' + matchersUtil.pp(firstSpy) + '.' - ) - ); - } - if (!j$.isSpy(latterSpy)) { - throw new Error( - getErrorMsg( - 'Expected a spy, but got ' + matchersUtil.pp(latterSpy) + '.' - ) - ); - } - - var result = { pass: false }; - - if (!firstSpy.calls.count()) { - result.message = - 'Expected spy ' + firstSpy.and.identity + ' to have been called.'; - return result; - } - if (!latterSpy.calls.count()) { - result.message = - 'Expected spy ' + latterSpy.and.identity + ' to have been called.'; - return result; - } - - var latest1stSpyCall = firstSpy.calls.mostRecent().invocationOrder; - var first2ndSpyCall = latterSpy.calls.first().invocationOrder; - - result.pass = latest1stSpyCall < first2ndSpyCall; - - if (result.pass) { - result.message = - 'Expected spy ' + - firstSpy.and.identity + - ' to not have been called before spy ' + - latterSpy.and.identity + - ', but it was'; - } else { - var first1stSpyCall = firstSpy.calls.first().invocationOrder; - var latest2ndSpyCall = latterSpy.calls.mostRecent().invocationOrder; - - if (first1stSpyCall < first2ndSpyCall) { - result.message = - 'Expected latest call to spy ' + - firstSpy.and.identity + - ' to have been called before first call to spy ' + - latterSpy.and.identity + - ' (no interleaved calls)'; - } else if (latest2ndSpyCall > latest1stSpyCall) { - result.message = - 'Expected first call to spy ' + - latterSpy.and.identity + - ' to have been called after latest call to spy ' + - firstSpy.and.identity + - ' (no interleaved calls)'; - } else { - result.message = - 'Expected spy ' + - firstSpy.and.identity + - ' to have been called before spy ' + - latterSpy.and.identity; - } - } - - return result; - } - }; - } - - return toHaveBeenCalledBefore; -}; - -getJasmineRequireObj().toHaveBeenCalledOnceWith = function(j$) { - var getErrorMsg = j$.formatErrorMsg( - '', - 'expect().toHaveBeenCalledOnceWith(...arguments)' - ); - - /** - * {@link expect} the actual (a {@link Spy}) to have been called exactly once, and exactly with the particular arguments. - * @function - * @name matchers#toHaveBeenCalledOnceWith - * @since 3.6.0 - * @param {...Object} - The arguments to look for - * @example - * expect(mySpy).toHaveBeenCalledOnceWith('foo', 'bar', 2); - */ - function toHaveBeenCalledOnceWith(util) { - return { - compare: function() { - var args = Array.prototype.slice.call(arguments, 0), - actual = args[0], - expectedArgs = args.slice(1); - - if (!j$.isSpy(actual)) { - throw new Error( - getErrorMsg('Expected a spy, but got ' + util.pp(actual) + '.') - ); - } - - var prettyPrintedCalls = actual.calls - .allArgs() - .map(function(argsForCall) { - return ' ' + util.pp(argsForCall); - }); - - if ( - actual.calls.count() === 1 && - util.contains(actual.calls.allArgs(), expectedArgs) - ) { - return { - pass: true, - message: - 'Expected spy ' + - actual.and.identity + - ' to have been called 0 times, multiple times, or once, but with arguments different from:\n' + - ' ' + - util.pp(expectedArgs) + - '\n' + - 'But the actual call was:\n' + - prettyPrintedCalls.join(',\n') + - '.\n\n' - }; - } - - function getDiffs() { - return actual.calls.allArgs().map(function(argsForCall, callIx) { - var diffBuilder = new j$.DiffBuilder(); - util.equals(argsForCall, expectedArgs, diffBuilder); - return diffBuilder.getMessage(); - }); - } - - function butString() { - switch (actual.calls.count()) { - case 0: - return 'But it was never called.\n\n'; - case 1: - return ( - 'But the actual call was:\n' + - prettyPrintedCalls.join(',\n') + - '.\n' + - getDiffs().join('\n') + - '\n\n' - ); - default: - return ( - 'But the actual calls were:\n' + - prettyPrintedCalls.join(',\n') + - '.\n\n' - ); - } - } - - return { - pass: false, - message: - 'Expected spy ' + - actual.and.identity + - ' to have been called only once, and with given args:\n' + - ' ' + - util.pp(expectedArgs) + - '\n' + - butString() - }; - } - }; - } - - return toHaveBeenCalledOnceWith; -}; - -getJasmineRequireObj().toHaveBeenCalledTimes = function(j$) { - var getErrorMsg = j$.formatErrorMsg( - '', - 'expect().toHaveBeenCalledTimes()' - ); - - /** - * {@link expect} the actual (a {@link Spy}) to have been called the specified number of times. - * @function - * @name matchers#toHaveBeenCalledTimes - * @since 2.4.0 - * @param {Number} expected - The number of invocations to look for. - * @example - * expect(mySpy).toHaveBeenCalledTimes(3); - */ - function toHaveBeenCalledTimes(matchersUtil) { - return { - compare: function(actual, expected) { - if (!j$.isSpy(actual)) { - throw new Error( - getErrorMsg( - 'Expected a spy, but got ' + matchersUtil.pp(actual) + '.' - ) - ); - } - - var args = Array.prototype.slice.call(arguments, 0), - result = { pass: false }; - - if (!j$.isNumber_(expected)) { - throw new Error( - getErrorMsg( - 'The expected times failed is a required argument and must be a number.' - ) - ); - } - - actual = args[0]; - var calls = actual.calls.count(); - var timesMessage = expected === 1 ? 'once' : expected + ' times'; - result.pass = calls === expected; - result.message = result.pass - ? 'Expected spy ' + - actual.and.identity + - ' not to have been called ' + - timesMessage + - '. It was called ' + - calls + - ' times.' - : 'Expected spy ' + - actual.and.identity + - ' to have been called ' + - timesMessage + - '. It was called ' + - calls + - ' times.'; - return result; - } - }; - } - - return toHaveBeenCalledTimes; -}; - -getJasmineRequireObj().toHaveBeenCalledWith = function(j$) { - var getErrorMsg = j$.formatErrorMsg( - '', - 'expect().toHaveBeenCalledWith(...arguments)' - ); - - /** - * {@link expect} the actual (a {@link Spy}) to have been called with particular arguments at least once. - * @function - * @name matchers#toHaveBeenCalledWith - * @since 1.3.0 - * @param {...Object} - The arguments to look for - * @example - * expect(mySpy).toHaveBeenCalledWith('foo', 'bar', 2); - */ - function toHaveBeenCalledWith(matchersUtil) { - return { - compare: function() { - var args = Array.prototype.slice.call(arguments, 0), - actual = args[0], - expectedArgs = args.slice(1), - result = { pass: false }; - - if (!j$.isSpy(actual)) { - throw new Error( - getErrorMsg( - 'Expected a spy, but got ' + matchersUtil.pp(actual) + '.' - ) - ); - } - - if (!actual.calls.any()) { - result.message = function() { - return ( - 'Expected spy ' + - actual.and.identity + - ' to have been called with:\n' + - ' ' + - matchersUtil.pp(expectedArgs) + - '\nbut it was never called.' - ); - }; - return result; - } - - if (matchersUtil.contains(actual.calls.allArgs(), expectedArgs)) { - result.pass = true; - result.message = function() { - return ( - 'Expected spy ' + - actual.and.identity + - ' not to have been called with:\n' + - ' ' + - matchersUtil.pp(expectedArgs) + - '\nbut it was.' - ); - }; - } else { - result.message = function() { - var prettyPrintedCalls = actual.calls - .allArgs() - .map(function(argsForCall) { - return ' ' + matchersUtil.pp(argsForCall); - }); - - var diffs = actual.calls - .allArgs() - .map(function(argsForCall, callIx) { - var diffBuilder = new j$.DiffBuilder(); - matchersUtil.equals(argsForCall, expectedArgs, diffBuilder); - return ( - 'Call ' + - callIx + - ':\n' + - diffBuilder.getMessage().replace(/^/gm, ' ') - ); - }); - - return ( - 'Expected spy ' + - actual.and.identity + - ' to have been called with:\n' + - ' ' + - matchersUtil.pp(expectedArgs) + - '\n' + - '' + - 'but actual calls were:\n' + - prettyPrintedCalls.join(',\n') + - '.\n\n' + - diffs.join('\n') - ); - }; - } - - return result; - } - }; - } - - return toHaveBeenCalledWith; -}; - -getJasmineRequireObj().toHaveClass = function(j$) { - /** - * {@link expect} the actual value to be a DOM element that has the expected class - * @function - * @name matchers#toHaveClass - * @since 3.0.0 - * @param {Object} expected - The class name to test for - * @example - * var el = document.createElement('div'); - * el.className = 'foo bar baz'; - * expect(el).toHaveClass('bar'); - */ - function toHaveClass(matchersUtil) { - return { - compare: function(actual, expected) { - if (!isElement(actual)) { - throw new Error(matchersUtil.pp(actual) + ' is not a DOM element'); - } - - return { - pass: actual.classList.contains(expected) - }; - } - }; - } - - function isElement(maybeEl) { - return ( - maybeEl && maybeEl.classList && j$.isFunction_(maybeEl.classList.contains) - ); - } - - return toHaveClass; -}; - -getJasmineRequireObj().toHaveSize = function(j$) { - /** - * {@link expect} the actual size to be equal to the expected, using array-like length or object keys size. - * @function - * @name matchers#toHaveSize - * @since 3.6.0 - * @param {Object} expected - Expected size - * @example - * array = [1,2]; - * expect(array).toHaveSize(2); - */ - function toHaveSize() { - return { - compare: function(actual, expected) { - var result = { - pass: false - }; - - if ( - j$.isA_('WeakSet', actual) || - j$.isWeakMap(actual) || - j$.isDataView(actual) - ) { - throw new Error('Cannot get size of ' + actual + '.'); - } - - if (j$.isSet(actual) || j$.isMap(actual)) { - result.pass = actual.size === expected; - } else if (isLength(actual.length)) { - result.pass = actual.length === expected; - } else { - result.pass = Object.keys(actual).length === expected; - } - - return result; - } - }; - } - - var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991; // eslint-disable-line compat/compat - function isLength(value) { - return ( - typeof value == 'number' && - value > -1 && - value % 1 === 0 && - value <= MAX_SAFE_INTEGER - ); - } - - return toHaveSize; -}; - -getJasmineRequireObj().toMatch = function(j$) { - var getErrorMsg = j$.formatErrorMsg( - '', - 'expect().toMatch( || )' - ); - - /** - * {@link expect} the actual value to match a regular expression - * @function - * @name matchers#toMatch - * @since 1.3.0 - * @param {RegExp|String} expected - Value to look for in the string. - * @example - * expect("my string").toMatch(/string$/); - * expect("other string").toMatch("her"); - */ - function toMatch() { - return { - compare: function(actual, expected) { - if (!j$.isString_(expected) && !j$.isA_('RegExp', expected)) { - throw new Error(getErrorMsg('Expected is not a String or a RegExp')); - } - - var regexp = new RegExp(expected); - - return { - pass: regexp.test(actual) - }; - } - }; - } - - return toMatch; -}; - -getJasmineRequireObj().toThrow = function(j$) { - var getErrorMsg = j$.formatErrorMsg( - '', - 'expect(function() {}).toThrow()' - ); - - /** - * {@link expect} a function to `throw` something. - * @function - * @name matchers#toThrow - * @since 2.0.0 - * @param {Object} [expected] - Value that should be thrown. If not provided, simply the fact that something was thrown will be checked. - * @example - * expect(function() { return 'things'; }).toThrow('foo'); - * expect(function() { return 'stuff'; }).toThrow(); - */ - function toThrow(matchersUtil) { - return { - compare: function(actual, expected) { - var result = { pass: false }, - threw = false, - thrown; - - if (typeof actual != 'function') { - throw new Error(getErrorMsg('Actual is not a Function')); - } - - try { - actual(); - } catch (e) { - threw = true; - thrown = e; - } - - if (!threw) { - result.message = 'Expected function to throw an exception.'; - return result; - } - - if (arguments.length == 1) { - result.pass = true; - result.message = function() { - return ( - 'Expected function not to throw, but it threw ' + - matchersUtil.pp(thrown) + - '.' - ); - }; - - return result; - } - - if (matchersUtil.equals(thrown, expected)) { - result.pass = true; - result.message = function() { - return ( - 'Expected function not to throw ' + - matchersUtil.pp(expected) + - '.' - ); - }; - } else { - result.message = function() { - return ( - 'Expected function to throw ' + - matchersUtil.pp(expected) + - ', but it threw ' + - matchersUtil.pp(thrown) + - '.' - ); - }; - } - - return result; - } - }; - } - - return toThrow; -}; - -getJasmineRequireObj().toThrowError = function(j$) { - var getErrorMsg = j$.formatErrorMsg( - '', - 'expect(function() {}).toThrowError(, )' - ); - - /** - * {@link expect} a function to `throw` an `Error`. - * @function - * @name matchers#toThrowError - * @since 2.0.0 - * @param {Error} [expected] - `Error` constructor the object that was thrown needs to be an instance of. If not provided, `Error` will be used. - * @param {RegExp|String} [message] - The message that should be set on the thrown `Error` - * @example - * expect(function() { return 'things'; }).toThrowError(MyCustomError, 'message'); - * expect(function() { return 'things'; }).toThrowError(MyCustomError, /bar/); - * expect(function() { return 'stuff'; }).toThrowError(MyCustomError); - * expect(function() { return 'other'; }).toThrowError(/foo/); - * expect(function() { return 'other'; }).toThrowError(); - */ - function toThrowError(matchersUtil) { - return { - compare: function(actual) { - var errorMatcher = getMatcher.apply(null, arguments), - thrown; - - if (typeof actual != 'function') { - throw new Error(getErrorMsg('Actual is not a Function')); - } - - try { - actual(); - return fail('Expected function to throw an Error.'); - } catch (e) { - thrown = e; - } - - if (!j$.isError_(thrown)) { - return fail(function() { - return ( - 'Expected function to throw an Error, but it threw ' + - matchersUtil.pp(thrown) + - '.' - ); - }); - } - - return errorMatcher.match(thrown); - } - }; - - function getMatcher() { - var expected, errorType; - - if (arguments[2]) { - errorType = arguments[1]; - expected = arguments[2]; - if (!isAnErrorType(errorType)) { - throw new Error(getErrorMsg('Expected error type is not an Error.')); - } - - return exactMatcher(expected, errorType); - } else if (arguments[1]) { - expected = arguments[1]; - - if (isAnErrorType(arguments[1])) { - return exactMatcher(null, arguments[1]); - } else { - return exactMatcher(arguments[1], null); - } - } else { - return anyMatcher(); - } - } - - function anyMatcher() { - return { - match: function(error) { - return pass( - 'Expected function not to throw an Error, but it threw ' + - j$.fnNameFor(error) + - '.' - ); - } - }; - } - - function exactMatcher(expected, errorType) { - if (expected && !isStringOrRegExp(expected)) { - if (errorType) { - throw new Error( - getErrorMsg('Expected error message is not a string or RegExp.') - ); - } else { - throw new Error( - getErrorMsg('Expected is not an Error, string, or RegExp.') - ); - } - } - - function messageMatch(message) { - if (typeof expected == 'string') { - return expected == message; - } else { - return expected.test(message); - } - } - - var errorTypeDescription = errorType - ? j$.fnNameFor(errorType) - : 'an exception'; - - function thrownDescription(thrown) { - var thrownName = errorType - ? j$.fnNameFor(thrown.constructor) - : 'an exception', - thrownMessage = ''; - - if (expected) { - thrownMessage = ' with message ' + matchersUtil.pp(thrown.message); - } - - return thrownName + thrownMessage; - } - - function messageDescription() { - if (expected === null) { - return ''; - } else if (expected instanceof RegExp) { - return ' with a message matching ' + matchersUtil.pp(expected); - } else { - return ' with message ' + matchersUtil.pp(expected); - } - } - - function matches(error) { - return ( - (errorType === null || error instanceof errorType) && - (expected === null || messageMatch(error.message)) - ); - } - - return { - match: function(thrown) { - if (matches(thrown)) { - return pass(function() { - return ( - 'Expected function not to throw ' + - errorTypeDescription + - messageDescription() + - '.' - ); - }); - } else { - return fail(function() { - return ( - 'Expected function to throw ' + - errorTypeDescription + - messageDescription() + - ', but it threw ' + - thrownDescription(thrown) + - '.' - ); - }); - } - } - }; - } - - function isStringOrRegExp(potential) { - return potential instanceof RegExp || typeof potential == 'string'; - } - - function isAnErrorType(type) { - if (typeof type !== 'function') { - return false; - } - - var Surrogate = function() {}; - Surrogate.prototype = type.prototype; - return j$.isError_(new Surrogate()); - } - } - - function pass(message) { - return { - pass: true, - message: message - }; - } - - function fail(message) { - return { - pass: false, - message: message - }; - } - - return toThrowError; -}; - -getJasmineRequireObj().toThrowMatching = function(j$) { - var usageError = j$.formatErrorMsg( - '', - 'expect(function() {}).toThrowMatching()' - ); - - /** - * {@link expect} a function to `throw` something matching a predicate. - * @function - * @name matchers#toThrowMatching - * @since 3.0.0 - * @param {Function} predicate - A function that takes the thrown exception as its parameter and returns true if it matches. - * @example - * expect(function() { throw new Error('nope'); }).toThrowMatching(function(thrown) { return thrown.message === 'nope'; }); - */ - function toThrowMatching(matchersUtil) { - return { - compare: function(actual, predicate) { - var thrown; - - if (typeof actual !== 'function') { - throw new Error(usageError('Actual is not a Function')); - } - - if (typeof predicate !== 'function') { - throw new Error(usageError('Predicate is not a Function')); - } - - try { - actual(); - return fail('Expected function to throw an exception.'); - } catch (e) { - thrown = e; - } - - if (predicate(thrown)) { - return pass( - 'Expected function not to throw an exception matching a predicate.' - ); - } else { - return fail(function() { - return ( - 'Expected function to throw an exception matching a predicate, ' + - 'but it threw ' + - thrownDescription(thrown) + - '.' - ); - }); - } - } - }; - - function thrownDescription(thrown) { - if (thrown && thrown.constructor) { - return ( - j$.fnNameFor(thrown.constructor) + - ' with message ' + - matchersUtil.pp(thrown.message) - ); - } else { - return matchersUtil.pp(thrown); - } - } - } - - function pass(message) { - return { - pass: true, - message: message - }; - } - - function fail(message) { - return { - pass: false, - message: message - }; - } - - return toThrowMatching; -}; - -getJasmineRequireObj().MockDate = function() { - function MockDate(global) { - var self = this; - var currentTime = 0; - - if (!global || !global.Date) { - self.install = function() {}; - self.tick = function() {}; - self.uninstall = function() {}; - return self; - } - - var GlobalDate = global.Date; - - self.install = function(mockDate) { - if (mockDate instanceof GlobalDate) { - currentTime = mockDate.getTime(); - } else { - currentTime = new GlobalDate().getTime(); - } - - global.Date = FakeDate; - }; - - self.tick = function(millis) { - millis = millis || 0; - currentTime = currentTime + millis; - }; - - self.uninstall = function() { - currentTime = 0; - global.Date = GlobalDate; - }; - - createDateProperties(); - - return self; - - function FakeDate() { - switch (arguments.length) { - case 0: - return new GlobalDate(currentTime); - case 1: - return new GlobalDate(arguments[0]); - case 2: - return new GlobalDate(arguments[0], arguments[1]); - case 3: - return new GlobalDate(arguments[0], arguments[1], arguments[2]); - case 4: - return new GlobalDate( - arguments[0], - arguments[1], - arguments[2], - arguments[3] - ); - case 5: - return new GlobalDate( - arguments[0], - arguments[1], - arguments[2], - arguments[3], - arguments[4] - ); - case 6: - return new GlobalDate( - arguments[0], - arguments[1], - arguments[2], - arguments[3], - arguments[4], - arguments[5] - ); - default: - return new GlobalDate( - arguments[0], - arguments[1], - arguments[2], - arguments[3], - arguments[4], - arguments[5], - arguments[6] - ); - } - } - - function createDateProperties() { - FakeDate.prototype = GlobalDate.prototype; - - FakeDate.now = function() { - if (GlobalDate.now) { - return currentTime; - } else { - throw new Error('Browser does not support Date.now()'); - } - }; - - FakeDate.toSource = GlobalDate.toSource; - FakeDate.toString = GlobalDate.toString; - FakeDate.parse = GlobalDate.parse; - FakeDate.UTC = GlobalDate.UTC; - } - } - - return MockDate; -}; - -getJasmineRequireObj().makePrettyPrinter = function(j$) { - function SinglePrettyPrintRun(customObjectFormatters, pp) { - this.customObjectFormatters_ = customObjectFormatters; - this.ppNestLevel_ = 0; - this.seen = []; - this.length = 0; - this.stringParts = []; - this.pp_ = pp; - } - - function hasCustomToString(value) { - // value.toString !== Object.prototype.toString if value has no custom toString but is from another context (e.g. - // iframe, web worker) - try { - return ( - j$.isFunction_(value.toString) && - value.toString !== Object.prototype.toString && - value.toString() !== Object.prototype.toString.call(value) - ); - } catch (e) { - // The custom toString() threw. - return true; - } - } - - SinglePrettyPrintRun.prototype.format = function(value) { - this.ppNestLevel_++; - try { - var customFormatResult = this.applyCustomFormatters_(value); - - if (customFormatResult) { - this.emitScalar(customFormatResult); - } else if (j$.util.isUndefined(value)) { - this.emitScalar('undefined'); - } else if (value === null) { - this.emitScalar('null'); - } else if (value === 0 && 1 / value === -Infinity) { - this.emitScalar('-0'); - } else if (value === j$.getGlobal()) { - this.emitScalar(''); - } else if (value.jasmineToString) { - this.emitScalar(value.jasmineToString(this.pp_)); - } else if (typeof value === 'string') { - this.emitString(value); - } else if (j$.isSpy(value)) { - this.emitScalar('spy on ' + value.and.identity); - } else if (j$.isSpy(value.toString)) { - this.emitScalar('spy on ' + value.toString.and.identity); - } else if (value instanceof RegExp) { - this.emitScalar(value.toString()); - } else if (typeof value === 'function') { - this.emitScalar('Function'); - } else if (j$.isDomNode(value)) { - if (value.tagName) { - this.emitDomElement(value); - } else { - this.emitScalar('HTMLNode'); - } - } else if (value instanceof Date) { - this.emitScalar('Date(' + value + ')'); - } else if (j$.isSet(value)) { - this.emitSet(value); - } else if (j$.isMap(value)) { - this.emitMap(value); - } else if (j$.isTypedArray_(value)) { - this.emitTypedArray(value); - } else if ( - value.toString && - typeof value === 'object' && - !j$.isArray_(value) && - hasCustomToString(value) - ) { - try { - this.emitScalar(value.toString()); - } catch (e) { - this.emitScalar('has-invalid-toString-method'); - } - } else if (j$.util.arrayContains(this.seen, value)) { - this.emitScalar( - '' - ); - } else if (j$.isArray_(value) || j$.isA_('Object', value)) { - this.seen.push(value); - if (j$.isArray_(value)) { - this.emitArray(value); - } else { - this.emitObject(value); - } - this.seen.pop(); - } else { - this.emitScalar(value.toString()); - } - } catch (e) { - if (this.ppNestLevel_ > 1 || !(e instanceof MaxCharsReachedError)) { - throw e; - } - } finally { - this.ppNestLevel_--; - } - }; - - SinglePrettyPrintRun.prototype.applyCustomFormatters_ = function(value) { - return customFormat(value, this.customObjectFormatters_); - }; - - SinglePrettyPrintRun.prototype.iterateObject = function(obj, fn) { - var objKeys = keys(obj, j$.isArray_(obj)); - var isGetter = function isGetter(prop) {}; - - if (obj.__lookupGetter__) { - isGetter = function isGetter(prop) { - var getter = obj.__lookupGetter__(prop); - return !j$.util.isUndefined(getter) && getter !== null; - }; - } - var length = Math.min(objKeys.length, j$.MAX_PRETTY_PRINT_ARRAY_LENGTH); - for (var i = 0; i < length; i++) { - var property = objKeys[i]; - fn(property, isGetter(property)); - } - - return objKeys.length > length; - }; - - SinglePrettyPrintRun.prototype.emitScalar = function(value) { - this.append(value); - }; - - SinglePrettyPrintRun.prototype.emitString = function(value) { - this.append("'" + value + "'"); - }; - - SinglePrettyPrintRun.prototype.emitArray = function(array) { - if (this.ppNestLevel_ > j$.MAX_PRETTY_PRINT_DEPTH) { - this.append('Array'); - return; - } - var length = Math.min(array.length, j$.MAX_PRETTY_PRINT_ARRAY_LENGTH); - this.append('[ '); - for (var i = 0; i < length; i++) { - if (i > 0) { - this.append(', '); - } - this.format(array[i]); - } - if (array.length > length) { - this.append(', ...'); - } - - var self = this; - var first = array.length === 0; - var truncated = this.iterateObject(array, function(property, isGetter) { - if (first) { - first = false; - } else { - self.append(', '); - } - - self.formatProperty(array, property, isGetter); - }); - - if (truncated) { - this.append(', ...'); - } - - this.append(' ]'); - }; - - SinglePrettyPrintRun.prototype.emitSet = function(set) { - if (this.ppNestLevel_ > j$.MAX_PRETTY_PRINT_DEPTH) { - this.append('Set'); - return; - } - this.append('Set( '); - var size = Math.min(set.size, j$.MAX_PRETTY_PRINT_ARRAY_LENGTH); - var i = 0; - set.forEach(function(value, key) { - if (i >= size) { - return; - } - if (i > 0) { - this.append(', '); - } - this.format(value); - - i++; - }, this); - if (set.size > size) { - this.append(', ...'); - } - this.append(' )'); - }; - - SinglePrettyPrintRun.prototype.emitMap = function(map) { - if (this.ppNestLevel_ > j$.MAX_PRETTY_PRINT_DEPTH) { - this.append('Map'); - return; - } - this.append('Map( '); - var size = Math.min(map.size, j$.MAX_PRETTY_PRINT_ARRAY_LENGTH); - var i = 0; - map.forEach(function(value, key) { - if (i >= size) { - return; - } - if (i > 0) { - this.append(', '); - } - this.format([key, value]); - - i++; - }, this); - if (map.size > size) { - this.append(', ...'); - } - this.append(' )'); - }; - - SinglePrettyPrintRun.prototype.emitObject = function(obj) { - var ctor = obj.constructor, - constructorName; - - constructorName = - typeof ctor === 'function' && obj instanceof ctor - ? j$.fnNameFor(obj.constructor) - : 'null'; - - this.append(constructorName); - - if (this.ppNestLevel_ > j$.MAX_PRETTY_PRINT_DEPTH) { - return; - } - - var self = this; - this.append('({ '); - var first = true; - - var truncated = this.iterateObject(obj, function(property, isGetter) { - if (first) { - first = false; - } else { - self.append(', '); - } - - self.formatProperty(obj, property, isGetter); - }); - - if (truncated) { - this.append(', ...'); - } - - this.append(' })'); - }; - - SinglePrettyPrintRun.prototype.emitTypedArray = function(arr) { - var constructorName = j$.fnNameFor(arr.constructor), - limitedArray = Array.prototype.slice.call( - arr, - 0, - j$.MAX_PRETTY_PRINT_ARRAY_LENGTH - ), - itemsString = Array.prototype.join.call(limitedArray, ', '); - - if (limitedArray.length !== arr.length) { - itemsString += ', ...'; - } - - this.append(constructorName + ' [ ' + itemsString + ' ]'); - }; - - SinglePrettyPrintRun.prototype.emitDomElement = function(el) { - var tagName = el.tagName.toLowerCase(), - attrs = el.attributes, - i, - len = attrs.length, - out = '<' + tagName, - attr; - - for (i = 0; i < len; i++) { - attr = attrs[i]; - out += ' ' + attr.name; - - if (attr.value !== '') { - out += '="' + attr.value + '"'; - } - } - - out += '>'; - - if (el.childElementCount !== 0 || el.textContent !== '') { - out += '...'; - } - - this.append(out); - }; - - SinglePrettyPrintRun.prototype.formatProperty = function( - obj, - property, - isGetter - ) { - this.append(property); - this.append(': '); - if (isGetter) { - this.append(''); - } else { - this.format(obj[property]); - } - }; - - SinglePrettyPrintRun.prototype.append = function(value) { - // This check protects us from the rare case where an object has overriden - // `toString()` with an invalid implementation (returning a non-string). - if (typeof value !== 'string') { - value = Object.prototype.toString.call(value); - } - - var result = truncate(value, j$.MAX_PRETTY_PRINT_CHARS - this.length); - this.length += result.value.length; - this.stringParts.push(result.value); - - if (result.truncated) { - throw new MaxCharsReachedError(); - } - }; - - function truncate(s, maxlen) { - if (s.length <= maxlen) { - return { value: s, truncated: false }; - } - - s = s.substring(0, maxlen - 4) + ' ...'; - return { value: s, truncated: true }; - } - - function MaxCharsReachedError() { - this.message = - 'Exceeded ' + - j$.MAX_PRETTY_PRINT_CHARS + - ' characters while pretty-printing a value'; - } - - MaxCharsReachedError.prototype = new Error(); - - function keys(obj, isArray) { - var allKeys = Object.keys - ? Object.keys(obj) - : (function(o) { - var keys = []; - for (var key in o) { - if (j$.util.has(o, key)) { - keys.push(key); - } - } - return keys; - })(obj); - - if (!isArray) { - return allKeys; - } - - if (allKeys.length === 0) { - return allKeys; - } - - var extraKeys = []; - for (var i = 0; i < allKeys.length; i++) { - if (!/^[0-9]+$/.test(allKeys[i])) { - extraKeys.push(allKeys[i]); - } - } - - return extraKeys; - } - - function customFormat(value, customObjectFormatters) { - var i, result; - - for (i = 0; i < customObjectFormatters.length; i++) { - result = customObjectFormatters[i](value); - - if (result !== undefined) { - return result; - } - } - } - - return function(customObjectFormatters) { - customObjectFormatters = customObjectFormatters || []; - - var pp = function(value) { - var prettyPrinter = new SinglePrettyPrintRun(customObjectFormatters, pp); - prettyPrinter.format(value); - return prettyPrinter.stringParts.join(''); - }; - - pp.customFormat_ = function(value) { - return customFormat(value, customObjectFormatters); - }; - - return pp; - }; -}; - -getJasmineRequireObj().QueueRunner = function(j$) { - var nextid = 1; - - function StopExecutionError() {} - StopExecutionError.prototype = new Error(); - j$.StopExecutionError = StopExecutionError; - - function once(fn) { - var called = false; - return function(arg) { - if (!called) { - called = true; - // Direct call using single parameter, because cleanup/next does not need more - fn(arg); - } - return null; - }; - } - - function emptyFn() {} - - function QueueRunner(attrs) { - this.id_ = nextid++; - var queueableFns = attrs.queueableFns || []; - this.queueableFns = queueableFns.concat(attrs.cleanupFns || []); - this.firstCleanupIx = queueableFns.length; - this.onComplete = attrs.onComplete || emptyFn; - this.clearStack = - attrs.clearStack || - function(fn) { - fn(); - }; - this.onException = attrs.onException || emptyFn; - this.userContext = attrs.userContext || new j$.UserContext(); - this.timeout = attrs.timeout || { - setTimeout: setTimeout, - clearTimeout: clearTimeout - }; - this.fail = attrs.fail || emptyFn; - this.globalErrors = attrs.globalErrors || { - pushListener: emptyFn, - popListener: emptyFn - }; - this.completeOnFirstError = !!attrs.completeOnFirstError; - this.errored = false; - - if (typeof this.onComplete !== 'function') { - throw new Error('invalid onComplete ' + JSON.stringify(this.onComplete)); - } - this.deprecated = attrs.deprecated; - } - - QueueRunner.prototype.execute = function() { - var self = this; - this.handleFinalError = function(message, source, lineno, colno, error) { - // Older browsers would send the error as the first parameter. HTML5 - // specifies the the five parameters above. The error instance should - // be preffered, otherwise the call stack would get lost. - self.onException(error || message); - }; - this.globalErrors.pushListener(this.handleFinalError); - this.run(0); - }; - - QueueRunner.prototype.skipToCleanup = function(lastRanIndex) { - if (lastRanIndex < this.firstCleanupIx) { - this.run(this.firstCleanupIx); - } else { - this.run(lastRanIndex + 1); - } - }; - - QueueRunner.prototype.clearTimeout = function(timeoutId) { - Function.prototype.apply.apply(this.timeout.clearTimeout, [ - j$.getGlobal(), - [timeoutId] - ]); - }; - - QueueRunner.prototype.setTimeout = function(fn, timeout) { - return Function.prototype.apply.apply(this.timeout.setTimeout, [ - j$.getGlobal(), - [fn, timeout] - ]); - }; - - QueueRunner.prototype.attempt = function attempt(iterativeIndex) { - var self = this, - completedSynchronously = true, - handleError = function handleError(error) { - onException(error); - next(error); - }, - cleanup = once(function cleanup() { - if (timeoutId !== void 0) { - self.clearTimeout(timeoutId); - } - self.globalErrors.popListener(handleError); - }), - next = once(function next(err) { - cleanup(); - - if (j$.isError_(err)) { - if (!(err instanceof StopExecutionError) && !err.jasmineMessage) { - self.fail(err); - } - self.errored = errored = true; - } - - function runNext() { - if (self.completeOnFirstError && errored) { - self.skipToCleanup(iterativeIndex); - } else { - self.run(iterativeIndex + 1); - } - } - - if (completedSynchronously) { - self.setTimeout(runNext); - } else { - runNext(); - } - }), - errored = false, - queueableFn = self.queueableFns[iterativeIndex], - timeoutId, - maybeThenable; - - next.fail = function nextFail() { - self.fail.apply(null, arguments); - self.errored = errored = true; - next(); - }; - - self.globalErrors.pushListener(handleError); - - if (queueableFn.timeout !== undefined) { - var timeoutInterval = queueableFn.timeout || j$.DEFAULT_TIMEOUT_INTERVAL; - timeoutId = self.setTimeout(function() { - var error = new Error( - 'Timeout - Async function did not complete within ' + - timeoutInterval + - 'ms ' + - (queueableFn.timeout - ? '(custom timeout)' - : '(set by jasmine.DEFAULT_TIMEOUT_INTERVAL)') - ); - onException(error); - next(); - }, timeoutInterval); - } - - try { - if (queueableFn.fn.length === 0) { - maybeThenable = queueableFn.fn.call(self.userContext); - - if (maybeThenable && j$.isFunction_(maybeThenable.then)) { - maybeThenable.then(next, onPromiseRejection); - completedSynchronously = false; - return { completedSynchronously: false }; - } - } else { - maybeThenable = queueableFn.fn.call(self.userContext, next); - this.diagnoseConflictingAsync_(queueableFn.fn, maybeThenable); - completedSynchronously = false; - return { completedSynchronously: false }; - } - } catch (e) { - onException(e); - self.errored = errored = true; - } - - cleanup(); - return { completedSynchronously: true, errored: errored }; - - function onException(e) { - self.onException(e); - self.errored = errored = true; - } - - function onPromiseRejection(e) { - onException(e); - next(); - } - }; - - QueueRunner.prototype.run = function(recursiveIndex) { - var length = this.queueableFns.length, - self = this, - iterativeIndex; - - for ( - iterativeIndex = recursiveIndex; - iterativeIndex < length; - iterativeIndex++ - ) { - var result = this.attempt(iterativeIndex); - - if (!result.completedSynchronously) { - return; - } - - self.errored = self.errored || result.errored; - - if (this.completeOnFirstError && result.errored) { - this.skipToCleanup(iterativeIndex); - return; - } - } - - this.clearStack(function() { - self.globalErrors.popListener(self.handleFinalError); - self.onComplete(self.errored && new StopExecutionError()); - }); - }; - - QueueRunner.prototype.diagnoseConflictingAsync_ = function(fn, retval) { - if (retval && j$.isFunction_(retval.then)) { - // Issue a warning that matches the user's code - if (j$.isAsyncFunction_(fn)) { - this.deprecated( - 'An asynchronous before/it/after ' + - 'function was defined with the async keyword but also took a ' + - 'done callback. This is not supported and will stop working in' + - ' the future. Either remove the done callback (recommended) or ' + - 'remove the async keyword.' - ); - } else { - this.deprecated( - 'An asynchronous before/it/after ' + - 'function took a done callback but also returned a promise. ' + - 'This is not supported and will stop working in the future. ' + - 'Either remove the done callback (recommended) or change the ' + - 'function to not return a promise.' - ); - } - } - }; - - return QueueRunner; -}; - -getJasmineRequireObj().ReportDispatcher = function(j$) { - function ReportDispatcher(methods, queueRunnerFactory) { - var dispatchedMethods = methods || []; - - for (var i = 0; i < dispatchedMethods.length; i++) { - var method = dispatchedMethods[i]; - this[method] = (function(m) { - return function() { - dispatch(m, arguments); - }; - })(method); - } - - var reporters = []; - var fallbackReporter = null; - - this.addReporter = function(reporter) { - reporters.push(reporter); - }; - - this.provideFallbackReporter = function(reporter) { - fallbackReporter = reporter; - }; - - this.clearReporters = function() { - reporters = []; - }; - - return this; - - function dispatch(method, args) { - if (reporters.length === 0 && fallbackReporter !== null) { - reporters.push(fallbackReporter); - } - var onComplete = args[args.length - 1]; - args = j$.util.argsToArray(args).splice(0, args.length - 1); - var fns = []; - for (var i = 0; i < reporters.length; i++) { - var reporter = reporters[i]; - addFn(fns, reporter, method, args); - } - - queueRunnerFactory({ - queueableFns: fns, - onComplete: onComplete, - isReporter: true - }); - } - - function addFn(fns, reporter, method, args) { - var fn = reporter[method]; - if (!fn) { - return; - } - - var thisArgs = j$.util.cloneArgs(args); - if (fn.length <= 1) { - fns.push({ - fn: function() { - return fn.apply(reporter, thisArgs); - } - }); - } else { - fns.push({ - fn: function(done) { - return fn.apply(reporter, thisArgs.concat([done])); - } - }); - } - } - } - - return ReportDispatcher; -}; - -getJasmineRequireObj().interface = function(jasmine, env) { - var jasmineInterface = { - /** - * Callback passed to parts of the Jasmine base interface. - * - * By default Jasmine assumes this function completes synchronously. - * If you have code that you need to test asynchronously, you can declare that you receive a `done` callback, return a Promise, or use the `async` keyword if it is supported in your environment. - * @callback implementationCallback - * @param {Function} [done] Used to specify to Jasmine that this callback is asynchronous and Jasmine should wait until it has been called before moving on. - * @returns {} Optionally return a Promise instead of using `done` to cause Jasmine to wait for completion. - */ - - /** - * Create a group of specs (often called a suite). - * - * Calls to `describe` can be nested within other calls to compose your suite as a tree. - * @name describe - * @since 1.3.0 - * @function - * @global - * @param {String} description Textual description of the group - * @param {Function} specDefinitions Function for Jasmine to invoke that will define inner suites and specs - */ - describe: function(description, specDefinitions) { - return env.describe(description, specDefinitions); - }, - - /** - * A temporarily disabled [`describe`]{@link describe} - * - * Specs within an `xdescribe` will be marked pending and not executed - * @name xdescribe - * @since 1.3.0 - * @function - * @global - * @param {String} description Textual description of the group - * @param {Function} specDefinitions Function for Jasmine to invoke that will define inner suites and specs - */ - xdescribe: function(description, specDefinitions) { - return env.xdescribe(description, specDefinitions); - }, - - /** - * A focused [`describe`]{@link describe} - * - * If suites or specs are focused, only those that are focused will be executed - * @see fit - * @name fdescribe - * @since 2.1.0 - * @function - * @global - * @param {String} description Textual description of the group - * @param {Function} specDefinitions Function for Jasmine to invoke that will define inner suites and specs - */ - fdescribe: function(description, specDefinitions) { - return env.fdescribe(description, specDefinitions); - }, - - /** - * Define a single spec. A spec should contain one or more {@link expect|expectations} that test the state of the code. - * - * A spec whose expectations all succeed will be passing and a spec with any failures will fail. - * The name `it` is a pronoun for the test target, not an abbreviation of anything. It makes the - * spec more readable by connecting the function name `it` and the argument `description` as a - * complete sentence. - * @name it - * @since 1.3.0 - * @function - * @global - * @param {String} description Textual description of what this spec is checking - * @param {implementationCallback} [testFunction] Function that contains the code of your test. If not provided the test will be `pending`. - * @param {Int} [timeout={@link jasmine.DEFAULT_TIMEOUT_INTERVAL}] Custom timeout for an async spec. - * @see async - */ - it: function() { - return env.it.apply(env, arguments); - }, - - /** - * A temporarily disabled [`it`]{@link it} - * - * The spec will report as `pending` and will not be executed. - * @name xit - * @since 1.3.0 - * @function - * @global - * @param {String} description Textual description of what this spec is checking. - * @param {implementationCallback} [testFunction] Function that contains the code of your test. Will not be executed. - */ - xit: function() { - return env.xit.apply(env, arguments); - }, - - /** - * A focused [`it`]{@link it} - * - * If suites or specs are focused, only those that are focused will be executed. - * @name fit - * @since 2.1.0 - * @function - * @global - * @param {String} description Textual description of what this spec is checking. - * @param {implementationCallback} testFunction Function that contains the code of your test. - * @param {Int} [timeout={@link jasmine.DEFAULT_TIMEOUT_INTERVAL}] Custom timeout for an async spec. - * @see async - */ - fit: function() { - return env.fit.apply(env, arguments); - }, - - /** - * Run some shared setup before each of the specs in the {@link describe} in which it is called. - * @name beforeEach - * @since 1.3.0 - * @function - * @global - * @param {implementationCallback} [function] Function that contains the code to setup your specs. - * @param {Int} [timeout={@link jasmine.DEFAULT_TIMEOUT_INTERVAL}] Custom timeout for an async beforeEach. - * @see async - */ - beforeEach: function() { - return env.beforeEach.apply(env, arguments); - }, - - /** - * Run some shared teardown after each of the specs in the {@link describe} in which it is called. - * @name afterEach - * @since 1.3.0 - * @function - * @global - * @param {implementationCallback} [function] Function that contains the code to teardown your specs. - * @param {Int} [timeout={@link jasmine.DEFAULT_TIMEOUT_INTERVAL}] Custom timeout for an async afterEach. - * @see async - */ - afterEach: function() { - return env.afterEach.apply(env, arguments); - }, - - /** - * Run some shared setup once before all of the specs in the {@link describe} are run. - * - * _Note:_ Be careful, sharing the setup from a beforeAll makes it easy to accidentally leak state between your specs so that they erroneously pass or fail. - * @name beforeAll - * @since 2.1.0 - * @function - * @global - * @param {implementationCallback} [function] Function that contains the code to setup your specs. - * @param {Int} [timeout={@link jasmine.DEFAULT_TIMEOUT_INTERVAL}] Custom timeout for an async beforeAll. - * @see async - */ - beforeAll: function() { - return env.beforeAll.apply(env, arguments); - }, - - /** - * Run some shared teardown once after all of the specs in the {@link describe} are run. - * - * _Note:_ Be careful, sharing the teardown from a afterAll makes it easy to accidentally leak state between your specs so that they erroneously pass or fail. - * @name afterAll - * @since 2.1.0 - * @function - * @global - * @param {implementationCallback} [function] Function that contains the code to teardown your specs. - * @param {Int} [timeout={@link jasmine.DEFAULT_TIMEOUT_INTERVAL}] Custom timeout for an async afterAll. - * @see async - */ - afterAll: function() { - return env.afterAll.apply(env, arguments); - }, - - /** - * Sets a user-defined property that will be provided to reporters as part of the properties field of {@link SpecResult} - * @name setSpecProperty - * @since 3.6.0 - * @function - * @param {String} key The name of the property - * @param {*} value The value of the property - */ - setSpecProperty: function(key, value) { - return env.setSpecProperty(key, value); - }, - - /** - * Sets a user-defined property that will be provided to reporters as part of the properties field of {@link SuiteResult} - * @name setSuiteProperty - * @since 3.6.0 - * @function - * @param {String} key The name of the property - * @param {*} value The value of the property - */ - setSuiteProperty: function(key, value) { - return env.setSuiteProperty(key, value); - }, - - /** - * Create an expectation for a spec. - * @name expect - * @since 1.3.0 - * @function - * @global - * @param {Object} actual - Actual computed value to test expectations against. - * @return {matchers} - */ - expect: function(actual) { - return env.expect(actual); - }, - - /** - * Create an asynchronous expectation for a spec. Note that the matchers - * that are provided by an asynchronous expectation all return promises - * which must be either returned from the spec or waited for using `await` - * in order for Jasmine to associate them with the correct spec. - * @name expectAsync - * @since 3.3.0 - * @function - * @global - * @param {Object} actual - Actual computed value to test expectations against. - * @return {async-matchers} - * @example - * await expectAsync(somePromise).toBeResolved(); - * @example - * return expectAsync(somePromise).toBeResolved(); - */ - expectAsync: function(actual) { - return env.expectAsync(actual); - }, - - /** - * Mark a spec as pending, expectation results will be ignored. - * @name pending - * @since 2.0.0 - * @function - * @global - * @param {String} [message] - Reason the spec is pending. - */ - pending: function() { - return env.pending.apply(env, arguments); - }, - - /** - * Explicitly mark a spec as failed. - * @name fail - * @since 2.1.0 - * @function - * @global - * @param {String|Error} [error] - Reason for the failure. - */ - fail: function() { - return env.fail.apply(env, arguments); - }, - - /** - * Install a spy onto an existing object. - * @name spyOn - * @since 1.3.0 - * @function - * @global - * @param {Object} obj - The object upon which to install the {@link Spy}. - * @param {String} methodName - The name of the method to replace with a {@link Spy}. - * @returns {Spy} - */ - spyOn: function(obj, methodName) { - return env.spyOn(obj, methodName); - }, - - /** - * Install a spy on a property installed with `Object.defineProperty` onto an existing object. - * @name spyOnProperty - * @since 2.6.0 - * @function - * @global - * @param {Object} obj - The object upon which to install the {@link Spy} - * @param {String} propertyName - The name of the property to replace with a {@link Spy}. - * @param {String} [accessType=get] - The access type (get|set) of the property to {@link Spy} on. - * @returns {Spy} - */ - spyOnProperty: function(obj, methodName, accessType) { - return env.spyOnProperty(obj, methodName, accessType); - }, - - /** - * Installs spies on all writable and configurable properties of an object. - * @name spyOnAllFunctions - * @since 3.2.1 - * @function - * @global - * @param {Object} obj - The object upon which to install the {@link Spy}s - * @param {boolean} includeNonEnumerable - Whether or not to add spies to non-enumerable properties - * @returns {Object} the spied object - */ - spyOnAllFunctions: function(obj, includeNonEnumerable) { - return env.spyOnAllFunctions(obj, includeNonEnumerable); - }, - - jsApiReporter: new jasmine.JsApiReporter({ - timer: new jasmine.Timer() - }), - - /** - * @namespace jasmine - */ - jasmine: jasmine - }; - - /** - * Add a custom equality tester for the current scope of specs. - * - * _Note:_ This is only callable from within a {@link beforeEach}, {@link it}, or {@link beforeAll}. - * @name jasmine.addCustomEqualityTester - * @since 2.0.0 - * @function - * @param {Function} tester - A function which takes two arguments to compare and returns a `true` or `false` comparison result if it knows how to compare them, and `undefined` otherwise. - * @see custom_equality - */ - jasmine.addCustomEqualityTester = function(tester) { - env.addCustomEqualityTester(tester); - }; - - /** - * Add custom matchers for the current scope of specs. - * - * _Note:_ This is only callable from within a {@link beforeEach}, {@link it}, or {@link beforeAll}. - * @name jasmine.addMatchers - * @since 2.0.0 - * @function - * @param {Object} matchers - Keys from this object will be the new matcher names. - * @see custom_matcher - */ - jasmine.addMatchers = function(matchers) { - return env.addMatchers(matchers); - }; - - /** - * Add custom async matchers for the current scope of specs. - * - * _Note:_ This is only callable from within a {@link beforeEach}, {@link it}, or {@link beforeAll}. - * @name jasmine.addAsyncMatchers - * @since 3.5.0 - * @function - * @param {Object} matchers - Keys from this object will be the new async matcher names. - * @see custom_matcher - */ - jasmine.addAsyncMatchers = function(matchers) { - return env.addAsyncMatchers(matchers); - }; - - /** - * Add a custom object formatter for the current scope of specs. - * - * _Note:_ This is only callable from within a {@link beforeEach}, {@link it}, or {@link beforeAll}. - * @name jasmine.addCustomObjectFormatter - * @since 3.6.0 - * @function - * @param {Function} formatter - A function which takes a value to format and returns a string if it knows how to format it, and `undefined` otherwise. - * @see custom_object_formatters - */ - jasmine.addCustomObjectFormatter = function(formatter) { - return env.addCustomObjectFormatter(formatter); - }; - - /** - * Get the currently booted mock {Clock} for this Jasmine environment. - * @name jasmine.clock - * @since 2.0.0 - * @function - * @returns {Clock} - */ - jasmine.clock = function() { - return env.clock; - }; - - /** - * Create a bare {@link Spy} object. This won't be installed anywhere and will not have any implementation behind it. - * @name jasmine.createSpy - * @since 1.3.0 - * @function - * @param {String} [name] - Name to give the spy. This will be displayed in failure messages. - * @param {Function} [originalFn] - Function to act as the real implementation. - * @return {Spy} - */ - jasmine.createSpy = function(name, originalFn) { - return env.createSpy(name, originalFn); - }; - - /** - * Create an object with multiple {@link Spy}s as its members. - * @name jasmine.createSpyObj - * @since 1.3.0 - * @function - * @param {String} [baseName] - Base name for the spies in the object. - * @param {String[]|Object} methodNames - Array of method names to create spies for, or Object whose keys will be method names and values the {@link Spy#and#returnValue|returnValue}. - * @param {String[]|Object} [propertyNames] - Array of property names to create spies for, or Object whose keys will be propertynames and values the {@link Spy#and#returnValue|returnValue}. - * @return {Object} - */ - jasmine.createSpyObj = function(baseName, methodNames, propertyNames) { - return env.createSpyObj(baseName, methodNames, propertyNames); - }; - - /** - * Add a custom spy strategy for the current scope of specs. - * - * _Note:_ This is only callable from within a {@link beforeEach}, {@link it}, or {@link beforeAll}. - * @name jasmine.addSpyStrategy - * @since 3.5.0 - * @function - * @param {String} name - The name of the strategy (i.e. what you call from `and`) - * @param {Function} factory - Factory function that returns the plan to be executed. - */ - jasmine.addSpyStrategy = function(name, factory) { - return env.addSpyStrategy(name, factory); - }; - - /** - * Set the default spy strategy for the current scope of specs. - * - * _Note:_ This is only callable from within a {@link beforeEach}, {@link it}, or {@link beforeAll}. - * @name jasmine.setDefaultSpyStrategy - * @function - * @param {Function} defaultStrategyFn - a function that assigns a strategy - * @example - * beforeEach(function() { - * jasmine.setDefaultSpyStrategy(and => and.returnValue(true)); - * }); - */ - jasmine.setDefaultSpyStrategy = function(defaultStrategyFn) { - return env.setDefaultSpyStrategy(defaultStrategyFn); - }; - - return jasmineInterface; -}; - -getJasmineRequireObj().Spy = function(j$) { - var nextOrder = (function() { - var order = 0; - - return function() { - return order++; - }; - })(); - - var matchersUtil = new j$.MatchersUtil({ - customTesters: [], - pp: j$.makePrettyPrinter() - }); - - /** - * @classdesc _Note:_ Do not construct this directly. Use {@link spyOn}, - * {@link spyOnProperty}, {@link jasmine.createSpy}, or - * {@link jasmine.createSpyObj} instead. - * @class Spy - * @hideconstructor - */ - function Spy( - name, - originalFn, - customStrategies, - defaultStrategyFn, - getPromise - ) { - var numArgs = typeof originalFn === 'function' ? originalFn.length : 0, - wrapper = makeFunc(numArgs, function(context, args, invokeNew) { - return spy(context, args, invokeNew); - }), - strategyDispatcher = new SpyStrategyDispatcher({ - name: name, - fn: originalFn, - getSpy: function() { - return wrapper; - }, - customStrategies: customStrategies, - getPromise: getPromise - }), - callTracker = new j$.CallTracker(), - spy = function(context, args, invokeNew) { - /** - * @name Spy.callData - * @property {object} object - `this` context for the invocation. - * @property {number} invocationOrder - Order of the invocation. - * @property {Array} args - The arguments passed for this invocation. - * @property returnValue - The value that was returned from this invocation. - */ - var callData = { - object: context, - invocationOrder: nextOrder(), - args: Array.prototype.slice.apply(args) - }; - - callTracker.track(callData); - var returnValue = strategyDispatcher.exec(context, args, invokeNew); - callData.returnValue = returnValue; - - return returnValue; - }; - - function makeFunc(length, fn) { - switch (length) { - case 1: - return function wrap1(a) { - return fn(this, arguments, this instanceof wrap1); - }; - case 2: - return function wrap2(a, b) { - return fn(this, arguments, this instanceof wrap2); - }; - case 3: - return function wrap3(a, b, c) { - return fn(this, arguments, this instanceof wrap3); - }; - case 4: - return function wrap4(a, b, c, d) { - return fn(this, arguments, this instanceof wrap4); - }; - case 5: - return function wrap5(a, b, c, d, e) { - return fn(this, arguments, this instanceof wrap5); - }; - case 6: - return function wrap6(a, b, c, d, e, f) { - return fn(this, arguments, this instanceof wrap6); - }; - case 7: - return function wrap7(a, b, c, d, e, f, g) { - return fn(this, arguments, this instanceof wrap7); - }; - case 8: - return function wrap8(a, b, c, d, e, f, g, h) { - return fn(this, arguments, this instanceof wrap8); - }; - case 9: - return function wrap9(a, b, c, d, e, f, g, h, i) { - return fn(this, arguments, this instanceof wrap9); - }; - default: - return function wrap() { - return fn(this, arguments, this instanceof wrap); - }; - } - } - - for (var prop in originalFn) { - if (prop === 'and' || prop === 'calls') { - throw new Error( - "Jasmine spies would overwrite the 'and' and 'calls' properties on the object being spied upon" - ); - } - - wrapper[prop] = originalFn[prop]; - } - - /** - * @member {SpyStrategy} - Accesses the default strategy for the spy. This strategy will be used - * whenever the spy is called with arguments that don't match any strategy - * created with {@link Spy#withArgs}. - * @name Spy#and - * @since 2.0.0 - * @example - * spyOn(someObj, 'func').and.returnValue(42); - */ - wrapper.and = strategyDispatcher.and; - /** - * Specifies a strategy to be used for calls to the spy that have the - * specified arguments. - * @name Spy#withArgs - * @since 3.0.0 - * @function - * @param {...*} args - The arguments to match - * @type {SpyStrategy} - * @example - * spyOn(someObj, 'func').withArgs(1, 2, 3).and.returnValue(42); - * someObj.func(1, 2, 3); // returns 42 - */ - wrapper.withArgs = function() { - return strategyDispatcher.withArgs.apply(strategyDispatcher, arguments); - }; - wrapper.calls = callTracker; - - if (defaultStrategyFn) { - defaultStrategyFn(wrapper.and); - } - - return wrapper; - } - - function SpyStrategyDispatcher(strategyArgs) { - var baseStrategy = new j$.SpyStrategy(strategyArgs); - var argsStrategies = new StrategyDict(function() { - return new j$.SpyStrategy(strategyArgs); - }); - - this.and = baseStrategy; - - this.exec = function(spy, args, invokeNew) { - var strategy = argsStrategies.get(args); - - if (!strategy) { - if (argsStrategies.any() && !baseStrategy.isConfigured()) { - throw new Error( - "Spy '" + - strategyArgs.name + - "' received a call with arguments " + - j$.pp(Array.prototype.slice.call(args)) + - ' but all configured strategies specify other arguments.' - ); - } else { - strategy = baseStrategy; - } - } - - return strategy.exec(spy, args, invokeNew); - }; - - this.withArgs = function() { - return { and: argsStrategies.getOrCreate(arguments) }; - }; - } - - function StrategyDict(strategyFactory) { - this.strategies = []; - this.strategyFactory = strategyFactory; - } - - StrategyDict.prototype.any = function() { - return this.strategies.length > 0; - }; - - StrategyDict.prototype.getOrCreate = function(args) { - var strategy = this.get(args); - - if (!strategy) { - strategy = this.strategyFactory(); - this.strategies.push({ - args: args, - strategy: strategy - }); - } - - return strategy; - }; - - StrategyDict.prototype.get = function(args) { - var i; - - for (i = 0; i < this.strategies.length; i++) { - if (matchersUtil.equals(args, this.strategies[i].args)) { - return this.strategies[i].strategy; - } - } - }; - - return Spy; -}; - -getJasmineRequireObj().SpyFactory = function(j$) { - function SpyFactory(getCustomStrategies, getDefaultStrategyFn, getPromise) { - var self = this; - - this.createSpy = function(name, originalFn) { - return j$.Spy( - name, - originalFn, - getCustomStrategies(), - getDefaultStrategyFn(), - getPromise - ); - }; - - this.createSpyObj = function(baseName, methodNames, propertyNames) { - var baseNameIsCollection = - j$.isObject_(baseName) || j$.isArray_(baseName); - - if (baseNameIsCollection) { - propertyNames = methodNames; - methodNames = baseName; - baseName = 'unknown'; - } - - var obj = {}; - var spy, descriptor; - - var methods = normalizeKeyValues(methodNames); - for (var i = 0; i < methods.length; i++) { - spy = obj[methods[i][0]] = self.createSpy( - baseName + '.' + methods[i][0] - ); - if (methods[i].length > 1) { - spy.and.returnValue(methods[i][1]); - } - } - - var properties = normalizeKeyValues(propertyNames); - for (var i = 0; i < properties.length; i++) { - descriptor = { - enumerable: true, - get: self.createSpy(baseName + '.' + properties[i][0] + '.get'), - set: self.createSpy(baseName + '.' + properties[i][0] + '.set') - }; - if (properties[i].length > 1) { - descriptor.get.and.returnValue(properties[i][1]); - descriptor.set.and.returnValue(properties[i][1]); - } - Object.defineProperty(obj, properties[i][0], descriptor); - } - - if (methods.length === 0 && properties.length === 0) { - throw 'createSpyObj requires a non-empty array or object of method names to create spies for'; - } - - return obj; - }; - } - - function normalizeKeyValues(object) { - var result = []; - if (j$.isArray_(object)) { - for (var i = 0; i < object.length; i++) { - result.push([object[i]]); - } - } else if (j$.isObject_(object)) { - for (var key in object) { - if (object.hasOwnProperty(key)) { - result.push([key, object[key]]); - } - } - } - return result; - } - - return SpyFactory; -}; - -getJasmineRequireObj().SpyRegistry = function(j$) { - var spyOnMsg = j$.formatErrorMsg('', 'spyOn(, )'); - var spyOnPropertyMsg = j$.formatErrorMsg( - '', - 'spyOnProperty(, , [accessType])' - ); - - function SpyRegistry(options) { - options = options || {}; - var global = options.global || j$.getGlobal(); - var createSpy = options.createSpy; - var currentSpies = - options.currentSpies || - function() { - return []; - }; - - this.allowRespy = function(allow) { - this.respy = allow; - }; - - this.spyOn = function(obj, methodName) { - var getErrorMsg = spyOnMsg; - - if (j$.util.isUndefined(obj) || obj === null) { - throw new Error( - getErrorMsg( - 'could not find an object to spy upon for ' + methodName + '()' - ) - ); - } - - if (j$.util.isUndefined(methodName) || methodName === null) { - throw new Error(getErrorMsg('No method name supplied')); - } - - if (j$.util.isUndefined(obj[methodName])) { - throw new Error(getErrorMsg(methodName + '() method does not exist')); - } - - if (obj[methodName] && j$.isSpy(obj[methodName])) { - if (this.respy) { - return obj[methodName]; - } else { - throw new Error( - getErrorMsg(methodName + ' has already been spied upon') - ); - } - } - - var descriptor = Object.getOwnPropertyDescriptor(obj, methodName); - - if (descriptor && !(descriptor.writable || descriptor.set)) { - throw new Error( - getErrorMsg(methodName + ' is not declared writable or has no setter') - ); - } - - var originalMethod = obj[methodName], - spiedMethod = createSpy(methodName, originalMethod), - restoreStrategy; - - if ( - Object.prototype.hasOwnProperty.call(obj, methodName) || - (obj === global && methodName === 'onerror') - ) { - restoreStrategy = function() { - obj[methodName] = originalMethod; - }; - } else { - restoreStrategy = function() { - if (!delete obj[methodName]) { - obj[methodName] = originalMethod; - } - }; - } - - currentSpies().push({ - restoreObjectToOriginalState: restoreStrategy - }); - - obj[methodName] = spiedMethod; - - return spiedMethod; - }; - - this.spyOnProperty = function(obj, propertyName, accessType) { - var getErrorMsg = spyOnPropertyMsg; - - accessType = accessType || 'get'; - - if (j$.util.isUndefined(obj)) { - throw new Error( - getErrorMsg( - 'spyOn could not find an object to spy upon for ' + - propertyName + - '' - ) - ); - } - - if (j$.util.isUndefined(propertyName)) { - throw new Error(getErrorMsg('No property name supplied')); - } - - var descriptor = j$.util.getPropertyDescriptor(obj, propertyName); - - if (!descriptor) { - throw new Error(getErrorMsg(propertyName + ' property does not exist')); - } - - if (!descriptor.configurable) { - throw new Error( - getErrorMsg(propertyName + ' is not declared configurable') - ); - } - - if (!descriptor[accessType]) { - throw new Error( - getErrorMsg( - 'Property ' + - propertyName + - ' does not have access type ' + - accessType - ) - ); - } - - if (j$.isSpy(descriptor[accessType])) { - if (this.respy) { - return descriptor[accessType]; - } else { - throw new Error( - getErrorMsg( - propertyName + '#' + accessType + ' has already been spied upon' - ) - ); - } - } - - var originalDescriptor = j$.util.clone(descriptor), - spy = createSpy(propertyName, descriptor[accessType]), - restoreStrategy; - - if (Object.prototype.hasOwnProperty.call(obj, propertyName)) { - restoreStrategy = function() { - Object.defineProperty(obj, propertyName, originalDescriptor); - }; - } else { - restoreStrategy = function() { - delete obj[propertyName]; - }; - } - - currentSpies().push({ - restoreObjectToOriginalState: restoreStrategy - }); - - descriptor[accessType] = spy; - - Object.defineProperty(obj, propertyName, descriptor); - - return spy; - }; - - this.spyOnAllFunctions = function(obj, includeNonEnumerable) { - if (j$.util.isUndefined(obj)) { - throw new Error( - 'spyOnAllFunctions could not find an object to spy upon' - ); - } - - var pointer = obj, - propsToSpyOn = [], - properties, - propertiesToSkip = []; - - while ( - pointer && - (!includeNonEnumerable || pointer !== Object.prototype) - ) { - properties = getProps(pointer, includeNonEnumerable); - properties = properties.filter(function(prop) { - return propertiesToSkip.indexOf(prop) === -1; - }); - propertiesToSkip = propertiesToSkip.concat(properties); - propsToSpyOn = propsToSpyOn.concat( - getSpyableFunctionProps(pointer, properties) - ); - pointer = Object.getPrototypeOf(pointer); - } - - for (var i = 0; i < propsToSpyOn.length; i++) { - this.spyOn(obj, propsToSpyOn[i]); - } - - return obj; - }; - - this.clearSpies = function() { - var spies = currentSpies(); - for (var i = spies.length - 1; i >= 0; i--) { - var spyEntry = spies[i]; - spyEntry.restoreObjectToOriginalState(); - } - }; - } - - function getProps(obj, includeNonEnumerable) { - var enumerableProperties = Object.keys(obj); - - if (!includeNonEnumerable) { - return enumerableProperties; - } - - return Object.getOwnPropertyNames(obj).filter(function(prop) { - return ( - prop !== 'constructor' || - enumerableProperties.indexOf('constructor') > -1 - ); - }); - } - - function getSpyableFunctionProps(obj, propertiesToCheck) { - var props = [], - prop; - for (var i = 0; i < propertiesToCheck.length; i++) { - prop = propertiesToCheck[i]; - if ( - Object.prototype.hasOwnProperty.call(obj, prop) && - isSpyableProp(obj, prop) - ) { - props.push(prop); - } - } - return props; - } - - function isSpyableProp(obj, prop) { - var value, descriptor; - try { - value = obj[prop]; - } catch (e) { - return false; - } - if (value instanceof Function) { - descriptor = Object.getOwnPropertyDescriptor(obj, prop); - return (descriptor.writable || descriptor.set) && descriptor.configurable; - } - return false; - } - - return SpyRegistry; -}; - -getJasmineRequireObj().SpyStrategy = function(j$) { - /** - * @interface SpyStrategy - */ - function SpyStrategy(options) { - options = options || {}; - - var self = this; - - /** - * Get the identifying information for the spy. - * @name SpyStrategy#identity - * @since 3.0.0 - * @member - * @type {String} - */ - this.identity = options.name || 'unknown'; - this.originalFn = options.fn || function() {}; - this.getSpy = options.getSpy || function() {}; - this.plan = this._defaultPlan = function() {}; - - var k, - cs = options.customStrategies || {}; - for (k in cs) { - if (j$.util.has(cs, k) && !this[k]) { - this[k] = createCustomPlan(cs[k]); - } - } - - var getPromise = - typeof options.getPromise === 'function' - ? options.getPromise - : function() {}; - - var requirePromise = function(name) { - var Promise = getPromise(); - - if (!Promise) { - throw new Error( - name + - ' requires global Promise, or `Promise` configured with `jasmine.getEnv().configure()`' - ); - } - - return Promise; - }; - - /** - * Tell the spy to return a promise resolving to the specified value when invoked. - * @name SpyStrategy#resolveTo - * @since 3.5.0 - * @function - * @param {*} value The value to return. - */ - this.resolveTo = function(value) { - var Promise = requirePromise('resolveTo'); - self.plan = function() { - return Promise.resolve(value); - }; - return self.getSpy(); - }; - - /** - * Tell the spy to return a promise rejecting with the specified value when invoked. - * @name SpyStrategy#rejectWith - * @since 3.5.0 - * @function - * @param {*} value The value to return. - */ - this.rejectWith = function(value) { - var Promise = requirePromise('rejectWith'); - - self.plan = function() { - return Promise.reject(value); - }; - return self.getSpy(); - }; - } - - function createCustomPlan(factory) { - return function() { - var plan = factory.apply(null, arguments); - - if (!j$.isFunction_(plan)) { - throw new Error('Spy strategy must return a function'); - } - - this.plan = plan; - return this.getSpy(); - }; - } - - /** - * Execute the current spy strategy. - * @name SpyStrategy#exec - * @since 2.0.0 - * @function - */ - SpyStrategy.prototype.exec = function(context, args, invokeNew) { - var contextArgs = [context].concat( - args ? Array.prototype.slice.call(args) : [] - ); - var target = this.plan.bind.apply(this.plan, contextArgs); - - return invokeNew ? new target() : target(); - }; - - /** - * Tell the spy to call through to the real implementation when invoked. - * @name SpyStrategy#callThrough - * @since 2.0.0 - * @function - */ - SpyStrategy.prototype.callThrough = function() { - this.plan = this.originalFn; - return this.getSpy(); - }; - - /** - * Tell the spy to return the value when invoked. - * @name SpyStrategy#returnValue - * @since 2.0.0 - * @function - * @param {*} value The value to return. - */ - SpyStrategy.prototype.returnValue = function(value) { - this.plan = function() { - return value; - }; - return this.getSpy(); - }; - - /** - * Tell the spy to return one of the specified values (sequentially) each time the spy is invoked. - * @name SpyStrategy#returnValues - * @since 2.1.0 - * @function - * @param {...*} values - Values to be returned on subsequent calls to the spy. - */ - SpyStrategy.prototype.returnValues = function() { - var values = Array.prototype.slice.call(arguments); - this.plan = function() { - return values.shift(); - }; - return this.getSpy(); - }; - - /** - * Tell the spy to throw an error when invoked. - * @name SpyStrategy#throwError - * @since 2.0.0 - * @function - * @param {Error|Object|String} something Thing to throw - */ - SpyStrategy.prototype.throwError = function(something) { - var error = j$.isString_(something) ? new Error(something) : something; - this.plan = function() { - throw error; - }; - return this.getSpy(); - }; - - /** - * Tell the spy to call a fake implementation when invoked. - * @name SpyStrategy#callFake - * @since 2.0.0 - * @function - * @param {Function} fn The function to invoke with the passed parameters. - */ - SpyStrategy.prototype.callFake = function(fn) { - if ( - !( - j$.isFunction_(fn) || - j$.isAsyncFunction_(fn) || - j$.isGeneratorFunction_(fn) - ) - ) { - throw new Error( - 'Argument passed to callFake should be a function, got ' + fn - ); - } - this.plan = fn; - return this.getSpy(); - }; - - /** - * Tell the spy to do nothing when invoked. This is the default. - * @name SpyStrategy#stub - * @since 2.0.0 - * @function - */ - SpyStrategy.prototype.stub = function(fn) { - this.plan = function() {}; - return this.getSpy(); - }; - - SpyStrategy.prototype.isConfigured = function() { - return this.plan !== this._defaultPlan; - }; - - return SpyStrategy; -}; - -getJasmineRequireObj().StackTrace = function(j$) { - function StackTrace(error) { - var lines = error.stack.split('\n').filter(function(line) { - return line !== ''; - }); - - var extractResult = extractMessage(error.message, lines); - - if (extractResult) { - this.message = extractResult.message; - lines = extractResult.remainder; - } - - var parseResult = tryParseFrames(lines); - this.frames = parseResult.frames; - this.style = parseResult.style; - } - - var framePatterns = [ - // PhantomJS on Linux, Node, Chrome, IE, Edge - // e.g. " at QueueRunner.run (http://localhost:8888/__jasmine__/jasmine.js:4320:20)" - // Note that the "function name" can include a surprisingly large set of - // characters, including angle brackets and square brackets. - { - re: /^\s*at ([^\)]+) \(([^\)]+)\)$/, - fnIx: 1, - fileLineColIx: 2, - style: 'v8' - }, - - // NodeJS alternate form, often mixed in with the Chrome style - // e.g. " at /some/path:4320:20 - { re: /\s*at (.+)$/, fileLineColIx: 1, style: 'v8' }, - - // PhantomJS on OS X, Safari, Firefox - // e.g. "run@http://localhost:8888/__jasmine__/jasmine.js:4320:27" - // or "http://localhost:8888/__jasmine__/jasmine.js:4320:27" - { - re: /^(([^@\s]+)@)?([^\s]+)$/, - fnIx: 2, - fileLineColIx: 3, - style: 'webkit' - } - ]; - - // regexes should capture the function name (if any) as group 1 - // and the file, line, and column as group 2. - function tryParseFrames(lines) { - var style = null; - var frames = lines.map(function(line) { - var convertedLine = first(framePatterns, function(pattern) { - var overallMatch = line.match(pattern.re), - fileLineColMatch; - if (!overallMatch) { - return null; - } - - fileLineColMatch = overallMatch[pattern.fileLineColIx].match( - /^(.*):(\d+):\d+$/ - ); - if (!fileLineColMatch) { - return null; - } - - style = style || pattern.style; - return { - raw: line, - file: fileLineColMatch[1], - line: parseInt(fileLineColMatch[2], 10), - func: overallMatch[pattern.fnIx] - }; - }); - - return convertedLine || { raw: line }; - }); - - return { - style: style, - frames: frames - }; - } - - function first(items, fn) { - var i, result; - - for (i = 0; i < items.length; i++) { - result = fn(items[i]); - - if (result) { - return result; - } - } - } - - function extractMessage(message, stackLines) { - var len = messagePrefixLength(message, stackLines); - - if (len > 0) { - return { - message: stackLines.slice(0, len).join('\n'), - remainder: stackLines.slice(len) - }; - } - } - - function messagePrefixLength(message, stackLines) { - if (!stackLines[0].match(/^\w*Error/)) { - return 0; - } - - var messageLines = message.split('\n'); - var i; - - for (i = 1; i < messageLines.length; i++) { - if (messageLines[i] !== stackLines[i]) { - return 0; - } - } - - return messageLines.length; - } - - return StackTrace; -}; - -getJasmineRequireObj().Suite = function(j$) { - /** - * @interface Suite - * @see Env#topSuite - */ - function Suite(attrs) { - this.env = attrs.env; - /** - * The unique ID of this suite. - * @name Suite#id - * @readonly - * @type {string} - */ - this.id = attrs.id; - /** - * The parent of this suite, or null if this is the top suite. - * @name Suite#parentSuite - * @readonly - * @type {Suite} - */ - this.parentSuite = attrs.parentSuite; - /** - * The description passed to the {@link describe} that created this suite. - * @name Suite#description - * @readonly - * @type {string} - */ - this.description = attrs.description; - this.expectationFactory = attrs.expectationFactory; - this.asyncExpectationFactory = attrs.asyncExpectationFactory; - this.expectationResultFactory = attrs.expectationResultFactory; - this.throwOnExpectationFailure = !!attrs.throwOnExpectationFailure; - - this.beforeFns = []; - this.afterFns = []; - this.beforeAllFns = []; - this.afterAllFns = []; - - this.timer = attrs.timer || new j$.Timer(); - - /** - * The suite's children. - * @name Suite#children - * @type {Array.<(Spec|Suite)>} - */ - this.children = []; - - /** - * @typedef SuiteResult - * @property {Int} id - The unique id of this suite. - * @property {String} description - The description text passed to the {@link describe} that made this suite. - * @property {String} fullName - The full description including all ancestors of this suite. - * @property {Expectation[]} failedExpectations - The list of expectations that failed in an {@link afterAll} for this suite. - * @property {Expectation[]} deprecationWarnings - The list of deprecation warnings that occurred on this suite. - * @property {String} status - Once the suite has completed, this string represents the pass/fail status of this suite. - * @property {number} duration - The time in ms for Suite execution, including any before/afterAll, before/afterEach. - * @property {Object} properties - User-supplied properties, if any, that were set using {@link Env#setSuiteProperty} - */ - this.result = { - id: this.id, - description: this.description, - fullName: this.getFullName(), - failedExpectations: [], - deprecationWarnings: [], - duration: null, - properties: null - }; - } - - Suite.prototype.setSuiteProperty = function(key, value) { - this.result.properties = this.result.properties || {}; - this.result.properties[key] = value; - }; - - Suite.prototype.expect = function(actual) { - return this.expectationFactory(actual, this); - }; - - Suite.prototype.expectAsync = function(actual) { - return this.asyncExpectationFactory(actual, this); - }; - - /** - * The full description including all ancestors of this suite. - * @name Suite#getFullName - * @function - * @returns {string} - */ - Suite.prototype.getFullName = function() { - var fullName = []; - for ( - var parentSuite = this; - parentSuite; - parentSuite = parentSuite.parentSuite - ) { - if (parentSuite.parentSuite) { - fullName.unshift(parentSuite.description); - } - } - return fullName.join(' '); - }; - - Suite.prototype.pend = function() { - this.markedPending = true; - }; - - Suite.prototype.beforeEach = function(fn) { - this.beforeFns.unshift(fn); - }; - - Suite.prototype.beforeAll = function(fn) { - this.beforeAllFns.push(fn); - }; - - Suite.prototype.afterEach = function(fn) { - this.afterFns.unshift(fn); - }; - - Suite.prototype.afterAll = function(fn) { - this.afterAllFns.unshift(fn); - }; - - Suite.prototype.startTimer = function() { - this.timer.start(); - }; - - Suite.prototype.endTimer = function() { - this.result.duration = this.timer.elapsed(); - }; - - function removeFns(queueableFns) { - for (var i = 0; i < queueableFns.length; i++) { - queueableFns[i].fn = null; - } - } - - Suite.prototype.cleanupBeforeAfter = function() { - removeFns(this.beforeAllFns); - removeFns(this.afterAllFns); - removeFns(this.beforeFns); - removeFns(this.afterFns); - }; - - Suite.prototype.addChild = function(child) { - this.children.push(child); - }; - - Suite.prototype.status = function() { - if (this.markedPending) { - return 'pending'; - } - - if (this.result.failedExpectations.length > 0) { - return 'failed'; - } else { - return 'passed'; - } - }; - - Suite.prototype.canBeReentered = function() { - return this.beforeAllFns.length === 0 && this.afterAllFns.length === 0; - }; - - Suite.prototype.getResult = function() { - this.result.status = this.status(); - return this.result; - }; - - Suite.prototype.sharedUserContext = function() { - if (!this.sharedContext) { - this.sharedContext = this.parentSuite - ? this.parentSuite.clonedSharedUserContext() - : new j$.UserContext(); - } - - return this.sharedContext; - }; - - Suite.prototype.clonedSharedUserContext = function() { - return j$.UserContext.fromExisting(this.sharedUserContext()); - }; - - Suite.prototype.onException = function() { - if (arguments[0] instanceof j$.errors.ExpectationFailed) { - return; - } - - var data = { - matcherName: '', - passed: false, - expected: '', - actual: '', - error: arguments[0] - }; - var failedExpectation = this.expectationResultFactory(data); - - if (!this.parentSuite) { - failedExpectation.globalErrorType = 'afterAll'; - } - - this.result.failedExpectations.push(failedExpectation); - }; - - Suite.prototype.addExpectationResult = function() { - if (isFailure(arguments)) { - var data = arguments[1]; - this.result.failedExpectations.push(this.expectationResultFactory(data)); - if (this.throwOnExpectationFailure) { - throw new j$.errors.ExpectationFailed(); - } - } - }; - - Suite.prototype.addDeprecationWarning = function(deprecation) { - if (typeof deprecation === 'string') { - deprecation = { message: deprecation }; - } - this.result.deprecationWarnings.push( - this.expectationResultFactory(deprecation) - ); - }; - - function isFailure(args) { - return !args[0]; - } - - return Suite; -}; - -if (typeof window == void 0 && typeof exports == 'object') { - /* globals exports */ - exports.Suite = jasmineRequire.Suite; -} - -getJasmineRequireObj().Timer = function() { - var defaultNow = (function(Date) { - return function() { - return new Date().getTime(); - }; - })(Date); - - function Timer(options) { - options = options || {}; - - var now = options.now || defaultNow, - startTime; - - this.start = function() { - startTime = now(); - }; - - this.elapsed = function() { - return now() - startTime; - }; - } - - return Timer; -}; - -getJasmineRequireObj().TreeProcessor = function() { - function TreeProcessor(attrs) { - var tree = attrs.tree, - runnableIds = attrs.runnableIds, - queueRunnerFactory = attrs.queueRunnerFactory, - nodeStart = attrs.nodeStart || function() {}, - nodeComplete = attrs.nodeComplete || function() {}, - failSpecWithNoExpectations = !!attrs.failSpecWithNoExpectations, - orderChildren = - attrs.orderChildren || - function(node) { - return node.children; - }, - excludeNode = - attrs.excludeNode || - function(node) { - return false; - }, - stats = { valid: true }, - processed = false, - defaultMin = Infinity, - defaultMax = 1 - Infinity; - - this.processTree = function() { - processNode(tree, true); - processed = true; - return stats; - }; - - this.execute = function(done) { - if (!processed) { - this.processTree(); - } - - if (!stats.valid) { - throw 'invalid order'; - } - - var childFns = wrapChildren(tree, 0); - - queueRunnerFactory({ - queueableFns: childFns, - userContext: tree.sharedUserContext(), - onException: function() { - tree.onException.apply(tree, arguments); - }, - onComplete: done - }); - }; - - function runnableIndex(id) { - for (var i = 0; i < runnableIds.length; i++) { - if (runnableIds[i] === id) { - return i; - } - } - } - - function processNode(node, parentExcluded) { - var executableIndex = runnableIndex(node.id); - - if (executableIndex !== undefined) { - parentExcluded = false; - } - - if (!node.children) { - var excluded = parentExcluded || excludeNode(node); - stats[node.id] = { - excluded: excluded, - willExecute: !excluded && !node.markedPending, - segments: [ - { - index: 0, - owner: node, - nodes: [node], - min: startingMin(executableIndex), - max: startingMax(executableIndex) - } - ] - }; - } else { - var hasExecutableChild = false; - - var orderedChildren = orderChildren(node); - - for (var i = 0; i < orderedChildren.length; i++) { - var child = orderedChildren[i]; - - processNode(child, parentExcluded); - - if (!stats.valid) { - return; - } - - var childStats = stats[child.id]; - - hasExecutableChild = hasExecutableChild || childStats.willExecute; - } - - stats[node.id] = { - excluded: parentExcluded, - willExecute: hasExecutableChild - }; - - segmentChildren(node, orderedChildren, stats[node.id], executableIndex); - - if (!node.canBeReentered() && stats[node.id].segments.length > 1) { - stats = { valid: false }; - } - } - } - - function startingMin(executableIndex) { - return executableIndex === undefined ? defaultMin : executableIndex; - } - - function startingMax(executableIndex) { - return executableIndex === undefined ? defaultMax : executableIndex; - } - - function segmentChildren( - node, - orderedChildren, - nodeStats, - executableIndex - ) { - var currentSegment = { - index: 0, - owner: node, - nodes: [], - min: startingMin(executableIndex), - max: startingMax(executableIndex) - }, - result = [currentSegment], - lastMax = defaultMax, - orderedChildSegments = orderChildSegments(orderedChildren); - - function isSegmentBoundary(minIndex) { - return ( - lastMax !== defaultMax && - minIndex !== defaultMin && - lastMax < minIndex - 1 - ); - } - - for (var i = 0; i < orderedChildSegments.length; i++) { - var childSegment = orderedChildSegments[i], - maxIndex = childSegment.max, - minIndex = childSegment.min; - - if (isSegmentBoundary(minIndex)) { - currentSegment = { - index: result.length, - owner: node, - nodes: [], - min: defaultMin, - max: defaultMax - }; - result.push(currentSegment); - } - - currentSegment.nodes.push(childSegment); - currentSegment.min = Math.min(currentSegment.min, minIndex); - currentSegment.max = Math.max(currentSegment.max, maxIndex); - lastMax = maxIndex; - } - - nodeStats.segments = result; - } - - function orderChildSegments(children) { - var specifiedOrder = [], - unspecifiedOrder = []; - - for (var i = 0; i < children.length; i++) { - var child = children[i], - segments = stats[child.id].segments; - - for (var j = 0; j < segments.length; j++) { - var seg = segments[j]; - - if (seg.min === defaultMin) { - unspecifiedOrder.push(seg); - } else { - specifiedOrder.push(seg); - } - } - } - - specifiedOrder.sort(function(a, b) { - return a.min - b.min; - }); - - return specifiedOrder.concat(unspecifiedOrder); - } - - function executeNode(node, segmentNumber) { - if (node.children) { - return { - fn: function(done) { - var onStart = { - fn: function(next) { - nodeStart(node, next); - } - }; - - queueRunnerFactory({ - onComplete: function() { - var args = Array.prototype.slice.call(arguments, [0]); - node.cleanupBeforeAfter(); - nodeComplete(node, node.getResult(), function() { - done.apply(undefined, args); - }); - }, - queueableFns: [onStart].concat(wrapChildren(node, segmentNumber)), - userContext: node.sharedUserContext(), - onException: function() { - node.onException.apply(node, arguments); - } - }); - } - }; - } else { - return { - fn: function(done) { - node.execute( - done, - stats[node.id].excluded, - failSpecWithNoExpectations - ); - } - }; - } - } - - function wrapChildren(node, segmentNumber) { - var result = [], - segmentChildren = stats[node.id].segments[segmentNumber].nodes; - - for (var i = 0; i < segmentChildren.length; i++) { - result.push( - executeNode(segmentChildren[i].owner, segmentChildren[i].index) - ); - } - - if (!stats[node.id].willExecute) { - return result; - } - - return node.beforeAllFns.concat(result).concat(node.afterAllFns); - } - } - - return TreeProcessor; -}; - -getJasmineRequireObj().UserContext = function(j$) { - function UserContext() {} - - UserContext.fromExisting = function(oldContext) { - var context = new UserContext(); - - for (var prop in oldContext) { - if (oldContext.hasOwnProperty(prop)) { - context[prop] = oldContext[prop]; - } - } - - return context; - }; - - return UserContext; -}; - -getJasmineRequireObj().version = function() { - return '3.9.0'; -}; diff --git a/src/test/resources/libraries/jasmine/jasmine_3.9.0/smoketest.html b/src/test/resources/libraries/jasmine/jasmine_3.9.0/smoketest.html deleted file mode 100644 index 86abca9984a..00000000000 --- a/src/test/resources/libraries/jasmine/jasmine_3.9.0/smoketest.html +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - -