├── doc ├── rewrite-timings1.png ├── rewrite-timings2.png └── intro.md ├── index.html ├── src ├── cljs │ └── combinator │ │ ├── macros.clj │ │ ├── core.cljs │ │ ├── evaluate.cljs │ │ └── zip.cljs └── clj │ └── combinator │ ├── core.clj │ └── zip.clj ├── .gitignore ├── test └── combinator │ └── core_test.clj ├── project.clj ├── out ├── constants_table.js └── combinator │ ├── evaluate.js │ ├── core.js │ └── zip.js ├── README.md └── combinator.js /doc/rewrite-timings1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kovasb/combinator/HEAD/doc/rewrite-timings1.png -------------------------------------------------------------------------------- /doc/rewrite-timings2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kovasb/combinator/HEAD/doc/rewrite-timings2.png -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /doc/intro.md: -------------------------------------------------------------------------------- 1 | # Introduction to combinator 2 | 3 | TODO: write [great documentation](http://jacobian.org/writing/great-documentation/what-to-write/) 4 | -------------------------------------------------------------------------------- /src/cljs/combinator/macros.clj: -------------------------------------------------------------------------------- 1 | (ns combinator.macros) 2 | 3 | 4 | 5 | (defmacro timing [x] 6 | `(do 7 | (println ~x) 8 | ~x 9 | ~x 10 | ~x 11 | (time ~x))) 12 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | /lib 3 | /classes 4 | /checkouts 5 | pom.xml 6 | pom.xml.asc 7 | *.jar 8 | *.class 9 | .lein-deps-sum 10 | .lein-failures 11 | .lein-plugins 12 | .lein-repl-history 13 | .nrepl-port 14 | -------------------------------------------------------------------------------- /test/combinator/core_test.clj: -------------------------------------------------------------------------------- 1 | (ns combinator.core-test 2 | (:require [clojure.test :refer :all] 3 | [combinator.core :refer :all])) 4 | 5 | (deftest a-test 6 | (testing "FIXME, I fail." 7 | (is (= 0 1)))) 8 | -------------------------------------------------------------------------------- /src/cljs/combinator/core.cljs: -------------------------------------------------------------------------------- 1 | (ns combinator.core 2 | (:require-macros [combinator.macros :as m]) 3 | (:require [combinator.evaluate :as e] 4 | [combinator.zip :as z])) 5 | 6 | (defn js-print [& args] 7 | (if (js* "typeof console != 'undefined'") 8 | (.log js/console (apply str args)) 9 | (js/print (apply str args)))) 10 | 11 | (set! *print-fn* js-print) 12 | 13 | (defn result [n] 14 | (loop [i 0 term '(((:e ((:e :e) :e)) :e) :e)] 15 | (if-not (> i n) 16 | (recur (inc i) (e/replace-all term e/sample-combinator)) 17 | term))) 18 | 19 | (println (result 300)) 20 | 21 | (dotimes [_ 20] 22 | (time (result 300))) 23 | 24 | ;; median timing is 240msec 25 | -------------------------------------------------------------------------------- /src/cljs/combinator/evaluate.cljs: -------------------------------------------------------------------------------- 1 | (ns combinator.evaluate 2 | (:require [combinator.zip :as z])) 3 | 4 | 5 | (defn replace-all [init rulefn] 6 | (loop [node (z/vector-zip init)] 7 | (if (z/end? node) 8 | (z/node node) 9 | (if-let [m (rulefn (z/node node))] 10 | (let [new (z/replace node m)] 11 | (if-let [r (z/right new)] 12 | (recur r) 13 | (z/root new))) 14 | (recur (z/next node)))))) 15 | 16 | 17 | 18 | (def sample-combinator 19 | (fn [x] 20 | (if (seq? x) 21 | (let [l1 (first x)] 22 | (if (seq? l1) 23 | (if (keyword-identical? :e (first l1)) 24 | (let [xr (second l1) yr (second x)] 25 | (list (list xr (list :e yr) ) xr ) ;[[xr [:e yr]] xr] 26 | ) 27 | false) 28 | false)) 29 | false))) 30 | -------------------------------------------------------------------------------- /project.clj: -------------------------------------------------------------------------------- 1 | (defproject combinator "0.1.0-SNAPSHOT" 2 | :description "FIXME: write description" 3 | :url "http://example.com/FIXME" 4 | :license {:name "Eclipse Public License" 5 | :url "http://www.eclipse.org/legal/epl-v10.html"} 6 | :jvm-opts ^:replace ["-server" "-Xmx1G"] 7 | :dependencies [ 8 | [org.clojure/clojure "1.5.1"] 9 | [fast-zip "0.3.0"] 10 | [clj-tuple "0.1.3-SNAPSHOT"] 11 | [criterium "0.4.2"] 12 | [org.clojure/clojurescript "0.0-2030"] 13 | 14 | ] 15 | :source-paths ["src/clj"] 16 | :cljsbuild 17 | { 18 | :builds [{ 19 | :id "combinator" 20 | ;; The path to the top-level ClojureScript source directory: 21 | :source-paths ["src/cljs"] 22 | ;; The standard ClojureScript compiler options: 23 | ;; (See the ClojureScript compiler documentation for details.) 24 | :compiler {:output-dir "out" 25 | :output-to "combinator.js" 26 | :static-fns true 27 | :optimizations :advanced}}]} 28 | 29 | :plugins [[lein-cljsbuild "1.0.0-alpha2"]]) 30 | -------------------------------------------------------------------------------- /out/constants_table.js: -------------------------------------------------------------------------------- 1 | cljs.core.constant$keyword$5 = new cljs.core.Keyword(null,"dup","dup"); 2 | cljs.core.constant$keyword$17 = new cljs.core.Keyword(null,"r","r"); 3 | cljs.core.constant$keyword$13 = new cljs.core.Keyword(null,"descendants","descendants"); 4 | cljs.core.constant$keyword$11 = new cljs.core.Keyword(null,"keywordize-keys","keywordize-keys"); 5 | cljs.core.constant$keyword$18 = new cljs.core.Keyword(null,"changed?","changed?"); 6 | cljs.core.constant$keyword$12 = new cljs.core.Keyword(null,"parents","parents"); 7 | cljs.core.constant$keyword$2 = new cljs.core.Keyword(null,"flush-on-newline","flush-on-newline"); 8 | cljs.core.constant$keyword$15 = new cljs.core.Keyword(null,"end","end"); 9 | cljs.core.constant$keyword$1 = new cljs.core.Keyword(null,"extending-base-js-type","extending-base-js-type"); 10 | cljs.core.constant$keyword$19 = new cljs.core.Keyword(null,"e","e"); 11 | cljs.core.constant$keyword$16 = new cljs.core.Keyword(null,"l","l"); 12 | cljs.core.constant$keyword$14 = new cljs.core.Keyword(null,"ancestors","ancestors"); 13 | cljs.core.constant$keyword$9 = new cljs.core.Keyword(null,"done","done"); 14 | cljs.core.constant$keyword$6 = new cljs.core.Keyword(null,"else","else"); 15 | cljs.core.constant$keyword$7 = new cljs.core.Keyword("cljs.core","not-found","cljs.core/not-found"); 16 | cljs.core.constant$keyword$3 = new cljs.core.Keyword(null,"readably","readably"); 17 | cljs.core.constant$keyword$8 = new cljs.core.Keyword(null,"validator","validator"); 18 | cljs.core.constant$keyword$4 = new cljs.core.Keyword(null,"meta","meta"); 19 | cljs.core.constant$keyword$10 = new cljs.core.Keyword(null,"value","value"); 20 | -------------------------------------------------------------------------------- /out/combinator/evaluate.js: -------------------------------------------------------------------------------- 1 | // Compiled by ClojureScript 0.0-2030 2 | goog.provide('combinator.evaluate'); 3 | goog.require('cljs.core'); 4 | goog.require('combinator.zip'); 5 | goog.require('combinator.zip'); 6 | combinator.evaluate.replace_all = (function replace_all(init,rulefn){var node = combinator.zip.vector_zip(init);while(true){ 7 | if(cljs.core.truth_(combinator.zip.end_QMARK_(node))) 8 | {return combinator.zip.node(node); 9 | } else 10 | {var temp__4090__auto__ = (rulefn.cljs$core$IFn$_invoke$arity$1 ? rulefn.cljs$core$IFn$_invoke$arity$1(combinator.zip.node(node)) : rulefn.call(null,combinator.zip.node(node)));if(cljs.core.truth_(temp__4090__auto__)) 11 | {var m = temp__4090__auto__;var new$ = combinator.zip.replace(node,m);var temp__4090__auto____$1 = combinator.zip.right(new$);if(cljs.core.truth_(temp__4090__auto____$1)) 12 | {var r = temp__4090__auto____$1;{ 13 | var G__4877 = r; 14 | node = G__4877; 15 | continue; 16 | } 17 | } else 18 | {return combinator.zip.root(new$); 19 | } 20 | } else 21 | {{ 22 | var G__4878 = combinator.zip.next(node); 23 | node = G__4878; 24 | continue; 25 | } 26 | } 27 | } 28 | break; 29 | } 30 | }); 31 | combinator.evaluate.sample_combinator = (function sample_combinator(x){if(cljs.core.seq_QMARK_(x)) 32 | {var l1 = cljs.core.first(x);if(cljs.core.seq_QMARK_(l1)) 33 | {if(cljs.core.keyword_identical_QMARK_(cljs.core.constant$keyword$19,cljs.core.first(l1))) 34 | {var xr = cljs.core.second(l1);var yr = cljs.core.second(x);return cljs.core._conj(cljs.core._conj(cljs.core.List.EMPTY,xr),cljs.core._conj(cljs.core._conj(cljs.core.List.EMPTY,cljs.core._conj(cljs.core._conj(cljs.core.List.EMPTY,yr),cljs.core.constant$keyword$19)),xr)); 35 | } else 36 | {return false; 37 | } 38 | } else 39 | {return false; 40 | } 41 | } else 42 | {return false; 43 | } 44 | }); 45 | -------------------------------------------------------------------------------- /out/combinator/core.js: -------------------------------------------------------------------------------- 1 | // Compiled by ClojureScript 0.0-2030 2 | goog.provide('combinator.core'); 3 | goog.require('cljs.core'); 4 | goog.require('combinator.zip'); 5 | goog.require('combinator.zip'); 6 | goog.require('combinator.evaluate'); 7 | goog.require('combinator.evaluate'); 8 | /** 9 | * @param {...*} var_args 10 | */ 11 | combinator.core.js_print = (function() { 12 | var js_print__delegate = function (args){if(cljs.core.truth_(typeof console != 'undefined')) 13 | {return console.log(cljs.core.apply.cljs$core$IFn$_invoke$arity$2(cljs.core.str,args)); 14 | } else 15 | {return print(cljs.core.apply.cljs$core$IFn$_invoke$arity$2(cljs.core.str,args)); 16 | } 17 | }; 18 | var js_print = function (var_args){ 19 | var args = null;if (arguments.length > 0) { 20 | args = cljs.core.array_seq(Array.prototype.slice.call(arguments, 0),0);} 21 | return js_print__delegate.call(this,args);}; 22 | js_print.cljs$lang$maxFixedArity = 0; 23 | js_print.cljs$lang$applyTo = (function (arglist__4869){ 24 | var args = cljs.core.seq(arglist__4869); 25 | return js_print__delegate(args); 26 | }); 27 | js_print.cljs$core$IFn$_invoke$arity$variadic = js_print__delegate; 28 | return js_print; 29 | })() 30 | ; 31 | cljs.core._STAR_print_fn_STAR_ = combinator.core.js_print; 32 | combinator.core.result = (function result(n){var i = 0;var term = cljs.core.list(cljs.core.list(cljs.core.list(cljs.core.constant$keyword$19,cljs.core.list(cljs.core.list(cljs.core.constant$keyword$19,cljs.core.constant$keyword$19),cljs.core.constant$keyword$19)),cljs.core.constant$keyword$19),cljs.core.constant$keyword$19);while(true){ 33 | if(!((i > n))) 34 | {{ 35 | var G__4870 = (i + 1); 36 | var G__4871 = combinator.evaluate.replace_all(term,combinator.evaluate.sample_combinator); 37 | i = G__4870; 38 | term = G__4871; 39 | continue; 40 | } 41 | } else 42 | {return term; 43 | } 44 | break; 45 | } 46 | }); 47 | cljs.core.println.cljs$core$IFn$_invoke$arity$variadic(cljs.core.array_seq([combinator.core.result(300)], 0)); 48 | var n__3937__auto___4872 = 20;var __4873 = 0;while(true){ 49 | if((__4873 < n__3937__auto___4872)) 50 | {var start__3962__auto___4874 = (new Date()).getTime();var ret__3963__auto___4875 = combinator.core.result(300);cljs.core.prn.cljs$core$IFn$_invoke$arity$variadic(cljs.core.array_seq([[cljs.core.str("Elapsed time: "),cljs.core.str(((new Date()).getTime() - start__3962__auto___4874)),cljs.core.str(" msecs")].join('')], 0)); 51 | { 52 | var G__4876 = (__4873 + 1); 53 | __4873 = G__4876; 54 | continue; 55 | } 56 | } else 57 | {} 58 | break; 59 | } 60 | -------------------------------------------------------------------------------- /src/clj/combinator/core.clj: -------------------------------------------------------------------------------- 1 | (ns combinator.core 2 | (:require [clojure.zip]) 3 | (:require [fast-zip.core :as fast-zip]) 4 | (:require [combinator.zip :as z])) 5 | 6 | 7 | 8 | 9 | (defn replace-all [init rulefn] 10 | (loop [node (z/zipper init)] 11 | (if (z/end? node) 12 | (z/node node) 13 | (if-let [m (rulefn (z/node node))] 14 | (let [new (z/replace node m)] 15 | (if-let [r (z/right new)] 16 | (recur r) 17 | (z/root new))) 18 | (recur (z/next node)))))) 19 | 20 | (defn replace-all-core-zip [init rulefn] 21 | (loop [node (clojure.zip/zipper seq? seq (fn [x y] y) init)] 22 | (if (clojure.zip/end? node) 23 | (clojure.zip/node node) 24 | (if-let [m (rulefn (clojure.zip/node node))] 25 | (let [new (clojure.zip/replace node m)] 26 | (if-let [r (clojure.zip/right new)] 27 | (recur r) 28 | (clojure.zip/root new))) 29 | (recur (clojure.zip/next node)))))) 30 | 31 | (defn replace-all-fast-zip [init rulefn] 32 | (loop [node (fast-zip/zipper seq? seq (fn [x y] y) init)] 33 | (if (fast-zip/end? node) 34 | (fast-zip/node node) 35 | (if-let [m (rulefn (fast-zip/node node))] 36 | (let [new (fast-zip/replace node m)] 37 | (if-let [r (fast-zip/right new)] 38 | (recur r) 39 | (fast-zip/root new))) 40 | (recur (fast-zip/next node)))))) 41 | 42 | 43 | (defn sample-combinator 44 | [x] 45 | (if (seq? x) 46 | (let [l1 (first x)] 47 | (if (seq? l1) 48 | (if (identical? :e (first l1)) 49 | (let [l1r (second l1)] (list (list l1r (list :e (second x))) l1r))))))) 50 | 51 | 52 | (defn ops-counting-combinator [x test-count-atom test-success-count-atom] 53 | (do 54 | (swap! test-count-atom + 1) 55 | (if (seq? x) 56 | (let [l1 (first x)] 57 | (if (seq? l1) 58 | (if (identical? :e (first l1)) 59 | (let [l1r (second l1)] 60 | (swap! test-success-count-atom + 1) 61 | (list (list l1r (list :e (second x))) l1r)))))))) 62 | 63 | 64 | 65 | (comment 66 | 67 | 68 | (use 'criterium.core) 69 | 70 | 71 | ;; make sure all zipper implementations give the same result 72 | 73 | (= 74 | (loop [i 0 term (list (list (list :e (list (list :e :e) :e)) :e) :e)] 75 | (if (> i 300) 76 | term 77 | (recur (+ 1 i) (replace-all-core-zip term sample-combinator)))) 78 | (loop [i 0 term (list (list (list :e (list (list :e :e) :e)) :e) :e)] 79 | (if (> i 300) 80 | term 81 | (recur (+ 1 i) (replace-all-fast-zip term sample-combinator)))) 82 | (loop [i 0 term (list (list (list :e (list (list :e :e) :e)) :e) :e)] 83 | (if (> i 300) 84 | term 85 | (recur (+ 1 i) (replace-all term sample-combinator))))) 86 | 87 | 88 | ;; determine number of operations performed 89 | 90 | (def counts-data 91 | (let [test-count (atom 0) test-success-count (atom 0) 92 | test-combinator (fn [x] (ops-counting-combinator x test-count test-success-count))] 93 | 94 | (loop [i 0 term (list (list (list :e (list (list :e :e) :e)) :e) :e)] 95 | (if (> i 300) 96 | {:term term :iterations @test-count :replacements @test-success-count } 97 | (recur (+ 1 i) (replace-all-core-zip term test-combinator)))))) 98 | 99 | (dissoc counts-data :term) 100 | 101 | ;; => {:iterations 1275981, :replacements 601} 102 | 103 | 104 | ;; e[x_][y_]->x[e[y]][x] 105 | ;; median mathematica timing w 20 trials = 452 msec 106 | 107 | 108 | ;; bench with clojure.zip 109 | 110 | (bench 111 | (loop [i 0 term (list (list (list :e (list (list :e :e) :e)) :e) :e)] 112 | (when-not (> i 300) 113 | (recur (+ 1 i) (replace-all-core-zip term sample-combinator))))) 114 | ;; Execution time mean : 2.001708 sec 115 | ;; Execution time std-deviation : 19.954785 ms 116 | ;;Execution time lower quantile : 1.974356 sec ( 2.5%) 117 | ;;Execution time upper quantile : 2.038739 sec (97.5%) 118 | ;; Overhead used : 2.001213 ns 119 | 120 | 121 | 122 | ;; bench with fast-zip 123 | 124 | (bench 125 | (loop [i 0 term (list (list (list :e (list (list :e :e) :e)) :e) :e)] 126 | (when-not (> i 300) 127 | (recur (+ 1 i) (replace-all-fast-zip term sample-combinator))))) 128 | ;; Execution time mean : 272.941419 ms 129 | ;; Execution time std-deviation : 2.047528 ms 130 | ;;Execution time lower quantile : 268.750873 ms ( 2.5%) 131 | ;;Execution time upper quantile : 276.424804 ms (97.5%) 132 | ;; Overhead used : 2.001213 ns 133 | 134 | 135 | 136 | ;; bench with combinator.zip 137 | 138 | (bench 139 | (loop [i 0 term (list (list (list :e (list (list :e :e) :e)) :e) :e)] 140 | (when-not (> i 300) 141 | (recur (+ 1 i) (replace-all term sample-combinator))))) 142 | ;; Execution time mean : 177.763342 ms 143 | ;; Execution time std-deviation : 1.402199 ms 144 | ;; Execution time lower quantile : 174.929998 ms ( 2.5%) 145 | ;; Execution time upper quantile : 180.029744 ms (97.5%) 146 | ;; Overhead used : 2.001213 ns 147 | 148 | 149 | ) 150 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # combinator 2 | 3 | This project is an experiment in fast term-rewriting in clojure. Its goal is to establish the upper bound on term-rewriting performance in clojure and clojurescript. 4 | 5 | 6 | # The combinator system 7 | 8 | For our benchmarks, we are using the simple combinator-like systems defined at https://www.wolframscience.com/nksonline/section-3.10 . 9 | 10 | These combinators iteratively rewrite a binary tree; each iteration is a pre-order traversal that performs all non-overlapping rewrites. 11 | 12 | The nodes in the binary tree consist of either the symbol constant e, or a node with two children that again satisfy the criteria. 13 | 14 | In Mathematica notation, these trees are expressed as 15 | 16 | ``` 17 | e ;; node consistent of single atomic element 18 | e[e] ;; node consisting of two atomic children 19 | e[e][e] ;; depth-3 tree, with e[e] as the left branch, and e as the right branch 20 | ``` 21 | 22 | The combinators themselves are expressed as rules like 23 | 24 | ``` 25 | e[x_][y_]->x[e[y]][x] 26 | ``` 27 | 28 | where x_ and y_ are wildcards that will match any subtree in those positions. 29 | 30 | ``` 31 | e[e][e] ;; matches rule 32 | e[e[e]][e] ;; matches rule 33 | e[e][e][e] ;; does not match 34 | ``` 35 | 36 | Different right-hand-sides of the rules will generate different behavior, in terms of the final result, the pattern of recursion, and ultimately patterns of memory access and method invocation. 37 | 38 | For the moment we are using only the sample combinator shown above, but a more rigorous test would enumerate all possible combinators up to a certain rhs tree size. 39 | 40 | Starting from the initial condition 41 | 42 | ``` 43 | e[e[e][e]][e][e] 44 | ``` 45 | 46 | the first three steps of evolution are 47 | 48 | ``` 49 | e[e][e][e[e]][e[e][e]][e] 50 | e[e[e]][e][e[e]][e[e[e]][e]][e] 51 | e[e][e[e]][e[e]][e[e]][e[e][e[e]][e[e]]][e] 52 | ``` 53 | 54 | # Representation and implementation in clojure 55 | 56 | In general, and for this rule in particular, the evolution will not reach a fixed-point. Therefore we cannot implement the combinator as a naive recursive function because it will never return. 57 | 58 | Furthermore, we cannot use a recursive function like clojure.walk to drive the traversal, because we will quickly blow the stack. 59 | 60 | Zippers are the ideal solution, and most of the work in this project is to optimize the zipper implementation. 61 | 62 | To represent the binary trees, we use seq'able datastructures. 63 | 64 | Thus, 65 | 66 | ``` 67 | e[e[e][e]][e][e] 68 | ``` 69 | 70 | is represented as 71 | 72 | ``` 73 | `(((:e ((:e :e) :e)) :e) :e) 74 | ``` 75 | 76 | To make the combinator rule as fast as possible, encode the rule in a low-level form 77 | 78 | ``` 79 | (defn sample-combinator 80 | [x] 81 | (if (seq? x) 82 | (let [l1 (first x)] 83 | (if (seq? l1) 84 | (if (identical? :e (first l1)) 85 | (let [l1r (second l1)] (list (list l1r (list :e (second x))) l1r))))))) 86 | ``` 87 | 88 | that checks the structure of an input against the desired structure of e[x_][y_] (equivalently, '((:e ?x) ?y) ), and returns a new tree if it succeeds. 89 | 90 | 91 | # Performance 92 | 93 | We evolve the sample combinator for 300 steps. The system used is a macbook pro with 2.3GHz intil core i7 . 94 | 95 | In Mathematica, this is expressed as 96 | 97 | ``` 98 | Nest[# /. e[x_][y_] -> x[e[y]][x] &, e[e[e][e]][e][e], 300] 99 | ``` 100 | 101 | The total evolution involves over 1.4 million operations of (rule attempt + navigate tree). The resulting tree has 10412 nodes, 5207 of which are leaves. The serialized representation has 15619 characters. 102 | 103 | In clojure, we evolve the system with several zipper implementations: clojure.zip, fast-zip, and two versions of the optimized combinator.zip (for clojure and clojurescript) 104 | 105 |  106 | 107 |  108 | 109 | # Discussion 110 | 111 | The performance is excellent. These results show that the Clojure platform is a good substrate for implementing rewriting systems. 112 | 113 | Even just using fast-zip is significantly faster than Mathematica. The optimized implementations are nearly 3x faster for clojure, and 2x faster for clojurescript. This is very impressive, considering the equivalent operations in Mathematica are implemented in optimized C code. 114 | 115 | I tried many possible datastructures, but using seqs as the basis for the zipper was by far the fastest. 116 | 117 | Additional performance gains were achieved by 118 | 119 | - Manual cloning of records, instead of using assoc 120 | - Using custom tuples for the left side of the zipper 121 | - Using deftype instead of defrecord in the clojurescript version 122 | - Optimizations in the boolean logic operations in clojurescript 123 | 124 | Further optimizations are possible by taking advantage of traversal strategy, which should only ever call up from the rightmost child. 125 | 126 | # Further work 127 | 128 | A macro rule compiler would make it easy to benchmark with different combinator rules with different behavior. 129 | 130 | It would be very interested to benchmark this against systems like Maude, Stratego, ASF+SDF, OMeta, and K. Sample code and instructions to this effect is very welcome. 131 | 132 | # Thanks 133 | 134 | Special thanks to David Nolen for help optimizing the clojurescript version. 135 | 136 | 137 | -------------------------------------------------------------------------------- /src/clj/combinator/zip.clj: -------------------------------------------------------------------------------- 1 | ; Copyright (c) Rich Hickey. All rights reserved. 2 | ; The use and distribution terms for this software are covered by the 3 | ; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) 4 | ; which can be found in the file epl-v10.html at the root of this distribution. 5 | ; By using this software in any fashion, you are agreeing to be bound by 6 | ; the terms of this license. 7 | ; You must not remove this notice, or any other, from this software. 8 | 9 | ;functional hierarchical zipper, with navigation, editing and enumeration 10 | ;see Huet 11 | 12 | (ns 13 | combinator.zip 14 | (:refer-clojure :exclude (replace remove next)) 15 | (:use clj-tuple) 16 | ) 17 | 18 | (defrecord ZipperPath [l r ppath pnodes changed?]) 19 | 20 | (defrecord ZipperLocation [node path]) 21 | 22 | (defn zipper 23 | [root] 24 | (ZipperLocation. root nil)) 25 | 26 | 27 | 28 | 29 | (defn node 30 | "Returns the node at loc" 31 | [^ZipperLocation loc] 32 | (.node loc)) 33 | 34 | (defn branch? 35 | "Returns true if the node at loc is a branch" 36 | [^ZipperLocation loc] 37 | (seq? (.node loc))) 38 | 39 | (defn children 40 | "Returns a seq of the children of node at loc, which must be a branch" 41 | [^ZipperLocation loc] 42 | (.node loc)) 43 | 44 | (defn make-node 45 | "Returns a new branch node, given an existing node and new children. 46 | The loc is only used to supply the constructor." 47 | [^ZipperLocation loc node children] 48 | children) 49 | 50 | (defn path 51 | "Returns a seq of nodes leading to this loc" 52 | [^ZipperLocation loc] 53 | (.pnodes ^ZipperPath (.path loc))) 54 | 55 | (defn lefts 56 | "Returns a seq of the left siblings of this loc" 57 | [^ZipperLocation loc] 58 | (seq (.l ^ZipperPath (.path loc)))) 59 | 60 | (defn rights 61 | "Returns a seq of the right siblings of this loc" 62 | [^ZipperLocation loc] 63 | (.r ^ZipperPath (.path loc))) 64 | 65 | (defn down 66 | "Returns the loc of the leftmost child of the node at this loc, 67 | or nil if no children" 68 | [^ZipperLocation loc] 69 | (when (branch? loc) 70 | (when-let [cs (children loc)] 71 | (let [node (.node loc), path ^ZipperPath (.path loc)] 72 | (ZipperLocation. 73 | 74 | (first cs) 75 | (ZipperPath. (tuple) 76 | (clojure.core/next cs) 77 | path 78 | (if path 79 | (conj (.pnodes path) node) 80 | [node]) 81 | nil)))))) 82 | 83 | (comment (make-node loc 84 | pnode 85 | (concat 86 | (.l path) ;; should still be a vector 87 | (cons node 88 | (.r path))))) 89 | 90 | (defn up 91 | "Returns the loc of the parent of the node at this loc, or nil if at the top" 92 | [^ZipperLocation loc] 93 | (let [node (.node loc), path ^ZipperPath (.path loc)] 94 | (when-let [pnodes (and path (.pnodes path))] 95 | (let [pnode (peek pnodes)] 96 | (if (.changed? path) 97 | (ZipperLocation. 98 | ;;(conj (.l path) node) 99 | 100 | (concat 101 | (.l path) ;; should still be a vector 102 | (cons node 103 | (.r path))) 104 | 105 | (if-let [ppath ^ZipperPath (.ppath path)] 106 | (ZipperPath. 107 | (.l ppath) 108 | (.r ppath) 109 | (.ppath ppath) 110 | (.pnodes ppath) 111 | true))) 112 | (ZipperLocation. 113 | 114 | pnode 115 | (.ppath path))))))) 116 | 117 | (defn root 118 | "zips all the way up and returns the root node, reflecting any changes." 119 | [^ZipperLocation loc] 120 | (if (identical? :end (.path loc)) 121 | (.node loc) 122 | (let [p (up loc)] 123 | (if p 124 | (recur p) 125 | (.node loc))))) 126 | 127 | (defn right 128 | "Returns the loc of the right sibling of the node at this loc, or nil" 129 | [^ZipperLocation loc] 130 | (let [path ^ZipperPath (.path loc)] 131 | (when-let [r (and path (.r path))] 132 | (ZipperLocation. 133 | 134 | (first r) 135 | ; (defrecord ZipperPath [l r ppath pnodes changed?]) 136 | 137 | (ZipperPath. (conj (.l path) (.node loc)) 138 | (clojure.core/next r) 139 | (.ppath path) 140 | (.pnodes path) 141 | (.changed? path) 142 | ) 143 | ;(assoc path :l (conj (.l path) (.node loc)) :r (clojure.core/next r)) 144 | )))) 145 | 146 | (defn rightmost 147 | "Returns the loc of the rightmost sibling of the node at this loc, or self" 148 | [^ZipperLocation loc] 149 | (let [path ^ZipperPath (.path loc)] 150 | (if-let [r (and path (.r path))] 151 | (ZipperLocation. 152 | 153 | (last r) 154 | (assoc path :l (apply conj (.l path) (.node loc) (butlast r)) :r nil)) 155 | loc))) 156 | 157 | (defn left 158 | "Returns the loc of the left sibling of the node at this loc, or nil" 159 | [^ZipperLocation loc] 160 | (let [path ^ZipperPath (.path loc)] 161 | (when (and path (seq (.l path))) 162 | (ZipperLocation. 163 | 164 | (peek (.l path)) 165 | (assoc path :l (pop (.l path)) :r (cons (.node loc) (.r path))))))) 166 | 167 | (defn leftmost 168 | "Returns the loc of the leftmost sibling of the node at this loc, or self" 169 | [^ZipperLocation loc] 170 | (let [path ^ZipperPath (.path loc)] 171 | (if (and path (seq (.l path))) 172 | (ZipperLocation. 173 | 174 | (first (.l path)) 175 | (assoc path :l [] :r (concat (rest (.l path)) [(.node loc)] (.r path)))) 176 | loc))) 177 | 178 | (defn insert-left 179 | "Inserts the item as the left sibling of the node at this loc, without moving" 180 | [^ZipperLocation loc item] 181 | (if-let [path ^ZipperPath (.path loc)] 182 | (ZipperLocation. 183 | 184 | (.node loc) 185 | (assoc path :l (conj (.l path) item) :changed? true)) 186 | (throw (new Exception "Insert at top")))) 187 | 188 | (defn insert-right 189 | "Inserts the item as the right sibling of the node at this loc, without moving" 190 | [^ZipperLocation loc item] 191 | (if-let [path ^ZipperPath (.path loc)] 192 | (ZipperLocation. 193 | 194 | (.node loc) 195 | (assoc path :r (cons item (.r path)) :changed? true)) 196 | (throw (new Exception "Insert at top")))) 197 | 198 | (defn replace 199 | "Replaces the node at this loc, without moving" 200 | [^ZipperLocation loc node] 201 | (ZipperLocation. 202 | 203 | node 204 | (if-let [path ^ZipperPath (.path loc)] 205 | (ZipperPath. 206 | (.l path) 207 | (.r path) 208 | (.ppath path) 209 | (.pnodes path) 210 | true)))) 211 | 212 | (defn insert-child 213 | "Inserts the item as the leftmost child of the node at this loc, without moving" 214 | [^ZipperLocation loc item] 215 | (replace loc (make-node loc (.node loc) (cons item (children loc))))) 216 | 217 | (defn append-child 218 | "Inserts the item as the rightmost child of the node at this loc, without moving" 219 | [^ZipperLocation loc item] 220 | (replace loc (make-node loc (.node loc) (concat (children loc) [item])))) 221 | 222 | (defn next 223 | "Moves to the next loc in the hierarchy, depth-first. When reaching 224 | the end, returns a distinguished loc detectable via end?. If already 225 | at the end, stays there." 226 | [^ZipperLocation loc] 227 | (let [path (.path loc)] 228 | (if (identical? :end path) 229 | loc 230 | (or 231 | (and (branch? loc) (down loc)) 232 | (right loc) 233 | (loop [p loc] 234 | (if-let [u (up p)] 235 | (or (right u) (recur u)) 236 | (ZipperLocation. (.node p) :end))))))) 237 | 238 | (defn prev 239 | "Moves to the previous loc in the hierarchy, depth-first. If already at the root, returns nil." 240 | [loc] 241 | (if-let [lloc (left loc)] 242 | (loop [loc lloc] 243 | (if-let [child (and (branch? loc) (down loc))] 244 | (recur (rightmost child)) 245 | loc)) 246 | (up loc))) 247 | 248 | (defn end? 249 | "Returns true if loc represents the end of a depth-first walk" 250 | [^ZipperLocation loc] 251 | (identical? :end (.path loc))) 252 | 253 | (defn remove 254 | "Removes the node at loc, returning the loc that would have preceded it in a depth-first walk." 255 | [^ZipperLocation loc] 256 | (if-let [path ^ZipperPath (.path loc)] 257 | (if (pos? (count (.l path))) 258 | (loop [loc (ZipperLocation. 259 | 260 | (peek (.l path)) 261 | (assoc path :l (pop (.l path)) :changed? true))] 262 | (if-let [child (and (branch? loc) (down loc))] 263 | (recur (rightmost child)) 264 | loc)) 265 | (ZipperLocation. 266 | 267 | (make-node loc (peek (.pnodes path)) (.r path)) 268 | (if-let [ppath (.ppath path)] (and ppath (assoc ppath :changed? true))))) 269 | (throw (new Exception "Remove at top")))) 270 | 271 | (defn edit 272 | "Replaces the node at this loc with the value of (f node args)" 273 | [^ZipperLocation loc f & args] 274 | (replace loc (apply f (.node loc) args))) 275 | -------------------------------------------------------------------------------- /src/cljs/combinator/zip.cljs: -------------------------------------------------------------------------------- 1 | ; Copyright (c) Rich Hickey. All rights reserved. 2 | ; The use and distribution terms for this software are covered by the 3 | ; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) 4 | ; which can be found in the file epl-v10.html at the root of this distribution. 5 | ; By using this software in any fashion, you are agreeing to be bound by 6 | ; the terms of this license. 7 | ; You must not remove this notice, or any other, from this software. 8 | 9 | ;functional hierarchical zipper, with navigation, editing and enumeration 10 | ;see Huet 11 | 12 | (ns 13 | combinator.zip 14 | (:refer-clojure :exclude (replace remove next))) 15 | 16 | (declare Tuple1 Tuple2) 17 | 18 | (deftype Tuple0 [] 19 | ICollection 20 | (-conj [coll o] 21 | (Tuple1. o)) 22 | ISeqable 23 | (-seq [_] 24 | ())) 25 | 26 | (deftype Tuple1 [x] 27 | ICollection 28 | (-conj [coll o] 29 | (Tuple2. x o)) 30 | ISeqable 31 | (-seq [_] 32 | (prim-seq (array x)))) 33 | 34 | (deftype Tuple2 [x y] 35 | ICollection 36 | (-conj [coll o] 37 | [x y o]) 38 | ISeqable 39 | (-seq [_] 40 | (prim-seq (array x y)))) 41 | 42 | (deftype ZipperPath [l r ppath pnodes changed?]) 43 | 44 | (deftype ZipperLocation [node path]) 45 | 46 | (defn ^:export zipper 47 | "Creates a new zipper structure. 48 | 49 | branch? is a fn that, given a node, returns true if can have 50 | children, even if it currently doesn't. 51 | 52 | children is a fn that, given a branch node, returns a seq of its 53 | children. 54 | 55 | make-node is a fn that, given an existing node and a seq of 56 | children, returns a new branch node with the supplied children. 57 | root is the root node." 58 | {:added "1.0"} 59 | [root] 60 | (ZipperLocation. root nil)) 61 | 62 | 63 | 64 | (defn vector-zip 65 | "Returns a zipper for nested vectors, given a root vector" 66 | {:added "1.0"} 67 | [root] 68 | (zipper 69 | root)) 70 | 71 | 72 | 73 | (defn node 74 | "Returns the node at loc" 75 | [^ZipperLocation loc] 76 | (.-node loc)) 77 | 78 | (defn ^boolean branch? 79 | "Returns true if the node at loc is a branch" 80 | [^ZipperLocation loc] 81 | (seq? (.-node loc))) 82 | 83 | (defn children 84 | "Returns a seq of the children of node at loc, which must be a branch" 85 | [^ZipperLocation loc] 86 | (.-node loc)) 87 | 88 | (defn make-node 89 | "Returns a new branch node, given an existing node and new children. 90 | The loc is only used to supply the constructor." 91 | [^ZipperLocation loc node children] 92 | children) 93 | 94 | (defn path 95 | "Returns a seq of nodes leading to this loc" 96 | [^ZipperLocation loc] 97 | (.-pnodes ^ZipperPath (.-path loc))) 98 | 99 | (defn lefts 100 | "Returns a seq of the left siblings of this loc" 101 | [^ZipperLocation loc] 102 | (seq (.-l ^ZipperPath (.-path loc)))) 103 | 104 | (defn rights 105 | "Returns a seq of the right siblings of this loc" 106 | [^ZipperLocation loc] 107 | (.-r ^ZipperPath (.-path loc))) 108 | 109 | (defn down 110 | "Returns the loc of the leftmost child of the node at this loc, 111 | or nil if no children" 112 | [^ZipperLocation loc] 113 | (when (branch? loc) 114 | (when-let [cs (children loc)] 115 | (let [node (.-node loc), path ^ZipperPath (.-path loc)] 116 | (ZipperLocation. 117 | (first cs) 118 | (ZipperPath. 119 | (Tuple0.) 120 | (clojure.core/-next ^not-native cs) 121 | path 122 | (if path (-conj ^not-native (.-pnodes path) node) (list node)) nil)))))) 123 | 124 | (defn up 125 | "Returns the loc of the parent of the node at this loc, or nil if at the top" 126 | [^ZipperLocation loc] 127 | (let [node (.-node loc), path ^ZipperPath (.-path loc)] 128 | (when-let [pnodes (and path (.-pnodes path))] 129 | (let [pnode (peek pnodes)] 130 | (if (.-changed? path) 131 | (ZipperLocation. 132 | (make-node loc pnode (seq (into (.-l path) (cons node (.-r path))))) 133 | (if-let [ppath (.-ppath path)] 134 | (ZipperPath. (.-l ppath) (.-r ppath) (.-ppath ppath) (.-pnodes ppath) true))) 135 | (ZipperLocation. 136 | 137 | pnode 138 | (.-ppath path))))))) 139 | 140 | 141 | ; (deftype ZipperPath [l r ppath pnodes changed?]) 142 | 143 | 144 | 145 | (defn root 146 | "zips all the way up and returns the root node, reflecting any changes." 147 | [^ZipperLocation loc] 148 | (if (keyword-identical? :end (.-path loc)) 149 | (.-node loc) 150 | (let [p (up loc)] 151 | (if p 152 | (recur p) 153 | (.-node loc))))) 154 | 155 | (defn right 156 | "Returns the loc of the right sibling of the node at this loc, or nil" 157 | [^ZipperLocation loc] 158 | (let [path ^ZipperPath (.-path loc)] 159 | (when-let [r (and (not (nil? path)) (.-r path))] 160 | (let [^not-native r r] 161 | (ZipperLocation. 162 | (-first r) 163 | (ZipperPath. (-conj ^not-native (.-l path) (.-node loc)) 164 | (clojure.core/-next r) 165 | (.-ppath path) 166 | (.-pnodes path) 167 | (.-changed? path))))))) 168 | 169 | (defn rightmost 170 | "Returns the loc of the rightmost sibling of the node at this loc, or self" 171 | [^ZipperLocation loc] 172 | (let [path ^ZipperPath (.-path loc)] 173 | (if-let [r (and path (.-r path))] 174 | (ZipperLocation. 175 | 176 | (last r) 177 | (assoc path :l (apply conj (.-l path) (.-node loc) (butlast r)) :r nil)) 178 | loc))) 179 | 180 | (defn left 181 | "Returns the loc of the left sibling of the node at this loc, or nil" 182 | [^ZipperLocation loc] 183 | (let [path ^ZipperPath (.-path loc)] 184 | (when (and path (seq (.-l path))) 185 | (ZipperLocation. 186 | 187 | (peek (.-l path)) 188 | (assoc path :l (pop (.-l path)) :r (cons (.-node loc) (.-r path))))))) 189 | 190 | (defn leftmost 191 | "Returns the loc of the leftmost sibling of the node at this loc, or self" 192 | [^ZipperLocation loc] 193 | (let [path ^ZipperPath (.-path loc)] 194 | (if (and path (seq (.-l path))) 195 | (ZipperLocation. 196 | 197 | (first (.-l path)) 198 | (assoc path :l [] :r (concat (rest (.-l path)) [(.-node loc)] (.-r path)))) 199 | loc))) 200 | 201 | (defn insert-left 202 | "Inserts the item as the left sibling of the node at this loc, without moving" 203 | [^ZipperLocation loc item] 204 | (if-let [path ^ZipperPath (.-path loc)] 205 | (ZipperLocation. 206 | 207 | (.-node loc) 208 | (assoc path :l (conj (.-l path) item) :changed? true)) 209 | )) 210 | 211 | (defn insert-right 212 | "Inserts the item as the right sibling of the node at this loc, without moving" 213 | [^ZipperLocation loc item] 214 | (if-let [path ^ZipperPath (.-path loc)] 215 | (ZipperLocation. 216 | 217 | (.-node loc) 218 | (assoc path :r (cons item (.-r path)) :changed? true)) 219 | )) 220 | 221 | (defn replace 222 | "Replaces the node at this loc, without moving" 223 | [^ZipperLocation loc node] 224 | (ZipperLocation. 225 | node 226 | (if-let [path (.-path loc)] 227 | (ZipperPath. (.-l path) (.-r path) (.-ppath path) (.-pnodes path) true)))) 228 | 229 | (defn insert-child 230 | "Inserts the item as the leftmost child of the node at this loc, without moving" 231 | [^ZipperLocation loc item] 232 | (replace loc (make-node loc (.-node loc) (cons item (children loc))))) 233 | 234 | (defn append-child 235 | "Inserts the item as the rightmost child of the node at this loc, without moving" 236 | [^ZipperLocation loc item] 237 | (replace loc (make-node loc (.-node loc) (concat (children loc) [item])))) 238 | 239 | (defn next 240 | "Moves to the next loc in the hierarchy, depth-first. When reaching 241 | the end, returns a distinguished loc detectable via end?. If already 242 | at the end, stays there." 243 | [^ZipperLocation loc] 244 | (let [path (.-path loc)] 245 | (if (keyword-identical? :end path) 246 | loc 247 | (if (branch? loc) 248 | (down loc) 249 | (let [right (combinator.zip/right loc)] 250 | (if-not (nil? right) 251 | right 252 | (loop [p loc] 253 | (let [u (up p)] 254 | (if-not (nil? u) 255 | (let [right (combinator.zip/right u)] 256 | (if-not (nil? right) 257 | right 258 | (recur u))) 259 | (ZipperLocation. (.-node p) :end)))))))))) 260 | 261 | (defn prev 262 | "Moves to the previous loc in the hierarchy, depth-first. If already at the root, returns nil." 263 | [loc] 264 | (if-let [lloc (left loc)] 265 | (loop [loc lloc] 266 | (if-let [child (and (branch? loc) (down loc))] 267 | (recur (rightmost child)) 268 | loc)) 269 | (up loc))) 270 | 271 | (defn end? 272 | "Returns true if loc represents the end of a depth-first walk" 273 | [^ZipperLocation loc] 274 | (keyword-identical? :end (.-path loc))) 275 | 276 | (defn remove 277 | "Removes the node at loc, returning the loc that would have preceded it in a depth-first walk." 278 | [^ZipperLocation loc] 279 | (if-let [path ^ZipperPath (.-path loc)] 280 | (if (pos? (count (.-l path))) 281 | (loop [loc (ZipperLocation. 282 | (peek (.-l path)) 283 | (assoc path :l (pop (.-l path)) :changed? true))] 284 | (if-let [child (and (branch? loc) (down loc))] 285 | (recur (rightmost child)) 286 | loc)) 287 | (ZipperLocation. 288 | 289 | (make-node loc (peek (.-pnodes path)) (.-r path)) 290 | (if-let [ppath (.-ppath path)] (and ppath (assoc ppath :changed? true))))) 291 | )) 292 | 293 | (defn edit 294 | "Replaces the node at this loc with the value of (f node args)" 295 | [^ZipperLocation loc f & args] 296 | (replace loc (apply f (.-node loc) args))) 297 | -------------------------------------------------------------------------------- /out/combinator/zip.js: -------------------------------------------------------------------------------- 1 | // Compiled by ClojureScript 0.0-2030 2 | goog.provide('combinator.zip'); 3 | goog.require('cljs.core'); 4 | 5 | /** 6 | * @constructor 7 | */ 8 | combinator.zip.Tuple0 = (function (){ 9 | this.cljs$lang$protocol_mask$partition1$ = 0; 10 | this.cljs$lang$protocol_mask$partition0$ = 8388616; 11 | }) 12 | combinator.zip.Tuple0.cljs$lang$type = true; 13 | combinator.zip.Tuple0.cljs$lang$ctorStr = "combinator.zip/Tuple0"; 14 | combinator.zip.Tuple0.cljs$lang$ctorPrWriter = (function (this__3685__auto__,writer__3686__auto__,opt__3687__auto__){return cljs.core._write(writer__3686__auto__,"combinator.zip/Tuple0"); 15 | }); 16 | combinator.zip.Tuple0.prototype.cljs$core$ISeqable$_seq$arity$1 = (function (_){var self__ = this; 17 | var ___$1 = this;return cljs.core.List.EMPTY; 18 | }); 19 | combinator.zip.Tuple0.prototype.cljs$core$ICollection$_conj$arity$2 = (function (coll,o){var self__ = this; 20 | var coll__$1 = this;return (new combinator.zip.Tuple1(o)); 21 | }); 22 | combinator.zip.__GT_Tuple0 = (function __GT_Tuple0(){return (new combinator.zip.Tuple0()); 23 | }); 24 | 25 | /** 26 | * @constructor 27 | */ 28 | combinator.zip.Tuple1 = (function (x){ 29 | this.x = x; 30 | this.cljs$lang$protocol_mask$partition1$ = 0; 31 | this.cljs$lang$protocol_mask$partition0$ = 8388616; 32 | }) 33 | combinator.zip.Tuple1.cljs$lang$type = true; 34 | combinator.zip.Tuple1.cljs$lang$ctorStr = "combinator.zip/Tuple1"; 35 | combinator.zip.Tuple1.cljs$lang$ctorPrWriter = (function (this__3685__auto__,writer__3686__auto__,opt__3687__auto__){return cljs.core._write(writer__3686__auto__,"combinator.zip/Tuple1"); 36 | }); 37 | combinator.zip.Tuple1.prototype.cljs$core$ISeqable$_seq$arity$1 = (function (_){var self__ = this; 38 | var ___$1 = this;return cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$1([self__.x]); 39 | }); 40 | combinator.zip.Tuple1.prototype.cljs$core$ICollection$_conj$arity$2 = (function (coll,o){var self__ = this; 41 | var coll__$1 = this;return (new combinator.zip.Tuple2(self__.x,o)); 42 | }); 43 | combinator.zip.__GT_Tuple1 = (function __GT_Tuple1(x){return (new combinator.zip.Tuple1(x)); 44 | }); 45 | 46 | /** 47 | * @constructor 48 | */ 49 | combinator.zip.Tuple2 = (function (x,y){ 50 | this.x = x; 51 | this.y = y; 52 | this.cljs$lang$protocol_mask$partition1$ = 0; 53 | this.cljs$lang$protocol_mask$partition0$ = 8388616; 54 | }) 55 | combinator.zip.Tuple2.cljs$lang$type = true; 56 | combinator.zip.Tuple2.cljs$lang$ctorStr = "combinator.zip/Tuple2"; 57 | combinator.zip.Tuple2.cljs$lang$ctorPrWriter = (function (this__3685__auto__,writer__3686__auto__,opt__3687__auto__){return cljs.core._write(writer__3686__auto__,"combinator.zip/Tuple2"); 58 | }); 59 | combinator.zip.Tuple2.prototype.cljs$core$ISeqable$_seq$arity$1 = (function (_){var self__ = this; 60 | var ___$1 = this;return cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$1([self__.x,self__.y]); 61 | }); 62 | combinator.zip.Tuple2.prototype.cljs$core$ICollection$_conj$arity$2 = (function (coll,o){var self__ = this; 63 | var coll__$1 = this;return cljs.core.PersistentVector.fromArray([self__.x,self__.y,o], true); 64 | }); 65 | combinator.zip.__GT_Tuple2 = (function __GT_Tuple2(x,y){return (new combinator.zip.Tuple2(x,y)); 66 | }); 67 | 68 | /** 69 | * @constructor 70 | */ 71 | combinator.zip.ZipperPath = (function (l,r,ppath,pnodes,changed_QMARK_){ 72 | this.l = l; 73 | this.r = r; 74 | this.ppath = ppath; 75 | this.pnodes = pnodes; 76 | this.changed_QMARK_ = changed_QMARK_; 77 | }) 78 | combinator.zip.ZipperPath.cljs$lang$type = true; 79 | combinator.zip.ZipperPath.cljs$lang$ctorStr = "combinator.zip/ZipperPath"; 80 | combinator.zip.ZipperPath.cljs$lang$ctorPrWriter = (function (this__3688__auto__,writer__3689__auto__,opts__3690__auto__){return cljs.core._write(writer__3689__auto__,"combinator.zip/ZipperPath"); 81 | }); 82 | combinator.zip.__GT_ZipperPath = (function __GT_ZipperPath(l,r,ppath,pnodes,changed_QMARK_){return (new combinator.zip.ZipperPath(l,r,ppath,pnodes,changed_QMARK_)); 83 | }); 84 | 85 | /** 86 | * @constructor 87 | */ 88 | combinator.zip.ZipperLocation = (function (node,path){ 89 | this.node = node; 90 | this.path = path; 91 | }) 92 | combinator.zip.ZipperLocation.cljs$lang$type = true; 93 | combinator.zip.ZipperLocation.cljs$lang$ctorStr = "combinator.zip/ZipperLocation"; 94 | combinator.zip.ZipperLocation.cljs$lang$ctorPrWriter = (function (this__3688__auto__,writer__3689__auto__,opts__3690__auto__){return cljs.core._write(writer__3689__auto__,"combinator.zip/ZipperLocation"); 95 | }); 96 | combinator.zip.__GT_ZipperLocation = (function __GT_ZipperLocation(node,path){return (new combinator.zip.ZipperLocation(node,path)); 97 | }); 98 | /** 99 | * Creates a new zipper structure. 100 | * 101 | * branch? is a fn that, given a node, returns true if can have 102 | * children, even if it currently doesn't. 103 | * 104 | * children is a fn that, given a branch node, returns a seq of its 105 | * children. 106 | * 107 | * make-node is a fn that, given an existing node and a seq of 108 | * children, returns a new branch node with the supplied children. 109 | * root is the root node. 110 | */ 111 | combinator.zip.zipper = (function zipper(root){return (new combinator.zip.ZipperLocation(root,null)); 112 | }); 113 | goog.exportSymbol('combinator.zip.zipper', combinator.zip.zipper); 114 | /** 115 | * Returns a zipper for nested vectors, given a root vector 116 | */ 117 | combinator.zip.vector_zip = (function vector_zip(root){return combinator.zip.zipper(root); 118 | }); 119 | /** 120 | * Returns the node at loc 121 | */ 122 | combinator.zip.node = (function node(loc){return loc.node; 123 | }); 124 | /** 125 | * Returns true if the node at loc is a branch 126 | */ 127 | combinator.zip.branch_QMARK_ = (function branch_QMARK_(loc){return cljs.core.seq_QMARK_(loc.node); 128 | }); 129 | /** 130 | * Returns a seq of the children of node at loc, which must be a branch 131 | */ 132 | combinator.zip.children = (function children(loc){return loc.node; 133 | }); 134 | /** 135 | * Returns a new branch node, given an existing node and new children. 136 | * The loc is only used to supply the constructor. 137 | */ 138 | combinator.zip.make_node = (function make_node(loc,node,children){return children; 139 | }); 140 | /** 141 | * Returns a seq of nodes leading to this loc 142 | */ 143 | combinator.zip.path = (function path(loc){return loc.path.pnodes; 144 | }); 145 | /** 146 | * Returns a seq of the left siblings of this loc 147 | */ 148 | combinator.zip.lefts = (function lefts(loc){return cljs.core.seq(loc.path.l); 149 | }); 150 | /** 151 | * Returns a seq of the right siblings of this loc 152 | */ 153 | combinator.zip.rights = (function rights(loc){return loc.path.r; 154 | }); 155 | /** 156 | * Returns the loc of the leftmost child of the node at this loc, 157 | * or nil if no children 158 | */ 159 | combinator.zip.down = (function down(loc){if(combinator.zip.branch_QMARK_(loc)) 160 | {var temp__4092__auto__ = combinator.zip.children(loc);if(cljs.core.truth_(temp__4092__auto__)) 161 | {var cs = temp__4092__auto__;var node = loc.node;var path = loc.path;return (new combinator.zip.ZipperLocation(cljs.core.first(cs),(new combinator.zip.ZipperPath((new combinator.zip.Tuple0()),cs.cljs$core$INext$_next$arity$1(null),path,(cljs.core.truth_(path)?path.pnodes.cljs$core$ICollection$_conj$arity$2(null,node):cljs.core._conj(cljs.core.List.EMPTY,node)),null)))); 162 | } else 163 | {return null; 164 | } 165 | } else 166 | {return null; 167 | } 168 | }); 169 | /** 170 | * Returns the loc of the parent of the node at this loc, or nil if at the top 171 | */ 172 | combinator.zip.up = (function up(loc){var node = loc.node;var path = loc.path;var temp__4092__auto__ = (function (){var and__3139__auto__ = path;if(cljs.core.truth_(and__3139__auto__)) 173 | {return path.pnodes; 174 | } else 175 | {return and__3139__auto__; 176 | } 177 | })();if(cljs.core.truth_(temp__4092__auto__)) 178 | {var pnodes = temp__4092__auto__;var pnode = cljs.core.peek(pnodes);if(cljs.core.truth_(path.changed_QMARK_)) 179 | {return (new combinator.zip.ZipperLocation(combinator.zip.make_node(loc,pnode,cljs.core.seq(cljs.core.into(path.l,cljs.core.cons(node,path.r)))),(function (){var temp__4090__auto__ = path.ppath;if(cljs.core.truth_(temp__4090__auto__)) 180 | {var ppath = temp__4090__auto__;return (new combinator.zip.ZipperPath(ppath.l,ppath.r,ppath.ppath,ppath.pnodes,true)); 181 | } else 182 | {return null; 183 | } 184 | })())); 185 | } else 186 | {return (new combinator.zip.ZipperLocation(pnode,path.ppath)); 187 | } 188 | } else 189 | {return null; 190 | } 191 | }); 192 | /** 193 | * zips all the way up and returns the root node, reflecting any changes. 194 | */ 195 | combinator.zip.root = (function root(loc){while(true){ 196 | if(cljs.core.keyword_identical_QMARK_(cljs.core.constant$keyword$15,loc.path)) 197 | {return loc.node; 198 | } else 199 | {var p = combinator.zip.up(loc);if(cljs.core.truth_(p)) 200 | {{ 201 | var G__4879 = p; 202 | loc = G__4879; 203 | continue; 204 | } 205 | } else 206 | {return loc.node; 207 | } 208 | } 209 | break; 210 | } 211 | }); 212 | /** 213 | * Returns the loc of the right sibling of the node at this loc, or nil 214 | */ 215 | combinator.zip.right = (function right(loc){var path = loc.path;var temp__4092__auto__ = (function (){var and__3139__auto__ = !((path == null));if(and__3139__auto__) 216 | {return path.r; 217 | } else 218 | {return and__3139__auto__; 219 | } 220 | })();if(cljs.core.truth_(temp__4092__auto__)) 221 | {var r = temp__4092__auto__;var r__$1 = r;return (new combinator.zip.ZipperLocation(r__$1.cljs$core$ISeq$_first$arity$1(null),(new combinator.zip.ZipperPath(path.l.cljs$core$ICollection$_conj$arity$2(null,loc.node),r__$1.cljs$core$INext$_next$arity$1(null),path.ppath,path.pnodes,path.changed_QMARK_)))); 222 | } else 223 | {return null; 224 | } 225 | }); 226 | /** 227 | * Returns the loc of the rightmost sibling of the node at this loc, or self 228 | */ 229 | combinator.zip.rightmost = (function rightmost(loc){var path = loc.path;var temp__4090__auto__ = (function (){var and__3139__auto__ = path;if(cljs.core.truth_(and__3139__auto__)) 230 | {return path.r; 231 | } else 232 | {return and__3139__auto__; 233 | } 234 | })();if(cljs.core.truth_(temp__4090__auto__)) 235 | {var r = temp__4090__auto__;return (new combinator.zip.ZipperLocation(cljs.core.last(r),cljs.core.assoc.cljs$core$IFn$_invoke$arity$variadic(path,cljs.core.constant$keyword$16,cljs.core.apply.cljs$core$IFn$_invoke$arity$4(cljs.core.conj,path.l,loc.node,cljs.core.butlast(r)),cljs.core.array_seq([cljs.core.constant$keyword$17,null], 0)))); 236 | } else 237 | {return loc; 238 | } 239 | }); 240 | /** 241 | * Returns the loc of the left sibling of the node at this loc, or nil 242 | */ 243 | combinator.zip.left = (function left(loc){var path = loc.path;if(cljs.core.truth_((function (){var and__3139__auto__ = path;if(cljs.core.truth_(and__3139__auto__)) 244 | {return cljs.core.seq(path.l); 245 | } else 246 | {return and__3139__auto__; 247 | } 248 | })())) 249 | {return (new combinator.zip.ZipperLocation(cljs.core.peek(path.l),cljs.core.assoc.cljs$core$IFn$_invoke$arity$variadic(path,cljs.core.constant$keyword$16,cljs.core.pop(path.l),cljs.core.array_seq([cljs.core.constant$keyword$17,cljs.core.cons(loc.node,path.r)], 0)))); 250 | } else 251 | {return null; 252 | } 253 | }); 254 | /** 255 | * Returns the loc of the leftmost sibling of the node at this loc, or self 256 | */ 257 | combinator.zip.leftmost = (function leftmost(loc){var path = loc.path;if(cljs.core.truth_((function (){var and__3139__auto__ = path;if(cljs.core.truth_(and__3139__auto__)) 258 | {return cljs.core.seq(path.l); 259 | } else 260 | {return and__3139__auto__; 261 | } 262 | })())) 263 | {return (new combinator.zip.ZipperLocation(cljs.core.first(path.l),cljs.core.assoc.cljs$core$IFn$_invoke$arity$variadic(path,cljs.core.constant$keyword$16,cljs.core.PersistentVector.EMPTY,cljs.core.array_seq([cljs.core.constant$keyword$17,cljs.core.concat.cljs$core$IFn$_invoke$arity$variadic(cljs.core.rest(path.l),cljs.core.PersistentVector.fromArray([loc.node], true),cljs.core.array_seq([path.r], 0))], 0)))); 264 | } else 265 | {return loc; 266 | } 267 | }); 268 | /** 269 | * Inserts the item as the left sibling of the node at this loc, without moving 270 | */ 271 | combinator.zip.insert_left = (function insert_left(loc,item){var temp__4090__auto__ = loc.path;if(cljs.core.truth_(temp__4090__auto__)) 272 | {var path = temp__4090__auto__;return (new combinator.zip.ZipperLocation(loc.node,cljs.core.assoc.cljs$core$IFn$_invoke$arity$variadic(path,cljs.core.constant$keyword$16,cljs.core.conj.cljs$core$IFn$_invoke$arity$2(path.l,item),cljs.core.array_seq([cljs.core.constant$keyword$18,true], 0)))); 273 | } else 274 | {return null; 275 | } 276 | }); 277 | /** 278 | * Inserts the item as the right sibling of the node at this loc, without moving 279 | */ 280 | combinator.zip.insert_right = (function insert_right(loc,item){var temp__4090__auto__ = loc.path;if(cljs.core.truth_(temp__4090__auto__)) 281 | {var path = temp__4090__auto__;return (new combinator.zip.ZipperLocation(loc.node,cljs.core.assoc.cljs$core$IFn$_invoke$arity$variadic(path,cljs.core.constant$keyword$17,cljs.core.cons(item,path.r),cljs.core.array_seq([cljs.core.constant$keyword$18,true], 0)))); 282 | } else 283 | {return null; 284 | } 285 | }); 286 | /** 287 | * Replaces the node at this loc, without moving 288 | */ 289 | combinator.zip.replace = (function replace(loc,node){return (new combinator.zip.ZipperLocation(node,(function (){var temp__4090__auto__ = loc.path;if(cljs.core.truth_(temp__4090__auto__)) 290 | {var path = temp__4090__auto__;return (new combinator.zip.ZipperPath(path.l,path.r,path.ppath,path.pnodes,true)); 291 | } else 292 | {return null; 293 | } 294 | })())); 295 | }); 296 | /** 297 | * Inserts the item as the leftmost child of the node at this loc, without moving 298 | */ 299 | combinator.zip.insert_child = (function insert_child(loc,item){return combinator.zip.replace(loc,combinator.zip.make_node(loc,loc.node,cljs.core.cons(item,combinator.zip.children(loc)))); 300 | }); 301 | /** 302 | * Inserts the item as the rightmost child of the node at this loc, without moving 303 | */ 304 | combinator.zip.append_child = (function append_child(loc,item){return combinator.zip.replace(loc,combinator.zip.make_node(loc,loc.node,cljs.core.concat.cljs$core$IFn$_invoke$arity$2(combinator.zip.children(loc),cljs.core.PersistentVector.fromArray([item], true)))); 305 | }); 306 | /** 307 | * Moves to the next loc in the hierarchy, depth-first. When reaching 308 | * the end, returns a distinguished loc detectable via end?. If already 309 | * at the end, stays there. 310 | */ 311 | combinator.zip.next = (function next(loc){var path = loc.path;if(cljs.core.keyword_identical_QMARK_(cljs.core.constant$keyword$15,path)) 312 | {return loc; 313 | } else 314 | {if(combinator.zip.branch_QMARK_(loc)) 315 | {return combinator.zip.down(loc); 316 | } else 317 | {var right = combinator.zip.right(loc);if(!((right == null))) 318 | {return right; 319 | } else 320 | {var p = loc;while(true){ 321 | var u = combinator.zip.up(p);if(!((u == null))) 322 | {var right__$1 = combinator.zip.right(u);if(!((right__$1 == null))) 323 | {return right__$1; 324 | } else 325 | {{ 326 | var G__4880 = u; 327 | p = G__4880; 328 | continue; 329 | } 330 | } 331 | } else 332 | {return (new combinator.zip.ZipperLocation(p.node,cljs.core.constant$keyword$15)); 333 | } 334 | break; 335 | } 336 | } 337 | } 338 | } 339 | }); 340 | /** 341 | * Moves to the previous loc in the hierarchy, depth-first. If already at the root, returns nil. 342 | */ 343 | combinator.zip.prev = (function prev(loc){var temp__4090__auto__ = combinator.zip.left(loc);if(cljs.core.truth_(temp__4090__auto__)) 344 | {var lloc = temp__4090__auto__;var loc__$1 = lloc;while(true){ 345 | var temp__4090__auto____$1 = (function (){var and__3139__auto__ = combinator.zip.branch_QMARK_(loc__$1);if(and__3139__auto__) 346 | {return combinator.zip.down(loc__$1); 347 | } else 348 | {return and__3139__auto__; 349 | } 350 | })();if(cljs.core.truth_(temp__4090__auto____$1)) 351 | {var child = temp__4090__auto____$1;{ 352 | var G__4881 = combinator.zip.rightmost(child); 353 | loc__$1 = G__4881; 354 | continue; 355 | } 356 | } else 357 | {return loc__$1; 358 | } 359 | break; 360 | } 361 | } else 362 | {return combinator.zip.up(loc); 363 | } 364 | }); 365 | /** 366 | * Returns true if loc represents the end of a depth-first walk 367 | */ 368 | combinator.zip.end_QMARK_ = (function end_QMARK_(loc){return cljs.core.keyword_identical_QMARK_(cljs.core.constant$keyword$15,loc.path); 369 | }); 370 | /** 371 | * Removes the node at loc, returning the loc that would have preceded it in a depth-first walk. 372 | */ 373 | combinator.zip.remove = (function remove(loc){var temp__4090__auto__ = loc.path;if(cljs.core.truth_(temp__4090__auto__)) 374 | {var path = temp__4090__auto__;if((cljs.core.count(path.l) > 0)) 375 | {var loc__$1 = (new combinator.zip.ZipperLocation(cljs.core.peek(path.l),cljs.core.assoc.cljs$core$IFn$_invoke$arity$variadic(path,cljs.core.constant$keyword$16,cljs.core.pop(path.l),cljs.core.array_seq([cljs.core.constant$keyword$18,true], 0))));while(true){ 376 | var temp__4090__auto____$1 = (function (){var and__3139__auto__ = combinator.zip.branch_QMARK_(loc__$1);if(and__3139__auto__) 377 | {return combinator.zip.down(loc__$1); 378 | } else 379 | {return and__3139__auto__; 380 | } 381 | })();if(cljs.core.truth_(temp__4090__auto____$1)) 382 | {var child = temp__4090__auto____$1;{ 383 | var G__4882 = combinator.zip.rightmost(child); 384 | loc__$1 = G__4882; 385 | continue; 386 | } 387 | } else 388 | {return loc__$1; 389 | } 390 | break; 391 | } 392 | } else 393 | {return (new combinator.zip.ZipperLocation(combinator.zip.make_node(loc,cljs.core.peek(path.pnodes),path.r),(function (){var temp__4090__auto____$1 = path.ppath;if(cljs.core.truth_(temp__4090__auto____$1)) 394 | {var ppath = temp__4090__auto____$1;var and__3139__auto__ = ppath;if(cljs.core.truth_(and__3139__auto__)) 395 | {return cljs.core.assoc.cljs$core$IFn$_invoke$arity$3(ppath,cljs.core.constant$keyword$18,true); 396 | } else 397 | {return and__3139__auto__; 398 | } 399 | } else 400 | {return null; 401 | } 402 | })())); 403 | } 404 | } else 405 | {return null; 406 | } 407 | }); 408 | /** 409 | * Replaces the node at this loc with the value of (f node args) 410 | * @param {...*} var_args 411 | */ 412 | combinator.zip.edit = (function() { 413 | var edit__delegate = function (loc,f,args){return combinator.zip.replace(loc,cljs.core.apply.cljs$core$IFn$_invoke$arity$3(f,loc.node,args)); 414 | }; 415 | var edit = function (loc,f,var_args){ 416 | var args = null;if (arguments.length > 2) { 417 | args = cljs.core.array_seq(Array.prototype.slice.call(arguments, 2),0);} 418 | return edit__delegate.call(this,loc,f,args);}; 419 | edit.cljs$lang$maxFixedArity = 2; 420 | edit.cljs$lang$applyTo = (function (arglist__4883){ 421 | var loc = cljs.core.first(arglist__4883); 422 | arglist__4883 = cljs.core.next(arglist__4883); 423 | var f = cljs.core.first(arglist__4883); 424 | var args = cljs.core.rest(arglist__4883); 425 | return edit__delegate(loc,f,args); 426 | }); 427 | edit.cljs$core$IFn$_invoke$arity$variadic = edit__delegate; 428 | return edit; 429 | })() 430 | ; 431 | -------------------------------------------------------------------------------- /combinator.js: -------------------------------------------------------------------------------- 1 | ;(function(){ 2 | function f(a) { 3 | return function() { 4 | return this[a] 5 | } 6 | } 7 | function n(a) { 8 | return function() { 9 | return a 10 | } 11 | } 12 | var q; 13 | function s(a) { 14 | var b = typeof a; 15 | if("object" == b) { 16 | if(a) { 17 | if(a instanceof Array) { 18 | return"array" 19 | } 20 | if(a instanceof Object) { 21 | return b 22 | } 23 | var c = Object.prototype.toString.call(a); 24 | if("[object Window]" == c) { 25 | return"object" 26 | } 27 | if("[object Array]" == c || "number" == typeof a.length && "undefined" != typeof a.splice && "undefined" != typeof a.propertyIsEnumerable && !a.propertyIsEnumerable("splice")) { 28 | return"array" 29 | } 30 | if("[object Function]" == c || "undefined" != typeof a.call && "undefined" != typeof a.propertyIsEnumerable && !a.propertyIsEnumerable("call")) { 31 | return"function" 32 | } 33 | }else { 34 | return"null" 35 | } 36 | }else { 37 | if("function" == b && "undefined" == typeof a.call) { 38 | return"object" 39 | } 40 | } 41 | return b 42 | } 43 | var aa = "closure_uid_" + (1E9 * Math.random() >>> 0), ba = 0; 44 | function ca(a, b) { 45 | null != a && this.append.apply(this, arguments) 46 | } 47 | ca.prototype.ka = ""; 48 | ca.prototype.append = function(a, b, c) { 49 | this.ka += a; 50 | if(null != b) { 51 | for(var d = 1;d < arguments.length;d++) { 52 | this.ka += arguments[d] 53 | } 54 | } 55 | return this 56 | }; 57 | ca.prototype.toString = f("ka"); 58 | function ea() { 59 | throw Error("No *print-fn* fn set for evaluation environment"); 60 | } 61 | function fa() { 62 | var a = [ga, !0, ha, !0, ia, !1, ja, !1]; 63 | return new ka(null, a.length / 2, a, null) 64 | } 65 | function t(a) { 66 | return null != a && !1 !== a 67 | } 68 | function u(a, b) { 69 | return a[s(null == b ? null : b)] ? !0 : a._ ? !0 : v ? !1 : null 70 | } 71 | function ma(a) { 72 | return null == a ? null : a.constructor 73 | } 74 | function w(a, b) { 75 | var c = ma(b), c = t(t(c) ? c.jb : c) ? c.ib : s(b); 76 | return Error(["No protocol method ", a, " defined for type ", c, ": ", b].join("")) 77 | } 78 | function na(a) { 79 | var b = a.ib; 80 | return t(b) ? b : "" + x(a) 81 | } 82 | var oa = {}, pa = {}; 83 | function z(a) { 84 | if(a ? a.D : a) { 85 | return a.D(a) 86 | } 87 | var b; 88 | b = z[s(null == a ? null : a)]; 89 | if(!b && (b = z._, !b)) { 90 | throw w("ICounted.-count", a); 91 | } 92 | return b.call(null, a) 93 | } 94 | function A(a, b) { 95 | if(a ? a.s : a) { 96 | return a.s(a, b) 97 | } 98 | var c; 99 | c = A[s(null == a ? null : a)]; 100 | if(!c && (c = A._, !c)) { 101 | throw w("ICollection.-conj", a); 102 | } 103 | return c.call(null, a, b) 104 | } 105 | var qa = {}, B = function() { 106 | function a(a, b, c) { 107 | if(a ? a.S : a) { 108 | return a.S(a, b, c) 109 | } 110 | var h; 111 | h = B[s(null == a ? null : a)]; 112 | if(!h && (h = B._, !h)) { 113 | throw w("IIndexed.-nth", a); 114 | } 115 | return h.call(null, a, b, c) 116 | } 117 | function b(a, b) { 118 | if(a ? a.J : a) { 119 | return a.J(a, b) 120 | } 121 | var c; 122 | c = B[s(null == a ? null : a)]; 123 | if(!c && (c = B._, !c)) { 124 | throw w("IIndexed.-nth", a); 125 | } 126 | return c.call(null, a, b) 127 | } 128 | var c = null, c = function(c, e, g) { 129 | switch(arguments.length) { 130 | case 2: 131 | return b.call(this, c, e); 132 | case 3: 133 | return a.call(this, c, e, g) 134 | } 135 | throw Error("Invalid arity: " + arguments.length); 136 | }; 137 | c.b = b; 138 | c.c = a; 139 | return c 140 | }(), ra = {}; 141 | function D(a) { 142 | if(a ? a.M : a) { 143 | return a.M(a) 144 | } 145 | var b; 146 | b = D[s(null == a ? null : a)]; 147 | if(!b && (b = D._, !b)) { 148 | throw w("ISeq.-first", a); 149 | } 150 | return b.call(null, a) 151 | } 152 | function F(a) { 153 | if(a ? a.Q : a) { 154 | return a.Q(a) 155 | } 156 | var b; 157 | b = F[s(null == a ? null : a)]; 158 | if(!b && (b = F._, !b)) { 159 | throw w("ISeq.-rest", a); 160 | } 161 | return b.call(null, a) 162 | } 163 | var sa = {}, ta = function() { 164 | function a(a, b, c) { 165 | if(a ? a.H : a) { 166 | return a.H(a, b, c) 167 | } 168 | var h; 169 | h = ta[s(null == a ? null : a)]; 170 | if(!h && (h = ta._, !h)) { 171 | throw w("ILookup.-lookup", a); 172 | } 173 | return h.call(null, a, b, c) 174 | } 175 | function b(a, b) { 176 | if(a ? a.G : a) { 177 | return a.G(a, b) 178 | } 179 | var c; 180 | c = ta[s(null == a ? null : a)]; 181 | if(!c && (c = ta._, !c)) { 182 | throw w("ILookup.-lookup", a); 183 | } 184 | return c.call(null, a, b) 185 | } 186 | var c = null, c = function(c, e, g) { 187 | switch(arguments.length) { 188 | case 2: 189 | return b.call(this, c, e); 190 | case 3: 191 | return a.call(this, c, e, g) 192 | } 193 | throw Error("Invalid arity: " + arguments.length); 194 | }; 195 | c.b = b; 196 | c.c = a; 197 | return c 198 | }(); 199 | function ua(a, b, c) { 200 | if(a ? a.la : a) { 201 | return a.la(a, b, c) 202 | } 203 | var d; 204 | d = ua[s(null == a ? null : a)]; 205 | if(!d && (d = ua._, !d)) { 206 | throw w("IAssociative.-assoc", a); 207 | } 208 | return d.call(null, a, b, c) 209 | } 210 | var va = {}, wa = {}; 211 | function xa(a) { 212 | if(a ? a.Ya : a) { 213 | return a.Ya() 214 | } 215 | var b; 216 | b = xa[s(null == a ? null : a)]; 217 | if(!b && (b = xa._, !b)) { 218 | throw w("IMapEntry.-key", a); 219 | } 220 | return b.call(null, a) 221 | } 222 | function ya(a) { 223 | if(a ? a.Za : a) { 224 | return a.Za() 225 | } 226 | var b; 227 | b = ya[s(null == a ? null : a)]; 228 | if(!b && (b = ya._, !b)) { 229 | throw w("IMapEntry.-val", a); 230 | } 231 | return b.call(null, a) 232 | } 233 | function za(a) { 234 | if(a ? a.oa : a) { 235 | return a.oa(a) 236 | } 237 | var b; 238 | b = za[s(null == a ? null : a)]; 239 | if(!b && (b = za._, !b)) { 240 | throw w("IStack.-peek", a); 241 | } 242 | return b.call(null, a) 243 | } 244 | var Aa = {}; 245 | function Ba(a, b, c) { 246 | if(a ? a.Sa : a) { 247 | return a.Sa(a, b, c) 248 | } 249 | var d; 250 | d = Ba[s(null == a ? null : a)]; 251 | if(!d && (d = Ba._, !d)) { 252 | throw w("IVector.-assoc-n", a); 253 | } 254 | return d.call(null, a, b, c) 255 | } 256 | var Ca = {}; 257 | function Da(a) { 258 | if(a ? a.O : a) { 259 | return a.O(a) 260 | } 261 | var b; 262 | b = Da[s(null == a ? null : a)]; 263 | if(!b && (b = Da._, !b)) { 264 | throw w("IMeta.-meta", a); 265 | } 266 | return b.call(null, a) 267 | } 268 | function Ea(a, b) { 269 | if(a ? a.N : a) { 270 | return a.N(a, b) 271 | } 272 | var c; 273 | c = Ea[s(null == a ? null : a)]; 274 | if(!c && (c = Ea._, !c)) { 275 | throw w("IWithMeta.-with-meta", a); 276 | } 277 | return c.call(null, a, b) 278 | } 279 | var Fa = {}, Ga = function() { 280 | function a(a, b, c) { 281 | if(a ? a.L : a) { 282 | return a.L(a, b, c) 283 | } 284 | var h; 285 | h = Ga[s(null == a ? null : a)]; 286 | if(!h && (h = Ga._, !h)) { 287 | throw w("IReduce.-reduce", a); 288 | } 289 | return h.call(null, a, b, c) 290 | } 291 | function b(a, b) { 292 | if(a ? a.K : a) { 293 | return a.K(a, b) 294 | } 295 | var c; 296 | c = Ga[s(null == a ? null : a)]; 297 | if(!c && (c = Ga._, !c)) { 298 | throw w("IReduce.-reduce", a); 299 | } 300 | return c.call(null, a, b) 301 | } 302 | var c = null, c = function(c, e, g) { 303 | switch(arguments.length) { 304 | case 2: 305 | return b.call(this, c, e); 306 | case 3: 307 | return a.call(this, c, e, g) 308 | } 309 | throw Error("Invalid arity: " + arguments.length); 310 | }; 311 | c.b = b; 312 | c.c = a; 313 | return c 314 | }(); 315 | function Ha(a, b) { 316 | if(a ? a.w : a) { 317 | return a.w(a, b) 318 | } 319 | var c; 320 | c = Ha[s(null == a ? null : a)]; 321 | if(!c && (c = Ha._, !c)) { 322 | throw w("IEquiv.-equiv", a); 323 | } 324 | return c.call(null, a, b) 325 | } 326 | function Ia(a) { 327 | if(a ? a.B : a) { 328 | return a.B(a) 329 | } 330 | var b; 331 | b = Ia[s(null == a ? null : a)]; 332 | if(!b && (b = Ia._, !b)) { 333 | throw w("IHash.-hash", a); 334 | } 335 | return b.call(null, a) 336 | } 337 | var Ja = {}; 338 | function Ka(a) { 339 | if(a ? a.v : a) { 340 | return a.v(a) 341 | } 342 | var b; 343 | b = Ka[s(null == a ? null : a)]; 344 | if(!b && (b = Ka._, !b)) { 345 | throw w("ISeqable.-seq", a); 346 | } 347 | return b.call(null, a) 348 | } 349 | var La = {}; 350 | function G(a, b) { 351 | if(a ? a.ab : a) { 352 | return a.ab(0, b) 353 | } 354 | var c; 355 | c = G[s(null == a ? null : a)]; 356 | if(!c && (c = G._, !c)) { 357 | throw w("IWriter.-write", a); 358 | } 359 | return c.call(null, a, b) 360 | } 361 | function Ma(a) { 362 | if(a ? a.hb : a) { 363 | return null 364 | } 365 | var b; 366 | b = Ma[s(null == a ? null : a)]; 367 | if(!b && (b = Ma._, !b)) { 368 | throw w("IWriter.-flush", a); 369 | } 370 | return b.call(null, a) 371 | } 372 | var Na = {}; 373 | function Oa(a, b, c) { 374 | if(a ? a.A : a) { 375 | return a.A(a, b, c) 376 | } 377 | var d; 378 | d = Oa[s(null == a ? null : a)]; 379 | if(!d && (d = Oa._, !d)) { 380 | throw w("IPrintWithWriter.-pr-writer", a); 381 | } 382 | return d.call(null, a, b, c) 383 | } 384 | function Pa(a) { 385 | if(a ? a.ua : a) { 386 | return a.ua(a) 387 | } 388 | var b; 389 | b = Pa[s(null == a ? null : a)]; 390 | if(!b && (b = Pa._, !b)) { 391 | throw w("IEditableCollection.-as-transient", a); 392 | } 393 | return b.call(null, a) 394 | } 395 | function Qa(a, b) { 396 | if(a ? a.va : a) { 397 | return a.va(a, b) 398 | } 399 | var c; 400 | c = Qa[s(null == a ? null : a)]; 401 | if(!c && (c = Qa._, !c)) { 402 | throw w("ITransientCollection.-conj!", a); 403 | } 404 | return c.call(null, a, b) 405 | } 406 | function Ra(a) { 407 | if(a ? a.wa : a) { 408 | return a.wa(a) 409 | } 410 | var b; 411 | b = Ra[s(null == a ? null : a)]; 412 | if(!b && (b = Ra._, !b)) { 413 | throw w("ITransientCollection.-persistent!", a); 414 | } 415 | return b.call(null, a) 416 | } 417 | function Sa(a, b, c) { 418 | if(a ? a.pa : a) { 419 | return a.pa(a, b, c) 420 | } 421 | var d; 422 | d = Sa[s(null == a ? null : a)]; 423 | if(!d && (d = Sa._, !d)) { 424 | throw w("ITransientAssociative.-assoc!", a); 425 | } 426 | return d.call(null, a, b, c) 427 | } 428 | function Ta(a, b, c) { 429 | if(a ? a.$a : a) { 430 | return a.$a(0, b, c) 431 | } 432 | var d; 433 | d = Ta[s(null == a ? null : a)]; 434 | if(!d && (d = Ta._, !d)) { 435 | throw w("ITransientVector.-assoc-n!", a); 436 | } 437 | return d.call(null, a, b, c) 438 | } 439 | function Ua(a) { 440 | if(a ? a.Ua : a) { 441 | return a.Ua() 442 | } 443 | var b; 444 | b = Ua[s(null == a ? null : a)]; 445 | if(!b && (b = Ua._, !b)) { 446 | throw w("IChunk.-drop-first", a); 447 | } 448 | return b.call(null, a) 449 | } 450 | function Va(a) { 451 | if(a ? a.Da : a) { 452 | return a.Da(a) 453 | } 454 | var b; 455 | b = Va[s(null == a ? null : a)]; 456 | if(!b && (b = Va._, !b)) { 457 | throw w("IChunkedSeq.-chunked-first", a); 458 | } 459 | return b.call(null, a) 460 | } 461 | function Wa(a) { 462 | if(a ? a.Ea : a) { 463 | return a.Ea(a) 464 | } 465 | var b; 466 | b = Wa[s(null == a ? null : a)]; 467 | if(!b && (b = Wa._, !b)) { 468 | throw w("IChunkedSeq.-chunked-rest", a); 469 | } 470 | return b.call(null, a) 471 | } 472 | function Xa(a) { 473 | if(a ? a.Ca : a) { 474 | return a.Ca(a) 475 | } 476 | var b; 477 | b = Xa[s(null == a ? null : a)]; 478 | if(!b && (b = Xa._, !b)) { 479 | throw w("IChunkedNext.-chunked-next", a); 480 | } 481 | return b.call(null, a) 482 | } 483 | function Ya(a) { 484 | this.lb = a; 485 | this.n = 0; 486 | this.f = 1073741824 487 | } 488 | Ya.prototype.ab = function(a, b) { 489 | return this.lb.append(b) 490 | }; 491 | Ya.prototype.hb = n(null); 492 | function H(a) { 493 | var b = new ca, c = new Ya(b); 494 | a.A(null, c, fa()); 495 | Ma(c); 496 | return"" + x(b) 497 | } 498 | function J(a) { 499 | if(null == a) { 500 | return null 501 | } 502 | if(a && (a.f & 8388608 || a.tb)) { 503 | return a.v(null) 504 | } 505 | if(a instanceof Array || "string" === typeof a) { 506 | return 0 === a.length ? null : new Za(a, 0) 507 | } 508 | if(u(Ja, a)) { 509 | return Ka(a) 510 | } 511 | if(v) { 512 | throw Error([x(a), x("is not ISeqable")].join("")); 513 | } 514 | return null 515 | } 516 | function K(a) { 517 | if(null == a) { 518 | return null 519 | } 520 | if(a && (a.f & 64 || a.na)) { 521 | return a.M(null) 522 | } 523 | a = J(a); 524 | return null == a ? null : D(a) 525 | } 526 | function M(a) { 527 | return null != a ? a && (a.f & 64 || a.na) ? a.Q(null) : (a = J(a)) ? F(a) : N : N 528 | } 529 | function O(a) { 530 | return null == a ? null : a && (a.f & 128 || a.sb) ? a.T(null) : J(M(a)) 531 | } 532 | var $a = function() { 533 | function a(a, b) { 534 | return a === b || Ha(a, b) 535 | } 536 | var b = null, c = function() { 537 | function a(b, d, k) { 538 | var l = null; 539 | 2 < arguments.length && (l = P(Array.prototype.slice.call(arguments, 2), 0)); 540 | return c.call(this, b, d, l) 541 | } 542 | function c(a, d, e) { 543 | for(;;) { 544 | if(b.b(a, d)) { 545 | if(O(e)) { 546 | a = d, d = K(e), e = O(e) 547 | }else { 548 | return b.b(d, K(e)) 549 | } 550 | }else { 551 | return!1 552 | } 553 | } 554 | } 555 | a.r = 2; 556 | a.k = function(a) { 557 | var b = K(a); 558 | a = O(a); 559 | var d = K(a); 560 | a = M(a); 561 | return c(b, d, a) 562 | }; 563 | a.i = c; 564 | return a 565 | }(), b = function(b, e, g) { 566 | switch(arguments.length) { 567 | case 1: 568 | return!0; 569 | case 2: 570 | return a.call(this, b, e); 571 | default: 572 | return c.i(b, e, P(arguments, 2)) 573 | } 574 | throw Error("Invalid arity: " + arguments.length); 575 | }; 576 | b.r = 2; 577 | b.k = c.k; 578 | b.e = n(!0); 579 | b.b = a; 580 | b.i = c.i; 581 | return b 582 | }(); 583 | Ia["null"] = n(0); 584 | pa["null"] = !0; 585 | z["null"] = n(0); 586 | za["null"] = n(null); 587 | Ha["null"] = function(a, b) { 588 | return null == b 589 | }; 590 | Ea["null"] = n(null); 591 | Ca["null"] = !0; 592 | Da["null"] = n(null); 593 | va["null"] = !0; 594 | Date.prototype.w = function(a, b) { 595 | return b instanceof Date && this.toString() === b.toString() 596 | }; 597 | Ha.number = function(a, b) { 598 | return a === b 599 | }; 600 | Ca["function"] = !0; 601 | Da["function"] = n(null); 602 | oa["function"] = !0; 603 | Ia._ = function(a) { 604 | return a[aa] || (a[aa] = ++ba) 605 | }; 606 | var ab = function() { 607 | function a(a, b, c, d) { 608 | for(var l = z(a);;) { 609 | if(d < l) { 610 | c = b.b ? b.b(c, B.b(a, d)) : b.call(null, c, B.b(a, d)), d += 1 611 | }else { 612 | return c 613 | } 614 | } 615 | } 616 | function b(a, b, c) { 617 | for(var d = z(a), l = 0;;) { 618 | if(l < d) { 619 | c = b.b ? b.b(c, B.b(a, l)) : b.call(null, c, B.b(a, l)), l += 1 620 | }else { 621 | return c 622 | } 623 | } 624 | } 625 | function c(a, b) { 626 | var c = z(a); 627 | if(0 === c) { 628 | return b.ma ? "" : b.call(null) 629 | } 630 | for(var d = B.b(a, 0), l = 1;;) { 631 | if(l < c) { 632 | d = b.b ? b.b(d, B.b(a, l)) : b.call(null, d, B.b(a, l)), l += 1 633 | }else { 634 | return d 635 | } 636 | } 637 | } 638 | var d = null, d = function(d, g, h, k) { 639 | switch(arguments.length) { 640 | case 2: 641 | return c.call(this, d, g); 642 | case 3: 643 | return b.call(this, d, g, h); 644 | case 4: 645 | return a.call(this, d, g, h, k) 646 | } 647 | throw Error("Invalid arity: " + arguments.length); 648 | }; 649 | d.b = c; 650 | d.c = b; 651 | d.m = a; 652 | return d 653 | }(), bb = function() { 654 | function a(a, b, c, d) { 655 | for(var l = a.length;;) { 656 | if(d < l) { 657 | c = b.b ? b.b(c, a[d]) : b.call(null, c, a[d]), d += 1 658 | }else { 659 | return c 660 | } 661 | } 662 | } 663 | function b(a, b, c) { 664 | for(var d = a.length, l = 0;;) { 665 | if(l < d) { 666 | c = b.b ? b.b(c, a[l]) : b.call(null, c, a[l]), l += 1 667 | }else { 668 | return c 669 | } 670 | } 671 | } 672 | function c(a, b) { 673 | var c = a.length; 674 | if(0 === a.length) { 675 | return b.ma ? "" : b.call(null) 676 | } 677 | for(var d = a[0], l = 1;;) { 678 | if(l < c) { 679 | d = b.b ? b.b(d, a[l]) : b.call(null, d, a[l]), l += 1 680 | }else { 681 | return d 682 | } 683 | } 684 | } 685 | var d = null, d = function(d, g, h, k) { 686 | switch(arguments.length) { 687 | case 2: 688 | return c.call(this, d, g); 689 | case 3: 690 | return b.call(this, d, g, h); 691 | case 4: 692 | return a.call(this, d, g, h, k) 693 | } 694 | throw Error("Invalid arity: " + arguments.length); 695 | }; 696 | d.b = c; 697 | d.c = b; 698 | d.m = a; 699 | return d 700 | }(); 701 | function cb(a) { 702 | return a ? a.f & 2 || a.bb ? !0 : a.f ? !1 : u(pa, a) : u(pa, a) 703 | } 704 | function db(a) { 705 | return a ? a.f & 16 || a.Xa ? !0 : a.f ? !1 : u(qa, a) : u(qa, a) 706 | } 707 | function Za(a, b) { 708 | this.a = a; 709 | this.g = b; 710 | this.n = 0; 711 | this.f = 166199550 712 | } 713 | q = Za.prototype; 714 | q.B = function() { 715 | return eb.e ? eb.e(this) : eb.call(null, this) 716 | }; 717 | q.T = function() { 718 | return this.g + 1 < this.a.length ? new Za(this.a, this.g + 1) : null 719 | }; 720 | q.s = function(a, b) { 721 | return Q.b ? Q.b(b, this) : Q.call(null, b, this) 722 | }; 723 | q.toString = function() { 724 | return H(this) 725 | }; 726 | q.K = function(a, b) { 727 | return bb.m(this.a, b, this.a[this.g], this.g + 1) 728 | }; 729 | q.L = function(a, b, c) { 730 | return bb.m(this.a, b, c, this.g) 731 | }; 732 | q.v = function() { 733 | return this 734 | }; 735 | q.D = function() { 736 | return this.a.length - this.g 737 | }; 738 | q.M = function() { 739 | return this.a[this.g] 740 | }; 741 | q.Q = function() { 742 | return this.g + 1 < this.a.length ? new Za(this.a, this.g + 1) : N 743 | }; 744 | q.w = function(a, b) { 745 | return R.b ? R.b(this, b) : R.call(null, this, b) 746 | }; 747 | q.J = function(a, b) { 748 | var c = b + this.g; 749 | return c < this.a.length ? this.a[c] : null 750 | }; 751 | q.S = function(a, b, c) { 752 | a = b + this.g; 753 | return a < this.a.length ? this.a[a] : c 754 | }; 755 | var fb = function() { 756 | function a(a, b) { 757 | return b < a.length ? new Za(a, b) : null 758 | } 759 | function b(a) { 760 | return c.b(a, 0) 761 | } 762 | var c = null, c = function(c, e) { 763 | switch(arguments.length) { 764 | case 1: 765 | return b.call(this, c); 766 | case 2: 767 | return a.call(this, c, e) 768 | } 769 | throw Error("Invalid arity: " + arguments.length); 770 | }; 771 | c.e = b; 772 | c.b = a; 773 | return c 774 | }(), P = function() { 775 | function a(a, b) { 776 | return fb.b(a, b) 777 | } 778 | function b(a) { 779 | return fb.b(a, 0) 780 | } 781 | var c = null, c = function(c, e) { 782 | switch(arguments.length) { 783 | case 1: 784 | return b.call(this, c); 785 | case 2: 786 | return a.call(this, c, e) 787 | } 788 | throw Error("Invalid arity: " + arguments.length); 789 | }; 790 | c.e = b; 791 | c.b = a; 792 | return c 793 | }(); 794 | Ha._ = function(a, b) { 795 | return a === b 796 | }; 797 | var gb = function() { 798 | function a(a, b) { 799 | return null != a ? A(a, b) : A(N, b) 800 | } 801 | var b = null, c = function() { 802 | function a(b, d, k) { 803 | var l = null; 804 | 2 < arguments.length && (l = P(Array.prototype.slice.call(arguments, 2), 0)); 805 | return c.call(this, b, d, l) 806 | } 807 | function c(a, d, e) { 808 | for(;;) { 809 | if(t(e)) { 810 | a = b.b(a, d), d = K(e), e = O(e) 811 | }else { 812 | return b.b(a, d) 813 | } 814 | } 815 | } 816 | a.r = 2; 817 | a.k = function(a) { 818 | var b = K(a); 819 | a = O(a); 820 | var d = K(a); 821 | a = M(a); 822 | return c(b, d, a) 823 | }; 824 | a.i = c; 825 | return a 826 | }(), b = function(b, e, g) { 827 | switch(arguments.length) { 828 | case 2: 829 | return a.call(this, b, e); 830 | default: 831 | return c.i(b, e, P(arguments, 2)) 832 | } 833 | throw Error("Invalid arity: " + arguments.length); 834 | }; 835 | b.r = 2; 836 | b.k = c.k; 837 | b.b = a; 838 | b.i = c.i; 839 | return b 840 | }(); 841 | function S(a) { 842 | if(null != a) { 843 | if(a && (a.f & 2 || a.bb)) { 844 | a = a.D(null) 845 | }else { 846 | if(a instanceof Array) { 847 | a = a.length 848 | }else { 849 | if("string" === typeof a) { 850 | a = a.length 851 | }else { 852 | if(u(pa, a)) { 853 | a = z(a) 854 | }else { 855 | if(v) { 856 | a: { 857 | a = J(a); 858 | for(var b = 0;;) { 859 | if(cb(a)) { 860 | a = b + z(a); 861 | break a 862 | } 863 | a = O(a); 864 | b += 1 865 | } 866 | a = void 0 867 | } 868 | }else { 869 | a = null 870 | } 871 | } 872 | } 873 | } 874 | } 875 | }else { 876 | a = 0 877 | } 878 | return a 879 | } 880 | var hb = function() { 881 | function a(a, b, c) { 882 | for(;;) { 883 | if(null == a) { 884 | return c 885 | } 886 | if(0 === b) { 887 | return J(a) ? K(a) : c 888 | } 889 | if(db(a)) { 890 | return B.c(a, b, c) 891 | } 892 | if(J(a)) { 893 | a = O(a), b -= 1 894 | }else { 895 | return v ? c : null 896 | } 897 | } 898 | } 899 | function b(a, b) { 900 | for(;;) { 901 | if(null == a) { 902 | throw Error("Index out of bounds"); 903 | } 904 | if(0 === b) { 905 | if(J(a)) { 906 | return K(a) 907 | } 908 | throw Error("Index out of bounds"); 909 | } 910 | if(db(a)) { 911 | return B.b(a, b) 912 | } 913 | if(J(a)) { 914 | var c = O(a), h = b - 1; 915 | a = c; 916 | b = h 917 | }else { 918 | if(v) { 919 | throw Error("Index out of bounds"); 920 | } 921 | return null 922 | } 923 | } 924 | } 925 | var c = null, c = function(c, e, g) { 926 | switch(arguments.length) { 927 | case 2: 928 | return b.call(this, c, e); 929 | case 3: 930 | return a.call(this, c, e, g) 931 | } 932 | throw Error("Invalid arity: " + arguments.length); 933 | }; 934 | c.b = b; 935 | c.c = a; 936 | return c 937 | }(), ib = function() { 938 | function a(a, b, c) { 939 | if(null != a) { 940 | if(a && (a.f & 16 || a.Xa)) { 941 | return a.S(null, b, c) 942 | } 943 | if(a instanceof Array || "string" === typeof a) { 944 | return b < a.length ? a[b] : c 945 | } 946 | if(u(qa, a)) { 947 | return B.b(a, b) 948 | } 949 | if(v) { 950 | if(a ? a.f & 64 || a.na || (a.f ? 0 : u(ra, a)) : u(ra, a)) { 951 | return hb.c(a, b, c) 952 | } 953 | throw Error([x("nth not supported on this type "), x(na(ma(a)))].join("")); 954 | } 955 | return null 956 | } 957 | return c 958 | } 959 | function b(a, b) { 960 | if(null == a) { 961 | return null 962 | } 963 | if(a && (a.f & 16 || a.Xa)) { 964 | return a.J(null, b) 965 | } 966 | if(a instanceof Array || "string" === typeof a) { 967 | return b < a.length ? a[b] : null 968 | } 969 | if(u(qa, a)) { 970 | return B.b(a, b) 971 | } 972 | if(v) { 973 | if(a ? a.f & 64 || a.na || (a.f ? 0 : u(ra, a)) : u(ra, a)) { 974 | return hb.b(a, b) 975 | } 976 | throw Error([x("nth not supported on this type "), x(na(ma(a)))].join("")); 977 | } 978 | return null 979 | } 980 | var c = null, c = function(c, e, g) { 981 | switch(arguments.length) { 982 | case 2: 983 | return b.call(this, c, e); 984 | case 3: 985 | return a.call(this, c, e, g) 986 | } 987 | throw Error("Invalid arity: " + arguments.length); 988 | }; 989 | c.b = b; 990 | c.c = a; 991 | return c 992 | }(), jb = function() { 993 | function a(a, b, c) { 994 | return null != a ? a && (a.f & 256 || a.cb) ? a.H(null, b, c) : a instanceof Array ? b < a.length ? a[b] : c : "string" === typeof a ? b < a.length ? a[b] : c : u(sa, a) ? ta.c(a, b, c) : v ? c : null : c 995 | } 996 | function b(a, b) { 997 | return null == a ? null : a && (a.f & 256 || a.cb) ? a.G(null, b) : a instanceof Array ? b < a.length ? a[b] : null : "string" === typeof a ? b < a.length ? a[b] : null : u(sa, a) ? ta.b(a, b) : null 998 | } 999 | var c = null, c = function(c, e, g) { 1000 | switch(arguments.length) { 1001 | case 2: 1002 | return b.call(this, c, e); 1003 | case 3: 1004 | return a.call(this, c, e, g) 1005 | } 1006 | throw Error("Invalid arity: " + arguments.length); 1007 | }; 1008 | c.b = b; 1009 | c.c = a; 1010 | return c 1011 | }(), mb = function() { 1012 | function a(a, b, c) { 1013 | return null != a ? ua(a, b, c) : kb.b ? kb.b([b], [c]) : kb.call(null, [b], [c]) 1014 | } 1015 | var b = null, c = function() { 1016 | function a(b, d, k, l) { 1017 | var m = null; 1018 | 3 < arguments.length && (m = P(Array.prototype.slice.call(arguments, 3), 0)); 1019 | return c.call(this, b, d, k, m) 1020 | } 1021 | function c(a, d, e, l) { 1022 | for(;;) { 1023 | if(a = b.c(a, d, e), t(l)) { 1024 | d = K(l), e = K(O(l)), l = O(O(l)) 1025 | }else { 1026 | return a 1027 | } 1028 | } 1029 | } 1030 | a.r = 3; 1031 | a.k = function(a) { 1032 | var b = K(a); 1033 | a = O(a); 1034 | var d = K(a); 1035 | a = O(a); 1036 | var l = K(a); 1037 | a = M(a); 1038 | return c(b, d, l, a) 1039 | }; 1040 | a.i = c; 1041 | return a 1042 | }(), b = function(b, e, g, h) { 1043 | switch(arguments.length) { 1044 | case 3: 1045 | return a.call(this, b, e, g); 1046 | default: 1047 | return c.i(b, e, g, P(arguments, 3)) 1048 | } 1049 | throw Error("Invalid arity: " + arguments.length); 1050 | }; 1051 | b.r = 3; 1052 | b.k = c.k; 1053 | b.c = a; 1054 | b.i = c.i; 1055 | return b 1056 | }(); 1057 | function nb(a) { 1058 | var b = "function" == s(a); 1059 | return b ? b : a ? t(t(null) ? null : a.nb) ? !0 : a.xb ? !1 : u(oa, a) : u(oa, a) 1060 | } 1061 | function ob(a) { 1062 | return(a ? a.f & 131072 || a.fb || (a.f ? 0 : u(Ca, a)) : u(Ca, a)) ? Da(a) : null 1063 | } 1064 | var pb = {}, qb = 0; 1065 | function T(a) { 1066 | if(a && (a.f & 4194304 || a.qb)) { 1067 | a = a.B(null) 1068 | }else { 1069 | if("number" === typeof a) { 1070 | a = Math.floor(a) % 2147483647 1071 | }else { 1072 | if(!0 === a) { 1073 | a = 1 1074 | }else { 1075 | if(!1 === a) { 1076 | a = 0 1077 | }else { 1078 | if("string" === typeof a) { 1079 | 255 < qb && (pb = {}, qb = 0); 1080 | var b = pb[a]; 1081 | if("number" !== typeof b) { 1082 | for(var c = b = 0;c < a.length;++c) { 1083 | b = 31 * b + a.charCodeAt(c), b %= 4294967296 1084 | } 1085 | pb[a] = b; 1086 | qb += 1 1087 | } 1088 | a = b 1089 | }else { 1090 | a = v ? Ia(a) : null 1091 | } 1092 | } 1093 | } 1094 | } 1095 | } 1096 | return a 1097 | } 1098 | function rb(a) { 1099 | return a ? a.f & 16384 || a.vb ? !0 : a.f ? !1 : u(Aa, a) : u(Aa, a) 1100 | } 1101 | function sb(a) { 1102 | return a ? a.n & 512 || a.ob ? !0 : !1 : !1 1103 | } 1104 | function tb(a, b, c, d, e) { 1105 | for(;0 !== e;) { 1106 | c[d] = a[b], d += 1, e -= 1, b += 1 1107 | } 1108 | } 1109 | function ub(a) { 1110 | return null == a ? !1 : a ? a.f & 64 || a.na ? !0 : a.f ? !1 : u(ra, a) : u(ra, a) 1111 | } 1112 | function vb(a) { 1113 | return t(a) ? !0 : !1 1114 | } 1115 | function wb(a, b) { 1116 | if(a === b) { 1117 | return 0 1118 | } 1119 | if(null == a) { 1120 | return-1 1121 | } 1122 | if(null == b) { 1123 | return 1 1124 | } 1125 | if(ma(a) === ma(b)) { 1126 | return a && (a.n & 2048 || a.Va) ? a.Wa(null, b) : a > b ? 1 : a < b ? -1 : 0 1127 | } 1128 | if(v) { 1129 | throw Error("compare on non-nil objects of different types"); 1130 | } 1131 | return null 1132 | } 1133 | var xb = function() { 1134 | function a(a, b, c, h) { 1135 | for(;;) { 1136 | var k = wb(ib.b(a, h), ib.b(b, h)); 1137 | if(0 === k && h + 1 < c) { 1138 | h += 1 1139 | }else { 1140 | return k 1141 | } 1142 | } 1143 | } 1144 | function b(a, b) { 1145 | var g = S(a), h = S(b); 1146 | return g < h ? -1 : g > h ? 1 : v ? c.m(a, b, g, 0) : null 1147 | } 1148 | var c = null, c = function(c, e, g, h) { 1149 | switch(arguments.length) { 1150 | case 2: 1151 | return b.call(this, c, e); 1152 | case 4: 1153 | return a.call(this, c, e, g, h) 1154 | } 1155 | throw Error("Invalid arity: " + arguments.length); 1156 | }; 1157 | c.b = b; 1158 | c.m = a; 1159 | return c 1160 | }(), U = function() { 1161 | function a(a, b, c) { 1162 | for(c = J(c);;) { 1163 | if(c) { 1164 | b = a.b ? a.b(b, K(c)) : a.call(null, b, K(c)), c = O(c) 1165 | }else { 1166 | return b 1167 | } 1168 | } 1169 | } 1170 | function b(a, b) { 1171 | var c = J(b); 1172 | return c ? yb.c ? yb.c(a, K(c), O(c)) : yb.call(null, a, K(c), O(c)) : a.ma ? "" : a.call(null) 1173 | } 1174 | var c = null, c = function(c, e, g) { 1175 | switch(arguments.length) { 1176 | case 2: 1177 | return b.call(this, c, e); 1178 | case 3: 1179 | return a.call(this, c, e, g) 1180 | } 1181 | throw Error("Invalid arity: " + arguments.length); 1182 | }; 1183 | c.b = b; 1184 | c.c = a; 1185 | return c 1186 | }(), yb = function() { 1187 | function a(a, b, c) { 1188 | return c && (c.f & 524288 || c.gb) ? c.L(null, a, b) : c instanceof Array ? bb.c(c, a, b) : "string" === typeof c ? bb.c(c, a, b) : u(Fa, c) ? Ga.c(c, a, b) : v ? U.c(a, b, c) : null 1189 | } 1190 | function b(a, b) { 1191 | return b && (b.f & 524288 || b.gb) ? b.K(null, a) : b instanceof Array ? bb.b(b, a) : "string" === typeof b ? bb.b(b, a) : u(Fa, b) ? Ga.b(b, a) : v ? U.b(a, b) : null 1192 | } 1193 | var c = null, c = function(c, e, g) { 1194 | switch(arguments.length) { 1195 | case 2: 1196 | return b.call(this, c, e); 1197 | case 3: 1198 | return a.call(this, c, e, g) 1199 | } 1200 | throw Error("Invalid arity: " + arguments.length); 1201 | }; 1202 | c.b = b; 1203 | c.c = a; 1204 | return c 1205 | }(); 1206 | function zb(a) { 1207 | return 0 <= a ? Math.floor.e ? Math.floor.e(a) : Math.floor.call(null, a) : Math.ceil.e ? Math.ceil.e(a) : Math.ceil.call(null, a) 1208 | } 1209 | function Ab(a) { 1210 | a -= a >> 1 & 1431655765; 1211 | a = (a & 858993459) + (a >> 2 & 858993459); 1212 | return 16843009 * (a + (a >> 4) & 252645135) >> 24 1213 | } 1214 | var x = function() { 1215 | function a(a) { 1216 | return null == a ? "" : a.toString() 1217 | } 1218 | var b = null, c = function() { 1219 | function a(b, d) { 1220 | var k = null; 1221 | 1 < arguments.length && (k = P(Array.prototype.slice.call(arguments, 1), 0)); 1222 | return c.call(this, b, k) 1223 | } 1224 | function c(a, d) { 1225 | for(var e = new ca(b.e(a)), l = d;;) { 1226 | if(t(l)) { 1227 | e = e.append(b.e(K(l))), l = O(l) 1228 | }else { 1229 | return e.toString() 1230 | } 1231 | } 1232 | } 1233 | a.r = 1; 1234 | a.k = function(a) { 1235 | var b = K(a); 1236 | a = M(a); 1237 | return c(b, a) 1238 | }; 1239 | a.i = c; 1240 | return a 1241 | }(), b = function(b, e) { 1242 | switch(arguments.length) { 1243 | case 0: 1244 | return""; 1245 | case 1: 1246 | return a.call(this, b); 1247 | default: 1248 | return c.i(b, P(arguments, 1)) 1249 | } 1250 | throw Error("Invalid arity: " + arguments.length); 1251 | }; 1252 | b.r = 1; 1253 | b.k = c.k; 1254 | b.ma = n(""); 1255 | b.e = a; 1256 | b.i = c.i; 1257 | return b 1258 | }(); 1259 | function R(a, b) { 1260 | return vb((b ? b.f & 16777216 || b.ub || (b.f ? 0 : u(La, b)) : u(La, b)) ? function() { 1261 | for(var c = J(a), d = J(b);;) { 1262 | if(null == c) { 1263 | return null == d 1264 | } 1265 | if(null == d) { 1266 | return!1 1267 | } 1268 | if($a.b(K(c), K(d))) { 1269 | c = O(c), d = O(d) 1270 | }else { 1271 | return v ? !1 : null 1272 | } 1273 | } 1274 | }() : null) 1275 | } 1276 | function Bb(a, b) { 1277 | return a ^ b + 2654435769 + (a << 6) + (a >> 2) 1278 | } 1279 | function eb(a) { 1280 | if(J(a)) { 1281 | var b = T(K(a)); 1282 | for(a = O(a);;) { 1283 | if(null == a) { 1284 | return b 1285 | } 1286 | b = Bb(b, T(K(a))); 1287 | a = O(a) 1288 | } 1289 | }else { 1290 | return 0 1291 | } 1292 | } 1293 | function Cb(a) { 1294 | var b = 0; 1295 | for(a = J(a);;) { 1296 | if(a) { 1297 | var c = K(a), b = (b + (T(V.e ? V.e(c) : V.call(null, c)) ^ T(W.e ? W.e(c) : W.call(null, c)))) % 4503599627370496; 1298 | a = O(a) 1299 | }else { 1300 | return b 1301 | } 1302 | } 1303 | } 1304 | function Db(a, b, c, d, e) { 1305 | this.j = a; 1306 | this.ja = b; 1307 | this.ca = c; 1308 | this.count = d; 1309 | this.h = e; 1310 | this.n = 0; 1311 | this.f = 65937646 1312 | } 1313 | q = Db.prototype; 1314 | q.B = function() { 1315 | var a = this.h; 1316 | return null != a ? a : this.h = a = eb(this) 1317 | }; 1318 | q.T = function() { 1319 | return 1 === this.count ? null : this.ca 1320 | }; 1321 | q.s = function(a, b) { 1322 | return new Db(this.j, b, this, this.count + 1, null) 1323 | }; 1324 | q.toString = function() { 1325 | return H(this) 1326 | }; 1327 | q.K = function(a, b) { 1328 | return U.b(b, this) 1329 | }; 1330 | q.L = function(a, b, c) { 1331 | return U.c(b, c, this) 1332 | }; 1333 | q.v = function() { 1334 | return this 1335 | }; 1336 | q.D = f("count"); 1337 | q.oa = f("ja"); 1338 | q.M = f("ja"); 1339 | q.Q = function() { 1340 | return 1 === this.count ? N : this.ca 1341 | }; 1342 | q.w = function(a, b) { 1343 | return R(this, b) 1344 | }; 1345 | q.N = function(a, b) { 1346 | return new Db(b, this.ja, this.ca, this.count, this.h) 1347 | }; 1348 | q.O = f("j"); 1349 | function Eb(a) { 1350 | this.j = a; 1351 | this.n = 0; 1352 | this.f = 65937614 1353 | } 1354 | q = Eb.prototype; 1355 | q.B = n(0); 1356 | q.T = n(null); 1357 | q.s = function(a, b) { 1358 | return new Db(this.j, b, null, 1, null) 1359 | }; 1360 | q.toString = function() { 1361 | return H(this) 1362 | }; 1363 | q.K = function(a, b) { 1364 | return U.b(b, this) 1365 | }; 1366 | q.L = function(a, b, c) { 1367 | return U.c(b, c, this) 1368 | }; 1369 | q.v = n(null); 1370 | q.D = n(0); 1371 | q.oa = n(null); 1372 | q.M = n(null); 1373 | q.Q = function() { 1374 | return N 1375 | }; 1376 | q.w = function(a, b) { 1377 | return R(this, b) 1378 | }; 1379 | q.N = function(a, b) { 1380 | return new Eb(b) 1381 | }; 1382 | q.O = f("j"); 1383 | var N = new Eb(null), Fb = function() { 1384 | function a(a) { 1385 | var d = null; 1386 | 0 < arguments.length && (d = P(Array.prototype.slice.call(arguments, 0), 0)); 1387 | return b.call(this, d) 1388 | } 1389 | function b(a) { 1390 | var b; 1391 | if(a instanceof Za) { 1392 | b = a.a 1393 | }else { 1394 | a: { 1395 | for(b = [];;) { 1396 | if(null != a) { 1397 | b.push(a.M(null)), a = a.T(null) 1398 | }else { 1399 | break a 1400 | } 1401 | } 1402 | b = void 0 1403 | } 1404 | } 1405 | a = b.length; 1406 | for(var e = N;;) { 1407 | if(0 < a) { 1408 | var g = a - 1, e = e.s(null, b[a - 1]); 1409 | a = g 1410 | }else { 1411 | return e 1412 | } 1413 | } 1414 | } 1415 | a.r = 0; 1416 | a.k = function(a) { 1417 | a = J(a); 1418 | return b(a) 1419 | }; 1420 | a.i = b; 1421 | return a 1422 | }(); 1423 | function Gb(a, b, c, d) { 1424 | this.j = a; 1425 | this.ja = b; 1426 | this.ca = c; 1427 | this.h = d; 1428 | this.n = 0; 1429 | this.f = 65929452 1430 | } 1431 | q = Gb.prototype; 1432 | q.B = function() { 1433 | var a = this.h; 1434 | return null != a ? a : this.h = a = eb(this) 1435 | }; 1436 | q.T = function() { 1437 | return null == this.ca ? null : J(this.ca) 1438 | }; 1439 | q.s = function(a, b) { 1440 | return new Gb(null, b, this, this.h) 1441 | }; 1442 | q.toString = function() { 1443 | return H(this) 1444 | }; 1445 | q.K = function(a, b) { 1446 | return U.b(b, this) 1447 | }; 1448 | q.L = function(a, b, c) { 1449 | return U.c(b, c, this) 1450 | }; 1451 | q.v = function() { 1452 | return this 1453 | }; 1454 | q.M = f("ja"); 1455 | q.Q = function() { 1456 | return null == this.ca ? N : this.ca 1457 | }; 1458 | q.w = function(a, b) { 1459 | return R(this, b) 1460 | }; 1461 | q.N = function(a, b) { 1462 | return new Gb(b, this.ja, this.ca, this.h) 1463 | }; 1464 | q.O = f("j"); 1465 | function Q(a, b) { 1466 | var c = null == b; 1467 | return(c ? c : b && (b.f & 64 || b.na)) ? new Gb(null, a, b, null) : new Gb(null, a, J(b), null) 1468 | } 1469 | function Hb(a, b, c, d) { 1470 | this.kb = a; 1471 | this.name = b; 1472 | this.ea = c; 1473 | this.za = d; 1474 | this.f = 2153775105; 1475 | this.n = 4096 1476 | } 1477 | q = Hb.prototype; 1478 | q.A = function(a, b) { 1479 | return G(b, [x(":"), x(this.ea)].join("")) 1480 | }; 1481 | q.B = function() { 1482 | null == this.za && (this.za = Bb(T(this.kb), T(this.name)) + 2654435769); 1483 | return this.za 1484 | }; 1485 | q.call = function() { 1486 | var a = null; 1487 | return a = function(a, c, d) { 1488 | switch(arguments.length) { 1489 | case 2: 1490 | return jb.b(c, this); 1491 | case 3: 1492 | return jb.c(c, this, d) 1493 | } 1494 | throw Error("Invalid arity: " + arguments.length); 1495 | } 1496 | }(); 1497 | q.apply = function(a, b) { 1498 | return this.call.apply(this, [this].concat(b.slice())) 1499 | }; 1500 | q.e = function(a) { 1501 | return jb.b(a, this) 1502 | }; 1503 | q.b = function(a, b) { 1504 | return jb.c(a, this, b) 1505 | }; 1506 | q.w = function(a, b) { 1507 | return b instanceof Hb ? this.ea === b.ea : !1 1508 | }; 1509 | q.toString = function() { 1510 | return[x(":"), x(this.ea)].join("") 1511 | }; 1512 | function Ib(a, b) { 1513 | return a === b ? !0 : a instanceof Hb && b instanceof Hb ? a.ea === b.ea : !1 1514 | } 1515 | function Jb(a, b, c, d) { 1516 | this.j = a; 1517 | this.qa = b; 1518 | this.p = c; 1519 | this.h = d; 1520 | this.n = 0; 1521 | this.f = 32374988 1522 | } 1523 | q = Jb.prototype; 1524 | q.B = function() { 1525 | var a = this.h; 1526 | return null != a ? a : this.h = a = eb(this) 1527 | }; 1528 | q.T = function() { 1529 | Ka(this); 1530 | return null == this.p ? null : O(this.p) 1531 | }; 1532 | q.s = function(a, b) { 1533 | return Q(b, this) 1534 | }; 1535 | q.toString = function() { 1536 | return H(this) 1537 | }; 1538 | function Kb(a) { 1539 | null != a.qa && (a.p = a.qa.ma ? "" : a.qa.call(null), a.qa = null); 1540 | return a.p 1541 | } 1542 | q.K = function(a, b) { 1543 | return U.b(b, this) 1544 | }; 1545 | q.L = function(a, b, c) { 1546 | return U.c(b, c, this) 1547 | }; 1548 | q.v = function() { 1549 | Kb(this); 1550 | if(null == this.p) { 1551 | return null 1552 | } 1553 | for(var a = this.p;;) { 1554 | if(a instanceof Jb) { 1555 | a = Kb(a) 1556 | }else { 1557 | return this.p = a, J(this.p) 1558 | } 1559 | } 1560 | }; 1561 | q.M = function() { 1562 | Ka(this); 1563 | return null == this.p ? null : K(this.p) 1564 | }; 1565 | q.Q = function() { 1566 | Ka(this); 1567 | return null != this.p ? M(this.p) : N 1568 | }; 1569 | q.w = function(a, b) { 1570 | return R(this, b) 1571 | }; 1572 | q.N = function(a, b) { 1573 | return new Jb(b, this.qa, this.p, this.h) 1574 | }; 1575 | q.O = f("j"); 1576 | function Lb(a, b) { 1577 | this.Ba = a; 1578 | this.end = b; 1579 | this.n = 0; 1580 | this.f = 2 1581 | } 1582 | Lb.prototype.D = f("end"); 1583 | Lb.prototype.add = function(a) { 1584 | this.Ba[this.end] = a; 1585 | return this.end += 1 1586 | }; 1587 | Lb.prototype.$ = function() { 1588 | var a = new Mb(this.Ba, 0, this.end); 1589 | this.Ba = null; 1590 | return a 1591 | }; 1592 | function Mb(a, b, c) { 1593 | this.a = a; 1594 | this.q = b; 1595 | this.end = c; 1596 | this.n = 0; 1597 | this.f = 524306 1598 | } 1599 | q = Mb.prototype; 1600 | q.K = function(a, b) { 1601 | return bb.m(this.a, b, this.a[this.q], this.q + 1) 1602 | }; 1603 | q.L = function(a, b, c) { 1604 | return bb.m(this.a, b, c, this.q) 1605 | }; 1606 | q.Ua = function() { 1607 | if(this.q === this.end) { 1608 | throw Error("-drop-first of empty chunk"); 1609 | } 1610 | return new Mb(this.a, this.q + 1, this.end) 1611 | }; 1612 | q.J = function(a, b) { 1613 | return this.a[this.q + b] 1614 | }; 1615 | q.S = function(a, b, c) { 1616 | return 0 <= b && b < this.end - this.q ? this.a[this.q + b] : c 1617 | }; 1618 | q.D = function() { 1619 | return this.end - this.q 1620 | }; 1621 | var Nb = function() { 1622 | function a(a, b, c) { 1623 | return new Mb(a, b, c) 1624 | } 1625 | function b(a, b) { 1626 | return new Mb(a, b, a.length) 1627 | } 1628 | function c(a) { 1629 | return new Mb(a, 0, a.length) 1630 | } 1631 | var d = null, d = function(d, g, h) { 1632 | switch(arguments.length) { 1633 | case 1: 1634 | return c.call(this, d); 1635 | case 2: 1636 | return b.call(this, d, g); 1637 | case 3: 1638 | return a.call(this, d, g, h) 1639 | } 1640 | throw Error("Invalid arity: " + arguments.length); 1641 | }; 1642 | d.e = c; 1643 | d.b = b; 1644 | d.c = a; 1645 | return d 1646 | }(); 1647 | function Ob(a, b, c, d) { 1648 | this.$ = a; 1649 | this.Y = b; 1650 | this.j = c; 1651 | this.h = d; 1652 | this.f = 31850732; 1653 | this.n = 1536 1654 | } 1655 | q = Ob.prototype; 1656 | q.B = function() { 1657 | var a = this.h; 1658 | return null != a ? a : this.h = a = eb(this) 1659 | }; 1660 | q.T = function() { 1661 | if(1 < z(this.$)) { 1662 | return new Ob(Ua(this.$), this.Y, this.j, null) 1663 | } 1664 | var a = Ka(this.Y); 1665 | return null == a ? null : a 1666 | }; 1667 | q.s = function(a, b) { 1668 | return Q(b, this) 1669 | }; 1670 | q.toString = function() { 1671 | return H(this) 1672 | }; 1673 | q.v = function() { 1674 | return this 1675 | }; 1676 | q.M = function() { 1677 | return B.b(this.$, 0) 1678 | }; 1679 | q.Q = function() { 1680 | return 1 < z(this.$) ? new Ob(Ua(this.$), this.Y, this.j, null) : null == this.Y ? N : this.Y 1681 | }; 1682 | q.Ca = function() { 1683 | return null == this.Y ? null : this.Y 1684 | }; 1685 | q.w = function(a, b) { 1686 | return R(this, b) 1687 | }; 1688 | q.N = function(a, b) { 1689 | return new Ob(this.$, this.Y, b, this.h) 1690 | }; 1691 | q.O = f("j"); 1692 | q.Da = f("$"); 1693 | q.Ea = function() { 1694 | return null == this.Y ? N : this.Y 1695 | }; 1696 | function Pb(a) { 1697 | for(var b = [];;) { 1698 | if(J(a)) { 1699 | b.push(K(a)), a = O(a) 1700 | }else { 1701 | return b 1702 | } 1703 | } 1704 | } 1705 | function Qb(a, b) { 1706 | if(cb(a)) { 1707 | return S(a) 1708 | } 1709 | for(var c = a, d = b, e = 0;;) { 1710 | if(0 < d && J(c)) { 1711 | c = O(c), d -= 1, e += 1 1712 | }else { 1713 | return e 1714 | } 1715 | } 1716 | } 1717 | var Sb = function Rb(b) { 1718 | return null == b ? null : null == O(b) ? J(K(b)) : v ? Q(K(b), Rb(O(b))) : null 1719 | }, Tb = function() { 1720 | function a(a, b, c, d) { 1721 | return Q(a, Q(b, Q(c, d))) 1722 | } 1723 | function b(a, b, c) { 1724 | return Q(a, Q(b, c)) 1725 | } 1726 | var c = null, d = function() { 1727 | function a(c, d, e, m, p) { 1728 | var r = null; 1729 | 4 < arguments.length && (r = P(Array.prototype.slice.call(arguments, 4), 0)); 1730 | return b.call(this, c, d, e, m, r) 1731 | } 1732 | function b(a, c, d, e, g) { 1733 | return Q(a, Q(c, Q(d, Q(e, Sb(g))))) 1734 | } 1735 | a.r = 4; 1736 | a.k = function(a) { 1737 | var c = K(a); 1738 | a = O(a); 1739 | var d = K(a); 1740 | a = O(a); 1741 | var e = K(a); 1742 | a = O(a); 1743 | var p = K(a); 1744 | a = M(a); 1745 | return b(c, d, e, p, a) 1746 | }; 1747 | a.i = b; 1748 | return a 1749 | }(), c = function(c, g, h, k, l) { 1750 | switch(arguments.length) { 1751 | case 1: 1752 | return J(c); 1753 | case 2: 1754 | return Q(c, g); 1755 | case 3: 1756 | return b.call(this, c, g, h); 1757 | case 4: 1758 | return a.call(this, c, g, h, k); 1759 | default: 1760 | return d.i(c, g, h, k, P(arguments, 4)) 1761 | } 1762 | throw Error("Invalid arity: " + arguments.length); 1763 | }; 1764 | c.r = 4; 1765 | c.k = d.k; 1766 | c.e = function(a) { 1767 | return J(a) 1768 | }; 1769 | c.b = function(a, b) { 1770 | return Q(a, b) 1771 | }; 1772 | c.c = b; 1773 | c.m = a; 1774 | c.i = d.i; 1775 | return c 1776 | }(); 1777 | function Ub(a, b, c) { 1778 | var d = J(c); 1779 | if(0 === b) { 1780 | return a.ma ? "" : a.call(null) 1781 | } 1782 | c = D(d); 1783 | var e = F(d); 1784 | if(1 === b) { 1785 | return a.e ? a.e(c) : a.e ? a.e(c) : a.call(null, c) 1786 | } 1787 | var d = D(e), g = F(e); 1788 | if(2 === b) { 1789 | return a.b ? a.b(c, d) : a.b ? a.b(c, d) : a.call(null, c, d) 1790 | } 1791 | var e = D(g), h = F(g); 1792 | if(3 === b) { 1793 | return a.c ? a.c(c, d, e) : a.c ? a.c(c, d, e) : a.call(null, c, d, e) 1794 | } 1795 | var g = D(h), k = F(h); 1796 | if(4 === b) { 1797 | return a.m ? a.m(c, d, e, g) : a.m ? a.m(c, d, e, g) : a.call(null, c, d, e, g) 1798 | } 1799 | h = D(k); 1800 | k = F(k); 1801 | if(5 === b) { 1802 | return a.F ? a.F(c, d, e, g, h) : a.F ? a.F(c, d, e, g, h) : a.call(null, c, d, e, g, h) 1803 | } 1804 | a = D(k); 1805 | var l = F(k); 1806 | if(6 === b) { 1807 | return a.aa ? a.aa(c, d, e, g, h, a) : a.aa ? a.aa(c, d, e, g, h, a) : a.call(null, c, d, e, g, h, a) 1808 | } 1809 | var k = D(l), m = F(l); 1810 | if(7 === b) { 1811 | return a.ga ? a.ga(c, d, e, g, h, a, k) : a.ga ? a.ga(c, d, e, g, h, a, k) : a.call(null, c, d, e, g, h, a, k) 1812 | } 1813 | var l = D(m), p = F(m); 1814 | if(8 === b) { 1815 | return a.Qa ? a.Qa(c, d, e, g, h, a, k, l) : a.Qa ? a.Qa(c, d, e, g, h, a, k, l) : a.call(null, c, d, e, g, h, a, k, l) 1816 | } 1817 | var m = D(p), r = F(p); 1818 | if(9 === b) { 1819 | return a.Ra ? a.Ra(c, d, e, g, h, a, k, l, m) : a.Ra ? a.Ra(c, d, e, g, h, a, k, l, m) : a.call(null, c, d, e, g, h, a, k, l, m) 1820 | } 1821 | var p = D(r), y = F(r); 1822 | if(10 === b) { 1823 | return a.Fa ? a.Fa(c, d, e, g, h, a, k, l, m, p) : a.Fa ? a.Fa(c, d, e, g, h, a, k, l, m, p) : a.call(null, c, d, e, g, h, a, k, l, m, p) 1824 | } 1825 | var r = D(y), C = F(y); 1826 | if(11 === b) { 1827 | return a.Ga ? a.Ga(c, d, e, g, h, a, k, l, m, p, r) : a.Ga ? a.Ga(c, d, e, g, h, a, k, l, m, p, r) : a.call(null, c, d, e, g, h, a, k, l, m, p, r) 1828 | } 1829 | var y = D(C), E = F(C); 1830 | if(12 === b) { 1831 | return a.Ha ? a.Ha(c, d, e, g, h, a, k, l, m, p, r, y) : a.Ha ? a.Ha(c, d, e, g, h, a, k, l, m, p, r, y) : a.call(null, c, d, e, g, h, a, k, l, m, p, r, y) 1832 | } 1833 | var C = D(E), I = F(E); 1834 | if(13 === b) { 1835 | return a.Ia ? a.Ia(c, d, e, g, h, a, k, l, m, p, r, y, C) : a.Ia ? a.Ia(c, d, e, g, h, a, k, l, m, p, r, y, C) : a.call(null, c, d, e, g, h, a, k, l, m, p, r, y, C) 1836 | } 1837 | var E = D(I), L = F(I); 1838 | if(14 === b) { 1839 | return a.Ja ? a.Ja(c, d, e, g, h, a, k, l, m, p, r, y, C, E) : a.Ja ? a.Ja(c, d, e, g, h, a, k, l, m, p, r, y, C, E) : a.call(null, c, d, e, g, h, a, k, l, m, p, r, y, C, E) 1840 | } 1841 | var I = D(L), X = F(L); 1842 | if(15 === b) { 1843 | return a.Ka ? a.Ka(c, d, e, g, h, a, k, l, m, p, r, y, C, E, I) : a.Ka ? a.Ka(c, d, e, g, h, a, k, l, m, p, r, y, C, E, I) : a.call(null, c, d, e, g, h, a, k, l, m, p, r, y, C, E, I) 1844 | } 1845 | var L = D(X), da = F(X); 1846 | if(16 === b) { 1847 | return a.La ? a.La(c, d, e, g, h, a, k, l, m, p, r, y, C, E, I, L) : a.La ? a.La(c, d, e, g, h, a, k, l, m, p, r, y, C, E, I, L) : a.call(null, c, d, e, g, h, a, k, l, m, p, r, y, C, E, I, L) 1848 | } 1849 | var X = D(da), la = F(da); 1850 | if(17 === b) { 1851 | return a.Ma ? a.Ma(c, d, e, g, h, a, k, l, m, p, r, y, C, E, I, L, X) : a.Ma ? a.Ma(c, d, e, g, h, a, k, l, m, p, r, y, C, E, I, L, X) : a.call(null, c, d, e, g, h, a, k, l, m, p, r, y, C, E, I, L, X) 1852 | } 1853 | var da = D(la), lb = F(la); 1854 | if(18 === b) { 1855 | return a.Na ? a.Na(c, d, e, g, h, a, k, l, m, p, r, y, C, E, I, L, X, da) : a.Na ? a.Na(c, d, e, g, h, a, k, l, m, p, r, y, C, E, I, L, X, da) : a.call(null, c, d, e, g, h, a, k, l, m, p, r, y, C, E, I, L, X, da) 1856 | } 1857 | la = D(lb); 1858 | lb = F(lb); 1859 | if(19 === b) { 1860 | return a.Oa ? a.Oa(c, d, e, g, h, a, k, l, m, p, r, y, C, E, I, L, X, da, la) : a.Oa ? a.Oa(c, d, e, g, h, a, k, l, m, p, r, y, C, E, I, L, X, da, la) : a.call(null, c, d, e, g, h, a, k, l, m, p, r, y, C, E, I, L, X, da, la) 1861 | } 1862 | var Yb = D(lb); 1863 | F(lb); 1864 | if(20 === b) { 1865 | return a.Pa ? a.Pa(c, d, e, g, h, a, k, l, m, p, r, y, C, E, I, L, X, da, la, Yb) : a.Pa ? a.Pa(c, d, e, g, h, a, k, l, m, p, r, y, C, E, I, L, X, da, la, Yb) : a.call(null, c, d, e, g, h, a, k, l, m, p, r, y, C, E, I, L, X, da, la, Yb) 1866 | } 1867 | throw Error("Only up to 20 arguments supported on functions"); 1868 | } 1869 | var Vb = function() { 1870 | function a(a, b, c, d, e) { 1871 | b = Tb.m(b, c, d, e); 1872 | c = a.r; 1873 | return a.k ? (d = Qb(b, c + 1), d <= c ? Ub(a, d, b) : a.k(b)) : a.apply(a, Pb(b)) 1874 | } 1875 | function b(a, b, c, d) { 1876 | b = Tb.c(b, c, d); 1877 | c = a.r; 1878 | return a.k ? (d = Qb(b, c + 1), d <= c ? Ub(a, d, b) : a.k(b)) : a.apply(a, Pb(b)) 1879 | } 1880 | function c(a, b, c) { 1881 | b = Tb.b(b, c); 1882 | c = a.r; 1883 | if(a.k) { 1884 | var d = Qb(b, c + 1); 1885 | return d <= c ? Ub(a, d, b) : a.k(b) 1886 | } 1887 | return a.apply(a, Pb(b)) 1888 | } 1889 | function d(a, b) { 1890 | var c = a.r; 1891 | if(a.k) { 1892 | var d = Qb(b, c + 1); 1893 | return d <= c ? Ub(a, d, b) : a.k(b) 1894 | } 1895 | return a.apply(a, Pb(b)) 1896 | } 1897 | var e = null, g = function() { 1898 | function a(c, d, e, g, h, C) { 1899 | var E = null; 1900 | 5 < arguments.length && (E = P(Array.prototype.slice.call(arguments, 5), 0)); 1901 | return b.call(this, c, d, e, g, h, E) 1902 | } 1903 | function b(a, c, d, e, g, h) { 1904 | c = Q(c, Q(d, Q(e, Q(g, Sb(h))))); 1905 | d = a.r; 1906 | return a.k ? (e = Qb(c, d + 1), e <= d ? Ub(a, e, c) : a.k(c)) : a.apply(a, Pb(c)) 1907 | } 1908 | a.r = 5; 1909 | a.k = function(a) { 1910 | var c = K(a); 1911 | a = O(a); 1912 | var d = K(a); 1913 | a = O(a); 1914 | var e = K(a); 1915 | a = O(a); 1916 | var g = K(a); 1917 | a = O(a); 1918 | var h = K(a); 1919 | a = M(a); 1920 | return b(c, d, e, g, h, a) 1921 | }; 1922 | a.i = b; 1923 | return a 1924 | }(), e = function(e, k, l, m, p, r) { 1925 | switch(arguments.length) { 1926 | case 2: 1927 | return d.call(this, e, k); 1928 | case 3: 1929 | return c.call(this, e, k, l); 1930 | case 4: 1931 | return b.call(this, e, k, l, m); 1932 | case 5: 1933 | return a.call(this, e, k, l, m, p); 1934 | default: 1935 | return g.i(e, k, l, m, p, P(arguments, 5)) 1936 | } 1937 | throw Error("Invalid arity: " + arguments.length); 1938 | }; 1939 | e.r = 5; 1940 | e.k = g.k; 1941 | e.b = d; 1942 | e.c = c; 1943 | e.m = b; 1944 | e.F = a; 1945 | e.i = g.i; 1946 | return e 1947 | }(); 1948 | function Wb(a, b) { 1949 | for(;;) { 1950 | if(null == J(b)) { 1951 | return!0 1952 | } 1953 | if(t(a.e ? a.e(K(b)) : a.call(null, K(b)))) { 1954 | var c = a, d = O(b); 1955 | a = c; 1956 | b = d 1957 | }else { 1958 | return v ? !1 : null 1959 | } 1960 | } 1961 | } 1962 | function Xb(a) { 1963 | return a 1964 | } 1965 | var Zb = function() { 1966 | function a(a, b, c, e) { 1967 | return new Jb(null, function() { 1968 | var m = J(b), p = J(c), r = J(e); 1969 | return m && p && r ? Q(a.c ? a.c(K(m), K(p), K(r)) : a.call(null, K(m), K(p), K(r)), d.m(a, M(m), M(p), M(r))) : null 1970 | }, null, null) 1971 | } 1972 | function b(a, b, c) { 1973 | return new Jb(null, function() { 1974 | var e = J(b), m = J(c); 1975 | return e && m ? Q(a.b ? a.b(K(e), K(m)) : a.call(null, K(e), K(m)), d.c(a, M(e), M(m))) : null 1976 | }, null, null) 1977 | } 1978 | function c(a, b) { 1979 | return new Jb(null, function() { 1980 | var c = J(b); 1981 | if(c) { 1982 | if(sb(c)) { 1983 | for(var e = Va(c), m = S(e), p = new Lb(Array(m), 0), r = 0;;) { 1984 | if(r < m) { 1985 | var y = a.e ? a.e(B.b(e, r)) : a.call(null, B.b(e, r)); 1986 | p.add(y); 1987 | r += 1 1988 | }else { 1989 | break 1990 | } 1991 | } 1992 | e = p.$(); 1993 | c = d.b(a, Wa(c)); 1994 | return 0 === z(e) ? c : new Ob(e, c, null, null) 1995 | } 1996 | return Q(a.e ? a.e(K(c)) : a.call(null, K(c)), d.b(a, M(c))) 1997 | } 1998 | return null 1999 | }, null, null) 2000 | } 2001 | var d = null, e = function() { 2002 | function a(c, d, e, g, r) { 2003 | var y = null; 2004 | 4 < arguments.length && (y = P(Array.prototype.slice.call(arguments, 4), 0)); 2005 | return b.call(this, c, d, e, g, y) 2006 | } 2007 | function b(a, c, e, g, h) { 2008 | return d.b(function(b) { 2009 | return Vb.b(a, b) 2010 | }, function C(a) { 2011 | return new Jb(null, function() { 2012 | var b = d.b(J, a); 2013 | return Wb(Xb, b) ? Q(d.b(K, b), C(d.b(M, b))) : null 2014 | }, null, null) 2015 | }(gb.i(h, g, P([e, c], 0)))) 2016 | } 2017 | a.r = 4; 2018 | a.k = function(a) { 2019 | var c = K(a); 2020 | a = O(a); 2021 | var d = K(a); 2022 | a = O(a); 2023 | var e = K(a); 2024 | a = O(a); 2025 | var g = K(a); 2026 | a = M(a); 2027 | return b(c, d, e, g, a) 2028 | }; 2029 | a.i = b; 2030 | return a 2031 | }(), d = function(d, h, k, l, m) { 2032 | switch(arguments.length) { 2033 | case 2: 2034 | return c.call(this, d, h); 2035 | case 3: 2036 | return b.call(this, d, h, k); 2037 | case 4: 2038 | return a.call(this, d, h, k, l); 2039 | default: 2040 | return e.i(d, h, k, l, P(arguments, 4)) 2041 | } 2042 | throw Error("Invalid arity: " + arguments.length); 2043 | }; 2044 | d.r = 4; 2045 | d.k = e.k; 2046 | d.b = c; 2047 | d.c = b; 2048 | d.m = a; 2049 | d.i = e.i; 2050 | return d 2051 | }(); 2052 | function $b(a, b) { 2053 | var c; 2054 | null != a ? a && (a.n & 4 || a.pb) ? (c = yb.c(Qa, Pa(a), b), c = Ra(c)) : c = yb.c(A, a, b) : c = yb.c(gb, N, b); 2055 | return c 2056 | } 2057 | function ac(a, b) { 2058 | this.l = a; 2059 | this.a = b 2060 | } 2061 | function bc(a) { 2062 | a = a.d; 2063 | return 32 > a ? 0 : a - 1 >>> 5 << 5 2064 | } 2065 | function cc(a, b, c) { 2066 | for(;;) { 2067 | if(0 === b) { 2068 | return c 2069 | } 2070 | var d = new ac(a, Array(32)); 2071 | d.a[0] = c; 2072 | c = d; 2073 | b -= 5 2074 | } 2075 | } 2076 | var ec = function dc(b, c, d, e) { 2077 | var g = new ac(d.l, d.a.slice()), h = b.d - 1 >>> c & 31; 2078 | 5 === c ? g.a[h] = e : (d = d.a[h], b = null != d ? dc(b, c - 5, d, e) : cc(null, c - 5, e), g.a[h] = b); 2079 | return g 2080 | }; 2081 | function fc(a, b) { 2082 | throw Error([x("No item "), x(a), x(" in vector of length "), x(b)].join("")); 2083 | } 2084 | function gc(a, b) { 2085 | if(0 <= b && b < a.d) { 2086 | if(b >= bc(a)) { 2087 | return a.C 2088 | } 2089 | for(var c = a.root, d = a.shift;;) { 2090 | if(0 < d) { 2091 | var e = d - 5, c = c.a[b >>> d & 31], d = e 2092 | }else { 2093 | return c.a 2094 | } 2095 | } 2096 | }else { 2097 | return fc(b, a.d) 2098 | } 2099 | } 2100 | var ic = function hc(b, c, d, e, g) { 2101 | var h = new ac(d.l, d.a.slice()); 2102 | if(0 === c) { 2103 | h.a[e & 31] = g 2104 | }else { 2105 | var k = e >>> c & 31; 2106 | b = hc(b, c - 5, d.a[k], e, g); 2107 | h.a[k] = b 2108 | } 2109 | return h 2110 | }; 2111 | function jc(a, b, c, d, e, g) { 2112 | this.j = a; 2113 | this.d = b; 2114 | this.shift = c; 2115 | this.root = d; 2116 | this.C = e; 2117 | this.h = g; 2118 | this.n = 4; 2119 | this.f = 167668511 2120 | } 2121 | q = jc.prototype; 2122 | q.ua = function() { 2123 | return new kc(this.d, this.shift, lc.e ? lc.e(this.root) : lc.call(null, this.root), mc.e ? mc.e(this.C) : mc.call(null, this.C)) 2124 | }; 2125 | q.B = function() { 2126 | var a = this.h; 2127 | return null != a ? a : this.h = a = eb(this) 2128 | }; 2129 | q.G = function(a, b) { 2130 | return B.c(this, b, null) 2131 | }; 2132 | q.H = function(a, b, c) { 2133 | return B.c(this, b, c) 2134 | }; 2135 | q.la = function(a, b, c) { 2136 | if(0 <= b && b < this.d) { 2137 | return bc(this) <= b ? (a = this.C.slice(), a[b & 31] = c, new jc(this.j, this.d, this.shift, this.root, a, null)) : new jc(this.j, this.d, this.shift, ic(this, this.shift, this.root, b, c), this.C, null) 2138 | } 2139 | if(b === this.d) { 2140 | return A(this, c) 2141 | } 2142 | if(v) { 2143 | throw Error([x("Index "), x(b), x(" out of bounds [0,"), x(this.d), x("]")].join("")); 2144 | } 2145 | return null 2146 | }; 2147 | q.call = function() { 2148 | var a = null; 2149 | return a = function(a, c, d) { 2150 | switch(arguments.length) { 2151 | case 2: 2152 | return this.J(null, c); 2153 | case 3: 2154 | return this.S(null, c, d) 2155 | } 2156 | throw Error("Invalid arity: " + arguments.length); 2157 | } 2158 | }(); 2159 | q.apply = function(a, b) { 2160 | return this.call.apply(this, [this].concat(b.slice())) 2161 | }; 2162 | q.e = function(a) { 2163 | return this.J(null, a) 2164 | }; 2165 | q.b = function(a, b) { 2166 | return this.S(null, a, b) 2167 | }; 2168 | q.s = function(a, b) { 2169 | if(32 > this.d - bc(this)) { 2170 | var c = this.C.slice(); 2171 | c.push(b); 2172 | return new jc(this.j, this.d + 1, this.shift, this.root, c, null) 2173 | } 2174 | var d = this.d >>> 5 > 1 << this.shift, c = d ? this.shift + 5 : this.shift; 2175 | if(d) { 2176 | d = new ac(null, Array(32)); 2177 | d.a[0] = this.root; 2178 | var e = cc(null, this.shift, new ac(null, this.C)); 2179 | d.a[1] = e 2180 | }else { 2181 | d = ec(this, this.shift, this.root, new ac(null, this.C)) 2182 | } 2183 | return new jc(this.j, this.d + 1, c, d, [b], null) 2184 | }; 2185 | q.Ya = function() { 2186 | return B.b(this, 0) 2187 | }; 2188 | q.Za = function() { 2189 | return B.b(this, 1) 2190 | }; 2191 | q.toString = function() { 2192 | return H(this) 2193 | }; 2194 | q.K = function(a, b) { 2195 | return ab.b(this, b) 2196 | }; 2197 | q.L = function(a, b, c) { 2198 | return ab.c(this, b, c) 2199 | }; 2200 | q.v = function() { 2201 | return 0 === this.d ? null : 32 > this.d ? P.e(this.C) : v ? Y.c ? Y.c(this, 0, 0) : Y.call(null, this, 0, 0) : null 2202 | }; 2203 | q.D = f("d"); 2204 | q.oa = function() { 2205 | return 0 < this.d ? B.b(this, this.d - 1) : null 2206 | }; 2207 | q.Sa = function(a, b, c) { 2208 | return ua(this, b, c) 2209 | }; 2210 | q.w = function(a, b) { 2211 | return R(this, b) 2212 | }; 2213 | q.N = function(a, b) { 2214 | return new jc(b, this.d, this.shift, this.root, this.C, this.h) 2215 | }; 2216 | q.O = f("j"); 2217 | q.J = function(a, b) { 2218 | return gc(this, b)[b & 31] 2219 | }; 2220 | q.S = function(a, b, c) { 2221 | return 0 <= b && b < this.d ? B.b(this, b) : c 2222 | }; 2223 | var nc = new ac(null, Array(32)); 2224 | function oc(a) { 2225 | var b = a.length; 2226 | if(32 > b) { 2227 | return new jc(null, b, 5, nc, a, null) 2228 | } 2229 | for(var c = a.slice(0, 32), d = 32, e = Pa(new jc(null, 32, 5, nc, c, null));;) { 2230 | if(d < b) { 2231 | c = d + 1, e = Qa(e, a[d]), d = c 2232 | }else { 2233 | return Ra(e) 2234 | } 2235 | } 2236 | } 2237 | function pc(a, b, c, d, e, g) { 2238 | this.u = a; 2239 | this.o = b; 2240 | this.g = c; 2241 | this.q = d; 2242 | this.j = e; 2243 | this.h = g; 2244 | this.f = 32243948; 2245 | this.n = 1536 2246 | } 2247 | q = pc.prototype; 2248 | q.B = function() { 2249 | var a = this.h; 2250 | return null != a ? a : this.h = a = eb(this) 2251 | }; 2252 | q.T = function() { 2253 | if(this.q + 1 < this.o.length) { 2254 | var a = Y.m ? Y.m(this.u, this.o, this.g, this.q + 1) : Y.call(null, this.u, this.o, this.g, this.q + 1); 2255 | return null == a ? null : a 2256 | } 2257 | return Xa(this) 2258 | }; 2259 | q.s = function(a, b) { 2260 | return Q(b, this) 2261 | }; 2262 | q.toString = function() { 2263 | return H(this) 2264 | }; 2265 | q.K = function(a, b) { 2266 | return ab.b(qc.c ? qc.c(this.u, this.g + this.q, S(this.u)) : qc.call(null, this.u, this.g + this.q, S(this.u)), b) 2267 | }; 2268 | q.L = function(a, b, c) { 2269 | return ab.c(qc.c ? qc.c(this.u, this.g + this.q, S(this.u)) : qc.call(null, this.u, this.g + this.q, S(this.u)), b, c) 2270 | }; 2271 | q.v = function() { 2272 | return this 2273 | }; 2274 | q.M = function() { 2275 | return this.o[this.q] 2276 | }; 2277 | q.Q = function() { 2278 | if(this.q + 1 < this.o.length) { 2279 | var a = Y.m ? Y.m(this.u, this.o, this.g, this.q + 1) : Y.call(null, this.u, this.o, this.g, this.q + 1); 2280 | return null == a ? N : a 2281 | } 2282 | return Wa(this) 2283 | }; 2284 | q.Ca = function() { 2285 | var a = this.o.length, a = this.g + a < z(this.u) ? Y.c ? Y.c(this.u, this.g + a, 0) : Y.call(null, this.u, this.g + a, 0) : null; 2286 | return null == a ? null : a 2287 | }; 2288 | q.w = function(a, b) { 2289 | return R(this, b) 2290 | }; 2291 | q.N = function(a, b) { 2292 | return Y.F ? Y.F(this.u, this.o, this.g, this.q, b) : Y.call(null, this.u, this.o, this.g, this.q, b) 2293 | }; 2294 | q.Da = function() { 2295 | return Nb.b(this.o, this.q) 2296 | }; 2297 | q.Ea = function() { 2298 | var a = this.o.length, a = this.g + a < z(this.u) ? Y.c ? Y.c(this.u, this.g + a, 0) : Y.call(null, this.u, this.g + a, 0) : null; 2299 | return null == a ? N : a 2300 | }; 2301 | var Y = function() { 2302 | function a(a, b, c, d, l) { 2303 | return new pc(a, b, c, d, l, null) 2304 | } 2305 | function b(a, b, c, d) { 2306 | return new pc(a, b, c, d, null, null) 2307 | } 2308 | function c(a, b, c) { 2309 | return new pc(a, gc(a, b), b, c, null, null) 2310 | } 2311 | var d = null, d = function(d, g, h, k, l) { 2312 | switch(arguments.length) { 2313 | case 3: 2314 | return c.call(this, d, g, h); 2315 | case 4: 2316 | return b.call(this, d, g, h, k); 2317 | case 5: 2318 | return a.call(this, d, g, h, k, l) 2319 | } 2320 | throw Error("Invalid arity: " + arguments.length); 2321 | }; 2322 | d.c = c; 2323 | d.m = b; 2324 | d.F = a; 2325 | return d 2326 | }(); 2327 | function rc(a, b, c, d, e) { 2328 | this.j = a; 2329 | this.X = b; 2330 | this.start = c; 2331 | this.end = d; 2332 | this.h = e; 2333 | this.n = 0; 2334 | this.f = 32400159 2335 | } 2336 | q = rc.prototype; 2337 | q.B = function() { 2338 | var a = this.h; 2339 | return null != a ? a : this.h = a = eb(this) 2340 | }; 2341 | q.G = function(a, b) { 2342 | return B.c(this, b, null) 2343 | }; 2344 | q.H = function(a, b, c) { 2345 | return B.c(this, b, c) 2346 | }; 2347 | q.la = function(a, b, c) { 2348 | var d = this, e = d.start + b; 2349 | return sc.F ? sc.F(d.j, mb.c(d.X, e, c), d.start, function() { 2350 | var a = d.end, b = e + 1; 2351 | return a > b ? a : b 2352 | }(), null) : sc.call(null, d.j, mb.c(d.X, e, c), d.start, function() { 2353 | var a = d.end, b = e + 1; 2354 | return a > b ? a : b 2355 | }(), null) 2356 | }; 2357 | q.call = function() { 2358 | var a = null; 2359 | return a = function(a, c, d) { 2360 | switch(arguments.length) { 2361 | case 2: 2362 | return this.J(null, c); 2363 | case 3: 2364 | return this.S(null, c, d) 2365 | } 2366 | throw Error("Invalid arity: " + arguments.length); 2367 | } 2368 | }(); 2369 | q.apply = function(a, b) { 2370 | return this.call.apply(this, [this].concat(b.slice())) 2371 | }; 2372 | q.e = function(a) { 2373 | return this.J(null, a) 2374 | }; 2375 | q.b = function(a, b) { 2376 | return this.S(null, a, b) 2377 | }; 2378 | q.s = function(a, b) { 2379 | return sc.F ? sc.F(this.j, Ba(this.X, this.end, b), this.start, this.end + 1, null) : sc.call(null, this.j, Ba(this.X, this.end, b), this.start, this.end + 1, null) 2380 | }; 2381 | q.toString = function() { 2382 | return H(this) 2383 | }; 2384 | q.K = function(a, b) { 2385 | return ab.b(this, b) 2386 | }; 2387 | q.L = function(a, b, c) { 2388 | return ab.c(this, b, c) 2389 | }; 2390 | q.v = function() { 2391 | var a = this; 2392 | return function c(d) { 2393 | return d === a.end ? null : Q(B.b(a.X, d), new Jb(null, function() { 2394 | return c(d + 1) 2395 | }, null, null)) 2396 | }(a.start) 2397 | }; 2398 | q.D = function() { 2399 | return this.end - this.start 2400 | }; 2401 | q.oa = function() { 2402 | return B.b(this.X, this.end - 1) 2403 | }; 2404 | q.Sa = function(a, b, c) { 2405 | return ua(this, b, c) 2406 | }; 2407 | q.w = function(a, b) { 2408 | return R(this, b) 2409 | }; 2410 | q.N = function(a, b) { 2411 | return sc.F ? sc.F(b, this.X, this.start, this.end, this.h) : sc.call(null, b, this.X, this.start, this.end, this.h) 2412 | }; 2413 | q.O = f("j"); 2414 | q.J = function(a, b) { 2415 | return 0 > b || this.end <= this.start + b ? fc(b, this.end - this.start) : B.b(this.X, this.start + b) 2416 | }; 2417 | q.S = function(a, b, c) { 2418 | return 0 > b || this.end <= this.start + b ? c : B.c(this.X, this.start + b, c) 2419 | }; 2420 | function sc(a, b, c, d, e) { 2421 | for(;;) { 2422 | if(b instanceof rc) { 2423 | c = b.start + c, d = b.start + d, b = b.X 2424 | }else { 2425 | var g = S(b); 2426 | if(0 > c || 0 > d || c > g || d > g) { 2427 | throw Error("Index out of bounds"); 2428 | } 2429 | return new rc(a, b, c, d, e) 2430 | } 2431 | } 2432 | } 2433 | var qc = function() { 2434 | function a(a, b, c) { 2435 | return sc(null, a, b, c, null) 2436 | } 2437 | function b(a, b) { 2438 | return c.c(a, b, S(a)) 2439 | } 2440 | var c = null, c = function(c, e, g) { 2441 | switch(arguments.length) { 2442 | case 2: 2443 | return b.call(this, c, e); 2444 | case 3: 2445 | return a.call(this, c, e, g) 2446 | } 2447 | throw Error("Invalid arity: " + arguments.length); 2448 | }; 2449 | c.b = b; 2450 | c.c = a; 2451 | return c 2452 | }(); 2453 | function lc(a) { 2454 | return new ac({}, a.a.slice()) 2455 | } 2456 | function mc(a) { 2457 | var b = Array(32); 2458 | tb(a, 0, b, 0, a.length); 2459 | return b 2460 | } 2461 | var uc = function tc(b, c, d, e) { 2462 | d = b.root.l === d.l ? d : new ac(b.root.l, d.a.slice()); 2463 | var g = b.d - 1 >>> c & 31; 2464 | if(5 === c) { 2465 | b = e 2466 | }else { 2467 | var h = d.a[g]; 2468 | b = null != h ? tc(b, c - 5, h, e) : cc(b.root.l, c - 5, e) 2469 | } 2470 | d.a[g] = b; 2471 | return d 2472 | }; 2473 | function kc(a, b, c, d) { 2474 | this.d = a; 2475 | this.shift = b; 2476 | this.root = c; 2477 | this.C = d; 2478 | this.f = 275; 2479 | this.n = 88 2480 | } 2481 | q = kc.prototype; 2482 | q.call = function() { 2483 | var a = null; 2484 | return a = function(a, c, d) { 2485 | switch(arguments.length) { 2486 | case 2: 2487 | return this.G(null, c); 2488 | case 3: 2489 | return this.H(null, c, d) 2490 | } 2491 | throw Error("Invalid arity: " + arguments.length); 2492 | } 2493 | }(); 2494 | q.apply = function(a, b) { 2495 | return this.call.apply(this, [this].concat(b.slice())) 2496 | }; 2497 | q.e = function(a) { 2498 | return this.G(null, a) 2499 | }; 2500 | q.b = function(a, b) { 2501 | return this.H(null, a, b) 2502 | }; 2503 | q.G = function(a, b) { 2504 | return B.c(this, b, null) 2505 | }; 2506 | q.H = function(a, b, c) { 2507 | return B.c(this, b, c) 2508 | }; 2509 | q.J = function(a, b) { 2510 | if(this.root.l) { 2511 | return gc(this, b)[b & 31] 2512 | } 2513 | throw Error("nth after persistent!"); 2514 | }; 2515 | q.S = function(a, b, c) { 2516 | return 0 <= b && b < this.d ? B.b(this, b) : c 2517 | }; 2518 | q.D = function() { 2519 | if(this.root.l) { 2520 | return this.d 2521 | } 2522 | throw Error("count after persistent!"); 2523 | }; 2524 | q.$a = function(a, b, c) { 2525 | var d = this; 2526 | if(d.root.l) { 2527 | if(0 <= b && b < d.d) { 2528 | return bc(this) <= b ? d.C[b & 31] = c : (a = function g(a, k) { 2529 | var l = d.root.l === k.l ? k : new ac(d.root.l, k.a.slice()); 2530 | if(0 === a) { 2531 | l.a[b & 31] = c 2532 | }else { 2533 | var m = b >>> a & 31, p = g(a - 5, l.a[m]); 2534 | l.a[m] = p 2535 | } 2536 | return l 2537 | }.call(null, d.shift, d.root), d.root = a), this 2538 | } 2539 | if(b === d.d) { 2540 | return Qa(this, c) 2541 | } 2542 | if(v) { 2543 | throw Error([x("Index "), x(b), x(" out of bounds for TransientVector of length"), x(d.d)].join("")); 2544 | } 2545 | return null 2546 | } 2547 | throw Error("assoc! after persistent!"); 2548 | }; 2549 | q.pa = function(a, b, c) { 2550 | return Ta(this, b, c) 2551 | }; 2552 | q.va = function(a, b) { 2553 | if(this.root.l) { 2554 | if(32 > this.d - bc(this)) { 2555 | this.C[this.d & 31] = b 2556 | }else { 2557 | var c = new ac(this.root.l, this.C), d = Array(32); 2558 | d[0] = b; 2559 | this.C = d; 2560 | if(this.d >>> 5 > 1 << this.shift) { 2561 | var d = Array(32), e = this.shift + 5; 2562 | d[0] = this.root; 2563 | d[1] = cc(this.root.l, this.shift, c); 2564 | this.root = new ac(this.root.l, d); 2565 | this.shift = e 2566 | }else { 2567 | this.root = uc(this, this.shift, this.root, c) 2568 | } 2569 | } 2570 | this.d += 1; 2571 | return this 2572 | } 2573 | throw Error("conj! after persistent!"); 2574 | }; 2575 | q.wa = function() { 2576 | if(this.root.l) { 2577 | this.root.l = null; 2578 | var a = this.d - bc(this), b = Array(a); 2579 | tb(this.C, 0, b, 0, a); 2580 | return new jc(null, this.d, this.shift, this.root, b, null) 2581 | } 2582 | throw Error("persistent! called twice"); 2583 | }; 2584 | function vc() { 2585 | this.n = 0; 2586 | this.f = 2097152 2587 | } 2588 | vc.prototype.w = n(!1); 2589 | var wc = new vc; 2590 | function xc(a, b) { 2591 | return vb((null == b ? 0 : b ? b.f & 1024 || b.rb || (b.f ? 0 : u(va, b)) : u(va, b)) ? S(a) === S(b) ? Wb(Xb, Zb.b(function(a) { 2592 | return $a.b(jb.c(b, K(a), wc), K(O(a))) 2593 | }, a)) : null : null) 2594 | } 2595 | function yc(a, b) { 2596 | var c = a.a; 2597 | if(b instanceof Hb) { 2598 | a: { 2599 | for(var d = c.length, e = b.ea, g = 0;;) { 2600 | if(d <= g) { 2601 | c = -1; 2602 | break a 2603 | } 2604 | var h = c[g]; 2605 | if(h instanceof Hb && e === h.ea) { 2606 | c = g; 2607 | break a 2608 | } 2609 | if(v) { 2610 | g += 2 2611 | }else { 2612 | c = null; 2613 | break a 2614 | } 2615 | } 2616 | c = void 0 2617 | } 2618 | }else { 2619 | if("string" == typeof b || "number" === typeof b) { 2620 | a: { 2621 | d = c.length; 2622 | for(e = 0;;) { 2623 | if(d <= e) { 2624 | c = -1; 2625 | break a 2626 | } 2627 | if(b === c[e]) { 2628 | c = e; 2629 | break a 2630 | } 2631 | if(v) { 2632 | e += 2 2633 | }else { 2634 | c = null; 2635 | break a 2636 | } 2637 | } 2638 | c = void 0 2639 | } 2640 | }else { 2641 | if(null == b) { 2642 | a: { 2643 | d = c.length; 2644 | for(e = 0;;) { 2645 | if(d <= e) { 2646 | c = -1; 2647 | break a 2648 | } 2649 | if(null == c[e]) { 2650 | c = e; 2651 | break a 2652 | } 2653 | if(v) { 2654 | e += 2 2655 | }else { 2656 | c = null; 2657 | break a 2658 | } 2659 | } 2660 | c = void 0 2661 | } 2662 | }else { 2663 | if(v) { 2664 | a: { 2665 | d = c.length; 2666 | for(e = 0;;) { 2667 | if(d <= e) { 2668 | c = -1; 2669 | break a 2670 | } 2671 | if($a.b(b, c[e])) { 2672 | c = e; 2673 | break a 2674 | } 2675 | if(v) { 2676 | e += 2 2677 | }else { 2678 | c = null; 2679 | break a 2680 | } 2681 | } 2682 | c = void 0 2683 | } 2684 | }else { 2685 | c = null 2686 | } 2687 | } 2688 | } 2689 | } 2690 | return c 2691 | } 2692 | function zc(a, b, c) { 2693 | this.a = a; 2694 | this.g = b; 2695 | this.Aa = c; 2696 | this.n = 0; 2697 | this.f = 32374990 2698 | } 2699 | q = zc.prototype; 2700 | q.B = function() { 2701 | return eb(this) 2702 | }; 2703 | q.T = function() { 2704 | return this.g < this.a.length - 2 ? new zc(this.a, this.g + 2, this.Aa) : null 2705 | }; 2706 | q.s = function(a, b) { 2707 | return Q(b, this) 2708 | }; 2709 | q.toString = function() { 2710 | return H(this) 2711 | }; 2712 | q.K = function(a, b) { 2713 | return U.b(b, this) 2714 | }; 2715 | q.L = function(a, b, c) { 2716 | return U.c(b, c, this) 2717 | }; 2718 | q.v = function() { 2719 | return this 2720 | }; 2721 | q.D = function() { 2722 | return(this.a.length - this.g) / 2 2723 | }; 2724 | q.M = function() { 2725 | return oc([this.a[this.g], this.a[this.g + 1]]) 2726 | }; 2727 | q.Q = function() { 2728 | return this.g < this.a.length - 2 ? new zc(this.a, this.g + 2, this.Aa) : N 2729 | }; 2730 | q.w = function(a, b) { 2731 | return R(this, b) 2732 | }; 2733 | q.N = function(a, b) { 2734 | return new zc(this.a, this.g, b) 2735 | }; 2736 | q.O = f("Aa"); 2737 | function ka(a, b, c, d) { 2738 | this.j = a; 2739 | this.d = b; 2740 | this.a = c; 2741 | this.h = d; 2742 | this.n = 4; 2743 | this.f = 16123663 2744 | } 2745 | q = ka.prototype; 2746 | q.ua = function() { 2747 | return new Ac({}, this.a.length, this.a.slice()) 2748 | }; 2749 | q.B = function() { 2750 | var a = this.h; 2751 | return null != a ? a : this.h = a = Cb(this) 2752 | }; 2753 | q.G = function(a, b) { 2754 | return ta.c(this, b, null) 2755 | }; 2756 | q.H = function(a, b, c) { 2757 | a = yc(this, b); 2758 | return-1 === a ? c : this.a[a + 1] 2759 | }; 2760 | q.la = function(a, b, c) { 2761 | a = yc(this, b); 2762 | if(-1 === a) { 2763 | if(this.d < Bc) { 2764 | a = this.a; 2765 | for(var d = a.length, e = Array(d + 2), g = 0;;) { 2766 | if(g < d) { 2767 | e[g] = a[g], g += 1 2768 | }else { 2769 | break 2770 | } 2771 | } 2772 | e[d] = b; 2773 | e[d + 1] = c; 2774 | return new ka(this.j, this.d + 1, e, null) 2775 | } 2776 | return Ea(ua($b(Cc, this), b, c), this.j) 2777 | } 2778 | return c === this.a[a + 1] ? this : v ? (b = this.a.slice(), b[a + 1] = c, new ka(this.j, this.d, b, null)) : null 2779 | }; 2780 | q.call = function() { 2781 | var a = null; 2782 | return a = function(a, c, d) { 2783 | switch(arguments.length) { 2784 | case 2: 2785 | return this.G(null, c); 2786 | case 3: 2787 | return this.H(null, c, d) 2788 | } 2789 | throw Error("Invalid arity: " + arguments.length); 2790 | } 2791 | }(); 2792 | q.apply = function(a, b) { 2793 | return this.call.apply(this, [this].concat(b.slice())) 2794 | }; 2795 | q.e = function(a) { 2796 | return this.G(null, a) 2797 | }; 2798 | q.b = function(a, b) { 2799 | return this.H(null, a, b) 2800 | }; 2801 | q.s = function(a, b) { 2802 | return rb(b) ? ua(this, B.b(b, 0), B.b(b, 1)) : yb.c(A, this, b) 2803 | }; 2804 | q.toString = function() { 2805 | return H(this) 2806 | }; 2807 | q.v = function() { 2808 | return 0 <= this.a.length - 2 ? new zc(this.a, 0, null) : null 2809 | }; 2810 | q.D = f("d"); 2811 | q.w = function(a, b) { 2812 | return xc(this, b) 2813 | }; 2814 | q.N = function(a, b) { 2815 | return new ka(b, this.d, this.a, this.h) 2816 | }; 2817 | q.O = f("j"); 2818 | var Bc = 8; 2819 | function Ac(a, b, c) { 2820 | this.ha = a; 2821 | this.ba = b; 2822 | this.a = c; 2823 | this.n = 56; 2824 | this.f = 258 2825 | } 2826 | q = Ac.prototype; 2827 | q.pa = function(a, b, c) { 2828 | if(t(this.ha)) { 2829 | a = yc(this, b); 2830 | if(-1 === a) { 2831 | if(this.ba + 2 <= 2 * Bc) { 2832 | return this.ba += 2, this.a.push(b), this.a.push(c), this 2833 | } 2834 | a = Dc.b ? Dc.b(this.ba, this.a) : Dc.call(null, this.ba, this.a); 2835 | return Sa(a, b, c) 2836 | } 2837 | c !== this.a[a + 1] && (this.a[a + 1] = c); 2838 | return this 2839 | } 2840 | throw Error("assoc! after persistent!"); 2841 | }; 2842 | q.va = function(a, b) { 2843 | if(t(this.ha)) { 2844 | if(b ? b.f & 2048 || b.eb || (b.f ? 0 : u(wa, b)) : u(wa, b)) { 2845 | return Sa(this, V.e ? V.e(b) : V.call(null, b), W.e ? W.e(b) : W.call(null, b)) 2846 | } 2847 | for(var c = J(b), d = this;;) { 2848 | var e = K(c); 2849 | if(t(e)) { 2850 | c = O(c), d = Sa(d, V.e ? V.e(e) : V.call(null, e), W.e ? W.e(e) : W.call(null, e)) 2851 | }else { 2852 | return d 2853 | } 2854 | } 2855 | }else { 2856 | throw Error("conj! after persistent!"); 2857 | } 2858 | }; 2859 | q.wa = function() { 2860 | if(t(this.ha)) { 2861 | return this.ha = !1, new ka(null, zb((this.ba - this.ba % 2) / 2), this.a, null) 2862 | } 2863 | throw Error("persistent! called twice"); 2864 | }; 2865 | q.G = function(a, b) { 2866 | return ta.c(this, b, null) 2867 | }; 2868 | q.H = function(a, b, c) { 2869 | if(t(this.ha)) { 2870 | return a = yc(this, b), -1 === a ? c : this.a[a + 1] 2871 | } 2872 | throw Error("lookup after persistent!"); 2873 | }; 2874 | q.D = function() { 2875 | if(t(this.ha)) { 2876 | return zb((this.ba - this.ba % 2) / 2) 2877 | } 2878 | throw Error("count after persistent!"); 2879 | }; 2880 | function Dc(a, b) { 2881 | for(var c = Pa(Cc), d = 0;;) { 2882 | if(d < a) { 2883 | c = Sa(c, b[d], b[d + 1]), d += 2 2884 | }else { 2885 | return c 2886 | } 2887 | } 2888 | } 2889 | function Ec() { 2890 | this.Z = !1 2891 | } 2892 | function Fc(a, b) { 2893 | return a === b ? !0 : Ib(a, b) ? !0 : v ? $a.b(a, b) : null 2894 | } 2895 | var Gc = function() { 2896 | function a(a, b, c, h, k) { 2897 | a = a.slice(); 2898 | a[b] = c; 2899 | a[h] = k; 2900 | return a 2901 | } 2902 | function b(a, b, c) { 2903 | a = a.slice(); 2904 | a[b] = c; 2905 | return a 2906 | } 2907 | var c = null, c = function(c, e, g, h, k) { 2908 | switch(arguments.length) { 2909 | case 3: 2910 | return b.call(this, c, e, g); 2911 | case 5: 2912 | return a.call(this, c, e, g, h, k) 2913 | } 2914 | throw Error("Invalid arity: " + arguments.length); 2915 | }; 2916 | c.c = b; 2917 | c.F = a; 2918 | return c 2919 | }(), Hc = function() { 2920 | function a(a, b, c, h, k, l) { 2921 | a = a.ia(b); 2922 | a.a[c] = h; 2923 | a.a[k] = l; 2924 | return a 2925 | } 2926 | function b(a, b, c, h) { 2927 | a = a.ia(b); 2928 | a.a[c] = h; 2929 | return a 2930 | } 2931 | var c = null, c = function(c, e, g, h, k, l) { 2932 | switch(arguments.length) { 2933 | case 4: 2934 | return b.call(this, c, e, g, h); 2935 | case 6: 2936 | return a.call(this, c, e, g, h, k, l) 2937 | } 2938 | throw Error("Invalid arity: " + arguments.length); 2939 | }; 2940 | c.m = b; 2941 | c.aa = a; 2942 | return c 2943 | }(); 2944 | function Ic(a, b, c) { 2945 | this.l = a; 2946 | this.t = b; 2947 | this.a = c 2948 | } 2949 | q = Ic.prototype; 2950 | q.V = function(a, b, c, d, e, g) { 2951 | var h = 1 << (c >>> b & 31), k = Ab(this.t & h - 1); 2952 | if(0 === (this.t & h)) { 2953 | var l = Ab(this.t); 2954 | if(2 * l < this.a.length) { 2955 | a = this.ia(a); 2956 | b = a.a; 2957 | g.Z = !0; 2958 | a: { 2959 | for(c = 2 * (l - k), g = 2 * k + (c - 1), l = 2 * (k + 1) + (c - 1);;) { 2960 | if(0 === c) { 2961 | break a 2962 | } 2963 | b[l] = b[g]; 2964 | l -= 1; 2965 | c -= 1; 2966 | g -= 1 2967 | } 2968 | } 2969 | b[2 * k] = d; 2970 | b[2 * k + 1] = e; 2971 | a.t |= h; 2972 | return a 2973 | } 2974 | if(16 <= l) { 2975 | k = Array(32); 2976 | k[c >>> b & 31] = Jc.V(a, b + 5, c, d, e, g); 2977 | for(e = d = 0;;) { 2978 | if(32 > d) { 2979 | 0 !== (this.t >>> d & 1) && (k[d] = null != this.a[e] ? Jc.V(a, b + 5, T(this.a[e]), this.a[e], this.a[e + 1], g) : this.a[e + 1], e += 2), d += 1 2980 | }else { 2981 | break 2982 | } 2983 | } 2984 | return new Kc(a, l + 1, k) 2985 | } 2986 | return v ? (b = Array(2 * (l + 4)), tb(this.a, 0, b, 0, 2 * k), b[2 * k] = d, b[2 * k + 1] = e, tb(this.a, 2 * k, b, 2 * (k + 1), 2 * (l - k)), g.Z = !0, a = this.ia(a), a.a = b, a.t |= h, a) : null 2987 | } 2988 | l = this.a[2 * k]; 2989 | h = this.a[2 * k + 1]; 2990 | return null == l ? (l = h.V(a, b + 5, c, d, e, g), l === h ? this : Hc.m(this, a, 2 * k + 1, l)) : Fc(d, l) ? e === h ? this : Hc.m(this, a, 2 * k + 1, e) : v ? (g.Z = !0, Hc.aa(this, a, 2 * k, null, 2 * k + 1, Lc.ga ? Lc.ga(a, b + 5, l, h, c, d, e) : Lc.call(null, a, b + 5, l, h, c, d, e))) : null 2991 | }; 2992 | q.ra = function() { 2993 | return Mc.e ? Mc.e(this.a) : Mc.call(null, this.a) 2994 | }; 2995 | q.ia = function(a) { 2996 | if(a === this.l) { 2997 | return this 2998 | } 2999 | var b = Ab(this.t), c = Array(0 > b ? 4 : 2 * (b + 1)); 3000 | tb(this.a, 0, c, 0, 2 * b); 3001 | return new Ic(a, this.t, c) 3002 | }; 3003 | q.U = function(a, b, c, d, e) { 3004 | var g = 1 << (b >>> a & 31), h = Ab(this.t & g - 1); 3005 | if(0 === (this.t & g)) { 3006 | var k = Ab(this.t); 3007 | if(16 <= k) { 3008 | h = Array(32); 3009 | h[b >>> a & 31] = Jc.U(a + 5, b, c, d, e); 3010 | for(d = c = 0;;) { 3011 | if(32 > c) { 3012 | 0 !== (this.t >>> c & 1) && (h[c] = null != this.a[d] ? Jc.U(a + 5, T(this.a[d]), this.a[d], this.a[d + 1], e) : this.a[d + 1], d += 2), c += 1 3013 | }else { 3014 | break 3015 | } 3016 | } 3017 | return new Kc(null, k + 1, h) 3018 | } 3019 | a = Array(2 * (k + 1)); 3020 | tb(this.a, 0, a, 0, 2 * h); 3021 | a[2 * h] = c; 3022 | a[2 * h + 1] = d; 3023 | tb(this.a, 2 * h, a, 2 * (h + 1), 2 * (k - h)); 3024 | e.Z = !0; 3025 | return new Ic(null, this.t | g, a) 3026 | } 3027 | k = this.a[2 * h]; 3028 | g = this.a[2 * h + 1]; 3029 | return null == k ? (k = g.U(a + 5, b, c, d, e), k === g ? this : new Ic(null, this.t, Gc.c(this.a, 2 * h + 1, k))) : Fc(c, k) ? d === g ? this : new Ic(null, this.t, Gc.c(this.a, 2 * h + 1, d)) : v ? (e.Z = !0, new Ic(null, this.t, Gc.F(this.a, 2 * h, null, 2 * h + 1, Lc.aa ? Lc.aa(a + 5, k, g, b, c, d) : Lc.call(null, a + 5, k, g, b, c, d)))) : null 3030 | }; 3031 | q.fa = function(a, b, c, d) { 3032 | var e = 1 << (b >>> a & 31); 3033 | if(0 === (this.t & e)) { 3034 | return d 3035 | } 3036 | var g = Ab(this.t & e - 1), e = this.a[2 * g], g = this.a[2 * g + 1]; 3037 | return null == e ? g.fa(a + 5, b, c, d) : Fc(c, e) ? g : v ? d : null 3038 | }; 3039 | var Jc = new Ic(null, 0, []); 3040 | function Kc(a, b, c) { 3041 | this.l = a; 3042 | this.d = b; 3043 | this.a = c 3044 | } 3045 | q = Kc.prototype; 3046 | q.V = function(a, b, c, d, e, g) { 3047 | var h = c >>> b & 31, k = this.a[h]; 3048 | if(null == k) { 3049 | return a = Hc.m(this, a, h, Jc.V(a, b + 5, c, d, e, g)), a.d += 1, a 3050 | } 3051 | b = k.V(a, b + 5, c, d, e, g); 3052 | return b === k ? this : Hc.m(this, a, h, b) 3053 | }; 3054 | q.ra = function() { 3055 | return Nc.e ? Nc.e(this.a) : Nc.call(null, this.a) 3056 | }; 3057 | q.ia = function(a) { 3058 | return a === this.l ? this : new Kc(a, this.d, this.a.slice()) 3059 | }; 3060 | q.U = function(a, b, c, d, e) { 3061 | var g = b >>> a & 31, h = this.a[g]; 3062 | if(null == h) { 3063 | return new Kc(null, this.d + 1, Gc.c(this.a, g, Jc.U(a + 5, b, c, d, e))) 3064 | } 3065 | a = h.U(a + 5, b, c, d, e); 3066 | return a === h ? this : new Kc(null, this.d, Gc.c(this.a, g, a)) 3067 | }; 3068 | q.fa = function(a, b, c, d) { 3069 | var e = this.a[b >>> a & 31]; 3070 | return null != e ? e.fa(a + 5, b, c, d) : d 3071 | }; 3072 | function Oc(a, b, c) { 3073 | b *= 2; 3074 | for(var d = 0;;) { 3075 | if(d < b) { 3076 | if(Fc(c, a[d])) { 3077 | return d 3078 | } 3079 | d += 2 3080 | }else { 3081 | return-1 3082 | } 3083 | } 3084 | } 3085 | function Pc(a, b, c, d) { 3086 | this.l = a; 3087 | this.da = b; 3088 | this.d = c; 3089 | this.a = d 3090 | } 3091 | q = Pc.prototype; 3092 | q.V = function(a, b, c, d, e, g) { 3093 | if(c === this.da) { 3094 | b = Oc(this.a, this.d, d); 3095 | if(-1 === b) { 3096 | if(this.a.length > 2 * this.d) { 3097 | return a = Hc.aa(this, a, 2 * this.d, d, 2 * this.d + 1, e), g.Z = !0, a.d += 1, a 3098 | } 3099 | c = this.a.length; 3100 | b = Array(c + 2); 3101 | tb(this.a, 0, b, 0, c); 3102 | b[c] = d; 3103 | b[c + 1] = e; 3104 | g.Z = !0; 3105 | g = this.d + 1; 3106 | a === this.l ? (this.a = b, this.d = g, a = this) : a = new Pc(this.l, this.da, g, b); 3107 | return a 3108 | } 3109 | return this.a[b + 1] === e ? this : Hc.m(this, a, b + 1, e) 3110 | } 3111 | return(new Ic(a, 1 << (this.da >>> b & 31), [null, this, null, null])).V(a, b, c, d, e, g) 3112 | }; 3113 | q.ra = function() { 3114 | return Mc.e ? Mc.e(this.a) : Mc.call(null, this.a) 3115 | }; 3116 | q.ia = function(a) { 3117 | if(a === this.l) { 3118 | return this 3119 | } 3120 | var b = Array(2 * (this.d + 1)); 3121 | tb(this.a, 0, b, 0, 2 * this.d); 3122 | return new Pc(a, this.da, this.d, b) 3123 | }; 3124 | q.U = function(a, b, c, d, e) { 3125 | return b === this.da ? (a = Oc(this.a, this.d, c), -1 === a ? (a = 2 * this.d, b = Array(a + 2), tb(this.a, 0, b, 0, a), b[a] = c, b[a + 1] = d, e.Z = !0, new Pc(null, this.da, this.d + 1, b)) : $a.b(this.a[a], d) ? this : new Pc(null, this.da, this.d, Gc.c(this.a, a + 1, d))) : (new Ic(null, 1 << (this.da >>> a & 31), [null, this])).U(a, b, c, d, e) 3126 | }; 3127 | q.fa = function(a, b, c, d) { 3128 | a = Oc(this.a, this.d, c); 3129 | return 0 > a ? d : Fc(c, this.a[a]) ? this.a[a + 1] : v ? d : null 3130 | }; 3131 | var Lc = function() { 3132 | function a(a, b, c, h, k, l, m) { 3133 | var p = T(c); 3134 | if(p === k) { 3135 | return new Pc(null, p, 2, [c, h, l, m]) 3136 | } 3137 | var r = new Ec; 3138 | return Jc.V(a, b, p, c, h, r).V(a, b, k, l, m, r) 3139 | } 3140 | function b(a, b, c, h, k, l) { 3141 | var m = T(b); 3142 | if(m === h) { 3143 | return new Pc(null, m, 2, [b, c, k, l]) 3144 | } 3145 | var p = new Ec; 3146 | return Jc.U(a, m, b, c, p).U(a, h, k, l, p) 3147 | } 3148 | var c = null, c = function(c, e, g, h, k, l, m) { 3149 | switch(arguments.length) { 3150 | case 6: 3151 | return b.call(this, c, e, g, h, k, l); 3152 | case 7: 3153 | return a.call(this, c, e, g, h, k, l, m) 3154 | } 3155 | throw Error("Invalid arity: " + arguments.length); 3156 | }; 3157 | c.aa = b; 3158 | c.ga = a; 3159 | return c 3160 | }(); 3161 | function Qc(a, b, c, d, e) { 3162 | this.j = a; 3163 | this.W = b; 3164 | this.g = c; 3165 | this.p = d; 3166 | this.h = e; 3167 | this.n = 0; 3168 | this.f = 32374860 3169 | } 3170 | q = Qc.prototype; 3171 | q.B = function() { 3172 | var a = this.h; 3173 | return null != a ? a : this.h = a = eb(this) 3174 | }; 3175 | q.s = function(a, b) { 3176 | return Q(b, this) 3177 | }; 3178 | q.toString = function() { 3179 | return H(this) 3180 | }; 3181 | q.K = function(a, b) { 3182 | return U.b(b, this) 3183 | }; 3184 | q.L = function(a, b, c) { 3185 | return U.c(b, c, this) 3186 | }; 3187 | q.v = function() { 3188 | return this 3189 | }; 3190 | q.M = function() { 3191 | return null == this.p ? oc([this.W[this.g], this.W[this.g + 1]]) : K(this.p) 3192 | }; 3193 | q.Q = function() { 3194 | return null == this.p ? Mc.c ? Mc.c(this.W, this.g + 2, null) : Mc.call(null, this.W, this.g + 2, null) : Mc.c ? Mc.c(this.W, this.g, O(this.p)) : Mc.call(null, this.W, this.g, O(this.p)) 3195 | }; 3196 | q.w = function(a, b) { 3197 | return R(this, b) 3198 | }; 3199 | q.N = function(a, b) { 3200 | return new Qc(b, this.W, this.g, this.p, this.h) 3201 | }; 3202 | q.O = f("j"); 3203 | var Mc = function() { 3204 | function a(a, b, c) { 3205 | if(null == c) { 3206 | for(c = a.length;;) { 3207 | if(b < c) { 3208 | if(null != a[b]) { 3209 | return new Qc(null, a, b, null, null) 3210 | } 3211 | var h = a[b + 1]; 3212 | if(t(h) && (h = h.ra(), t(h))) { 3213 | return new Qc(null, a, b + 2, h, null) 3214 | } 3215 | b += 2 3216 | }else { 3217 | return null 3218 | } 3219 | } 3220 | }else { 3221 | return new Qc(null, a, b, c, null) 3222 | } 3223 | } 3224 | function b(a) { 3225 | return c.c(a, 0, null) 3226 | } 3227 | var c = null, c = function(c, e, g) { 3228 | switch(arguments.length) { 3229 | case 1: 3230 | return b.call(this, c); 3231 | case 3: 3232 | return a.call(this, c, e, g) 3233 | } 3234 | throw Error("Invalid arity: " + arguments.length); 3235 | }; 3236 | c.e = b; 3237 | c.c = a; 3238 | return c 3239 | }(); 3240 | function Rc(a, b, c, d, e) { 3241 | this.j = a; 3242 | this.W = b; 3243 | this.g = c; 3244 | this.p = d; 3245 | this.h = e; 3246 | this.n = 0; 3247 | this.f = 32374860 3248 | } 3249 | q = Rc.prototype; 3250 | q.B = function() { 3251 | var a = this.h; 3252 | return null != a ? a : this.h = a = eb(this) 3253 | }; 3254 | q.s = function(a, b) { 3255 | return Q(b, this) 3256 | }; 3257 | q.toString = function() { 3258 | return H(this) 3259 | }; 3260 | q.K = function(a, b) { 3261 | return U.b(b, this) 3262 | }; 3263 | q.L = function(a, b, c) { 3264 | return U.c(b, c, this) 3265 | }; 3266 | q.v = function() { 3267 | return this 3268 | }; 3269 | q.M = function() { 3270 | return K(this.p) 3271 | }; 3272 | q.Q = function() { 3273 | return Nc.m ? Nc.m(null, this.W, this.g, O(this.p)) : Nc.call(null, null, this.W, this.g, O(this.p)) 3274 | }; 3275 | q.w = function(a, b) { 3276 | return R(this, b) 3277 | }; 3278 | q.N = function(a, b) { 3279 | return new Rc(b, this.W, this.g, this.p, this.h) 3280 | }; 3281 | q.O = f("j"); 3282 | var Nc = function() { 3283 | function a(a, b, c, h) { 3284 | if(null == h) { 3285 | for(h = b.length;;) { 3286 | if(c < h) { 3287 | var k = b[c]; 3288 | if(t(k) && (k = k.ra(), t(k))) { 3289 | return new Rc(a, b, c + 1, k, null) 3290 | } 3291 | c += 1 3292 | }else { 3293 | return null 3294 | } 3295 | } 3296 | }else { 3297 | return new Rc(a, b, c, h, null) 3298 | } 3299 | } 3300 | function b(a) { 3301 | return c.m(null, a, 0, null) 3302 | } 3303 | var c = null, c = function(c, e, g, h) { 3304 | switch(arguments.length) { 3305 | case 1: 3306 | return b.call(this, c); 3307 | case 4: 3308 | return a.call(this, c, e, g, h) 3309 | } 3310 | throw Error("Invalid arity: " + arguments.length); 3311 | }; 3312 | c.e = b; 3313 | c.m = a; 3314 | return c 3315 | }(); 3316 | function Sc(a, b, c, d, e, g) { 3317 | this.j = a; 3318 | this.d = b; 3319 | this.root = c; 3320 | this.P = d; 3321 | this.R = e; 3322 | this.h = g; 3323 | this.n = 4; 3324 | this.f = 16123663 3325 | } 3326 | q = Sc.prototype; 3327 | q.ua = function() { 3328 | return new Tc({}, this.root, this.d, this.P, this.R) 3329 | }; 3330 | q.B = function() { 3331 | var a = this.h; 3332 | return null != a ? a : this.h = a = Cb(this) 3333 | }; 3334 | q.G = function(a, b) { 3335 | return ta.c(this, b, null) 3336 | }; 3337 | q.H = function(a, b, c) { 3338 | return null == b ? this.P ? this.R : c : null == this.root ? c : v ? this.root.fa(0, T(b), b, c) : null 3339 | }; 3340 | q.la = function(a, b, c) { 3341 | if(null == b) { 3342 | return this.P && c === this.R ? this : new Sc(this.j, this.P ? this.d : this.d + 1, this.root, !0, c, null) 3343 | } 3344 | a = new Ec; 3345 | b = (null == this.root ? Jc : this.root).U(0, T(b), b, c, a); 3346 | return b === this.root ? this : new Sc(this.j, a.Z ? this.d + 1 : this.d, b, this.P, this.R, null) 3347 | }; 3348 | q.call = function() { 3349 | var a = null; 3350 | return a = function(a, c, d) { 3351 | switch(arguments.length) { 3352 | case 2: 3353 | return this.G(null, c); 3354 | case 3: 3355 | return this.H(null, c, d) 3356 | } 3357 | throw Error("Invalid arity: " + arguments.length); 3358 | } 3359 | }(); 3360 | q.apply = function(a, b) { 3361 | return this.call.apply(this, [this].concat(b.slice())) 3362 | }; 3363 | q.e = function(a) { 3364 | return this.G(null, a) 3365 | }; 3366 | q.b = function(a, b) { 3367 | return this.H(null, a, b) 3368 | }; 3369 | q.s = function(a, b) { 3370 | return rb(b) ? ua(this, B.b(b, 0), B.b(b, 1)) : yb.c(A, this, b) 3371 | }; 3372 | q.toString = function() { 3373 | return H(this) 3374 | }; 3375 | q.v = function() { 3376 | if(0 < this.d) { 3377 | var a = null != this.root ? this.root.ra() : null; 3378 | return this.P ? Q(oc([null, this.R]), a) : a 3379 | } 3380 | return null 3381 | }; 3382 | q.D = f("d"); 3383 | q.w = function(a, b) { 3384 | return xc(this, b) 3385 | }; 3386 | q.N = function(a, b) { 3387 | return new Sc(b, this.d, this.root, this.P, this.R, this.h) 3388 | }; 3389 | q.O = f("j"); 3390 | var Cc = new Sc(null, 0, null, !1, null, 0); 3391 | function kb(a, b) { 3392 | for(var c = a.length, d = 0, e = Pa(Cc);;) { 3393 | if(d < c) { 3394 | var g = d + 1, e = e.pa(null, a[d], b[d]), d = g 3395 | }else { 3396 | return Ra(e) 3397 | } 3398 | } 3399 | } 3400 | function Tc(a, b, c, d, e) { 3401 | this.l = a; 3402 | this.root = b; 3403 | this.count = c; 3404 | this.P = d; 3405 | this.R = e; 3406 | this.n = 56; 3407 | this.f = 258 3408 | } 3409 | q = Tc.prototype; 3410 | q.pa = function(a, b, c) { 3411 | return Uc(this, b, c) 3412 | }; 3413 | q.va = function(a, b) { 3414 | var c; 3415 | a: { 3416 | if(this.l) { 3417 | if(b ? b.f & 2048 || b.eb || (b.f ? 0 : u(wa, b)) : u(wa, b)) { 3418 | c = Uc(this, V.e ? V.e(b) : V.call(null, b), W.e ? W.e(b) : W.call(null, b)); 3419 | break a 3420 | } 3421 | c = J(b); 3422 | for(var d = this;;) { 3423 | var e = K(c); 3424 | if(t(e)) { 3425 | c = O(c), d = Uc(d, V.e ? V.e(e) : V.call(null, e), W.e ? W.e(e) : W.call(null, e)) 3426 | }else { 3427 | c = d; 3428 | break a 3429 | } 3430 | } 3431 | }else { 3432 | throw Error("conj! after persistent"); 3433 | } 3434 | c = void 0 3435 | } 3436 | return c 3437 | }; 3438 | q.wa = function() { 3439 | var a; 3440 | if(this.l) { 3441 | this.l = null, a = new Sc(null, this.count, this.root, this.P, this.R, null) 3442 | }else { 3443 | throw Error("persistent! called twice"); 3444 | } 3445 | return a 3446 | }; 3447 | q.G = function(a, b) { 3448 | return null == b ? this.P ? this.R : null : null == this.root ? null : this.root.fa(0, T(b), b) 3449 | }; 3450 | q.H = function(a, b, c) { 3451 | return null == b ? this.P ? this.R : c : null == this.root ? c : this.root.fa(0, T(b), b, c) 3452 | }; 3453 | q.D = function() { 3454 | if(this.l) { 3455 | return this.count 3456 | } 3457 | throw Error("count after persistent!"); 3458 | }; 3459 | function Uc(a, b, c) { 3460 | if(a.l) { 3461 | if(null == b) { 3462 | a.R !== c && (a.R = c), a.P || (a.count += 1, a.P = !0) 3463 | }else { 3464 | var d = new Ec; 3465 | b = (null == a.root ? Jc : a.root).V(a.l, 0, T(b), b, c, d); 3466 | b !== a.root && (a.root = b); 3467 | d.Z && (a.count += 1) 3468 | } 3469 | return a 3470 | } 3471 | throw Error("assoc! after persistent!"); 3472 | } 3473 | function V(a) { 3474 | return xa(a) 3475 | } 3476 | function W(a) { 3477 | return ya(a) 3478 | } 3479 | function Z(a, b, c, d, e, g, h) { 3480 | G(a, c); 3481 | J(h) && (b.c ? b.c(K(h), a, g) : b.call(null, K(h), a, g)); 3482 | c = J(O(h)); 3483 | h = null; 3484 | for(var k = 0, l = 0;;) { 3485 | if(l < k) { 3486 | var m = h.J(null, l); 3487 | G(a, d); 3488 | b.c ? b.c(m, a, g) : b.call(null, m, a, g); 3489 | l += 1 3490 | }else { 3491 | if(c = J(c)) { 3492 | h = c, sb(h) ? (c = Va(h), l = Wa(h), h = c, k = S(c), c = l) : (c = K(h), G(a, d), b.c ? b.c(c, a, g) : b.call(null, c, a, g), c = O(h), h = null, k = 0), l = 0 3493 | }else { 3494 | break 3495 | } 3496 | } 3497 | } 3498 | return G(a, e) 3499 | } 3500 | var Vc = function() { 3501 | function a(a, d) { 3502 | var e = null; 3503 | 1 < arguments.length && (e = P(Array.prototype.slice.call(arguments, 1), 0)); 3504 | return b.call(this, a, e) 3505 | } 3506 | function b(a, b) { 3507 | for(var e = J(b), g = null, h = 0, k = 0;;) { 3508 | if(k < h) { 3509 | var l = g.J(null, k); 3510 | G(a, l); 3511 | k += 1 3512 | }else { 3513 | if(e = J(e)) { 3514 | g = e, sb(g) ? (e = Va(g), h = Wa(g), g = e, l = S(e), e = h, h = l) : (l = K(g), G(a, l), e = O(g), g = null, h = 0), k = 0 3515 | }else { 3516 | return null 3517 | } 3518 | } 3519 | } 3520 | } 3521 | a.r = 1; 3522 | a.k = function(a) { 3523 | var d = K(a); 3524 | a = M(a); 3525 | return b(d, a) 3526 | }; 3527 | a.i = b; 3528 | return a 3529 | }(); 3530 | function Wc(a) { 3531 | ea.e ? ea.e(a) : ea.call(null, a) 3532 | } 3533 | var Xc = {'"':'\\"', "\\":"\\\\", "\b":"\\b", "\f":"\\f", "\n":"\\n", "\r":"\\r", "\t":"\\t"}; 3534 | function Yc(a) { 3535 | return[x('"'), x(a.replace(RegExp('[\\\\"\b\f\n\r\t]', "g"), function(a) { 3536 | return Xc[a] 3537 | })), x('"')].join("") 3538 | } 3539 | var $ = function Zc(b, c, d) { 3540 | if(null == b) { 3541 | return G(c, "nil") 3542 | } 3543 | if(void 0 === b) { 3544 | return G(c, "#\x3cundefined\x3e") 3545 | } 3546 | if(v) { 3547 | t(function() { 3548 | var c = jb.b(d, ia); 3549 | return t(c) ? (c = b ? b.f & 131072 || b.fb ? !0 : b.f ? !1 : u(Ca, b) : u(Ca, b)) ? ob(b) : c : c 3550 | }()) && (G(c, "^"), Zc(ob(b), c, d), G(c, " ")); 3551 | if(null == b) { 3552 | return G(c, "nil") 3553 | } 3554 | if(b.jb) { 3555 | return b.wb(c) 3556 | } 3557 | if(b && (b.f & 2147483648 || b.I)) { 3558 | return b.A(null, c, d) 3559 | } 3560 | if(ma(b) === Boolean || "number" === typeof b) { 3561 | return G(c, "" + x(b)) 3562 | } 3563 | if(b instanceof Array) { 3564 | return Z(c, Zc, "#\x3cArray [", ", ", "]\x3e", d, b) 3565 | } 3566 | if("string" == typeof b) { 3567 | return t(ha.e(d)) ? G(c, Yc(b)) : G(c, b) 3568 | } 3569 | if(nb(b)) { 3570 | return Vc.i(c, P(["#\x3c", "" + x(b), "\x3e"], 0)) 3571 | } 3572 | if(b instanceof Date) { 3573 | var e = function(b, c) { 3574 | for(var d = "" + x(b);;) { 3575 | if(S(d) < c) { 3576 | d = [x("0"), x(d)].join("") 3577 | }else { 3578 | return d 3579 | } 3580 | } 3581 | }; 3582 | return Vc.i(c, P(['#inst "', "" + x(b.getUTCFullYear()), "-", e(b.getUTCMonth() + 1, 2), "-", e(b.getUTCDate(), 2), "T", e(b.getUTCHours(), 2), ":", e(b.getUTCMinutes(), 2), ":", e(b.getUTCSeconds(), 2), ".", e(b.getUTCMilliseconds(), 3), "-", '00:00"'], 0)) 3583 | } 3584 | return t(b instanceof RegExp) ? Vc.i(c, P(['#"', b.source, '"'], 0)) : (b ? b.f & 2147483648 || b.I || (b.f ? 0 : u(Na, b)) : u(Na, b)) ? Oa(b, c, d) : v ? Vc.i(c, P(["#\x3c", "" + x(b), "\x3e"], 0)) : null 3585 | } 3586 | return null 3587 | }; 3588 | function $c(a, b) { 3589 | var c; 3590 | (c = null == a) || (c = J(a), c = t(c) ? !1 : !0); 3591 | if(c) { 3592 | c = "" 3593 | }else { 3594 | c = x; 3595 | var d = new ca, e = new Ya(d); 3596 | a: { 3597 | $(K(a), e, b); 3598 | for(var g = J(O(a)), h = null, k = 0, l = 0;;) { 3599 | if(l < k) { 3600 | var m = h.J(null, l); 3601 | G(e, " "); 3602 | $(m, e, b); 3603 | l += 1 3604 | }else { 3605 | if(g = J(g)) { 3606 | h = g, sb(h) ? (g = Va(h), k = Wa(h), h = g, m = S(g), g = k, k = m) : (m = K(h), G(e, " "), $(m, e, b), g = O(h), h = null, k = 0), l = 0 3607 | }else { 3608 | break a 3609 | } 3610 | } 3611 | } 3612 | } 3613 | Ma(e); 3614 | c = "" + c(d) 3615 | } 3616 | return c 3617 | } 3618 | function ad() { 3619 | var a = fa(); 3620 | Wc("\n"); 3621 | return jb.b(a, ga), null 3622 | } 3623 | var bd = function() { 3624 | function a(a) { 3625 | var d = null; 3626 | 0 < arguments.length && (d = P(Array.prototype.slice.call(arguments, 0), 0)); 3627 | return b.call(this, d) 3628 | } 3629 | function b(a) { 3630 | var b = mb.c(fa(), ha, !1); 3631 | Wc($c(a, b)); 3632 | return ad() 3633 | } 3634 | a.r = 0; 3635 | a.k = function(a) { 3636 | a = J(a); 3637 | return b(a) 3638 | }; 3639 | a.i = b; 3640 | return a 3641 | }(), cd = function() { 3642 | function a(a) { 3643 | var d = null; 3644 | 0 < arguments.length && (d = P(Array.prototype.slice.call(arguments, 0), 0)); 3645 | return b.call(this, d) 3646 | } 3647 | function b(a) { 3648 | var b = fa(); 3649 | Wc($c(a, b)); 3650 | return ad() 3651 | } 3652 | a.r = 0; 3653 | a.k = function(a) { 3654 | a = J(a); 3655 | return b(a) 3656 | }; 3657 | a.i = b; 3658 | return a 3659 | }(); 3660 | Za.prototype.I = !0; 3661 | Za.prototype.A = function(a, b, c) { 3662 | return Z(b, $, "(", " ", ")", c, this) 3663 | }; 3664 | rc.prototype.I = !0; 3665 | rc.prototype.A = function(a, b, c) { 3666 | return Z(b, $, "[", " ", "]", c, this) 3667 | }; 3668 | Ob.prototype.I = !0; 3669 | Ob.prototype.A = function(a, b, c) { 3670 | return Z(b, $, "(", " ", ")", c, this) 3671 | }; 3672 | ka.prototype.I = !0; 3673 | ka.prototype.A = function(a, b, c) { 3674 | return Z(b, function(a) { 3675 | return Z(b, $, "", " ", "", c, a) 3676 | }, "{", ", ", "}", c, this) 3677 | }; 3678 | Jb.prototype.I = !0; 3679 | Jb.prototype.A = function(a, b, c) { 3680 | return Z(b, $, "(", " ", ")", c, this) 3681 | }; 3682 | Qc.prototype.I = !0; 3683 | Qc.prototype.A = function(a, b, c) { 3684 | return Z(b, $, "(", " ", ")", c, this) 3685 | }; 3686 | pc.prototype.I = !0; 3687 | pc.prototype.A = function(a, b, c) { 3688 | return Z(b, $, "(", " ", ")", c, this) 3689 | }; 3690 | Sc.prototype.I = !0; 3691 | Sc.prototype.A = function(a, b, c) { 3692 | return Z(b, function(a) { 3693 | return Z(b, $, "", " ", "", c, a) 3694 | }, "{", ", ", "}", c, this) 3695 | }; 3696 | jc.prototype.I = !0; 3697 | jc.prototype.A = function(a, b, c) { 3698 | return Z(b, $, "[", " ", "]", c, this) 3699 | }; 3700 | Db.prototype.I = !0; 3701 | Db.prototype.A = function(a, b, c) { 3702 | return Z(b, $, "(", " ", ")", c, this) 3703 | }; 3704 | zc.prototype.I = !0; 3705 | zc.prototype.A = function(a, b, c) { 3706 | return Z(b, $, "(", " ", ")", c, this) 3707 | }; 3708 | Eb.prototype.I = !0; 3709 | Eb.prototype.A = function(a, b) { 3710 | return G(b, "()") 3711 | }; 3712 | Gb.prototype.I = !0; 3713 | Gb.prototype.A = function(a, b, c) { 3714 | return Z(b, $, "(", " ", ")", c, this) 3715 | }; 3716 | Rc.prototype.I = !0; 3717 | Rc.prototype.A = function(a, b, c) { 3718 | return Z(b, $, "(", " ", ")", c, this) 3719 | }; 3720 | jc.prototype.Va = !0; 3721 | jc.prototype.Wa = function(a, b) { 3722 | return xb.b(this, b) 3723 | }; 3724 | rc.prototype.Va = !0; 3725 | rc.prototype.Wa = function(a, b) { 3726 | return xb.b(this, b) 3727 | }; 3728 | var ja = new Hb(null, "dup", "dup"), ga = new Hb(null, "flush-on-newline", "flush-on-newline"), dd = new Hb(null, "end", "end"), ed = new Hb(null, "e", "e"), v = new Hb(null, "else", "else"), ha = new Hb(null, "readably", "readably"), ia = new Hb(null, "meta", "meta"); 3729 | function fd() { 3730 | this.n = 0; 3731 | this.f = 8388616 3732 | } 3733 | fd.prototype.v = function() { 3734 | return N 3735 | }; 3736 | fd.prototype.s = function(a, b) { 3737 | return new gd(b) 3738 | }; 3739 | function gd(a) { 3740 | this.x = a; 3741 | this.n = 0; 3742 | this.f = 8388616 3743 | } 3744 | gd.prototype.v = function() { 3745 | return fb.e([this.x]) 3746 | }; 3747 | gd.prototype.s = function(a, b) { 3748 | return new hd(this.x, b) 3749 | }; 3750 | function hd(a, b) { 3751 | this.x = a; 3752 | this.y = b; 3753 | this.n = 0; 3754 | this.f = 8388616 3755 | } 3756 | hd.prototype.v = function() { 3757 | return fb.e([this.x, this.y]) 3758 | }; 3759 | hd.prototype.s = function(a, b) { 3760 | return oc([this.x, this.y, b]) 3761 | }; 3762 | function id(a, b, c, d, e) { 3763 | this.xa = a; 3764 | this.ya = b; 3765 | this.ta = c; 3766 | this.sa = d; 3767 | this.Ta = e 3768 | } 3769 | function jd(a, b) { 3770 | this.o = a; 3771 | this.path = b 3772 | } 3773 | function kd(a) { 3774 | return new jd(a, null) 3775 | } 3776 | var ld = ["combinator", "zip", "zipper"], md = this; 3777 | ld[0] in md || !md.execScript || md.execScript("var " + ld[0]); 3778 | for(var nd;ld.length && (nd = ld.shift());) { 3779 | ld.length || void 0 === kd ? md = md[nd] ? md[nd] : md[nd] = {} : md[nd] = kd 3780 | } 3781 | function od(a) { 3782 | var b = a.o; 3783 | a = a.path; 3784 | var c = t(a) ? a.sa : a; 3785 | return t(c) ? (c = za(c), t(a.Ta) ? (b = J($b(a.xa, Q(b, a.ya))), a = a.ta, b = new jd(b, t(a) ? new id(a.xa, a.ya, a.ta, a.sa, !0) : null)) : b = new jd(c, a.ta), b) : null 3786 | } 3787 | function pd(a) { 3788 | var b = a.path, c; 3789 | c = (c = null != b) ? b.ya : c; 3790 | return t(c) ? new jd(c.M(null), new id(b.xa.s(null, a.o), c.T(null), b.ta, b.sa, b.Ta)) : null 3791 | } 3792 | function qd(a) { 3793 | if(Ib(dd, a.path)) { 3794 | return a 3795 | } 3796 | if(ub(a.o)) { 3797 | a: { 3798 | if(ub(a.o)) { 3799 | var b = a.o; 3800 | if(t(b)) { 3801 | var c = a.o; 3802 | a = a.path; 3803 | a = new jd(K(b), new id(new fd, b.T(null), a, t(a) ? a.sa.s(null, c) : A(N, c), null)); 3804 | break a 3805 | } 3806 | } 3807 | a = null 3808 | } 3809 | return a 3810 | } 3811 | b = pd(a); 3812 | if(null != b) { 3813 | return b 3814 | } 3815 | for(b = a;;) { 3816 | if(a = od(b), null != a) { 3817 | b = pd(a); 3818 | if(null != b) { 3819 | return b 3820 | } 3821 | b = a 3822 | }else { 3823 | return new jd(b.o, dd) 3824 | } 3825 | } 3826 | } 3827 | ;function rd(a) { 3828 | if(ub(a)) { 3829 | var b = K(a); 3830 | if(ub(b) && Ib(ed, K(b))) { 3831 | return b = K(O(b)), a = K(O(a)), A(A(N, b), A(A(N, A(A(N, a), ed)), b)) 3832 | } 3833 | } 3834 | return!1 3835 | } 3836 | ;ea = function() { 3837 | function a(a) { 3838 | var d = null; 3839 | 0 < arguments.length && (d = P(Array.prototype.slice.call(arguments, 0), 0)); 3840 | return b.call(this, d) 3841 | } 3842 | function b(a) { 3843 | return t("undefined" != typeof console) ? console.log(Vb.b(x, a)) : print(Vb.b(x, a)) 3844 | } 3845 | a.r = 0; 3846 | a.k = function(a) { 3847 | a = J(a); 3848 | return b(a) 3849 | }; 3850 | a.i = b; 3851 | return a 3852 | }(); 3853 | function sd() { 3854 | for(var a = 0, b = Fb(Fb(Fb(ed, Fb(Fb(ed, ed), ed)), ed), ed);;) { 3855 | if(300 < a) { 3856 | return b 3857 | } 3858 | var a = a + 1, c; 3859 | a: { 3860 | c = rd; 3861 | for(var d = kd(b);;) { 3862 | if(t(Ib(dd, d.path))) { 3863 | c = d.o; 3864 | break a 3865 | } 3866 | b = c.e ? c.e(d.o) : c.call(null, d.o); 3867 | if(t(b)) { 3868 | if(d = d.path, b = new jd(b, t(d) ? new id(d.xa, d.ya, d.ta, d.sa, !0) : null), d = pd(b), !t(d)) { 3869 | b: { 3870 | for(c = b;;) { 3871 | if(Ib(dd, c.path)) { 3872 | c = c.o; 3873 | break b 3874 | } 3875 | b = od(c); 3876 | if(t(b)) { 3877 | c = b 3878 | }else { 3879 | c = c.o; 3880 | break b 3881 | } 3882 | } 3883 | c = void 0 3884 | } 3885 | break a 3886 | } 3887 | }else { 3888 | d = qd(d) 3889 | } 3890 | } 3891 | c = void 0 3892 | } 3893 | b = c 3894 | } 3895 | } 3896 | bd.i(P([sd()], 0)); 3897 | for(var td = 0;;) { 3898 | if(20 > td) { 3899 | var ud = (new Date).getTime(); 3900 | sd(); 3901 | cd.i(P([[x("Elapsed time: "), x((new Date).getTime() - ud), x(" msecs")].join("")], 0)); 3902 | td += 1 3903 | }else { 3904 | break 3905 | } 3906 | } 3907 | ; 3908 | })(); 3909 | --------------------------------------------------------------------------------