Removed an awful lot of compiled javascript files from the repo

Demo still seems to work.
This commit is contained in:
Simon Brooke 2020-10-24 15:04:23 +01:00
parent e3b5963e55
commit 293e911556
No known key found for this signature in database
GPG key ID: A7A4F18D1D4DF987
467 changed files with 681 additions and 212151 deletions

File diff suppressed because one or more lines are too long

View file

@ -1 +0,0 @@
-1579054184

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

View file

@ -1,919 +0,0 @@
(ns cljs.core.async
(:refer-clojure :exclude [reduce into merge map take partition partition-by])
(:require [cljs.core.async.impl.protocols :as impl]
[cljs.core.async.impl.channels :as channels]
[cljs.core.async.impl.buffers :as buffers]
[cljs.core.async.impl.timers :as timers]
[cljs.core.async.impl.dispatch :as dispatch]
[cljs.core.async.impl.ioc-helpers :as helpers])
(:require-macros [cljs.core.async.impl.ioc-macros :as ioc]
[cljs.core.async.macros :refer [go go-loop]]))
(defn- fn-handler
([f] (fn-handler f true))
([f blockable]
(reify
impl/Handler
(active? [_] true)
(blockable? [_] blockable)
(commit [_] f))))
(defn buffer
"Returns a fixed buffer of size n. When full, puts will block/park."
[n]
(buffers/fixed-buffer n))
(defn dropping-buffer
"Returns a buffer of size n. When full, puts will complete but
val will be dropped (no transfer)."
[n]
(buffers/dropping-buffer n))
(defn sliding-buffer
"Returns a buffer of size n. When full, puts will complete, and be
buffered, but oldest elements in buffer will be dropped (not
transferred)."
[n]
(buffers/sliding-buffer n))
(defn unblocking-buffer?
"Returns true if a channel created with buff will never block. That is to say,
puts into this buffer will never cause the buffer to be full. "
[buff]
(satisfies? impl/UnblockingBuffer buff))
(defn chan
"Creates a channel with an optional buffer, an optional transducer (like (map f),
(filter p) etc or a composition thereof), and an optional exception handler.
If buf-or-n is a number, will create and use a fixed buffer of that size. If a
transducer is supplied a buffer must be specified. ex-handler must be a
fn of one argument - if an exception occurs during transformation it will be called
with the thrown value as an argument, and any non-nil return value will be placed
in the channel."
([] (chan nil))
([buf-or-n] (chan buf-or-n nil nil))
([buf-or-n xform] (chan buf-or-n xform nil))
([buf-or-n xform ex-handler]
(let [buf-or-n (if (= buf-or-n 0)
nil
buf-or-n)]
(when xform (assert buf-or-n "buffer must be supplied when transducer is"))
(channels/chan (if (number? buf-or-n)
(buffer buf-or-n)
buf-or-n)
xform
ex-handler))))
(defn promise-chan
"Creates a promise channel with an optional transducer, and an optional
exception-handler. A promise channel can take exactly one value that consumers
will receive. Once full, puts complete but val is dropped (no transfer).
Consumers will block until either a value is placed in the channel or the
channel is closed. See chan for the semantics of xform and ex-handler."
([] (promise-chan nil))
([xform] (promise-chan xform nil))
([xform ex-handler]
(chan (buffers/promise-buffer) xform ex-handler)))
(defn timeout
"Returns a channel that will close after msecs"
[msecs]
(timers/timeout msecs))
(defn <!
"takes a val from port. Must be called inside a (go ...) block. Will
return nil if closed. Will park if nothing is available.
Returns true unless port is already closed"
[port]
(throw (js/Error. "<! used not in (go ...) block")))
(defn take!
"Asynchronously takes a val from port, passing to fn1. Will pass nil
if closed. If on-caller? (default true) is true, and value is
immediately available, will call fn1 on calling thread.
Returns nil."
([port fn1] (take! port fn1 true))
([port fn1 on-caller?]
(let [ret (impl/take! port (fn-handler fn1))]
(when ret
(let [val @ret]
(if on-caller?
(fn1 val)
(dispatch/run #(fn1 val)))))
nil)))
(defn- nop [_])
(def ^:private fhnop (fn-handler nop))
(defn >!
"puts a val into port. nil values are not allowed. Must be called
inside a (go ...) block. Will park if no buffer space is available.
Returns true unless port is already closed."
[port val]
(throw (js/Error. ">! used not in (go ...) block")))
(defn put!
"Asynchronously puts a val into port, calling fn0 (if supplied) when
complete. nil values are not allowed. Will throw if closed. If
on-caller? (default true) is true, and the put is immediately
accepted, will call fn0 on calling thread. Returns nil."
([port val]
(if-let [ret (impl/put! port val fhnop)]
@ret
true))
([port val fn1] (put! port val fn1 true))
([port val fn1 on-caller?]
(if-let [retb (impl/put! port val (fn-handler fn1))]
(let [ret @retb]
(if on-caller?
(fn1 ret)
(dispatch/run #(fn1 ret)))
ret)
true)))
(defn close!
([port]
(impl/close! port)))
(defn- random-array
[n]
(let [a (make-array n)]
(dotimes [x n]
(aset a x 0))
(loop [i 1]
(if (= i n)
a
(do
(let [j (rand-int i)]
(aset a i (aget a j))
(aset a j i)
(recur (inc i))))))))
(defn- alt-flag []
(let [flag (atom true)]
(reify
impl/Handler
(active? [_] @flag)
(blockable? [_] true)
(commit [_]
(reset! flag nil)
true))))
(defn- alt-handler [flag cb]
(reify
impl/Handler
(active? [_] (impl/active? flag))
(blockable? [_] true)
(commit [_]
(impl/commit flag)
cb)))
(defn do-alts
"returns derefable [val port] if immediate, nil if enqueued"
[fret ports opts]
(let [flag (alt-flag)
n (count ports)
idxs (random-array n)
priority (:priority opts)
ret
(loop [i 0]
(when (< i n)
(let [idx (if priority i (aget idxs i))
port (nth ports idx)
wport (when (vector? port) (port 0))
vbox (if wport
(let [val (port 1)]
(impl/put! wport val (alt-handler flag #(fret [% wport]))))
(impl/take! port (alt-handler flag #(fret [% port]))))]
(if vbox
(channels/box [@vbox (or wport port)])
(recur (inc i))))))]
(or
ret
(when (contains? opts :default)
(when-let [got (and (impl/active? flag) (impl/commit flag))]
(channels/box [(:default opts) :default]))))))
(defn alts!
"Completes at most one of several channel operations. Must be called
inside a (go ...) block. ports is a vector of channel endpoints,
which can be either a channel to take from or a vector of
[channel-to-put-to val-to-put], in any combination. Takes will be
made as if by <!, and puts will be made as if by >!. Unless
the :priority option is true, if more than one port operation is
ready a non-deterministic choice will be made. If no operation is
ready and a :default value is supplied, [default-val :default] will
be returned, otherwise alts! will park until the first operation to
become ready completes. Returns [val port] of the completed
operation, where val is the value taken for takes, and a
boolean (true unless already closed, as per put!) for puts.
opts are passed as :key val ... Supported options:
:default val - the value to use if none of the operations are immediately ready
:priority true - (default nil) when true, the operations will be tried in order.
Note: there is no guarantee that the port exps or val exprs will be
used, nor in what order should they be, so they should not be
depended upon for side effects."
[ports & {:as opts}]
(throw (js/Error. "alts! used not in (go ...) block")))
(defn offer!
"Puts a val into port if it's possible to do so immediately.
nil values are not allowed. Never blocks. Returns true if offer succeeds."
[port val]
(let [ret (impl/put! port val (fn-handler nop false))]
(when ret @ret)))
(defn poll!
"Takes a val from port if it's possible to do so immediately.
Never blocks. Returns value if successful, nil otherwise."
[port]
(let [ret (impl/take! port (fn-handler nop false))]
(when ret @ret)))
;;;;;;; channel ops
(defn pipe
"Takes elements from the from channel and supplies them to the to
channel. By default, the to channel will be closed when the from
channel closes, but can be determined by the close? parameter. Will
stop consuming the from channel if the to channel closes"
([from to] (pipe from to true))
([from to close?]
(go-loop []
(let [v (<! from)]
(if (nil? v)
(when close? (close! to))
(when (>! to v)
(recur)))))
to))
(defn- pipeline*
([n to xf from close? ex-handler type]
(assert (pos? n))
(let [jobs (chan n)
results (chan n)
process (fn [[v p :as job]]
(if (nil? job)
(do (close! results) nil)
(let [res (chan 1 xf ex-handler)]
(go
(>! res v)
(close! res))
(put! p res)
true)))
async (fn [[v p :as job]]
(if (nil? job)
(do (close! results) nil)
(let [res (chan 1)]
(xf v res)
(put! p res)
true)))]
(dotimes [_ n]
(case type
:compute (go-loop []
(let [job (<! jobs)]
(when (process job)
(recur))))
:async (go-loop []
(let [job (<! jobs)]
(when (async job)
(recur))))))
(go-loop []
(let [v (<! from)]
(if (nil? v)
(close! jobs)
(let [p (chan 1)]
(>! jobs [v p])
(>! results p)
(recur)))))
(go-loop []
(let [p (<! results)]
(if (nil? p)
(when close? (close! to))
(let [res (<! p)]
(loop []
(let [v (<! res)]
(when (and (not (nil? v)) (>! to v))
(recur))))
(recur))))))))
(defn pipeline-async
"Takes elements from the from channel and supplies them to the to
channel, subject to the async function af, with parallelism n. af
must be a function of two arguments, the first an input value and
the second a channel on which to place the result(s). af must close!
the channel before returning. The presumption is that af will
return immediately, having launched some asynchronous operation
whose completion/callback will manipulate the result channel. Outputs
will be returned in order relative to the inputs. By default, the to
channel will be closed when the from channel closes, but can be
determined by the close? parameter. Will stop consuming the from
channel if the to channel closes."
([n to af from] (pipeline-async n to af from true))
([n to af from close?] (pipeline* n to af from close? nil :async)))
(defn pipeline
"Takes elements from the from channel and supplies them to the to
channel, subject to the transducer xf, with parallelism n. Because
it is parallel, the transducer will be applied independently to each
element, not across elements, and may produce zero or more outputs
per input. Outputs will be returned in order relative to the
inputs. By default, the to channel will be closed when the from
channel closes, but can be determined by the close? parameter. Will
stop consuming the from channel if the to channel closes.
Note this is supplied for API compatibility with the Clojure version.
Values of N > 1 will not result in actual concurrency in a
single-threaded runtime."
([n to xf from] (pipeline n to xf from true))
([n to xf from close?] (pipeline n to xf from close? nil))
([n to xf from close? ex-handler] (pipeline* n to xf from close? ex-handler :compute)))
(defn split
"Takes a predicate and a source channel and returns a vector of two
channels, the first of which will contain the values for which the
predicate returned true, the second those for which it returned
false.
The out channels will be unbuffered by default, or two buf-or-ns can
be supplied. The channels will close after the source channel has
closed."
([p ch] (split p ch nil nil))
([p ch t-buf-or-n f-buf-or-n]
(let [tc (chan t-buf-or-n)
fc (chan f-buf-or-n)]
(go-loop []
(let [v (<! ch)]
(if (nil? v)
(do (close! tc) (close! fc))
(when (>! (if (p v) tc fc) v)
(recur)))))
[tc fc])))
(defn reduce
"f should be a function of 2 arguments. Returns a channel containing
the single result of applying f to init and the first item from the
channel, then applying f to that result and the 2nd item, etc. If
the channel closes without yielding items, returns init and f is not
called. ch must close before reduce produces a result."
[f init ch]
(go-loop [ret init]
(let [v (<! ch)]
(if (nil? v)
ret
(let [ret' (f ret v)]
(if (reduced? ret')
@ret'
(recur ret')))))))
(defn onto-chan
"Puts the contents of coll into the supplied channel.
By default the channel will be closed after the items are copied,
but can be determined by the close? parameter.
Returns a channel which will close after the items are copied."
([ch coll] (onto-chan ch coll true))
([ch coll close?]
(go-loop [vs (seq coll)]
(if (and vs (>! ch (first vs)))
(recur (next vs))
(when close?
(close! ch))))))
(defn to-chan
"Creates and returns a channel which contains the contents of coll,
closing when exhausted."
[coll]
(let [ch (chan (bounded-count 100 coll))]
(onto-chan ch coll)
ch))
(defprotocol Mux
(muxch* [_]))
(defprotocol Mult
(tap* [m ch close?])
(untap* [m ch])
(untap-all* [m]))
(defn mult
"Creates and returns a mult(iple) of the supplied channel. Channels
containing copies of the channel can be created with 'tap', and
detached with 'untap'.
Each item is distributed to all taps in parallel and synchronously,
i.e. each tap must accept before the next item is distributed. Use
buffering/windowing to prevent slow taps from holding up the mult.
Items received when there are no taps get dropped.
If a tap puts to a closed channel, it will be removed from the mult."
[ch]
(let [cs (atom {}) ;;ch->close?
m (reify
Mux
(muxch* [_] ch)
Mult
(tap* [_ ch close?] (swap! cs assoc ch close?) nil)
(untap* [_ ch] (swap! cs dissoc ch) nil)
(untap-all* [_] (reset! cs {}) nil))
dchan (chan 1)
dctr (atom nil)
done (fn [_] (when (zero? (swap! dctr dec))
(put! dchan true)))]
(go-loop []
(let [val (<! ch)]
(if (nil? val)
(doseq [[c close?] @cs]
(when close? (close! c)))
(let [chs (keys @cs)]
(reset! dctr (count chs))
(doseq [c chs]
(when-not (put! c val done)
(done nil)
(untap* m c)))
;;wait for all
(when (seq chs)
(<! dchan))
(recur)))))
m))
(defn tap
"Copies the mult source onto the supplied channel.
By default the channel will be closed when the source closes,
but can be determined by the close? parameter."
([mult ch] (tap mult ch true))
([mult ch close?] (tap* mult ch close?) ch))
(defn untap
"Disconnects a target channel from a mult"
[mult ch]
(untap* mult ch))
(defn untap-all
"Disconnects all target channels from a mult"
[mult] (untap-all* mult))
(defprotocol Mix
(admix* [m ch])
(unmix* [m ch])
(unmix-all* [m])
(toggle* [m state-map])
(solo-mode* [m mode]))
(defn ioc-alts! [state cont-block ports & {:as opts}]
(ioc/aset-all! state helpers/STATE-IDX cont-block)
(when-let [cb (cljs.core.async/do-alts
(fn [val]
(ioc/aset-all! state helpers/VALUE-IDX val)
(helpers/run-state-machine-wrapped state))
ports
opts)]
(ioc/aset-all! state helpers/VALUE-IDX @cb)
:recur))
(defn mix
"Creates and returns a mix of one or more input channels which will
be put on the supplied out channel. Input sources can be added to
the mix with 'admix', and removed with 'unmix'. A mix supports
soloing, muting and pausing multiple inputs atomically using
'toggle', and can solo using either muting or pausing as determined
by 'solo-mode'.
Each channel can have zero or more boolean modes set via 'toggle':
:solo - when true, only this (ond other soloed) channel(s) will appear
in the mix output channel. :mute and :pause states of soloed
channels are ignored. If solo-mode is :mute, non-soloed
channels are muted, if :pause, non-soloed channels are
paused.
:mute - muted channels will have their contents consumed but not included in the mix
:pause - paused channels will not have their contents consumed (and thus also not included in the mix)
"
[out]
(let [cs (atom {}) ;;ch->attrs-map
solo-modes #{:mute :pause}
attrs (conj solo-modes :solo)
solo-mode (atom :mute)
change (chan)
changed #(put! change true)
pick (fn [attr chs]
(reduce-kv
(fn [ret c v]
(if (attr v)
(conj ret c)
ret))
#{} chs))
calc-state (fn []
(let [chs @cs
mode @solo-mode
solos (pick :solo chs)
pauses (pick :pause chs)]
{:solos solos
:mutes (pick :mute chs)
:reads (conj
(if (and (= mode :pause) (not (empty? solos)))
(vec solos)
(vec (remove pauses (keys chs))))
change)}))
m (reify
Mux
(muxch* [_] out)
Mix
(admix* [_ ch] (swap! cs assoc ch {}) (changed))
(unmix* [_ ch] (swap! cs dissoc ch) (changed))
(unmix-all* [_] (reset! cs {}) (changed))
(toggle* [_ state-map] (swap! cs (partial merge-with cljs.core/merge) state-map) (changed))
(solo-mode* [_ mode]
(assert (solo-modes mode) (str "mode must be one of: " solo-modes))
(reset! solo-mode mode)
(changed)))]
(go-loop [{:keys [solos mutes reads] :as state} (calc-state)]
(let [[v c] (alts! reads)]
(if (or (nil? v) (= c change))
(do (when (nil? v)
(swap! cs dissoc c))
(recur (calc-state)))
(if (or (solos c)
(and (empty? solos) (not (mutes c))))
(when (>! out v)
(recur state))
(recur state)))))
m))
(defn admix
"Adds ch as an input to the mix"
[mix ch]
(admix* mix ch))
(defn unmix
"Removes ch as an input to the mix"
[mix ch]
(unmix* mix ch))
(defn unmix-all
"removes all inputs from the mix"
[mix]
(unmix-all* mix))
(defn toggle
"Atomically sets the state(s) of one or more channels in a mix. The
state map is a map of channels -> channel-state-map. A
channel-state-map is a map of attrs -> boolean, where attr is one or
more of :mute, :pause or :solo. Any states supplied are merged with
the current state.
Note that channels can be added to a mix via toggle, which can be
used to add channels in a particular (e.g. paused) state."
[mix state-map]
(toggle* mix state-map))
(defn solo-mode
"Sets the solo mode of the mix. mode must be one of :mute or :pause"
[mix mode]
(solo-mode* mix mode))
(defprotocol Pub
(sub* [p v ch close?])
(unsub* [p v ch])
(unsub-all* [p] [p v]))
(defn pub
"Creates and returns a pub(lication) of the supplied channel,
partitioned into topics by the topic-fn. topic-fn will be applied to
each value on the channel and the result will determine the 'topic'
on which that value will be put. Channels can be subscribed to
receive copies of topics using 'sub', and unsubscribed using
'unsub'. Each topic will be handled by an internal mult on a
dedicated channel. By default these internal channels are
unbuffered, but a buf-fn can be supplied which, given a topic,
creates a buffer with desired properties.
Each item is distributed to all subs in parallel and synchronously,
i.e. each sub must accept before the next item is distributed. Use
buffering/windowing to prevent slow subs from holding up the pub.
Items received when there are no matching subs get dropped.
Note that if buf-fns are used then each topic is handled
asynchronously, i.e. if a channel is subscribed to more than one
topic it should not expect them to be interleaved identically with
the source."
([ch topic-fn] (pub ch topic-fn (constantly nil)))
([ch topic-fn buf-fn]
(let [mults (atom {}) ;;topic->mult
ensure-mult (fn [topic]
(or (get @mults topic)
(get (swap! mults
#(if (% topic) % (assoc % topic (mult (chan (buf-fn topic))))))
topic)))
p (reify
Mux
(muxch* [_] ch)
Pub
(sub* [p topic ch close?]
(let [m (ensure-mult topic)]
(tap m ch close?)))
(unsub* [p topic ch]
(when-let [m (get @mults topic)]
(untap m ch)))
(unsub-all* [_] (reset! mults {}))
(unsub-all* [_ topic] (swap! mults dissoc topic)))]
(go-loop []
(let [val (<! ch)]
(if (nil? val)
(doseq [m (vals @mults)]
(close! (muxch* m)))
(let [topic (topic-fn val)
m (get @mults topic)]
(when m
(when-not (>! (muxch* m) val)
(swap! mults dissoc topic)))
(recur)))))
p)))
(defn sub
"Subscribes a channel to a topic of a pub.
By default the channel will be closed when the source closes,
but can be determined by the close? parameter."
([p topic ch] (sub p topic ch true))
([p topic ch close?] (sub* p topic ch close?)))
(defn unsub
"Unsubscribes a channel from a topic of a pub"
[p topic ch]
(unsub* p topic ch))
(defn unsub-all
"Unsubscribes all channels from a pub, or a topic of a pub"
([p] (unsub-all* p))
([p topic] (unsub-all* p topic)))
;;;;
(defn map
"Takes a function and a collection of source channels, and returns a
channel which contains the values produced by applying f to the set
of first items taken from each source channel, followed by applying
f to the set of second items from each channel, until any one of the
channels is closed, at which point the output channel will be
closed. The returned channel will be unbuffered by default, or a
buf-or-n can be supplied"
([f chs] (map f chs nil))
([f chs buf-or-n]
(let [chs (vec chs)
out (chan buf-or-n)
cnt (count chs)
rets (object-array cnt)
dchan (chan 1)
dctr (atom nil)
done (mapv (fn [i]
(fn [ret]
(aset rets i ret)
(when (zero? (swap! dctr dec))
(put! dchan (.slice rets 0)))))
(range cnt))]
(go-loop []
(reset! dctr cnt)
(dotimes [i cnt]
(try
(take! (chs i) (done i))
(catch js/Object e
(swap! dctr dec))))
(let [rets (<! dchan)]
(if (some nil? rets)
(close! out)
(do (>! out (apply f rets))
(recur)))))
out)))
(defn merge
"Takes a collection of source channels and returns a channel which
contains all values taken from them. The returned channel will be
unbuffered by default, or a buf-or-n can be supplied. The channel
will close after all the source channels have closed."
([chs] (merge chs nil))
([chs buf-or-n]
(let [out (chan buf-or-n)]
(go-loop [cs (vec chs)]
(if (pos? (count cs))
(let [[v c] (alts! cs)]
(if (nil? v)
(recur (filterv #(not= c %) cs))
(do (>! out v)
(recur cs))))
(close! out)))
out)))
(defn into
"Returns a channel containing the single (collection) result of the
items taken from the channel conjoined to the supplied
collection. ch must close before into produces a result."
[coll ch]
(reduce conj coll ch))
(defn take
"Returns a channel that will return, at most, n items from ch. After n items
have been returned, or ch has been closed, the return chanel will close.
The output channel is unbuffered by default, unless buf-or-n is given."
([n ch]
(take n ch nil))
([n ch buf-or-n]
(let [out (chan buf-or-n)]
(go (loop [x 0]
(when (< x n)
(let [v (<! ch)]
(when (not (nil? v))
(>! out v)
(recur (inc x))))))
(close! out))
out)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; deprecated - do not use ;;;;;;;;;;;;;;;;;;;;;;;;;
(defn map<
"Deprecated - this function will be removed. Use transducer instead"
[f ch]
(reify
impl/Channel
(close! [_] (impl/close! ch))
(closed? [_] (impl/closed? ch))
impl/ReadPort
(take! [_ fn1]
(let [ret
(impl/take! ch
(reify
impl/Handler
(active? [_] (impl/active? fn1))
(blockable? [_] true)
#_(lock-id [_] (impl/lock-id fn1))
(commit [_]
(let [f1 (impl/commit fn1)]
#(f1 (if (nil? %) nil (f %)))))))]
(if (and ret (not (nil? @ret)))
(channels/box (f @ret))
ret)))
impl/WritePort
(put! [_ val fn1] (impl/put! ch val fn1))))
(defn map>
"Deprecated - this function will be removed. Use transducer instead"
[f ch]
(reify
impl/Channel
(close! [_] (impl/close! ch))
impl/ReadPort
(take! [_ fn1] (impl/take! ch fn1))
impl/WritePort
(put! [_ val fn1]
(impl/put! ch (f val) fn1))))
(defn filter>
"Deprecated - this function will be removed. Use transducer instead"
[p ch]
(reify
impl/Channel
(close! [_] (impl/close! ch))
(closed? [_] (impl/closed? ch))
impl/ReadPort
(take! [_ fn1] (impl/take! ch fn1))
impl/WritePort
(put! [_ val fn1]
(if (p val)
(impl/put! ch val fn1)
(channels/box (not (impl/closed? ch)))))))
(defn remove>
"Deprecated - this function will be removed. Use transducer instead"
[p ch]
(filter> (complement p) ch))
(defn filter<
"Deprecated - this function will be removed. Use transducer instead"
([p ch] (filter< p ch nil))
([p ch buf-or-n]
(let [out (chan buf-or-n)]
(go-loop []
(let [val (<! ch)]
(if (nil? val)
(close! out)
(do (when (p val)
(>! out val))
(recur)))))
out)))
(defn remove<
"Deprecated - this function will be removed. Use transducer instead"
([p ch] (remove< p ch nil))
([p ch buf-or-n] (filter< (complement p) ch buf-or-n)))
(defn- mapcat* [f in out]
(go-loop []
(let [val (<! in)]
(if (nil? val)
(close! out)
(do (doseq [v (f val)]
(>! out v))
(when-not (impl/closed? out)
(recur)))))))
(defn mapcat<
"Deprecated - this function will be removed. Use transducer instead"
([f in] (mapcat< f in nil))
([f in buf-or-n]
(let [out (chan buf-or-n)]
(mapcat* f in out)
out)))
(defn mapcat>
"Deprecated - this function will be removed. Use transducer instead"
([f out] (mapcat> f out nil))
([f out buf-or-n]
(let [in (chan buf-or-n)]
(mapcat* f in out)
in)))
(defn unique
"Deprecated - this function will be removed. Use transducer instead"
([ch]
(unique ch nil))
([ch buf-or-n]
(let [out (chan buf-or-n)]
(go (loop [last nil]
(let [v (<! ch)]
(when (not (nil? v))
(if (= v last)
(recur last)
(do (>! out v)
(recur v))))))
(close! out))
out)))
(defn partition
"Deprecated - this function will be removed. Use transducer instead"
([n ch]
(partition n ch nil))
([n ch buf-or-n]
(let [out (chan buf-or-n)]
(go (loop [arr (make-array n)
idx 0]
(let [v (<! ch)]
(if (not (nil? v))
(do (aset ^objects arr idx v)
(let [new-idx (inc idx)]
(if (< new-idx n)
(recur arr new-idx)
(do (>! out (vec arr))
(recur (make-array n) 0)))))
(do (when (> idx 0)
(>! out (vec arr)))
(close! out))))))
out)))
(defn partition-by
"Deprecated - this function will be removed. Use transducer instead"
([f ch]
(partition-by f ch nil))
([f ch buf-or-n]
(let [out (chan buf-or-n)]
(go (loop [lst (make-array 0)
last ::nothing]
(let [v (<! ch)]
(if (not (nil? v))
(let [new-itm (f v)]
(if (or (= new-itm last)
(keyword-identical? last ::nothing))
(do (.push lst v)
(recur lst new-itm))
(do (>! out (vec lst))
(let [new-lst (make-array 0)]
(.push new-lst v)
(recur new-lst new-itm)))))
(do (when (> (alength lst) 0)
(>! out (vec lst)))
(close! out))))))
out)))

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

View file

@ -1,159 +0,0 @@
;; Copyright (c) Rich Hickey and contributors. All rights reserved.
;; The use and distribution terms for this software are covered by the
;; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
;; which can be found in the file epl-v10.html at the root of this distribution.
;; By using this software in any fashion, you are agreeing to be bound by
;; the terms of this license.
;; You must not remove this notice, or any other, from this software.
(ns cljs.core.async.impl.buffers
(:require [cljs.core.async.impl.protocols :as impl]))
;; -----------------------------------------------------------------------------
;; DO NOT USE, this is internal buffer representation
(defn acopy [src src-start dest dest-start len]
(loop [cnt 0]
(when (< cnt len)
(aset dest
(+ dest-start cnt)
(aget src (+ src-start cnt)))
(recur (inc cnt)))))
(deftype RingBuffer [^:mutable head ^:mutable tail ^:mutable length ^:mutable arr]
Object
(pop [_]
(when-not (zero? length)
(let [x (aget arr tail)]
(aset arr tail nil)
(set! tail (js-mod (inc tail) (alength arr)))
(set! length (dec length))
x)))
(unshift [_ x]
(aset arr head x)
(set! head (js-mod (inc head) (alength arr)))
(set! length (inc length))
nil)
(unbounded-unshift [this x]
(if (== (inc length) (alength arr))
(.resize this))
(.unshift this x))
;; Doubles the size of the buffer while retaining all the existing values
(resize
[_]
(let [new-arr-size (* (alength arr) 2)
new-arr (make-array new-arr-size)]
(cond
(< tail head)
(do (acopy arr tail new-arr 0 length)
(set! tail 0)
(set! head length)
(set! arr new-arr))
(> tail head)
(do (acopy arr tail new-arr 0 (- (alength arr) tail))
(acopy arr 0 new-arr (- (alength arr) tail) head)
(set! tail 0)
(set! head length)
(set! arr new-arr))
(== tail head)
(do (set! tail 0)
(set! head 0)
(set! arr new-arr)))))
(cleanup [this keep?]
(dotimes [x length]
(let [v (.pop this)]
(when ^boolean (keep? v)
(.unshift this v))))))
(defn ring-buffer [n]
(assert (> n 0) "Can't create a ring buffer of size 0")
(RingBuffer. 0 0 0 (make-array n)))
;; -----------------------------------------------------------------------------
(deftype FixedBuffer [buf n]
impl/Buffer
(full? [this]
(== (.-length buf) n))
(remove! [this]
(.pop buf))
(add!* [this itm]
(.unbounded-unshift buf itm)
this)
(close-buf! [this])
cljs.core/ICounted
(-count [this]
(.-length buf)))
(defn fixed-buffer [n]
(FixedBuffer. (ring-buffer n) n))
(deftype DroppingBuffer [buf n]
impl/UnblockingBuffer
impl/Buffer
(full? [this]
false)
(remove! [this]
(.pop buf))
(add!* [this itm]
(when-not (== (.-length buf) n)
(.unshift buf itm))
this)
(close-buf! [this])
cljs.core/ICounted
(-count [this]
(.-length buf)))
(defn dropping-buffer [n]
(DroppingBuffer. (ring-buffer n) n))
(deftype SlidingBuffer [buf n]
impl/UnblockingBuffer
impl/Buffer
(full? [this]
false)
(remove! [this]
(.pop buf))
(add!* [this itm]
(when (== (.-length buf) n)
(impl/remove! this))
(.unshift buf itm)
this)
(close-buf! [this])
cljs.core/ICounted
(-count [this]
(.-length buf)))
(defn sliding-buffer [n]
(SlidingBuffer. (ring-buffer n) n))
(defonce ^:private NO-VAL (js/Object.))
(defn- undelivered? [val]
(identical? NO-VAL val))
(deftype PromiseBuffer [^:mutable val]
impl/UnblockingBuffer
impl/Buffer
(full? [_]
false)
(remove! [_]
val)
(add!* [this itm]
(when (undelivered? val)
(set! val itm))
this)
(close-buf! [_]
(when (undelivered? val)
(set! val nil)))
cljs.core/ICounted
(-count [_]
(if (undelivered? val) 0 1)))
(defn promise-buffer []
(PromiseBuffer. NO-VAL))

File diff suppressed because one or more lines are too long

View file

@ -1,451 +0,0 @@
// Compiled by ClojureScript 1.9.229 {}
goog.provide('cljs.core.async.impl.buffers');
goog.require('cljs.core');
goog.require('cljs.core.async.impl.protocols');
cljs.core.async.impl.buffers.acopy = (function cljs$core$async$impl$buffers$acopy(src,src_start,dest,dest_start,len){
var cnt = (0);
while(true){
if((cnt < len)){
(dest[(dest_start + cnt)] = (src[(src_start + cnt)]));
var G__27118 = (cnt + (1));
cnt = G__27118;
continue;
} else {
return null;
}
break;
}
});
/**
* @constructor
* @implements {cljs.core.async.impl.buffers.Object}
*/
cljs.core.async.impl.buffers.RingBuffer = (function (head,tail,length,arr){
this.head = head;
this.tail = tail;
this.length = length;
this.arr = arr;
})
cljs.core.async.impl.buffers.RingBuffer.prototype.pop = (function (){
var self__ = this;
var _ = this;
if((self__.length === (0))){
return null;
} else {
var x = (self__.arr[self__.tail]);
(self__.arr[self__.tail] = null);
self__.tail = ((self__.tail + (1)) % self__.arr.length);
self__.length = (self__.length - (1));
return x;
}
});
cljs.core.async.impl.buffers.RingBuffer.prototype.unshift = (function (x){
var self__ = this;
var _ = this;
(self__.arr[self__.head] = x);
self__.head = ((self__.head + (1)) % self__.arr.length);
self__.length = (self__.length + (1));
return null;
});
cljs.core.async.impl.buffers.RingBuffer.prototype.unbounded_unshift = (function (x){
var self__ = this;
var this$ = this;
if(((self__.length + (1)) === self__.arr.length)){
this$.resize();
} else {
}
return this$.unshift(x);
});
cljs.core.async.impl.buffers.RingBuffer.prototype.resize = (function (){
var self__ = this;
var _ = this;
var new_arr_size = (self__.arr.length * (2));
var new_arr = (new Array(new_arr_size));
if((self__.tail < self__.head)){
cljs.core.async.impl.buffers.acopy.call(null,self__.arr,self__.tail,new_arr,(0),self__.length);
self__.tail = (0);
self__.head = self__.length;
return self__.arr = new_arr;
} else {
if((self__.tail > self__.head)){
cljs.core.async.impl.buffers.acopy.call(null,self__.arr,self__.tail,new_arr,(0),(self__.arr.length - self__.tail));
cljs.core.async.impl.buffers.acopy.call(null,self__.arr,(0),new_arr,(self__.arr.length - self__.tail),self__.head);
self__.tail = (0);
self__.head = self__.length;
return self__.arr = new_arr;
} else {
if((self__.tail === self__.head)){
self__.tail = (0);
self__.head = (0);
return self__.arr = new_arr;
} else {
return null;
}
}
}
});
cljs.core.async.impl.buffers.RingBuffer.prototype.cleanup = (function (keep_QMARK_){
var self__ = this;
var this$ = this;
var n__26045__auto__ = self__.length;
var x = (0);
while(true){
if((x < n__26045__auto__)){
var v_27119 = this$.pop();
if(keep_QMARK_.call(null,v_27119)){
this$.unshift(v_27119);
} else {
}
var G__27120 = (x + (1));
x = G__27120;
continue;
} else {
return null;
}
break;
}
});
cljs.core.async.impl.buffers.RingBuffer.getBasis = (function (){
return new cljs.core.PersistentVector(null, 4, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.with_meta(new cljs.core.Symbol(null,"head","head",869147608,null),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"mutable","mutable",875778266),true], null)),cljs.core.with_meta(new cljs.core.Symbol(null,"tail","tail",494507963,null),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"mutable","mutable",875778266),true], null)),cljs.core.with_meta(new cljs.core.Symbol(null,"length","length",-2065447907,null),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"mutable","mutable",875778266),true], null)),cljs.core.with_meta(new cljs.core.Symbol(null,"arr","arr",2115492975,null),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"mutable","mutable",875778266),true], null))], null);
});
cljs.core.async.impl.buffers.RingBuffer.cljs$lang$type = true;
cljs.core.async.impl.buffers.RingBuffer.cljs$lang$ctorStr = "cljs.core.async.impl.buffers/RingBuffer";
cljs.core.async.impl.buffers.RingBuffer.cljs$lang$ctorPrWriter = (function (this__25736__auto__,writer__25737__auto__,opt__25738__auto__){
return cljs.core._write.call(null,writer__25737__auto__,"cljs.core.async.impl.buffers/RingBuffer");
});
cljs.core.async.impl.buffers.__GT_RingBuffer = (function cljs$core$async$impl$buffers$__GT_RingBuffer(head,tail,length,arr){
return (new cljs.core.async.impl.buffers.RingBuffer(head,tail,length,arr));
});
cljs.core.async.impl.buffers.ring_buffer = (function cljs$core$async$impl$buffers$ring_buffer(n){
if((n > (0))){
} else {
throw (new Error([cljs.core.str("Assert failed: "),cljs.core.str("Can't create a ring buffer of size 0"),cljs.core.str("\n"),cljs.core.str("(> n 0)")].join('')));
}
return (new cljs.core.async.impl.buffers.RingBuffer((0),(0),(0),(new Array(n))));
});
/**
* @constructor
* @implements {cljs.core.ICounted}
* @implements {cljs.core.async.impl.protocols.Buffer}
*/
cljs.core.async.impl.buffers.FixedBuffer = (function (buf,n){
this.buf = buf;
this.n = n;
this.cljs$lang$protocol_mask$partition0$ = 2;
this.cljs$lang$protocol_mask$partition1$ = 0;
})
cljs.core.async.impl.buffers.FixedBuffer.prototype.cljs$core$async$impl$protocols$Buffer$ = true;
cljs.core.async.impl.buffers.FixedBuffer.prototype.cljs$core$async$impl$protocols$Buffer$full_QMARK_$arity$1 = (function (this$){
var self__ = this;
var this$__$1 = this;
return (self__.buf.length === self__.n);
});
cljs.core.async.impl.buffers.FixedBuffer.prototype.cljs$core$async$impl$protocols$Buffer$remove_BANG_$arity$1 = (function (this$){
var self__ = this;
var this$__$1 = this;
return self__.buf.pop();
});
cljs.core.async.impl.buffers.FixedBuffer.prototype.cljs$core$async$impl$protocols$Buffer$add_BANG__STAR_$arity$2 = (function (this$,itm){
var self__ = this;
var this$__$1 = this;
self__.buf.unbounded_unshift(itm);
return this$__$1;
});
cljs.core.async.impl.buffers.FixedBuffer.prototype.cljs$core$async$impl$protocols$Buffer$close_buf_BANG_$arity$1 = (function (this$){
var self__ = this;
var this$__$1 = this;
return null;
});
cljs.core.async.impl.buffers.FixedBuffer.prototype.cljs$core$ICounted$_count$arity$1 = (function (this$){
var self__ = this;
var this$__$1 = this;
return self__.buf.length;
});
cljs.core.async.impl.buffers.FixedBuffer.getBasis = (function (){
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"buf","buf",1426618187,null),new cljs.core.Symbol(null,"n","n",-2092305744,null)], null);
});
cljs.core.async.impl.buffers.FixedBuffer.cljs$lang$type = true;
cljs.core.async.impl.buffers.FixedBuffer.cljs$lang$ctorStr = "cljs.core.async.impl.buffers/FixedBuffer";
cljs.core.async.impl.buffers.FixedBuffer.cljs$lang$ctorPrWriter = (function (this__25736__auto__,writer__25737__auto__,opt__25738__auto__){
return cljs.core._write.call(null,writer__25737__auto__,"cljs.core.async.impl.buffers/FixedBuffer");
});
cljs.core.async.impl.buffers.__GT_FixedBuffer = (function cljs$core$async$impl$buffers$__GT_FixedBuffer(buf,n){
return (new cljs.core.async.impl.buffers.FixedBuffer(buf,n));
});
cljs.core.async.impl.buffers.fixed_buffer = (function cljs$core$async$impl$buffers$fixed_buffer(n){
return (new cljs.core.async.impl.buffers.FixedBuffer(cljs.core.async.impl.buffers.ring_buffer.call(null,n),n));
});
/**
* @constructor
* @implements {cljs.core.ICounted}
* @implements {cljs.core.async.impl.protocols.UnblockingBuffer}
* @implements {cljs.core.async.impl.protocols.Buffer}
*/
cljs.core.async.impl.buffers.DroppingBuffer = (function (buf,n){
this.buf = buf;
this.n = n;
this.cljs$lang$protocol_mask$partition0$ = 2;
this.cljs$lang$protocol_mask$partition1$ = 0;
})
cljs.core.async.impl.buffers.DroppingBuffer.prototype.cljs$core$async$impl$protocols$UnblockingBuffer$ = true;
cljs.core.async.impl.buffers.DroppingBuffer.prototype.cljs$core$async$impl$protocols$Buffer$ = true;
cljs.core.async.impl.buffers.DroppingBuffer.prototype.cljs$core$async$impl$protocols$Buffer$full_QMARK_$arity$1 = (function (this$){
var self__ = this;
var this$__$1 = this;
return false;
});
cljs.core.async.impl.buffers.DroppingBuffer.prototype.cljs$core$async$impl$protocols$Buffer$remove_BANG_$arity$1 = (function (this$){
var self__ = this;
var this$__$1 = this;
return self__.buf.pop();
});
cljs.core.async.impl.buffers.DroppingBuffer.prototype.cljs$core$async$impl$protocols$Buffer$add_BANG__STAR_$arity$2 = (function (this$,itm){
var self__ = this;
var this$__$1 = this;
if((self__.buf.length === self__.n)){
} else {
self__.buf.unshift(itm);
}
return this$__$1;
});
cljs.core.async.impl.buffers.DroppingBuffer.prototype.cljs$core$async$impl$protocols$Buffer$close_buf_BANG_$arity$1 = (function (this$){
var self__ = this;
var this$__$1 = this;
return null;
});
cljs.core.async.impl.buffers.DroppingBuffer.prototype.cljs$core$ICounted$_count$arity$1 = (function (this$){
var self__ = this;
var this$__$1 = this;
return self__.buf.length;
});
cljs.core.async.impl.buffers.DroppingBuffer.getBasis = (function (){
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"buf","buf",1426618187,null),new cljs.core.Symbol(null,"n","n",-2092305744,null)], null);
});
cljs.core.async.impl.buffers.DroppingBuffer.cljs$lang$type = true;
cljs.core.async.impl.buffers.DroppingBuffer.cljs$lang$ctorStr = "cljs.core.async.impl.buffers/DroppingBuffer";
cljs.core.async.impl.buffers.DroppingBuffer.cljs$lang$ctorPrWriter = (function (this__25736__auto__,writer__25737__auto__,opt__25738__auto__){
return cljs.core._write.call(null,writer__25737__auto__,"cljs.core.async.impl.buffers/DroppingBuffer");
});
cljs.core.async.impl.buffers.__GT_DroppingBuffer = (function cljs$core$async$impl$buffers$__GT_DroppingBuffer(buf,n){
return (new cljs.core.async.impl.buffers.DroppingBuffer(buf,n));
});
cljs.core.async.impl.buffers.dropping_buffer = (function cljs$core$async$impl$buffers$dropping_buffer(n){
return (new cljs.core.async.impl.buffers.DroppingBuffer(cljs.core.async.impl.buffers.ring_buffer.call(null,n),n));
});
/**
* @constructor
* @implements {cljs.core.ICounted}
* @implements {cljs.core.async.impl.protocols.UnblockingBuffer}
* @implements {cljs.core.async.impl.protocols.Buffer}
*/
cljs.core.async.impl.buffers.SlidingBuffer = (function (buf,n){
this.buf = buf;
this.n = n;
this.cljs$lang$protocol_mask$partition0$ = 2;
this.cljs$lang$protocol_mask$partition1$ = 0;
})
cljs.core.async.impl.buffers.SlidingBuffer.prototype.cljs$core$async$impl$protocols$UnblockingBuffer$ = true;
cljs.core.async.impl.buffers.SlidingBuffer.prototype.cljs$core$async$impl$protocols$Buffer$ = true;
cljs.core.async.impl.buffers.SlidingBuffer.prototype.cljs$core$async$impl$protocols$Buffer$full_QMARK_$arity$1 = (function (this$){
var self__ = this;
var this$__$1 = this;
return false;
});
cljs.core.async.impl.buffers.SlidingBuffer.prototype.cljs$core$async$impl$protocols$Buffer$remove_BANG_$arity$1 = (function (this$){
var self__ = this;
var this$__$1 = this;
return self__.buf.pop();
});
cljs.core.async.impl.buffers.SlidingBuffer.prototype.cljs$core$async$impl$protocols$Buffer$add_BANG__STAR_$arity$2 = (function (this$,itm){
var self__ = this;
var this$__$1 = this;
if((self__.buf.length === self__.n)){
cljs.core.async.impl.protocols.remove_BANG_.call(null,this$__$1);
} else {
}
self__.buf.unshift(itm);
return this$__$1;
});
cljs.core.async.impl.buffers.SlidingBuffer.prototype.cljs$core$async$impl$protocols$Buffer$close_buf_BANG_$arity$1 = (function (this$){
var self__ = this;
var this$__$1 = this;
return null;
});
cljs.core.async.impl.buffers.SlidingBuffer.prototype.cljs$core$ICounted$_count$arity$1 = (function (this$){
var self__ = this;
var this$__$1 = this;
return self__.buf.length;
});
cljs.core.async.impl.buffers.SlidingBuffer.getBasis = (function (){
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"buf","buf",1426618187,null),new cljs.core.Symbol(null,"n","n",-2092305744,null)], null);
});
cljs.core.async.impl.buffers.SlidingBuffer.cljs$lang$type = true;
cljs.core.async.impl.buffers.SlidingBuffer.cljs$lang$ctorStr = "cljs.core.async.impl.buffers/SlidingBuffer";
cljs.core.async.impl.buffers.SlidingBuffer.cljs$lang$ctorPrWriter = (function (this__25736__auto__,writer__25737__auto__,opt__25738__auto__){
return cljs.core._write.call(null,writer__25737__auto__,"cljs.core.async.impl.buffers/SlidingBuffer");
});
cljs.core.async.impl.buffers.__GT_SlidingBuffer = (function cljs$core$async$impl$buffers$__GT_SlidingBuffer(buf,n){
return (new cljs.core.async.impl.buffers.SlidingBuffer(buf,n));
});
cljs.core.async.impl.buffers.sliding_buffer = (function cljs$core$async$impl$buffers$sliding_buffer(n){
return (new cljs.core.async.impl.buffers.SlidingBuffer(cljs.core.async.impl.buffers.ring_buffer.call(null,n),n));
});
if(typeof cljs.core.async.impl.buffers.NO_VAL !== 'undefined'){
} else {
cljs.core.async.impl.buffers.NO_VAL = (new Object());
}
cljs.core.async.impl.buffers.undelivered_QMARK_ = (function cljs$core$async$impl$buffers$undelivered_QMARK_(val){
return (cljs.core.async.impl.buffers.NO_VAL === val);
});
/**
* @constructor
* @implements {cljs.core.ICounted}
* @implements {cljs.core.async.impl.protocols.UnblockingBuffer}
* @implements {cljs.core.async.impl.protocols.Buffer}
*/
cljs.core.async.impl.buffers.PromiseBuffer = (function (val){
this.val = val;
this.cljs$lang$protocol_mask$partition0$ = 2;
this.cljs$lang$protocol_mask$partition1$ = 0;
})
cljs.core.async.impl.buffers.PromiseBuffer.prototype.cljs$core$async$impl$protocols$UnblockingBuffer$ = true;
cljs.core.async.impl.buffers.PromiseBuffer.prototype.cljs$core$async$impl$protocols$Buffer$ = true;
cljs.core.async.impl.buffers.PromiseBuffer.prototype.cljs$core$async$impl$protocols$Buffer$full_QMARK_$arity$1 = (function (_){
var self__ = this;
var ___$1 = this;
return false;
});
cljs.core.async.impl.buffers.PromiseBuffer.prototype.cljs$core$async$impl$protocols$Buffer$remove_BANG_$arity$1 = (function (_){
var self__ = this;
var ___$1 = this;
return self__.val;
});
cljs.core.async.impl.buffers.PromiseBuffer.prototype.cljs$core$async$impl$protocols$Buffer$add_BANG__STAR_$arity$2 = (function (this$,itm){
var self__ = this;
var this$__$1 = this;
if(cljs.core.truth_(cljs.core.async.impl.buffers.undelivered_QMARK_.call(null,self__.val))){
self__.val = itm;
} else {
}
return this$__$1;
});
cljs.core.async.impl.buffers.PromiseBuffer.prototype.cljs$core$async$impl$protocols$Buffer$close_buf_BANG_$arity$1 = (function (_){
var self__ = this;
var ___$1 = this;
if(cljs.core.truth_(cljs.core.async.impl.buffers.undelivered_QMARK_.call(null,self__.val))){
return self__.val = null;
} else {
return null;
}
});
cljs.core.async.impl.buffers.PromiseBuffer.prototype.cljs$core$ICounted$_count$arity$1 = (function (_){
var self__ = this;
var ___$1 = this;
if(cljs.core.truth_(cljs.core.async.impl.buffers.undelivered_QMARK_.call(null,self__.val))){
return (0);
} else {
return (1);
}
});
cljs.core.async.impl.buffers.PromiseBuffer.getBasis = (function (){
return new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.with_meta(new cljs.core.Symbol(null,"val","val",1769233139,null),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"mutable","mutable",875778266),true], null))], null);
});
cljs.core.async.impl.buffers.PromiseBuffer.cljs$lang$type = true;
cljs.core.async.impl.buffers.PromiseBuffer.cljs$lang$ctorStr = "cljs.core.async.impl.buffers/PromiseBuffer";
cljs.core.async.impl.buffers.PromiseBuffer.cljs$lang$ctorPrWriter = (function (this__25736__auto__,writer__25737__auto__,opt__25738__auto__){
return cljs.core._write.call(null,writer__25737__auto__,"cljs.core.async.impl.buffers/PromiseBuffer");
});
cljs.core.async.impl.buffers.__GT_PromiseBuffer = (function cljs$core$async$impl$buffers$__GT_PromiseBuffer(val){
return (new cljs.core.async.impl.buffers.PromiseBuffer(val));
});
cljs.core.async.impl.buffers.promise_buffer = (function cljs$core$async$impl$buffers$promise_buffer(){
return (new cljs.core.async.impl.buffers.PromiseBuffer(cljs.core.async.impl.buffers.NO_VAL));
});
//# sourceMappingURL=buffers.js.map?rel=1603199189626

File diff suppressed because one or more lines are too long

View file

@ -1,185 +0,0 @@
;; Copyright (c) Rich Hickey and contributors. All rights reserved.
;; The use and distribution terms for this software are covered by the
;; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
;; which can be found in the file epl-v10.html at the root of this distribution.
;; By using this software in any fashion, you are agreeing to be bound by
;; the terms of this license.
;; You must not remove this notice, or any other, from this software.
(ns cljs.core.async.impl.channels
(:require [cljs.core.async.impl.protocols :as impl]
[cljs.core.async.impl.dispatch :as dispatch]
[cljs.core.async.impl.buffers :as buffers]))
(defn box [val]
(reify cljs.core/IDeref
(-deref [_] val)))
(deftype PutBox [handler val])
(defn put-active? [box]
(impl/active? (.-handler box)))
(def ^:const MAX_DIRTY 64)
(defprotocol MMC
(abort [this]))
(deftype ManyToManyChannel [takes ^:mutable dirty-takes puts ^:mutable dirty-puts ^not-native buf ^:mutable closed add!]
MMC
(abort [this]
(loop []
(let [putter (.pop puts)]
(when-not (nil? putter)
(let [^not-native put-handler (.-handler putter)
val (.-val putter)]
(if ^boolean (impl/active? put-handler)
(let [put-cb (impl/commit put-handler)]
(dispatch/run #(put-cb true)))
(recur))))))
(.cleanup puts (constantly false))
(impl/close! this))
impl/WritePort
(put! [this val ^not-native handler]
(assert (not (nil? val)) "Can't put nil in on a channel")
;; bug in CLJS compiler boolean inference - David
(let [^boolean closed closed]
(if (or closed (not ^boolean (impl/active? handler)))
(box (not closed))
(if (and buf (not (impl/full? buf)))
(do
(impl/commit handler)
(let [done? (reduced? (add! buf val))]
(loop []
(when (and (pos? (.-length takes)) (pos? (count buf)))
(let [^not-native taker (.pop takes)]
(if ^boolean (impl/active? taker)
(let [take-cb (impl/commit taker)
val (impl/remove! buf)]
(dispatch/run (fn [] (take-cb val))))
(recur)))))
(when done? (abort this))
(box true)))
(let [taker (loop []
(let [^not-native taker (.pop takes)]
(when taker
(if (impl/active? taker)
taker
(recur)))))]
(if taker
(let [take-cb (impl/commit taker)]
(impl/commit handler)
(dispatch/run (fn [] (take-cb val)))
(box true))
(do
(if (> dirty-puts MAX_DIRTY)
(do (set! dirty-puts 0)
(.cleanup puts put-active?))
(set! dirty-puts (inc dirty-puts)))
(when (impl/blockable? handler)
(assert (< (.-length puts) impl/MAX-QUEUE-SIZE)
(str "No more than " impl/MAX-QUEUE-SIZE
" pending puts are allowed on a single channel."
" Consider using a windowed buffer."))
(.unbounded-unshift puts (PutBox. handler val)))
nil)))))))
impl/ReadPort
(take! [this ^not-native handler]
(if (not ^boolean (impl/active? handler))
nil
(if (and (not (nil? buf)) (pos? (count buf)))
(let [_ (impl/commit handler)
retval (box (impl/remove! buf))]
(loop []
(when-not (impl/full? buf)
(let [putter (.pop puts)]
(when-not (nil? putter)
(let [^not-native put-handler (.-handler putter)
val (.-val putter)]
(when ^boolean (impl/active? put-handler)
(let [put-cb (impl/commit put-handler)]
(impl/commit handler)
(dispatch/run #(put-cb true))
(when (reduced? (add! buf val))
(abort this)))))
(recur)))))
retval)
(let [putter (loop []
(let [putter (.pop puts)]
(when putter
(if ^boolean (impl/active? (.-handler putter))
putter
(recur)))))]
(if putter
(let [put-cb (impl/commit (.-handler putter))]
(impl/commit handler)
(dispatch/run #(put-cb true))
(box (.-val putter)))
(if closed
(do
(when buf (add! buf))
(if (and (impl/active? handler) (impl/commit handler))
(let [has-val (and buf (pos? (count buf)))]
(let [val (when has-val (impl/remove! buf))]
(box val)))
nil))
(do
(if (> dirty-takes MAX_DIRTY)
(do (set! dirty-takes 0)
(.cleanup takes impl/active?))
(set! dirty-takes (inc dirty-takes)))
(when (impl/blockable? handler)
(assert (< (.-length takes) impl/MAX-QUEUE-SIZE)
(str "No more than " impl/MAX-QUEUE-SIZE
" pending takes are allowed on a single channel."))
(.unbounded-unshift takes handler))
nil)))))))
impl/Channel
(closed? [_] closed)
(close! [this]
(if ^boolean closed
nil
(do (set! closed true)
(when (and buf (zero? (.-length puts)))
(add! buf))
(loop []
(let [^not-native taker (.pop takes)]
(when-not (nil? taker)
(when ^boolean (impl/active? taker)
(let [take-cb (impl/commit taker)
val (when (and buf (pos? (count buf))) (impl/remove! buf))]
(dispatch/run (fn [] (take-cb val)))))
(recur))))
(when buf (impl/close-buf! buf))
nil))))
(defn- ex-handler [ex]
(.log js/console ex)
nil)
(defn- handle [buf exh t]
(let [else ((or exh ex-handler) t)]
(if (nil? else)
buf
(impl/add! buf else))))
(defn chan
([buf] (chan buf nil))
([buf xform] (chan buf xform nil))
([buf xform exh]
(ManyToManyChannel. (buffers/ring-buffer 32) 0 (buffers/ring-buffer 32)
0 buf false
(let [add! (if xform (xform impl/add!) impl/add!)]
(fn
([buf]
(try
(add! buf)
(catch :default t
(handle buf exh t))))
([buf val]
(try
(add! buf val)
(catch :default t
(handle buf exh t)))))))))

File diff suppressed because one or more lines are too long

View file

@ -1,560 +0,0 @@
// Compiled by ClojureScript 1.9.229 {}
goog.provide('cljs.core.async.impl.channels');
goog.require('cljs.core');
goog.require('cljs.core.async.impl.protocols');
goog.require('cljs.core.async.impl.dispatch');
goog.require('cljs.core.async.impl.buffers');
cljs.core.async.impl.channels.box = (function cljs$core$async$impl$channels$box(val){
if(typeof cljs.core.async.impl.channels.t_cljs$core$async$impl$channels27131 !== 'undefined'){
} else {
/**
* @constructor
* @implements {cljs.core.IMeta}
* @implements {cljs.core.IDeref}
* @implements {cljs.core.IWithMeta}
*/
cljs.core.async.impl.channels.t_cljs$core$async$impl$channels27131 = (function (box,val,meta27132){
this.box = box;
this.val = val;
this.meta27132 = meta27132;
this.cljs$lang$protocol_mask$partition0$ = 425984;
this.cljs$lang$protocol_mask$partition1$ = 0;
})
cljs.core.async.impl.channels.t_cljs$core$async$impl$channels27131.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_27133,meta27132__$1){
var self__ = this;
var _27133__$1 = this;
return (new cljs.core.async.impl.channels.t_cljs$core$async$impl$channels27131(self__.box,self__.val,meta27132__$1));
});
cljs.core.async.impl.channels.t_cljs$core$async$impl$channels27131.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_27133){
var self__ = this;
var _27133__$1 = this;
return self__.meta27132;
});
cljs.core.async.impl.channels.t_cljs$core$async$impl$channels27131.prototype.cljs$core$IDeref$_deref$arity$1 = (function (_){
var self__ = this;
var ___$1 = this;
return self__.val;
});
cljs.core.async.impl.channels.t_cljs$core$async$impl$channels27131.getBasis = (function (){
return new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.with_meta(new cljs.core.Symbol(null,"box","box",-1123515375,null),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"arglists","arglists",1661989754),cljs.core.list(new cljs.core.Symbol(null,"quote","quote",1377916282,null),cljs.core.list(new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"val","val",1769233139,null)], null)))], null)),new cljs.core.Symbol(null,"val","val",1769233139,null),new cljs.core.Symbol(null,"meta27132","meta27132",1018108436,null)], null);
});
cljs.core.async.impl.channels.t_cljs$core$async$impl$channels27131.cljs$lang$type = true;
cljs.core.async.impl.channels.t_cljs$core$async$impl$channels27131.cljs$lang$ctorStr = "cljs.core.async.impl.channels/t_cljs$core$async$impl$channels27131";
cljs.core.async.impl.channels.t_cljs$core$async$impl$channels27131.cljs$lang$ctorPrWriter = (function (this__25736__auto__,writer__25737__auto__,opt__25738__auto__){
return cljs.core._write.call(null,writer__25737__auto__,"cljs.core.async.impl.channels/t_cljs$core$async$impl$channels27131");
});
cljs.core.async.impl.channels.__GT_t_cljs$core$async$impl$channels27131 = (function cljs$core$async$impl$channels$box_$___GT_t_cljs$core$async$impl$channels27131(box__$1,val__$1,meta27132){
return (new cljs.core.async.impl.channels.t_cljs$core$async$impl$channels27131(box__$1,val__$1,meta27132));
});
}
return (new cljs.core.async.impl.channels.t_cljs$core$async$impl$channels27131(cljs$core$async$impl$channels$box,val,cljs.core.PersistentArrayMap.EMPTY));
});
/**
* @constructor
*/
cljs.core.async.impl.channels.PutBox = (function (handler,val){
this.handler = handler;
this.val = val;
})
cljs.core.async.impl.channels.PutBox.getBasis = (function (){
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"handler","handler",1444934915,null),new cljs.core.Symbol(null,"val","val",1769233139,null)], null);
});
cljs.core.async.impl.channels.PutBox.cljs$lang$type = true;
cljs.core.async.impl.channels.PutBox.cljs$lang$ctorStr = "cljs.core.async.impl.channels/PutBox";
cljs.core.async.impl.channels.PutBox.cljs$lang$ctorPrWriter = (function (this__25736__auto__,writer__25737__auto__,opt__25738__auto__){
return cljs.core._write.call(null,writer__25737__auto__,"cljs.core.async.impl.channels/PutBox");
});
cljs.core.async.impl.channels.__GT_PutBox = (function cljs$core$async$impl$channels$__GT_PutBox(handler,val){
return (new cljs.core.async.impl.channels.PutBox(handler,val));
});
cljs.core.async.impl.channels.put_active_QMARK_ = (function cljs$core$async$impl$channels$put_active_QMARK_(box){
return cljs.core.async.impl.protocols.active_QMARK_.call(null,box.handler);
});
cljs.core.async.impl.channels.MAX_DIRTY = (64);
/**
* @interface
*/
cljs.core.async.impl.channels.MMC = function(){};
cljs.core.async.impl.channels.abort = (function cljs$core$async$impl$channels$abort(this$){
if((!((this$ == null))) && (!((this$.cljs$core$async$impl$channels$MMC$abort$arity$1 == null)))){
return this$.cljs$core$async$impl$channels$MMC$abort$arity$1(this$);
} else {
var x__25793__auto__ = (((this$ == null))?null:this$);
var m__25794__auto__ = (cljs.core.async.impl.channels.abort[goog.typeOf(x__25793__auto__)]);
if(!((m__25794__auto__ == null))){
return m__25794__auto__.call(null,this$);
} else {
var m__25794__auto____$1 = (cljs.core.async.impl.channels.abort["_"]);
if(!((m__25794__auto____$1 == null))){
return m__25794__auto____$1.call(null,this$);
} else {
throw cljs.core.missing_protocol.call(null,"MMC.abort",this$);
}
}
}
});
/**
* @constructor
* @implements {cljs.core.async.impl.channels.MMC}
* @implements {cljs.core.async.impl.protocols.Channel}
* @implements {cljs.core.async.impl.protocols.WritePort}
* @implements {cljs.core.async.impl.protocols.ReadPort}
*/
cljs.core.async.impl.channels.ManyToManyChannel = (function (takes,dirty_takes,puts,dirty_puts,buf,closed,add_BANG_){
this.takes = takes;
this.dirty_takes = dirty_takes;
this.puts = puts;
this.dirty_puts = dirty_puts;
this.buf = buf;
this.closed = closed;
this.add_BANG_ = add_BANG_;
})
cljs.core.async.impl.channels.ManyToManyChannel.prototype.cljs$core$async$impl$channels$MMC$ = true;
cljs.core.async.impl.channels.ManyToManyChannel.prototype.cljs$core$async$impl$channels$MMC$abort$arity$1 = (function (this$){
var self__ = this;
var this$__$1 = this;
while(true){
var putter_27134 = self__.puts.pop();
if((putter_27134 == null)){
} else {
var put_handler_27135 = putter_27134.handler;
var val_27136 = putter_27134.val;
if(cljs.core.async.impl.protocols.active_QMARK_.call(null,put_handler_27135)){
var put_cb_27137 = cljs.core.async.impl.protocols.commit.call(null,put_handler_27135);
cljs.core.async.impl.dispatch.run.call(null,((function (put_cb_27137,put_handler_27135,val_27136,putter_27134,this$__$1){
return (function (){
return put_cb_27137.call(null,true);
});})(put_cb_27137,put_handler_27135,val_27136,putter_27134,this$__$1))
);
} else {
continue;
}
}
break;
}
self__.puts.cleanup(cljs.core.constantly.call(null,false));
return cljs.core.async.impl.protocols.close_BANG_.call(null,this$__$1);
});
cljs.core.async.impl.channels.ManyToManyChannel.prototype.cljs$core$async$impl$protocols$WritePort$ = true;
cljs.core.async.impl.channels.ManyToManyChannel.prototype.cljs$core$async$impl$protocols$WritePort$put_BANG_$arity$3 = (function (this$,val,handler){
var self__ = this;
var this$__$1 = this;
if(!((val == null))){
} else {
throw (new Error([cljs.core.str("Assert failed: "),cljs.core.str("Can't put nil in on a channel"),cljs.core.str("\n"),cljs.core.str("(not (nil? val))")].join('')));
}
var closed__$1 = self__.closed;
if((closed__$1) || (!(cljs.core.async.impl.protocols.active_QMARK_.call(null,handler)))){
return cljs.core.async.impl.channels.box.call(null,!(closed__$1));
} else {
if(cljs.core.truth_((function (){var and__25118__auto__ = self__.buf;
if(cljs.core.truth_(and__25118__auto__)){
return cljs.core.not.call(null,cljs.core.async.impl.protocols.full_QMARK_.call(null,self__.buf));
} else {
return and__25118__auto__;
}
})())){
cljs.core.async.impl.protocols.commit.call(null,handler);
var done_QMARK_ = cljs.core.reduced_QMARK_.call(null,self__.add_BANG_.call(null,self__.buf,val));
while(true){
if(((self__.takes.length > (0))) && ((cljs.core.count.call(null,self__.buf) > (0)))){
var taker_27138 = self__.takes.pop();
if(cljs.core.async.impl.protocols.active_QMARK_.call(null,taker_27138)){
var take_cb_27139 = cljs.core.async.impl.protocols.commit.call(null,taker_27138);
var val_27140__$1 = cljs.core.async.impl.protocols.remove_BANG_.call(null,self__.buf);
cljs.core.async.impl.dispatch.run.call(null,((function (take_cb_27139,val_27140__$1,taker_27138,done_QMARK_,closed__$1,this$__$1){
return (function (){
return take_cb_27139.call(null,val_27140__$1);
});})(take_cb_27139,val_27140__$1,taker_27138,done_QMARK_,closed__$1,this$__$1))
);
} else {
continue;
}
} else {
}
break;
}
if(done_QMARK_){
cljs.core.async.impl.channels.abort.call(null,this$__$1);
} else {
}
return cljs.core.async.impl.channels.box.call(null,true);
} else {
var taker = (function (){while(true){
var taker = self__.takes.pop();
if(cljs.core.truth_(taker)){
if(cljs.core.truth_(cljs.core.async.impl.protocols.active_QMARK_.call(null,taker))){
return taker;
} else {
continue;
}
} else {
return null;
}
break;
}
})();
if(cljs.core.truth_(taker)){
var take_cb = cljs.core.async.impl.protocols.commit.call(null,taker);
cljs.core.async.impl.protocols.commit.call(null,handler);
cljs.core.async.impl.dispatch.run.call(null,((function (take_cb,taker,closed__$1,this$__$1){
return (function (){
return take_cb.call(null,val);
});})(take_cb,taker,closed__$1,this$__$1))
);
return cljs.core.async.impl.channels.box.call(null,true);
} else {
if((self__.dirty_puts > cljs.core.async.impl.channels.MAX_DIRTY)){
self__.dirty_puts = (0);
self__.puts.cleanup(cljs.core.async.impl.channels.put_active_QMARK_);
} else {
self__.dirty_puts = (self__.dirty_puts + (1));
}
if(cljs.core.truth_(cljs.core.async.impl.protocols.blockable_QMARK_.call(null,handler))){
if((self__.puts.length < cljs.core.async.impl.protocols.MAX_QUEUE_SIZE)){
} else {
throw (new Error([cljs.core.str("Assert failed: "),cljs.core.str([cljs.core.str("No more than "),cljs.core.str(cljs.core.async.impl.protocols.MAX_QUEUE_SIZE),cljs.core.str(" pending puts are allowed on a single channel."),cljs.core.str(" Consider using a windowed buffer.")].join('')),cljs.core.str("\n"),cljs.core.str("(< (.-length puts) impl/MAX-QUEUE-SIZE)")].join('')));
}
self__.puts.unbounded_unshift((new cljs.core.async.impl.channels.PutBox(handler,val)));
} else {
}
return null;
}
}
}
});
cljs.core.async.impl.channels.ManyToManyChannel.prototype.cljs$core$async$impl$protocols$ReadPort$ = true;
cljs.core.async.impl.channels.ManyToManyChannel.prototype.cljs$core$async$impl$protocols$ReadPort$take_BANG_$arity$2 = (function (this$,handler){
var self__ = this;
var this$__$1 = this;
if(!(cljs.core.async.impl.protocols.active_QMARK_.call(null,handler))){
return null;
} else {
if((!((self__.buf == null))) && ((cljs.core.count.call(null,self__.buf) > (0)))){
var _ = cljs.core.async.impl.protocols.commit.call(null,handler);
var retval = cljs.core.async.impl.channels.box.call(null,cljs.core.async.impl.protocols.remove_BANG_.call(null,self__.buf));
while(true){
if(cljs.core.truth_(cljs.core.async.impl.protocols.full_QMARK_.call(null,self__.buf))){
} else {
var putter_27141 = self__.puts.pop();
if((putter_27141 == null)){
} else {
var put_handler_27142 = putter_27141.handler;
var val_27143 = putter_27141.val;
if(cljs.core.async.impl.protocols.active_QMARK_.call(null,put_handler_27142)){
var put_cb_27144 = cljs.core.async.impl.protocols.commit.call(null,put_handler_27142);
cljs.core.async.impl.protocols.commit.call(null,handler);
cljs.core.async.impl.dispatch.run.call(null,((function (put_cb_27144,put_handler_27142,val_27143,putter_27141,_,retval,this$__$1){
return (function (){
return put_cb_27144.call(null,true);
});})(put_cb_27144,put_handler_27142,val_27143,putter_27141,_,retval,this$__$1))
);
if(cljs.core.reduced_QMARK_.call(null,self__.add_BANG_.call(null,self__.buf,val_27143))){
cljs.core.async.impl.channels.abort.call(null,this$__$1);
} else {
}
} else {
}
continue;
}
}
break;
}
return retval;
} else {
var putter = (function (){while(true){
var putter = self__.puts.pop();
if(cljs.core.truth_(putter)){
if(cljs.core.async.impl.protocols.active_QMARK_.call(null,putter.handler)){
return putter;
} else {
continue;
}
} else {
return null;
}
break;
}
})();
if(cljs.core.truth_(putter)){
var put_cb = cljs.core.async.impl.protocols.commit.call(null,putter.handler);
cljs.core.async.impl.protocols.commit.call(null,handler);
cljs.core.async.impl.dispatch.run.call(null,((function (put_cb,putter,this$__$1){
return (function (){
return put_cb.call(null,true);
});})(put_cb,putter,this$__$1))
);
return cljs.core.async.impl.channels.box.call(null,putter.val);
} else {
if(cljs.core.truth_(self__.closed)){
if(cljs.core.truth_(self__.buf)){
self__.add_BANG_.call(null,self__.buf);
} else {
}
if(cljs.core.truth_((function (){var and__25118__auto__ = cljs.core.async.impl.protocols.active_QMARK_.call(null,handler);
if(cljs.core.truth_(and__25118__auto__)){
return cljs.core.async.impl.protocols.commit.call(null,handler);
} else {
return and__25118__auto__;
}
})())){
var has_val = (function (){var and__25118__auto__ = self__.buf;
if(cljs.core.truth_(and__25118__auto__)){
return (cljs.core.count.call(null,self__.buf) > (0));
} else {
return and__25118__auto__;
}
})();
var val = (cljs.core.truth_(has_val)?cljs.core.async.impl.protocols.remove_BANG_.call(null,self__.buf):null);
return cljs.core.async.impl.channels.box.call(null,val);
} else {
return null;
}
} else {
if((self__.dirty_takes > cljs.core.async.impl.channels.MAX_DIRTY)){
self__.dirty_takes = (0);
self__.takes.cleanup(cljs.core.async.impl.protocols.active_QMARK_);
} else {
self__.dirty_takes = (self__.dirty_takes + (1));
}
if(cljs.core.truth_(cljs.core.async.impl.protocols.blockable_QMARK_.call(null,handler))){
if((self__.takes.length < cljs.core.async.impl.protocols.MAX_QUEUE_SIZE)){
} else {
throw (new Error([cljs.core.str("Assert failed: "),cljs.core.str([cljs.core.str("No more than "),cljs.core.str(cljs.core.async.impl.protocols.MAX_QUEUE_SIZE),cljs.core.str(" pending takes are allowed on a single channel.")].join('')),cljs.core.str("\n"),cljs.core.str("(< (.-length takes) impl/MAX-QUEUE-SIZE)")].join('')));
}
self__.takes.unbounded_unshift(handler);
} else {
}
return null;
}
}
}
}
});
cljs.core.async.impl.channels.ManyToManyChannel.prototype.cljs$core$async$impl$protocols$Channel$ = true;
cljs.core.async.impl.channels.ManyToManyChannel.prototype.cljs$core$async$impl$protocols$Channel$closed_QMARK_$arity$1 = (function (_){
var self__ = this;
var ___$1 = this;
return self__.closed;
});
cljs.core.async.impl.channels.ManyToManyChannel.prototype.cljs$core$async$impl$protocols$Channel$close_BANG_$arity$1 = (function (this$){
var self__ = this;
var this$__$1 = this;
if(self__.closed){
return null;
} else {
self__.closed = true;
if(cljs.core.truth_((function (){var and__25118__auto__ = self__.buf;
if(cljs.core.truth_(and__25118__auto__)){
return (self__.puts.length === (0));
} else {
return and__25118__auto__;
}
})())){
self__.add_BANG_.call(null,self__.buf);
} else {
}
while(true){
var taker_27145 = self__.takes.pop();
if((taker_27145 == null)){
} else {
if(cljs.core.async.impl.protocols.active_QMARK_.call(null,taker_27145)){
var take_cb_27146 = cljs.core.async.impl.protocols.commit.call(null,taker_27145);
var val_27147 = (cljs.core.truth_((function (){var and__25118__auto__ = self__.buf;
if(cljs.core.truth_(and__25118__auto__)){
return (cljs.core.count.call(null,self__.buf) > (0));
} else {
return and__25118__auto__;
}
})())?cljs.core.async.impl.protocols.remove_BANG_.call(null,self__.buf):null);
cljs.core.async.impl.dispatch.run.call(null,((function (take_cb_27146,val_27147,taker_27145,this$__$1){
return (function (){
return take_cb_27146.call(null,val_27147);
});})(take_cb_27146,val_27147,taker_27145,this$__$1))
);
} else {
}
continue;
}
break;
}
if(cljs.core.truth_(self__.buf)){
cljs.core.async.impl.protocols.close_buf_BANG_.call(null,self__.buf);
} else {
}
return null;
}
});
cljs.core.async.impl.channels.ManyToManyChannel.getBasis = (function (){
return new cljs.core.PersistentVector(null, 7, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"takes","takes",298247964,null),cljs.core.with_meta(new cljs.core.Symbol(null,"dirty-takes","dirty-takes",575642138,null),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"mutable","mutable",875778266),true], null)),new cljs.core.Symbol(null,"puts","puts",-1883877054,null),cljs.core.with_meta(new cljs.core.Symbol(null,"dirty-puts","dirty-puts",57041148,null),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"mutable","mutable",875778266),true], null)),cljs.core.with_meta(new cljs.core.Symbol(null,"buf","buf",1426618187,null),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"tag","tag",-1290361223),new cljs.core.Symbol(null,"not-native","not-native",-236392494,null)], null)),cljs.core.with_meta(new cljs.core.Symbol(null,"closed","closed",720856168,null),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"mutable","mutable",875778266),true], null)),new cljs.core.Symbol(null,"add!","add!",2046056845,null)], null);
});
cljs.core.async.impl.channels.ManyToManyChannel.cljs$lang$type = true;
cljs.core.async.impl.channels.ManyToManyChannel.cljs$lang$ctorStr = "cljs.core.async.impl.channels/ManyToManyChannel";
cljs.core.async.impl.channels.ManyToManyChannel.cljs$lang$ctorPrWriter = (function (this__25736__auto__,writer__25737__auto__,opt__25738__auto__){
return cljs.core._write.call(null,writer__25737__auto__,"cljs.core.async.impl.channels/ManyToManyChannel");
});
cljs.core.async.impl.channels.__GT_ManyToManyChannel = (function cljs$core$async$impl$channels$__GT_ManyToManyChannel(takes,dirty_takes,puts,dirty_puts,buf,closed,add_BANG_){
return (new cljs.core.async.impl.channels.ManyToManyChannel(takes,dirty_takes,puts,dirty_puts,buf,closed,add_BANG_));
});
cljs.core.async.impl.channels.ex_handler = (function cljs$core$async$impl$channels$ex_handler(ex){
console.log(ex);
return null;
});
cljs.core.async.impl.channels.handle = (function cljs$core$async$impl$channels$handle(buf,exh,t){
var else$ = (function (){var or__25130__auto__ = exh;
if(cljs.core.truth_(or__25130__auto__)){
return or__25130__auto__;
} else {
return cljs.core.async.impl.channels.ex_handler;
}
})().call(null,t);
if((else$ == null)){
return buf;
} else {
return cljs.core.async.impl.protocols.add_BANG_.call(null,buf,else$);
}
});
cljs.core.async.impl.channels.chan = (function cljs$core$async$impl$channels$chan(var_args){
var args27148 = [];
var len__26205__auto___27153 = arguments.length;
var i__26206__auto___27154 = (0);
while(true){
if((i__26206__auto___27154 < len__26205__auto___27153)){
args27148.push((arguments[i__26206__auto___27154]));
var G__27155 = (i__26206__auto___27154 + (1));
i__26206__auto___27154 = G__27155;
continue;
} else {
}
break;
}
var G__27150 = args27148.length;
switch (G__27150) {
case 1:
return cljs.core.async.impl.channels.chan.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));
break;
case 2:
return cljs.core.async.impl.channels.chan.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));
break;
case 3:
return cljs.core.async.impl.channels.chan.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));
break;
default:
throw (new Error([cljs.core.str("Invalid arity: "),cljs.core.str(args27148.length)].join('')));
}
});
cljs.core.async.impl.channels.chan.cljs$core$IFn$_invoke$arity$1 = (function (buf){
return cljs.core.async.impl.channels.chan.call(null,buf,null);
});
cljs.core.async.impl.channels.chan.cljs$core$IFn$_invoke$arity$2 = (function (buf,xform){
return cljs.core.async.impl.channels.chan.call(null,buf,xform,null);
});
cljs.core.async.impl.channels.chan.cljs$core$IFn$_invoke$arity$3 = (function (buf,xform,exh){
return (new cljs.core.async.impl.channels.ManyToManyChannel(cljs.core.async.impl.buffers.ring_buffer.call(null,(32)),(0),cljs.core.async.impl.buffers.ring_buffer.call(null,(32)),(0),buf,false,(function (){var add_BANG_ = (cljs.core.truth_(xform)?xform.call(null,cljs.core.async.impl.protocols.add_BANG_):cljs.core.async.impl.protocols.add_BANG_);
return ((function (add_BANG_){
return (function() {
var G__27157 = null;
var G__27157__1 = (function (buf__$1){
try{return add_BANG_.call(null,buf__$1);
}catch (e27151){var t = e27151;
return cljs.core.async.impl.channels.handle.call(null,buf__$1,exh,t);
}});
var G__27157__2 = (function (buf__$1,val){
try{return add_BANG_.call(null,buf__$1,val);
}catch (e27152){var t = e27152;
return cljs.core.async.impl.channels.handle.call(null,buf__$1,exh,t);
}});
G__27157 = function(buf__$1,val){
switch(arguments.length){
case 1:
return G__27157__1.call(this,buf__$1);
case 2:
return G__27157__2.call(this,buf__$1,val);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
G__27157.cljs$core$IFn$_invoke$arity$1 = G__27157__1;
G__27157.cljs$core$IFn$_invoke$arity$2 = G__27157__2;
return G__27157;
})()
;})(add_BANG_))
})()));
});
cljs.core.async.impl.channels.chan.cljs$lang$maxFixedArity = 3;
//# sourceMappingURL=channels.js.map?rel=1603199189779

File diff suppressed because one or more lines are too long

View file

@ -1,37 +0,0 @@
(ns cljs.core.async.impl.dispatch
(:require [cljs.core.async.impl.buffers :as buffers]
[goog.async.nextTick]))
(def tasks (buffers/ring-buffer 32))
(def running? false)
(def queued? false)
(def TASK_BATCH_SIZE 1024)
(declare queue-dispatcher)
(defn process-messages []
(set! running? true)
(set! queued? false)
(loop [count 0]
(let [m (.pop tasks)]
(when-not (nil? m)
(m)
(when (< count TASK_BATCH_SIZE)
(recur (inc count))))))
(set! running? false)
(when (> (.-length tasks) 0)
(queue-dispatcher)))
(defn queue-dispatcher []
(when-not (and queued? running?)
(set! queued? true)
(goog.async.nextTick process-messages)))
(defn run [f]
(.unbounded-unshift tasks f)
(queue-dispatcher))
(defn queue-delay [f delay]
(js/setTimeout f delay))

View file

@ -1 +0,0 @@
{:rename-macros {}, :renames {}, :use-macros {}, :excludes #{}, :name cljs.core.async.impl.dispatch, :imports nil, :requires {buffers cljs.core.async.impl.buffers, cljs.core.async.impl.buffers cljs.core.async.impl.buffers, goog.async.nextTick goog.async.nextTick}, :uses nil, :defs {tasks {:name cljs.core.async.impl.dispatch/tasks, :file "docs/js/compiled/out/cljs/core/async/impl/dispatch.cljs", :line 5, :column 1, :end-line 5, :end-column 11, :meta {:file "/Users/simon/workspace/swinging-needle-meter/docs/js/compiled/out/cljs/core/async/impl/dispatch.cljs", :line 5, :column 6, :end-line 5, :end-column 11}}, running? {:name cljs.core.async.impl.dispatch/running?, :file "docs/js/compiled/out/cljs/core/async/impl/dispatch.cljs", :line 6, :column 1, :end-line 6, :end-column 14, :meta {:file "/Users/simon/workspace/swinging-needle-meter/docs/js/compiled/out/cljs/core/async/impl/dispatch.cljs", :line 6, :column 6, :end-line 6, :end-column 14}}, queued? {:name cljs.core.async.impl.dispatch/queued?, :file "docs/js/compiled/out/cljs/core/async/impl/dispatch.cljs", :line 7, :column 1, :end-line 7, :end-column 13, :meta {:file "/Users/simon/workspace/swinging-needle-meter/docs/js/compiled/out/cljs/core/async/impl/dispatch.cljs", :line 7, :column 6, :end-line 7, :end-column 13}}, TASK_BATCH_SIZE {:name cljs.core.async.impl.dispatch/TASK_BATCH_SIZE, :file "docs/js/compiled/out/cljs/core/async/impl/dispatch.cljs", :line 9, :column 1, :end-line 9, :end-column 21, :meta {:file "/Users/simon/workspace/swinging-needle-meter/docs/js/compiled/out/cljs/core/async/impl/dispatch.cljs", :line 9, :column 6, :end-line 9, :end-column 21}}, queue-dispatcher {:protocol-inline nil, :meta {:file "/Users/simon/workspace/swinging-needle-meter/docs/js/compiled/out/cljs/core/async/impl/dispatch.cljs", :line 26, :column 7, :end-line 26, :end-column 23, :arglists (quote ([]))}, :name cljs.core.async.impl.dispatch/queue-dispatcher, :variadic false, :file "docs/js/compiled/out/cljs/core/async/impl/dispatch.cljs", :end-column 23, :method-params ([]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 26, :end-line 26, :max-fixed-arity 0, :fn-var true, :arglists (quote ([]))}, process-messages {:protocol-inline nil, :meta {:file "/Users/simon/workspace/swinging-needle-meter/docs/js/compiled/out/cljs/core/async/impl/dispatch.cljs", :line 13, :column 7, :end-line 13, :end-column 23, :arglists (quote ([]))}, :name cljs.core.async.impl.dispatch/process-messages, :variadic false, :file "docs/js/compiled/out/cljs/core/async/impl/dispatch.cljs", :end-column 23, :method-params ([]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 13, :end-line 13, :max-fixed-arity 0, :fn-var true, :arglists (quote ([]))}, run {:protocol-inline nil, :meta {:file "/Users/simon/workspace/swinging-needle-meter/docs/js/compiled/out/cljs/core/async/impl/dispatch.cljs", :line 31, :column 7, :end-line 31, :end-column 10, :arglists (quote ([f]))}, :name cljs.core.async.impl.dispatch/run, :variadic false, :file "docs/js/compiled/out/cljs/core/async/impl/dispatch.cljs", :end-column 10, :method-params ([f]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 31, :end-line 31, :max-fixed-arity 1, :fn-var true, :arglists (quote ([f]))}, queue-delay {:protocol-inline nil, :meta {:file "/Users/simon/workspace/swinging-needle-meter/docs/js/compiled/out/cljs/core/async/impl/dispatch.cljs", :line 35, :column 7, :end-line 35, :end-column 18, :arglists (quote ([f delay]))}, :name cljs.core.async.impl.dispatch/queue-delay, :variadic false, :file "docs/js/compiled/out/cljs/core/async/impl/dispatch.cljs", :end-column 18, :method-params ([f delay]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 35, :end-line 35, :max-fixed-arity 2, :fn-var true, :arglists (quote ([f delay]))}}, :require-macros nil, :doc nil}

View file

@ -1,64 +0,0 @@
// Compiled by ClojureScript 1.9.229 {}
goog.provide('cljs.core.async.impl.dispatch');
goog.require('cljs.core');
goog.require('cljs.core.async.impl.buffers');
goog.require('goog.async.nextTick');
cljs.core.async.impl.dispatch.tasks = cljs.core.async.impl.buffers.ring_buffer.call(null,(32));
cljs.core.async.impl.dispatch.running_QMARK_ = false;
cljs.core.async.impl.dispatch.queued_QMARK_ = false;
cljs.core.async.impl.dispatch.TASK_BATCH_SIZE = (1024);
cljs.core.async.impl.dispatch.process_messages = (function cljs$core$async$impl$dispatch$process_messages(){
cljs.core.async.impl.dispatch.running_QMARK_ = true;
cljs.core.async.impl.dispatch.queued_QMARK_ = false;
var count_27123 = (0);
while(true){
var m_27124 = cljs.core.async.impl.dispatch.tasks.pop();
if((m_27124 == null)){
} else {
m_27124.call(null);
if((count_27123 < cljs.core.async.impl.dispatch.TASK_BATCH_SIZE)){
var G__27125 = (count_27123 + (1));
count_27123 = G__27125;
continue;
} else {
}
}
break;
}
cljs.core.async.impl.dispatch.running_QMARK_ = false;
if((cljs.core.async.impl.dispatch.tasks.length > (0))){
return cljs.core.async.impl.dispatch.queue_dispatcher.call(null);
} else {
return null;
}
});
cljs.core.async.impl.dispatch.queue_dispatcher = (function cljs$core$async$impl$dispatch$queue_dispatcher(){
if(cljs.core.truth_((function (){var and__25118__auto__ = cljs.core.async.impl.dispatch.queued_QMARK_;
if(cljs.core.truth_(and__25118__auto__)){
return cljs.core.async.impl.dispatch.running_QMARK_;
} else {
return and__25118__auto__;
}
})())){
return null;
} else {
cljs.core.async.impl.dispatch.queued_QMARK_ = true;
return goog.async.nextTick(cljs.core.async.impl.dispatch.process_messages);
}
});
cljs.core.async.impl.dispatch.run = (function cljs$core$async$impl$dispatch$run(f){
cljs.core.async.impl.dispatch.tasks.unbounded_unshift(f);
return cljs.core.async.impl.dispatch.queue_dispatcher.call(null);
});
cljs.core.async.impl.dispatch.queue_delay = (function cljs$core$async$impl$dispatch$queue_delay(f,delay){
return setTimeout(f,delay);
});
//# sourceMappingURL=dispatch.js.map?rel=1603199189660

View file

@ -1 +0,0 @@
{"version":3,"file":"\/Users\/simon\/workspace\/swinging-needle-meter\/docs\/js\/compiled\/out\/cljs\/core\/async\/impl\/dispatch.js","sources":["dispatch.cljs?rel=1603199189661"],"lineCount":64,"mappings":";AAAA;;;;AAIA,AAAKA,sCAAM,mDAAA,nDAACC;AACZ,+CAAA,\/CAAKC;AACL,8CAAA,9CAAKC;AAEL,gDAAA,hDAAKC;AAEL,AAAA,AAEA,iDAAA,jDAAMC;AAAN,AACE,+CAAA,\/CAAMH;;AACN,8CAAA,9CAAMC;;AACN,kBAAA,dAAOG;;AAAP,AACE,IAAMC,UAAE,AAAMP;AAAd,AACE,GAAU,YAAA,XAAMO;AAAhB;AAAA,AACE,AAACA;;AACD,GAAM,CAAGD,cAAMF;AAAf,AACE,eAAO,eAAA,dAAKE;;;;AADd;;;;;AAEN,+CAAA,\/CAAMJ;;AACN,GAAM,8CAAA,7CAAG,AAAUF;AAAnB,AACE,OAACQ;;AADH;;;AAGF,iDAAA,jDAAMA;AAAN,AACE,oBAAU,iBAAAC,qBAAKN;AAAL,AAAA,oBAAAM;AAAaP;;AAAbO;;;AAAV;;AAAA,AACE,8CAAA,9CAAMN;;AACN,OAACO,oBAAoBL;;;AAEzB,oCAAA,pCAAMM,gFAAKC;AAAX,AACE,AAAoBZ,sDAAMY;;AAC1B,OAACJ;;AAEH,4CAAA,5CAAMK,gGAAaD,EAAEE;AAArB,AACE,OAACC,WAAcH,EAAEE","names":["cljs.core.async.impl.dispatch\/tasks","cljs.core.async.impl.buffers\/ring-buffer","cljs.core.async.impl.dispatch\/running?","cljs.core.async.impl.dispatch\/queued?","cljs.core.async.impl.dispatch\/TASK_BATCH_SIZE","cljs.core.async.impl.dispatch\/process-messages","count","m","cljs.core.async.impl.dispatch\/queue-dispatcher","and__25118__auto__","goog\/async.nextTick","cljs.core.async.impl.dispatch\/run","f","cljs.core.async.impl.dispatch\/queue-delay","delay","js\/setTimeout"]}

View file

@ -1,146 +0,0 @@
(ns cljs.core.async.impl.ioc-helpers
(:require [cljs.core.async.impl.protocols :as impl])
(:require-macros [cljs.core.async.impl.ioc-macros :as ioc]))
(def ^:const FN-IDX 0)
(def ^:const STATE-IDX 1)
(def ^:const VALUE-IDX 2)
(def ^:const BINDINGS-IDX 3)
(def ^:const EXCEPTION-FRAMES 4)
(def ^:const CURRENT-EXCEPTION 5)
(def ^:const USER-START-IDX 6)
(defn aset-object [arr idx o]
(aget arr idx o))
(defn aget-object [arr idx]
(aget arr idx))
(defn finished?
"Returns true if the machine is in a finished state"
[state-array]
(keyword-identical? (aget state-array STATE-IDX) :finished))
(defn- fn-handler
[f]
(reify
impl/Handler
(active? [_] true)
(blockable? [_] true)
(commit [_] f)))
(defn run-state-machine [state]
((aget-object state FN-IDX) state))
(defn run-state-machine-wrapped [state]
(try
(run-state-machine state)
(catch js/Object ex
(impl/close! ^not-native (aget-object state USER-START-IDX))
(throw ex))))
(defn take! [state blk ^not-native c]
(if-let [cb (impl/take! c (fn-handler
(fn [x]
(ioc/aset-all! state VALUE-IDX x STATE-IDX blk)
(run-state-machine-wrapped state))))]
(do (ioc/aset-all! state VALUE-IDX @cb STATE-IDX blk)
:recur)
nil))
(defn put! [state blk ^not-native c val]
(if-let [cb (impl/put! c val (fn-handler (fn [ret-val]
(ioc/aset-all! state VALUE-IDX ret-val STATE-IDX blk)
(run-state-machine-wrapped state))))]
(do (ioc/aset-all! state VALUE-IDX @cb STATE-IDX blk)
:recur)
nil))
(defn return-chan [state value]
(let [^not-native c (aget state USER-START-IDX)]
(when-not (nil? value)
(impl/put! c value (fn-handler (fn [] nil))))
(impl/close! c)
c))
(defrecord ExceptionFrame [catch-block
^Class catch-exception
finally-block
continue-block
prev])
(defn add-exception-frame [state catch-block catch-exception finally-block continue-block]
(ioc/aset-all! state
EXCEPTION-FRAMES
(->ExceptionFrame catch-block
catch-exception
finally-block
continue-block
(aget-object state EXCEPTION-FRAMES))))
(defn process-exception [state]
(let [exception-frame (aget-object state EXCEPTION-FRAMES)
catch-block (:catch-block exception-frame)
catch-exception (:catch-exception exception-frame)
exception (aget-object state CURRENT-EXCEPTION)]
(cond
(and exception
(not exception-frame))
(throw exception)
(and exception
catch-block
(or (= :default catch-exception)
(instance? catch-exception exception)))
(ioc/aset-all! state
STATE-IDX
catch-block
VALUE-IDX
exception
CURRENT-EXCEPTION
nil
EXCEPTION-FRAMES
(assoc exception-frame
:catch-block nil
:catch-exception nil))
(and exception
(not catch-block)
(not (:finally-block exception-frame)))
(do (ioc/aset-all! state
EXCEPTION-FRAMES
(:prev exception-frame))
(recur state))
(and exception
(not catch-block)
(:finally-block exception-frame))
(ioc/aset-all! state
STATE-IDX
(:finally-block exception-frame)
EXCEPTION-FRAMES
(assoc exception-frame
:finally-block nil))
(and (not exception)
(:finally-block exception-frame))
(do (ioc/aset-all! state
STATE-IDX
(:finally-block exception-frame)
EXCEPTION-FRAMES
(assoc exception-frame
:finally-block nil)))
(and (not exception)
(not (:finally-block exception-frame)))
(do (ioc/aset-all! state
STATE-IDX
(:continue-block exception-frame)
EXCEPTION-FRAMES
(:prev exception-frame)))
:else (throw (js/Error. "No matching clause")))))

File diff suppressed because one or more lines are too long

View file

@ -1,502 +0,0 @@
// Compiled by ClojureScript 1.9.229 {}
goog.provide('cljs.core.async.impl.ioc_helpers');
goog.require('cljs.core');
goog.require('cljs.core.async.impl.protocols');
cljs.core.async.impl.ioc_helpers.FN_IDX = (0);
cljs.core.async.impl.ioc_helpers.STATE_IDX = (1);
cljs.core.async.impl.ioc_helpers.VALUE_IDX = (2);
cljs.core.async.impl.ioc_helpers.BINDINGS_IDX = (3);
cljs.core.async.impl.ioc_helpers.EXCEPTION_FRAMES = (4);
cljs.core.async.impl.ioc_helpers.CURRENT_EXCEPTION = (5);
cljs.core.async.impl.ioc_helpers.USER_START_IDX = (6);
cljs.core.async.impl.ioc_helpers.aset_object = (function cljs$core$async$impl$ioc_helpers$aset_object(arr,idx,o){
return (arr[idx][o]);
});
cljs.core.async.impl.ioc_helpers.aget_object = (function cljs$core$async$impl$ioc_helpers$aget_object(arr,idx){
return (arr[idx]);
});
/**
* Returns true if the machine is in a finished state
*/
cljs.core.async.impl.ioc_helpers.finished_QMARK_ = (function cljs$core$async$impl$ioc_helpers$finished_QMARK_(state_array){
return cljs.core.keyword_identical_QMARK_.call(null,(state_array[cljs.core.async.impl.ioc_helpers.STATE_IDX]),new cljs.core.Keyword(null,"finished","finished",-1018867731));
});
cljs.core.async.impl.ioc_helpers.fn_handler = (function cljs$core$async$impl$ioc_helpers$fn_handler(f){
if(typeof cljs.core.async.impl.ioc_helpers.t_cljs$core$async$impl$ioc_helpers28268 !== 'undefined'){
} else {
/**
* @constructor
* @implements {cljs.core.async.impl.protocols.Handler}
* @implements {cljs.core.IMeta}
* @implements {cljs.core.IWithMeta}
*/
cljs.core.async.impl.ioc_helpers.t_cljs$core$async$impl$ioc_helpers28268 = (function (fn_handler,f,meta28269){
this.fn_handler = fn_handler;
this.f = f;
this.meta28269 = meta28269;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
})
cljs.core.async.impl.ioc_helpers.t_cljs$core$async$impl$ioc_helpers28268.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_28270,meta28269__$1){
var self__ = this;
var _28270__$1 = this;
return (new cljs.core.async.impl.ioc_helpers.t_cljs$core$async$impl$ioc_helpers28268(self__.fn_handler,self__.f,meta28269__$1));
});
cljs.core.async.impl.ioc_helpers.t_cljs$core$async$impl$ioc_helpers28268.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_28270){
var self__ = this;
var _28270__$1 = this;
return self__.meta28269;
});
cljs.core.async.impl.ioc_helpers.t_cljs$core$async$impl$ioc_helpers28268.prototype.cljs$core$async$impl$protocols$Handler$ = true;
cljs.core.async.impl.ioc_helpers.t_cljs$core$async$impl$ioc_helpers28268.prototype.cljs$core$async$impl$protocols$Handler$active_QMARK_$arity$1 = (function (_){
var self__ = this;
var ___$1 = this;
return true;
});
cljs.core.async.impl.ioc_helpers.t_cljs$core$async$impl$ioc_helpers28268.prototype.cljs$core$async$impl$protocols$Handler$blockable_QMARK_$arity$1 = (function (_){
var self__ = this;
var ___$1 = this;
return true;
});
cljs.core.async.impl.ioc_helpers.t_cljs$core$async$impl$ioc_helpers28268.prototype.cljs$core$async$impl$protocols$Handler$commit$arity$1 = (function (_){
var self__ = this;
var ___$1 = this;
return self__.f;
});
cljs.core.async.impl.ioc_helpers.t_cljs$core$async$impl$ioc_helpers28268.getBasis = (function (){
return new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.with_meta(new cljs.core.Symbol(null,"fn-handler","fn-handler",648785851,null),new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"private","private",-558947994),true,new cljs.core.Keyword(null,"arglists","arglists",1661989754),cljs.core.list(new cljs.core.Symbol(null,"quote","quote",1377916282,null),cljs.core.list(new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"f","f",43394975,null)], null)))], null)),new cljs.core.Symbol(null,"f","f",43394975,null),new cljs.core.Symbol(null,"meta28269","meta28269",1151629333,null)], null);
});
cljs.core.async.impl.ioc_helpers.t_cljs$core$async$impl$ioc_helpers28268.cljs$lang$type = true;
cljs.core.async.impl.ioc_helpers.t_cljs$core$async$impl$ioc_helpers28268.cljs$lang$ctorStr = "cljs.core.async.impl.ioc-helpers/t_cljs$core$async$impl$ioc_helpers28268";
cljs.core.async.impl.ioc_helpers.t_cljs$core$async$impl$ioc_helpers28268.cljs$lang$ctorPrWriter = (function (this__25736__auto__,writer__25737__auto__,opt__25738__auto__){
return cljs.core._write.call(null,writer__25737__auto__,"cljs.core.async.impl.ioc-helpers/t_cljs$core$async$impl$ioc_helpers28268");
});
cljs.core.async.impl.ioc_helpers.__GT_t_cljs$core$async$impl$ioc_helpers28268 = (function cljs$core$async$impl$ioc_helpers$fn_handler_$___GT_t_cljs$core$async$impl$ioc_helpers28268(fn_handler__$1,f__$1,meta28269){
return (new cljs.core.async.impl.ioc_helpers.t_cljs$core$async$impl$ioc_helpers28268(fn_handler__$1,f__$1,meta28269));
});
}
return (new cljs.core.async.impl.ioc_helpers.t_cljs$core$async$impl$ioc_helpers28268(cljs$core$async$impl$ioc_helpers$fn_handler,f,cljs.core.PersistentArrayMap.EMPTY));
});
cljs.core.async.impl.ioc_helpers.run_state_machine = (function cljs$core$async$impl$ioc_helpers$run_state_machine(state){
return cljs.core.async.impl.ioc_helpers.aget_object.call(null,state,cljs.core.async.impl.ioc_helpers.FN_IDX).call(null,state);
});
cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped = (function cljs$core$async$impl$ioc_helpers$run_state_machine_wrapped(state){
try{return cljs.core.async.impl.ioc_helpers.run_state_machine.call(null,state);
}catch (e28272){if((e28272 instanceof Object)){
var ex = e28272;
cljs.core.async.impl.protocols.close_BANG_.call(null,cljs.core.async.impl.ioc_helpers.aget_object.call(null,state,cljs.core.async.impl.ioc_helpers.USER_START_IDX));
throw ex;
} else {
throw e28272;
}
}});
cljs.core.async.impl.ioc_helpers.take_BANG_ = (function cljs$core$async$impl$ioc_helpers$take_BANG_(state,blk,c){
var temp__4655__auto__ = cljs.core.async.impl.protocols.take_BANG_.call(null,c,cljs.core.async.impl.ioc_helpers.fn_handler.call(null,(function (x){
var statearr_28275_28277 = state;
(statearr_28275_28277[cljs.core.async.impl.ioc_helpers.VALUE_IDX] = x);
(statearr_28275_28277[cljs.core.async.impl.ioc_helpers.STATE_IDX] = blk);
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state);
})));
if(cljs.core.truth_(temp__4655__auto__)){
var cb = temp__4655__auto__;
var statearr_28276_28278 = state;
(statearr_28276_28278[cljs.core.async.impl.ioc_helpers.VALUE_IDX] = cljs.core.deref.call(null,cb));
(statearr_28276_28278[cljs.core.async.impl.ioc_helpers.STATE_IDX] = blk);
return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
});
cljs.core.async.impl.ioc_helpers.put_BANG_ = (function cljs$core$async$impl$ioc_helpers$put_BANG_(state,blk,c,val){
var temp__4655__auto__ = cljs.core.async.impl.protocols.put_BANG_.call(null,c,val,cljs.core.async.impl.ioc_helpers.fn_handler.call(null,(function (ret_val){
var statearr_28281_28283 = state;
(statearr_28281_28283[cljs.core.async.impl.ioc_helpers.VALUE_IDX] = ret_val);
(statearr_28281_28283[cljs.core.async.impl.ioc_helpers.STATE_IDX] = blk);
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped.call(null,state);
})));
if(cljs.core.truth_(temp__4655__auto__)){
var cb = temp__4655__auto__;
var statearr_28282_28284 = state;
(statearr_28282_28284[cljs.core.async.impl.ioc_helpers.VALUE_IDX] = cljs.core.deref.call(null,cb));
(statearr_28282_28284[cljs.core.async.impl.ioc_helpers.STATE_IDX] = blk);
return new cljs.core.Keyword(null,"recur","recur",-437573268);
} else {
return null;
}
});
cljs.core.async.impl.ioc_helpers.return_chan = (function cljs$core$async$impl$ioc_helpers$return_chan(state,value){
var c = (state[cljs.core.async.impl.ioc_helpers.USER_START_IDX]);
if((value == null)){
} else {
cljs.core.async.impl.protocols.put_BANG_.call(null,c,value,cljs.core.async.impl.ioc_helpers.fn_handler.call(null,((function (c){
return (function (){
return null;
});})(c))
));
}
cljs.core.async.impl.protocols.close_BANG_.call(null,c);
return c;
});
/**
* @constructor
* @implements {cljs.core.IRecord}
* @implements {cljs.core.IEquiv}
* @implements {cljs.core.IHash}
* @implements {cljs.core.ICollection}
* @implements {cljs.core.ICounted}
* @implements {cljs.core.ISeqable}
* @implements {cljs.core.IMeta}
* @implements {cljs.core.ICloneable}
* @implements {cljs.core.IPrintWithWriter}
* @implements {cljs.core.IIterable}
* @implements {cljs.core.IWithMeta}
* @implements {cljs.core.IAssociative}
* @implements {cljs.core.IMap}
* @implements {cljs.core.ILookup}
*/
cljs.core.async.impl.ioc_helpers.ExceptionFrame = (function (catch_block,catch_exception,finally_block,continue_block,prev,__meta,__extmap,__hash){
this.catch_block = catch_block;
this.catch_exception = catch_exception;
this.finally_block = finally_block;
this.continue_block = continue_block;
this.prev = prev;
this.__meta = __meta;
this.__extmap = __extmap;
this.__hash = __hash;
this.cljs$lang$protocol_mask$partition0$ = 2229667594;
this.cljs$lang$protocol_mask$partition1$ = 8192;
})
cljs.core.async.impl.ioc_helpers.ExceptionFrame.prototype.cljs$core$ILookup$_lookup$arity$2 = (function (this__25752__auto__,k__25753__auto__){
var self__ = this;
var this__25752__auto____$1 = this;
return cljs.core._lookup.call(null,this__25752__auto____$1,k__25753__auto__,null);
});
cljs.core.async.impl.ioc_helpers.ExceptionFrame.prototype.cljs$core$ILookup$_lookup$arity$3 = (function (this__25754__auto__,k28286,else__25755__auto__){
var self__ = this;
var this__25754__auto____$1 = this;
var G__28288 = (((k28286 instanceof cljs.core.Keyword))?k28286.fqn:null);
switch (G__28288) {
case "catch-block":
return self__.catch_block;
break;
case "catch-exception":
return self__.catch_exception;
break;
case "finally-block":
return self__.finally_block;
break;
case "continue-block":
return self__.continue_block;
break;
case "prev":
return self__.prev;
break;
default:
return cljs.core.get.call(null,self__.__extmap,k28286,else__25755__auto__);
}
});
cljs.core.async.impl.ioc_helpers.ExceptionFrame.prototype.cljs$core$IPrintWithWriter$_pr_writer$arity$3 = (function (this__25766__auto__,writer__25767__auto__,opts__25768__auto__){
var self__ = this;
var this__25766__auto____$1 = this;
var pr_pair__25769__auto__ = ((function (this__25766__auto____$1){
return (function (keyval__25770__auto__){
return cljs.core.pr_sequential_writer.call(null,writer__25767__auto__,cljs.core.pr_writer,""," ","",opts__25768__auto__,keyval__25770__auto__);
});})(this__25766__auto____$1))
;
return cljs.core.pr_sequential_writer.call(null,writer__25767__auto__,pr_pair__25769__auto__,"#cljs.core.async.impl.ioc-helpers.ExceptionFrame{",", ","}",opts__25768__auto__,cljs.core.concat.call(null,new cljs.core.PersistentVector(null, 5, 5, cljs.core.PersistentVector.EMPTY_NODE, [(new cljs.core.PersistentVector(null,2,(5),cljs.core.PersistentVector.EMPTY_NODE,[new cljs.core.Keyword(null,"catch-block","catch-block",1175212748),self__.catch_block],null)),(new cljs.core.PersistentVector(null,2,(5),cljs.core.PersistentVector.EMPTY_NODE,[new cljs.core.Keyword(null,"catch-exception","catch-exception",-1997306795),self__.catch_exception],null)),(new cljs.core.PersistentVector(null,2,(5),cljs.core.PersistentVector.EMPTY_NODE,[new cljs.core.Keyword(null,"finally-block","finally-block",832982472),self__.finally_block],null)),(new cljs.core.PersistentVector(null,2,(5),cljs.core.PersistentVector.EMPTY_NODE,[new cljs.core.Keyword(null,"continue-block","continue-block",-1852047850),self__.continue_block],null)),(new cljs.core.PersistentVector(null,2,(5),cljs.core.PersistentVector.EMPTY_NODE,[new cljs.core.Keyword(null,"prev","prev",-1597069226),self__.prev],null))], null),self__.__extmap));
});
cljs.core.async.impl.ioc_helpers.ExceptionFrame.prototype.cljs$core$IIterable$ = true;
cljs.core.async.impl.ioc_helpers.ExceptionFrame.prototype.cljs$core$IIterable$_iterator$arity$1 = (function (G__28285){
var self__ = this;
var G__28285__$1 = this;
return (new cljs.core.RecordIter((0),G__28285__$1,5,new cljs.core.PersistentVector(null, 5, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"catch-block","catch-block",1175212748),new cljs.core.Keyword(null,"catch-exception","catch-exception",-1997306795),new cljs.core.Keyword(null,"finally-block","finally-block",832982472),new cljs.core.Keyword(null,"continue-block","continue-block",-1852047850),new cljs.core.Keyword(null,"prev","prev",-1597069226)], null),cljs.core._iterator.call(null,self__.__extmap)));
});
cljs.core.async.impl.ioc_helpers.ExceptionFrame.prototype.cljs$core$IMeta$_meta$arity$1 = (function (this__25750__auto__){
var self__ = this;
var this__25750__auto____$1 = this;
return self__.__meta;
});
cljs.core.async.impl.ioc_helpers.ExceptionFrame.prototype.cljs$core$ICloneable$_clone$arity$1 = (function (this__25746__auto__){
var self__ = this;
var this__25746__auto____$1 = this;
return (new cljs.core.async.impl.ioc_helpers.ExceptionFrame(self__.catch_block,self__.catch_exception,self__.finally_block,self__.continue_block,self__.prev,self__.__meta,self__.__extmap,self__.__hash));
});
cljs.core.async.impl.ioc_helpers.ExceptionFrame.prototype.cljs$core$ICounted$_count$arity$1 = (function (this__25756__auto__){
var self__ = this;
var this__25756__auto____$1 = this;
return (5 + cljs.core.count.call(null,self__.__extmap));
});
cljs.core.async.impl.ioc_helpers.ExceptionFrame.prototype.cljs$core$IHash$_hash$arity$1 = (function (this__25747__auto__){
var self__ = this;
var this__25747__auto____$1 = this;
var h__25565__auto__ = self__.__hash;
if(!((h__25565__auto__ == null))){
return h__25565__auto__;
} else {
var h__25565__auto____$1 = cljs.core.hash_imap.call(null,this__25747__auto____$1);
self__.__hash = h__25565__auto____$1;
return h__25565__auto____$1;
}
});
cljs.core.async.impl.ioc_helpers.ExceptionFrame.prototype.cljs$core$IEquiv$_equiv$arity$2 = (function (this__25748__auto__,other__25749__auto__){
var self__ = this;
var this__25748__auto____$1 = this;
if(cljs.core.truth_((function (){var and__25118__auto__ = other__25749__auto__;
if(cljs.core.truth_(and__25118__auto__)){
var and__25118__auto____$1 = (this__25748__auto____$1.constructor === other__25749__auto__.constructor);
if(and__25118__auto____$1){
return cljs.core.equiv_map.call(null,this__25748__auto____$1,other__25749__auto__);
} else {
return and__25118__auto____$1;
}
} else {
return and__25118__auto__;
}
})())){
return true;
} else {
return false;
}
});
cljs.core.async.impl.ioc_helpers.ExceptionFrame.prototype.cljs$core$IMap$_dissoc$arity$2 = (function (this__25761__auto__,k__25762__auto__){
var self__ = this;
var this__25761__auto____$1 = this;
if(cljs.core.contains_QMARK_.call(null,new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 5, [new cljs.core.Keyword(null,"finally-block","finally-block",832982472),null,new cljs.core.Keyword(null,"catch-block","catch-block",1175212748),null,new cljs.core.Keyword(null,"catch-exception","catch-exception",-1997306795),null,new cljs.core.Keyword(null,"prev","prev",-1597069226),null,new cljs.core.Keyword(null,"continue-block","continue-block",-1852047850),null], null), null),k__25762__auto__)){
return cljs.core.dissoc.call(null,cljs.core.with_meta.call(null,cljs.core.into.call(null,cljs.core.PersistentArrayMap.EMPTY,this__25761__auto____$1),self__.__meta),k__25762__auto__);
} else {
return (new cljs.core.async.impl.ioc_helpers.ExceptionFrame(self__.catch_block,self__.catch_exception,self__.finally_block,self__.continue_block,self__.prev,self__.__meta,cljs.core.not_empty.call(null,cljs.core.dissoc.call(null,self__.__extmap,k__25762__auto__)),null));
}
});
cljs.core.async.impl.ioc_helpers.ExceptionFrame.prototype.cljs$core$IAssociative$_assoc$arity$3 = (function (this__25759__auto__,k__25760__auto__,G__28285){
var self__ = this;
var this__25759__auto____$1 = this;
var pred__28289 = cljs.core.keyword_identical_QMARK_;
var expr__28290 = k__25760__auto__;
if(cljs.core.truth_(pred__28289.call(null,new cljs.core.Keyword(null,"catch-block","catch-block",1175212748),expr__28290))){
return (new cljs.core.async.impl.ioc_helpers.ExceptionFrame(G__28285,self__.catch_exception,self__.finally_block,self__.continue_block,self__.prev,self__.__meta,self__.__extmap,null));
} else {
if(cljs.core.truth_(pred__28289.call(null,new cljs.core.Keyword(null,"catch-exception","catch-exception",-1997306795),expr__28290))){
return (new cljs.core.async.impl.ioc_helpers.ExceptionFrame(self__.catch_block,G__28285,self__.finally_block,self__.continue_block,self__.prev,self__.__meta,self__.__extmap,null));
} else {
if(cljs.core.truth_(pred__28289.call(null,new cljs.core.Keyword(null,"finally-block","finally-block",832982472),expr__28290))){
return (new cljs.core.async.impl.ioc_helpers.ExceptionFrame(self__.catch_block,self__.catch_exception,G__28285,self__.continue_block,self__.prev,self__.__meta,self__.__extmap,null));
} else {
if(cljs.core.truth_(pred__28289.call(null,new cljs.core.Keyword(null,"continue-block","continue-block",-1852047850),expr__28290))){
return (new cljs.core.async.impl.ioc_helpers.ExceptionFrame(self__.catch_block,self__.catch_exception,self__.finally_block,G__28285,self__.prev,self__.__meta,self__.__extmap,null));
} else {
if(cljs.core.truth_(pred__28289.call(null,new cljs.core.Keyword(null,"prev","prev",-1597069226),expr__28290))){
return (new cljs.core.async.impl.ioc_helpers.ExceptionFrame(self__.catch_block,self__.catch_exception,self__.finally_block,self__.continue_block,G__28285,self__.__meta,self__.__extmap,null));
} else {
return (new cljs.core.async.impl.ioc_helpers.ExceptionFrame(self__.catch_block,self__.catch_exception,self__.finally_block,self__.continue_block,self__.prev,self__.__meta,cljs.core.assoc.call(null,self__.__extmap,k__25760__auto__,G__28285),null));
}
}
}
}
}
});
cljs.core.async.impl.ioc_helpers.ExceptionFrame.prototype.cljs$core$ISeqable$_seq$arity$1 = (function (this__25764__auto__){
var self__ = this;
var this__25764__auto____$1 = this;
return cljs.core.seq.call(null,cljs.core.concat.call(null,new cljs.core.PersistentVector(null, 5, 5, cljs.core.PersistentVector.EMPTY_NODE, [(new cljs.core.PersistentVector(null,2,(5),cljs.core.PersistentVector.EMPTY_NODE,[new cljs.core.Keyword(null,"catch-block","catch-block",1175212748),self__.catch_block],null)),(new cljs.core.PersistentVector(null,2,(5),cljs.core.PersistentVector.EMPTY_NODE,[new cljs.core.Keyword(null,"catch-exception","catch-exception",-1997306795),self__.catch_exception],null)),(new cljs.core.PersistentVector(null,2,(5),cljs.core.PersistentVector.EMPTY_NODE,[new cljs.core.Keyword(null,"finally-block","finally-block",832982472),self__.finally_block],null)),(new cljs.core.PersistentVector(null,2,(5),cljs.core.PersistentVector.EMPTY_NODE,[new cljs.core.Keyword(null,"continue-block","continue-block",-1852047850),self__.continue_block],null)),(new cljs.core.PersistentVector(null,2,(5),cljs.core.PersistentVector.EMPTY_NODE,[new cljs.core.Keyword(null,"prev","prev",-1597069226),self__.prev],null))], null),self__.__extmap));
});
cljs.core.async.impl.ioc_helpers.ExceptionFrame.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (this__25751__auto__,G__28285){
var self__ = this;
var this__25751__auto____$1 = this;
return (new cljs.core.async.impl.ioc_helpers.ExceptionFrame(self__.catch_block,self__.catch_exception,self__.finally_block,self__.continue_block,self__.prev,G__28285,self__.__extmap,self__.__hash));
});
cljs.core.async.impl.ioc_helpers.ExceptionFrame.prototype.cljs$core$ICollection$_conj$arity$2 = (function (this__25757__auto__,entry__25758__auto__){
var self__ = this;
var this__25757__auto____$1 = this;
if(cljs.core.vector_QMARK_.call(null,entry__25758__auto__)){
return cljs.core._assoc.call(null,this__25757__auto____$1,cljs.core._nth.call(null,entry__25758__auto__,(0)),cljs.core._nth.call(null,entry__25758__auto__,(1)));
} else {
return cljs.core.reduce.call(null,cljs.core._conj,this__25757__auto____$1,entry__25758__auto__);
}
});
cljs.core.async.impl.ioc_helpers.ExceptionFrame.getBasis = (function (){
return new cljs.core.PersistentVector(null, 5, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"catch-block","catch-block",-1479223021,null),cljs.core.with_meta(new cljs.core.Symbol(null,"catch-exception","catch-exception",-356775268,null),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"tag","tag",-1290361223),new cljs.core.Symbol(null,"Class","Class",2064526977,null)], null)),new cljs.core.Symbol(null,"finally-block","finally-block",-1821453297,null),new cljs.core.Symbol(null,"continue-block","continue-block",-211516323,null),new cljs.core.Symbol(null,"prev","prev",43462301,null)], null);
});
cljs.core.async.impl.ioc_helpers.ExceptionFrame.cljs$lang$type = true;
cljs.core.async.impl.ioc_helpers.ExceptionFrame.cljs$lang$ctorPrSeq = (function (this__25786__auto__){
return cljs.core._conj.call(null,cljs.core.List.EMPTY,"cljs.core.async.impl.ioc-helpers/ExceptionFrame");
});
cljs.core.async.impl.ioc_helpers.ExceptionFrame.cljs$lang$ctorPrWriter = (function (this__25786__auto__,writer__25787__auto__){
return cljs.core._write.call(null,writer__25787__auto__,"cljs.core.async.impl.ioc-helpers/ExceptionFrame");
});
cljs.core.async.impl.ioc_helpers.__GT_ExceptionFrame = (function cljs$core$async$impl$ioc_helpers$__GT_ExceptionFrame(catch_block,catch_exception,finally_block,continue_block,prev){
return (new cljs.core.async.impl.ioc_helpers.ExceptionFrame(catch_block,catch_exception,finally_block,continue_block,prev,null,null,null));
});
cljs.core.async.impl.ioc_helpers.map__GT_ExceptionFrame = (function cljs$core$async$impl$ioc_helpers$map__GT_ExceptionFrame(G__28287){
return (new cljs.core.async.impl.ioc_helpers.ExceptionFrame(new cljs.core.Keyword(null,"catch-block","catch-block",1175212748).cljs$core$IFn$_invoke$arity$1(G__28287),new cljs.core.Keyword(null,"catch-exception","catch-exception",-1997306795).cljs$core$IFn$_invoke$arity$1(G__28287),new cljs.core.Keyword(null,"finally-block","finally-block",832982472).cljs$core$IFn$_invoke$arity$1(G__28287),new cljs.core.Keyword(null,"continue-block","continue-block",-1852047850).cljs$core$IFn$_invoke$arity$1(G__28287),new cljs.core.Keyword(null,"prev","prev",-1597069226).cljs$core$IFn$_invoke$arity$1(G__28287),null,cljs.core.dissoc.call(null,G__28287,new cljs.core.Keyword(null,"catch-block","catch-block",1175212748),new cljs.core.Keyword(null,"catch-exception","catch-exception",-1997306795),new cljs.core.Keyword(null,"finally-block","finally-block",832982472),new cljs.core.Keyword(null,"continue-block","continue-block",-1852047850),new cljs.core.Keyword(null,"prev","prev",-1597069226)),null));
});
cljs.core.async.impl.ioc_helpers.add_exception_frame = (function cljs$core$async$impl$ioc_helpers$add_exception_frame(state,catch_block,catch_exception,finally_block,continue_block){
var statearr_28294 = state;
(statearr_28294[cljs.core.async.impl.ioc_helpers.EXCEPTION_FRAMES] = cljs.core.async.impl.ioc_helpers.__GT_ExceptionFrame.call(null,catch_block,catch_exception,finally_block,continue_block,cljs.core.async.impl.ioc_helpers.aget_object.call(null,state,cljs.core.async.impl.ioc_helpers.EXCEPTION_FRAMES)));
return statearr_28294;
});
cljs.core.async.impl.ioc_helpers.process_exception = (function cljs$core$async$impl$ioc_helpers$process_exception(state){
while(true){
var exception_frame = cljs.core.async.impl.ioc_helpers.aget_object.call(null,state,cljs.core.async.impl.ioc_helpers.EXCEPTION_FRAMES);
var catch_block = new cljs.core.Keyword(null,"catch-block","catch-block",1175212748).cljs$core$IFn$_invoke$arity$1(exception_frame);
var catch_exception = new cljs.core.Keyword(null,"catch-exception","catch-exception",-1997306795).cljs$core$IFn$_invoke$arity$1(exception_frame);
var exception = cljs.core.async.impl.ioc_helpers.aget_object.call(null,state,cljs.core.async.impl.ioc_helpers.CURRENT_EXCEPTION);
if(cljs.core.truth_((function (){var and__25118__auto__ = exception;
if(cljs.core.truth_(and__25118__auto__)){
return cljs.core.not.call(null,exception_frame);
} else {
return and__25118__auto__;
}
})())){
throw exception;
} else {
if(cljs.core.truth_((function (){var and__25118__auto__ = exception;
if(cljs.core.truth_(and__25118__auto__)){
var and__25118__auto____$1 = catch_block;
if(cljs.core.truth_(and__25118__auto____$1)){
return (cljs.core._EQ_.call(null,new cljs.core.Keyword(null,"default","default",-1987822328),catch_exception)) || ((exception instanceof catch_exception));
} else {
return and__25118__auto____$1;
}
} else {
return and__25118__auto__;
}
})())){
var statearr_28300 = state;
(statearr_28300[cljs.core.async.impl.ioc_helpers.STATE_IDX] = catch_block);
(statearr_28300[cljs.core.async.impl.ioc_helpers.VALUE_IDX] = exception);
(statearr_28300[cljs.core.async.impl.ioc_helpers.CURRENT_EXCEPTION] = null);
(statearr_28300[cljs.core.async.impl.ioc_helpers.EXCEPTION_FRAMES] = cljs.core.assoc.call(null,exception_frame,new cljs.core.Keyword(null,"catch-block","catch-block",1175212748),null,new cljs.core.Keyword(null,"catch-exception","catch-exception",-1997306795),null));
return statearr_28300;
} else {
if(cljs.core.truth_((function (){var and__25118__auto__ = exception;
if(cljs.core.truth_(and__25118__auto__)){
return (cljs.core.not.call(null,catch_block)) && (cljs.core.not.call(null,new cljs.core.Keyword(null,"finally-block","finally-block",832982472).cljs$core$IFn$_invoke$arity$1(exception_frame)));
} else {
return and__25118__auto__;
}
})())){
var statearr_28301_28305 = state;
(statearr_28301_28305[cljs.core.async.impl.ioc_helpers.EXCEPTION_FRAMES] = new cljs.core.Keyword(null,"prev","prev",-1597069226).cljs$core$IFn$_invoke$arity$1(exception_frame));
var G__28306 = state;
state = G__28306;
continue;
} else {
if(cljs.core.truth_((function (){var and__25118__auto__ = exception;
if(cljs.core.truth_(and__25118__auto__)){
var and__25118__auto____$1 = cljs.core.not.call(null,catch_block);
if(and__25118__auto____$1){
return new cljs.core.Keyword(null,"finally-block","finally-block",832982472).cljs$core$IFn$_invoke$arity$1(exception_frame);
} else {
return and__25118__auto____$1;
}
} else {
return and__25118__auto__;
}
})())){
var statearr_28302 = state;
(statearr_28302[cljs.core.async.impl.ioc_helpers.STATE_IDX] = new cljs.core.Keyword(null,"finally-block","finally-block",832982472).cljs$core$IFn$_invoke$arity$1(exception_frame));
(statearr_28302[cljs.core.async.impl.ioc_helpers.EXCEPTION_FRAMES] = cljs.core.assoc.call(null,exception_frame,new cljs.core.Keyword(null,"finally-block","finally-block",832982472),null));
return statearr_28302;
} else {
if(cljs.core.truth_((function (){var and__25118__auto__ = cljs.core.not.call(null,exception);
if(and__25118__auto__){
return new cljs.core.Keyword(null,"finally-block","finally-block",832982472).cljs$core$IFn$_invoke$arity$1(exception_frame);
} else {
return and__25118__auto__;
}
})())){
var statearr_28303 = state;
(statearr_28303[cljs.core.async.impl.ioc_helpers.STATE_IDX] = new cljs.core.Keyword(null,"finally-block","finally-block",832982472).cljs$core$IFn$_invoke$arity$1(exception_frame));
(statearr_28303[cljs.core.async.impl.ioc_helpers.EXCEPTION_FRAMES] = cljs.core.assoc.call(null,exception_frame,new cljs.core.Keyword(null,"finally-block","finally-block",832982472),null));
return statearr_28303;
} else {
if((cljs.core.not.call(null,exception)) && (cljs.core.not.call(null,new cljs.core.Keyword(null,"finally-block","finally-block",832982472).cljs$core$IFn$_invoke$arity$1(exception_frame)))){
var statearr_28304 = state;
(statearr_28304[cljs.core.async.impl.ioc_helpers.STATE_IDX] = new cljs.core.Keyword(null,"continue-block","continue-block",-1852047850).cljs$core$IFn$_invoke$arity$1(exception_frame));
(statearr_28304[cljs.core.async.impl.ioc_helpers.EXCEPTION_FRAMES] = new cljs.core.Keyword(null,"prev","prev",-1597069226).cljs$core$IFn$_invoke$arity$1(exception_frame));
return statearr_28304;
} else {
throw (new Error("No matching clause"));
}
}
}
}
}
}
break;
}
});
//# sourceMappingURL=ioc_helpers.js.map?rel=1603199191100

File diff suppressed because one or more lines are too long

View file

@ -1,43 +0,0 @@
;; Copyright (c) Rich Hickey and contributors. All rights reserved.
;; The use and distribution terms for this software are covered by the
;; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
;; which can be found in the file epl-v10.html at the root of this distribution.
;; By using this software in any fashion, you are agreeing to be bound by
;; the terms of this license.
;; You must not remove this notice, or any other, from this software.
(ns cljs.core.async.impl.protocols)
(def ^:const MAX-QUEUE-SIZE 1024)
(defprotocol ReadPort
(take! [port fn1-handler] "derefable val if taken, nil if take was enqueued"))
(defprotocol WritePort
(put! [port val fn1-handler] "derefable boolean (false if already closed) if handled, nil if put was enqueued.
Must throw on nil val."))
(defprotocol Channel
(close! [chan])
(closed? [chan]))
(defprotocol Handler
(active? [h] "returns true if has callback. Must work w/o lock")
(blockable? [h] "returns true if this handler may be blocked, otherwise it must not block")
#_(lock-id [h] "a unique id for lock acquisition order, 0 if no lock")
(commit [h] "commit to fulfilling its end of the transfer, returns cb. Must be called within lock"))
(defprotocol Buffer
(full? [b] "returns true if buffer can accept put")
(remove! [b] "remove and return next item from buffer, called under chan mutex")
(add!* [b itm] "if room, add item to the buffer, returns b, called under chan mutex")
(close-buf! [b] "called on chan closed under chan mutex, return ignored"))
(defn add!
([b] b)
([b itm]
(assert (not (nil? itm)))
(add!* b itm)))
;; Defines a buffer that will never block (return true to full?)
(defprotocol UnblockingBuffer)

File diff suppressed because one or more lines are too long

View file

@ -1,326 +0,0 @@
// Compiled by ClojureScript 1.9.229 {}
goog.provide('cljs.core.async.impl.protocols');
goog.require('cljs.core');
cljs.core.async.impl.protocols.MAX_QUEUE_SIZE = (1024);
/**
* @interface
*/
cljs.core.async.impl.protocols.ReadPort = function(){};
/**
* derefable val if taken, nil if take was enqueued
*/
cljs.core.async.impl.protocols.take_BANG_ = (function cljs$core$async$impl$protocols$take_BANG_(port,fn1_handler){
if((!((port == null))) && (!((port.cljs$core$async$impl$protocols$ReadPort$take_BANG_$arity$2 == null)))){
return port.cljs$core$async$impl$protocols$ReadPort$take_BANG_$arity$2(port,fn1_handler);
} else {
var x__25793__auto__ = (((port == null))?null:port);
var m__25794__auto__ = (cljs.core.async.impl.protocols.take_BANG_[goog.typeOf(x__25793__auto__)]);
if(!((m__25794__auto__ == null))){
return m__25794__auto__.call(null,port,fn1_handler);
} else {
var m__25794__auto____$1 = (cljs.core.async.impl.protocols.take_BANG_["_"]);
if(!((m__25794__auto____$1 == null))){
return m__25794__auto____$1.call(null,port,fn1_handler);
} else {
throw cljs.core.missing_protocol.call(null,"ReadPort.take!",port);
}
}
}
});
/**
* @interface
*/
cljs.core.async.impl.protocols.WritePort = function(){};
/**
* derefable boolean (false if already closed) if handled, nil if put was enqueued.
* Must throw on nil val.
*/
cljs.core.async.impl.protocols.put_BANG_ = (function cljs$core$async$impl$protocols$put_BANG_(port,val,fn1_handler){
if((!((port == null))) && (!((port.cljs$core$async$impl$protocols$WritePort$put_BANG_$arity$3 == null)))){
return port.cljs$core$async$impl$protocols$WritePort$put_BANG_$arity$3(port,val,fn1_handler);
} else {
var x__25793__auto__ = (((port == null))?null:port);
var m__25794__auto__ = (cljs.core.async.impl.protocols.put_BANG_[goog.typeOf(x__25793__auto__)]);
if(!((m__25794__auto__ == null))){
return m__25794__auto__.call(null,port,val,fn1_handler);
} else {
var m__25794__auto____$1 = (cljs.core.async.impl.protocols.put_BANG_["_"]);
if(!((m__25794__auto____$1 == null))){
return m__25794__auto____$1.call(null,port,val,fn1_handler);
} else {
throw cljs.core.missing_protocol.call(null,"WritePort.put!",port);
}
}
}
});
/**
* @interface
*/
cljs.core.async.impl.protocols.Channel = function(){};
cljs.core.async.impl.protocols.close_BANG_ = (function cljs$core$async$impl$protocols$close_BANG_(chan){
if((!((chan == null))) && (!((chan.cljs$core$async$impl$protocols$Channel$close_BANG_$arity$1 == null)))){
return chan.cljs$core$async$impl$protocols$Channel$close_BANG_$arity$1(chan);
} else {
var x__25793__auto__ = (((chan == null))?null:chan);
var m__25794__auto__ = (cljs.core.async.impl.protocols.close_BANG_[goog.typeOf(x__25793__auto__)]);
if(!((m__25794__auto__ == null))){
return m__25794__auto__.call(null,chan);
} else {
var m__25794__auto____$1 = (cljs.core.async.impl.protocols.close_BANG_["_"]);
if(!((m__25794__auto____$1 == null))){
return m__25794__auto____$1.call(null,chan);
} else {
throw cljs.core.missing_protocol.call(null,"Channel.close!",chan);
}
}
}
});
cljs.core.async.impl.protocols.closed_QMARK_ = (function cljs$core$async$impl$protocols$closed_QMARK_(chan){
if((!((chan == null))) && (!((chan.cljs$core$async$impl$protocols$Channel$closed_QMARK_$arity$1 == null)))){
return chan.cljs$core$async$impl$protocols$Channel$closed_QMARK_$arity$1(chan);
} else {
var x__25793__auto__ = (((chan == null))?null:chan);
var m__25794__auto__ = (cljs.core.async.impl.protocols.closed_QMARK_[goog.typeOf(x__25793__auto__)]);
if(!((m__25794__auto__ == null))){
return m__25794__auto__.call(null,chan);
} else {
var m__25794__auto____$1 = (cljs.core.async.impl.protocols.closed_QMARK_["_"]);
if(!((m__25794__auto____$1 == null))){
return m__25794__auto____$1.call(null,chan);
} else {
throw cljs.core.missing_protocol.call(null,"Channel.closed?",chan);
}
}
}
});
/**
* @interface
*/
cljs.core.async.impl.protocols.Handler = function(){};
/**
* returns true if has callback. Must work w/o lock
*/
cljs.core.async.impl.protocols.active_QMARK_ = (function cljs$core$async$impl$protocols$active_QMARK_(h){
if((!((h == null))) && (!((h.cljs$core$async$impl$protocols$Handler$active_QMARK_$arity$1 == null)))){
return h.cljs$core$async$impl$protocols$Handler$active_QMARK_$arity$1(h);
} else {
var x__25793__auto__ = (((h == null))?null:h);
var m__25794__auto__ = (cljs.core.async.impl.protocols.active_QMARK_[goog.typeOf(x__25793__auto__)]);
if(!((m__25794__auto__ == null))){
return m__25794__auto__.call(null,h);
} else {
var m__25794__auto____$1 = (cljs.core.async.impl.protocols.active_QMARK_["_"]);
if(!((m__25794__auto____$1 == null))){
return m__25794__auto____$1.call(null,h);
} else {
throw cljs.core.missing_protocol.call(null,"Handler.active?",h);
}
}
}
});
/**
* returns true if this handler may be blocked, otherwise it must not block
*/
cljs.core.async.impl.protocols.blockable_QMARK_ = (function cljs$core$async$impl$protocols$blockable_QMARK_(h){
if((!((h == null))) && (!((h.cljs$core$async$impl$protocols$Handler$blockable_QMARK_$arity$1 == null)))){
return h.cljs$core$async$impl$protocols$Handler$blockable_QMARK_$arity$1(h);
} else {
var x__25793__auto__ = (((h == null))?null:h);
var m__25794__auto__ = (cljs.core.async.impl.protocols.blockable_QMARK_[goog.typeOf(x__25793__auto__)]);
if(!((m__25794__auto__ == null))){
return m__25794__auto__.call(null,h);
} else {
var m__25794__auto____$1 = (cljs.core.async.impl.protocols.blockable_QMARK_["_"]);
if(!((m__25794__auto____$1 == null))){
return m__25794__auto____$1.call(null,h);
} else {
throw cljs.core.missing_protocol.call(null,"Handler.blockable?",h);
}
}
}
});
/**
* commit to fulfilling its end of the transfer, returns cb. Must be called within lock
*/
cljs.core.async.impl.protocols.commit = (function cljs$core$async$impl$protocols$commit(h){
if((!((h == null))) && (!((h.cljs$core$async$impl$protocols$Handler$commit$arity$1 == null)))){
return h.cljs$core$async$impl$protocols$Handler$commit$arity$1(h);
} else {
var x__25793__auto__ = (((h == null))?null:h);
var m__25794__auto__ = (cljs.core.async.impl.protocols.commit[goog.typeOf(x__25793__auto__)]);
if(!((m__25794__auto__ == null))){
return m__25794__auto__.call(null,h);
} else {
var m__25794__auto____$1 = (cljs.core.async.impl.protocols.commit["_"]);
if(!((m__25794__auto____$1 == null))){
return m__25794__auto____$1.call(null,h);
} else {
throw cljs.core.missing_protocol.call(null,"Handler.commit",h);
}
}
}
});
/**
* @interface
*/
cljs.core.async.impl.protocols.Buffer = function(){};
/**
* returns true if buffer can accept put
*/
cljs.core.async.impl.protocols.full_QMARK_ = (function cljs$core$async$impl$protocols$full_QMARK_(b){
if((!((b == null))) && (!((b.cljs$core$async$impl$protocols$Buffer$full_QMARK_$arity$1 == null)))){
return b.cljs$core$async$impl$protocols$Buffer$full_QMARK_$arity$1(b);
} else {
var x__25793__auto__ = (((b == null))?null:b);
var m__25794__auto__ = (cljs.core.async.impl.protocols.full_QMARK_[goog.typeOf(x__25793__auto__)]);
if(!((m__25794__auto__ == null))){
return m__25794__auto__.call(null,b);
} else {
var m__25794__auto____$1 = (cljs.core.async.impl.protocols.full_QMARK_["_"]);
if(!((m__25794__auto____$1 == null))){
return m__25794__auto____$1.call(null,b);
} else {
throw cljs.core.missing_protocol.call(null,"Buffer.full?",b);
}
}
}
});
/**
* remove and return next item from buffer, called under chan mutex
*/
cljs.core.async.impl.protocols.remove_BANG_ = (function cljs$core$async$impl$protocols$remove_BANG_(b){
if((!((b == null))) && (!((b.cljs$core$async$impl$protocols$Buffer$remove_BANG_$arity$1 == null)))){
return b.cljs$core$async$impl$protocols$Buffer$remove_BANG_$arity$1(b);
} else {
var x__25793__auto__ = (((b == null))?null:b);
var m__25794__auto__ = (cljs.core.async.impl.protocols.remove_BANG_[goog.typeOf(x__25793__auto__)]);
if(!((m__25794__auto__ == null))){
return m__25794__auto__.call(null,b);
} else {
var m__25794__auto____$1 = (cljs.core.async.impl.protocols.remove_BANG_["_"]);
if(!((m__25794__auto____$1 == null))){
return m__25794__auto____$1.call(null,b);
} else {
throw cljs.core.missing_protocol.call(null,"Buffer.remove!",b);
}
}
}
});
/**
* if room, add item to the buffer, returns b, called under chan mutex
*/
cljs.core.async.impl.protocols.add_BANG__STAR_ = (function cljs$core$async$impl$protocols$add_BANG__STAR_(b,itm){
if((!((b == null))) && (!((b.cljs$core$async$impl$protocols$Buffer$add_BANG__STAR_$arity$2 == null)))){
return b.cljs$core$async$impl$protocols$Buffer$add_BANG__STAR_$arity$2(b,itm);
} else {
var x__25793__auto__ = (((b == null))?null:b);
var m__25794__auto__ = (cljs.core.async.impl.protocols.add_BANG__STAR_[goog.typeOf(x__25793__auto__)]);
if(!((m__25794__auto__ == null))){
return m__25794__auto__.call(null,b,itm);
} else {
var m__25794__auto____$1 = (cljs.core.async.impl.protocols.add_BANG__STAR_["_"]);
if(!((m__25794__auto____$1 == null))){
return m__25794__auto____$1.call(null,b,itm);
} else {
throw cljs.core.missing_protocol.call(null,"Buffer.add!*",b);
}
}
}
});
/**
* called on chan closed under chan mutex, return ignored
*/
cljs.core.async.impl.protocols.close_buf_BANG_ = (function cljs$core$async$impl$protocols$close_buf_BANG_(b){
if((!((b == null))) && (!((b.cljs$core$async$impl$protocols$Buffer$close_buf_BANG_$arity$1 == null)))){
return b.cljs$core$async$impl$protocols$Buffer$close_buf_BANG_$arity$1(b);
} else {
var x__25793__auto__ = (((b == null))?null:b);
var m__25794__auto__ = (cljs.core.async.impl.protocols.close_buf_BANG_[goog.typeOf(x__25793__auto__)]);
if(!((m__25794__auto__ == null))){
return m__25794__auto__.call(null,b);
} else {
var m__25794__auto____$1 = (cljs.core.async.impl.protocols.close_buf_BANG_["_"]);
if(!((m__25794__auto____$1 == null))){
return m__25794__auto____$1.call(null,b);
} else {
throw cljs.core.missing_protocol.call(null,"Buffer.close-buf!",b);
}
}
}
});
cljs.core.async.impl.protocols.add_BANG_ = (function cljs$core$async$impl$protocols$add_BANG_(var_args){
var args27109 = [];
var len__26205__auto___27112 = arguments.length;
var i__26206__auto___27113 = (0);
while(true){
if((i__26206__auto___27113 < len__26205__auto___27112)){
args27109.push((arguments[i__26206__auto___27113]));
var G__27114 = (i__26206__auto___27113 + (1));
i__26206__auto___27113 = G__27114;
continue;
} else {
}
break;
}
var G__27111 = args27109.length;
switch (G__27111) {
case 1:
return cljs.core.async.impl.protocols.add_BANG_.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));
break;
case 2:
return cljs.core.async.impl.protocols.add_BANG_.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));
break;
default:
throw (new Error([cljs.core.str("Invalid arity: "),cljs.core.str(args27109.length)].join('')));
}
});
cljs.core.async.impl.protocols.add_BANG_.cljs$core$IFn$_invoke$arity$1 = (function (b){
return b;
});
cljs.core.async.impl.protocols.add_BANG_.cljs$core$IFn$_invoke$arity$2 = (function (b,itm){
if(!((itm == null))){
} else {
throw (new Error("Assert failed: (not (nil? itm))"));
}
return cljs.core.async.impl.protocols.add_BANG__STAR_.call(null,b,itm);
});
cljs.core.async.impl.protocols.add_BANG_.cljs$lang$maxFixedArity = 2;
/**
* @interface
*/
cljs.core.async.impl.protocols.UnblockingBuffer = function(){};
//# sourceMappingURL=protocols.js.map?rel=1603199189530

File diff suppressed because one or more lines are too long

View file

@ -1,167 +0,0 @@
;; Copyright (c) Rich Hickey and contributors. All rights reserved.
;; The use and distribution terms for this software are covered by the
;; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
;; which can be found in the file epl-v10.html at the root of this distribution.
;; By using this software in any fashion, you are agreeing to be bound by
;; the terms of this license.
;; You must not remove this notice, or any other, from this software.
(ns cljs.core.async.impl.timers
(:require [cljs.core.async.impl.protocols :as impl]
[cljs.core.async.impl.channels :as channels]
[cljs.core.async.impl.dispatch :as dispatch]))
(def MAX_LEVEL 15) ;; 16 levels
(def P (/ 1 2))
(defn random-level
([] (random-level 0))
([level]
(if (and (< (.random js/Math) P)
(< level MAX_LEVEL))
(recur (inc level))
level)))
(deftype SkipListNode [key ^:mutable val forward]
ISeqable
(-seq [coll]
(list key val))
IPrintWithWriter
(-pr-writer [coll writer opts]
(pr-sequential-writer writer pr-writer "[" " " "]" opts coll)))
(defn skip-list-node
([level] (skip-list-node nil nil level))
([k v level]
(let [arr (make-array (inc level))]
(loop [i 0]
(when (< i (alength arr))
(aset arr i nil)
(recur (inc i))))
(SkipListNode. k v arr))))
(defn least-greater-node
([x k level] (least-greater-node x k level nil))
([x k level update]
(if-not (neg? level)
(let [x (loop [x x]
(if-let [x' (aget (.-forward x) level)]
(if (< (.-key x') k)
(recur x')
x)
x))]
(when-not (nil? update)
(aset update level x))
(recur x k (dec level) update))
x)))
(deftype SkipList [header ^:mutable level]
Object
(put [coll k v]
(let [update (make-array MAX_LEVEL)
x (least-greater-node header k level update)
x (aget (.-forward x) 0)]
(if (and (not (nil? x)) (== (.-key x) k))
(set! (.-val x) v)
(let [new-level (random-level)]
(when (> new-level level)
(loop [i (inc level)]
(when (<= i (inc new-level))
(aset update i header)
(recur (inc i))))
(set! level new-level))
(let [x (skip-list-node k v (make-array new-level))]
(loop [i 0]
(when (<= i level)
(let [links (.-forward (aget update i))]
(aset (.-forward x) i (aget links i))
(aset links i x)))))))))
(remove [coll k]
(let [update (make-array MAX_LEVEL)
x (least-greater-node header k level update)
x (aget (.-forward x) 0)]
(when (and (not (nil? x)) (== (.-key x) k))
(loop [i 0]
(when (<= i level)
(let [links (.-forward (aget update i))]
(if (identical? (aget links i) x)
(do
(aset links i (aget (.-forward x) i))
(recur (inc i)))
(recur (inc i))))))
(while (and (> level 0)
(nil? (aget (.-forward header) level)))
(set! level (dec level))))))
(ceilingEntry [coll k]
(loop [x header level level]
(if-not (neg? level)
(let [nx (loop [x x]
(let [x' (aget (.-forward x) level)]
(when-not (nil? x')
(if (>= (.-key x') k)
x'
(recur x')))))]
(if-not (nil? nx)
(recur nx (dec level))
(recur x (dec level))))
(when-not (identical? x header)
x))))
(floorEntry [coll k]
(loop [x header level level]
(if-not (neg? level)
(let [nx (loop [x x]
(let [x' (aget (.-forward x) level)]
(if-not (nil? x')
(if (> (.-key x') k)
x
(recur x'))
(when (zero? level)
x))))]
(if nx
(recur nx (dec level))
(recur x (dec level))))
(when-not (identical? x header)
x))))
ISeqable
(-seq [coll]
(letfn [(iter [node]
(lazy-seq
(when-not (nil? node)
(cons [(.-key node) (.-val node)]
(iter (aget (.-forward node) 0))))))]
(iter (aget (.-forward header) 0))))
IPrintWithWriter
(-pr-writer [coll writer opts]
(let [pr-pair (fn [keyval]
(pr-sequential-writer writer pr-writer "" " " "" opts keyval))]
(pr-sequential-writer writer pr-pair "{" ", " "}" opts coll))))
(defn skip-list []
(SkipList. (skip-list-node 0) 0))
(def timeouts-map (skip-list))
(def TIMEOUT_RESOLUTION_MS 10)
(defn timeout
"returns a channel that will close after msecs"
[msecs]
(let [timeout (+ (.valueOf (js/Date.)) msecs)
me (.ceilingEntry timeouts-map timeout)]
(or (when (and me (< (.-key me) (+ timeout TIMEOUT_RESOLUTION_MS)))
(.-val me))
(let [timeout-channel (channels/chan nil)]
(.put timeouts-map timeout timeout-channel)
(dispatch/queue-delay
(fn []
(.remove timeouts-map timeout)
(impl/close! timeout-channel))
msecs)
timeout-channel))))

File diff suppressed because one or more lines are too long

View file

@ -1,521 +0,0 @@
// Compiled by ClojureScript 1.9.229 {}
goog.provide('cljs.core.async.impl.timers');
goog.require('cljs.core');
goog.require('cljs.core.async.impl.protocols');
goog.require('cljs.core.async.impl.channels');
goog.require('cljs.core.async.impl.dispatch');
cljs.core.async.impl.timers.MAX_LEVEL = (15);
cljs.core.async.impl.timers.P = ((1) / (2));
cljs.core.async.impl.timers.random_level = (function cljs$core$async$impl$timers$random_level(var_args){
var args28309 = [];
var len__26205__auto___28312 = arguments.length;
var i__26206__auto___28313 = (0);
while(true){
if((i__26206__auto___28313 < len__26205__auto___28312)){
args28309.push((arguments[i__26206__auto___28313]));
var G__28314 = (i__26206__auto___28313 + (1));
i__26206__auto___28313 = G__28314;
continue;
} else {
}
break;
}
var G__28311 = args28309.length;
switch (G__28311) {
case 0:
return cljs.core.async.impl.timers.random_level.cljs$core$IFn$_invoke$arity$0();
break;
case 1:
return cljs.core.async.impl.timers.random_level.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));
break;
default:
throw (new Error([cljs.core.str("Invalid arity: "),cljs.core.str(args28309.length)].join('')));
}
});
cljs.core.async.impl.timers.random_level.cljs$core$IFn$_invoke$arity$0 = (function (){
return cljs.core.async.impl.timers.random_level.call(null,(0));
});
cljs.core.async.impl.timers.random_level.cljs$core$IFn$_invoke$arity$1 = (function (level){
while(true){
if(((Math.random() < cljs.core.async.impl.timers.P)) && ((level < cljs.core.async.impl.timers.MAX_LEVEL))){
var G__28316 = (level + (1));
level = G__28316;
continue;
} else {
return level;
}
break;
}
});
cljs.core.async.impl.timers.random_level.cljs$lang$maxFixedArity = 1;
/**
* @constructor
* @implements {cljs.core.ISeqable}
* @implements {cljs.core.IPrintWithWriter}
*/
cljs.core.async.impl.timers.SkipListNode = (function (key,val,forward){
this.key = key;
this.val = val;
this.forward = forward;
this.cljs$lang$protocol_mask$partition0$ = 2155872256;
this.cljs$lang$protocol_mask$partition1$ = 0;
})
cljs.core.async.impl.timers.SkipListNode.prototype.cljs$core$ISeqable$_seq$arity$1 = (function (coll){
var self__ = this;
var coll__$1 = this;
var x__25964__auto__ = self__.key;
return cljs.core._conj.call(null,(function (){var x__25964__auto____$1 = self__.val;
return cljs.core._conj.call(null,cljs.core.List.EMPTY,x__25964__auto____$1);
})(),x__25964__auto__);
});
cljs.core.async.impl.timers.SkipListNode.prototype.cljs$core$IPrintWithWriter$_pr_writer$arity$3 = (function (coll,writer,opts){
var self__ = this;
var coll__$1 = this;
return cljs.core.pr_sequential_writer.call(null,writer,cljs.core.pr_writer,"["," ","]",opts,coll__$1);
});
cljs.core.async.impl.timers.SkipListNode.getBasis = (function (){
return new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"key","key",124488940,null),cljs.core.with_meta(new cljs.core.Symbol(null,"val","val",1769233139,null),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"mutable","mutable",875778266),true], null)),new cljs.core.Symbol(null,"forward","forward",1083186224,null)], null);
});
cljs.core.async.impl.timers.SkipListNode.cljs$lang$type = true;
cljs.core.async.impl.timers.SkipListNode.cljs$lang$ctorStr = "cljs.core.async.impl.timers/SkipListNode";
cljs.core.async.impl.timers.SkipListNode.cljs$lang$ctorPrWriter = (function (this__25736__auto__,writer__25737__auto__,opt__25738__auto__){
return cljs.core._write.call(null,writer__25737__auto__,"cljs.core.async.impl.timers/SkipListNode");
});
cljs.core.async.impl.timers.__GT_SkipListNode = (function cljs$core$async$impl$timers$__GT_SkipListNode(key,val,forward){
return (new cljs.core.async.impl.timers.SkipListNode(key,val,forward));
});
cljs.core.async.impl.timers.skip_list_node = (function cljs$core$async$impl$timers$skip_list_node(var_args){
var args28317 = [];
var len__26205__auto___28320 = arguments.length;
var i__26206__auto___28321 = (0);
while(true){
if((i__26206__auto___28321 < len__26205__auto___28320)){
args28317.push((arguments[i__26206__auto___28321]));
var G__28322 = (i__26206__auto___28321 + (1));
i__26206__auto___28321 = G__28322;
continue;
} else {
}
break;
}
var G__28319 = args28317.length;
switch (G__28319) {
case 1:
return cljs.core.async.impl.timers.skip_list_node.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));
break;
case 3:
return cljs.core.async.impl.timers.skip_list_node.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));
break;
default:
throw (new Error([cljs.core.str("Invalid arity: "),cljs.core.str(args28317.length)].join('')));
}
});
cljs.core.async.impl.timers.skip_list_node.cljs$core$IFn$_invoke$arity$1 = (function (level){
return cljs.core.async.impl.timers.skip_list_node.call(null,null,null,level);
});
cljs.core.async.impl.timers.skip_list_node.cljs$core$IFn$_invoke$arity$3 = (function (k,v,level){
var arr = (new Array((level + (1))));
var i_28324 = (0);
while(true){
if((i_28324 < arr.length)){
(arr[i_28324] = null);
var G__28325 = (i_28324 + (1));
i_28324 = G__28325;
continue;
} else {
}
break;
}
return (new cljs.core.async.impl.timers.SkipListNode(k,v,arr));
});
cljs.core.async.impl.timers.skip_list_node.cljs$lang$maxFixedArity = 3;
cljs.core.async.impl.timers.least_greater_node = (function cljs$core$async$impl$timers$least_greater_node(var_args){
var args28326 = [];
var len__26205__auto___28329 = arguments.length;
var i__26206__auto___28330 = (0);
while(true){
if((i__26206__auto___28330 < len__26205__auto___28329)){
args28326.push((arguments[i__26206__auto___28330]));
var G__28331 = (i__26206__auto___28330 + (1));
i__26206__auto___28330 = G__28331;
continue;
} else {
}
break;
}
var G__28328 = args28326.length;
switch (G__28328) {
case 3:
return cljs.core.async.impl.timers.least_greater_node.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));
break;
case 4:
return cljs.core.async.impl.timers.least_greater_node.cljs$core$IFn$_invoke$arity$4((arguments[(0)]),(arguments[(1)]),(arguments[(2)]),(arguments[(3)]));
break;
default:
throw (new Error([cljs.core.str("Invalid arity: "),cljs.core.str(args28326.length)].join('')));
}
});
cljs.core.async.impl.timers.least_greater_node.cljs$core$IFn$_invoke$arity$3 = (function (x,k,level){
return cljs.core.async.impl.timers.least_greater_node.call(null,x,k,level,null);
});
cljs.core.async.impl.timers.least_greater_node.cljs$core$IFn$_invoke$arity$4 = (function (x,k,level,update){
while(true){
if(!((level < (0)))){
var x__$1 = (function (){var x__$1 = x;
while(true){
var temp__4655__auto__ = (x__$1.forward[level]);
if(cljs.core.truth_(temp__4655__auto__)){
var x_SINGLEQUOTE_ = temp__4655__auto__;
if((x_SINGLEQUOTE_.key < k)){
var G__28333 = x_SINGLEQUOTE_;
x__$1 = G__28333;
continue;
} else {
return x__$1;
}
} else {
return x__$1;
}
break;
}
})();
if((update == null)){
} else {
(update[level] = x__$1);
}
var G__28334 = x__$1;
var G__28335 = k;
var G__28336 = (level - (1));
var G__28337 = update;
x = G__28334;
k = G__28335;
level = G__28336;
update = G__28337;
continue;
} else {
return x;
}
break;
}
});
cljs.core.async.impl.timers.least_greater_node.cljs$lang$maxFixedArity = 4;
/**
* @constructor
* @implements {cljs.core.async.impl.timers.Object}
* @implements {cljs.core.ISeqable}
* @implements {cljs.core.IPrintWithWriter}
*/
cljs.core.async.impl.timers.SkipList = (function (header,level){
this.header = header;
this.level = level;
this.cljs$lang$protocol_mask$partition0$ = 2155872256;
this.cljs$lang$protocol_mask$partition1$ = 0;
})
cljs.core.async.impl.timers.SkipList.prototype.put = (function (k,v){
var self__ = this;
var coll = this;
var update = (new Array(cljs.core.async.impl.timers.MAX_LEVEL));
var x = cljs.core.async.impl.timers.least_greater_node.call(null,self__.header,k,self__.level,update);
var x__$1 = (x.forward[(0)]);
if((!((x__$1 == null))) && ((x__$1.key === k))){
return x__$1.val = v;
} else {
var new_level = cljs.core.async.impl.timers.random_level.call(null);
if((new_level > self__.level)){
var i_28338 = (self__.level + (1));
while(true){
if((i_28338 <= (new_level + (1)))){
(update[i_28338] = self__.header);
var G__28339 = (i_28338 + (1));
i_28338 = G__28339;
continue;
} else {
}
break;
}
self__.level = new_level;
} else {
}
var x__$2 = cljs.core.async.impl.timers.skip_list_node.call(null,k,v,(new Array(new_level)));
var i = (0);
while(true){
if((i <= self__.level)){
var links = (update[i]).forward;
(x__$2.forward[i] = (links[i]));
return (links[i] = x__$2);
} else {
return null;
}
break;
}
}
});
cljs.core.async.impl.timers.SkipList.prototype.remove = (function (k){
var self__ = this;
var coll = this;
var update = (new Array(cljs.core.async.impl.timers.MAX_LEVEL));
var x = cljs.core.async.impl.timers.least_greater_node.call(null,self__.header,k,self__.level,update);
var x__$1 = (x.forward[(0)]);
if((!((x__$1 == null))) && ((x__$1.key === k))){
var i_28340 = (0);
while(true){
if((i_28340 <= self__.level)){
var links_28341 = (update[i_28340]).forward;
if(((links_28341[i_28340]) === x__$1)){
(links_28341[i_28340] = (x__$1.forward[i_28340]));
var G__28342 = (i_28340 + (1));
i_28340 = G__28342;
continue;
} else {
var G__28343 = (i_28340 + (1));
i_28340 = G__28343;
continue;
}
} else {
}
break;
}
while(true){
if(((self__.level > (0))) && (((self__.header.forward[self__.level]) == null))){
self__.level = (self__.level - (1));
continue;
} else {
return null;
}
break;
}
} else {
return null;
}
});
cljs.core.async.impl.timers.SkipList.prototype.ceilingEntry = (function (k){
var self__ = this;
var coll = this;
var x = self__.header;
var level__$1 = self__.level;
while(true){
if(!((level__$1 < (0)))){
var nx = (function (){var x__$1 = x;
while(true){
var x_SINGLEQUOTE_ = (x__$1.forward[level__$1]);
if((x_SINGLEQUOTE_ == null)){
return null;
} else {
if((x_SINGLEQUOTE_.key >= k)){
return x_SINGLEQUOTE_;
} else {
var G__28344 = x_SINGLEQUOTE_;
x__$1 = G__28344;
continue;
}
}
break;
}
})();
if(!((nx == null))){
var G__28345 = nx;
var G__28346 = (level__$1 - (1));
x = G__28345;
level__$1 = G__28346;
continue;
} else {
var G__28347 = x;
var G__28348 = (level__$1 - (1));
x = G__28347;
level__$1 = G__28348;
continue;
}
} else {
if((x === self__.header)){
return null;
} else {
return x;
}
}
break;
}
});
cljs.core.async.impl.timers.SkipList.prototype.floorEntry = (function (k){
var self__ = this;
var coll = this;
var x = self__.header;
var level__$1 = self__.level;
while(true){
if(!((level__$1 < (0)))){
var nx = (function (){var x__$1 = x;
while(true){
var x_SINGLEQUOTE_ = (x__$1.forward[level__$1]);
if(!((x_SINGLEQUOTE_ == null))){
if((x_SINGLEQUOTE_.key > k)){
return x__$1;
} else {
var G__28349 = x_SINGLEQUOTE_;
x__$1 = G__28349;
continue;
}
} else {
if((level__$1 === (0))){
return x__$1;
} else {
return null;
}
}
break;
}
})();
if(cljs.core.truth_(nx)){
var G__28350 = nx;
var G__28351 = (level__$1 - (1));
x = G__28350;
level__$1 = G__28351;
continue;
} else {
var G__28352 = x;
var G__28353 = (level__$1 - (1));
x = G__28352;
level__$1 = G__28353;
continue;
}
} else {
if((x === self__.header)){
return null;
} else {
return x;
}
}
break;
}
});
cljs.core.async.impl.timers.SkipList.prototype.cljs$core$ISeqable$_seq$arity$1 = (function (coll){
var self__ = this;
var coll__$1 = this;
var iter = ((function (coll__$1){
return (function cljs$core$async$impl$timers$iter(node){
return (new cljs.core.LazySeq(null,((function (coll__$1){
return (function (){
if((node == null)){
return null;
} else {
return cljs.core.cons.call(null,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [node.key,node.val], null),cljs$core$async$impl$timers$iter.call(null,(node.forward[(0)])));
}
});})(coll__$1))
,null,null));
});})(coll__$1))
;
return iter.call(null,(self__.header.forward[(0)]));
});
cljs.core.async.impl.timers.SkipList.prototype.cljs$core$IPrintWithWriter$_pr_writer$arity$3 = (function (coll,writer,opts){
var self__ = this;
var coll__$1 = this;
var pr_pair = ((function (coll__$1){
return (function (keyval){
return cljs.core.pr_sequential_writer.call(null,writer,cljs.core.pr_writer,""," ","",opts,keyval);
});})(coll__$1))
;
return cljs.core.pr_sequential_writer.call(null,writer,pr_pair,"{",", ","}",opts,coll__$1);
});
cljs.core.async.impl.timers.SkipList.getBasis = (function (){
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Symbol(null,"header","header",1759972661,null),cljs.core.with_meta(new cljs.core.Symbol(null,"level","level",-1363938217,null),new cljs.core.PersistentArrayMap(null, 1, [new cljs.core.Keyword(null,"mutable","mutable",875778266),true], null))], null);
});
cljs.core.async.impl.timers.SkipList.cljs$lang$type = true;
cljs.core.async.impl.timers.SkipList.cljs$lang$ctorStr = "cljs.core.async.impl.timers/SkipList";
cljs.core.async.impl.timers.SkipList.cljs$lang$ctorPrWriter = (function (this__25736__auto__,writer__25737__auto__,opt__25738__auto__){
return cljs.core._write.call(null,writer__25737__auto__,"cljs.core.async.impl.timers/SkipList");
});
cljs.core.async.impl.timers.__GT_SkipList = (function cljs$core$async$impl$timers$__GT_SkipList(header,level){
return (new cljs.core.async.impl.timers.SkipList(header,level));
});
cljs.core.async.impl.timers.skip_list = (function cljs$core$async$impl$timers$skip_list(){
return (new cljs.core.async.impl.timers.SkipList(cljs.core.async.impl.timers.skip_list_node.call(null,(0)),(0)));
});
cljs.core.async.impl.timers.timeouts_map = cljs.core.async.impl.timers.skip_list.call(null);
cljs.core.async.impl.timers.TIMEOUT_RESOLUTION_MS = (10);
/**
* returns a channel that will close after msecs
*/
cljs.core.async.impl.timers.timeout = (function cljs$core$async$impl$timers$timeout(msecs){
var timeout__$1 = ((new Date()).valueOf() + msecs);
var me = cljs.core.async.impl.timers.timeouts_map.ceilingEntry(timeout__$1);
var or__25130__auto__ = (cljs.core.truth_((function (){var and__25118__auto__ = me;
if(cljs.core.truth_(and__25118__auto__)){
return (me.key < (timeout__$1 + cljs.core.async.impl.timers.TIMEOUT_RESOLUTION_MS));
} else {
return and__25118__auto__;
}
})())?me.val:null);
if(cljs.core.truth_(or__25130__auto__)){
return or__25130__auto__;
} else {
var timeout_channel = cljs.core.async.impl.channels.chan.call(null,null);
cljs.core.async.impl.timers.timeouts_map.put(timeout__$1,timeout_channel);
cljs.core.async.impl.dispatch.queue_delay.call(null,((function (timeout_channel,or__25130__auto__,timeout__$1,me){
return (function (){
cljs.core.async.impl.timers.timeouts_map.remove(timeout__$1);
return cljs.core.async.impl.protocols.close_BANG_.call(null,timeout_channel);
});})(timeout_channel,or__25130__auto__,timeout__$1,me))
,msecs);
return timeout_channel;
}
});
//# sourceMappingURL=timers.js.map?rel=1603199191227

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,641 +0,0 @@
; Copyright (c) Rich Hickey. All rights reserved.
; The use and distribution terms for this software are covered by the
; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
; which can be found in the file epl-v10.html at the root of this distribution.
; By using this software in any fashion, you are agreeing to be bound by
; the terms of this license.
; You must not remove this notice, or any other, from this software.
(ns cljs.reader
(:require [goog.string :as gstring])
(:import goog.string.StringBuffer))
(defprotocol PushbackReader
(read-char [reader] "Returns the next char from the Reader,
nil if the end of stream has been reached")
(unread [reader ch] "Push back a single character on to the stream"))
(deftype StringPushbackReader [s buffer ^:mutable idx]
PushbackReader
(read-char [reader]
(if (zero? (alength buffer))
(do
(set! idx (inc idx))
(aget s idx))
(.pop buffer)))
(unread [reader ch]
(.push buffer ch)))
(defn push-back-reader [s]
"Creates a StringPushbackReader from a given string"
(StringPushbackReader. s (array) -1))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; predicates
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defn- ^boolean whitespace?
"Checks whether a given character is whitespace"
[ch]
(or (gstring/isBreakingWhitespace ch) (identical? \, ch)))
(defn- ^boolean numeric?
"Checks whether a given character is numeric"
[ch]
(gstring/isNumeric ch))
(defn- ^boolean comment-prefix?
"Checks whether the character begins a comment."
[ch]
(identical? \; ch))
(defn- ^boolean number-literal?
"Checks whether the reader is at the start of a number literal"
[reader initch]
(or (numeric? initch)
(and (or (identical? \+ initch) (identical? \- initch))
(numeric? (let [next-ch (read-char reader)]
(unread reader next-ch)
next-ch)))))
(declare read macros dispatch-macros)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; read helpers
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; later will do e.g. line numbers...
(defn reader-error
[rdr & msg]
(throw (js/Error. (apply str msg))))
(defn ^boolean macro-terminating? [ch]
(and (not (identical? ch "#"))
(not (identical? ch \'))
(not (identical? ch ":"))
(macros ch)))
(defn read-token
[rdr initch]
(loop [sb (StringBuffer. initch)
ch (read-char rdr)]
(if (or (nil? ch)
(whitespace? ch)
(macro-terminating? ch))
(do (unread rdr ch) (.toString sb))
(recur (do (.append sb ch) sb) (read-char rdr)))))
(defn skip-line
"Advances the reader to the end of a line. Returns the reader"
[reader _]
(loop []
(let [ch (read-char reader)]
(if (or (identical? ch \newline) (identical? ch \return) (nil? ch))
reader
(recur)))))
(def int-pattern (re-pattern "^([-+]?)(?:(0)|([1-9][0-9]*)|0[xX]([0-9A-Fa-f]+)|0([0-7]+)|([1-9][0-9]?)[rR]([0-9A-Za-z]+))(N)?$"))
(def ratio-pattern (re-pattern "^([-+]?[0-9]+)/([0-9]+)$"))
(def float-pattern (re-pattern "^([-+]?[0-9]+(\\.[0-9]*)?([eE][-+]?[0-9]+)?)(M)?$"))
(def symbol-pattern (re-pattern "^[:]?([^0-9/].*/)?([^0-9/][^/]*)$"))
(defn- re-matches*
[re s]
(let [matches (.exec re s)]
(when (and (not (nil? matches))
(identical? (aget matches 0) s))
(if (== (alength matches) 1)
(aget matches 0)
matches))))
(defn- match-int
[s]
(let [groups (re-matches* int-pattern s)
ie8-fix (aget groups 2)
zero (if (= ie8-fix "") nil ie8-fix)]
(if-not (nil? zero)
0
(let [a (cond
(aget groups 3) (array (aget groups 3) 10)
(aget groups 4) (array (aget groups 4) 16)
(aget groups 5) (array (aget groups 5) 8)
(aget groups 6) (array (aget groups 7)
(js/parseInt (aget groups 6) 10))
:else (array nil nil))
n (aget a 0)
radix (aget a 1)]
(when-not (nil? n)
(let [parsed (js/parseInt n radix)]
(if (identical? "-" (aget groups 1))
(- parsed)
parsed)))))))
(defn- match-ratio
[s]
(let [groups (re-matches* ratio-pattern s)
numinator (aget groups 1)
denominator (aget groups 2)]
(/ (js/parseInt numinator 10) (js/parseInt denominator 10))))
(defn- match-float
[s]
(js/parseFloat s))
(defn- match-number
[s]
(cond
(re-matches* int-pattern s) (match-int s)
(re-matches* ratio-pattern s) (match-ratio s)
(re-matches* float-pattern s) (match-float s)))
(defn escape-char-map [c]
(cond
(identical? c \t) "\t"
(identical? c \r) "\r"
(identical? c \n) "\n"
(identical? c \\) \\
(identical? c \") \"
(identical? c \b) "\b"
(identical? c \f) "\f"
:else nil))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; unicode
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defn read-2-chars [reader]
(.toString
(StringBuffer.
(read-char reader)
(read-char reader))))
(defn read-4-chars [reader]
(.toString
(StringBuffer.
(read-char reader)
(read-char reader)
(read-char reader)
(read-char reader))))
(def unicode-2-pattern (re-pattern "^[0-9A-Fa-f]{2}$"))
(def unicode-4-pattern (re-pattern "^[0-9A-Fa-f]{4}$"))
(defn validate-unicode-escape [unicode-pattern reader escape-char unicode-str]
(if (re-matches unicode-pattern unicode-str)
unicode-str
(reader-error reader "Unexpected unicode escape \\" escape-char unicode-str)))
(defn make-unicode-char [code-str]
(let [code (js/parseInt code-str 16)]
(.fromCharCode js/String code)))
(defn escape-char
[buffer reader]
(let [ch (read-char reader)
mapresult (escape-char-map ch)]
(if mapresult
mapresult
(cond
(identical? ch \x)
(->> (read-2-chars reader)
(validate-unicode-escape unicode-2-pattern reader ch)
(make-unicode-char))
(identical? ch \u)
(->> (read-4-chars reader)
(validate-unicode-escape unicode-4-pattern reader ch)
(make-unicode-char))
(numeric? ch)
(.fromCharCode js/String ch)
:else
(reader-error reader "Unexpected unicode escape \\" ch )))))
(defn read-past
"Read until first character that doesn't match pred, returning
char."
[pred rdr]
(loop [ch (read-char rdr)]
(if (pred ch)
(recur (read-char rdr))
ch)))
(defn read-delimited-list
[delim rdr recursive?]
(loop [a (array)]
(let [ch (read-past whitespace? rdr)]
(when-not ch (reader-error rdr "EOF while reading"))
(if (identical? delim ch)
a
(if-let [macrofn (macros ch)]
(let [mret (macrofn rdr ch)]
(recur (if (identical? mret rdr) a (do
(.push a mret)
a))))
(do
(unread rdr ch)
(let [o (read rdr true nil recursive?)]
(recur (if (identical? o rdr) a (do
(.push a o)
a))))))))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; data structure readers
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defn not-implemented
[rdr ch]
(reader-error rdr "Reader for " ch " not implemented yet"))
(declare maybe-read-tagged-type)
(defn read-dispatch
[rdr _]
(let [ch (read-char rdr)
dm (dispatch-macros ch)]
(if dm
(dm rdr _)
(if-let [obj (maybe-read-tagged-type rdr ch)]
obj
(reader-error rdr "No dispatch macro for " ch)))))
(defn read-unmatched-delimiter
[rdr ch]
(reader-error rdr "Unmatched delimiter " ch))
(defn read-list
[rdr _]
(let [arr (read-delimited-list ")" rdr true)]
(loop [i (alength arr) ^not-native r ()]
(if (> i 0)
(recur (dec i) (-conj r (aget arr (dec i))))
r))))
(def read-comment skip-line)
(defn read-vector
[rdr _]
(vec (read-delimited-list "]" rdr true)))
(defn read-map
[rdr _]
(let [l (read-delimited-list "}" rdr true)
c (alength l)]
(when (odd? c)
(reader-error rdr "Map literal must contain an even number of forms"))
(if (<= c (* 2 (.-HASHMAP-THRESHOLD PersistentArrayMap)))
(.fromArray PersistentArrayMap l true true)
(.fromArray PersistentHashMap l true))))
(defn read-number
[reader initch]
(loop [buffer (gstring/StringBuffer. initch)
ch (read-char reader)]
(if (or (nil? ch) (whitespace? ch) (macros ch))
(do
(unread reader ch)
(let [s (.toString buffer)]
(or (match-number s)
(reader-error reader "Invalid number format [" s "]"))))
(recur (do (.append buffer ch) buffer) (read-char reader)))))
(defn read-string*
[reader _]
(loop [buffer (gstring/StringBuffer.)
ch (read-char reader)]
(cond
(nil? ch) (reader-error reader "EOF while reading")
(identical? "\\" ch) (recur (do (.append buffer (escape-char buffer reader)) buffer)
(read-char reader))
(identical? \" ch) (. buffer (toString))
:default (recur (do (.append buffer ch) buffer) (read-char reader)))))
(defn read-raw-string*
[reader _]
(loop [buffer (gstring/StringBuffer.)
ch (read-char reader)]
(cond
(nil? ch) (reader-error reader "EOF while reading")
(identical? "\\" ch) (do (.append buffer ch)
(let [nch (read-char reader)]
(if (nil? nch)
(reader-error reader "EOF while reading")
(recur (doto buffer (.append nch))
(read-char reader)))))
(identical? "\"" ch) (.toString buffer)
:else (recur (doto buffer (.append ch)) (read-char reader)))))
(defn special-symbols [t not-found]
(cond
(identical? t "nil") nil
(identical? t "true") true
(identical? t "false") false
(identical? t "/") '/
:else not-found))
(defn read-symbol
[reader initch]
(let [token (read-token reader initch)]
(if (and (gstring/contains token "/")
(not (== (.-length token) 1)))
(symbol (subs token 0 (.indexOf token "/"))
(subs token (inc (.indexOf token "/"))
(.-length token)))
(special-symbols token (symbol token)))))
(defn read-literal
[rdr ch]
(let [token (read-token rdr ch)
chars (subs token 1)]
(cond (identical? (.-length chars) 1) chars
(identical? chars "tab") "\t"
(identical? chars "return") "\r"
(identical? chars "newline") "\n"
(identical? chars "space") " "
(identical? chars "backspace") "\b"
(identical? chars "formfeed") "\f"
(identical? (.charAt chars 0) "u") (make-unicode-char (subs chars 1))
(identical? (.charAt chars 0) "o") (not-implemented rdr token)
:else (reader-error rdr "Unknown character literal: " token))))
(defn read-keyword
[reader initch]
(let [token (read-token reader (read-char reader))
a (re-matches* symbol-pattern token)
token (aget a 0)
ns (aget a 1)
name (aget a 2)]
(if (or (and (not (undefined? ns))
(identical? (. ns (substring (- (.-length ns) 2) (.-length ns))) ":/"))
(identical? (aget name (dec (.-length name))) ":")
(not (== (.indexOf token "::" 1) -1)))
(reader-error reader "Invalid token: " token)
(if (and (not (nil? ns)) (> (.-length ns) 0))
(keyword (.substring ns 0 (.indexOf ns "/")) name)
(keyword token)))))
(defn desugar-meta
[f]
(cond
(symbol? f) {:tag f}
(string? f) {:tag f}
(keyword? f) {f true}
:else f))
(defn wrapping-reader
[sym]
(fn [rdr _]
(list sym (read rdr true nil true))))
(defn throwing-reader
[msg]
(fn [rdr _]
(reader-error rdr msg)))
(defn read-meta
[rdr _]
(let [m (desugar-meta (read rdr true nil true))]
(when-not (map? m)
(reader-error rdr "Metadata must be Symbol,Keyword,String or Map"))
(let [o (read rdr true nil true)]
(if (satisfies? IWithMeta o)
(with-meta o (merge (meta o) m))
(reader-error rdr "Metadata can only be applied to IWithMetas")))))
(defn read-set
[rdr _]
(.fromArray PersistentHashSet (read-delimited-list "}" rdr true) true))
(defn read-regex
[rdr ch]
(-> (read-raw-string* rdr ch) re-pattern))
(defn read-discard
[rdr _]
(read rdr true nil true)
rdr)
(defn macros [c]
(cond
(identical? c \") read-string*
(identical? c \:) read-keyword
(identical? c \;) read-comment
(identical? c \') (wrapping-reader 'quote)
(identical? c \@) (wrapping-reader 'deref)
(identical? c \^) read-meta
(identical? c \`) not-implemented
(identical? c \~) not-implemented
(identical? c \() read-list
(identical? c \)) read-unmatched-delimiter
(identical? c \[) read-vector
(identical? c \]) read-unmatched-delimiter
(identical? c \{) read-map
(identical? c \}) read-unmatched-delimiter
(identical? c \\) read-literal
(identical? c \#) read-dispatch
:else nil))
;; omitted by design: var reader, eval reader
(defn dispatch-macros [s]
(cond
(identical? s "{") read-set
(identical? s "<") (throwing-reader "Unreadable form")
(identical? s "\"") read-regex
(identical? s"!") read-comment
(identical? s "_") read-discard
:else nil))
(defn read
"Reads the first object from a PushbackReader. Returns the object read.
If EOF, throws if eof-is-error is true. Otherwise returns sentinel.
Only supports edn (similar to clojure.edn/read)"
[reader eof-is-error sentinel is-recursive]
(let [ch (read-char reader)]
(cond
(nil? ch) (if eof-is-error (reader-error reader "EOF while reading") sentinel)
(whitespace? ch) (recur reader eof-is-error sentinel is-recursive)
(comment-prefix? ch) (recur (read-comment reader ch) eof-is-error sentinel is-recursive)
:else (let [f (macros ch)
res
(cond
f (f reader ch)
(number-literal? reader ch) (read-number reader ch)
:else (read-symbol reader ch))]
(if (identical? res reader)
(recur reader eof-is-error sentinel is-recursive)
res)))))
(defn read-string
"Reads one object from the string s"
[s]
(when-not (string? s)
(throw (js/Error. "Cannot read from non-string object.")))
(let [r (push-back-reader s)]
(read r false nil false)))
;; read instances
(defn ^:private zero-fill-right-and-truncate [s width]
(cond (= width (count s)) s
(< width (count s)) (subs s 0 width)
:else (loop [b (StringBuffer. s)]
(if (< (.getLength b) width)
(recur (.append b "0"))
(.toString b)))))
(defn ^:private divisible?
[num div]
(zero? (mod num div)))
(defn ^:private indivisible?
[num div]
(not (divisible? num div)))
(defn ^:private leap-year?
[year]
(and (divisible? year 4)
(or (indivisible? year 100)
(divisible? year 400))))
(def ^:private days-in-month
(let [dim-norm [nil 31 28 31 30 31 30 31 31 30 31 30 31]
dim-leap [nil 31 29 31 30 31 30 31 31 30 31 30 31]]
(fn [month leap-year?]
(get (if leap-year? dim-leap dim-norm) month))))
(def ^:private timestamp-regex #"(\d\d\d\d)(?:-(\d\d)(?:-(\d\d)(?:[T](\d\d)(?::(\d\d)(?::(\d\d)(?:[.](\d+))?)?)?)?)?)?(?:[Z]|([-+])(\d\d):(\d\d))?")
(defn ^:private parse-int [s]
(let [n (js/parseInt s 10)]
(if-not (js/isNaN n)
n)))
(defn ^:private check [low n high msg]
(when-not (<= low n high)
(reader-error nil (str msg " Failed: " low "<=" n "<=" high)))
n)
(defn parse-and-validate-timestamp [s]
(let [[_ years months days hours minutes seconds fraction offset-sign offset-hours offset-minutes :as v]
(re-matches timestamp-regex s)]
(if-not v
(reader-error nil (str "Unrecognized date/time syntax: " s))
(let [years (parse-int years)
months (or (parse-int months) 1)
days (or (parse-int days) 1)
hours (or (parse-int hours) 0)
minutes (or (parse-int minutes) 0)
seconds (or (parse-int seconds) 0)
fraction (or (parse-int (zero-fill-right-and-truncate fraction 3)) 0)
offset-sign (if (= offset-sign "-") -1 1)
offset-hours (or (parse-int offset-hours) 0)
offset-minutes (or (parse-int offset-minutes) 0)
offset (* offset-sign (+ (* offset-hours 60) offset-minutes))]
[years
(check 1 months 12 "timestamp month field must be in range 1..12")
(check 1 days (days-in-month months (leap-year? years)) "timestamp day field must be in range 1..last day in month")
(check 0 hours 23 "timestamp hour field must be in range 0..23")
(check 0 minutes 59 "timestamp minute field must be in range 0..59")
(check 0 seconds (if (= minutes 59) 60 59) "timestamp second field must be in range 0..60")
(check 0 fraction 999 "timestamp millisecond field must be in range 0..999")
offset]))))
(defn parse-timestamp
[ts]
(if-let [[years months days hours minutes seconds ms offset]
(parse-and-validate-timestamp ts)]
(js/Date.
(- (.UTC js/Date years (dec months) days hours minutes seconds ms)
(* offset 60 1000)))
(reader-error nil (str "Unrecognized date/time syntax: " ts))))
(defn ^:private read-date
[s]
(if (string? s)
(parse-timestamp s)
(reader-error nil "Instance literal expects a string for its timestamp.")))
(defn ^:private read-queue
[elems]
(if (vector? elems)
(into cljs.core.PersistentQueue.EMPTY elems)
(reader-error nil "Queue literal expects a vector for its elements.")))
(defn ^:private read-js
[form]
(cond
(vector? form)
(let [arr (array)]
(doseq [x form]
(.push arr x))
arr)
(map? form)
(let [obj (js-obj)]
(doseq [[k v] form]
(aset obj (name k) v))
obj)
:else
(reader-error nil
(str "JS literal expects a vector or map containing "
"only string or unqualified keyword keys"))))
(defn ^:private read-uuid
[uuid]
(if (string? uuid)
(cljs.core/uuid uuid)
(reader-error nil "UUID literal expects a string as its representation.")))
(def ^:dynamic *tag-table*
(atom {"inst" read-date
"uuid" read-uuid
"queue" read-queue
"js" read-js}))
(def ^:dynamic *default-data-reader-fn*
(atom nil))
(defn maybe-read-tagged-type
[rdr initch]
(let [tag (read-symbol rdr initch)
pfn (get @*tag-table* (str tag))
dfn @*default-data-reader-fn*]
(cond
pfn (pfn (read rdr true nil false))
dfn (dfn tag (read rdr true nil false))
:else (reader-error rdr
"Could not find tag parser for " (str tag)
" in " (pr-str (keys @*tag-table*))))))
(defn register-tag-parser!
[tag f]
(let [tag (str tag)
old-parser (get @*tag-table* tag)]
(swap! *tag-table* assoc tag f)
old-parser))
(defn deregister-tag-parser!
[tag]
(let [tag (str tag)
old-parser (get @*tag-table* tag)]
(swap! *tag-table* dissoc tag)
old-parser))
(defn register-default-tag-parser!
[f]
(let [old-parser @*default-data-reader-fn*]
(swap! *default-data-reader-fn* (fn [_] f))
old-parser))
(defn deregister-default-tag-parser!
[]
(let [old-parser @*default-data-reader-fn*]
(swap! *default-data-reader-fn* (fn [_] nil))
old-parser))

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

View file

@ -1,56 +0,0 @@
;; Copyright (c) Rich Hickey. All rights reserved.
;; The use and distribution terms for this software are covered by the
;; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
;; which can be found in the file epl-v10.html at the root of this distribution.
;; By using this software in any fashion, you are agreeing to be bound by
;; the terms of this license.
;; You must not remove this notice, or any other, from this software.
(ns cljs.repl
(:require-macros cljs.repl)
(:require [cljs.spec :as spec]))
(defn print-doc [{n :ns nm :name :as m}]
(println "-------------------------")
(println (str (when-let [ns (:ns m)] (str ns "/")) (:name m)))
(when (:protocol m)
(println "Protocol"))
(cond
(:forms m) (doseq [f (:forms m)]
(println " " f))
(:arglists m) (let [arglists (:arglists m)]
(if (or (:macro m)
(:repl-special-function m))
(prn arglists)
(prn
(if (= 'quote (first arglists))
(second arglists)
arglists)))))
(if (:special-form m)
(do
(println "Special Form")
(println " " (:doc m))
(if (contains? m :url)
(when (:url m)
(println (str "\n Please see http://clojure.org/" (:url m))))
(println (str "\n Please see http://clojure.org/special_forms#"
(:name m)))))
(do
(when (:macro m)
(println "Macro"))
(when (:repl-special-function m)
(println "REPL Special Function"))
(println " " (:doc m))
(when (:protocol m)
(doseq [[name {:keys [doc arglists]}] (:methods m)]
(println)
(println " " name)
(println " " arglists)
(when doc
(println " " doc))))
(when n
(when-let [fnspec (spec/get-spec (symbol (str (ns-name n)) (name nm)))]
(print "Spec")
(doseq [role [:args :ret :fn]]
(when-let [spec (get fnspec role)]
(print (str "\n " (name role) ":") (spec/describe spec)))))))))

View file

@ -1 +0,0 @@
{:rename-macros {}, :renames {}, :use-macros {}, :excludes #{}, :name cljs.repl, :imports nil, :requires {spec cljs.spec, cljs.spec cljs.spec}, :uses nil, :defs {print-doc {:protocol-inline nil, :meta {:file "/Users/simon/workspace/swinging-needle-meter/docs/js/compiled/out/cljs/repl.cljs", :line 13, :column 7, :end-line 13, :end-column 16, :arglists (quote ([{n :ns, nm :name, :as m}]))}, :name cljs.repl/print-doc, :variadic false, :file "docs/js/compiled/out/cljs/repl.cljs", :end-column 16, :method-params ([p__37649]), :protocol-impl nil, :arglists-meta (nil nil), :column 1, :line 13, :end-line 13, :max-fixed-arity 1, :fn-var true, :arglists (quote ([{n :ns, nm :name, :as m}]))}}, :require-macros {cljs.repl cljs.repl, spec cljs.spec, cljs.spec cljs.spec}, :cljs.analyzer/constants {:seen #{:args :ret :fn :protocol :ns :name :special-form :repl-special-function :methods :macro :url quote :arglists :doc :forms}, :order [:ns :name :protocol :forms :arglists :macro :repl-special-function quote :special-form :doc :url :methods :args :ret :fn]}, :doc nil}

View file

@ -1,287 +0,0 @@
// Compiled by ClojureScript 1.9.229 {}
goog.provide('cljs.repl');
goog.require('cljs.core');
goog.require('cljs.spec');
cljs.repl.print_doc = (function cljs$repl$print_doc(p__37649){
var map__37674 = p__37649;
var map__37674__$1 = ((((!((map__37674 == null)))?((((map__37674.cljs$lang$protocol_mask$partition0$ & (64))) || (map__37674.cljs$core$ISeq$))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__37674):map__37674);
var m = map__37674__$1;
var n = cljs.core.get.call(null,map__37674__$1,new cljs.core.Keyword(null,"ns","ns",441598760));
var nm = cljs.core.get.call(null,map__37674__$1,new cljs.core.Keyword(null,"name","name",1843675177));
cljs.core.println.call(null,"-------------------------");
cljs.core.println.call(null,[cljs.core.str((function (){var temp__4657__auto__ = new cljs.core.Keyword(null,"ns","ns",441598760).cljs$core$IFn$_invoke$arity$1(m);
if(cljs.core.truth_(temp__4657__auto__)){
var ns = temp__4657__auto__;
return [cljs.core.str(ns),cljs.core.str("/")].join('');
} else {
return null;
}
})()),cljs.core.str(new cljs.core.Keyword(null,"name","name",1843675177).cljs$core$IFn$_invoke$arity$1(m))].join(''));
if(cljs.core.truth_(new cljs.core.Keyword(null,"protocol","protocol",652470118).cljs$core$IFn$_invoke$arity$1(m))){
cljs.core.println.call(null,"Protocol");
} else {
}
if(cljs.core.truth_(new cljs.core.Keyword(null,"forms","forms",2045992350).cljs$core$IFn$_invoke$arity$1(m))){
var seq__37676_37698 = cljs.core.seq.call(null,new cljs.core.Keyword(null,"forms","forms",2045992350).cljs$core$IFn$_invoke$arity$1(m));
var chunk__37677_37699 = null;
var count__37678_37700 = (0);
var i__37679_37701 = (0);
while(true){
if((i__37679_37701 < count__37678_37700)){
var f_37702 = cljs.core._nth.call(null,chunk__37677_37699,i__37679_37701);
cljs.core.println.call(null," ",f_37702);
var G__37703 = seq__37676_37698;
var G__37704 = chunk__37677_37699;
var G__37705 = count__37678_37700;
var G__37706 = (i__37679_37701 + (1));
seq__37676_37698 = G__37703;
chunk__37677_37699 = G__37704;
count__37678_37700 = G__37705;
i__37679_37701 = G__37706;
continue;
} else {
var temp__4657__auto___37707 = cljs.core.seq.call(null,seq__37676_37698);
if(temp__4657__auto___37707){
var seq__37676_37708__$1 = temp__4657__auto___37707;
if(cljs.core.chunked_seq_QMARK_.call(null,seq__37676_37708__$1)){
var c__25941__auto___37709 = cljs.core.chunk_first.call(null,seq__37676_37708__$1);
var G__37710 = cljs.core.chunk_rest.call(null,seq__37676_37708__$1);
var G__37711 = c__25941__auto___37709;
var G__37712 = cljs.core.count.call(null,c__25941__auto___37709);
var G__37713 = (0);
seq__37676_37698 = G__37710;
chunk__37677_37699 = G__37711;
count__37678_37700 = G__37712;
i__37679_37701 = G__37713;
continue;
} else {
var f_37714 = cljs.core.first.call(null,seq__37676_37708__$1);
cljs.core.println.call(null," ",f_37714);
var G__37715 = cljs.core.next.call(null,seq__37676_37708__$1);
var G__37716 = null;
var G__37717 = (0);
var G__37718 = (0);
seq__37676_37698 = G__37715;
chunk__37677_37699 = G__37716;
count__37678_37700 = G__37717;
i__37679_37701 = G__37718;
continue;
}
} else {
}
}
break;
}
} else {
if(cljs.core.truth_(new cljs.core.Keyword(null,"arglists","arglists",1661989754).cljs$core$IFn$_invoke$arity$1(m))){
var arglists_37719 = new cljs.core.Keyword(null,"arglists","arglists",1661989754).cljs$core$IFn$_invoke$arity$1(m);
if(cljs.core.truth_((function (){var or__25130__auto__ = new cljs.core.Keyword(null,"macro","macro",-867863404).cljs$core$IFn$_invoke$arity$1(m);
if(cljs.core.truth_(or__25130__auto__)){
return or__25130__auto__;
} else {
return new cljs.core.Keyword(null,"repl-special-function","repl-special-function",1262603725).cljs$core$IFn$_invoke$arity$1(m);
}
})())){
cljs.core.prn.call(null,arglists_37719);
} else {
cljs.core.prn.call(null,((cljs.core._EQ_.call(null,new cljs.core.Symbol(null,"quote","quote",1377916282,null),cljs.core.first.call(null,arglists_37719)))?cljs.core.second.call(null,arglists_37719):arglists_37719));
}
} else {
}
}
if(cljs.core.truth_(new cljs.core.Keyword(null,"special-form","special-form",-1326536374).cljs$core$IFn$_invoke$arity$1(m))){
cljs.core.println.call(null,"Special Form");
cljs.core.println.call(null," ",new cljs.core.Keyword(null,"doc","doc",1913296891).cljs$core$IFn$_invoke$arity$1(m));
if(cljs.core.contains_QMARK_.call(null,m,new cljs.core.Keyword(null,"url","url",276297046))){
if(cljs.core.truth_(new cljs.core.Keyword(null,"url","url",276297046).cljs$core$IFn$_invoke$arity$1(m))){
return cljs.core.println.call(null,[cljs.core.str("\n Please see http://clojure.org/"),cljs.core.str(new cljs.core.Keyword(null,"url","url",276297046).cljs$core$IFn$_invoke$arity$1(m))].join(''));
} else {
return null;
}
} else {
return cljs.core.println.call(null,[cljs.core.str("\n Please see http://clojure.org/special_forms#"),cljs.core.str(new cljs.core.Keyword(null,"name","name",1843675177).cljs$core$IFn$_invoke$arity$1(m))].join(''));
}
} else {
if(cljs.core.truth_(new cljs.core.Keyword(null,"macro","macro",-867863404).cljs$core$IFn$_invoke$arity$1(m))){
cljs.core.println.call(null,"Macro");
} else {
}
if(cljs.core.truth_(new cljs.core.Keyword(null,"repl-special-function","repl-special-function",1262603725).cljs$core$IFn$_invoke$arity$1(m))){
cljs.core.println.call(null,"REPL Special Function");
} else {
}
cljs.core.println.call(null," ",new cljs.core.Keyword(null,"doc","doc",1913296891).cljs$core$IFn$_invoke$arity$1(m));
if(cljs.core.truth_(new cljs.core.Keyword(null,"protocol","protocol",652470118).cljs$core$IFn$_invoke$arity$1(m))){
var seq__37680_37720 = cljs.core.seq.call(null,new cljs.core.Keyword(null,"methods","methods",453930866).cljs$core$IFn$_invoke$arity$1(m));
var chunk__37681_37721 = null;
var count__37682_37722 = (0);
var i__37683_37723 = (0);
while(true){
if((i__37683_37723 < count__37682_37722)){
var vec__37684_37724 = cljs.core._nth.call(null,chunk__37681_37721,i__37683_37723);
var name_37725 = cljs.core.nth.call(null,vec__37684_37724,(0),null);
var map__37687_37726 = cljs.core.nth.call(null,vec__37684_37724,(1),null);
var map__37687_37727__$1 = ((((!((map__37687_37726 == null)))?((((map__37687_37726.cljs$lang$protocol_mask$partition0$ & (64))) || (map__37687_37726.cljs$core$ISeq$))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__37687_37726):map__37687_37726);
var doc_37728 = cljs.core.get.call(null,map__37687_37727__$1,new cljs.core.Keyword(null,"doc","doc",1913296891));
var arglists_37729 = cljs.core.get.call(null,map__37687_37727__$1,new cljs.core.Keyword(null,"arglists","arglists",1661989754));
cljs.core.println.call(null);
cljs.core.println.call(null," ",name_37725);
cljs.core.println.call(null," ",arglists_37729);
if(cljs.core.truth_(doc_37728)){
cljs.core.println.call(null," ",doc_37728);
} else {
}
var G__37730 = seq__37680_37720;
var G__37731 = chunk__37681_37721;
var G__37732 = count__37682_37722;
var G__37733 = (i__37683_37723 + (1));
seq__37680_37720 = G__37730;
chunk__37681_37721 = G__37731;
count__37682_37722 = G__37732;
i__37683_37723 = G__37733;
continue;
} else {
var temp__4657__auto___37734 = cljs.core.seq.call(null,seq__37680_37720);
if(temp__4657__auto___37734){
var seq__37680_37735__$1 = temp__4657__auto___37734;
if(cljs.core.chunked_seq_QMARK_.call(null,seq__37680_37735__$1)){
var c__25941__auto___37736 = cljs.core.chunk_first.call(null,seq__37680_37735__$1);
var G__37737 = cljs.core.chunk_rest.call(null,seq__37680_37735__$1);
var G__37738 = c__25941__auto___37736;
var G__37739 = cljs.core.count.call(null,c__25941__auto___37736);
var G__37740 = (0);
seq__37680_37720 = G__37737;
chunk__37681_37721 = G__37738;
count__37682_37722 = G__37739;
i__37683_37723 = G__37740;
continue;
} else {
var vec__37689_37741 = cljs.core.first.call(null,seq__37680_37735__$1);
var name_37742 = cljs.core.nth.call(null,vec__37689_37741,(0),null);
var map__37692_37743 = cljs.core.nth.call(null,vec__37689_37741,(1),null);
var map__37692_37744__$1 = ((((!((map__37692_37743 == null)))?((((map__37692_37743.cljs$lang$protocol_mask$partition0$ & (64))) || (map__37692_37743.cljs$core$ISeq$))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__37692_37743):map__37692_37743);
var doc_37745 = cljs.core.get.call(null,map__37692_37744__$1,new cljs.core.Keyword(null,"doc","doc",1913296891));
var arglists_37746 = cljs.core.get.call(null,map__37692_37744__$1,new cljs.core.Keyword(null,"arglists","arglists",1661989754));
cljs.core.println.call(null);
cljs.core.println.call(null," ",name_37742);
cljs.core.println.call(null," ",arglists_37746);
if(cljs.core.truth_(doc_37745)){
cljs.core.println.call(null," ",doc_37745);
} else {
}
var G__37747 = cljs.core.next.call(null,seq__37680_37735__$1);
var G__37748 = null;
var G__37749 = (0);
var G__37750 = (0);
seq__37680_37720 = G__37747;
chunk__37681_37721 = G__37748;
count__37682_37722 = G__37749;
i__37683_37723 = G__37750;
continue;
}
} else {
}
}
break;
}
} else {
}
if(cljs.core.truth_(n)){
var temp__4657__auto__ = cljs.spec.get_spec.call(null,cljs.core.symbol.call(null,[cljs.core.str(cljs.core.ns_name.call(null,n))].join(''),cljs.core.name.call(null,nm)));
if(cljs.core.truth_(temp__4657__auto__)){
var fnspec = temp__4657__auto__;
cljs.core.print.call(null,"Spec");
var seq__37694 = cljs.core.seq.call(null,new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"args","args",1315556576),new cljs.core.Keyword(null,"ret","ret",-468222814),new cljs.core.Keyword(null,"fn","fn",-1175266204)], null));
var chunk__37695 = null;
var count__37696 = (0);
var i__37697 = (0);
while(true){
if((i__37697 < count__37696)){
var role = cljs.core._nth.call(null,chunk__37695,i__37697);
var temp__4657__auto___37751__$1 = cljs.core.get.call(null,fnspec,role);
if(cljs.core.truth_(temp__4657__auto___37751__$1)){
var spec_37752 = temp__4657__auto___37751__$1;
cljs.core.print.call(null,[cljs.core.str("\n "),cljs.core.str(cljs.core.name.call(null,role)),cljs.core.str(":")].join(''),cljs.spec.describe.call(null,spec_37752));
} else {
}
var G__37753 = seq__37694;
var G__37754 = chunk__37695;
var G__37755 = count__37696;
var G__37756 = (i__37697 + (1));
seq__37694 = G__37753;
chunk__37695 = G__37754;
count__37696 = G__37755;
i__37697 = G__37756;
continue;
} else {
var temp__4657__auto____$1 = cljs.core.seq.call(null,seq__37694);
if(temp__4657__auto____$1){
var seq__37694__$1 = temp__4657__auto____$1;
if(cljs.core.chunked_seq_QMARK_.call(null,seq__37694__$1)){
var c__25941__auto__ = cljs.core.chunk_first.call(null,seq__37694__$1);
var G__37757 = cljs.core.chunk_rest.call(null,seq__37694__$1);
var G__37758 = c__25941__auto__;
var G__37759 = cljs.core.count.call(null,c__25941__auto__);
var G__37760 = (0);
seq__37694 = G__37757;
chunk__37695 = G__37758;
count__37696 = G__37759;
i__37697 = G__37760;
continue;
} else {
var role = cljs.core.first.call(null,seq__37694__$1);
var temp__4657__auto___37761__$2 = cljs.core.get.call(null,fnspec,role);
if(cljs.core.truth_(temp__4657__auto___37761__$2)){
var spec_37762 = temp__4657__auto___37761__$2;
cljs.core.print.call(null,[cljs.core.str("\n "),cljs.core.str(cljs.core.name.call(null,role)),cljs.core.str(":")].join(''),cljs.spec.describe.call(null,spec_37762));
} else {
}
var G__37763 = cljs.core.next.call(null,seq__37694__$1);
var G__37764 = null;
var G__37765 = (0);
var G__37766 = (0);
seq__37694 = G__37763;
chunk__37695 = G__37764;
count__37696 = G__37765;
i__37697 = G__37766;
continue;
}
} else {
return null;
}
}
break;
}
} else {
return null;
}
} else {
return null;
}
}
});
//# sourceMappingURL=repl.js.map?rel=1603199205844

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

View file

@ -1,179 +0,0 @@
; Copyright (c) Rich Hickey. All rights reserved.
; The use and distribution terms for this software are covered by the
; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
; which can be found in the file epl-v10.html at the root of this distribution.
; By using this software in any fashion, you are agreeing to be bound by
; the terms of this license.
; You must not remove this notice, or any other, from this software.
(ns cljs.spec.impl.gen
(:refer-clojure :exclude [boolean cat hash-map list map not-empty set vector
char double int keyword symbol string uuid delay])
(:require-macros [cljs.core :as c]
[cljs.spec.impl.gen :as gen :refer [dynaload lazy-combinators lazy-prims]])
(:require [cljs.core :as c]))
(deftype LazyVar [f ^:mutable cached]
IDeref
(-deref [this]
(if-not (nil? cached)
cached
(let [x (f)]
(when-not (nil? x)
(set! cached x))
x))))
(def ^:private quick-check-ref
(dynaload 'clojure.test.check/quick-check))
(defn quick-check
[& args]
(apply @quick-check-ref args))
(def ^:private for-all*-ref
(dynaload 'clojure.test.check.properties/for-all*))
(defn for-all*
"Dynamically loaded clojure.test.check.properties/for-all*."
[& args]
(apply @for-all*-ref args))
(let [g? (dynaload 'clojure.test.check.generators/generator?)
g (dynaload 'clojure.test.check.generators/generate)
mkg (dynaload 'clojure.test.check.generators/->Generator)]
(defn- generator?
[x]
(@g? x))
(defn- generator
[gfn]
(@mkg gfn))
(defn generate
"Generate a single value using generator."
[generator]
(@g generator)))
(defn ^:skip-wiki delay-impl
[gfnd]
;;N.B. depends on test.check impl details
(generator (fn [rnd size]
((:gen @gfnd) rnd size))))
;(defn gen-for-name
; "Dynamically loads test.check generator named s."
; [s]
; (let [g (dynaload s)]
; (if (generator? g)
; g
; (throw (js/Error. (str "Var " s " is not a generator"))))))
(lazy-combinators hash-map list map not-empty set vector vector-distinct fmap elements
bind choose one-of such-that tuple sample return
large-integer* double*)
(lazy-prims any any-printable boolean char char-alpha char-alphanumeric char-ascii double
int keyword keyword-ns large-integer ratio simple-type simple-type-printable
string string-ascii string-alphanumeric symbol symbol-ns uuid)
(defn cat
"Returns a generator of a sequence catenated from results of
gens, each of which should generate something sequential."
[& gens]
(fmap #(apply concat %)
(apply tuple gens)))
(defn- ^boolean qualified? [ident] (not (nil? (namespace ident))))
(def ^:private
gen-builtins
(c/delay
(let [simple (simple-type-printable)]
{any? (one-of [(return nil) (any-printable)])
number? (one-of [(large-integer) (double)])
integer? (large-integer)
int? (large-integer)
pos-int? (large-integer* {:min 1})
neg-int? (large-integer* {:max -1})
nat-int? (large-integer* {:min 0})
;float? (double)
string? (string-alphanumeric)
ident? (one-of [(keyword-ns) (symbol-ns)])
simple-ident? (one-of [(keyword) (symbol)])
qualified-ident? (such-that qualified? (one-of [(keyword-ns) (symbol-ns)]))
keyword? (keyword-ns)
simple-keyword? (keyword)
qualified-keyword? (such-that qualified? (keyword-ns))
symbol? (symbol-ns)
simple-symbol? (symbol)
qualified-symbol? (such-that qualified? (symbol-ns))
uuid? (uuid)
inst? (fmap #(js/Date. %)
(large-integer))
seqable? (one-of [(return nil)
(list simple)
(vector simple)
(map simple simple)
(set simple)
(string-alphanumeric)])
indexed? (vector simple)
map? (map simple simple)
vector? (vector simple)
list? (list simple)
seq? (list simple)
char? (char)
set? (set simple)
nil? (return nil)
false? (return false)
true? (return true)
boolean? (boolean)
zero? (return 0)
;rational? (one-of [(large-integer) (ratio)])
coll? (one-of [(map simple simple)
(list simple)
(vector simple)
(set simple)])
empty? (elements [nil '() [] {} #{}])
associative? (one-of [(map simple simple) (vector simple)])
sequential? (one-of [(list simple) (vector simple)])
;ratio? (such-that ratio? (ratio))
})))
(defn gen-for-pred
"Given a predicate, returns a built-in generator if one exists."
[pred]
(if (set? pred)
(elements pred)
(get @gen-builtins pred)))
(comment
(require 'clojure.test.check)
(require 'clojure.test.check.properties)
(require 'cljs.spec.impl.gen)
(in-ns 'cljs.spec.impl.gen)
;; combinators, see call to lazy-combinators above for complete list
(generate (one-of [(gen-for-pred integer?) (gen-for-pred string?)]))
(generate (such-that #(< 10000 %) (gen-for-pred integer?)))
(let [reqs {:a (gen-for-pred number?)
:b (gen-for-pred keyword?)}
opts {:c (gen-for-pred string?)}]
(generate (bind (choose 0 (count opts))
#(let [args (concat (seq reqs) (shuffle (seq opts)))]
(->> args
(take (+ % (count reqs)))
(mapcat identity)
(apply hash-map))))))
(generate (cat (list (gen-for-pred string?))
(list (gen-for-pred integer?))))
;; load your own generator
;(gen-for-name 'clojure.test.check.generators/int)
;; failure modes
;(gen-for-name 'unqualified)
;(gen-for-name 'clojure.core/+)
;(gen-for-name 'clojure.core/name-does-not-exist)
;(gen-for-name 'ns.does.not.exist/f)
)

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

View file

@ -1,692 +0,0 @@
;; Copyright (c) Rich Hickey. All rights reserved.
;; The use and distribution terms for this software are covered by the
;; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
;; which can be found in the file epl-v10.html at the root of this distribution.
;; By using this software in any fashion, you are agreeing to be bound by
;; the terms of this license.
;; You must not remove this notice, or any other, from this software.
(ns cljs.stacktrace
(:require #?@(:clj [[cljs.util :as util]
[clojure.java.io :as io]]
:cljs [[goog.string :as gstring]])
[clojure.string :as string])
#?(:clj (:import [java.util.regex Pattern]
[java.io File])))
(defmulti parse-stacktrace
"Parse a JavaScript stacktrace string into a canonical data form. The
arguments:
repl-env - the repl environment, an optional map with :host and :port keys
if the stacktrace includes url, not file references
st - the original stacktrace string to parse
err - an error map. :ua-product key defines the type of stacktrace parser
to use, for example :chrome
opts - additional options. :output-dir maybe given in this argument if
:host and :port do not apply, for example, a file path
The canonical stacktrace representation can easily be mapped to a
ClojureScript one see mapped-stacktrace and mapped-stacktrace-str"
(fn [repl-env st err opts] (:ua-product err)))
(defn parse-int [s]
#?(:clj (Long/parseLong s)
:cljs (js/parseInt s 10)))
(defn starts-with?
#?(:cljs {:tag boolean})
[^String s0 s1]
#?(:clj (.startsWith s0 s1)
:cljs (gstring/startsWith s0 s1)))
(defn ends-with?
#?(:cljs {:tag boolean})
[^String s0 s1]
#?(:clj (.endsWith s0 s1)
:cljs (gstring/endsWith s0 s1)))
(defn string->regex [s]
#?(:clj (Pattern/compile s)
:cljs (js/RegExp. s)))
(defn output-directory [opts]
#?(:clj (util/output-directory opts)
:cljs (or (:output-dir opts) "out")))
(defmethod parse-stacktrace :default
[repl-env st err opts] st)
(defn parse-file-line-column [flc]
(if-not (re-find #":" flc)
[flc nil nil]
(let [xs (string/split flc #":")
[pre [line column]]
(reduce
(fn [[pre post] [x i]]
(if (<= i 2)
[pre (conj post x)]
[(conj pre x) post]))
[[] []] (map vector xs (range (count xs) 0 -1)))
file (string/join ":" pre)]
[(cond-> file
(starts-with? file "(") (string/replace "(" ""))
(parse-int
(cond-> line
(ends-with? line ")") (string/replace ")" "")))
(parse-int
(cond-> column
(ends-with? column ")") (string/replace ")" "")))])))
(defn parse-file
"Given a browser file url convert it into a relative path that can be used
to locate the original source."
[{:keys [host host-port port] :as repl-env} file {:keys [asset-path] :as opts}]
(let [urlpat (if host
(string->regex
(str "http://" host ":" (or host-port port) "/"))
"")
match (if host
(re-find urlpat file)
(contains? opts :output-dir))]
(if match
(-> file
(string/replace urlpat "")
(string/replace
(string->regex
;; if :asset-path specified drop leading slash
(str "^" (or (and asset-path (string/replace asset-path #"^/" ""))
(output-directory opts)) "/"))
""))
(if-let [asset-root (:asset-root opts)]
(string/replace file asset-root "")
(throw
(ex-info (str "Could not relativize URL " file)
{:type :parse-stacktrace
:reason :relativize-url}))))))
;; -----------------------------------------------------------------------------
;; Chrome Stacktrace
(defn chrome-st-el->frame
[repl-env st-el opts]
(let [xs (-> st-el
(string/replace #"\s+at\s+" "")
(string/split #"\s+"))
[function flc] (if (== 1 (count xs))
[nil (first xs)]
[(first xs) (last xs)])
[file line column] (parse-file-line-column flc)]
(if (and file function line column)
{:file (parse-file repl-env file opts)
:function (string/replace function #"Object\." "")
:line line
:column column}
(when-not (string/blank? function)
{:file nil
:function (string/replace function #"Object\." "")
:line nil
:column nil}))))
(comment
(chrome-st-el->frame {:host "localhost" :port 9000}
"\tat cljs$core$ffirst (http://localhost:9000/out/cljs/core.js:5356:34)" {})
)
(defmethod parse-stacktrace :chrome
[repl-env st err opts]
(->> st
string/split-lines
(drop-while #(starts-with? % "Error"))
(take-while #(not (starts-with? % " at eval")))
(map #(chrome-st-el->frame repl-env % opts))
(remove nil?)
vec))
(comment
(parse-stacktrace {:host "localhost" :port 9000}
"Error: 1 is not ISeqable
at Object.cljs$core$seq [as seq] (http://localhost:9000/out/cljs/core.js:4258:8)
at Object.cljs$core$first [as first] (http://localhost:9000/out/cljs/core.js:4288:19)
at cljs$core$ffirst (http://localhost:9000/out/cljs/core.js:5356:34)
at http://localhost:9000/out/cljs/core.js:16971:89
at cljs.core.map.cljs$core$map__2 (http://localhost:9000/out/cljs/core.js:16972:3)
at http://localhost:9000/out/cljs/core.js:10981:129
at cljs.core.LazySeq.sval (http://localhost:9000/out/cljs/core.js:10982:3)
at cljs.core.LazySeq.cljs$core$ISeqable$_seq$arity$1 (http://localhost:9000/out/cljs/core.js:11073:10)
at Object.cljs$core$seq [as seq] (http://localhost:9000/out/cljs/core.js:4239:13)
at Object.cljs$core$pr_sequential_writer [as pr_sequential_writer] (http://localhost:9000/out/cljs/core.js:28706:14)"
{:ua-product :chrome}
nil)
(parse-stacktrace {:host "localhost" :port 9000}
"Error: 1 is not ISeqable
at Object.cljs$core$seq [as seq] (http://localhost:9000/js/cljs/core.js:4258:8)
at Object.cljs$core$first [as first] (http://localhost:9000/js/cljs/core.js:4288:19)
at cljs$core$ffirst (http://localhost:9000/js/cljs/core.js:5356:34)
at http://localhost:9000/js/cljs/core.js:16971:89
at cljs.core.map.cljs$core$map__2 (http://localhost:9000/js/cljs/core.js:16972:3)
at http://localhost:9000/js/cljs/core.js:10981:129
at cljs.core.LazySeq.sval (http://localhost:9000/js/cljs/core.js:10982:3)
at cljs.core.LazySeq.cljs$core$ISeqable$_seq$arity$1 (http://localhost:9000/js/cljs/core.js:11073:10)
at Object.cljs$core$seq [as seq] (http://localhost:9000/js/cljs/core.js:4239:13)
at Object.cljs$core$pr_sequential_writer [as pr_sequential_writer] (http://localhost:9000/js/cljs/core.js:28706:14)"
{:ua-product :chrome}
{:asset-path "/js"})
(parse-stacktrace {:host "localhost" :port 9000}
"Error: 1 is not ISeqable
at Object.cljs$core$seq [as seq] (http://localhost:9000/out/cljs/core.js:4259:8)
at Object.cljs$core$first [as first] (http://localhost:9000/out/cljs/core.js:4289:19)
at cljs$core$ffirst (http://localhost:9000/out/cljs/core.js:5357:18)
at eval (eval at <anonymous> (http://localhost:9000/out/clojure/browser/repl.js:23:272), <anonymous>:1:106)
at eval (eval at <anonymous> (http://localhost:9000/out/clojure/browser/repl.js:23:272), <anonymous>:9:3)
at eval (eval at <anonymous> (http://localhost:9000/out/clojure/browser/repl.js:23:272), <anonymous>:14:4)
at http://localhost:9000/out/clojure/browser/repl.js:23:267
at clojure$browser$repl$evaluate_javascript (http://localhost:9000/out/clojure/browser/repl.js:26:4)
at Object.callback (http://localhost:9000/out/clojure/browser/repl.js:121:169)
at goog.messaging.AbstractChannel.deliver (http://localhost:9000/out/goog/messaging/abstractchannel.js:142:13)"
{:ua-product :chrome}
nil)
;; Node.js example
(parse-stacktrace {}
"Error: 1 is not ISeqable
at Object.cljs$core$seq [as seq] (/home/my/cool/project/.cljs_bootstrap/cljs/core.js:3999:8)
at Object.cljs$core$first [as first] (/home/my/cool/project/.cljs_bootstrap/cljs/core.js:4018:19)
at cljs$core$ffirst (/home/my/cool/project/.cljs_bootstrap/cljs/core.js:5161:34)
at /home/my/cool/project/.cljs_bootstrap/cljs/core.js:16006:88
at cljs.core.map.cljs$core$IFn$_invoke$arity$2 (/home/my/cool/project/.cljs_bootstrap/cljs/core.js:16007:3)
at cljs.core.LazySeq.sval (/home/my/cool/project/.cljs_bootstrap/cljs/core.js:10244:109)
at cljs.core.LazySeq.cljs$core$ISeqable$_seq$arity$1 (/home/my/cool/project/.cljs_bootstrap/cljs/core.js:10335:10)
at Object.cljs$core$seq [as seq] (/home/my/cool/project/.cljs_bootstrap/cljs/core.js:3980:13)
at Object.cljs$core$pr_sequential_writer [as pr_sequential_writer] (/home/my/cool/project/.cljs_bootstrap/cljs/core.js:28084:14)
at cljs.core.LazySeq.cljs$core$IPrintWithWriter$_pr_writer$arity$3 (/home/my/cool/project/.cljs_bootstrap/cljs/core.js:28812:18)"
{:ua-product :chrome}
{:output-dir "/home/my/cool/project/.cljs_bootstrap"})
)
;; -----------------------------------------------------------------------------
;; Safari Stacktrace
(defn safari-st-el->frame
[repl-env st-el opts]
(let [[function flc] (if (re-find #"@" st-el)
(string/split st-el #"@")
[nil st-el])
[file line column] (parse-file-line-column flc)]
(if (and file function line column)
{:file (parse-file repl-env file opts)
:function (string/trim function)
:line line
:column column}
(when-not (string/blank? function)
{:file nil
:function (string/trim function)
:line nil
:column nil}))))
(comment
(safari-st-el->frame {:host "localhost" :port 9000}
"cljs$core$seq@http://localhost:9000/out/cljs/core.js:4259:17" {})
(safari-st-el->frame {:host "localhost" :port 9000}
"cljs$core$seq@http://localhost:9000/js/cljs/core.js:4259:17" {:asset-path "js"})
)
(defmethod parse-stacktrace :safari
[repl-env st err opts]
(->> st
string/split-lines
(drop-while #(starts-with? % "Error"))
(take-while #(not (starts-with? % "eval code")))
(remove string/blank?)
(map #(safari-st-el->frame repl-env % opts))
(remove nil?)
vec))
(comment
(parse-stacktrace {}
"cljs$core$seq@out/cljs/core.js:3999:17
cljs$core$first@out/cljs/core.js:4018:22
cljs$core$ffirst@out/cljs/core.js:5161:39
global code"
{:ua-product :safari}
{:output-dir "out"})
(parse-stacktrace {:host "localhost" :port 9000}
"cljs$core$seq@http://localhost:9000/out/cljs/core.js:4259:17
cljs$core$first@http://localhost:9000/out/cljs/core.js:4289:22
cljs$core$ffirst@http://localhost:9000/out/cljs/core.js:5357:39
http://localhost:9000/out/cljs/core.js:16972:92
http://localhost:9000/out/cljs/core.js:16973:3
http://localhost:9000/out/cljs/core.js:10982:133
sval@http://localhost:9000/out/cljs/core.js:10983:3
cljs$core$ISeqable$_seq$arity$1@http://localhost:9000/out/cljs/core.js:11074:14
cljs$core$seq@http://localhost:9000/out/cljs/core.js:4240:44
cljs$core$pr_sequential_writer@http://localhost:9000/out/cljs/core.js:28707:17
cljs$core$IPrintWithWriter$_pr_writer$arity$3@http://localhost:9000/out/cljs/core.js:29386:38
cljs$core$pr_writer_impl@http://localhost:9000/out/cljs/core.js:28912:57
cljs$core$pr_writer@http://localhost:9000/out/cljs/core.js:29011:32
cljs$core$pr_seq_writer@http://localhost:9000/out/cljs/core.js:29015:20
cljs$core$pr_sb_with_opts@http://localhost:9000/out/cljs/core.js:29078:24
cljs$core$pr_str_with_opts@http://localhost:9000/out/cljs/core.js:29092:48
cljs$core$pr_str__delegate@http://localhost:9000/out/cljs/core.js:29130:34
cljs$core$pr_str@http://localhost:9000/out/cljs/core.js:29139:39
eval code
eval@[native code]
http://localhost:9000/out/clojure/browser/repl.js:23:271
clojure$browser$repl$evaluate_javascript@http://localhost:9000/out/clojure/browser/repl.js:26:4
http://localhost:9000/out/clojure/browser/repl.js:121:173
deliver@http://localhost:9000/out/goog/messaging/abstractchannel.js:142:21
xpcDeliver@http://localhost:9000/out/goog/net/xpc/crosspagechannel.js:733:19
messageReceived_@http://localhost:9000/out/goog/net/xpc/nativemessagingtransport.js:321:23
fireListener@http://localhost:9000/out/goog/events/events.js:741:25
handleBrowserEvent_@http://localhost:9000/out/goog/events/events.js:862:34
http://localhost:9000/out/goog/events/events.js:276:42"
{:ua-product :safari}
nil)
)
;; -----------------------------------------------------------------------------
;; Firefox Stacktrace
(defn firefox-clean-function [f]
(as-> f f
(cond
(string/blank? f) nil
(not= (.indexOf f "</") -1)
(let [idx (.indexOf f "</")]
(.substring f (+ idx 2)))
:else f)
(-> f
(string/replace #"<" "")
(string/replace #?(:clj #"\/" :cljs (js/RegExp. "\\/")) ""))))
(defn firefox-st-el->frame
[repl-env st-el opts]
(let [[function flc] (if (re-find #"@" st-el)
(string/split st-el #"@")
[nil st-el])
[file line column] (parse-file-line-column flc)]
(if (and file function line column)
{:file (parse-file repl-env file opts)
:function (firefox-clean-function function)
:line line
:column column}
(when-not (string/blank? function)
{:file nil
:function (firefox-clean-function function)
:line nil
:column nil}))))
(comment
(firefox-st-el->frame {:host "localhost" :port 9000}
"cljs$core$seq@http://localhost:9000/out/cljs/core.js:4258:8" {})
(firefox-st-el->frame {:host "localhost" :port 9000}
"cljs.core.map</cljs$core$map__2/</<@http://localhost:9000/out/cljs/core.js:16971:87" {})
(firefox-st-el->frame {:host "localhost" :port 9000}
"cljs.core.map</cljs$core$map__2/</<@http://localhost:9000/out/cljs/core.js:16971:87" {})
(firefox-st-el->frame {:host "localhost" :port 9000}
"cljs.core.pr_str</cljs$core$pr_str@http://localhost:9000/out/cljs/core.js:29138:8" {})
(firefox-st-el->frame {:host "localhost" :port 9000}
"cljs.core.pr_str</cljs$core$pr_str__delegate@http://localhost:9000/out/cljs/core.js:29129:8" {})
)
(defmethod parse-stacktrace :firefox
[repl-env st err opts]
(->> st
string/split-lines
(drop-while #(starts-with? % "Error"))
(take-while #(= (.indexOf % "> eval") -1))
(remove string/blank?)
(map #(firefox-st-el->frame repl-env % opts))
(remove nil?)
vec))
(comment
(parse-stacktrace {:host "localhost" :port 9000}
"cljs$core$seq@http://localhost:9000/out/cljs/core.js:4258:8
cljs$core$first@http://localhost:9000/out/cljs/core.js:4288:9
cljs$core$ffirst@http://localhost:9000/out/cljs/core.js:5356:24
cljs.core.map</cljs$core$map__2/</<@http://localhost:9000/out/cljs/core.js:16971:87
cljs.core.map</cljs$core$map__2/<@http://localhost:9000/out/cljs/core.js:16970:1
cljs.core.LazySeq.prototype.sval/self__.s<@http://localhost:9000/out/cljs/core.js:10981:119
cljs.core.LazySeq.prototype.sval@http://localhost:9000/out/cljs/core.js:10981:13
cljs.core.LazySeq.prototype.cljs$core$ISeqable$_seq$arity$1@http://localhost:9000/out/cljs/core.js:11073:1
cljs$core$seq@http://localhost:9000/out/cljs/core.js:4239:8
cljs$core$pr_sequential_writer@http://localhost:9000/out/cljs/core.js:28706:4
cljs.core.LazySeq.prototype.cljs$core$IPrintWithWriter$_pr_writer$arity$3@http://localhost:9000/out/cljs/core.js:29385:8
cljs$core$pr_writer_impl@http://localhost:9000/out/cljs/core.js:28911:8
cljs$core$pr_writer@http://localhost:9000/out/cljs/core.js:29010:8
cljs$core$pr_seq_writer@http://localhost:9000/out/cljs/core.js:29014:1
cljs$core$pr_sb_with_opts@http://localhost:9000/out/cljs/core.js:29077:1
cljs$core$pr_str_with_opts@http://localhost:9000/out/cljs/core.js:29091:23
cljs.core.pr_str</cljs$core$pr_str__delegate@http://localhost:9000/out/cljs/core.js:29129:8
cljs.core.pr_str</cljs$core$pr_str@http://localhost:9000/out/cljs/core.js:29138:8
@http://localhost:9000/out/clojure/browser/repl.js line 23 > eval:1:25
@http://localhost:9000/out/clojure/browser/repl.js line 23 > eval:1:2
clojure$browser$repl$evaluate_javascript/result<@http://localhost:9000/out/clojure/browser/repl.js:23:267
clojure$browser$repl$evaluate_javascript@http://localhost:9000/out/clojure/browser/repl.js:23:15
clojure$browser$repl$connect/</<@http://localhost:9000/out/clojure/browser/repl.js:121:128
goog.messaging.AbstractChannel.prototype.deliver@http://localhost:9000/out/goog/messaging/abstractchannel.js:142:5
goog.net.xpc.CrossPageChannel.prototype.xpcDeliver@http://localhost:9000/out/goog/net/xpc/crosspagechannel.js:733:7
goog.net.xpc.NativeMessagingTransport.messageReceived_@http://localhost:9000/out/goog/net/xpc/nativemessagingtransport.js:321:1
goog.events.fireListener@http://localhost:9000/out/goog/events/events.js:741:10
goog.events.handleBrowserEvent_@http://localhost:9000/out/goog/events/events.js:862:1
goog.events.getProxy/f<@http://localhost:9000/out/goog/events/events.js:276:16"
{:ua-product :firefox}
nil)
)
;; -----------------------------------------------------------------------------
;; Rhino Stacktrace
(defmethod parse-stacktrace :rhino
[repl-env st err {:keys [output-dir] :as opts}]
(letfn [(process-frame [frame-str]
(when-not (or (string/blank? frame-str)
(== -1 (.indexOf frame-str "\tat")))
(let [[file-side line-fn-side] (string/split frame-str #":")
file (string/replace file-side #"\s+at\s+" "")
[line function] (string/split line-fn-side #"\s+")]
{:file (string/replace file
(str output-dir
#?(:clj File/separator :cljs "/"))
"")
:function (when function
(-> function
(string/replace "(" "")
(string/replace ")" "")))
:line (when (and line (not (string/blank? line)))
(parse-int line))
:column 0})))]
(->> (string/split st #"\n")
(map process-frame)
(remove nil?)
vec)))
(comment
(parse-stacktrace {}
"\tat .cljs_rhino_repl/goog/../cljs/core.js:4215 (seq)
\tat .cljs_rhino_repl/goog/../cljs/core.js:4245 (first)
\tat .cljs_rhino_repl/goog/../cljs/core.js:5295 (ffirst)
\tat <cljs repl>:1
\tat <cljs repl>:1"
{:ua-product :rhino}
{:output-dir ".cljs_rhino_repl"})
(parse-stacktrace {}
"org.mozilla.javascript.JavaScriptException: Error: 1 is not ISeqable (.cljs_rhino_repl/goog/../cljs/core.js#3998)
\tat .cljs_rhino_repl/goog/../cljs/core.js:3998 (cljs$core$seq)
\tat .cljs_rhino_repl/goog/../cljs/core.js:4017 (cljs$core$first)
\tat .cljs_rhino_repl/goog/../cljs/core.js:5160 (cljs$core$ffirst)
\tat .cljs_rhino_repl/goog/../cljs/core.js:16005
\tat .cljs_rhino_repl/goog/../cljs/core.js:16004
\tat .cljs_rhino_repl/goog/../cljs/core.js:10243
\tat .cljs_rhino_repl/goog/../cljs/core.js:10334
\tat .cljs_rhino_repl/goog/../cljs/core.js:3979 (cljs$core$seq)
\tat .cljs_rhino_repl/goog/../cljs/core.js:28083 (cljs$core$pr_sequential_writer)
\tat .cljs_rhino_repl/goog/../cljs/core.js:28811
\tat .cljs_rhino_repl/goog/../cljs/core.js:28267 (cljs$core$pr_writer_impl)
\tat .cljs_rhino_repl/goog/../cljs/core.js:28349 (cljs$core$pr_writer)
\tat .cljs_rhino_repl/goog/../cljs/core.js:28353 (cljs$core$pr_seq_writer)
\tat .cljs_rhino_repl/goog/../cljs/core.js:28416 (cljs$core$pr_sb_with_opts)
\tat .cljs_rhino_repl/goog/../cljs/core.js:28430 (cljs$core$pr_str_with_opts)
\tat .cljs_rhino_repl/goog/../cljs/core.js:28524
\tat .cljs_rhino_repl/goog/../cljs/core.js:28520 (cljs$core$pr_str)
at <cljs repl>:1
"
{:ua-product :rhino}
{:output-dir ".cljs_rhino_repl"})
)
;; -----------------------------------------------------------------------------
;; Nashorn Stacktrace
(defmethod parse-stacktrace :nashorn
[repl-env st err {:keys [output-dir] :as opts}]
(letfn [(process-frame [frame-str]
(when-not (or (string/blank? frame-str)
(== -1 (.indexOf frame-str "\tat")))
(let [frame-str (string/replace frame-str #"\s+at\s+" "")
[function file-and-line] (string/split frame-str #"\s+")
[file-part line-part] (string/split file-and-line #":")]
{:file (string/replace (.substring file-part 1)
(str output-dir
#?(:clj File/separator :cljs "/"))
"")
:function function
:line (when (and line-part (not (string/blank? line-part)))
(parse-int
(.substring line-part 0
(dec (count line-part)))))
:column 0})))]
(->> (string/split st #"\n")
(map process-frame)
(remove nil?)
vec)))
(comment
(parse-stacktrace {}
"Error: 1 is not ISeqable
\tat cljs$core$seq (.cljs_nashorn_repl/goog/../cljs/core.js:3998)
\tat cljs$core$first (.cljs_nashorn_repl/goog/../cljs/core.js:4017)
\tat cljs$core$ffirst (.cljs_nashorn_repl/goog/../cljs/core.js:5160)
\tat <anonymous> (.cljs_nashorn_repl/goog/../cljs/core.js:16005)
\tat <anonymous> (.cljs_nashorn_repl/goog/../cljs/core.js:16004)
\tat sval (.cljs_nashorn_repl/goog/../cljs/core.js:10243)
\tat cljs$core$ISeqable$_seq$arity$1-6 (.cljs_nashorn_repl/goog/../cljs/core.js:10334)
\tat cljs$core$seq (.cljs_nashorn_repl/goog/../cljs/core.js:3979)
\tat cljs$core$pr_sequential_writer (.cljs_nashorn_repl/goog/../cljs/core.js:28083)
\tat cljs$core$IPrintWithWriter$_pr_writer$arity$3-5 (.cljs_nashorn_repl/goog/../cljs/core.js:28811)
\tat cljs$core$pr_writer_impl (.cljs_nashorn_repl/goog/../cljs/core.js:28267)
\tat cljs$core$pr_writer (.cljs_nashorn_repl/goog/../cljs/core.js:28349)
\tat cljs$core$pr_seq_writer (.cljs_nashorn_repl/goog/../cljs/core.js:28353)
\tat cljs$core$pr_sb_with_opts (.cljs_nashorn_repl/goog/../cljs/core.js:28416)
\tat cljs$core$pr_str_with_opts (.cljs_nashorn_repl/goog/../cljs/core.js:28430)
\tat cljs$core$IFn$_invoke$arity$variadic-71 (.cljs_nashorn_repl/goog/../cljs/core.js:28524)
\tat cljs$core$pr_str (.cljs_nashorn_repl/goog/../cljs/core.js:28520)
\tat <anonymous> (<eval>:1)
\tat <program> (<eval>:1)\n"
{:ua-product :nashorn}
{:output-dir ".cljs_nashorn_repl"})
)
;; -----------------------------------------------------------------------------
;; Node.js Stacktrace
(defmethod parse-stacktrace :nodejs
[repl-env st err {:keys [output-dir] :as opts}]
(letfn [(parse-source-loc-info [x]
(when (and x (not (string/blank? x)))
(parse-int x)))
(process-frame [frame-str]
(when-not (or (string/blank? frame-str)
(nil? (re-find #"^\s+at" frame-str)))
(let [frame-str (string/replace frame-str #"\s+at\s+" "")]
(when-not (string/starts-with? frame-str "repl:")
(let [parts (string/split frame-str #"\s+")
[function file&line] (if (== 2 (count parts))
[(first parts)
(subs (second parts) 1
(dec (count (second parts))))]
[nil (first parts)])
[file-part line-part col-part] (string/split file&line #":")]
{:file (if function
(cond-> file-part
output-dir
(string/replace
(str output-dir
#?(:clj File/separator :cljs "/"))
""))
file-part)
:function function
:line (parse-source-loc-info line-part)
:column (parse-source-loc-info col-part)})))))]
(->> (string/split st #"\n")
(map process-frame)
(remove nil?)
vec)))
(comment
(parse-stacktrace {}
"Error: 1 is not ISeqable
at cljs$core$seq (.cljs_node_repl/cljs/core.cljs:1118:20)
at repl:1:65
at repl:9:4
at repl:17:3
at repl:22:4
at Object.exports.runInThisContext (vm.js:54:17)
at Domain.<anonymous> ([stdin]:41:34)
at Domain.run (domain.js:228:14)
at Socket.<anonymous> ([stdin]:40:25)
at emitOne (events.js:77:13)"
{:ua-product :nodejs}
{:output-dir ".cljs_node_repl"})
)
;; -----------------------------------------------------------------------------
;; Stacktrace Mapping
(defn remove-ext [file]
(-> file
(string/replace #"\.js$" "")
(string/replace #"\.cljs$" "")
(string/replace #"\.cljc$" "")
(string/replace #"\.clj$" "")))
(defn mapped-line-column-call
"Given a cljs.source-map source map data structure map a generated line
and column back to the original line, column, and function called."
[sms file line column]
(let [source-map (get sms (symbol (string/replace (remove-ext file) "/" ".")))]
;; source maps are 0 indexed for columns
;; multiple segments may exist at column
;; the last segment seems most accurate
(letfn [(get-best-column [columns column]
(last (or (get columns
(last (filter #(<= % (dec column))
(sort (keys columns)))))
(second (first columns)))))
(adjust [mapped]
(vec (map #(%1 %2) [inc inc identity] mapped)))]
(let [default [line column nil]]
;; source maps are 0 indexed for lines
(if-let [columns (get source-map (dec line))]
(adjust (map (get-best-column columns column) [:line :col :name]))
default)))))
(defn mapped-frame
"Given opts and a canonicalized JavaScript stacktrace frame, return the
ClojureScript frame."
[{:keys [function file line column]} sms opts]
(let [no-source-file? (if-not file true (starts-with? file "<"))
[line' column' call] (if no-source-file?
[line column nil]
(mapped-line-column-call sms file line column))
file' (when-not no-source-file?
(if (ends-with? file ".js")
(str (subs file 0 (- (count file) 3)) ".cljs")
file))]
{:function function
:call call
:file (if no-source-file?
(str "NO_SOURCE_FILE" (when file (str " " file)))
file')
:line line'
:column column'}))
(defn mapped-stacktrace
"Given a vector representing the canonicalized JavaScript stacktrace
return the ClojureScript stacktrace. The canonical stacktrace must be
in the form:
[{:file <string>
:function <string>
:line <integer>
:column <integer>}*]
:file must be a URL path (without protocol) relative to :output-dir or a
identifier delimited by angle brackets. The returned mapped stacktrace will
also contain :url entries to the original sources if it can be determined
from the classpath."
([stacktrace sms]
(mapped-stacktrace stacktrace sms nil))
([stacktrace sms opts]
(letfn [(call->function [x]
(if (:call x)
(hash-map :function (:call x))
{}))
(call-merge [function call]
(merge-with
(fn [munged-fn-name unmunged-call-name]
(if (= munged-fn-name
(string/replace (munge unmunged-call-name) "." "$"))
unmunged-call-name
munged-fn-name))
function call))]
(let [mapped-frames (map (memoize #(mapped-frame % sms opts)) stacktrace)]
;; take each non-nil :call and optionally merge it into :function one-level
;; up to avoid replacing with local symbols, we only replace munged name if
;; we can munge call symbol back to it
(vec (map call-merge
(map #(dissoc % :call) mapped-frames)
(concat (rest (map call->function mapped-frames)) [{}])))))))
(defn mapped-stacktrace-str
"Given a vector representing the canonicalized JavaScript stacktrace and a map
of library names to decoded source maps, print the ClojureScript stacktrace .
See mapped-stacktrace."
([stacktrace sms]
(mapped-stacktrace-str stacktrace sms nil))
([stacktrace sms opts]
(with-out-str
(doseq [{:keys [function file line column]}
(mapped-stacktrace stacktrace sms opts)]
(println "\t"
(str (when function (str function " "))
"(" file (when line (str ":" line))
(when column (str ":" column)) ")"))))))
(comment
(require '[cljs.closure :as cljsc]
'[clojure.data.json :as json]
'[cljs.source-map :as sm]
'[clojure.pprint :as pp])
(cljsc/build "samples/hello/src"
{:optimizations :none
:output-dir "samples/hello/out"
:output-to "samples/hello/out/hello.js"
:source-map true})
(def sms
{'hello.core
(sm/decode
(json/read-str
(slurp "samples/hello/out/hello/core.js.map")
:key-fn keyword))})
(pp/pprint sms)
;; maps to :line 5 :column 24
(mapped-stacktrace
[{:file "hello/core.js"
:function "first"
:line 6
:column 0}]
sms {:output-dir "samples/hello/out"})
(mapped-stacktrace-str
[{:file "hello/core.js"
:function "first"
:line 6
:column 0}]
sms {:output-dir "samples/hello/out"})
)

File diff suppressed because one or more lines are too long

View file

@ -1,663 +0,0 @@
// Compiled by ClojureScript 1.9.229 {}
goog.provide('cljs.stacktrace');
goog.require('cljs.core');
goog.require('goog.string');
goog.require('clojure.string');
if(typeof cljs.stacktrace.parse_stacktrace !== 'undefined'){
} else {
/**
* Parse a JavaScript stacktrace string into a canonical data form. The
* arguments:
*
* repl-env - the repl environment, an optional map with :host and :port keys
* if the stacktrace includes url, not file references
* st - the original stacktrace string to parse
* err - an error map. :ua-product key defines the type of stacktrace parser
* to use, for example :chrome
* opts - additional options. :output-dir maybe given in this argument if
* :host and :port do not apply, for example, a file path
*
* The canonical stacktrace representation can easily be mapped to a
* ClojureScript one see mapped-stacktrace and mapped-stacktrace-str
*/
cljs.stacktrace.parse_stacktrace = (function (){var method_table__26055__auto__ = cljs.core.atom.call(null,cljs.core.PersistentArrayMap.EMPTY);
var prefer_table__26056__auto__ = cljs.core.atom.call(null,cljs.core.PersistentArrayMap.EMPTY);
var method_cache__26057__auto__ = cljs.core.atom.call(null,cljs.core.PersistentArrayMap.EMPTY);
var cached_hierarchy__26058__auto__ = cljs.core.atom.call(null,cljs.core.PersistentArrayMap.EMPTY);
var hierarchy__26059__auto__ = cljs.core.get.call(null,cljs.core.PersistentArrayMap.EMPTY,new cljs.core.Keyword(null,"hierarchy","hierarchy",-1053470341),cljs.core.get_global_hierarchy.call(null));
return (new cljs.core.MultiFn(cljs.core.symbol.call(null,"cljs.stacktrace","parse-stacktrace"),((function (method_table__26055__auto__,prefer_table__26056__auto__,method_cache__26057__auto__,cached_hierarchy__26058__auto__,hierarchy__26059__auto__){
return (function (repl_env,st,err,opts){
return new cljs.core.Keyword(null,"ua-product","ua-product",938384227).cljs$core$IFn$_invoke$arity$1(err);
});})(method_table__26055__auto__,prefer_table__26056__auto__,method_cache__26057__auto__,cached_hierarchy__26058__auto__,hierarchy__26059__auto__))
,new cljs.core.Keyword(null,"default","default",-1987822328),hierarchy__26059__auto__,method_table__26055__auto__,prefer_table__26056__auto__,method_cache__26057__auto__,cached_hierarchy__26058__auto__));
})();
}
cljs.stacktrace.parse_int = (function cljs$stacktrace$parse_int(s){
return parseInt(s,(10));
});
cljs.stacktrace.starts_with_QMARK_ = (function cljs$stacktrace$starts_with_QMARK_(s0,s1){
return goog.string.startsWith(s0,s1);
});
cljs.stacktrace.ends_with_QMARK_ = (function cljs$stacktrace$ends_with_QMARK_(s0,s1){
return goog.string.endsWith(s0,s1);
});
cljs.stacktrace.string__GT_regex = (function cljs$stacktrace$string__GT_regex(s){
return (new RegExp(s));
});
cljs.stacktrace.output_directory = (function cljs$stacktrace$output_directory(opts){
var or__25130__auto__ = new cljs.core.Keyword(null,"output-dir","output-dir",-290956991).cljs$core$IFn$_invoke$arity$1(opts);
if(cljs.core.truth_(or__25130__auto__)){
return or__25130__auto__;
} else {
return "out";
}
});
cljs.core._add_method.call(null,cljs.stacktrace.parse_stacktrace,new cljs.core.Keyword(null,"default","default",-1987822328),(function (repl_env,st,err,opts){
return st;
}));
cljs.stacktrace.parse_file_line_column = (function cljs$stacktrace$parse_file_line_column(flc){
if(cljs.core.not.call(null,cljs.core.re_find.call(null,/:/,flc))){
return new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [flc,null,null], null);
} else {
var xs = clojure.string.split.call(null,flc,/:/);
var vec__41903 = cljs.core.reduce.call(null,((function (xs){
return (function (p__41909,p__41910){
var vec__41911 = p__41909;
var pre = cljs.core.nth.call(null,vec__41911,(0),null);
var post = cljs.core.nth.call(null,vec__41911,(1),null);
var vec__41914 = p__41910;
var x = cljs.core.nth.call(null,vec__41914,(0),null);
var i = cljs.core.nth.call(null,vec__41914,(1),null);
if((i <= (2))){
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [pre,cljs.core.conj.call(null,post,x)], null);
} else {
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.conj.call(null,pre,x),post], null);
}
});})(xs))
,new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.PersistentVector.EMPTY,cljs.core.PersistentVector.EMPTY], null),cljs.core.map.call(null,cljs.core.vector,xs,cljs.core.range.call(null,cljs.core.count.call(null,xs),(0),(-1))));
var pre = cljs.core.nth.call(null,vec__41903,(0),null);
var vec__41906 = cljs.core.nth.call(null,vec__41903,(1),null);
var line = cljs.core.nth.call(null,vec__41906,(0),null);
var column = cljs.core.nth.call(null,vec__41906,(1),null);
var file = clojure.string.join.call(null,":",pre);
return new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [(function (){var G__41917 = file;
if(cljs.stacktrace.starts_with_QMARK_.call(null,file,"(")){
return clojure.string.replace.call(null,G__41917,"(","");
} else {
return G__41917;
}
})(),cljs.stacktrace.parse_int.call(null,(function (){var G__41918 = line;
if(cljs.stacktrace.ends_with_QMARK_.call(null,line,")")){
return clojure.string.replace.call(null,G__41918,")","");
} else {
return G__41918;
}
})()),cljs.stacktrace.parse_int.call(null,(function (){var G__41919 = column;
if(cljs.stacktrace.ends_with_QMARK_.call(null,column,")")){
return clojure.string.replace.call(null,G__41919,")","");
} else {
return G__41919;
}
})())], null);
}
});
/**
* Given a browser file url convert it into a relative path that can be used
* to locate the original source.
*/
cljs.stacktrace.parse_file = (function cljs$stacktrace$parse_file(p__41920,file,p__41921){
var map__41926 = p__41920;
var map__41926__$1 = ((((!((map__41926 == null)))?((((map__41926.cljs$lang$protocol_mask$partition0$ & (64))) || (map__41926.cljs$core$ISeq$))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__41926):map__41926);
var repl_env = map__41926__$1;
var host = cljs.core.get.call(null,map__41926__$1,new cljs.core.Keyword(null,"host","host",-1558485167));
var host_port = cljs.core.get.call(null,map__41926__$1,new cljs.core.Keyword(null,"host-port","host-port",1956551772));
var port = cljs.core.get.call(null,map__41926__$1,new cljs.core.Keyword(null,"port","port",1534937262));
var map__41927 = p__41921;
var map__41927__$1 = ((((!((map__41927 == null)))?((((map__41927.cljs$lang$protocol_mask$partition0$ & (64))) || (map__41927.cljs$core$ISeq$))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__41927):map__41927);
var opts = map__41927__$1;
var asset_path = cljs.core.get.call(null,map__41927__$1,new cljs.core.Keyword(null,"asset-path","asset-path",1500889617));
var urlpat = (cljs.core.truth_(host)?cljs.stacktrace.string__GT_regex.call(null,[cljs.core.str("http://"),cljs.core.str(host),cljs.core.str(":"),cljs.core.str((function (){var or__25130__auto__ = host_port;
if(cljs.core.truth_(or__25130__auto__)){
return or__25130__auto__;
} else {
return port;
}
})()),cljs.core.str("/")].join('')):"");
var match = (cljs.core.truth_(host)?cljs.core.re_find.call(null,urlpat,file):cljs.core.contains_QMARK_.call(null,opts,new cljs.core.Keyword(null,"output-dir","output-dir",-290956991)));
if(cljs.core.truth_(match)){
return clojure.string.replace.call(null,clojure.string.replace.call(null,file,urlpat,""),cljs.stacktrace.string__GT_regex.call(null,[cljs.core.str("^"),cljs.core.str((function (){var or__25130__auto__ = (function (){var and__25118__auto__ = asset_path;
if(cljs.core.truth_(and__25118__auto__)){
return clojure.string.replace.call(null,asset_path,/^\//,"");
} else {
return and__25118__auto__;
}
})();
if(cljs.core.truth_(or__25130__auto__)){
return or__25130__auto__;
} else {
return cljs.stacktrace.output_directory.call(null,opts);
}
})()),cljs.core.str("/")].join('')),"");
} else {
var temp__4655__auto__ = new cljs.core.Keyword(null,"asset-root","asset-root",1771735072).cljs$core$IFn$_invoke$arity$1(opts);
if(cljs.core.truth_(temp__4655__auto__)){
var asset_root = temp__4655__auto__;
return clojure.string.replace.call(null,file,asset_root,"");
} else {
throw cljs.core.ex_info.call(null,[cljs.core.str("Could not relativize URL "),cljs.core.str(file)].join(''),new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"type","type",1174270348),new cljs.core.Keyword(null,"parse-stacktrace","parse-stacktrace",-38208461),new cljs.core.Keyword(null,"reason","reason",-2070751759),new cljs.core.Keyword(null,"relativize-url","relativize-url",621482324)], null));
}
}
});
cljs.stacktrace.chrome_st_el__GT_frame = (function cljs$stacktrace$chrome_st_el__GT_frame(repl_env,st_el,opts){
var xs = clojure.string.split.call(null,clojure.string.replace.call(null,st_el,/\s+at\s+/,""),/\s+/);
var vec__41936 = ((((1) === cljs.core.count.call(null,xs)))?new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [null,cljs.core.first.call(null,xs)], null):new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.first.call(null,xs),cljs.core.last.call(null,xs)], null));
var function$ = cljs.core.nth.call(null,vec__41936,(0),null);
var flc = cljs.core.nth.call(null,vec__41936,(1),null);
var vec__41939 = cljs.stacktrace.parse_file_line_column.call(null,flc);
var file = cljs.core.nth.call(null,vec__41939,(0),null);
var line = cljs.core.nth.call(null,vec__41939,(1),null);
var column = cljs.core.nth.call(null,vec__41939,(2),null);
if(cljs.core.truth_((function (){var and__25118__auto__ = file;
if(cljs.core.truth_(and__25118__auto__)){
var and__25118__auto____$1 = function$;
if(cljs.core.truth_(and__25118__auto____$1)){
var and__25118__auto____$2 = line;
if(cljs.core.truth_(and__25118__auto____$2)){
return column;
} else {
return and__25118__auto____$2;
}
} else {
return and__25118__auto____$1;
}
} else {
return and__25118__auto__;
}
})())){
return new cljs.core.PersistentArrayMap(null, 4, [new cljs.core.Keyword(null,"file","file",-1269645878),cljs.stacktrace.parse_file.call(null,repl_env,file,opts),new cljs.core.Keyword(null,"function","function",-2127255473),clojure.string.replace.call(null,function$,/Object\./,""),new cljs.core.Keyword(null,"line","line",212345235),line,new cljs.core.Keyword(null,"column","column",2078222095),column], null);
} else {
if(clojure.string.blank_QMARK_.call(null,function$)){
return null;
} else {
return new cljs.core.PersistentArrayMap(null, 4, [new cljs.core.Keyword(null,"file","file",-1269645878),null,new cljs.core.Keyword(null,"function","function",-2127255473),clojure.string.replace.call(null,function$,/Object\./,""),new cljs.core.Keyword(null,"line","line",212345235),null,new cljs.core.Keyword(null,"column","column",2078222095),null], null);
}
}
});
cljs.core._add_method.call(null,cljs.stacktrace.parse_stacktrace,new cljs.core.Keyword(null,"chrome","chrome",1718738387),(function (repl_env,st,err,opts){
return cljs.core.vec.call(null,cljs.core.remove.call(null,cljs.core.nil_QMARK_,cljs.core.map.call(null,(function (p1__41944_SHARP_){
return cljs.stacktrace.chrome_st_el__GT_frame.call(null,repl_env,p1__41944_SHARP_,opts);
}),cljs.core.take_while.call(null,(function (p1__41943_SHARP_){
return !(cljs.stacktrace.starts_with_QMARK_.call(null,p1__41943_SHARP_," at eval"));
}),cljs.core.drop_while.call(null,(function (p1__41942_SHARP_){
return cljs.stacktrace.starts_with_QMARK_.call(null,p1__41942_SHARP_,"Error");
}),clojure.string.split_lines.call(null,st))))));
}));
cljs.stacktrace.safari_st_el__GT_frame = (function cljs$stacktrace$safari_st_el__GT_frame(repl_env,st_el,opts){
var vec__41951 = (cljs.core.truth_(cljs.core.re_find.call(null,/@/,st_el))?clojure.string.split.call(null,st_el,/@/):new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [null,st_el], null));
var function$ = cljs.core.nth.call(null,vec__41951,(0),null);
var flc = cljs.core.nth.call(null,vec__41951,(1),null);
var vec__41954 = cljs.stacktrace.parse_file_line_column.call(null,flc);
var file = cljs.core.nth.call(null,vec__41954,(0),null);
var line = cljs.core.nth.call(null,vec__41954,(1),null);
var column = cljs.core.nth.call(null,vec__41954,(2),null);
if(cljs.core.truth_((function (){var and__25118__auto__ = file;
if(cljs.core.truth_(and__25118__auto__)){
var and__25118__auto____$1 = function$;
if(cljs.core.truth_(and__25118__auto____$1)){
var and__25118__auto____$2 = line;
if(cljs.core.truth_(and__25118__auto____$2)){
return column;
} else {
return and__25118__auto____$2;
}
} else {
return and__25118__auto____$1;
}
} else {
return and__25118__auto__;
}
})())){
return new cljs.core.PersistentArrayMap(null, 4, [new cljs.core.Keyword(null,"file","file",-1269645878),cljs.stacktrace.parse_file.call(null,repl_env,file,opts),new cljs.core.Keyword(null,"function","function",-2127255473),clojure.string.trim.call(null,function$),new cljs.core.Keyword(null,"line","line",212345235),line,new cljs.core.Keyword(null,"column","column",2078222095),column], null);
} else {
if(clojure.string.blank_QMARK_.call(null,function$)){
return null;
} else {
return new cljs.core.PersistentArrayMap(null, 4, [new cljs.core.Keyword(null,"file","file",-1269645878),null,new cljs.core.Keyword(null,"function","function",-2127255473),clojure.string.trim.call(null,function$),new cljs.core.Keyword(null,"line","line",212345235),null,new cljs.core.Keyword(null,"column","column",2078222095),null], null);
}
}
});
cljs.core._add_method.call(null,cljs.stacktrace.parse_stacktrace,new cljs.core.Keyword(null,"safari","safari",497115653),(function (repl_env,st,err,opts){
return cljs.core.vec.call(null,cljs.core.remove.call(null,cljs.core.nil_QMARK_,cljs.core.map.call(null,(function (p1__41959_SHARP_){
return cljs.stacktrace.safari_st_el__GT_frame.call(null,repl_env,p1__41959_SHARP_,opts);
}),cljs.core.remove.call(null,clojure.string.blank_QMARK_,cljs.core.take_while.call(null,(function (p1__41958_SHARP_){
return !(cljs.stacktrace.starts_with_QMARK_.call(null,p1__41958_SHARP_,"eval code"));
}),cljs.core.drop_while.call(null,(function (p1__41957_SHARP_){
return cljs.stacktrace.starts_with_QMARK_.call(null,p1__41957_SHARP_,"Error");
}),clojure.string.split_lines.call(null,st)))))));
}));
cljs.stacktrace.firefox_clean_function = (function cljs$stacktrace$firefox_clean_function(f){
var f__$1 = f;
var f__$2 = ((clojure.string.blank_QMARK_.call(null,f__$1))?null:((cljs.core.not_EQ_.call(null,f__$1.indexOf("</"),(-1)))?(function (){var idx = f__$1.indexOf("</");
return f__$1.substring((idx + (2)));
})():f__$1
));
return clojure.string.replace.call(null,clojure.string.replace.call(null,f__$2,/</,""),(new RegExp("\\/")),"");
});
cljs.stacktrace.firefox_st_el__GT_frame = (function cljs$stacktrace$firefox_st_el__GT_frame(repl_env,st_el,opts){
var vec__41966 = (cljs.core.truth_(cljs.core.re_find.call(null,/@/,st_el))?clojure.string.split.call(null,st_el,/@/):new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [null,st_el], null));
var function$ = cljs.core.nth.call(null,vec__41966,(0),null);
var flc = cljs.core.nth.call(null,vec__41966,(1),null);
var vec__41969 = cljs.stacktrace.parse_file_line_column.call(null,flc);
var file = cljs.core.nth.call(null,vec__41969,(0),null);
var line = cljs.core.nth.call(null,vec__41969,(1),null);
var column = cljs.core.nth.call(null,vec__41969,(2),null);
if(cljs.core.truth_((function (){var and__25118__auto__ = file;
if(cljs.core.truth_(and__25118__auto__)){
var and__25118__auto____$1 = function$;
if(cljs.core.truth_(and__25118__auto____$1)){
var and__25118__auto____$2 = line;
if(cljs.core.truth_(and__25118__auto____$2)){
return column;
} else {
return and__25118__auto____$2;
}
} else {
return and__25118__auto____$1;
}
} else {
return and__25118__auto__;
}
})())){
return new cljs.core.PersistentArrayMap(null, 4, [new cljs.core.Keyword(null,"file","file",-1269645878),cljs.stacktrace.parse_file.call(null,repl_env,file,opts),new cljs.core.Keyword(null,"function","function",-2127255473),cljs.stacktrace.firefox_clean_function.call(null,function$),new cljs.core.Keyword(null,"line","line",212345235),line,new cljs.core.Keyword(null,"column","column",2078222095),column], null);
} else {
if(clojure.string.blank_QMARK_.call(null,function$)){
return null;
} else {
return new cljs.core.PersistentArrayMap(null, 4, [new cljs.core.Keyword(null,"file","file",-1269645878),null,new cljs.core.Keyword(null,"function","function",-2127255473),cljs.stacktrace.firefox_clean_function.call(null,function$),new cljs.core.Keyword(null,"line","line",212345235),null,new cljs.core.Keyword(null,"column","column",2078222095),null], null);
}
}
});
cljs.core._add_method.call(null,cljs.stacktrace.parse_stacktrace,new cljs.core.Keyword(null,"firefox","firefox",1283768880),(function (repl_env,st,err,opts){
return cljs.core.vec.call(null,cljs.core.remove.call(null,cljs.core.nil_QMARK_,cljs.core.map.call(null,(function (p1__41974_SHARP_){
return cljs.stacktrace.firefox_st_el__GT_frame.call(null,repl_env,p1__41974_SHARP_,opts);
}),cljs.core.remove.call(null,clojure.string.blank_QMARK_,cljs.core.take_while.call(null,(function (p1__41973_SHARP_){
return cljs.core._EQ_.call(null,p1__41973_SHARP_.indexOf("> eval"),(-1));
}),cljs.core.drop_while.call(null,(function (p1__41972_SHARP_){
return cljs.stacktrace.starts_with_QMARK_.call(null,p1__41972_SHARP_,"Error");
}),clojure.string.split_lines.call(null,st)))))));
}));
cljs.core._add_method.call(null,cljs.stacktrace.parse_stacktrace,new cljs.core.Keyword(null,"rhino","rhino",1962118035),(function (repl_env,st,err,p__41975){
var map__41976 = p__41975;
var map__41976__$1 = ((((!((map__41976 == null)))?((((map__41976.cljs$lang$protocol_mask$partition0$ & (64))) || (map__41976.cljs$core$ISeq$))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__41976):map__41976);
var opts = map__41976__$1;
var output_dir = cljs.core.get.call(null,map__41976__$1,new cljs.core.Keyword(null,"output-dir","output-dir",-290956991));
var process_frame = ((function (map__41976,map__41976__$1,opts,output_dir){
return (function cljs$stacktrace$process_frame(frame_str){
if((clojure.string.blank_QMARK_.call(null,frame_str)) || (((-1) === frame_str.indexOf("\tat")))){
return null;
} else {
var vec__41996 = clojure.string.split.call(null,frame_str,/:/);
var file_side = cljs.core.nth.call(null,vec__41996,(0),null);
var line_fn_side = cljs.core.nth.call(null,vec__41996,(1),null);
var file = clojure.string.replace.call(null,file_side,/\s+at\s+/,"");
var vec__41999 = clojure.string.split.call(null,line_fn_side,/\s+/);
var line = cljs.core.nth.call(null,vec__41999,(0),null);
var function$ = cljs.core.nth.call(null,vec__41999,(1),null);
return new cljs.core.PersistentArrayMap(null, 4, [new cljs.core.Keyword(null,"file","file",-1269645878),clojure.string.replace.call(null,file,[cljs.core.str(output_dir),cljs.core.str("/")].join(''),""),new cljs.core.Keyword(null,"function","function",-2127255473),(cljs.core.truth_(function$)?clojure.string.replace.call(null,clojure.string.replace.call(null,function$,"(",""),")",""):null),new cljs.core.Keyword(null,"line","line",212345235),(cljs.core.truth_((function (){var and__25118__auto__ = line;
if(cljs.core.truth_(and__25118__auto__)){
return !(clojure.string.blank_QMARK_.call(null,line));
} else {
return and__25118__auto__;
}
})())?cljs.stacktrace.parse_int.call(null,line):null),new cljs.core.Keyword(null,"column","column",2078222095),(0)], null);
}
});})(map__41976,map__41976__$1,opts,output_dir))
;
return cljs.core.vec.call(null,cljs.core.remove.call(null,cljs.core.nil_QMARK_,cljs.core.map.call(null,process_frame,clojure.string.split.call(null,st,/\n/))));
}));
cljs.core._add_method.call(null,cljs.stacktrace.parse_stacktrace,new cljs.core.Keyword(null,"nashorn","nashorn",988299963),(function (repl_env,st,err,p__42002){
var map__42003 = p__42002;
var map__42003__$1 = ((((!((map__42003 == null)))?((((map__42003.cljs$lang$protocol_mask$partition0$ & (64))) || (map__42003.cljs$core$ISeq$))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__42003):map__42003);
var opts = map__42003__$1;
var output_dir = cljs.core.get.call(null,map__42003__$1,new cljs.core.Keyword(null,"output-dir","output-dir",-290956991));
var process_frame = ((function (map__42003,map__42003__$1,opts,output_dir){
return (function cljs$stacktrace$process_frame(frame_str){
if((clojure.string.blank_QMARK_.call(null,frame_str)) || (((-1) === frame_str.indexOf("\tat")))){
return null;
} else {
var frame_str__$1 = clojure.string.replace.call(null,frame_str,/\s+at\s+/,"");
var vec__42023 = clojure.string.split.call(null,frame_str__$1,/\s+/);
var function$ = cljs.core.nth.call(null,vec__42023,(0),null);
var file_and_line = cljs.core.nth.call(null,vec__42023,(1),null);
var vec__42026 = clojure.string.split.call(null,file_and_line,/:/);
var file_part = cljs.core.nth.call(null,vec__42026,(0),null);
var line_part = cljs.core.nth.call(null,vec__42026,(1),null);
return new cljs.core.PersistentArrayMap(null, 4, [new cljs.core.Keyword(null,"file","file",-1269645878),clojure.string.replace.call(null,file_part.substring((1)),[cljs.core.str(output_dir),cljs.core.str("/")].join(''),""),new cljs.core.Keyword(null,"function","function",-2127255473),function$,new cljs.core.Keyword(null,"line","line",212345235),(cljs.core.truth_((function (){var and__25118__auto__ = line_part;
if(cljs.core.truth_(and__25118__auto__)){
return !(clojure.string.blank_QMARK_.call(null,line_part));
} else {
return and__25118__auto__;
}
})())?cljs.stacktrace.parse_int.call(null,line_part.substring((0),(cljs.core.count.call(null,line_part) - (1)))):null),new cljs.core.Keyword(null,"column","column",2078222095),(0)], null);
}
});})(map__42003,map__42003__$1,opts,output_dir))
;
return cljs.core.vec.call(null,cljs.core.remove.call(null,cljs.core.nil_QMARK_,cljs.core.map.call(null,process_frame,clojure.string.split.call(null,st,/\n/))));
}));
cljs.core._add_method.call(null,cljs.stacktrace.parse_stacktrace,new cljs.core.Keyword(null,"nodejs","nodejs",321212524),(function (repl_env,st,err,p__42029){
var map__42030 = p__42029;
var map__42030__$1 = ((((!((map__42030 == null)))?((((map__42030.cljs$lang$protocol_mask$partition0$ & (64))) || (map__42030.cljs$core$ISeq$))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__42030):map__42030);
var opts = map__42030__$1;
var output_dir = cljs.core.get.call(null,map__42030__$1,new cljs.core.Keyword(null,"output-dir","output-dir",-290956991));
var parse_source_loc_info = ((function (map__42030,map__42030__$1,opts,output_dir){
return (function cljs$stacktrace$parse_source_loc_info(x){
if(cljs.core.truth_((function (){var and__25118__auto__ = x;
if(cljs.core.truth_(and__25118__auto__)){
return !(clojure.string.blank_QMARK_.call(null,x));
} else {
return and__25118__auto__;
}
})())){
return cljs.stacktrace.parse_int.call(null,x);
} else {
return null;
}
});})(map__42030,map__42030__$1,opts,output_dir))
;
var process_frame = ((function (map__42030,map__42030__$1,opts,output_dir){
return (function cljs$stacktrace$process_frame(frame_str){
if((clojure.string.blank_QMARK_.call(null,frame_str)) || ((cljs.core.re_find.call(null,/^\s+at/,frame_str) == null))){
return null;
} else {
var frame_str__$1 = clojure.string.replace.call(null,frame_str,/\s+at\s+/,"");
if(clojure.string.starts_with_QMARK_.call(null,frame_str__$1,"repl:")){
return null;
} else {
var parts = clojure.string.split.call(null,frame_str__$1,/\s+/);
var vec__42053 = ((((2) === cljs.core.count.call(null,parts)))?new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.first.call(null,parts),cljs.core.subs.call(null,cljs.core.second.call(null,parts),(1),(cljs.core.count.call(null,cljs.core.second.call(null,parts)) - (1)))], null):new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [null,cljs.core.first.call(null,parts)], null));
var function$ = cljs.core.nth.call(null,vec__42053,(0),null);
var file_AMPERSAND_line = cljs.core.nth.call(null,vec__42053,(1),null);
var vec__42056 = clojure.string.split.call(null,file_AMPERSAND_line,/:/);
var file_part = cljs.core.nth.call(null,vec__42056,(0),null);
var line_part = cljs.core.nth.call(null,vec__42056,(1),null);
var col_part = cljs.core.nth.call(null,vec__42056,(2),null);
return new cljs.core.PersistentArrayMap(null, 4, [new cljs.core.Keyword(null,"file","file",-1269645878),(cljs.core.truth_(function$)?(function (){var G__42059 = file_part;
if(cljs.core.truth_(output_dir)){
return clojure.string.replace.call(null,G__42059,[cljs.core.str(output_dir),cljs.core.str("/")].join(''),"");
} else {
return G__42059;
}
})():file_part),new cljs.core.Keyword(null,"function","function",-2127255473),function$,new cljs.core.Keyword(null,"line","line",212345235),parse_source_loc_info.call(null,line_part),new cljs.core.Keyword(null,"column","column",2078222095),parse_source_loc_info.call(null,col_part)], null);
}
}
});})(map__42030,map__42030__$1,opts,output_dir))
;
return cljs.core.vec.call(null,cljs.core.remove.call(null,cljs.core.nil_QMARK_,cljs.core.map.call(null,process_frame,clojure.string.split.call(null,st,/\n/))));
}));
cljs.stacktrace.remove_ext = (function cljs$stacktrace$remove_ext(file){
return clojure.string.replace.call(null,clojure.string.replace.call(null,clojure.string.replace.call(null,clojure.string.replace.call(null,file,/\.js$/,""),/\.cljs$/,""),/\.cljc$/,""),/\.clj$/,"");
});
/**
* Given a cljs.source-map source map data structure map a generated line
* and column back to the original line, column, and function called.
*/
cljs.stacktrace.mapped_line_column_call = (function cljs$stacktrace$mapped_line_column_call(sms,file,line,column){
var source_map = cljs.core.get.call(null,sms,cljs.core.symbol.call(null,clojure.string.replace.call(null,cljs.stacktrace.remove_ext.call(null,file),"/",".")));
var get_best_column = ((function (source_map){
return (function cljs$stacktrace$mapped_line_column_call_$_get_best_column(columns,column__$1){
return cljs.core.last.call(null,(function (){var or__25130__auto__ = cljs.core.get.call(null,columns,cljs.core.last.call(null,cljs.core.filter.call(null,((function (source_map){
return (function (p1__42060_SHARP_){
return (p1__42060_SHARP_ <= (column__$1 - (1)));
});})(source_map))
,cljs.core.sort.call(null,cljs.core.keys.call(null,columns)))));
if(cljs.core.truth_(or__25130__auto__)){
return or__25130__auto__;
} else {
return cljs.core.second.call(null,cljs.core.first.call(null,columns));
}
})());
});})(source_map))
;
var adjust = ((function (source_map){
return (function cljs$stacktrace$mapped_line_column_call_$_adjust(mapped){
return cljs.core.vec.call(null,cljs.core.map.call(null,((function (source_map){
return (function (p1__42061_SHARP_,p2__42062_SHARP_){
return p1__42061_SHARP_.call(null,p2__42062_SHARP_);
});})(source_map))
,new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.inc,cljs.core.inc,cljs.core.identity], null),mapped));
});})(source_map))
;
var default$ = new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [line,column,null], null);
var temp__4655__auto__ = cljs.core.get.call(null,source_map,(line - (1)));
if(cljs.core.truth_(temp__4655__auto__)){
var columns = temp__4655__auto__;
return adjust.call(null,cljs.core.map.call(null,get_best_column.call(null,columns,column),new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"line","line",212345235),new cljs.core.Keyword(null,"col","col",-1959363084),new cljs.core.Keyword(null,"name","name",1843675177)], null)));
} else {
return default$;
}
});
/**
* Given opts and a canonicalized JavaScript stacktrace frame, return the
* ClojureScript frame.
*/
cljs.stacktrace.mapped_frame = (function cljs$stacktrace$mapped_frame(p__42063,sms,opts){
var map__42069 = p__42063;
var map__42069__$1 = ((((!((map__42069 == null)))?((((map__42069.cljs$lang$protocol_mask$partition0$ & (64))) || (map__42069.cljs$core$ISeq$))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__42069):map__42069);
var function$ = cljs.core.get.call(null,map__42069__$1,new cljs.core.Keyword(null,"function","function",-2127255473));
var file = cljs.core.get.call(null,map__42069__$1,new cljs.core.Keyword(null,"file","file",-1269645878));
var line = cljs.core.get.call(null,map__42069__$1,new cljs.core.Keyword(null,"line","line",212345235));
var column = cljs.core.get.call(null,map__42069__$1,new cljs.core.Keyword(null,"column","column",2078222095));
var no_source_file_QMARK_ = ((cljs.core.not.call(null,file))?true:cljs.stacktrace.starts_with_QMARK_.call(null,file,"<"));
var vec__42071 = ((no_source_file_QMARK_)?new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [line,column,null], null):cljs.stacktrace.mapped_line_column_call.call(null,sms,file,line,column));
var line_SINGLEQUOTE_ = cljs.core.nth.call(null,vec__42071,(0),null);
var column_SINGLEQUOTE_ = cljs.core.nth.call(null,vec__42071,(1),null);
var call = cljs.core.nth.call(null,vec__42071,(2),null);
var file_SINGLEQUOTE_ = ((no_source_file_QMARK_)?null:((cljs.stacktrace.ends_with_QMARK_.call(null,file,".js"))?[cljs.core.str(cljs.core.subs.call(null,file,(0),(cljs.core.count.call(null,file) - (3)))),cljs.core.str(".cljs")].join(''):file));
return new cljs.core.PersistentArrayMap(null, 5, [new cljs.core.Keyword(null,"function","function",-2127255473),function$,new cljs.core.Keyword(null,"call","call",-519999866),call,new cljs.core.Keyword(null,"file","file",-1269645878),((no_source_file_QMARK_)?[cljs.core.str("NO_SOURCE_FILE"),cljs.core.str((cljs.core.truth_(file)?[cljs.core.str(" "),cljs.core.str(file)].join(''):null))].join(''):file_SINGLEQUOTE_),new cljs.core.Keyword(null,"line","line",212345235),line_SINGLEQUOTE_,new cljs.core.Keyword(null,"column","column",2078222095),column_SINGLEQUOTE_], null);
});
/**
* Given a vector representing the canonicalized JavaScript stacktrace
* return the ClojureScript stacktrace. The canonical stacktrace must be
* in the form:
*
* [{:file <string>
* :function <string>
* :line <integer>
* :column <integer>}*]
*
* :file must be a URL path (without protocol) relative to :output-dir or a
* identifier delimited by angle brackets. The returned mapped stacktrace will
* also contain :url entries to the original sources if it can be determined
* from the classpath.
*/
cljs.stacktrace.mapped_stacktrace = (function cljs$stacktrace$mapped_stacktrace(var_args){
var args42076 = [];
var len__26205__auto___42079 = arguments.length;
var i__26206__auto___42080 = (0);
while(true){
if((i__26206__auto___42080 < len__26205__auto___42079)){
args42076.push((arguments[i__26206__auto___42080]));
var G__42081 = (i__26206__auto___42080 + (1));
i__26206__auto___42080 = G__42081;
continue;
} else {
}
break;
}
var G__42078 = args42076.length;
switch (G__42078) {
case 2:
return cljs.stacktrace.mapped_stacktrace.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));
break;
case 3:
return cljs.stacktrace.mapped_stacktrace.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));
break;
default:
throw (new Error([cljs.core.str("Invalid arity: "),cljs.core.str(args42076.length)].join('')));
}
});
cljs.stacktrace.mapped_stacktrace.cljs$core$IFn$_invoke$arity$2 = (function (stacktrace,sms){
return cljs.stacktrace.mapped_stacktrace.call(null,stacktrace,sms,null);
});
cljs.stacktrace.mapped_stacktrace.cljs$core$IFn$_invoke$arity$3 = (function (stacktrace,sms,opts){
var call__GT_function = (function cljs$stacktrace$call__GT_function(x){
if(cljs.core.truth_(new cljs.core.Keyword(null,"call","call",-519999866).cljs$core$IFn$_invoke$arity$1(x))){
return cljs.core.PersistentHashMap.fromArrays([new cljs.core.Keyword(null,"function","function",-2127255473)],[new cljs.core.Keyword(null,"call","call",-519999866).cljs$core$IFn$_invoke$arity$1(x)]);
} else {
return cljs.core.PersistentArrayMap.EMPTY;
}
});
var call_merge = (function cljs$stacktrace$call_merge(function$,call){
return cljs.core.merge_with.call(null,(function (munged_fn_name,unmunged_call_name){
if(cljs.core._EQ_.call(null,munged_fn_name,clojure.string.replace.call(null,cljs.core.munge.call(null,unmunged_call_name),".","$"))){
return unmunged_call_name;
} else {
return munged_fn_name;
}
}),function$,call);
});
var mapped_frames = cljs.core.map.call(null,cljs.core.memoize.call(null,(function (p1__42074_SHARP_){
return cljs.stacktrace.mapped_frame.call(null,p1__42074_SHARP_,sms,opts);
})),stacktrace);
return cljs.core.vec.call(null,cljs.core.map.call(null,call_merge,cljs.core.map.call(null,((function (mapped_frames){
return (function (p1__42075_SHARP_){
return cljs.core.dissoc.call(null,p1__42075_SHARP_,new cljs.core.Keyword(null,"call","call",-519999866));
});})(mapped_frames))
,mapped_frames),cljs.core.concat.call(null,cljs.core.rest.call(null,cljs.core.map.call(null,call__GT_function,mapped_frames)),new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.PersistentArrayMap.EMPTY], null))));
});
cljs.stacktrace.mapped_stacktrace.cljs$lang$maxFixedArity = 3;
/**
* Given a vector representing the canonicalized JavaScript stacktrace and a map
* of library names to decoded source maps, print the ClojureScript stacktrace .
* See mapped-stacktrace.
*/
cljs.stacktrace.mapped_stacktrace_str = (function cljs$stacktrace$mapped_stacktrace_str(var_args){
var args42083 = [];
var len__26205__auto___42096 = arguments.length;
var i__26206__auto___42097 = (0);
while(true){
if((i__26206__auto___42097 < len__26205__auto___42096)){
args42083.push((arguments[i__26206__auto___42097]));
var G__42098 = (i__26206__auto___42097 + (1));
i__26206__auto___42097 = G__42098;
continue;
} else {
}
break;
}
var G__42085 = args42083.length;
switch (G__42085) {
case 2:
return cljs.stacktrace.mapped_stacktrace_str.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));
break;
case 3:
return cljs.stacktrace.mapped_stacktrace_str.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));
break;
default:
throw (new Error([cljs.core.str("Invalid arity: "),cljs.core.str(args42083.length)].join('')));
}
});
cljs.stacktrace.mapped_stacktrace_str.cljs$core$IFn$_invoke$arity$2 = (function (stacktrace,sms){
return cljs.stacktrace.mapped_stacktrace_str.call(null,stacktrace,sms,null);
});
cljs.stacktrace.mapped_stacktrace_str.cljs$core$IFn$_invoke$arity$3 = (function (stacktrace,sms,opts){
var sb__26116__auto__ = (new goog.string.StringBuffer());
var _STAR_print_newline_STAR_42086_42100 = cljs.core._STAR_print_newline_STAR_;
var _STAR_print_fn_STAR_42087_42101 = cljs.core._STAR_print_fn_STAR_;
cljs.core._STAR_print_newline_STAR_ = true;
cljs.core._STAR_print_fn_STAR_ = ((function (_STAR_print_newline_STAR_42086_42100,_STAR_print_fn_STAR_42087_42101,sb__26116__auto__){
return (function (x__26117__auto__){
return sb__26116__auto__.append(x__26117__auto__);
});})(_STAR_print_newline_STAR_42086_42100,_STAR_print_fn_STAR_42087_42101,sb__26116__auto__))
;
try{var seq__42088_42102 = cljs.core.seq.call(null,cljs.stacktrace.mapped_stacktrace.call(null,stacktrace,sms,opts));
var chunk__42089_42103 = null;
var count__42090_42104 = (0);
var i__42091_42105 = (0);
while(true){
if((i__42091_42105 < count__42090_42104)){
var map__42092_42106 = cljs.core._nth.call(null,chunk__42089_42103,i__42091_42105);
var map__42092_42107__$1 = ((((!((map__42092_42106 == null)))?((((map__42092_42106.cljs$lang$protocol_mask$partition0$ & (64))) || (map__42092_42106.cljs$core$ISeq$))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__42092_42106):map__42092_42106);
var function_42108 = cljs.core.get.call(null,map__42092_42107__$1,new cljs.core.Keyword(null,"function","function",-2127255473));
var file_42109 = cljs.core.get.call(null,map__42092_42107__$1,new cljs.core.Keyword(null,"file","file",-1269645878));
var line_42110 = cljs.core.get.call(null,map__42092_42107__$1,new cljs.core.Keyword(null,"line","line",212345235));
var column_42111 = cljs.core.get.call(null,map__42092_42107__$1,new cljs.core.Keyword(null,"column","column",2078222095));
cljs.core.println.call(null,"\t",[cljs.core.str((cljs.core.truth_(function_42108)?[cljs.core.str(function_42108),cljs.core.str(" ")].join(''):null)),cljs.core.str("("),cljs.core.str(file_42109),cljs.core.str((cljs.core.truth_(line_42110)?[cljs.core.str(":"),cljs.core.str(line_42110)].join(''):null)),cljs.core.str((cljs.core.truth_(column_42111)?[cljs.core.str(":"),cljs.core.str(column_42111)].join(''):null)),cljs.core.str(")")].join(''));
var G__42112 = seq__42088_42102;
var G__42113 = chunk__42089_42103;
var G__42114 = count__42090_42104;
var G__42115 = (i__42091_42105 + (1));
seq__42088_42102 = G__42112;
chunk__42089_42103 = G__42113;
count__42090_42104 = G__42114;
i__42091_42105 = G__42115;
continue;
} else {
var temp__4657__auto___42116 = cljs.core.seq.call(null,seq__42088_42102);
if(temp__4657__auto___42116){
var seq__42088_42117__$1 = temp__4657__auto___42116;
if(cljs.core.chunked_seq_QMARK_.call(null,seq__42088_42117__$1)){
var c__25941__auto___42118 = cljs.core.chunk_first.call(null,seq__42088_42117__$1);
var G__42119 = cljs.core.chunk_rest.call(null,seq__42088_42117__$1);
var G__42120 = c__25941__auto___42118;
var G__42121 = cljs.core.count.call(null,c__25941__auto___42118);
var G__42122 = (0);
seq__42088_42102 = G__42119;
chunk__42089_42103 = G__42120;
count__42090_42104 = G__42121;
i__42091_42105 = G__42122;
continue;
} else {
var map__42094_42123 = cljs.core.first.call(null,seq__42088_42117__$1);
var map__42094_42124__$1 = ((((!((map__42094_42123 == null)))?((((map__42094_42123.cljs$lang$protocol_mask$partition0$ & (64))) || (map__42094_42123.cljs$core$ISeq$))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__42094_42123):map__42094_42123);
var function_42125 = cljs.core.get.call(null,map__42094_42124__$1,new cljs.core.Keyword(null,"function","function",-2127255473));
var file_42126 = cljs.core.get.call(null,map__42094_42124__$1,new cljs.core.Keyword(null,"file","file",-1269645878));
var line_42127 = cljs.core.get.call(null,map__42094_42124__$1,new cljs.core.Keyword(null,"line","line",212345235));
var column_42128 = cljs.core.get.call(null,map__42094_42124__$1,new cljs.core.Keyword(null,"column","column",2078222095));
cljs.core.println.call(null,"\t",[cljs.core.str((cljs.core.truth_(function_42125)?[cljs.core.str(function_42125),cljs.core.str(" ")].join(''):null)),cljs.core.str("("),cljs.core.str(file_42126),cljs.core.str((cljs.core.truth_(line_42127)?[cljs.core.str(":"),cljs.core.str(line_42127)].join(''):null)),cljs.core.str((cljs.core.truth_(column_42128)?[cljs.core.str(":"),cljs.core.str(column_42128)].join(''):null)),cljs.core.str(")")].join(''));
var G__42129 = cljs.core.next.call(null,seq__42088_42117__$1);
var G__42130 = null;
var G__42131 = (0);
var G__42132 = (0);
seq__42088_42102 = G__42129;
chunk__42089_42103 = G__42130;
count__42090_42104 = G__42131;
i__42091_42105 = G__42132;
continue;
}
} else {
}
}
break;
}
}finally {cljs.core._STAR_print_fn_STAR_ = _STAR_print_fn_STAR_42087_42101;
cljs.core._STAR_print_newline_STAR_ = _STAR_print_newline_STAR_42086_42100;
}
return [cljs.core.str(sb__26116__auto__)].join('');
});
cljs.stacktrace.mapped_stacktrace_str.cljs$lang$maxFixedArity = 3;
//# sourceMappingURL=stacktrace.js.map?rel=1603199213718

File diff suppressed because one or more lines are too long

View file

@ -1,102 +0,0 @@
goog.addDependency("base.js", ['goog'], []);
goog.addDependency("../cljs/core.js", ['cljs.core'], ['goog.string', 'goog.object', 'goog.math.Integer', 'goog.string.StringBuffer', 'goog.array', 'goog.math.Long']);
goog.addDependency("../devtools/defaults.js", ['devtools.defaults'], ['cljs.core']);
goog.addDependency("../devtools/protocols.js", ['devtools.protocols'], ['cljs.core']);
goog.addDependency("../devtools/format.js", ['devtools.format'], ['cljs.core']);
goog.addDependency("../devtools/prefs.js", ['devtools.prefs'], ['cljs.core', 'devtools.defaults']);
goog.addDependency("../devtools/version.js", ['devtools.version'], ['cljs.core']);
goog.addDependency("../clojure/string.js", ['clojure.string'], ['goog.string', 'cljs.core', 'goog.string.StringBuffer']);
goog.addDependency("../cljs/pprint.js", ['cljs.pprint'], ['goog.string', 'cljs.core', 'goog.string.StringBuffer', 'clojure.string']);
goog.addDependency("../clojure/set.js", ['clojure.set'], ['cljs.core']);
goog.addDependency("../clojure/data.js", ['clojure.data'], ['cljs.core', 'clojure.set']);
goog.addDependency("../devtools/util.js", ['devtools.util'], ['cljs.core', 'devtools.version', 'goog.userAgent', 'cljs.pprint', 'devtools.defaults', 'clojure.data', 'devtools.prefs']);
goog.addDependency("../devtools/munging.js", ['devtools.munging'], ['devtools.util', 'cljs.core', 'goog.object', 'goog.string.StringBuffer', 'clojure.string']);
goog.addDependency("../devtools/formatters/helpers.js", ['devtools.formatters.helpers'], ['cljs.core', 'devtools.protocols', 'devtools.format', 'devtools.prefs', 'devtools.munging']);
goog.addDependency("../devtools/formatters/state.js", ['devtools.formatters.state'], ['cljs.core']);
goog.addDependency("../devtools/formatters/printing.js", ['devtools.formatters.printing'], ['devtools.formatters.helpers', 'devtools.formatters.state', 'cljs.core', 'devtools.protocols', 'devtools.format', 'devtools.prefs']);
goog.addDependency("../clojure/walk.js", ['clojure.walk'], ['cljs.core']);
goog.addDependency("../devtools/formatters/templating.js", ['devtools.formatters.templating'], ['devtools.formatters.helpers', 'devtools.formatters.state', 'devtools.util', 'cljs.core', 'devtools.protocols', 'cljs.pprint', 'clojure.string', 'clojure.walk']);
goog.addDependency("../devtools/formatters/markup.js", ['devtools.formatters.markup'], ['devtools.formatters.helpers', 'devtools.formatters.printing', 'devtools.formatters.templating', 'devtools.formatters.state', 'cljs.core', 'devtools.munging']);
goog.addDependency("../devtools/formatters/budgeting.js", ['devtools.formatters.budgeting'], ['devtools.formatters.helpers', 'devtools.formatters.markup', 'devtools.formatters.templating', 'devtools.formatters.state', 'cljs.core']);
goog.addDependency("../devtools/formatters/core.js", ['devtools.formatters.core'], ['devtools.formatters.helpers', 'devtools.formatters.markup', 'devtools.formatters.templating', 'devtools.formatters.state', 'cljs.core', 'devtools.protocols', 'devtools.formatters.budgeting', 'devtools.format', 'devtools.prefs']);
goog.addDependency("../devtools/toolbox.js", ['devtools.toolbox'], ['devtools.formatters.markup', 'devtools.formatters.templating', 'cljs.core', 'devtools.protocols']);
goog.addDependency("../cljs/stacktrace.js", ['cljs.stacktrace'], ['goog.string', 'cljs.core', 'clojure.string']);
goog.addDependency("../devtools/async.js", ['devtools.async'], ['cljs.core', 'goog.async.nextTick']);
goog.addDependency("../devtools/formatters.js", ['devtools.formatters'], ['devtools.formatters.core', 'devtools.util', 'cljs.core', 'goog.labs.userAgent.browser', 'devtools.prefs']);
goog.addDependency("../devtools/hints.js", ['devtools.hints'], ['cljs.stacktrace', 'cljs.core', 'devtools.prefs']);
goog.addDependency("../devtools/core.js", ['devtools.core'], ['devtools.toolbox', 'devtools.util', 'cljs.core', 'devtools.async', 'devtools.formatters', 'devtools.hints', 'devtools.defaults', 'devtools.prefs']);
goog.addDependency("../devtools/preload.js", ['devtools.preload'], ['cljs.core', 'devtools.core', 'devtools.prefs']);
goog.addDependency("../reagent/interop.js", ['reagent.interop'], ['cljs.core']);
goog.addDependency("../react.inc.js", ['cljsjs.react'], []);
goog.addDependency("../reagent/debug.js", ['reagent.debug'], ['cljs.core']);
goog.addDependency("../reagent/impl/util.js", ['reagent.impl.util'], ['reagent.interop', 'cljs.core', 'cljsjs.react', 'reagent.debug', 'clojure.string']);
goog.addDependency("../reagent/impl/batching.js", ['reagent.impl.batching'], ['reagent.impl.util', 'reagent.interop', 'cljs.core', 'reagent.debug', 'clojure.string']);
goog.addDependency("../reagent/ratom.js", ['reagent.ratom'], ['reagent.impl.util', 'cljs.core', 'reagent.impl.batching', 'clojure.set', 'reagent.debug']);
goog.addDependency("../re_com/util.js", ['re_com.util'], ['goog.date.UtcDateTime', 'reagent.ratom', 'cljs.core', 'clojure.set', 'goog.date.DateTime']);
goog.addDependency("../reagent/impl/component.js", ['reagent.impl.component'], ['reagent.impl.util', 'reagent.interop', 'reagent.ratom', 'cljs.core', 'reagent.impl.batching', 'reagent.debug']);
goog.addDependency("../reagent/impl/template.js", ['reagent.impl.template'], ['reagent.impl.util', 'reagent.interop', 'reagent.ratom', 'cljs.core', 'reagent.impl.batching', 'reagent.impl.component', 'reagent.debug', 'clojure.string', 'clojure.walk']);
goog.addDependency("../react-dom-server.inc.js", ['cljsjs.react.dom.server'], ['cljsjs.react']);
goog.addDependency("../reagent/dom/server.js", ['reagent.dom.server'], ['reagent.impl.util', 'reagent.interop', 'reagent.ratom', 'cljs.core', 'reagent.impl.template', 'cljsjs.react.dom.server']);
goog.addDependency("../react-dom.inc.js", ['cljsjs.react.dom'], ['cljsjs.react']);
goog.addDependency("../reagent/dom.js", ['reagent.dom'], ['reagent.impl.util', 'reagent.interop', 'reagent.ratom', 'cljs.core', 'reagent.impl.template', 'reagent.impl.batching', 'cljsjs.react.dom', 'reagent.debug']);
goog.addDependency("../reagent/core.js", ['reagent.core'], ['reagent.impl.util', 'reagent.dom.server', 'reagent.interop', 'reagent.ratom', 'cljs.core', 'reagent.impl.template', 'reagent.impl.batching', 'reagent.impl.component', 'reagent.debug', 'reagent.dom']);
goog.addDependency("../re_com/validate.js", ['re_com.validate'], ['goog.date.UtcDateTime', 're_com.util', 'goog.string', 'reagent.core', 'cljs.core', 'reagent.impl.template', 'clojure.set']);
goog.addDependency("../re_com/box.js", ['re_com.box'], ['cljs.core', 're_com.validate', 'clojure.string']);
goog.addDependency("../re_com/popover.js", ['re_com.popover'], ['re_com.util', 'reagent.ratom', 're_com.box', 'reagent.core', 'cljs.core', 're_com.validate', 'clojure.string']);
goog.addDependency("../re_com/text.js", ['re_com.text'], ['re_com.util', 're_com.box', 'cljs.core', 're_com.validate']);
goog.addDependency("../cljs/core/async/impl/protocols.js", ['cljs.core.async.impl.protocols'], ['cljs.core']);
goog.addDependency("../cljs/core/async/impl/buffers.js", ['cljs.core.async.impl.buffers'], ['cljs.core', 'cljs.core.async.impl.protocols']);
goog.addDependency("../cljs/core/async/impl/dispatch.js", ['cljs.core.async.impl.dispatch'], ['cljs.core', 'cljs.core.async.impl.buffers', 'goog.async.nextTick']);
goog.addDependency("../cljs/core/async/impl/channels.js", ['cljs.core.async.impl.channels'], ['cljs.core.async.impl.dispatch', 'cljs.core', 'cljs.core.async.impl.buffers', 'cljs.core.async.impl.protocols']);
goog.addDependency("../cljs/core/async/impl/ioc_helpers.js", ['cljs.core.async.impl.ioc_helpers'], ['cljs.core', 'cljs.core.async.impl.protocols']);
goog.addDependency("../cljs/core/async/impl/timers.js", ['cljs.core.async.impl.timers'], ['cljs.core.async.impl.channels', 'cljs.core.async.impl.dispatch', 'cljs.core', 'cljs.core.async.impl.protocols']);
goog.addDependency("../cljs/core/async.js", ['cljs.core.async'], ['cljs.core.async.impl.channels', 'cljs.core.async.impl.dispatch', 'cljs.core', 'cljs.core.async.impl.buffers', 'cljs.core.async.impl.protocols', 'cljs.core.async.impl.ioc_helpers', 'cljs.core.async.impl.timers']);
goog.addDependency("../re_com/misc.js", ['re_com.misc'], ['re_com.util', 're_com.popover', 're_com.box', 'reagent.core', 'cljs.core', 're_com.validate']);
goog.addDependency("../re_com/typeahead.js", ['re_com.typeahead'], ['re_com.util', 're_com.popover', 're_com.box', 'reagent.core', 'cljs.core', 'cljs.core.async', 're_com.validate', 'goog.events.KeyCodes', 're_com.misc']);
goog.addDependency("../re_com/tabs.js", ['re_com.tabs'], ['re_com.util', 're_com.box', 'cljs.core', 're_com.validate']);
goog.addDependency("../re_com/buttons.js", ['re_com.buttons'], ['re_com.util', 're_com.popover', 're_com.box', 'reagent.core', 'cljs.core', 're_com.validate']);
goog.addDependency("../re_com/alert.js", ['re_com.alert'], ['re_com.util', 're_com.box', 'cljs.core', 're_com.buttons', 're_com.validate']);
goog.addDependency("../cljs_time/internal/core.js", ['cljs_time.internal.core'], ['goog.string', 'cljs.core', 'goog.string.format', 'clojure.string']);
goog.addDependency("../cljs_time/core.js", ['cljs_time.core'], ['goog.date.UtcDateTime', 'cljs.core', 'goog.date.Interval', 'cljs_time.internal.core', 'goog.date.DateTime', 'goog.date.Date', 'clojure.string']);
goog.addDependency("../cljs_time/format.js", ['cljs_time.format'], ['goog.string', 'cljs.core', 'goog.date.duration', 'cljs_time.core', 'clojure.set', 'cljs_time.internal.core', 'goog.string.format', 'clojure.string', 'goog.date']);
goog.addDependency("../cljs_time/predicates.js", ['cljs_time.predicates'], ['cljs.core', 'cljs_time.core']);
goog.addDependency("../re_com/datepicker.js", ['re_com.datepicker'], ['re_com.util', 're_com.popover', 're_com.box', 'reagent.core', 'cljs.core', 'cljs_time.core', 're_com.validate', 'cljs_time.format', 'cljs_time.predicates']);
goog.addDependency("../re_com/input_time.js", ['re_com.input_time'], ['re_com.util', 're_com.text', 're_com.box', 'reagent.core', 'cljs.core', 're_com.validate']);
goog.addDependency("../re_com/tour.js", ['re_com.tour'], ['re_com.box', 'reagent.core', 'cljs.core', 're_com.buttons']);
goog.addDependency("../re_com/selection_list.js", ['re_com.selection_list'], ['re_com.util', 're_com.text', 're_com.box', 'cljs.core', 're_com.validate', 're_com.misc']);
goog.addDependency("../re_com/dropdown.js", ['re_com.dropdown'], ['re_com.util', 're_com.box', 'reagent.core', 'cljs.core', 're_com.validate', 'clojure.string']);
goog.addDependency("../re_com/splits.js", ['re_com.splits'], ['re_com.util', 're_com.box', 'reagent.core', 'cljs.core', 're_com.validate']);
goog.addDependency("../re_com/modal_panel.js", ['re_com.modal_panel'], ['cljs.core', 're_com.validate']);
goog.addDependency("../re_com/core.js", ['re_com.core'], ['re_com.popover', 're_com.text', 're_com.box', 'cljs.core', 're_com.typeahead', 're_com.tabs', 're_com.alert', 're_com.datepicker', 're_com.input_time', 're_com.buttons', 're_com.tour', 're_com.selection_list', 're_com.dropdown', 're_com.misc', 're_com.splits', 're_com.modal_panel']);
goog.addDependency("../swinging_needle_meter/utils.js", ['swinging_needle_meter.utils'], ['re_com.core', 'cljs.core']);
goog.addDependency("../swinging_needle_meter/swinging_needle_meter.js", ['swinging_needle_meter.swinging_needle_meter'], ['swinging_needle_meter.utils', 're_com.util', 're_com.core', 're_com.box', 'reagent.core', 'cljs.core', 're_com.validate', 'clojure.string']);
goog.addDependency("../re_frame/interop.js", ['re_frame.interop'], ['reagent.ratom', 'reagent.core', 'cljs.core', 'goog.async.nextTick']);
goog.addDependency("../re_frame/loggers.js", ['re_frame.loggers'], ['cljs.core', 'clojure.set']);
goog.addDependency("../re_frame/interceptor.js", ['re_frame.interceptor'], ['re_frame.interop', 'cljs.core', 're_frame.loggers']);
goog.addDependency("../re_frame/trace.js", ['re_frame.trace'], ['re_frame.interop', 'cljs.core', 're_frame.loggers']);
goog.addDependency("../re_frame/registrar.js", ['re_frame.registrar'], ['re_frame.interop', 'cljs.core', 're_frame.loggers']);
goog.addDependency("../re_frame/utils.js", ['re_frame.utils'], ['cljs.core', 're_frame.loggers']);
goog.addDependency("../re_frame/db.js", ['re_frame.db'], ['re_frame.interop', 'cljs.core']);
goog.addDependency("../re_frame/events.js", ['re_frame.events'], ['re_frame.interop', 're_frame.interceptor', 're_frame.trace', 're_frame.registrar', 'cljs.core', 're_frame.utils', 're_frame.loggers', 're_frame.db']);
goog.addDependency("../re_frame/router.js", ['re_frame.router'], ['re_frame.interop', 're_frame.events', 're_frame.trace', 'cljs.core', 're_frame.loggers']);
goog.addDependency("../re_frame/fx.js", ['re_frame.fx'], ['re_frame.interop', 're_frame.interceptor', 're_frame.events', 're_frame.registrar', 'cljs.core', 're_frame.router', 're_frame.loggers', 're_frame.db']);
goog.addDependency("../re_frame/cofx.js", ['re_frame.cofx'], ['re_frame.interceptor', 're_frame.registrar', 'cljs.core', 're_frame.loggers', 're_frame.db']);
goog.addDependency("../re_frame/std_interceptors.js", ['re_frame.std_interceptors'], ['re_frame.interceptor', 're_frame.registrar', 'cljs.core', 're_frame.utils', 're_frame.loggers', 're_frame.cofx', 'clojure.data', 're_frame.db']);
goog.addDependency("../re_frame/subs.js", ['re_frame.subs'], ['re_frame.interop', 're_frame.trace', 're_frame.registrar', 'cljs.core', 're_frame.utils', 're_frame.loggers', 're_frame.db']);
goog.addDependency("../re_frame/core.js", ['re_frame.core'], ['re_frame.interop', 're_frame.interceptor', 're_frame.events', 're_frame.fx', 're_frame.registrar', 'cljs.core', 're_frame.router', 'clojure.set', 're_frame.std_interceptors', 're_frame.loggers', 're_frame.subs', 're_frame.cofx', 're_frame.db']);
goog.addDependency("../swinging_needle_meter/views.js", ['swinging_needle_meter.views'], ['swinging_needle_meter.utils', 're_com.util', 're_com.core', 'reagent.core', 'cljs.core', 'swinging_needle_meter.swinging_needle_meter', 're_frame.core']);
goog.addDependency("../swinging_needle_meter/subs.js", ['swinging_needle_meter.subs'], ['cljs.core', 're_frame.core']);
goog.addDependency("../swinging_needle_meter/config.js", ['swinging_needle_meter.config'], ['cljs.core']);
goog.addDependency("../swinging_needle_meter/state.js", ['swinging_needle_meter.state'], ['cljs.core']);
goog.addDependency("../swinging_needle_meter/events.js", ['swinging_needle_meter.events'], ['swinging_needle_meter.state', 'cljs.core', 're_frame.core']);
goog.addDependency("../swinging_needle_meter/core.js", ['swinging_needle_meter.core'], ['swinging_needle_meter.views', 'swinging_needle_meter.subs', 'reagent.core', 'cljs.core', 'swinging_needle_meter.config', 'swinging_needle_meter.events', 're_frame.core']);
goog.addDependency("../cljs/reader.js", ['cljs.reader'], ['goog.string', 'cljs.core', 'goog.string.StringBuffer']);
goog.addDependency("../figwheel/client/utils.js", ['figwheel.client.utils'], ['goog.userAgent.product', 'goog.string', 'cljs.core', 'goog.string.StringBuffer', 'cljs.pprint', 'goog.async.Deferred', 'clojure.string', 'cljs.reader']);
goog.addDependency("../figwheel/client/file_reloading.js", ['figwheel.client.file_reloading'], ['goog.string', 'goog.net.jsloader', 'goog.Uri', 'cljs.core', 'goog.object', 'cljs.core.async', 'clojure.set', 'figwheel.client.utils', 'goog.async.Deferred', 'clojure.string']);
goog.addDependency("../cljs/spec/impl/gen.js", ['cljs.spec.impl.gen'], ['cljs.core']);
goog.addDependency("../cljs/spec.js", ['cljs.spec'], ['cljs.core', 'goog.object', 'cljs.spec.impl.gen', 'clojure.string', 'clojure.walk']);
goog.addDependency("../cljs/repl.js", ['cljs.repl'], ['cljs.core', 'cljs.spec']);
goog.addDependency("../figwheel/client/socket.js", ['figwheel.client.socket'], ['cljs.core', 'figwheel.client.utils', 'cljs.reader']);
goog.addDependency("../figwheel/client/heads_up.js", ['figwheel.client.heads_up'], ['goog.dom', 'goog.string', 'cljs.core', 'goog.dom.dataset', 'goog.object', 'cljs.core.async', 'cljs.pprint', 'figwheel.client.utils', 'figwheel.client.socket', 'clojure.string']);
goog.addDependency("../figwheel/client.js", ['figwheel.client'], ['goog.userAgent.product', 'goog.Uri', 'cljs.core', 'goog.object', 'cljs.core.async', 'figwheel.client.file_reloading', 'figwheel.client.utils', 'cljs.repl', 'figwheel.client.heads_up', 'figwheel.client.socket', 'clojure.string', 'cljs.reader']);
goog.addDependency("../figwheel/connect/dev.js", ['figwheel.connect.dev'], ['cljs.core', 'swinging_needle_meter.core', 'figwheel.client', 'figwheel.client.utils']);

View file

@ -1,759 +0,0 @@
(ns cljs-time.core
"### The core namespace for date-time operations in the cljs-time library.
Create a DateTime instance with date-time (or a local DateTime instance with local-date-time),
specifying the year, month, day, hour, minute, second, and millisecond:
=> (date-time 1986 10 14 4 3 27 456)
#<DateTime 1986-10-14T04:03:27.456Z>
=> (local-date-time 1986 10 14 4 3 27 456)
#<DateTime 1986-10-14T04:03:27.456>
Less-significant fields can be omitted:
=> (date-time 1986 10 14)
#<DateTime 1986-10-14T00:00:00.000Z>
=> (local-date-time 1986 10 14)
#<DateTime 1986-10-14T00:00:00.000>
Get the current time with (now) and the start of the Unix epoch with (epoch).
Once you have a date-time, use accessors like hour and second to access the
corresponding fields:
=> (hour (date-time 1986 10 14 22))
22
=> (hour (local-date-time 1986 10 14 22))
22
The functions after? and before? determine the relative position of two
DateTime instances:
=> (after? (date-time 1986 10) (date-time 1986 9))
true
=> (after? (local-date-time 1986 10) (local-date-time 1986 9))
true
Often you will want to find a date some amount of time from a given date. For
example, to find the time 1 month and 3 weeks from a given date-time:
=> (plus (date-time 1986 10 14) (months 1) (weeks 3))
#<DateTime 1986-12-05T00:00:00.000Z>
=> (plus (local-date-time 1986 10 14) (months 1) (weeks 3))
#<DateTime 1986-12-05T00:00:00.000Z>
An Interval is used to represent the span of time between two DateTime
instances. Construct one using interval, then query them using within?,
overlaps?, and abuts?
=> (within? (interval (date-time 1986) (date-time 1990)) (date-time 1987))
true
To find the amount of time encompased by an interval, use in-seconds and
in-minutes:
=> (in-minutes (interval (date-time 1986 10 2) (date-time 1986 10 14)))
17280
Note that all functions in this namespace work with Joda objects or ints. If
you need to print or parse date-times, see cljs-time.format. If you need to
ceorce date-times to or from other types, see cljs-time.coerce."
(:refer-clojure :exclude [= extend second])
(:require
[cljs-time.internal.core :as internal :refer [leap-year? format]]
[clojure.string :as string]
goog.date.Interval)
(:import
goog.date.Date
goog.date.DateTime
goog.date.UtcDateTime))
(def ^{:doc "**Note:** Equality in goog.date.* (and also with plain
javascript dates) is not the same as in Joda/clj-time. Two date
objects representing the same instant in time in goog.date.* are not
equal.
If you need to test for equality use either `cljs-time.core/=`, or
optionally you can require the `cljs-time.extend` namespace which will
extend the goog.date.* datatypes, so that clojure.core/= works as
expected."}
= cljs-time.internal.core/=)
(defprotocol DateTimeProtocol
"Interface for various date time functions"
(year [this] "Return the year component of the given date/time.")
(month [this] "Return the month component of the given date/time.")
(day [this] "Return the day of month component of the given date/time.")
(day-of-week [this] "Return the day of week component of the given date/time. Monday is 1 and Sunday is 7")
(hour [this] "Return the hour of day component of the given date/time. A time of 12:01am will have an hour component of 0.")
(minute [this] "Return the minute of hour component of the given date/time.")
(sec [this] "Return the second of minute component of the given date/time.")
(second [this] "Return the second of minute component of the given date/time.")
(milli [this] "Return the millisecond of second component of the given date/time.")
(equal? [this that] "Returns true if DateTime 'this' is strictly equal to date/time 'that'.")
(after? [this that] "Returns true if DateTime 'this' is strictly after date/time 'that'.")
(before? [this that] "Returns true if DateTime 'this' is strictly before date/time 'that'.")
(plus- [this period] "Returns a new date/time corresponding to the given date/time moved forwards by the given Period(s).")
(minus- [this period] "Returns a new date/time corresponding to the given date/time moved backwards by the given Period(s).")
(first-day-of-the-month- [this] "Returns the first day of the month")
(last-day-of-the-month- [this] "Returns the last day of the month"))
(defprotocol InTimeUnitProtocol
"Interface for in-<time unit> functions"
(in-millis [this] "Return the time in milliseconds.")
(in-seconds [this] "Return the time in seconds.")
(in-minutes [this] "Return the time in minutes.")
(in-hours [this] "Return the time in hours.")
(in-days [this] "Return the time in days.")
(in-weeks [this] "Return the time in weeks")
(in-months [this] "Return the time in months")
(in-years [this] "Return the time in years"))
(defrecord Interval [start end])
(defn interval
"Returns an Interval representing the span between the two given DateTime.
Note that intervals are closed on the left and open on the right."
[start end]
{:pre [(<= (.getTime start) (.getTime end))]}
(->Interval start end))
(defrecord Period [years months weeks days hours minutes seconds millis])
(defn period
([period value]
(map->Period {period value}))
([p1 v1 & kvs]
(apply assoc (period p1 v1) kvs)))
(def periods
(let [fixed-time-fn (fn [f set-fn op date value]
(let [date (.clone date)]
(when value (set-fn date (op (f date) value)))
date))]
{:millis (partial fixed-time-fn milli #(.setMilliseconds %1 %2))
:seconds (partial fixed-time-fn second #(.setSeconds %1 %2))
:minutes (partial fixed-time-fn minute #(.setMinutes %1 %2))
:hours (partial fixed-time-fn hour #(.setHours %1 %2))
:days (partial fixed-time-fn day #(.setDate %1 %2))
:weeks (fn [op date value]
(let [date (.clone date)]
(when value (.setDate date (op (day date) (* 7 value))))
date))
:months (fn [op date value]
(let [date (.clone date)]
(when value
(let [m (op 0 value)
i (goog.date.Interval. goog.date.Interval.MONTHS m)]
(.add date i)))
date))
:years (fn [op date value]
(let [date (.clone date)]
(when value
(if (and (leap-year? (year date))
(= 2 (month date))
(= 29 (day date)))
(.setDate date 28))
(.setYear date (op (year date) value)))
date))}))
(defn period-fn [p]
(fn [operator date]
(reduce (fn [d [k v]] ((periods k) operator d v)) date p)))
(extend-protocol DateTimeProtocol
goog.date.UtcDateTime
(year [this] (.getYear this))
(month [this] (inc (.getMonth this)))
(day [this] (.getDate this))
(day-of-week [this] (let [d (.getDay this)] (if (= d 0) 7 d)))
(hour [this] (.getHours this))
(minute [this] (.getMinutes this))
(second [this] (.getSeconds this))
(milli [this] (.getMilliseconds this))
(equal? [this that] (== (.getTime this) (.getTime that)))
(after? [this that] (> (.getTime this) (.getTime that)))
(before? [this that] (< (.getTime this) (.getTime that)))
(plus- [this period] ((period-fn period) + this))
(minus- [this period] ((period-fn period) - this))
(first-day-of-the-month- [this]
(goog.date.UtcDateTime. (.getYear this) (.getMonth this) 1 0 0 0 0))
(last-day-of-the-month- [this]
(minus-
(goog.date.UtcDateTime. (.getYear this) (inc (.getMonth this)) 1 0 0 0 0)
(period :days 1)))
goog.date.DateTime
(year [this] (.getYear this))
(month [this] (inc (.getMonth this)))
(day [this] (.getDate this))
(day-of-week [this] (let [d (.getDay this)] (if (= d 0) 7 d)))
(hour [this] (.getHours this))
(minute [this] (.getMinutes this))
(second [this] (.getSeconds this))
(milli [this] (.getMilliseconds this))
(equal? [this that] (== (.getTime this) (.getTime that)))
(after? [this that] (> (.getTime this) (.getTime that)))
(before? [this that] (< (.getTime this) (.getTime that)))
(plus- [this period] ((period-fn period) + this))
(minus- [this period] ((period-fn period) - this))
(first-day-of-the-month- [this]
(goog.date.DateTime. (.getYear this) (.getMonth this) 1 0 0 0 0))
(last-day-of-the-month- [this]
(minus-
(goog.date.DateTime. (.getYear this) (inc (.getMonth this)) 1 0 0 0 0)
(period :days 1)))
goog.date.Date
(year [this] (.getYear this))
(month [this] (inc (.getMonth this)))
(day [this] (.getDate this))
(day-of-week [this] (let [d (.getDay this)] (if (= d 0) 7 d)))
(hour [this] nil)
(minute [this] nil)
(second [this] nil)
(milli [this] nil)
(equal? [this that] (== (.getTime this) (.getTime that)))
(after? [this that] (> (.getTime this) (.getTime that)))
(before? [this that] (< (.getTime this) (.getTime that)))
(plus- [this period] ((period-fn period) + this))
(minus- [this period] ((period-fn period) - this))
(first-day-of-the-month- [this]
(goog.date.Date. (.getYear this) (.getMonth this) 1))
(last-day-of-the-month- [this]
(minus-
(goog.date.Date. (.getYear this) (inc (.getMonth this)) 1)
(period :days 1))))
(def utc #js {:id "UTC" :std_offset 0 :names ["UTC"] :transitions []})
(defn default-ms-fn []
(fn [] (js/Date.now)))
(defn offset-ms-fn
[offset]
(fn [] (+ (js/Date.now) offset)))
(defn static-ms-fn
[ms]
(fn [] ms))
(def ^:dynamic *ms-fn* (default-ms-fn))
(defn now
"Returns a DateTime for the current instant in the UTC time zone."
[]
(doto (goog.date.UtcDateTime.) (.setTime (*ms-fn*))))
(defn time-now
"Returns a local DateTime for the current instant without date or time zone
in the current time zone."
[]
(doto (goog.date.DateTime.) (.setTime (*ms-fn*))))
(defn at-midnight [datetime]
(let [datetime (.clone datetime)]
(doto datetime
(.setHours 0)
(.setMinutes 0)
(.setSeconds 0)
(.setMilliseconds 0))))
(defn today-at-midnight
"Returns a DateTime for today at midnight in the UTC time zone."
[]
(at-midnight (now)))
(defn epoch
"Returns a DateTime for the begining of the Unix epoch in the UTC time zone."
[]
(doto (goog.date.UtcDateTime.) (.setTime 0)))
(defn date-midnight
"Constructs and returns a new DateTime at midnight in UTC.
Specify the year, month of year, day of month. Note that month and day are
1-indexed. Any number of least-significant components can be ommited, in
which case they will default to 1."
([year]
(date-midnight year 1 1))
([year month]
(date-midnight year month 1))
([year month day]
(goog.date.UtcDateTime. year (dec month) day)))
(defn date-time
"Constructs and returns a new DateTime in UTC.
Specify the year, month of year, day of month, hour of day, minute if hour,
second of minute, and millisecond of second. Note that month and day are
1-indexed while hour, second, minute, and millis are 0-indexed.
Any number of least-significant components can be ommited, in which case
they will default to 1 or 0 as appropriate."
([year]
(date-time year 1 1 0 0 0 0))
([year month]
(date-time year month 1 0 0 0 0))
([year month day]
(date-time year month day 0 0 0 0))
([year month day hour]
(date-time year month day hour 0 0 0))
([year month day hour minute]
(date-time year month day hour minute 0 0))
([year month day hour minute second]
(date-time year month day hour minute second 0))
([year month day hour minute second millis]
(goog.date.UtcDateTime. year (dec month) day hour minute second millis)))
(defn local-date-time
"Constructs and returns a new local DateTime.
Specify the year, month of year, day of month, hour of day, minute of hour,
second of minute, and millisecond of second. Note that month and day are
1-indexed while hour, second, minute, and millis are 0-indexed.
Any number of least-significant components can be ommited, in which case
they will default to 1 or 0 as appropriate."
([year]
(local-date-time year 1 1 0 0 0 0))
([year month]
(local-date-time year month 1 0 0 0 0))
([year month day]
(local-date-time year month day 0 0 0 0))
([year month day hour]
(local-date-time year month day hour 0 0 0))
([year month day hour minute]
(local-date-time year month day hour minute 0 0))
([year month day hour minute second]
(local-date-time year month day hour minute second 0))
([year month day hour minute second millis]
(goog.date.DateTime. year (dec month) day hour minute second millis)))
(defn local-date
"Constructs and returns a new local DateTime.
Specify the year, month, and day. Does not deal with timezones."
[year month day]
(goog.date.Date. year (dec month) day))
(defn today
"Constructs and returns a new local DateTime representing today's date.
local DateTime objects do not deal with timezones at all."
[]
(doto (goog.date.Date.) (.setTime (*ms-fn*))))
(defn time-zone-for-offset
"Returns a timezone map for the given offset, specified either in hours or
hours and minutes."
([hours]
(time-zone-for-offset hours nil))
([hours minutes]
(let [sign (if (neg? hours) :- :+)
fmt (str "UTC%s%02d" (when minutes ":%02d"))
hours (if (neg? hours) (* -1 hours) hours)
tz-name (if minutes
(format fmt (name sign) hours minutes)
(format fmt (name sign) hours))]
(with-meta
{:id tz-name
:offset [sign hours (or minutes 0) 0]
:rules "-"
:names [tz-name]}
{:type ::time-zone}))))
(defn default-time-zone
"Returns the default timezone map for the current environment."
[]
(let [offset (.getTimezoneOffset
(doto (goog.date.DateTime.) (.setTime (*ms-fn*))))
hours (/ (* -1 offset) 60)]
(time-zone-for-offset (int hours) (mod hours 1))))
(defn to-default-time-zone
"Assuming `dt` is in the UTC timezone, returns a DateTime
corresponding to the same absolute instant in time as the given
DateTime, but with calendar fields corresponding to in the default
(local) timezone."
[dt]
(goog.date.DateTime. dt))
(defn from-default-time-zone
"Assuming `dt` is in the UTC timezone, returns a DateTime
corresponding to the same point in calendar time as the given
DateTime, but for a correspondingly different absolute instant in
time in the default (local) timezone.
Note: This implementation uses the ECMAScript 5.1 implementation which
trades some historical daylight savings transition accuracy for simplicity.
see http://es5.github.io/#x15.9.1.8
"
[dt]
(goog.date.DateTime. (.getYear dt)
(.getMonth dt)
(.getDate dt)
(.getHours dt)
(.getMinutes dt)
(.getSeconds dt)
(.getMilliseconds dt)))
(defn years
"Given a number, returns a Period representing that many years.
Without an argument, returns a Period representing only years."
([] (years nil))
([n] (period :years n)))
(defn months
"Given a number, returns a Period representing that many months.
Without an argument, returns a Period representing only months."
([] (months nil))
([n] (period :months n)))
(defn weeks
"Given a number, returns a Period representing that many weeks.
Without an argument, returns a Period representing only weeks."
([] (weeks nil))
([n] (period :weeks n)))
(defn days
"Given a number, returns a Period representing that many days.
Without an argument, returns a Period representing only days."
([] (days nil))
([n] (period :days n)))
(defn hours
"Given a number, returns a Period representing that many hours.
Without an argument, returns a Period representing only hours."
([] (hours nil))
([n] (period :hours n)))
(defn minutes
"Given a number, returns a Period representing that many minutes.
Without an argument, returns a Period representing only minutes."
([] (minutes nil))
([n] (period :minutes n)))
(defn seconds
"Given a number, returns a Period representing that many seconds.
Without an argument, returns a Period representing only seconds."
([] (seconds nil))
([n] (period :seconds n)))
(defn millis
"Given a number, returns a Period representing that many milliseconds.
Without an argument, returns a Period representing only milliseconds."
([] (millis nil))
([n] (period :millis n)))
(defn plus
"Returns a new date/time corresponding to the given date/time moved
forwards by the given Period(s)."
([dt p]
(plus- dt p))
([dt p & ps]
(reduce plus- (plus- dt p) ps)))
(defn minus
"Returns a new date/time object corresponding to the given date/time
moved backwards by the given Period(s)."
([dt p]
(minus- dt p))
([dt p & ps]
(reduce minus- (minus- dt p) ps)))
(defn ago
"Returns a DateTime a supplied period before the present.
e.g. `(-> 5 years ago)`"
[period]
(minus (now) period))
(defn yesterday
"Returns a DateTime for yesterday relative to now"
[]
(-> 1 days ago))
(defn from-now
"Returns a DateTime a supplied period after the present.
e.g. `(-> 30 minutes from-now)`"
[period]
(plus (now) period))
(defn earliest
"Returns the earliest of the supplied DateTimes"
([dt1 dt2]
(if (before? dt1 dt2) dt1 dt2))
([dts]
(reduce earliest dts)))
(defn latest
"Returns the latest of the supplied DateTimes"
([dt1 dt2]
(if (after? dt1 dt2) dt1 dt2))
([dts]
(reduce latest dts)))
(defn start
"Returns the start DateTime of an Interval."
[in]
(:start in))
(defn end
"Returns the end DateTime of an Interval."
[in]
(:end in))
(defn extend
"Returns an Interval with an end DateTime the specified Period after the end
of the given Interval"
[in & by]
(assoc in :end (apply plus (end in) by)))
(defn- month-range [{:keys [start end]}]
(->> (range)
(map #(plus start (months (inc %))))
(take-while #(not (after? % end)))))
(defn- total-days-in-whole-months [interval]
(map #(.getNumberOfDaysInMonth %) (month-range interval)))
(defn- in-months-
"Returns the number of months in the given Interval.
For example, the interval 2nd Jan 2012 midnight to 2nd Feb 2012 midnight,
returns 1 month.
Likewise, 29th Dec 2011 midnight to 29th Feb 2012 midnight returns 2 months.
But also, 31st Dec 2011 midnight to 29th Feb 2012 midnight returns 2 months.
And, 28th Dec 2012 midnight to 28th Feb 2013 midnight returns 2 months."
[{:keys [start end] :as interval}]
(count (total-days-in-whole-months interval)))
(defn- in-years-
"Returns the number of standard years in the given Interval."
[{:keys [start end]}]
(let [sm (month start) sd (day start)
em (month end) ed (day end)
d1 (cond (and (= sm 2) (= sd 29) (= em 2) (= ed 28)) 0
(before? (date-time (year start) sm sd)
(date-time (year start) em ed)) 0
(after? (date-time (year start) sm sd)
(date-time (year start) em ed)) 1
:else-is-same-date 0)]
(- (year end) (year start) d1)))
(defn conversion-error [from to]
(let [from (string/capitalize (name from))
to (name to)]
(throw
(ex-info (format "%s cannot be converted to %s" from to)
{:type :unsupported-operation}))))
(extend-protocol InTimeUnitProtocol
cljs-time.core.Period
(in-millis [{:keys [millis seconds minutes hours days weeks months years]}]
(cond months (conversion-error :months :millis)
years (conversion-error :years :millis)
:default (+ millis
(* seconds 1000)
(* minutes 60 1000)
(* hours 60 60 1000)
(* days 24 60 60 1000)
(* weeks 7 24 60 60 1000))))
(in-seconds [this] (int (/ (in-millis this) 1000)))
(in-minutes [this] (int (/ (in-seconds this) 60)))
(in-hours [this] (int (/ (in-minutes this) 60)))
(in-days [this] (int (/ (in-hours this) 24)))
(in-weeks [this] (int (/ (in-days this) 7)))
(in-months [{:keys [millis seconds minutes hours days weeks months years]}]
(cond millis (conversion-error :millis :months)
seconds (conversion-error :seconds :months)
minutes (conversion-error :minutes :months)
hours (conversion-error :hours :months)
days (conversion-error :days :months)
weeks (conversion-error :weeks :months)
months (+ months (* (or years 0) 12))
years (* years 12)))
(in-years [{:keys [millis seconds minutes hours days weeks months years]}]
(cond millis (conversion-error :millis :years)
seconds (conversion-error :seconds :years)
minutes (conversion-error :minutes :years)
hours (conversion-error :hours :years)
days (conversion-error :days :years)
weeks (conversion-error :weeks :years)
months (int (+ (/ months 12) years))
years years))
cljs-time.core.Interval
(in-millis [{:keys [start end]}] (- (.getTime end) (.getTime start)))
(in-seconds [this] (int (/ (in-millis this) 1000)))
(in-minutes [this] (int (/ (in-seconds this) 60)))
(in-hours [this] (int (/ (in-minutes this) 60)))
(in-days [this] (int (/ (in-hours this) 24)))
(in-weeks [this] (int (/ (in-days this) 7)))
(in-months [this] (in-months- this))
(in-years [this] (in-years- this)))
(defn within?
"With 2 arguments: Returns true if the given Interval contains the given
DateTime. Note that if the DateTime is exactly equal to the
end of the interval, this function returns false.
With 3 arguments: Returns true if the start DateTime is
equal to or before and the end DateTime is equal to or after the test
DateTime."
([{:keys [start end]} date]
(within? start end date))
([start end date]
(or (= start date)
;(= end date)
(and (before? start date) (after? end date)))))
(defn overlaps?
"With 2 arguments: Returns true of the two given Intervals overlap.
Note that intervals that satisfy abuts? do not satisfy overlaps?
With 4 arguments: Returns true if the range specified by start-a and end-a
overlaps with the range specified by start-b and end-b."
([{start-a :start end-a :end} {start-b :start end-b :end}]
(and (not (or (= start-a end-b) (= end-a start-b)))
(overlaps? start-a end-a start-b end-b)))
([start-a end-a start-b end-b]
(or (and (before? start-b end-a) (after? end-b start-a))
(and (after? end-b start-a) (before? start-b end-a))
(or (= start-a end-b) (= start-b end-a)))))
(defn abuts?
"Returns true if Interval a abuts b, i.e. then end of a is exactly the
beginning of b."
[{start-a :start end-a :end} {start-b :start end-b :end}]
(or (= start-a end-b) (= end-a start-b)))
(defn date? [x]
(satisfies? DateTimeProtocol x))
(defn interval? [x]
(instance? Interval x))
(defn period? [x]
(instance? Period x))
(defn period-type? [type x]
(and (period? x) (contains? x type)))
(defn years?
"Returns true if the given value is an instance of Years"
[val]
(period-type? :years val))
(defn months?
"Returns true if the given value is an instance of Months"
[val]
(period-type? :months val))
(defn weeks?
"Returns true if the given value is an instance of Weeks"
[val]
(period-type? :weeks val))
(defn days?
"Returns true if the given value is an instance of Days"
[val]
(period-type? :days val))
(defn hours?
"Returns true if the given value is an instance of Hours"
[val]
(period-type? :hours val))
(defn minutes?
"Returns true if the given value is an instance of Minutes"
[val]
(period-type? :minutes val))
(defn seconds?
"Returns true if the given value is an instance of Seconds"
[val]
(period-type? :seconds val))
(defn mins-ago
[d]
(in-minutes (interval d (now))))
(defn last-day-of-the-month
([dt]
(last-day-of-the-month- dt))
([year month]
(last-day-of-the-month- (date-time year month))))
(defn number-of-days-in-the-month
([dt]
(number-of-days-in-the-month (year dt) (month dt)))
([year month]
(.getDate (last-day-of-the-month year month))))
(defn first-day-of-the-month
([dt]
(first-day-of-the-month- dt))
([year month]
(first-day-of-the-month- (date-time year month))))
(defprotocol IToPeriod
(->period [obj]))
(extend-protocol IToPeriod
cljs-time.core.Interval
(->period [{:keys [start end] :as interval}]
(let [years (in-years interval)
start-year (year start)
leap-years (count
(remove false?
(map leap-year?
(range start-year (+ start-year years)))))
start-month (month start)
days-in-months (total-days-in-whole-months interval)
months (- (count days-in-months) (* years 12))
days-to-remove (reduce + days-in-months)
days (- (in-days interval) days-to-remove)
hours-to-remove (* 24 (+ days days-to-remove))
hours (- (in-hours interval) hours-to-remove)
minutes-to-remove (* 60 (+ hours hours-to-remove))
minutes (- (in-minutes interval) minutes-to-remove)
seconds-to-remove (* 60 (+ minutes minutes-to-remove))
seconds (- (in-seconds interval) seconds-to-remove)]
(period :years years
:months months
:days days
:hours hours
:minutes minutes
:seconds seconds
:millis (- (in-millis interval)
(* 1000 (+ seconds seconds-to-remove))))))
cljs-time.core.Period
(->period [period] period))
(defn today-at
([hours minutes seconds millis]
(let [midnight (doto (goog.date.Date.) (.setTime (*ms-fn*)))]
(doto (goog.date.UtcDateTime. 0)
(.setYear (.getYear midnight))
(.setMonth (.getMonth midnight))
(.setDate (.getDate midnight))
(.setHours hours)
(.setMinutes minutes)
(.setSeconds seconds)
(.setMilliseconds millis))))
([hours minutes seconds]
(today-at hours minutes seconds 0))
([hours minutes]
(today-at hours minutes 0)))
(defn do-at* [base-date-time body-fn]
(binding [*ms-fn* (static-ms-fn (.getTime base-date-time))]
(body-fn)))

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

View file

@ -1,538 +0,0 @@
(ns cljs-time.format
"### Utilities for parsing and unparsing DateTimes as Strings.
Parsing and printing are controlled by formatters. You can either use one
of the built in ISO 8601 and a single RFC 822 formatters or define your own, e.g.:
(def built-in-formatter (formatters :basic-date-time))
(def custom-formatter (formatter \"yyyyMMdd\"))
To see a list of available built-in formatters and an example of a date-time
printed in their format:
(show-formatters)
Once you have a formatter, parsing and printing are strait-forward:
=> (parse custom-formatter \"20100311\")
#<DateTime 2010-03-11T00:00:00.000Z>
=> (unparse custom-formatter (date-time 2010 10 3))
\"20101003\"
By default the parse function always returns a DateTime instance with a UTC
time zone, and the unparse function always represents a given DateTime
instance in UTC. A formatter can be modified to different timezones, locales,
etc with the functions with-zone, with-locale, with-chronology, and
with-pivot-year."
(:require
[cljs-time.internal.core :refer [index-of valid-date? format zero-pad]]
[cljs-time.core :as time]
[clojure.set :refer [difference]]
[clojure.string :as string]
[goog.date :as date]
[goog.date.duration :as duration]
[goog.string :as gstring]
[goog.string.format]))
(def months
["January" "February" "March" "April" "May" "June" "July" "August"
"September" "October" "November" "December"])
(def days
["Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday"])
(defn abbreviate [n s]
(subs s 0 n))
(def ^{:doc "**Note: not all formatters have been implemented yet.**
The pattern syntax is mostly compatible with java.text.SimpleDateFormat -
time zone names cannot be parsed and a few more symbols are supported. All
ASCII letters are reserved as pattern letters, which are defined as follows:
Symbol Meaning Presentation Examples
------ ------- ------------ -------
G era text AD
C century of era (>=0) number 20
Y year of era (>=0) year 1996
x weekyear year 1996
w week of weekyear number 27
e day of week number 2
E day of week text Tuesday; Tue
y year year 1996
D day of year number 189
M month of year month July; Jul; 07
d day of month number 10
a halfday of day text PM
K hour of halfday (0~11) number 0
h clockhour of halfday (1~12) number 12
H hour of day (0~23) number 0
k clockhour of day (1~24) number 24
m minute of hour number 30
s second of minute number 55
S fraction of second number 978
a meridiem text am; pm
A meridiem text AM; PM
z time zone text Pacific Standard Time; PST
Z time zone offset/id zone -0800; -08:00; America/Los_Angeles
' escape for text delimiter
'' single quote literal '
The count of pattern letters determine the format.
**Text:** If the number of pattern letters is 4 or more, the full form is used;
otherwise a short or abbreviated form is used if available.
**Number:** The minimum number of digits. Shorter numbers are zero-padded to this
amount.
**Year:** Numeric presentation for year and weekyear fields are handled
specially. For example, if the count of 'y' is 2, the year will be displayed
as the zero-based year of the century, which is two digits.
**Month:** 3 or over, use text, otherwise use number.
**Zone:** 'Z' outputs offset without a colon, 'ZZ' outputs the offset with a
colon, 'ZZZ' or more outputs the zone id.
**Zone names:** Time zone names ('z') cannot be parsed.
Any characters in the pattern that are not in the ranges of ['a'..'z'] and
['A'..'Z'] will be treated as quoted text. For instance, characters like ':',
'.', ' ', '#' and '?' will appear in the resulting time text even they are
not embraced within single quotes."}
date-formatters
(let [d #(.getDate %)
M #(inc (.getMonth %))
y #(.getYear %)
h #(let [hr (mod (.getHours %) 12)]
(if (zero? hr) 12 hr))
a #(if (< (.getHours %) 12) "am" "pm")
A #(if (< (.getHours %) 12) "AM" "PM")
H #(.getHours %)
m #(.getMinutes %)
s #(.getSeconds %)
S #(.getMilliseconds %)
Z #(.getTimezoneOffsetString %)
doy #(.getDayOfYear %)
dow #(.getDay %)]
{"d" d
"dd" #(zero-pad (d %))
"dth" #(let [d (d %)] (str d (case d 1 "st" 2 "nd" 3 "rd" 21 "st" 22 "nd" 23 "rd" 31 "st" "th")))
"dow" #(days (dow %))
"D" doy
"DD" doy
"DDD" doy
"EEE" #(abbreviate 3 (days (dow %)))
"EEEE" #(days (dow %))
"M" M
"MM" #(zero-pad (M %))
"MMM" #(abbreviate 3 (months (dec (M %))))
"MMMM" #(months (dec (M %)))
"yyyy" y
"YYYY" y
"yy" #(mod (y %) 100)
"YY" #(mod (y %) 100)
"xxxx" y
"a" a
"A" A
"h" h
"H" H
"m" m
"s" s
"S" S
"hh" #(zero-pad (h %))
"HH" #(zero-pad (H %))
"mm" #(zero-pad (m %))
"ss" #(zero-pad (s %))
"SSS" #(zero-pad (S %) 3)
"Z" Z
"ZZ" Z
"ww" #(zero-pad (.getWeekNumber %))
"e" dow}))
(defn timezone-adjustment [d timezone-string]
(let [[_ sign hh mm] (string/split timezone-string
#"Z|(?:([-+])(\d{2})(?::?(\d{2}))?)$")]
(when (and sign hh mm)
(let [sign (cond (= sign "-") time/plus
(= sign "+") time/minus)
[hh mm] (map #(js/parseInt % 10) [hh mm])
adjusted (-> d
(sign (time/hours hh))
(sign (time/minutes mm)))]
(.setTime d (.getTime adjusted))))
d))
(def date-parsers
(let [parse-int #(js/parseInt % 10)
assoc-fn (fn [kw] #(assoc %1 kw (parse-int %2)))
y (assoc-fn :years)
d (assoc-fn :days)
M #(assoc %1 :months (dec (parse-int %2)))
h #(assoc %1 :hours (mod (parse-int %2) 12))
a (fn [{:keys [hours] :as date} x]
(if (#{"pm" "p"} (string/lower-case x))
(assoc date :hours (let [hours (+ 12 hours)]
(if (= hours 24) 0 hours)))
date))
H (assoc-fn :hours)
m (assoc-fn :minutes)
s (assoc-fn :seconds)
S (assoc-fn :millis)
MMM #(let [full (first (filter (fn [m]
(re-seq (re-pattern (str "^" %2)) m))
months))]
(M %1 (str (inc (index-of months full)))))
MMMM #(M %1 (str (inc (index-of months %2))))
skip (fn [x & args] x)
tz #(assoc %1 :time-zone %2)]
{"d" ["(\\d{1,2})" d]
"dd" ["(\\d{2})" d]
"D" ["(\\d{1,3})" d]
"DD" ["(\\d{2,3})" d]
"DDD" ["(\\d{3})" d]
"dth" ["(\\d{1,2})(?:st|nd|rd|th)" d]
"M" ["(\\d{1,2})" M]
"MM" ["((?:\\d{2})|(?:\\b\\d{1,2}\\b))" M]
"y" ["(\\d{1,4})" y]
"yy" ["(\\d{2,4})" y]
"yyyy" ["(\\d{4})" y]
"Y" ["(\\d{1,4})" y]
"YY" ["(\\d{2,4})" y]
"YYYY" ["(\\d{4})" y]
"MMM" [(str \( (string/join \| (map (partial abbreviate 3) months)) \)) MMM]
"MMMM" [(str \( (string/join \| months) \)) MMMM]
"E" [(str \( (string/join \| (map (partial abbreviate 3) days)) \)) skip]
"EEE" [(str \( (string/join \| (map (partial abbreviate 3) days)) \)) skip]
"EEEE" [(str \( (string/join \| days) \)) skip]
"dow" [(str \( (string/join \| days) \)) skip]
"a" ["(am|pm|a|p|AM|PM|A|P)" a]
"A" ["(am|pm|a|p|AM|PM|A|P)" a]
"m" ["(\\d{1,2})" m]
"s" ["(\\d{1,2})" s]
"S" ["(\\d{1,2})" S]
"h" ["(\\d{1,2})" h]
"H" ["(\\d{1,2})" H]
"hh" ["(\\d{2})" h]
"HH" ["(\\d{2})" H]
"mm" ["(\\d{2})" m]
"ss" ["(\\d{2})" s]
"SSS" ["(\\d{3})" S]
"Z" ["((?:(?:\\+|-)\\d{2}:?\\d{2})|Z+)" tz]
"ZZ" ["((?:(?:\\+|-)\\d{2}:\\d{2})|Z+)" tz]}))
(def date-setters
{:years #(.setYear %1 %2)
:months #(.setMonth %1 %2)
:days #(.setDate %1 %2)
:hours #(.setHours %1 %2)
:minutes #(.setMinutes %1 %2)
:seconds #(.setSeconds %1 %2)
:millis #(.setMilliseconds %1 %2)
:time-zone timezone-adjustment})
(defn parser-sort-order-pred [parser]
(index-of
["YYYY" "YY" "Y" "yyyy" "yy" "y" "d" "dd" "D" "DD" "DDD" "dth"
"M" "MM" "MMM" "MMMM" "dow" "h" "H" "m" "s" "S" "hh" "HH" "mm" "ss" "a" "A"
"SSS" "Z" "ZZ"]
parser))
(def date-format-pattern
(re-pattern
(str "(" (string/join ")|(" (reverse (sort-by count (keys date-formatters)))) ")")))
(defn old-string-replace [s match replacement]
(.replace s (js/RegExp. (.-source match) "g") replacement))
(defn date-parse-pattern [formatter]
(-> formatter
(old-string-replace #"'([^']+)'" "$1")
(old-string-replace date-format-pattern #(first (date-parsers %)))
re-pattern))
(defn- parser-fn [fmts]
(fn [s]
(->> (interleave (nfirst (re-seq (date-parse-pattern fmts) s))
(map first (re-seq date-format-pattern fmts)))
(partition 2)
(sort-by (comp parser-sort-order-pred second)))))
(defn- formatter-fn [fmts formatters]
(fn [date & [formatter-overrides]]
(let [a (atom {:c 0})]
[(old-string-replace
fmts
#"'([^']+)'"
(fn [x s]
(if (and (seq s) (= \' (first x)) (= \' (last x)))
(let [{:keys [c]} @a
k (str "&&&&" c)]
(swap! a assoc-in [:replace k] (constantly s))
(swap! a update-in [:c] inc)
k)
x)))
(-> (.-source date-format-pattern)
(cond->>
(:replace @a)
(str "(" (string/join ")|(" (keys (:replace @a))) ")|"))
(re-pattern))
#(((merge formatters formatter-overrides (:replace @a)) %) date)])))
(defn formatter
([fmts]
(formatter fmts time/utc))
([fmts dtz]
(with-meta
{:format-str fmts
:formatters date-formatters}
{:type ::formatter})))
(defn formatter-local [fmts]
(with-meta
{:format-str fmts
:formatters (assoc date-formatters
"Z" (constantly "")
"ZZ" (constantly ""))}
{:type ::formatter}))
(defn not-implemented [sym]
#(throw (clj->js {:name :not-implemented
:message (format "%s not implemented yet" (name sym))})))
(defn with-default-year
"Return a copy of a formatter that uses the given default year."
[f default-year]
(assoc f :default-year default-year))
(def ^{:doc "Map of ISO 8601 and a single RFC 822 formatters that can be used
for parsing and, in most cases, printing.
Note: due to current implementation limitations, timezone information
cannot be kept. Although the correct offset will be applied to UTC
time if supplied."}
formatters
{:basic-date (formatter "yyyyMMdd")
:basic-date-time (formatter "yyyyMMdd'T'HHmmss.SSSZ")
:basic-date-time-no-ms (formatter "yyyyMMdd'T'HHmmssZ")
:basic-ordinal-date (formatter "yyyyDDD")
:basic-ordinal-date-time (formatter "yyyyDDD'T'HHmmss.SSSZ")
:basic-ordinal-date-time-no-ms (formatter "yyyyDDD'T'HHmmssZ")
:basic-time (formatter "HHmmss.SSSZ")
:basic-time-no-ms (formatter "HHmmssZ")
:basic-t-time (formatter "'T'HHmmss.SSSZ")
:basic-t-time-no-ms (formatter "'T'HHmmssZ")
:basic-week-date (formatter "xxxx'W'wwe")
:basic-week-date-time (formatter "xxxx'W'wwe'T'HHmmss.SSSZ")
:basic-week-date-time-no-ms (formatter "xxxx'W'wwe'T'HHmmssZ")
:date (formatter "yyyy-MM-dd")
:date-element-parser (not-implemented 'dateElementParser)
:date-hour (formatter "yyyy-MM-dd'T'HH")
:date-hour-minute (formatter "yyyy-MM-dd'T'HH:mm")
:date-hour-minute-second (formatter "yyyy-MM-dd'T'HH:mm:ss")
:date-hour-minute-second-fraction (formatter "yyyy-MM-dd'T'HH:mm:ss.SSS")
:date-hour-minute-second-ms (formatter "yyyy-MM-dd'T'HH:mm:ss.SSS")
:date-opt-time (not-implemented 'dateOptionalTimeParser)
:date-parser (not-implemented 'dateParser)
:date-time (formatter "yyyy-MM-dd'T'HH:mm:ss.SSSZZ")
:date-time-no-ms (formatter "yyyy-MM-dd'T'HH:mm:ssZZ")
:date-time-parser (not-implemented 'dateTimeParser)
:hour (formatter "HH")
:hour-minute (formatter "HH:mm")
:hour-minute-second (formatter "HH:mm:ss")
:hour-minute-second-fraction (formatter "HH:mm:ss.SSS")
:hour-minute-second-ms (formatter "HH:mm:ss.SSS")
:local-date-opt-time (not-implemented 'localDateOptionalTimeParser)
:local-date (not-implemented 'localDateParser)
:local-time (not-implemented 'localTimeParser)
:ordinal-date (formatter "yyyy-DDD")
:ordinal-date-time (formatter "yyyy-DDD'T'HH:mm:ss.SSSZZ")
:ordinal-date-time-no-ms (formatter "yyyy-DDD'T'HH:mm:ssZZ")
:time (formatter "HH:mm:ss.SSSZZ")
:time-element-parser (not-implemented 'timeElementParser)
:time-no-ms (formatter "HH:mm:ssZZ")
:time-parser (formatter 'timeParser)
:t-time (formatter "'T'HH:mm:ss.SSSZZ")
:t-time-no-ms (formatter "'T'HH:mm:ssZZ")
:week-date (formatter "xxxx-'W'ww-e")
:week-date-time (formatter "xxxx-'W'ww-e'T'HH:mm:ss.SSSZZ")
:week-date-time-no-ms (formatter "xxxx-'W'ww-e'T'HH:mm:ssZZ")
:weekyear (formatter "xxxx")
:weekyear-week (formatter "xxxx-'W'ww")
:weekyear-week-day (formatter "xxxx-'W'ww-e")
:year (formatter "yyyy")
:year-month (formatter "yyyy-MM")
:year-month-day (formatter "yyyy-MM-dd")
:rfc822 (formatter "EEE, dd MMM yyyy HH:mm:ss Z")
:mysql (formatter "yyyy-MM-dd HH:mm:ss")})
(def ^{:private true} parsers
#{:date-element-parser :date-opt-time :date-parser :date-time-parser
:local-date-opt-time :local-date :local-time :time-element-parser
:time-parser})
(def ^{:private true} printers
(difference (set (keys formatters)) parsers))
(def part-splitter-regex
#"(?:(?!(?:\+|-)\d{2}):(?!\d{2}$))|[^\w:]+|.[TW]|'[^']+'")
(defprotocol IDateMap
(date-map [date]))
(extend-protocol IDateMap
goog.date.Date
(date-map [date]
{:years 0 :months 0 :days 1})
goog.date.DateTime
(date-map [date]
{:years 0 :months 0 :days 1 :hours 0 :minutes 0 :seconds 0 :millis 0})
goog.date.UtcDateTime
(date-map [date]
{:years 0 :months 0 :days 1 :hours 0 :minutes 0 :seconds 0 :millis 0
:time-zone nil}))
(defn parse* [constructor {:keys [format-str default-year] :as fmt} s]
{:pre [(seq s)]}
(let [min-parts (count (string/split s part-splitter-regex))]
(let [parse-fn (parser-fn format-str)
parse-seq (seq (map (fn [[a b]] [a (second (date-parsers b))])
(parse-fn s)))]
(if (>= (count parse-seq) min-parts)
(let [d (new constructor 0 0 0 0 0 0 0)
empty (assoc (date-map d) :years (or default-year 0))
setters (select-keys date-setters (keys empty))]
(->> parse-seq
(reduce (fn [date [part do-parse]] (do-parse date part)) empty)
valid-date?
(merge-with #(%1 d %2) setters))
d)
(throw
(ex-info "The parser could not match the input string."
{:type :parser-no-match}))))))
(defn parse
"Returns a DateTime instance in the UTC time zone obtained by parsing the
given string according to the given formatter."
([fmt s]
(parse* goog.date.UtcDateTime fmt s))
([s]
(first
(for [f (vals formatters)
:let [d (try (parse f s) (catch :default _))]
:when d] d))))
(defn parse-local
"Returns a local DateTime instance obtained by parsing the
given string according to the given formatter."
([fmt s]
(parse* goog.date.DateTime fmt s))
([s]
(first
(for [f (vals formatters)
:let [d (try (parse-local f s) (catch js/Error _ nil))]
:when d] d))))
(defn parse-local-date
"Returns a local Date instance obtained by parsing the
given string according to the given formatter."
([fmt s]
(parse* goog.date.Date fmt s))
([s]
(first
(for [f (vals formatters)
:let [d (try (parse-local-date f s) (catch js/Error _ nil))]
:when d] d))))
(defn unparse
"Returns a string representing the given DateTime instance in UTC and in the
form determined by the given formatter."
[{:keys [format-str formatters]} dt]
{:pre [(not (nil? dt)) (instance? goog.date.DateTime dt)]}
(apply old-string-replace ((formatter-fn format-str formatters) dt)))
(defn unparse-local
"Returns a string representing the given local DateTime instance in the
form determined by the given formatter."
[{:keys [format-str formatters] :as fmt} dt]
{:pre [(not (nil? dt)) (instance? goog.date.DateTime dt)]}
(apply old-string-replace
((formatter-fn format-str formatters) dt (assoc date-formatters
"Z" (constantly "")
"ZZ" (constantly "")))))
(defn unparse-local-date
"Returns a string representing the given local Date instance in the form
determined by the given formatter."
[{:keys [format-str formatters] :as fmt} dt]
{:pre [(not (nil? dt)) (instance? goog.date.Date dt)]}
(apply old-string-replace
((formatter-fn format-str formatters) dt (assoc date-formatters
"Z" (constantly "")
"ZZ" (constantly "")))))
(defn show-formatters
"Shows how a given DateTime, or by default the current time, would be
formatted with each of the available printing formatters."
([] (show-formatters (time/now)))
([dt]
(doseq [p (sort printers)]
(let [fmt (formatters p)]
(print (format "%-40s%s\n" p (unparse fmt dt)))))))
(defprotocol Mappable
(instant->map [instant] "Returns a map representation of the given instant.
It will contain the following keys: :years, :months,
:days, :hours, :minutes and :seconds."))
(defn unparse-duration
"Accepts a Period or Interval and outputs an absolute duration time
in form of \"1 day\", \"2 hours\", \"20 minutes\", \"2 days 1 hour
15 minutes\" etc."
[duration]
(-> duration time/in-millis duration/format))
(defn- to-map [years months days hours minutes seconds millis]
{:years years
:months months
:days days
:hours hours
:minutes minutes
:seconds seconds
:millis millis})
(extend-protocol Mappable
goog.date.UtcDateTime
(instant->map [dt]
(to-map
(.getYear dt)
(inc (.getMonth dt))
(.getDate dt)
(.getHours dt)
(.getMinutes dt)
(.getSeconds dt)
(.getMilliseconds dt)))
cljs-time.core.Period
(instant->map [m]
(time/->period m))
cljs-time.core.Interval
(instant->map [m]
(time/->period m))
cljs.core/PersistentArrayMap
(instant->map [m]
(case (:type (meta m))
:cljs-time.core/period m
:cljs-time.core/interval (time/->period m))))

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,73 +0,0 @@
(ns cljs-time.internal.core
(:refer-clojure :exclude [=])
(:require
[clojure.string :as string]
[goog.string :as gstring]
[goog.string.format]))
(defn = [& args]
(cond (every? #(instance? goog.date.Date %) args)
(apply cljs.core/= (map #(.getTime %) args))
:default (apply cljs.core/= args)))
(defn leap-year? [y]
(cond (zero? (mod y 400)) true
(zero? (mod y 100)) false
(zero? (mod y 4)) true
:else false))
(def days-in-month [31 28 31 30 31 30 31 31 30 31 30 31])
(defn year-corrected-dim [year month]
(cond-> (days-in-month (if (= month 1) 11 (dec month)))
(and (leap-year? year) (= month 2)) inc))
(defn valid-date?
[{:keys [years months days hours minutes seconds millis] :as d}]
(let [months (inc months)]
(if (and years
(<= 1 months 12)
(<= 1 days (year-corrected-dim years months))
(<= 0 hours 23)
(<= 0 minutes 59)
(<= 0 seconds 60)
(<= 0 millis 999))
d
(throw (ex-info "Date is not valid" {:type :invalid-date :date d})))))
(defn index-of [coll x]
(first (keep-indexed #(when (= %2 x) %1) coll)))
(defn format
"Formats a string using goog.string.format."
[fmt & args]
(let [args (map (fn [x]
(if (or (keyword? x) (symbol? x))
(str x)
x))
args)]
(apply gstring/format fmt args)))
(defn zero-pad
"Remove the need to pull in gstring/format code in advanced compilation"
([n] (if (<= 0 n 9) (str "0" n) (str n)))
([n zeros]
; No need to handle negative numbers
(if (> 1 zeros)
(str n)
(str (string/join (take (- zeros (count (str n))) (repeat "0")))
n))))
(defn multiplied-by [period scalar]
(letfn [(scale-fn [field]
(when field
(* field scalar)))]
(-> period
(update-in [:millis] scale-fn)
(update-in [:seconds] scale-fn)
(update-in [:minutes] scale-fn)
(update-in [:hours] scale-fn)
(update-in [:days] scale-fn)
(update-in [:weeks] scale-fn)
(update-in [:months] scale-fn)
(update-in [:years] scale-fn))))

File diff suppressed because one or more lines are too long

View file

@ -1,216 +0,0 @@
// Compiled by ClojureScript 1.9.229 {}
goog.provide('cljs_time.internal.core');
goog.require('cljs.core');
goog.require('clojure.string');
goog.require('goog.string');
goog.require('goog.string.format');
cljs_time.internal.core._EQ_ = (function cljs_time$internal$core$_EQ_(var_args){
var args__26212__auto__ = [];
var len__26205__auto___31798 = arguments.length;
var i__26206__auto___31799 = (0);
while(true){
if((i__26206__auto___31799 < len__26205__auto___31798)){
args__26212__auto__.push((arguments[i__26206__auto___31799]));
var G__31800 = (i__26206__auto___31799 + (1));
i__26206__auto___31799 = G__31800;
continue;
} else {
}
break;
}
var argseq__26213__auto__ = ((((0) < args__26212__auto__.length))?(new cljs.core.IndexedSeq(args__26212__auto__.slice((0)),(0),null)):null);
return cljs_time.internal.core._EQ_.cljs$core$IFn$_invoke$arity$variadic(argseq__26213__auto__);
});
cljs_time.internal.core._EQ_.cljs$core$IFn$_invoke$arity$variadic = (function (args){
if(cljs.core.every_QMARK_.call(null,(function (p1__31795_SHARP_){
return (p1__31795_SHARP_ instanceof goog.date.Date);
}),args)){
return cljs.core.apply.call(null,cljs.core._EQ_,cljs.core.map.call(null,(function (p1__31796_SHARP_){
return p1__31796_SHARP_.getTime();
}),args));
} else {
return cljs.core.apply.call(null,cljs.core._EQ_,args);
}
});
cljs_time.internal.core._EQ_.cljs$lang$maxFixedArity = (0);
cljs_time.internal.core._EQ_.cljs$lang$applyTo = (function (seq31797){
return cljs_time.internal.core._EQ_.cljs$core$IFn$_invoke$arity$variadic(cljs.core.seq.call(null,seq31797));
});
cljs_time.internal.core.leap_year_QMARK_ = (function cljs_time$internal$core$leap_year_QMARK_(y){
if((cljs.core.mod.call(null,y,(400)) === (0))){
return true;
} else {
if((cljs.core.mod.call(null,y,(100)) === (0))){
return false;
} else {
if((cljs.core.mod.call(null,y,(4)) === (0))){
return true;
} else {
return false;
}
}
}
});
cljs_time.internal.core.days_in_month = new cljs.core.PersistentVector(null, 12, 5, cljs.core.PersistentVector.EMPTY_NODE, [(31),(28),(31),(30),(31),(30),(31),(31),(30),(31),(30),(31)], null);
cljs_time.internal.core.year_corrected_dim = (function cljs_time$internal$core$year_corrected_dim(year,month){
var G__31802 = cljs_time.internal.core.days_in_month.call(null,(cljs.core.truth_(cljs_time.internal.core._EQ_.call(null,month,(1)))?(11):(month - (1))));
if(cljs.core.truth_((function (){var and__25118__auto__ = cljs_time.internal.core.leap_year_QMARK_.call(null,year);
if(cljs.core.truth_(and__25118__auto__)){
return cljs_time.internal.core._EQ_.call(null,month,(2));
} else {
return and__25118__auto__;
}
})())){
return (G__31802 + (1));
} else {
return G__31802;
}
});
cljs_time.internal.core.valid_date_QMARK_ = (function cljs_time$internal$core$valid_date_QMARK_(p__31803){
var map__31806 = p__31803;
var map__31806__$1 = ((((!((map__31806 == null)))?((((map__31806.cljs$lang$protocol_mask$partition0$ & (64))) || (map__31806.cljs$core$ISeq$))?true:false):false))?cljs.core.apply.call(null,cljs.core.hash_map,map__31806):map__31806);
var d = map__31806__$1;
var years = cljs.core.get.call(null,map__31806__$1,new cljs.core.Keyword(null,"years","years",-1298579689));
var months = cljs.core.get.call(null,map__31806__$1,new cljs.core.Keyword(null,"months","months",-45571637));
var days = cljs.core.get.call(null,map__31806__$1,new cljs.core.Keyword(null,"days","days",-1394072564));
var hours = cljs.core.get.call(null,map__31806__$1,new cljs.core.Keyword(null,"hours","hours",58380855));
var minutes = cljs.core.get.call(null,map__31806__$1,new cljs.core.Keyword(null,"minutes","minutes",1319166394));
var seconds = cljs.core.get.call(null,map__31806__$1,new cljs.core.Keyword(null,"seconds","seconds",-445266194));
var millis = cljs.core.get.call(null,map__31806__$1,new cljs.core.Keyword(null,"millis","millis",-1338288387));
var months__$1 = (months + (1));
if(cljs.core.truth_((function (){var and__25118__auto__ = years;
if(cljs.core.truth_(and__25118__auto__)){
return ((((1) <= months__$1)) && ((months__$1 <= (12)))) && ((((1) <= days)) && ((days <= cljs_time.internal.core.year_corrected_dim.call(null,years,months__$1)))) && ((((0) <= hours)) && ((hours <= (23)))) && ((((0) <= minutes)) && ((minutes <= (59)))) && ((((0) <= seconds)) && ((seconds <= (60)))) && ((((0) <= millis)) && ((millis <= (999))));
} else {
return and__25118__auto__;
}
})())){
return d;
} else {
throw cljs.core.ex_info.call(null,"Date is not valid",new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null,"type","type",1174270348),new cljs.core.Keyword(null,"invalid-date","invalid-date",2030506573),new cljs.core.Keyword(null,"date","date",-1463434462),d], null));
}
});
cljs_time.internal.core.index_of = (function cljs_time$internal$core$index_of(coll,x){
return cljs.core.first.call(null,cljs.core.keep_indexed.call(null,(function (p1__31809_SHARP_,p2__31808_SHARP_){
if(cljs.core.truth_(cljs_time.internal.core._EQ_.call(null,p2__31808_SHARP_,x))){
return p1__31809_SHARP_;
} else {
return null;
}
}),coll));
});
/**
* Formats a string using goog.string.format.
*/
cljs_time.internal.core.format = (function cljs_time$internal$core$format(var_args){
var args__26212__auto__ = [];
var len__26205__auto___31812 = arguments.length;
var i__26206__auto___31813 = (0);
while(true){
if((i__26206__auto___31813 < len__26205__auto___31812)){
args__26212__auto__.push((arguments[i__26206__auto___31813]));
var G__31814 = (i__26206__auto___31813 + (1));
i__26206__auto___31813 = G__31814;
continue;
} else {
}
break;
}
var argseq__26213__auto__ = ((((1) < args__26212__auto__.length))?(new cljs.core.IndexedSeq(args__26212__auto__.slice((1)),(0),null)):null);
return cljs_time.internal.core.format.cljs$core$IFn$_invoke$arity$variadic((arguments[(0)]),argseq__26213__auto__);
});
cljs_time.internal.core.format.cljs$core$IFn$_invoke$arity$variadic = (function (fmt,args){
var args__$1 = cljs.core.map.call(null,(function (x){
if(((x instanceof cljs.core.Keyword)) || ((x instanceof cljs.core.Symbol))){
return [cljs.core.str(x)].join('');
} else {
return x;
}
}),args);
return cljs.core.apply.call(null,goog.string.format,fmt,args__$1);
});
cljs_time.internal.core.format.cljs$lang$maxFixedArity = (1);
cljs_time.internal.core.format.cljs$lang$applyTo = (function (seq31810){
var G__31811 = cljs.core.first.call(null,seq31810);
var seq31810__$1 = cljs.core.next.call(null,seq31810);
return cljs_time.internal.core.format.cljs$core$IFn$_invoke$arity$variadic(G__31811,seq31810__$1);
});
/**
* Remove the need to pull in gstring/format code in advanced compilation
*/
cljs_time.internal.core.zero_pad = (function cljs_time$internal$core$zero_pad(var_args){
var args31815 = [];
var len__26205__auto___31818 = arguments.length;
var i__26206__auto___31819 = (0);
while(true){
if((i__26206__auto___31819 < len__26205__auto___31818)){
args31815.push((arguments[i__26206__auto___31819]));
var G__31820 = (i__26206__auto___31819 + (1));
i__26206__auto___31819 = G__31820;
continue;
} else {
}
break;
}
var G__31817 = args31815.length;
switch (G__31817) {
case 1:
return cljs_time.internal.core.zero_pad.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));
break;
case 2:
return cljs_time.internal.core.zero_pad.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));
break;
default:
throw (new Error([cljs.core.str("Invalid arity: "),cljs.core.str(args31815.length)].join('')));
}
});
cljs_time.internal.core.zero_pad.cljs$core$IFn$_invoke$arity$1 = (function (n){
if((((0) <= n)) && ((n <= (9)))){
return [cljs.core.str("0"),cljs.core.str(n)].join('');
} else {
return [cljs.core.str(n)].join('');
}
});
cljs_time.internal.core.zero_pad.cljs$core$IFn$_invoke$arity$2 = (function (n,zeros){
if(((1) > zeros)){
return [cljs.core.str(n)].join('');
} else {
return [cljs.core.str(clojure.string.join.call(null,cljs.core.take.call(null,(zeros - cljs.core.count.call(null,[cljs.core.str(n)].join(''))),cljs.core.repeat.call(null,"0")))),cljs.core.str(n)].join('');
}
});
cljs_time.internal.core.zero_pad.cljs$lang$maxFixedArity = 2;
cljs_time.internal.core.multiplied_by = (function cljs_time$internal$core$multiplied_by(period,scalar){
var scale_fn = (function cljs_time$internal$core$multiplied_by_$_scale_fn(field){
if(cljs.core.truth_(field)){
return (field * scalar);
} else {
return null;
}
});
return cljs.core.update_in.call(null,cljs.core.update_in.call(null,cljs.core.update_in.call(null,cljs.core.update_in.call(null,cljs.core.update_in.call(null,cljs.core.update_in.call(null,cljs.core.update_in.call(null,cljs.core.update_in.call(null,period,new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"millis","millis",-1338288387)], null),scale_fn),new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"seconds","seconds",-445266194)], null),scale_fn),new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"minutes","minutes",1319166394)], null),scale_fn),new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"hours","hours",58380855)], null),scale_fn),new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"days","days",-1394072564)], null),scale_fn),new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"weeks","weeks",1844596125)], null),scale_fn),new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"months","months",-45571637)], null),scale_fn),new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, [new cljs.core.Keyword(null,"years","years",-1298579689)], null),scale_fn);
});
//# sourceMappingURL=core.js.map?rel=1603199194749

File diff suppressed because one or more lines are too long

View file

@ -1,75 +0,0 @@
(ns cljs-time.predicates
"### Predicate functions to ask basic questions about a date.
Was it Monday?
(monday? (clj-time.core/date-time 1999 9 9))
Is it January?
(january? (clj-time.core/date-time 2011 1 1))"
(:require [cljs-time.core :as time]))
;; days of the week
(defn monday? [date-time]
(= (time/day-of-week date-time) 1))
(defn tuesday? [date-time]
(= (time/day-of-week date-time) 2))
(defn wednesday? [date-time]
(= (time/day-of-week date-time) 3))
(defn thursday? [date-time]
(= (time/day-of-week date-time) 4))
(defn friday? [date-time]
(= (time/day-of-week date-time) 5))
(defn saturday? [date-time]
(= (time/day-of-week date-time) 6))
(defn sunday? [date-time]
(= (time/day-of-week date-time) 7))
;; weekend / weekday checks
(defn weekend? [date-time]
(or (saturday? date-time) (sunday? date-time)))
(defn weekday? [date-time]
(not (weekend? date-time)))
;; months of the year
(defn january? [date-time]
(= (time/month date-time) 1))
(defn february? [date-time]
(= (time/month date-time) 2))
(defn march? [date-time]
(= (time/month date-time) 3))
(defn april? [date-time]
(= (time/month date-time) 4))
(defn may? [date-time]
(= (time/month date-time) 5))
(defn june? [date-time]
(= (time/month date-time) 6))
(defn july? [date-time]
(= (time/month date-time) 7))
(defn august? [date-time]
(= (time/month date-time) 8))
(defn september? [date-time]
(= (time/month date-time) 9))
(defn october? [date-time]
(= (time/month date-time) 10))
(defn november? [date-time]
(= (time/month date-time) 11))
(defn december? [date-time]
(= (time/month date-time) 12))

File diff suppressed because one or more lines are too long

View file

@ -1,74 +0,0 @@
// Compiled by ClojureScript 1.9.229 {}
goog.provide('cljs_time.predicates');
goog.require('cljs.core');
goog.require('cljs_time.core');
cljs_time.predicates.monday_QMARK_ = (function cljs_time$predicates$monday_QMARK_(date_time){
return cljs.core._EQ_.call(null,cljs_time.core.day_of_week.call(null,date_time),(1));
});
cljs_time.predicates.tuesday_QMARK_ = (function cljs_time$predicates$tuesday_QMARK_(date_time){
return cljs.core._EQ_.call(null,cljs_time.core.day_of_week.call(null,date_time),(2));
});
cljs_time.predicates.wednesday_QMARK_ = (function cljs_time$predicates$wednesday_QMARK_(date_time){
return cljs.core._EQ_.call(null,cljs_time.core.day_of_week.call(null,date_time),(3));
});
cljs_time.predicates.thursday_QMARK_ = (function cljs_time$predicates$thursday_QMARK_(date_time){
return cljs.core._EQ_.call(null,cljs_time.core.day_of_week.call(null,date_time),(4));
});
cljs_time.predicates.friday_QMARK_ = (function cljs_time$predicates$friday_QMARK_(date_time){
return cljs.core._EQ_.call(null,cljs_time.core.day_of_week.call(null,date_time),(5));
});
cljs_time.predicates.saturday_QMARK_ = (function cljs_time$predicates$saturday_QMARK_(date_time){
return cljs.core._EQ_.call(null,cljs_time.core.day_of_week.call(null,date_time),(6));
});
cljs_time.predicates.sunday_QMARK_ = (function cljs_time$predicates$sunday_QMARK_(date_time){
return cljs.core._EQ_.call(null,cljs_time.core.day_of_week.call(null,date_time),(7));
});
cljs_time.predicates.weekend_QMARK_ = (function cljs_time$predicates$weekend_QMARK_(date_time){
var or__25130__auto__ = cljs_time.predicates.saturday_QMARK_.call(null,date_time);
if(cljs.core.truth_(or__25130__auto__)){
return or__25130__auto__;
} else {
return cljs_time.predicates.sunday_QMARK_.call(null,date_time);
}
});
cljs_time.predicates.weekday_QMARK_ = (function cljs_time$predicates$weekday_QMARK_(date_time){
return cljs.core.not.call(null,cljs_time.predicates.weekend_QMARK_.call(null,date_time));
});
cljs_time.predicates.january_QMARK_ = (function cljs_time$predicates$january_QMARK_(date_time){
return cljs.core._EQ_.call(null,cljs_time.core.month.call(null,date_time),(1));
});
cljs_time.predicates.february_QMARK_ = (function cljs_time$predicates$february_QMARK_(date_time){
return cljs.core._EQ_.call(null,cljs_time.core.month.call(null,date_time),(2));
});
cljs_time.predicates.march_QMARK_ = (function cljs_time$predicates$march_QMARK_(date_time){
return cljs.core._EQ_.call(null,cljs_time.core.month.call(null,date_time),(3));
});
cljs_time.predicates.april_QMARK_ = (function cljs_time$predicates$april_QMARK_(date_time){
return cljs.core._EQ_.call(null,cljs_time.core.month.call(null,date_time),(4));
});
cljs_time.predicates.may_QMARK_ = (function cljs_time$predicates$may_QMARK_(date_time){
return cljs.core._EQ_.call(null,cljs_time.core.month.call(null,date_time),(5));
});
cljs_time.predicates.june_QMARK_ = (function cljs_time$predicates$june_QMARK_(date_time){
return cljs.core._EQ_.call(null,cljs_time.core.month.call(null,date_time),(6));
});
cljs_time.predicates.july_QMARK_ = (function cljs_time$predicates$july_QMARK_(date_time){
return cljs.core._EQ_.call(null,cljs_time.core.month.call(null,date_time),(7));
});
cljs_time.predicates.august_QMARK_ = (function cljs_time$predicates$august_QMARK_(date_time){
return cljs.core._EQ_.call(null,cljs_time.core.month.call(null,date_time),(8));
});
cljs_time.predicates.september_QMARK_ = (function cljs_time$predicates$september_QMARK_(date_time){
return cljs.core._EQ_.call(null,cljs_time.core.month.call(null,date_time),(9));
});
cljs_time.predicates.october_QMARK_ = (function cljs_time$predicates$october_QMARK_(date_time){
return cljs.core._EQ_.call(null,cljs_time.core.month.call(null,date_time),(10));
});
cljs_time.predicates.november_QMARK_ = (function cljs_time$predicates$november_QMARK_(date_time){
return cljs.core._EQ_.call(null,cljs_time.core.month.call(null,date_time),(11));
});
cljs_time.predicates.december_QMARK_ = (function cljs_time$predicates$december_QMARK_(date_time){
return cljs.core._EQ_.call(null,cljs_time.core.month.call(null,date_time),(12));
});
//# sourceMappingURL=predicates.js.map?rel=1603199196017

View file

@ -1 +0,0 @@
{"version":3,"file":"\/Users\/simon\/workspace\/swinging-needle-meter\/docs\/js\/compiled\/out\/cljs_time\/predicates.js","sources":["predicates.cljs?rel=1603199196018"],"lineCount":74,"mappings":";AAAA;;;AAWA,qCAAA,rCAAMA,kFAASC;AAAf,AACE,gFAAA,zEAACC,yBAAE,AAACC,qCAAiBF;;AAEvB,sCAAA,tCAAMG,oFAAUH;AAAhB,AACE,gFAAA,zEAACC,yBAAE,AAACC,qCAAiBF;;AAEvB,wCAAA,xCAAMI,wFAAYJ;AAAlB,AACE,gFAAA,zEAACC,yBAAE,AAACC,qCAAiBF;;AAEvB,uCAAA,vCAAMK,sFAAWL;AAAjB,AACE,gFAAA,zEAACC,yBAAE,AAACC,qCAAiBF;;AAEvB,qCAAA,rCAAMM,kFAASN;AAAf,AACE,gFAAA,zEAACC,yBAAE,AAACC,qCAAiBF;;AAEvB,uCAAA,vCAAMO,sFAAWP;AAAjB,AACE,gFAAA,zEAACC,yBAAE,AAACC,qCAAiBF;;AAEvB,qCAAA,rCAAMQ,kFAASR;AAAf,AACE,gFAAA,zEAACC,yBAAE,AAACC,qCAAiBF;;AAGvB,sCAAA,tCAAMS,oFAAUT;AAAhB,AACE,IAAAU,oBAAI,AAACH,+CAAUP;AAAf,AAAA,oBAAAU;AAAAA;;AAA0B,OAACF,6CAAQR;;;AAErC,sCAAA,tCAAMW,oFAAUX;AAAhB,AACE,OAACY,wBAAI,AAACH,8CAAST;;AAGjB,sCAAA,tCAAMa,oFAAUb;AAAhB,AACE,0EAAA,nEAACC,yBAAE,AAACa,+BAAWd;;AAEjB,uCAAA,vCAAMe,sFAAWf;AAAjB,AACE,0EAAA,nEAACC,yBAAE,AAACa,+BAAWd;;AAEjB,oCAAA,pCAAMgB,gFAAQhB;AAAd,AACE,0EAAA,nEAACC,yBAAE,AAACa,+BAAWd;;AAEjB,oCAAA,pCAAMiB,gFAAQjB;AAAd,AACE,0EAAA,nEAACC,yBAAE,AAACa,+BAAWd;;AAEjB,kCAAA,lCAAMkB,4EAAMlB;AAAZ,AACE,0EAAA,nEAACC,yBAAE,AAACa,+BAAWd;;AAEjB,mCAAA,nCAAMmB,8EAAOnB;AAAb,AACE,0EAAA,nEAACC,yBAAE,AAACa,+BAAWd;;AAEjB,mCAAA,nCAAMoB,8EAAOpB;AAAb,AACE,0EAAA,nEAACC,yBAAE,AAACa,+BAAWd;;AAEjB,qCAAA,rCAAMqB,kFAASrB;AAAf,AACE,0EAAA,nEAACC,yBAAE,AAACa,+BAAWd;;AAEjB,wCAAA,xCAAMsB,wFAAYtB;AAAlB,AACE,0EAAA,nEAACC,yBAAE,AAACa,+BAAWd;;AAEjB,sCAAA,tCAAMuB,oFAAUvB;AAAhB,AACE,0EAAA,nEAACC,yBAAE,AAACa,+BAAWd;;AAEjB,uCAAA,vCAAMwB,sFAAWxB;AAAjB,AACE,0EAAA,nEAACC,yBAAE,AAACa,+BAAWd;;AAEjB,uCAAA,vCAAMyB,sFAAWzB;AAAjB,AACE,0EAAA,nEAACC,yBAAE,AAACa,+BAAWd","names":["cljs-time.predicates\/monday?","date-time","cljs.core\/=","cljs-time.core\/day-of-week","cljs-time.predicates\/tuesday?","cljs-time.predicates\/wednesday?","cljs-time.predicates\/thursday?","cljs-time.predicates\/friday?","cljs-time.predicates\/saturday?","cljs-time.predicates\/sunday?","cljs-time.predicates\/weekend?","or__25130__auto__","cljs-time.predicates\/weekday?","cljs.core\/not","cljs-time.predicates\/january?","cljs-time.core\/month","cljs-time.predicates\/february?","cljs-time.predicates\/march?","cljs-time.predicates\/april?","cljs-time.predicates\/may?","cljs-time.predicates\/june?","cljs-time.predicates\/july?","cljs-time.predicates\/august?","cljs-time.predicates\/september?","cljs-time.predicates\/october?","cljs-time.predicates\/november?","cljs-time.predicates\/december?"]}

View file

@ -1,162 +0,0 @@
; Copyright (c) Rich Hickey. All rights reserved.
; The use and distribution terms for this software are covered by the
; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
; which can be found in the file epl-v10.html at the root of this distribution.
; By using this software in any fashion, you are agreeing to be bound by
; the terms of this license.
; You must not remove this notice, or any other, from this software.
(ns
^{:author "Stuart Halloway",
:doc "Non-core data functions."}
clojure.data
(:require [clojure.set :as set]))
(declare diff)
(defn- atom-diff
"Internal helper for diff."
[a b]
(if (= a b) [nil nil a] [a b nil]))
;; for big things a sparse vector class would be better
(defn- vectorize
"Convert an associative-by-numeric-index collection into
an equivalent vector, with nil for any missing keys"
[m]
(when (seq m)
(reduce
(fn [result [k v]] (assoc result k v))
(vec (repeat (apply max (keys m)) nil))
m)))
(defn- diff-associative-key
"Diff associative things a and b, comparing only the key k."
[a b k]
(let [va (get a k)
vb (get b k)
[a* b* ab] (diff va vb)
in-a (contains? a k)
in-b (contains? b k)
same (and in-a in-b
(or (not (nil? ab))
(and (nil? va) (nil? vb))))]
[(when (and in-a (or (not (nil? a*)) (not same))) {k a*})
(when (and in-b (or (not (nil? b*)) (not same))) {k b*})
(when same {k ab})
]))
(defn- diff-associative
"Diff associative things a and b, comparing only keys in ks (if supplied)."
([a b]
(diff-associative a b (set/union (keys a) (keys b))))
([a b ks]
(reduce
(fn [diff1 diff2]
(doall (map merge diff1 diff2)))
[nil nil nil]
(map
(partial diff-associative-key a b)
ks))))
(defn- diff-sequential
[a b]
(vec (map vectorize (diff-associative
(if (vector? a) a (vec a))
(if (vector? b) b (vec b))
(range (max (count a) (count b)))))))
(defn- diff-set
[a b]
[(not-empty (set/difference a b))
(not-empty (set/difference b a))
(not-empty (set/intersection a b))])
(defprotocol EqualityPartition
"Implementation detail. Subject to change."
(equality-partition [x] "Implementation detail. Subject to change."))
(defprotocol Diff
"Implementation detail. Subject to change."
(diff-similar [a b] "Implementation detail. Subject to change."))
(extend-protocol EqualityPartition
nil
(equality-partition [x] :atom)
string
(equality-partition [x] :atom)
number
(equality-partition [x] :atom)
array
(equality-partition [x] :sequential)
function
(equality-partition [x] :atom)
boolean
(equality-partition [x] :atom)
default
(equality-partition [x]
(cond
(satisfies? IMap x) :map
(satisfies? ISet x) :set
(satisfies? ISequential x) :sequential
:default :atom)))
(extend-protocol Diff
nil
(diff-similar [a b]
(atom-diff a b))
string
(diff-similar [a b]
(atom-diff a b))
number
(diff-similar [a b]
(atom-diff a b))
array
(diff-similar [a b]
(diff-sequential a b))
function
(diff-similar [a b]
(atom-diff a b))
boolean
(diff-similar [a b]
(atom-diff a b))
default
(diff-similar [a b]
((case (equality-partition a)
:atom atom-diff
:set diff-set
:sequential diff-sequential
:map diff-associative)
a b)))
(defn diff
"Recursively compares a and b, returning a tuple of
[things-only-in-a things-only-in-b things-in-both].
Comparison rules:
* For equal a and b, return [nil nil a].
* Maps are subdiffed where keys match and values differ.
* Sets are never subdiffed.
* All sequential things are treated as associative collections
by their indexes, with results returned as vectors.
* Everything else (including strings!) is treated as
an atom and compared for equality."
[a b]
(if (= a b)
[nil nil a]
(if (= (equality-partition a) (equality-partition b))
(diff-similar a b)
(atom-diff a b))))

File diff suppressed because one or more lines are too long

View file

@ -1,302 +0,0 @@
// Compiled by ClojureScript 1.9.229 {}
goog.provide('clojure.data');
goog.require('cljs.core');
goog.require('clojure.set');
/**
* Internal helper for diff.
*/
clojure.data.atom_diff = (function clojure$data$atom_diff(a,b){
if(cljs.core._EQ_.call(null,a,b)){
return new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [null,null,a], null);
} else {
return new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [a,b,null], null);
}
});
/**
* Convert an associative-by-numeric-index collection into
* an equivalent vector, with nil for any missing keys
*/
clojure.data.vectorize = (function clojure$data$vectorize(m){
if(cljs.core.seq.call(null,m)){
return cljs.core.reduce.call(null,(function (result,p__41009){
var vec__41010 = p__41009;
var k = cljs.core.nth.call(null,vec__41010,(0),null);
var v = cljs.core.nth.call(null,vec__41010,(1),null);
return cljs.core.assoc.call(null,result,k,v);
}),cljs.core.vec.call(null,cljs.core.repeat.call(null,cljs.core.apply.call(null,cljs.core.max,cljs.core.keys.call(null,m)),null)),m);
} else {
return null;
}
});
/**
* Diff associative things a and b, comparing only the key k.
*/
clojure.data.diff_associative_key = (function clojure$data$diff_associative_key(a,b,k){
var va = cljs.core.get.call(null,a,k);
var vb = cljs.core.get.call(null,b,k);
var vec__41016 = clojure.data.diff.call(null,va,vb);
var a_STAR_ = cljs.core.nth.call(null,vec__41016,(0),null);
var b_STAR_ = cljs.core.nth.call(null,vec__41016,(1),null);
var ab = cljs.core.nth.call(null,vec__41016,(2),null);
var in_a = cljs.core.contains_QMARK_.call(null,a,k);
var in_b = cljs.core.contains_QMARK_.call(null,b,k);
var same = (in_a) && (in_b) && ((!((ab == null))) || (((va == null)) && ((vb == null))));
return new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [(((in_a) && ((!((a_STAR_ == null))) || (!(same))))?cljs.core.PersistentArrayMap.fromArray([k,a_STAR_], true, false):null),(((in_b) && ((!((b_STAR_ == null))) || (!(same))))?cljs.core.PersistentArrayMap.fromArray([k,b_STAR_], true, false):null),((same)?cljs.core.PersistentArrayMap.fromArray([k,ab], true, false):null)], null);
});
/**
* Diff associative things a and b, comparing only keys in ks (if supplied).
*/
clojure.data.diff_associative = (function clojure$data$diff_associative(var_args){
var args41019 = [];
var len__26205__auto___41022 = arguments.length;
var i__26206__auto___41023 = (0);
while(true){
if((i__26206__auto___41023 < len__26205__auto___41022)){
args41019.push((arguments[i__26206__auto___41023]));
var G__41024 = (i__26206__auto___41023 + (1));
i__26206__auto___41023 = G__41024;
continue;
} else {
}
break;
}
var G__41021 = args41019.length;
switch (G__41021) {
case 2:
return clojure.data.diff_associative.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));
break;
case 3:
return clojure.data.diff_associative.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));
break;
default:
throw (new Error([cljs.core.str("Invalid arity: "),cljs.core.str(args41019.length)].join('')));
}
});
clojure.data.diff_associative.cljs$core$IFn$_invoke$arity$2 = (function (a,b){
return clojure.data.diff_associative.call(null,a,b,clojure.set.union.call(null,cljs.core.keys.call(null,a),cljs.core.keys.call(null,b)));
});
clojure.data.diff_associative.cljs$core$IFn$_invoke$arity$3 = (function (a,b,ks){
return cljs.core.reduce.call(null,(function (diff1,diff2){
return cljs.core.doall.call(null,cljs.core.map.call(null,cljs.core.merge,diff1,diff2));
}),new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [null,null,null], null),cljs.core.map.call(null,cljs.core.partial.call(null,clojure.data.diff_associative_key,a,b),ks));
});
clojure.data.diff_associative.cljs$lang$maxFixedArity = 3;
clojure.data.diff_sequential = (function clojure$data$diff_sequential(a,b){
return cljs.core.vec.call(null,cljs.core.map.call(null,clojure.data.vectorize,clojure.data.diff_associative.call(null,((cljs.core.vector_QMARK_.call(null,a))?a:cljs.core.vec.call(null,a)),((cljs.core.vector_QMARK_.call(null,b))?b:cljs.core.vec.call(null,b)),cljs.core.range.call(null,(function (){var x__25461__auto__ = cljs.core.count.call(null,a);
var y__25462__auto__ = cljs.core.count.call(null,b);
return ((x__25461__auto__ > y__25462__auto__) ? x__25461__auto__ : y__25462__auto__);
})()))));
});
clojure.data.diff_set = (function clojure$data$diff_set(a,b){
return new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.not_empty.call(null,clojure.set.difference.call(null,a,b)),cljs.core.not_empty.call(null,clojure.set.difference.call(null,b,a)),cljs.core.not_empty.call(null,clojure.set.intersection.call(null,a,b))], null);
});
/**
* Implementation detail. Subject to change.
* @interface
*/
clojure.data.EqualityPartition = function(){};
/**
* Implementation detail. Subject to change.
*/
clojure.data.equality_partition = (function clojure$data$equality_partition(x){
if((!((x == null))) && (!((x.clojure$data$EqualityPartition$equality_partition$arity$1 == null)))){
return x.clojure$data$EqualityPartition$equality_partition$arity$1(x);
} else {
var x__25793__auto__ = (((x == null))?null:x);
var m__25794__auto__ = (clojure.data.equality_partition[goog.typeOf(x__25793__auto__)]);
if(!((m__25794__auto__ == null))){
return m__25794__auto__.call(null,x);
} else {
var m__25794__auto____$1 = (clojure.data.equality_partition["_"]);
if(!((m__25794__auto____$1 == null))){
return m__25794__auto____$1.call(null,x);
} else {
throw cljs.core.missing_protocol.call(null,"EqualityPartition.equality-partition",x);
}
}
}
});
/**
* Implementation detail. Subject to change.
* @interface
*/
clojure.data.Diff = function(){};
/**
* Implementation detail. Subject to change.
*/
clojure.data.diff_similar = (function clojure$data$diff_similar(a,b){
if((!((a == null))) && (!((a.clojure$data$Diff$diff_similar$arity$2 == null)))){
return a.clojure$data$Diff$diff_similar$arity$2(a,b);
} else {
var x__25793__auto__ = (((a == null))?null:a);
var m__25794__auto__ = (clojure.data.diff_similar[goog.typeOf(x__25793__auto__)]);
if(!((m__25794__auto__ == null))){
return m__25794__auto__.call(null,a,b);
} else {
var m__25794__auto____$1 = (clojure.data.diff_similar["_"]);
if(!((m__25794__auto____$1 == null))){
return m__25794__auto____$1.call(null,a,b);
} else {
throw cljs.core.missing_protocol.call(null,"Diff.diff-similar",a);
}
}
}
});
(clojure.data.EqualityPartition["null"] = true);
(clojure.data.equality_partition["null"] = (function (x){
return new cljs.core.Keyword(null,"atom","atom",-397043653);
}));
(clojure.data.EqualityPartition["string"] = true);
(clojure.data.equality_partition["string"] = (function (x){
return new cljs.core.Keyword(null,"atom","atom",-397043653);
}));
(clojure.data.EqualityPartition["number"] = true);
(clojure.data.equality_partition["number"] = (function (x){
return new cljs.core.Keyword(null,"atom","atom",-397043653);
}));
(clojure.data.EqualityPartition["array"] = true);
(clojure.data.equality_partition["array"] = (function (x){
return new cljs.core.Keyword(null,"sequential","sequential",-1082983960);
}));
(clojure.data.EqualityPartition["function"] = true);
(clojure.data.equality_partition["function"] = (function (x){
return new cljs.core.Keyword(null,"atom","atom",-397043653);
}));
(clojure.data.EqualityPartition["boolean"] = true);
(clojure.data.equality_partition["boolean"] = (function (x){
return new cljs.core.Keyword(null,"atom","atom",-397043653);
}));
(clojure.data.EqualityPartition["_"] = true);
(clojure.data.equality_partition["_"] = (function (x){
if(((!((x == null)))?((((x.cljs$lang$protocol_mask$partition0$ & (1024))) || (x.cljs$core$IMap$))?true:(((!x.cljs$lang$protocol_mask$partition0$))?cljs.core.native_satisfies_QMARK_.call(null,cljs.core.IMap,x):false)):cljs.core.native_satisfies_QMARK_.call(null,cljs.core.IMap,x))){
return new cljs.core.Keyword(null,"map","map",1371690461);
} else {
if(((!((x == null)))?((((x.cljs$lang$protocol_mask$partition0$ & (4096))) || (x.cljs$core$ISet$))?true:(((!x.cljs$lang$protocol_mask$partition0$))?cljs.core.native_satisfies_QMARK_.call(null,cljs.core.ISet,x):false)):cljs.core.native_satisfies_QMARK_.call(null,cljs.core.ISet,x))){
return new cljs.core.Keyword(null,"set","set",304602554);
} else {
if(((!((x == null)))?((((x.cljs$lang$protocol_mask$partition0$ & (16777216))) || (x.cljs$core$ISequential$))?true:(((!x.cljs$lang$protocol_mask$partition0$))?cljs.core.native_satisfies_QMARK_.call(null,cljs.core.ISequential,x):false)):cljs.core.native_satisfies_QMARK_.call(null,cljs.core.ISequential,x))){
return new cljs.core.Keyword(null,"sequential","sequential",-1082983960);
} else {
return new cljs.core.Keyword(null,"atom","atom",-397043653);
}
}
}
}));
(clojure.data.Diff["null"] = true);
(clojure.data.diff_similar["null"] = (function (a,b){
return clojure.data.atom_diff.call(null,a,b);
}));
(clojure.data.Diff["string"] = true);
(clojure.data.diff_similar["string"] = (function (a,b){
return clojure.data.atom_diff.call(null,a,b);
}));
(clojure.data.Diff["number"] = true);
(clojure.data.diff_similar["number"] = (function (a,b){
return clojure.data.atom_diff.call(null,a,b);
}));
(clojure.data.Diff["array"] = true);
(clojure.data.diff_similar["array"] = (function (a,b){
return clojure.data.diff_sequential.call(null,a,b);
}));
(clojure.data.Diff["function"] = true);
(clojure.data.diff_similar["function"] = (function (a,b){
return clojure.data.atom_diff.call(null,a,b);
}));
(clojure.data.Diff["boolean"] = true);
(clojure.data.diff_similar["boolean"] = (function (a,b){
return clojure.data.atom_diff.call(null,a,b);
}));
(clojure.data.Diff["_"] = true);
(clojure.data.diff_similar["_"] = (function (a,b){
return (function (){var G__41029 = (((clojure.data.equality_partition.call(null,a) instanceof cljs.core.Keyword))?clojure.data.equality_partition.call(null,a).fqn:null);
switch (G__41029) {
case "atom":
return clojure.data.atom_diff;
break;
case "set":
return clojure.data.diff_set;
break;
case "sequential":
return clojure.data.diff_sequential;
break;
case "map":
return clojure.data.diff_associative;
break;
default:
throw (new Error([cljs.core.str("No matching clause: "),cljs.core.str(clojure.data.equality_partition.call(null,a))].join('')));
}
})().call(null,a,b);
}));
/**
* Recursively compares a and b, returning a tuple of
* [things-only-in-a things-only-in-b things-in-both].
* Comparison rules:
*
* * For equal a and b, return [nil nil a].
* * Maps are subdiffed where keys match and values differ.
* * Sets are never subdiffed.
* * All sequential things are treated as associative collections
* by their indexes, with results returned as vectors.
* * Everything else (including strings!) is treated as
* an atom and compared for equality.
*/
clojure.data.diff = (function clojure$data$diff(a,b){
if(cljs.core._EQ_.call(null,a,b)){
return new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [null,null,a], null);
} else {
if(cljs.core._EQ_.call(null,clojure.data.equality_partition.call(null,a),clojure.data.equality_partition.call(null,b))){
return clojure.data.diff_similar.call(null,a,b);
} else {
return clojure.data.atom_diff.call(null,a,b);
}
}
});
//# sourceMappingURL=data.js.map?rel=1603199211133

File diff suppressed because one or more lines are too long

View file

@ -1,161 +0,0 @@
; Copyright (c) Rich Hickey. All rights reserved.
; The use and distribution terms for this software are covered by the
; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
; which can be found in the file epl-v10.html at the root of this distribution.
; By using this software in any fashion, you are agreeing to be bound by
; the terms of this license.
; You must not remove this notice, or any other, from this software.
(ns ^{:doc "Set operations such as union/intersection."
:author "Rich Hickey"}
clojure.set)
(defn- bubble-max-key [k coll]
"Move a maximal element of coll according to fn k (which returns a number)
to the front of coll."
(let [max (apply max-key k coll)]
(cons max (remove #(identical? max %) coll))))
(defn union
"Return a set that is the union of the input sets"
([] #{})
([s1] s1)
([s1 s2]
(if (< (count s1) (count s2))
(reduce conj s2 s1)
(reduce conj s1 s2)))
([s1 s2 & sets]
(let [bubbled-sets (bubble-max-key count (conj sets s2 s1))]
(reduce into (first bubbled-sets) (rest bubbled-sets)))))
(defn intersection
"Return a set that is the intersection of the input sets"
([s1] s1)
([s1 s2]
(if (< (count s2) (count s1))
(recur s2 s1)
(reduce (fn [result item]
(if (contains? s2 item)
result
(disj result item)))
s1 s1)))
([s1 s2 & sets]
(let [bubbled-sets (bubble-max-key #(- (count %)) (conj sets s2 s1))]
(reduce intersection (first bubbled-sets) (rest bubbled-sets)))))
(defn difference
"Return a set that is the first set without elements of the remaining sets"
([s1] s1)
([s1 s2]
(if (< (count s1) (count s2))
(reduce (fn [result item]
(if (contains? s2 item)
(disj result item)
result))
s1 s1)
(reduce disj s1 s2)))
([s1 s2 & sets]
(reduce difference s1 (conj sets s2))))
(defn select
"Returns a set of the elements for which pred is true"
[pred xset]
(reduce (fn [s k] (if (pred k) s (disj s k)))
xset xset))
(defn project
"Returns a rel of the elements of xrel with only the keys in ks"
[xrel ks]
(set (map #(select-keys % ks) xrel)))
(defn rename-keys
"Returns the map with the keys in kmap renamed to the vals in kmap"
[map kmap]
(reduce
(fn [m [old new]]
(if (contains? map old)
(assoc m new (get map old))
m))
(apply dissoc map (keys kmap)) kmap))
(defn rename
"Returns a rel of the maps in xrel with the keys in kmap renamed to the vals in kmap"
[xrel kmap]
(set (map #(rename-keys % kmap) xrel)))
(defn index
"Returns a map of the distinct values of ks in the xrel mapped to a
set of the maps in xrel with the corresponding values of ks."
[xrel ks]
(reduce
(fn [m x]
(let [ik (select-keys x ks)]
(assoc m ik (conj (get m ik #{}) x))))
{} xrel))
(defn map-invert
"Returns the map with the vals mapped to the keys."
[m] (reduce (fn [m [k v]] (assoc m v k)) {} m))
(defn join
"When passed 2 rels, returns the rel corresponding to the natural
join. When passed an additional keymap, joins on the corresponding
keys."
([xrel yrel] ;natural join
(if (and (seq xrel) (seq yrel))
(let [ks (intersection (set (keys (first xrel))) (set (keys (first yrel))))
[r s] (if (<= (count xrel) (count yrel))
[xrel yrel]
[yrel xrel])
idx (index r ks)]
(reduce (fn [ret x]
(let [found (idx (select-keys x ks))]
(if found
(reduce #(conj %1 (merge %2 x)) ret found)
ret)))
#{} s))
#{}))
([xrel yrel km] ;arbitrary key mapping
(let [[r s k] (if (<= (count xrel) (count yrel))
[xrel yrel (map-invert km)]
[yrel xrel km])
idx (index r (vals k))]
(reduce (fn [ret x]
(let [found (idx (rename-keys (select-keys x (keys k)) k))]
(if found
(reduce #(conj %1 (merge %2 x)) ret found)
ret)))
#{} s))))
(defn subset?
"Is set1 a subset of set2?"
[set1 set2]
(and (<= (count set1) (count set2))
(every? #(contains? set2 %) set1)))
(defn superset?
"Is set1 a superset of set2?"
[set1 set2]
(and (>= (count set1) (count set2))
(every? #(contains? set1 %) set2)))
(comment
(refer 'set)
(def xs #{{:a 11 :b 1 :c 1 :d 4}
{:a 2 :b 12 :c 2 :d 6}
{:a 3 :b 3 :c 3 :d 8 :f 42}})
(def ys #{{:a 11 :b 11 :c 11 :e 5}
{:a 12 :b 11 :c 12 :e 3}
{:a 3 :b 3 :c 3 :e 7 }})
(join xs ys)
(join xs (rename ys {:b :yb :c :yc}) {:a :a})
(union #{:a :b :c} #{:c :d :e })
(difference #{:a :b :c} #{:c :d :e})
(intersection #{:a :b :c} #{:c :d :e})
(index ys [:b]))

File diff suppressed because one or more lines are too long

View file

@ -1,400 +0,0 @@
// Compiled by ClojureScript 1.9.229 {}
goog.provide('clojure.set');
goog.require('cljs.core');
clojure.set.bubble_max_key = (function clojure$set$bubble_max_key(k,coll){
var max = cljs.core.apply.call(null,cljs.core.max_key,k,coll);
return cljs.core.cons.call(null,max,cljs.core.remove.call(null,((function (max){
return (function (p1__40932_SHARP_){
return (max === p1__40932_SHARP_);
});})(max))
,coll));
});
/**
* Return a set that is the union of the input sets
*/
clojure.set.union = (function clojure$set$union(var_args){
var args40933 = [];
var len__26205__auto___40939 = arguments.length;
var i__26206__auto___40940 = (0);
while(true){
if((i__26206__auto___40940 < len__26205__auto___40939)){
args40933.push((arguments[i__26206__auto___40940]));
var G__40941 = (i__26206__auto___40940 + (1));
i__26206__auto___40940 = G__40941;
continue;
} else {
}
break;
}
var G__40938 = args40933.length;
switch (G__40938) {
case 0:
return clojure.set.union.cljs$core$IFn$_invoke$arity$0();
break;
case 1:
return clojure.set.union.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));
break;
case 2:
return clojure.set.union.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));
break;
default:
var argseq__26224__auto__ = (new cljs.core.IndexedSeq(args40933.slice((2)),(0),null));
return clojure.set.union.cljs$core$IFn$_invoke$arity$variadic((arguments[(0)]),(arguments[(1)]),argseq__26224__auto__);
}
});
clojure.set.union.cljs$core$IFn$_invoke$arity$0 = (function (){
return cljs.core.PersistentHashSet.EMPTY;
});
clojure.set.union.cljs$core$IFn$_invoke$arity$1 = (function (s1){
return s1;
});
clojure.set.union.cljs$core$IFn$_invoke$arity$2 = (function (s1,s2){
if((cljs.core.count.call(null,s1) < cljs.core.count.call(null,s2))){
return cljs.core.reduce.call(null,cljs.core.conj,s2,s1);
} else {
return cljs.core.reduce.call(null,cljs.core.conj,s1,s2);
}
});
clojure.set.union.cljs$core$IFn$_invoke$arity$variadic = (function (s1,s2,sets){
var bubbled_sets = clojure.set.bubble_max_key.call(null,cljs.core.count,cljs.core.conj.call(null,sets,s2,s1));
return cljs.core.reduce.call(null,cljs.core.into,cljs.core.first.call(null,bubbled_sets),cljs.core.rest.call(null,bubbled_sets));
});
clojure.set.union.cljs$lang$applyTo = (function (seq40934){
var G__40935 = cljs.core.first.call(null,seq40934);
var seq40934__$1 = cljs.core.next.call(null,seq40934);
var G__40936 = cljs.core.first.call(null,seq40934__$1);
var seq40934__$2 = cljs.core.next.call(null,seq40934__$1);
return clojure.set.union.cljs$core$IFn$_invoke$arity$variadic(G__40935,G__40936,seq40934__$2);
});
clojure.set.union.cljs$lang$maxFixedArity = (2);
/**
* Return a set that is the intersection of the input sets
*/
clojure.set.intersection = (function clojure$set$intersection(var_args){
var args40944 = [];
var len__26205__auto___40950 = arguments.length;
var i__26206__auto___40951 = (0);
while(true){
if((i__26206__auto___40951 < len__26205__auto___40950)){
args40944.push((arguments[i__26206__auto___40951]));
var G__40952 = (i__26206__auto___40951 + (1));
i__26206__auto___40951 = G__40952;
continue;
} else {
}
break;
}
var G__40949 = args40944.length;
switch (G__40949) {
case 1:
return clojure.set.intersection.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));
break;
case 2:
return clojure.set.intersection.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));
break;
default:
var argseq__26224__auto__ = (new cljs.core.IndexedSeq(args40944.slice((2)),(0),null));
return clojure.set.intersection.cljs$core$IFn$_invoke$arity$variadic((arguments[(0)]),(arguments[(1)]),argseq__26224__auto__);
}
});
clojure.set.intersection.cljs$core$IFn$_invoke$arity$1 = (function (s1){
return s1;
});
clojure.set.intersection.cljs$core$IFn$_invoke$arity$2 = (function (s1,s2){
while(true){
if((cljs.core.count.call(null,s2) < cljs.core.count.call(null,s1))){
var G__40954 = s2;
var G__40955 = s1;
s1 = G__40954;
s2 = G__40955;
continue;
} else {
return cljs.core.reduce.call(null,((function (s1,s2){
return (function (result,item){
if(cljs.core.contains_QMARK_.call(null,s2,item)){
return result;
} else {
return cljs.core.disj.call(null,result,item);
}
});})(s1,s2))
,s1,s1);
}
break;
}
});
clojure.set.intersection.cljs$core$IFn$_invoke$arity$variadic = (function (s1,s2,sets){
var bubbled_sets = clojure.set.bubble_max_key.call(null,(function (p1__40943_SHARP_){
return (- cljs.core.count.call(null,p1__40943_SHARP_));
}),cljs.core.conj.call(null,sets,s2,s1));
return cljs.core.reduce.call(null,clojure.set.intersection,cljs.core.first.call(null,bubbled_sets),cljs.core.rest.call(null,bubbled_sets));
});
clojure.set.intersection.cljs$lang$applyTo = (function (seq40945){
var G__40946 = cljs.core.first.call(null,seq40945);
var seq40945__$1 = cljs.core.next.call(null,seq40945);
var G__40947 = cljs.core.first.call(null,seq40945__$1);
var seq40945__$2 = cljs.core.next.call(null,seq40945__$1);
return clojure.set.intersection.cljs$core$IFn$_invoke$arity$variadic(G__40946,G__40947,seq40945__$2);
});
clojure.set.intersection.cljs$lang$maxFixedArity = (2);
/**
* Return a set that is the first set without elements of the remaining sets
*/
clojure.set.difference = (function clojure$set$difference(var_args){
var args40956 = [];
var len__26205__auto___40962 = arguments.length;
var i__26206__auto___40963 = (0);
while(true){
if((i__26206__auto___40963 < len__26205__auto___40962)){
args40956.push((arguments[i__26206__auto___40963]));
var G__40964 = (i__26206__auto___40963 + (1));
i__26206__auto___40963 = G__40964;
continue;
} else {
}
break;
}
var G__40961 = args40956.length;
switch (G__40961) {
case 1:
return clojure.set.difference.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));
break;
case 2:
return clojure.set.difference.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));
break;
default:
var argseq__26224__auto__ = (new cljs.core.IndexedSeq(args40956.slice((2)),(0),null));
return clojure.set.difference.cljs$core$IFn$_invoke$arity$variadic((arguments[(0)]),(arguments[(1)]),argseq__26224__auto__);
}
});
clojure.set.difference.cljs$core$IFn$_invoke$arity$1 = (function (s1){
return s1;
});
clojure.set.difference.cljs$core$IFn$_invoke$arity$2 = (function (s1,s2){
if((cljs.core.count.call(null,s1) < cljs.core.count.call(null,s2))){
return cljs.core.reduce.call(null,(function (result,item){
if(cljs.core.contains_QMARK_.call(null,s2,item)){
return cljs.core.disj.call(null,result,item);
} else {
return result;
}
}),s1,s1);
} else {
return cljs.core.reduce.call(null,cljs.core.disj,s1,s2);
}
});
clojure.set.difference.cljs$core$IFn$_invoke$arity$variadic = (function (s1,s2,sets){
return cljs.core.reduce.call(null,clojure.set.difference,s1,cljs.core.conj.call(null,sets,s2));
});
clojure.set.difference.cljs$lang$applyTo = (function (seq40957){
var G__40958 = cljs.core.first.call(null,seq40957);
var seq40957__$1 = cljs.core.next.call(null,seq40957);
var G__40959 = cljs.core.first.call(null,seq40957__$1);
var seq40957__$2 = cljs.core.next.call(null,seq40957__$1);
return clojure.set.difference.cljs$core$IFn$_invoke$arity$variadic(G__40958,G__40959,seq40957__$2);
});
clojure.set.difference.cljs$lang$maxFixedArity = (2);
/**
* Returns a set of the elements for which pred is true
*/
clojure.set.select = (function clojure$set$select(pred,xset){
return cljs.core.reduce.call(null,(function (s,k){
if(cljs.core.truth_(pred.call(null,k))){
return s;
} else {
return cljs.core.disj.call(null,s,k);
}
}),xset,xset);
});
/**
* Returns a rel of the elements of xrel with only the keys in ks
*/
clojure.set.project = (function clojure$set$project(xrel,ks){
return cljs.core.set.call(null,cljs.core.map.call(null,(function (p1__40966_SHARP_){
return cljs.core.select_keys.call(null,p1__40966_SHARP_,ks);
}),xrel));
});
/**
* Returns the map with the keys in kmap renamed to the vals in kmap
*/
clojure.set.rename_keys = (function clojure$set$rename_keys(map,kmap){
return cljs.core.reduce.call(null,(function (m,p__40971){
var vec__40972 = p__40971;
var old = cljs.core.nth.call(null,vec__40972,(0),null);
var new$ = cljs.core.nth.call(null,vec__40972,(1),null);
if(cljs.core.contains_QMARK_.call(null,map,old)){
return cljs.core.assoc.call(null,m,new$,cljs.core.get.call(null,map,old));
} else {
return m;
}
}),cljs.core.apply.call(null,cljs.core.dissoc,map,cljs.core.keys.call(null,kmap)),kmap);
});
/**
* Returns a rel of the maps in xrel with the keys in kmap renamed to the vals in kmap
*/
clojure.set.rename = (function clojure$set$rename(xrel,kmap){
return cljs.core.set.call(null,cljs.core.map.call(null,(function (p1__40975_SHARP_){
return clojure.set.rename_keys.call(null,p1__40975_SHARP_,kmap);
}),xrel));
});
/**
* Returns a map of the distinct values of ks in the xrel mapped to a
* set of the maps in xrel with the corresponding values of ks.
*/
clojure.set.index = (function clojure$set$index(xrel,ks){
return cljs.core.reduce.call(null,(function (m,x){
var ik = cljs.core.select_keys.call(null,x,ks);
return cljs.core.assoc.call(null,m,ik,cljs.core.conj.call(null,cljs.core.get.call(null,m,ik,cljs.core.PersistentHashSet.EMPTY),x));
}),cljs.core.PersistentArrayMap.EMPTY,xrel);
});
/**
* Returns the map with the vals mapped to the keys.
*/
clojure.set.map_invert = (function clojure$set$map_invert(m){
return cljs.core.reduce.call(null,(function (m__$1,p__40980){
var vec__40981 = p__40980;
var k = cljs.core.nth.call(null,vec__40981,(0),null);
var v = cljs.core.nth.call(null,vec__40981,(1),null);
return cljs.core.assoc.call(null,m__$1,v,k);
}),cljs.core.PersistentArrayMap.EMPTY,m);
});
/**
* When passed 2 rels, returns the rel corresponding to the natural
* join. When passed an additional keymap, joins on the corresponding
* keys.
*/
clojure.set.join = (function clojure$set$join(var_args){
var args40988 = [];
var len__26205__auto___40997 = arguments.length;
var i__26206__auto___40998 = (0);
while(true){
if((i__26206__auto___40998 < len__26205__auto___40997)){
args40988.push((arguments[i__26206__auto___40998]));
var G__40999 = (i__26206__auto___40998 + (1));
i__26206__auto___40998 = G__40999;
continue;
} else {
}
break;
}
var G__40990 = args40988.length;
switch (G__40990) {
case 2:
return clojure.set.join.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));
break;
case 3:
return clojure.set.join.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));
break;
default:
throw (new Error([cljs.core.str("Invalid arity: "),cljs.core.str(args40988.length)].join('')));
}
});
clojure.set.join.cljs$core$IFn$_invoke$arity$2 = (function (xrel,yrel){
if((cljs.core.seq.call(null,xrel)) && (cljs.core.seq.call(null,yrel))){
var ks = clojure.set.intersection.call(null,cljs.core.set.call(null,cljs.core.keys.call(null,cljs.core.first.call(null,xrel))),cljs.core.set.call(null,cljs.core.keys.call(null,cljs.core.first.call(null,yrel))));
var vec__40991 = (((cljs.core.count.call(null,xrel) <= cljs.core.count.call(null,yrel)))?new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [xrel,yrel], null):new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [yrel,xrel], null));
var r = cljs.core.nth.call(null,vec__40991,(0),null);
var s = cljs.core.nth.call(null,vec__40991,(1),null);
var idx = clojure.set.index.call(null,r,ks);
return cljs.core.reduce.call(null,((function (ks,vec__40991,r,s,idx){
return (function (ret,x){
var found = idx.call(null,cljs.core.select_keys.call(null,x,ks));
if(cljs.core.truth_(found)){
return cljs.core.reduce.call(null,((function (found,ks,vec__40991,r,s,idx){
return (function (p1__40984_SHARP_,p2__40985_SHARP_){
return cljs.core.conj.call(null,p1__40984_SHARP_,cljs.core.merge.call(null,p2__40985_SHARP_,x));
});})(found,ks,vec__40991,r,s,idx))
,ret,found);
} else {
return ret;
}
});})(ks,vec__40991,r,s,idx))
,cljs.core.PersistentHashSet.EMPTY,s);
} else {
return cljs.core.PersistentHashSet.EMPTY;
}
});
clojure.set.join.cljs$core$IFn$_invoke$arity$3 = (function (xrel,yrel,km){
var vec__40994 = (((cljs.core.count.call(null,xrel) <= cljs.core.count.call(null,yrel)))?new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [xrel,yrel,clojure.set.map_invert.call(null,km)], null):new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [yrel,xrel,km], null));
var r = cljs.core.nth.call(null,vec__40994,(0),null);
var s = cljs.core.nth.call(null,vec__40994,(1),null);
var k = cljs.core.nth.call(null,vec__40994,(2),null);
var idx = clojure.set.index.call(null,r,cljs.core.vals.call(null,k));
return cljs.core.reduce.call(null,((function (vec__40994,r,s,k,idx){
return (function (ret,x){
var found = idx.call(null,clojure.set.rename_keys.call(null,cljs.core.select_keys.call(null,x,cljs.core.keys.call(null,k)),k));
if(cljs.core.truth_(found)){
return cljs.core.reduce.call(null,((function (found,vec__40994,r,s,k,idx){
return (function (p1__40986_SHARP_,p2__40987_SHARP_){
return cljs.core.conj.call(null,p1__40986_SHARP_,cljs.core.merge.call(null,p2__40987_SHARP_,x));
});})(found,vec__40994,r,s,k,idx))
,ret,found);
} else {
return ret;
}
});})(vec__40994,r,s,k,idx))
,cljs.core.PersistentHashSet.EMPTY,s);
});
clojure.set.join.cljs$lang$maxFixedArity = 3;
/**
* Is set1 a subset of set2?
*/
clojure.set.subset_QMARK_ = (function clojure$set$subset_QMARK_(set1,set2){
return ((cljs.core.count.call(null,set1) <= cljs.core.count.call(null,set2))) && (cljs.core.every_QMARK_.call(null,(function (p1__41001_SHARP_){
return cljs.core.contains_QMARK_.call(null,set2,p1__41001_SHARP_);
}),set1));
});
/**
* Is set1 a superset of set2?
*/
clojure.set.superset_QMARK_ = (function clojure$set$superset_QMARK_(set1,set2){
return ((cljs.core.count.call(null,set1) >= cljs.core.count.call(null,set2))) && (cljs.core.every_QMARK_.call(null,(function (p1__41002_SHARP_){
return cljs.core.contains_QMARK_.call(null,set1,p1__41002_SHARP_);
}),set2));
});
//# sourceMappingURL=set.js.map?rel=1603199211023

File diff suppressed because one or more lines are too long

View file

@ -1,258 +0,0 @@
; Copyright (c) Rich Hickey. All rights reserved.
; The use and distribution terms for this software are covered by the
; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
; which can be found in the file epl-v10.html at the root of this distribution.
; By using this software in any fashion, you are agreeing to be bound by
; the terms of this license.
; You must not remove this notice, or any other, from this software.
(ns clojure.string
(:refer-clojure :exclude [replace reverse])
(:require [goog.string :as gstring])
(:import [goog.string StringBuffer]))
(defn- seq-reverse
[coll]
(reduce conj () coll))
(def ^:private re-surrogate-pair
(js/RegExp. "([\\uD800-\\uDBFF])([\\uDC00-\\uDFFF])" "g"))
(defn reverse
"Returns s with its characters reversed."
[s]
(-> (.replace s re-surrogate-pair "$2$1")
(.. (split "") (reverse) (join ""))))
(defn- replace-all
[s re replacement]
(.replace s (js/RegExp. (.-source re) "g") replacement))
(defn- replace-with
[f]
(fn [& args]
(let [matches (drop-last 2 args)]
(if (= (count matches) 1)
(f (first matches))
(f (vec matches))))))
(defn replace
"Replaces all instance of match with replacement in s.
match/replacement can be:
string / string
pattern / (string or function of match)."
[s match replacement]
(cond
(string? match)
(.replace s (js/RegExp. (gstring/regExpEscape match) "g") replacement)
(instance? js/RegExp match)
(if (string? replacement)
(replace-all s match replacement)
(replace-all s match (replace-with replacement)))
:else (throw (str "Invalid match arg: " match))))
(defn replace-first
"Replaces the first instance of match with replacement in s.
match/replacement can be:
string / string
pattern / (string or function of match)."
[s match replacement]
(.replace s match replacement))
(defn join
"Returns a string of all elements in coll, as returned by (seq coll),
separated by an optional separator."
([coll]
(loop [sb (StringBuffer.) coll (seq coll)]
(if-not (nil? coll)
(recur (. sb (append (str (first coll)))) (next coll))
(.toString sb))))
([separator coll]
(loop [sb (StringBuffer.) coll (seq coll)]
(if-not (nil? coll)
(do
(. sb (append (str (first coll))))
(let [coll (next coll)]
(when-not (nil? coll)
(. sb (append separator)))
(recur sb coll)))
(.toString sb)))))
(defn upper-case
"Converts string to all upper-case."
[s]
(.toUpperCase s))
(defn lower-case
"Converts string to all lower-case."
[s]
(.toLowerCase s))
(defn capitalize
"Converts first character of the string to upper-case, all other
characters to lower-case."
[s]
(if (< (count s) 2)
(upper-case s)
(str (upper-case (subs s 0 1))
(lower-case (subs s 1)))))
;; The JavaScript split function takes a limit argument but the return
;; value is not the same as the Java split function.
;;
;; Java: (.split "a-b-c" #"-" 2) => ["a" "b-c"]
;; JavaScript: (.split "a-b-c" #"-" 2) => ["a" "b"]
;;
;; For consistency, the three arg version has been implemented to
;; mimic Java's behavior.
(defn- pop-last-while-empty
[v]
(loop [v v]
(if (identical? "" (peek v))
(recur (pop v))
v)))
(defn- discard-trailing-if-needed
[limit v]
(if (and (== 0 limit) (< 1 (count v)))
(pop-last-while-empty v)
v))
(defn- split-with-empty-regex
[s limit]
(if (or (<= limit 0) (>= limit (+ 2 (count s))))
(conj (vec (cons "" (map str (seq s)))) "")
(condp == limit
1 (vector s)
2 (vector "" s)
(let [c (- limit 2)]
(conj (vec (cons "" (subvec (vec (map str (seq s))) 0 c))) (subs s c))))))
(defn split
"Splits string on a regular expression. Optional argument limit is
the maximum number of splits. Not lazy. Returns vector of the splits."
([s re]
(split s re 0))
([s re limit]
(discard-trailing-if-needed limit
(if (identical? "/(?:)/" (str re))
(split-with-empty-regex s limit)
(if (< limit 1)
(vec (.split (str s) re))
(loop [s s
limit limit
parts []]
(if (== 1 limit)
(conj parts s)
(let [m (re-find re s)]
(if-not (nil? m)
(let [index (.indexOf s m)]
(recur (.substring s (+ index (count m)))
(dec limit)
(conj parts (.substring s 0 index))))
(conj parts s))))))))))
(defn split-lines
"Splits s on \n or \r\n."
[s]
(split s #"\n|\r\n"))
(defn trim
"Removes whitespace from both ends of string."
[s]
(gstring/trim s))
(defn triml
"Removes whitespace from the left side of string."
[s]
(gstring/trimLeft s))
(defn trimr
"Removes whitespace from the right side of string."
[s]
(gstring/trimRight s))
(defn trim-newline
"Removes all trailing newline \\n or return \\r characters from
string. Similar to Perl's chomp."
[s]
(loop [index (.-length s)]
(if (zero? index)
""
(let [ch (get s (dec index))]
(if (or (identical? \newline ch)
(identical? \return ch))
(recur (dec index))
(.substring s 0 index))))))
(defn ^boolean blank?
"True is s is nil, empty, or contains only whitespace."
[s]
(gstring/isEmptySafe s))
(defn escape
"Return a new string, using cmap to escape each character ch
from s as follows:
If (cmap ch) is nil, append ch to the new string.
If (cmap ch) is non-nil, append (str (cmap ch)) instead."
[s cmap]
(let [buffer (StringBuffer.)
length (.-length s)]
(loop [index 0]
(if (== length index)
(. buffer (toString))
(let [ch (.charAt s index)
replacement (get cmap ch)]
(if-not (nil? replacement)
(.append buffer (str replacement))
(.append buffer ch))
(recur (inc index)))))))
(defn index-of
"Return index of value (string or char) in s, optionally searching
forward from from-index or nil if not found."
([s value]
(let [result (.indexOf s value)]
(if (neg? result)
nil
result)))
([s value from-index]
(let [result (.indexOf s value from-index)]
(if (neg? result)
nil
result))))
(defn last-index-of
"Return last index of value (string or char) in s, optionally
searching backward from from-index or nil if not found."
([s value]
(let [result (.lastIndexOf s value)]
(if (neg? result)
nil
result)))
([s value from-index]
(let [result (.lastIndexOf s value from-index)]
(if (neg? result)
nil
result))))
(defn ^boolean starts-with?
"True if s starts with substr."
[s substr]
(gstring/startsWith s substr))
(defn ^boolean ends-with?
"True if s ends with substr."
[s substr]
(gstring/endsWith s substr))
(defn ^boolean includes?
"True if s includes substr."
[s substr]
(gstring/contains s substr))

File diff suppressed because one or more lines are too long

View file

@ -1,505 +0,0 @@
// Compiled by ClojureScript 1.9.229 {}
goog.provide('clojure.string');
goog.require('cljs.core');
goog.require('goog.string');
goog.require('goog.string.StringBuffer');
clojure.string.seq_reverse = (function clojure$string$seq_reverse(coll){
return cljs.core.reduce.call(null,cljs.core.conj,cljs.core.List.EMPTY,coll);
});
clojure.string.re_surrogate_pair = (new RegExp("([\\uD800-\\uDBFF])([\\uDC00-\\uDFFF])","g"));
/**
* Returns s with its characters reversed.
*/
clojure.string.reverse = (function clojure$string$reverse(s){
return s.replace(clojure.string.re_surrogate_pair,"$2$1").split("").reverse().join("");
});
clojure.string.replace_all = (function clojure$string$replace_all(s,re,replacement){
return s.replace((new RegExp(re.source,"g")),replacement);
});
clojure.string.replace_with = (function clojure$string$replace_with(f){
return (function() {
var G__38949__delegate = function (args){
var matches = cljs.core.drop_last.call(null,(2),args);
if(cljs.core._EQ_.call(null,cljs.core.count.call(null,matches),(1))){
return f.call(null,cljs.core.first.call(null,matches));
} else {
return f.call(null,cljs.core.vec.call(null,matches));
}
};
var G__38949 = function (var_args){
var args = null;
if (arguments.length > 0) {
var G__38950__i = 0, G__38950__a = new Array(arguments.length - 0);
while (G__38950__i < G__38950__a.length) {G__38950__a[G__38950__i] = arguments[G__38950__i + 0]; ++G__38950__i;}
args = new cljs.core.IndexedSeq(G__38950__a,0);
}
return G__38949__delegate.call(this,args);};
G__38949.cljs$lang$maxFixedArity = 0;
G__38949.cljs$lang$applyTo = (function (arglist__38951){
var args = cljs.core.seq(arglist__38951);
return G__38949__delegate(args);
});
G__38949.cljs$core$IFn$_invoke$arity$variadic = G__38949__delegate;
return G__38949;
})()
;
});
/**
* Replaces all instance of match with replacement in s.
* match/replacement can be:
*
* string / string
* pattern / (string or function of match).
*/
clojure.string.replace = (function clojure$string$replace(s,match,replacement){
if(typeof match === 'string'){
return s.replace((new RegExp(goog.string.regExpEscape(match),"g")),replacement);
} else {
if((match instanceof RegExp)){
if(typeof replacement === 'string'){
return clojure.string.replace_all.call(null,s,match,replacement);
} else {
return clojure.string.replace_all.call(null,s,match,clojure.string.replace_with.call(null,replacement));
}
} else {
throw [cljs.core.str("Invalid match arg: "),cljs.core.str(match)].join('');
}
}
});
/**
* Replaces the first instance of match with replacement in s.
* match/replacement can be:
*
* string / string
* pattern / (string or function of match).
*/
clojure.string.replace_first = (function clojure$string$replace_first(s,match,replacement){
return s.replace(match,replacement);
});
/**
* Returns a string of all elements in coll, as returned by (seq coll),
* separated by an optional separator.
*/
clojure.string.join = (function clojure$string$join(var_args){
var args38952 = [];
var len__26205__auto___38955 = arguments.length;
var i__26206__auto___38956 = (0);
while(true){
if((i__26206__auto___38956 < len__26205__auto___38955)){
args38952.push((arguments[i__26206__auto___38956]));
var G__38957 = (i__26206__auto___38956 + (1));
i__26206__auto___38956 = G__38957;
continue;
} else {
}
break;
}
var G__38954 = args38952.length;
switch (G__38954) {
case 1:
return clojure.string.join.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));
break;
case 2:
return clojure.string.join.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));
break;
default:
throw (new Error([cljs.core.str("Invalid arity: "),cljs.core.str(args38952.length)].join('')));
}
});
clojure.string.join.cljs$core$IFn$_invoke$arity$1 = (function (coll){
var sb = (new goog.string.StringBuffer());
var coll__$1 = cljs.core.seq.call(null,coll);
while(true){
if(!((coll__$1 == null))){
var G__38959 = sb.append([cljs.core.str(cljs.core.first.call(null,coll__$1))].join(''));
var G__38960 = cljs.core.next.call(null,coll__$1);
sb = G__38959;
coll__$1 = G__38960;
continue;
} else {
return sb.toString();
}
break;
}
});
clojure.string.join.cljs$core$IFn$_invoke$arity$2 = (function (separator,coll){
var sb = (new goog.string.StringBuffer());
var coll__$1 = cljs.core.seq.call(null,coll);
while(true){
if(!((coll__$1 == null))){
sb.append([cljs.core.str(cljs.core.first.call(null,coll__$1))].join(''));
var coll__$2 = cljs.core.next.call(null,coll__$1);
if((coll__$2 == null)){
} else {
sb.append(separator);
}
var G__38961 = sb;
var G__38962 = coll__$2;
sb = G__38961;
coll__$1 = G__38962;
continue;
} else {
return sb.toString();
}
break;
}
});
clojure.string.join.cljs$lang$maxFixedArity = 2;
/**
* Converts string to all upper-case.
*/
clojure.string.upper_case = (function clojure$string$upper_case(s){
return s.toUpperCase();
});
/**
* Converts string to all lower-case.
*/
clojure.string.lower_case = (function clojure$string$lower_case(s){
return s.toLowerCase();
});
/**
* Converts first character of the string to upper-case, all other
* characters to lower-case.
*/
clojure.string.capitalize = (function clojure$string$capitalize(s){
if((cljs.core.count.call(null,s) < (2))){
return clojure.string.upper_case.call(null,s);
} else {
return [cljs.core.str(clojure.string.upper_case.call(null,cljs.core.subs.call(null,s,(0),(1)))),cljs.core.str(clojure.string.lower_case.call(null,cljs.core.subs.call(null,s,(1))))].join('');
}
});
clojure.string.pop_last_while_empty = (function clojure$string$pop_last_while_empty(v){
var v__$1 = v;
while(true){
if(("" === cljs.core.peek.call(null,v__$1))){
var G__38963 = cljs.core.pop.call(null,v__$1);
v__$1 = G__38963;
continue;
} else {
return v__$1;
}
break;
}
});
clojure.string.discard_trailing_if_needed = (function clojure$string$discard_trailing_if_needed(limit,v){
if((((0) === limit)) && (((1) < cljs.core.count.call(null,v)))){
return clojure.string.pop_last_while_empty.call(null,v);
} else {
return v;
}
});
clojure.string.split_with_empty_regex = (function clojure$string$split_with_empty_regex(s,limit){
if(((limit <= (0))) || ((limit >= ((2) + cljs.core.count.call(null,s))))){
return cljs.core.conj.call(null,cljs.core.vec.call(null,cljs.core.cons.call(null,"",cljs.core.map.call(null,cljs.core.str,cljs.core.seq.call(null,s)))),"");
} else {
var pred__38967 = cljs.core._EQ__EQ_;
var expr__38968 = limit;
if(cljs.core.truth_(pred__38967.call(null,(1),expr__38968))){
return (new cljs.core.PersistentVector(null,1,(5),cljs.core.PersistentVector.EMPTY_NODE,[s],null));
} else {
if(cljs.core.truth_(pred__38967.call(null,(2),expr__38968))){
return (new cljs.core.PersistentVector(null,2,(5),cljs.core.PersistentVector.EMPTY_NODE,["",s],null));
} else {
var c = (limit - (2));
return cljs.core.conj.call(null,cljs.core.vec.call(null,cljs.core.cons.call(null,"",cljs.core.subvec.call(null,cljs.core.vec.call(null,cljs.core.map.call(null,cljs.core.str,cljs.core.seq.call(null,s))),(0),c))),cljs.core.subs.call(null,s,c));
}
}
}
});
/**
* Splits string on a regular expression. Optional argument limit is
* the maximum number of splits. Not lazy. Returns vector of the splits.
*/
clojure.string.split = (function clojure$string$split(var_args){
var args38970 = [];
var len__26205__auto___38973 = arguments.length;
var i__26206__auto___38974 = (0);
while(true){
if((i__26206__auto___38974 < len__26205__auto___38973)){
args38970.push((arguments[i__26206__auto___38974]));
var G__38975 = (i__26206__auto___38974 + (1));
i__26206__auto___38974 = G__38975;
continue;
} else {
}
break;
}
var G__38972 = args38970.length;
switch (G__38972) {
case 2:
return clojure.string.split.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));
break;
case 3:
return clojure.string.split.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));
break;
default:
throw (new Error([cljs.core.str("Invalid arity: "),cljs.core.str(args38970.length)].join('')));
}
});
clojure.string.split.cljs$core$IFn$_invoke$arity$2 = (function (s,re){
return clojure.string.split.call(null,s,re,(0));
});
clojure.string.split.cljs$core$IFn$_invoke$arity$3 = (function (s,re,limit){
return clojure.string.discard_trailing_if_needed.call(null,limit,((("/(?:)/" === [cljs.core.str(re)].join('')))?clojure.string.split_with_empty_regex.call(null,s,limit):(((limit < (1)))?cljs.core.vec.call(null,[cljs.core.str(s)].join('').split(re)):(function (){var s__$1 = s;
var limit__$1 = limit;
var parts = cljs.core.PersistentVector.EMPTY;
while(true){
if(((1) === limit__$1)){
return cljs.core.conj.call(null,parts,s__$1);
} else {
var m = cljs.core.re_find.call(null,re,s__$1);
if(!((m == null))){
var index = s__$1.indexOf(m);
var G__38977 = s__$1.substring((index + cljs.core.count.call(null,m)));
var G__38978 = (limit__$1 - (1));
var G__38979 = cljs.core.conj.call(null,parts,s__$1.substring((0),index));
s__$1 = G__38977;
limit__$1 = G__38978;
parts = G__38979;
continue;
} else {
return cljs.core.conj.call(null,parts,s__$1);
}
}
break;
}
})())));
});
clojure.string.split.cljs$lang$maxFixedArity = 3;
/**
* Splits s on
* or
* .
*/
clojure.string.split_lines = (function clojure$string$split_lines(s){
return clojure.string.split.call(null,s,/\n|\r\n/);
});
/**
* Removes whitespace from both ends of string.
*/
clojure.string.trim = (function clojure$string$trim(s){
return goog.string.trim(s);
});
/**
* Removes whitespace from the left side of string.
*/
clojure.string.triml = (function clojure$string$triml(s){
return goog.string.trimLeft(s);
});
/**
* Removes whitespace from the right side of string.
*/
clojure.string.trimr = (function clojure$string$trimr(s){
return goog.string.trimRight(s);
});
/**
* Removes all trailing newline \n or return \r characters from
* string. Similar to Perl's chomp.
*/
clojure.string.trim_newline = (function clojure$string$trim_newline(s){
var index = s.length;
while(true){
if((index === (0))){
return "";
} else {
var ch = cljs.core.get.call(null,s,(index - (1)));
if((("\n" === ch)) || (("\r" === ch))){
var G__38980 = (index - (1));
index = G__38980;
continue;
} else {
return s.substring((0),index);
}
}
break;
}
});
/**
* True is s is nil, empty, or contains only whitespace.
*/
clojure.string.blank_QMARK_ = (function clojure$string$blank_QMARK_(s){
return goog.string.isEmptySafe(s);
});
/**
* Return a new string, using cmap to escape each character ch
* from s as follows:
*
* If (cmap ch) is nil, append ch to the new string.
* If (cmap ch) is non-nil, append (str (cmap ch)) instead.
*/
clojure.string.escape = (function clojure$string$escape(s,cmap){
var buffer = (new goog.string.StringBuffer());
var length = s.length;
var index = (0);
while(true){
if((length === index)){
return buffer.toString();
} else {
var ch = s.charAt(index);
var replacement = cljs.core.get.call(null,cmap,ch);
if(!((replacement == null))){
buffer.append([cljs.core.str(replacement)].join(''));
} else {
buffer.append(ch);
}
var G__38981 = (index + (1));
index = G__38981;
continue;
}
break;
}
});
/**
* Return index of value (string or char) in s, optionally searching
* forward from from-index or nil if not found.
*/
clojure.string.index_of = (function clojure$string$index_of(var_args){
var args38982 = [];
var len__26205__auto___38985 = arguments.length;
var i__26206__auto___38986 = (0);
while(true){
if((i__26206__auto___38986 < len__26205__auto___38985)){
args38982.push((arguments[i__26206__auto___38986]));
var G__38987 = (i__26206__auto___38986 + (1));
i__26206__auto___38986 = G__38987;
continue;
} else {
}
break;
}
var G__38984 = args38982.length;
switch (G__38984) {
case 2:
return clojure.string.index_of.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));
break;
case 3:
return clojure.string.index_of.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));
break;
default:
throw (new Error([cljs.core.str("Invalid arity: "),cljs.core.str(args38982.length)].join('')));
}
});
clojure.string.index_of.cljs$core$IFn$_invoke$arity$2 = (function (s,value){
var result = s.indexOf(value);
if((result < (0))){
return null;
} else {
return result;
}
});
clojure.string.index_of.cljs$core$IFn$_invoke$arity$3 = (function (s,value,from_index){
var result = s.indexOf(value,from_index);
if((result < (0))){
return null;
} else {
return result;
}
});
clojure.string.index_of.cljs$lang$maxFixedArity = 3;
/**
* Return last index of value (string or char) in s, optionally
* searching backward from from-index or nil if not found.
*/
clojure.string.last_index_of = (function clojure$string$last_index_of(var_args){
var args38989 = [];
var len__26205__auto___38992 = arguments.length;
var i__26206__auto___38993 = (0);
while(true){
if((i__26206__auto___38993 < len__26205__auto___38992)){
args38989.push((arguments[i__26206__auto___38993]));
var G__38994 = (i__26206__auto___38993 + (1));
i__26206__auto___38993 = G__38994;
continue;
} else {
}
break;
}
var G__38991 = args38989.length;
switch (G__38991) {
case 2:
return clojure.string.last_index_of.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));
break;
case 3:
return clojure.string.last_index_of.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));
break;
default:
throw (new Error([cljs.core.str("Invalid arity: "),cljs.core.str(args38989.length)].join('')));
}
});
clojure.string.last_index_of.cljs$core$IFn$_invoke$arity$2 = (function (s,value){
var result = s.lastIndexOf(value);
if((result < (0))){
return null;
} else {
return result;
}
});
clojure.string.last_index_of.cljs$core$IFn$_invoke$arity$3 = (function (s,value,from_index){
var result = s.lastIndexOf(value,from_index);
if((result < (0))){
return null;
} else {
return result;
}
});
clojure.string.last_index_of.cljs$lang$maxFixedArity = 3;
/**
* True if s starts with substr.
*/
clojure.string.starts_with_QMARK_ = (function clojure$string$starts_with_QMARK_(s,substr){
return goog.string.startsWith(s,substr);
});
/**
* True if s ends with substr.
*/
clojure.string.ends_with_QMARK_ = (function clojure$string$ends_with_QMARK_(s,substr){
return goog.string.endsWith(s,substr);
});
/**
* True if s includes substr.
*/
clojure.string.includes_QMARK_ = (function clojure$string$includes_QMARK_(s,substr){
return goog.string.contains(s,substr);
});
//# sourceMappingURL=string.js.map?rel=1603199207238

File diff suppressed because one or more lines are too long

View file

@ -1,96 +0,0 @@
; Copyright (c) Rich Hickey. All rights reserved.
; The use and distribution terms for this software are covered by the
; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
; which can be found in the file epl-v10.html at the root of this distribution.
; By using this software in any fashion, you are agreeing to be bound by
; the terms of this license.
; You must not remove this notice, or any other, from this software.
;;; walk.cljs - generic tree walker with replacement
;; by Stuart Sierra
;; Jul5 17, 2011
;; CHANGE LOG:
;;
;; * July 17, 2011: Port to ClojureScript
;;
;; * December 15, 2008: replaced 'walk' with 'prewalk' & 'postwalk'
;;
;; * December 9, 2008: first version
(ns
^{:author "Stuart Sierra",
:doc "This file defines a generic tree walker for Clojure data
structures. It takes any data structure (list, vector, map, set,
seq), calls a function on every element, and uses the return value
of the function in place of the original. This makes it fairly
easy to write recursive search-and-replace functions, as shown in
the examples.
Note: \"walk\" supports all Clojure data structures EXCEPT maps
created with sorted-map-by. There is no (obvious) way to retrieve
the sorting function."}
clojure.walk)
(defn walk
"Traverses form, an arbitrary data structure. inner and outer are
functions. Applies inner to each element of form, building up a
data structure of the same type, then applies outer to the result.
Recognizes all Clojure data structures. Consumes seqs as with doall."
{:added "1.1"}
[inner outer form]
(cond
(list? form) (outer (apply list (map inner form)))
(seq? form) (outer (doall (map inner form)))
(record? form) (outer (reduce (fn [r x] (conj r (inner x))) form form))
(coll? form) (outer (into (empty form) (map inner form)))
:else (outer form)))
(defn postwalk
"Performs a depth-first, post-order traversal of form. Calls f on
each sub-form, uses f's return value in place of the original.
Recognizes all Clojure data structures. Consumes seqs as with doall."
{:added "1.1"}
[f form]
(walk (partial postwalk f) f form))
(defn prewalk
"Like postwalk, but does pre-order traversal."
{:added "1.1"}
[f form]
(walk (partial prewalk f) identity (f form)))
(defn keywordize-keys
"Recursively transforms all map keys from strings to keywords."
{:added "1.1"}
[m]
(let [f (fn [[k v]] (if (string? k) [(keyword k) v] [k v]))]
;; only apply to maps
(postwalk (fn [x] (if (map? x) (into {} (map f x)) x)) m)))
(defn stringify-keys
"Recursively transforms all map keys from keywords to strings."
{:added "1.1"}
[m]
(let [f (fn [[k v]] (if (keyword? k) [(name k) v] [k v]))]
;; only apply to maps
(postwalk (fn [x] (if (map? x) (into {} (map f x)) x)) m)))
(defn prewalk-replace
"Recursively transforms form by replacing keys in smap with their
values. Like clojure/replace but works on any data structure. Does
replacement at the root of the tree first."
{:added "1.1"}
[smap form]
(prewalk (fn [x] (if (contains? smap x) (smap x) x)) form))
(defn postwalk-replace
"Recursively transforms form by replacing keys in smap with their
values. Like clojure/replace but works on any data structure. Does
replacement at the leaves of the tree first."
{:added "1.1"}
[smap form]
(postwalk (fn [x] (if (contains? smap x) (smap x) x)) form))

File diff suppressed because one or more lines are too long

View file

@ -1,123 +0,0 @@
// Compiled by ClojureScript 1.9.229 {}
goog.provide('clojure.walk');
goog.require('cljs.core');
/**
* Traverses form, an arbitrary data structure. inner and outer are
* functions. Applies inner to each element of form, building up a
* data structure of the same type, then applies outer to the result.
* Recognizes all Clojure data structures. Consumes seqs as with doall.
*/
clojure.walk.walk = (function clojure$walk$walk(inner,outer,form){
if(cljs.core.list_QMARK_.call(null,form)){
return outer.call(null,cljs.core.apply.call(null,cljs.core.list,cljs.core.map.call(null,inner,form)));
} else {
if(cljs.core.seq_QMARK_.call(null,form)){
return outer.call(null,cljs.core.doall.call(null,cljs.core.map.call(null,inner,form)));
} else {
if(cljs.core.record_QMARK_.call(null,form)){
return outer.call(null,cljs.core.reduce.call(null,(function (r,x){
return cljs.core.conj.call(null,r,inner.call(null,x));
}),form,form));
} else {
if(cljs.core.coll_QMARK_.call(null,form)){
return outer.call(null,cljs.core.into.call(null,cljs.core.empty.call(null,form),cljs.core.map.call(null,inner,form)));
} else {
return outer.call(null,form);
}
}
}
}
});
/**
* Performs a depth-first, post-order traversal of form. Calls f on
* each sub-form, uses f's return value in place of the original.
* Recognizes all Clojure data structures. Consumes seqs as with doall.
*/
clojure.walk.postwalk = (function clojure$walk$postwalk(f,form){
return clojure.walk.walk.call(null,cljs.core.partial.call(null,clojure$walk$postwalk,f),f,form);
});
/**
* Like postwalk, but does pre-order traversal.
*/
clojure.walk.prewalk = (function clojure$walk$prewalk(f,form){
return clojure.walk.walk.call(null,cljs.core.partial.call(null,clojure$walk$prewalk,f),cljs.core.identity,f.call(null,form));
});
/**
* Recursively transforms all map keys from strings to keywords.
*/
clojure.walk.keywordize_keys = (function clojure$walk$keywordize_keys(m){
var f = (function (p__41442){
var vec__41443 = p__41442;
var k = cljs.core.nth.call(null,vec__41443,(0),null);
var v = cljs.core.nth.call(null,vec__41443,(1),null);
if(typeof k === 'string'){
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.keyword.call(null,k),v], null);
} else {
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [k,v], null);
}
});
return clojure.walk.postwalk.call(null,((function (f){
return (function (x){
if(cljs.core.map_QMARK_.call(null,x)){
return cljs.core.into.call(null,cljs.core.PersistentArrayMap.EMPTY,cljs.core.map.call(null,f,x));
} else {
return x;
}
});})(f))
,m);
});
/**
* Recursively transforms all map keys from keywords to strings.
*/
clojure.walk.stringify_keys = (function clojure$walk$stringify_keys(m){
var f = (function (p__41450){
var vec__41451 = p__41450;
var k = cljs.core.nth.call(null,vec__41451,(0),null);
var v = cljs.core.nth.call(null,vec__41451,(1),null);
if((k instanceof cljs.core.Keyword)){
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.name.call(null,k),v], null);
} else {
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [k,v], null);
}
});
return clojure.walk.postwalk.call(null,((function (f){
return (function (x){
if(cljs.core.map_QMARK_.call(null,x)){
return cljs.core.into.call(null,cljs.core.PersistentArrayMap.EMPTY,cljs.core.map.call(null,f,x));
} else {
return x;
}
});})(f))
,m);
});
/**
* Recursively transforms form by replacing keys in smap with their
* values. Like clojure/replace but works on any data structure. Does
* replacement at the root of the tree first.
*/
clojure.walk.prewalk_replace = (function clojure$walk$prewalk_replace(smap,form){
return clojure.walk.prewalk.call(null,(function (x){
if(cljs.core.contains_QMARK_.call(null,smap,x)){
return smap.call(null,x);
} else {
return x;
}
}),form);
});
/**
* Recursively transforms form by replacing keys in smap with their
* values. Like clojure/replace but works on any data structure. Does
* replacement at the leaves of the tree first.
*/
clojure.walk.postwalk_replace = (function clojure$walk$postwalk_replace(smap,form){
return clojure.walk.postwalk.call(null,(function (x){
if(cljs.core.contains_QMARK_.call(null,smap,x)){
return smap.call(null,x);
} else {
return x;
}
}),form);
});
//# sourceMappingURL=walk.js.map?rel=1603199212448

View file

@ -1 +0,0 @@
{"version":3,"file":"\/Users\/simon\/workspace\/swinging-needle-meter\/docs\/js\/compiled\/out\/clojure\/walk.js","sources":["walk.cljs?rel=1603199212449"],"lineCount":123,"mappings":";AAsBA;;AAcA;;;;;;oBAAA,pBAAMA,gDAOHC,MAAMC,MAAMC;AAPf,AAQE,GACE,AAACC,gCAAMD;AAAQ,OAACD,gBAAM,AAACG,0BAAMC,eAAK,AAACC,wBAAIN,MAAME;;AAD\/C,GAEE,AAACK,+BAAKL;AAAS,OAACD,gBAAM,AAACO,0BAAM,AAACF,wBAAIN,MAAME;;AAF1C,GAGE,AAACO,kCAAQP;AAAM,OAACD,gBAAM,AAACS,2BAAO,WAAKC,EAAEC;AAAP,AAAU,OAACC,yBAAKF,EAAE,AAACX,gBAAMY;GAAKV,KAAKA;;AAHnE,GAIE,AAACY,gCAAMZ;AAAQ,OAACD,gBAAM,AAACc,yBAAK,AAACC,0BAAMd,MAAM,AAACI,wBAAIN,MAAME;;AAJtD,AAKiB,OAACD,gBAAMC;;;;;;;AAE1B;;;;;wBAAA,xBAAMe,wDAKHC,EAAEhB;AALL,AAME,OAACH,4BAAK,AAACoB,4BAAQC,sBAASF,GAAGA,EAAEhB;;AAE\/B;;;uBAAA,vBAAMmB,sDAGHH,EAAEhB;AAHL,AAIE,OAACH,4BAAK,AAACoB,4BAAQG,qBAAQJ,GAAGK,mBAAS,AAACL,YAAEhB;;AAExC;;;+BAAA,\/BAAMsB,sEAGHC;AAHH,AAIE,IAAMP,IAAE,WAAAQ;AAAA,AAAA,IAAAC,aAAAD;QAAA,AAAAE,wBAAAD,WAAA,IAAA,3CAAME;QAAN,AAAAD,wBAAAD,WAAA,IAAA,3CAAQG;AAAR,AAAY,GAAI,OAASD;AAAb,0FAAiB,AAACE,4BAAQF,GAAGC;;AAA7B,0FAAiCD,EAAEC;;;AAAvD,AAEE,OAACb,gCAAS;kBAAKL;AAAL,AAAQ,GAAI,AAACoB,+BAAKpB;AAAG,gCAAA,zBAACG,4DAAQ,AAACT,wBAAIY,EAAEN;;AAAIA;;;CAAIa;;AAE3D;;;8BAAA,9BAAMQ,oEAGHR;AAHH,AAIE,IAAMP,IAAE,WAAAgB;AAAA,AAAA,IAAAC,aAAAD;QAAA,AAAAN,wBAAAO,WAAA,IAAA,3CAAMN;QAAN,AAAAD,wBAAAO,WAAA,IAAA,3CAAQL;AAAR,AAAY,GAAI,cAAAM,bAAUP;AAAd,0FAAkB,AAACQ,yBAAKR,GAAGC;;AAA3B,0FAA+BD,EAAEC;;;AAArD,AAEE,OAACb,gCAAS;kBAAKL;AAAL,AAAQ,GAAI,AAACoB,+BAAKpB;AAAG,gCAAA,zBAACG,4DAAQ,AAACT,wBAAIY,EAAEN;;AAAIA;;;CAAIa;;AAE3D;;;;;+BAAA,\/BAAMa,sEAKHC,KAAKrC;AALR,AAME,OAACmB,+BAAQ,WAAKT;AAAL,AAAQ,GAAI,AAAC4B,oCAAUD,KAAK3B;AAAG,OAAC2B,eAAK3B;;AAAGA;;GAAIV;;AAEvD;;;;;gCAAA,hCAAMuC,wEAKHF,KAAKrC;AALR,AAME,OAACe,gCAAS,WAAKL;AAAL,AAAQ,GAAI,AAAC4B,oCAAUD,KAAK3B;AAAG,OAAC2B,eAAK3B;;AAAGA;;GAAIV","names":["clojure.walk\/walk","inner","outer","form","cljs.core\/list?","cljs.core\/apply","cljs.core\/list","cljs.core\/map","cljs.core\/seq?","cljs.core\/doall","cljs.core\/record?","cljs.core\/reduce","r","x","cljs.core\/conj","cljs.core\/coll?","cljs.core\/into","cljs.core\/empty","clojure.walk\/postwalk","f","cljs.core\/partial","postwalk","clojure.walk\/prewalk","prewalk","cljs.core\/identity","clojure.walk\/keywordize-keys","m","p__41442","vec__41443","cljs.core\/nth","k","v","cljs.core\/keyword","cljs.core\/map?","clojure.walk\/stringify-keys","p__41450","vec__41451","cljs.core\/Keyword","cljs.core\/name","clojure.walk\/prewalk-replace","smap","cljs.core\/contains?","clojure.walk\/postwalk-replace"]}

View file

@ -1,43 +0,0 @@
(ns devtools.async
(:require-macros [devtools.util :refer [oget oset ocall oapply]])
(:require [goog.async.nextTick :as next-tick]))
(defn ^:dynamic available? []
(exists? js/Promise))
(def ^:dynamic *installed* false)
(def ^:dynamic *original-set-immediate* nil)
; see http://stackoverflow.com/a/30741722/84283
(defn rethrow-outside-promise [e]
(js/setTimeout #(throw e) 0))
(defn promise-based-set-immediate [callback]
(-> (ocall js/Promise "resolve")
(ocall "then" callback)
(ocall "catch" rethrow-outside-promise))
nil)
(defn install-async-set-immediate! []
(set! *original-set-immediate* next-tick/setImmediate_)
(set! next-tick/setImmediate_ promise-based-set-immediate))
(defn uninstall-async-set-immediate! []
(set! next-tick/setImmediate_ *original-set-immediate*))
; -- installation -----------------------------------------------------------------------------------------------------------
(defn installed? []
*installed*)
(defn install! []
(when-not *installed*
(set! *installed* true)
(oset js/Error ["stackTraceLimit"] js/Infinity)
(install-async-set-immediate!)
true))
(defn uninstall! []
(when *installed*
(set! *installed* false)
(uninstall-async-set-immediate!)))

File diff suppressed because one or more lines are too long

View file

@ -1,67 +0,0 @@
// Compiled by ClojureScript 1.9.229 {}
goog.provide('devtools.async');
goog.require('cljs.core');
goog.require('goog.async.nextTick');
devtools.async.available_QMARK_ = (function devtools$async$available_QMARK_(){
return typeof Promise !== 'undefined';
});
devtools.async._STAR_installed_STAR_ = false;
devtools.async._STAR_original_set_immediate_STAR_ = null;
devtools.async.rethrow_outside_promise = (function devtools$async$rethrow_outside_promise(e){
return setTimeout((function (){
throw e;
}),(0));
});
devtools.async.promise_based_set_immediate = (function devtools$async$promise_based_set_immediate(callback){
var o__41049__auto___42135 = (function (){var o__41049__auto__ = (function (){var o__41049__auto__ = Promise;
return goog.object.get(o__41049__auto__,"resolve").call(o__41049__auto__);
})();
return goog.object.get(o__41049__auto__,"then").call(o__41049__auto__,callback);
})();
goog.object.get(o__41049__auto___42135,"catch").call(o__41049__auto___42135,devtools.async.rethrow_outside_promise);
return null;
});
devtools.async.install_async_set_immediate_BANG_ = (function devtools$async$install_async_set_immediate_BANG_(){
devtools.async._STAR_original_set_immediate_STAR_ = goog.async.nextTick.setImmediate_;
return goog.async.nextTick.setImmediate_ = devtools.async.promise_based_set_immediate;
});
devtools.async.uninstall_async_set_immediate_BANG_ = (function devtools$async$uninstall_async_set_immediate_BANG_(){
return goog.async.nextTick.setImmediate_ = devtools.async._STAR_original_set_immediate_STAR_;
});
devtools.async.installed_QMARK_ = (function devtools$async$installed_QMARK_(){
return devtools.async._STAR_installed_STAR_;
});
devtools.async.install_BANG_ = (function devtools$async$install_BANG_(){
if(cljs.core.truth_(devtools.async._STAR_installed_STAR_)){
return null;
} else {
devtools.async._STAR_installed_STAR_ = true;
var G__42137_42138 = Error;
var target__41068__auto___42139 = G__42137_42138;
if(cljs.core.truth_(target__41068__auto___42139)){
} else {
throw (new Error([cljs.core.str("Assert failed: "),cljs.core.str([cljs.core.str("unable to locate object path "),cljs.core.str(null),cljs.core.str(" in "),cljs.core.str(G__42137_42138)].join('')),cljs.core.str("\n"),cljs.core.str("target__41068__auto__")].join('')));
}
goog.object.set(target__41068__auto___42139,cljs.core.last.call(null,new cljs.core.PersistentVector(null, 1, 5, cljs.core.PersistentVector.EMPTY_NODE, ["stackTraceLimit"], null)),Infinity);
devtools.async.install_async_set_immediate_BANG_.call(null);
return true;
}
});
devtools.async.uninstall_BANG_ = (function devtools$async$uninstall_BANG_(){
if(cljs.core.truth_(devtools.async._STAR_installed_STAR_)){
devtools.async._STAR_installed_STAR_ = false;
return devtools.async.uninstall_async_set_immediate_BANG_.call(null);
} else {
return null;
}
});
//# sourceMappingURL=async.js.map?rel=1603199213777

View file

@ -1 +0,0 @@
{"version":3,"file":"\/Users\/simon\/workspace\/swinging-needle-meter\/docs\/js\/compiled\/out\/devtools\/async.js","sources":["async.cljs?rel=1603199213778"],"lineCount":67,"mappings":";AAAA;;;AAIA,kCAAA,lCAAgBA;AAAhB,AACE,cAASC;;AAEX,uCAAA,vCAAeC;AACf,oDAAA,pDAAeC;AAGf,yCAAA,zCAAMC,0FAAyBC;AAA\/B,AACE,kBAAA,XAACC;AAAD,AAAgB,MAAOD;GAAvB;;AAEF,6CAAA,7CAAME,kGAA6BC;AAAnC,iEACM,iBAAAC,mBAAOR,xEACP,iBAAAQ,9CACA,IAAAA;AAFA,AAAA,OAAA,AAAAC,gBAAAD,iBAAA,gBAAAA;;AACA,AAAA,OAAA,AAAAC,gBAAAD,iBAAA,aAAAA,iBAAcD;;AACd,AAAA,AAAA,AAAAE,gBAAAD,uBAAA,cAAAA,uBAAeL;;AAHrB;;AAMA,mDAAA,nDAAMO;AAAN,AACE,AAAMR,oDAAyBS;;AAC\/B,OAAMA,oCAAwBL;;AAEhC,qDAAA,rDAAMM;AAAN,AACE,OAAMD,oCAAwBT;;AAIhC,kCAAA,lCAAMW;AAAN,AACEZ;;AAEF,+BAAA,\/BAAMa;AAAN,AACE,oBAAUb;AAAV;;AAAA,AACE,uCAAA,vCAAMA;;AACN,IAAAc,iBAAME;IAAND,8BAAAD;AAAA,AAAA,oBAAAC;AAAA;AAAA,AAAA,MAAA,KAAAC,MAAA,eAAA,iCAAA,eAAA,+CAAA,oBAAA,sBAAAF,yCAAA,oBAAA;;;AAAA,AAAAG,gBAAAF,4BAAA,AAAAG,yBAAA,mFAAA,2BAAmCC;;AAAnCL;AACA,AAACL;;AAHH;;;AAMF,iCAAA,jCAAMW;AAAN,AACE,oBAAMpB;AAAN,AACE,uCAAA,vCAAMA;;AACN,OAACW;;AAFH","names":["devtools.async\/available?","js\/Promise","devtools.async\/*installed*","devtools.async\/*original-set-immediate*","devtools.async\/rethrow-outside-promise","e","js\/setTimeout","devtools.async\/promise-based-set-immediate","callback","o__41049__auto__","goog.object\/get","devtools.async\/install-async-set-immediate!","goog.async.nextTick\/setImmediate_","devtools.async\/uninstall-async-set-immediate!","devtools.async\/installed?","devtools.async\/install!","G__42137","target__41068__auto__","js\/Error","goog.object\/set","cljs.core\/last","js\/Infinity","devtools.async\/uninstall!"]}

View file

@ -1,110 +0,0 @@
(ns devtools.core
(:require [devtools.prefs :as prefs]
[devtools.hints :as hints]
[devtools.defaults :refer [feature-groups]]
[devtools.formatters :as formatters]
[devtools.async :as async]
[devtools.toolbox] ; this auto-requires the toolbox namespace, used by cljs-oops
[devtools.util :refer [display-banner-if-needed! install-feature! resolve-features! make-lib-info
print-config-overrides-if-requested!]]))
; -- public API -------------------------------------------------------------------------------------------------------------
(defn is-feature-available? [feature]
(case feature
:formatters (formatters/available?)
:hints (hints/available?)
:async (async/available?)))
(defn available?
([] (available? (prefs/pref :features-to-install)))
([features-desc]
(let [features (resolve-features! features-desc feature-groups)]
(if (empty? features)
false
(every? is-feature-available? features)))))
(defn is-feature-installed? [feature]
(case feature
:formatters (formatters/installed?)
:hints (hints/installed?)
:async (async/installed?)))
(defn installed?
([] (installed? (prefs/pref :features-to-install)))
([features-desc]
(let [features (resolve-features! features-desc feature-groups)]
(if (empty? features)
false
(every? is-feature-installed? features)))))
(defn install!
([] (install! (prefs/pref :features-to-install)))
([features-desc]
(let [features (resolve-features! features-desc feature-groups)]
(display-banner-if-needed! features feature-groups)
(print-config-overrides-if-requested! "config overrides prior install:\n")
(install-feature! :formatters features is-feature-available? formatters/install!)
(install-feature! :hints features is-feature-available? hints/install!)
(install-feature! :async features is-feature-available? async/install!))))
(defn uninstall! []
(formatters/uninstall!)
(hints/uninstall!)
(async/uninstall!))
(defn set-prefs! [new-prefs]
(prefs/set-prefs! new-prefs))
(defn get-prefs []
(prefs/get-prefs))
(defn set-pref! [pref val]
(prefs/set-pref! pref val))
; -- deprecated API ---------------------------------------------------------------------------------------------------------
(defn enable! []
(.warn js/console (str "devtools.core/enable! was removed "
"and has no effect in " (make-lib-info) " "
"=> remove the call")))
(defn disable! []
(.warn js/console (str "devtools.core/disable! was removed "
"and has no effect in " (make-lib-info) " "
"=> remove the call")))
(defn set-single-feature! [_feature _val]
(.warn js/console (str "devtools.core/set-single-feature! was removed "
"and has no effect in " (make-lib-info) " "
"=> use (devtools.core/install! features) to install custom features")))
(defn enable-single-feature! [_feature]
(.warn js/console (str "devtools.core/enable-single-feature! was removed "
"and has no effect in " (make-lib-info) " "
"=> use (devtools.core/install! features) to install custom features")))
(defn disable-single-feature! [_feature]
(.warn js/console (str "devtools.core/disable-single-feature! was removed "
"and has no effect in " (make-lib-info) " "
"=> use (devtools.core/install! features) to install custom features")))
(defn enable-feature! [& _features]
(.warn js/console (str "devtools.core/enable-feature! was removed "
"and has no effect in " (make-lib-info) " "
"=> use (devtools.core/install! features) to install custom features")))
(defn disable-feature! [& _features]
(.warn js/console (str "devtools.core/disable-feature! was removed "
"and has no effect in " (make-lib-info) " "
"=> use (devtools.core/install! features) to install custom features")))
(defn single-feature-available? [_feature]
(.warn js/console (str "devtools.core/single-feature-available? was removed "
"and has no effect in " (make-lib-info) " "
"=> use devtools.core/is-feature-available? instead")))
(defn feature-available? [& _features]
(.warn js/console (str "devtools.core/feature-available? was removed "
"and has no effect in " (make-lib-info) " "
"=> use devtools.core/is-feature-available? instead")))

File diff suppressed because one or more lines are too long

View file

@ -1,321 +0,0 @@
// Compiled by ClojureScript 1.9.229 {}
goog.provide('devtools.core');
goog.require('cljs.core');
goog.require('devtools.prefs');
goog.require('devtools.toolbox');
goog.require('devtools.hints');
goog.require('devtools.async');
goog.require('devtools.formatters');
goog.require('devtools.util');
goog.require('devtools.defaults');
devtools.core.is_feature_available_QMARK_ = (function devtools$core$is_feature_available_QMARK_(feature){
var G__42171 = (((feature instanceof cljs.core.Keyword))?feature.fqn:null);
switch (G__42171) {
case "formatters":
return devtools.formatters.available_QMARK_.call(null);
break;
case "hints":
return devtools.hints.available_QMARK_.call(null);
break;
case "async":
return devtools.async.available_QMARK_.call(null);
break;
default:
throw (new Error([cljs.core.str("No matching clause: "),cljs.core.str(feature)].join('')));
}
});
devtools.core.available_QMARK_ = (function devtools$core$available_QMARK_(var_args){
var args42173 = [];
var len__26205__auto___42176 = arguments.length;
var i__26206__auto___42177 = (0);
while(true){
if((i__26206__auto___42177 < len__26205__auto___42176)){
args42173.push((arguments[i__26206__auto___42177]));
var G__42178 = (i__26206__auto___42177 + (1));
i__26206__auto___42177 = G__42178;
continue;
} else {
}
break;
}
var G__42175 = args42173.length;
switch (G__42175) {
case 0:
return devtools.core.available_QMARK_.cljs$core$IFn$_invoke$arity$0();
break;
case 1:
return devtools.core.available_QMARK_.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));
break;
default:
throw (new Error([cljs.core.str("Invalid arity: "),cljs.core.str(args42173.length)].join('')));
}
});
devtools.core.available_QMARK_.cljs$core$IFn$_invoke$arity$0 = (function (){
return devtools.core.available_QMARK_.call(null,devtools.prefs.pref.call(null,new cljs.core.Keyword(null,"features-to-install","features-to-install",102899261)));
});
devtools.core.available_QMARK_.cljs$core$IFn$_invoke$arity$1 = (function (features_desc){
var features = devtools.util.resolve_features_BANG_.call(null,features_desc,devtools.defaults.feature_groups);
if(cljs.core.empty_QMARK_.call(null,features)){
return false;
} else {
return cljs.core.every_QMARK_.call(null,devtools.core.is_feature_available_QMARK_,features);
}
});
devtools.core.available_QMARK_.cljs$lang$maxFixedArity = 1;
devtools.core.is_feature_installed_QMARK_ = (function devtools$core$is_feature_installed_QMARK_(feature){
var G__42181 = (((feature instanceof cljs.core.Keyword))?feature.fqn:null);
switch (G__42181) {
case "formatters":
return devtools.formatters.installed_QMARK_.call(null);
break;
case "hints":
return devtools.hints.installed_QMARK_.call(null);
break;
case "async":
return devtools.async.installed_QMARK_.call(null);
break;
default:
throw (new Error([cljs.core.str("No matching clause: "),cljs.core.str(feature)].join('')));
}
});
devtools.core.installed_QMARK_ = (function devtools$core$installed_QMARK_(var_args){
var args42183 = [];
var len__26205__auto___42186 = arguments.length;
var i__26206__auto___42187 = (0);
while(true){
if((i__26206__auto___42187 < len__26205__auto___42186)){
args42183.push((arguments[i__26206__auto___42187]));
var G__42188 = (i__26206__auto___42187 + (1));
i__26206__auto___42187 = G__42188;
continue;
} else {
}
break;
}
var G__42185 = args42183.length;
switch (G__42185) {
case 0:
return devtools.core.installed_QMARK_.cljs$core$IFn$_invoke$arity$0();
break;
case 1:
return devtools.core.installed_QMARK_.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));
break;
default:
throw (new Error([cljs.core.str("Invalid arity: "),cljs.core.str(args42183.length)].join('')));
}
});
devtools.core.installed_QMARK_.cljs$core$IFn$_invoke$arity$0 = (function (){
return devtools.core.installed_QMARK_.call(null,devtools.prefs.pref.call(null,new cljs.core.Keyword(null,"features-to-install","features-to-install",102899261)));
});
devtools.core.installed_QMARK_.cljs$core$IFn$_invoke$arity$1 = (function (features_desc){
var features = devtools.util.resolve_features_BANG_.call(null,features_desc,devtools.defaults.feature_groups);
if(cljs.core.empty_QMARK_.call(null,features)){
return false;
} else {
return cljs.core.every_QMARK_.call(null,devtools.core.is_feature_installed_QMARK_,features);
}
});
devtools.core.installed_QMARK_.cljs$lang$maxFixedArity = 1;
devtools.core.install_BANG_ = (function devtools$core$install_BANG_(var_args){
var args42190 = [];
var len__26205__auto___42193 = arguments.length;
var i__26206__auto___42194 = (0);
while(true){
if((i__26206__auto___42194 < len__26205__auto___42193)){
args42190.push((arguments[i__26206__auto___42194]));
var G__42195 = (i__26206__auto___42194 + (1));
i__26206__auto___42194 = G__42195;
continue;
} else {
}
break;
}
var G__42192 = args42190.length;
switch (G__42192) {
case 0:
return devtools.core.install_BANG_.cljs$core$IFn$_invoke$arity$0();
break;
case 1:
return devtools.core.install_BANG_.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));
break;
default:
throw (new Error([cljs.core.str("Invalid arity: "),cljs.core.str(args42190.length)].join('')));
}
});
devtools.core.install_BANG_.cljs$core$IFn$_invoke$arity$0 = (function (){
return devtools.core.install_BANG_.call(null,devtools.prefs.pref.call(null,new cljs.core.Keyword(null,"features-to-install","features-to-install",102899261)));
});
devtools.core.install_BANG_.cljs$core$IFn$_invoke$arity$1 = (function (features_desc){
var features = devtools.util.resolve_features_BANG_.call(null,features_desc,devtools.defaults.feature_groups);
devtools.util.display_banner_if_needed_BANG_.call(null,features,devtools.defaults.feature_groups);
devtools.util.print_config_overrides_if_requested_BANG_.call(null,"config overrides prior install:\n");
devtools.util.install_feature_BANG_.call(null,new cljs.core.Keyword(null,"formatters","formatters",-1875637118),features,devtools.core.is_feature_available_QMARK_,devtools.formatters.install_BANG_);
devtools.util.install_feature_BANG_.call(null,new cljs.core.Keyword(null,"hints","hints",-991113151),features,devtools.core.is_feature_available_QMARK_,devtools.hints.install_BANG_);
return devtools.util.install_feature_BANG_.call(null,new cljs.core.Keyword(null,"async","async",1050769601),features,devtools.core.is_feature_available_QMARK_,devtools.async.install_BANG_);
});
devtools.core.install_BANG_.cljs$lang$maxFixedArity = 1;
devtools.core.uninstall_BANG_ = (function devtools$core$uninstall_BANG_(){
devtools.formatters.uninstall_BANG_.call(null);
devtools.hints.uninstall_BANG_.call(null);
return devtools.async.uninstall_BANG_.call(null);
});
devtools.core.set_prefs_BANG_ = (function devtools$core$set_prefs_BANG_(new_prefs){
return devtools.prefs.set_prefs_BANG_.call(null,new_prefs);
});
devtools.core.get_prefs = (function devtools$core$get_prefs(){
return devtools.prefs.get_prefs.call(null);
});
devtools.core.set_pref_BANG_ = (function devtools$core$set_pref_BANG_(pref,val){
return devtools.prefs.set_pref_BANG_.call(null,pref,val);
});
devtools.core.enable_BANG_ = (function devtools$core$enable_BANG_(){
return console.warn([cljs.core.str("devtools.core/enable! was removed "),cljs.core.str("and has no effect in "),cljs.core.str(devtools.util.make_lib_info.call(null)),cljs.core.str(" "),cljs.core.str("=> remove the call")].join(''));
});
devtools.core.disable_BANG_ = (function devtools$core$disable_BANG_(){
return console.warn([cljs.core.str("devtools.core/disable! was removed "),cljs.core.str("and has no effect in "),cljs.core.str(devtools.util.make_lib_info.call(null)),cljs.core.str(" "),cljs.core.str("=> remove the call")].join(''));
});
devtools.core.set_single_feature_BANG_ = (function devtools$core$set_single_feature_BANG_(_feature,_val){
return console.warn([cljs.core.str("devtools.core/set-single-feature! was removed "),cljs.core.str("and has no effect in "),cljs.core.str(devtools.util.make_lib_info.call(null)),cljs.core.str(" "),cljs.core.str("=> use (devtools.core/install! features) to install custom features")].join(''));
});
devtools.core.enable_single_feature_BANG_ = (function devtools$core$enable_single_feature_BANG_(_feature){
return console.warn([cljs.core.str("devtools.core/enable-single-feature! was removed "),cljs.core.str("and has no effect in "),cljs.core.str(devtools.util.make_lib_info.call(null)),cljs.core.str(" "),cljs.core.str("=> use (devtools.core/install! features) to install custom features")].join(''));
});
devtools.core.disable_single_feature_BANG_ = (function devtools$core$disable_single_feature_BANG_(_feature){
return console.warn([cljs.core.str("devtools.core/disable-single-feature! was removed "),cljs.core.str("and has no effect in "),cljs.core.str(devtools.util.make_lib_info.call(null)),cljs.core.str(" "),cljs.core.str("=> use (devtools.core/install! features) to install custom features")].join(''));
});
devtools.core.enable_feature_BANG_ = (function devtools$core$enable_feature_BANG_(var_args){
var args__26212__auto__ = [];
var len__26205__auto___42198 = arguments.length;
var i__26206__auto___42199 = (0);
while(true){
if((i__26206__auto___42199 < len__26205__auto___42198)){
args__26212__auto__.push((arguments[i__26206__auto___42199]));
var G__42200 = (i__26206__auto___42199 + (1));
i__26206__auto___42199 = G__42200;
continue;
} else {
}
break;
}
var argseq__26213__auto__ = ((((0) < args__26212__auto__.length))?(new cljs.core.IndexedSeq(args__26212__auto__.slice((0)),(0),null)):null);
return devtools.core.enable_feature_BANG_.cljs$core$IFn$_invoke$arity$variadic(argseq__26213__auto__);
});
devtools.core.enable_feature_BANG_.cljs$core$IFn$_invoke$arity$variadic = (function (_features){
return console.warn([cljs.core.str("devtools.core/enable-feature! was removed "),cljs.core.str("and has no effect in "),cljs.core.str(devtools.util.make_lib_info.call(null)),cljs.core.str(" "),cljs.core.str("=> use (devtools.core/install! features) to install custom features")].join(''));
});
devtools.core.enable_feature_BANG_.cljs$lang$maxFixedArity = (0);
devtools.core.enable_feature_BANG_.cljs$lang$applyTo = (function (seq42197){
return devtools.core.enable_feature_BANG_.cljs$core$IFn$_invoke$arity$variadic(cljs.core.seq.call(null,seq42197));
});
devtools.core.disable_feature_BANG_ = (function devtools$core$disable_feature_BANG_(var_args){
var args__26212__auto__ = [];
var len__26205__auto___42202 = arguments.length;
var i__26206__auto___42203 = (0);
while(true){
if((i__26206__auto___42203 < len__26205__auto___42202)){
args__26212__auto__.push((arguments[i__26206__auto___42203]));
var G__42204 = (i__26206__auto___42203 + (1));
i__26206__auto___42203 = G__42204;
continue;
} else {
}
break;
}
var argseq__26213__auto__ = ((((0) < args__26212__auto__.length))?(new cljs.core.IndexedSeq(args__26212__auto__.slice((0)),(0),null)):null);
return devtools.core.disable_feature_BANG_.cljs$core$IFn$_invoke$arity$variadic(argseq__26213__auto__);
});
devtools.core.disable_feature_BANG_.cljs$core$IFn$_invoke$arity$variadic = (function (_features){
return console.warn([cljs.core.str("devtools.core/disable-feature! was removed "),cljs.core.str("and has no effect in "),cljs.core.str(devtools.util.make_lib_info.call(null)),cljs.core.str(" "),cljs.core.str("=> use (devtools.core/install! features) to install custom features")].join(''));
});
devtools.core.disable_feature_BANG_.cljs$lang$maxFixedArity = (0);
devtools.core.disable_feature_BANG_.cljs$lang$applyTo = (function (seq42201){
return devtools.core.disable_feature_BANG_.cljs$core$IFn$_invoke$arity$variadic(cljs.core.seq.call(null,seq42201));
});
devtools.core.single_feature_available_QMARK_ = (function devtools$core$single_feature_available_QMARK_(_feature){
return console.warn([cljs.core.str("devtools.core/single-feature-available? was removed "),cljs.core.str("and has no effect in "),cljs.core.str(devtools.util.make_lib_info.call(null)),cljs.core.str(" "),cljs.core.str("=> use devtools.core/is-feature-available? instead")].join(''));
});
devtools.core.feature_available_QMARK_ = (function devtools$core$feature_available_QMARK_(var_args){
var args__26212__auto__ = [];
var len__26205__auto___42206 = arguments.length;
var i__26206__auto___42207 = (0);
while(true){
if((i__26206__auto___42207 < len__26205__auto___42206)){
args__26212__auto__.push((arguments[i__26206__auto___42207]));
var G__42208 = (i__26206__auto___42207 + (1));
i__26206__auto___42207 = G__42208;
continue;
} else {
}
break;
}
var argseq__26213__auto__ = ((((0) < args__26212__auto__.length))?(new cljs.core.IndexedSeq(args__26212__auto__.slice((0)),(0),null)):null);
return devtools.core.feature_available_QMARK_.cljs$core$IFn$_invoke$arity$variadic(argseq__26213__auto__);
});
devtools.core.feature_available_QMARK_.cljs$core$IFn$_invoke$arity$variadic = (function (_features){
return console.warn([cljs.core.str("devtools.core/feature-available? was removed "),cljs.core.str("and has no effect in "),cljs.core.str(devtools.util.make_lib_info.call(null)),cljs.core.str(" "),cljs.core.str("=> use devtools.core/is-feature-available? instead")].join(''));
});
devtools.core.feature_available_QMARK_.cljs$lang$maxFixedArity = (0);
devtools.core.feature_available_QMARK_.cljs$lang$applyTo = (function (seq42205){
return devtools.core.feature_available_QMARK_.cljs$core$IFn$_invoke$arity$variadic(cljs.core.seq.call(null,seq42205));
});
//# sourceMappingURL=core.js.map?rel=1603199214023

File diff suppressed because one or more lines are too long

View file

@ -1,394 +0,0 @@
(ns devtools.defaults
; warning: when touching this ns form, update also eval-css-arg in defaults.clj
(:require-macros [devtools.defaults :as d :refer [css span named-color]]))
(def known-features [:formatters :hints :async])
(def default-features [:formatters])
(def feature-groups {:all known-features
:default default-features})
(def prefs
{; -- installation --------------------------------------------------------------------------------------------------------
; you can specify a list/vector of features from known-features or a keyword from feature-groups
:features-to-install :default
:print-config-overrides false
:suppress-preload-install false
:bypass-availability-checks false
:file-reader nil
; -- feature tweaks ------------------------------------------------------------------------------------------------------
:render-metas true
:render-nils true
:render-bools true
:render-strings true
:render-numbers true
:render-keywords true
:render-symbols true
:render-instances true
:render-types true
:render-functions true
:disable-cljs-fn-formatting false ; deprecated, use :render-functions instead
; -- verbosity controls --------------------------------------------------------------------------------------------------
:max-print-level 2
:body-line-max-print-level 3
:max-header-elements 5
:min-expandable-sequable-count 0 ; false/nil means "never expandable", 0 means "always expandable" (unless empty)
:min-expandable-sequable-count-for-well-known-types 4 ; false/nil means "never expandable", 0 means "always expandable" (unless empty)
:max-number-body-items 100
:string-prefix-limit 20
:string-postfix-limit 20
:sanity-hint-min-length 128
:max-instance-header-fields 3
:max-instance-custom-printing-level 2
:max-list-protocols 5
:max-protocol-method-arities-list 3
:initial-hierarchy-depth-budget (dec 20) ; set to false to disable, issue #22
; by default, well known types will render only via cljs printer, we won't wrap them in the blue-ish type info
:well-known-types #{"cljs.core/Keyword"
"cljs.core/Symbol"
"cljs.core/TaggedLiteral"
"cljs.core/LazySeq"
"cljs.core/LazyTransformer"
"cljs.core/IndexedSeq"
"cljs.core/RSeq"
"cljs.core/PersistentQueueSeq"
"cljs.core/PersistentTreeMapSeq"
"cljs.core/NodeSeq"
"cljs.core/ArrayNodeSeq"
"cljs.core/List"
"cljs.core/Cons"
"cljs.core/EmptyList"
"cljs.core/PersistentVector"
"cljs.core/ChunkedCons"
"cljs.core/ChunkedSeq"
"cljs.core/Subvec"
"cljs.core/BlackNode"
"cljs.core/RedNode"
"cljs.core/ObjMap"
"cljs.core/KeySeq"
"cljs.core/ValSeq"
"cljs.core/PersistentArrayMapSeq"
"cljs.core/PersistentArrayMap"
"cljs.core/PersistentHashMap"
"cljs.core/PersistentTreeMap"
"cljs.core/PersistentHashSet"
"cljs.core/PersistentTreeSet"
"cljs.core/Range"
"cljs.core/ES6IteratorSeq"
"cljs.core/Eduction"
"cljs.core/UUID"
"cljs.core/ExceptionInfo"}
; -- pluggable markup ----------------------------------------------------------------------------------------------------
:more-marker "…"
:body-items-more-label "more…"
:string-abbreviation-marker " … "
:multi-arity-symbol "…"
:more-symbol "…"
:plus-symbol "+"
:header-field-value-spacer (span (css (str "color:" (named-color :field-spacer) ";")) "=")
:body-field-value-spacer (span (css (str "color:" (named-color :field-spacer) ";")) "=")
:header-field-separator " "
:more-fields-symbol "…"
:instance-value-separator ""
:fields-header-open-symbol ""
:fields-header-close-symbol ""
:fields-header-no-fields-symbol (span :header-field-name-style "∅")
:rest-symbol " & "
:args-open-symbol "["
:args-close-symbol "]"
:new-line-string-replacer "↵"
:line-index-separator ""
:dq "\""
:protocol-method-arities-more-symbol "…"
:protocol-method-arities-list-header-separator " "
:spacer " "
:nil-label "nil"
:default-envelope-header "\uD83D\uDCE8" ; U+1F4E8: INCOMING ENVELOPE, http://www.charbase.com/1f4e8-unicode-incoming-envelope
:list-separator " "
:list-open-symbol ""
:list-close-symbol ""
:empty-basis-symbol (span (css) :basis-icon (span :type-basis-item-style "∅"))
:expandable-symbol ""
:header-expander-symbol (span (css) "~")
; -- backgrounds ---------------------------------------------------------------------------------------------------------
:instance-custom-printing-background (d/get-custom-printing-background-markup)
:type-header-background (d/get-instance-type-header-background-markup)
:native-reference-background (d/get-native-reference-background-markup)
:protocol-background (d/get-protocol-background-markup)
:instance-header-background nil
; -- icons ---------------------------------------------------------------------------------------------------------------
:basis-icon (d/icon "β" (named-color :basis))
:protocols-icon (d/icon "⊢" (named-color :protocol))
:fields-icon (d/icon "∋" (named-color :field))
:method-icon (d/icon "m" (named-color :method))
:ns-icon (d/icon "in" (named-color :ns))
:native-icon (d/icon "js" (named-color :native))
:lambda-icon (d/icon "λ" (named-color :lambda))
:fn-icon (d/icon "fn" (named-color :fn))
:circular-ref-icon (d/icon "∞" (named-color :circular-ref) :slim)
; -- tags ----------------------------------------------------------------------------------------------------------------
:cljs-land-tag [:span :cljs-land-style]
:header-tag [:span :header-style]
:item-tag [:span :item-style]
:nil-tag [:span :nil-style]
:bool-tag [:span :bool-style]
:keyword-tag [:span :keyword-style]
:symbol-tag [:span :symbol-style]
:integer-tag [:span :integer-style]
:float-tag [:span :float-style]
:string-tag [:span :string-style]
:expanded-string-tag [:span :expanded-string-style]
:circular-reference-tag [:span :circular-reference-wrapper-style]
:circular-reference-body-tag [:span :circular-reference-body-style]
:native-reference-tag [:span :native-reference-style]
:native-reference-wrapper-tag [:span :native-reference-wrapper-style]
:meta-wrapper-tag [:span :meta-wrapper-style]
:meta-header-tag [:span :meta-style]
:meta-body-tag [:span :meta-body-style]
:meta-reference-tag [:span :meta-reference-style]
:body-tag [:span :body-style]
:index-tag [:span :index-style]
:standard-ol-tag [:ol :standard-ol-style]
:standard-ol-no-margin-tag [:ol :standard-ol-no-margin-style]
:standard-li-tag [:li :standard-li-style]
:standard-li-no-margin-tag [:li :standard-li-no-margin-style]
:aligned-li-tag [:li :aligned-li-style]
:body-items-more-tag [:span :body-items-more-style]
:fn-args-tag [:span :fn-args-style]
:fn-name-tag [:span :fn-name-style]
:fn-prefix-tag [:span :fn-prefix-style]
:fn-header-tag [:span :fn-header-style]
:fn-multi-arity-args-indent-tag [:span :fn-multi-arity-args-indent-style]
:fn-ns-name-tag [:span :fn-ns-name-style]
:type-wrapper-tag [:span :type-wrapper-style]
:type-header-tag [:span :type-header-style]
:type-name-tag [:span :type-name-style]
:type-ref-tag [:span :type-ref-style]
:type-basis-tag [:span :type-basis-style]
:type-basis-item-tag [:span :type-basis-item-style]
:standalone-type-tag [:span :standalone-type-style]
:header-field-tag [:span :header-field-style]
:header-field-name-tag [:span :header-field-name-style]
:header-field-value-tag [:span :header-field-value-style]
:instance-body-fields-table-tag [:table :instance-body-fields-table-style]
:body-field-tr-tag [:tr :body-field-tr-style]
:body-field-td1-tag [:td :body-field-td1-style]
:body-field-td2-tag [:td :body-field-td2-style]
:body-field-td3-tag [:td :body-field-td3-style]
:body-field-name-tag [:span :body-field-name-style]
:body-field-value-tag [:span :body-field-value-style]
:fields-header-tag [:span :fields-header-style]
:protocol-method-arities-header-tag [:span :protocol-method-arities-header-style]
:protocol-name-tag [:span :protocol-name-style]
:protocol-method-tag [:span :protocol-method-style]
:protocol-method-name-tag [:span :protocol-method-name-style]
:protocol-ns-name-tag [:span :protocol-ns-name-style]
:protocols-header-tag [:span :protocols-header-style]
:protocol-more-tag [:span :protocol-more-style]
:fast-protocol-tag [:span :fast-protocol-style]
:slow-protocol-tag [:span :slow-protocol-style]
:instance-value-tag [:span :instance-value-style]
:instance-custom-printing-wrapper-tag [:span :instance-custom-printing-wrapper-style]
:instance-header-tag [:span :instance-header-style]
:instance-type-header-tag [:span :instance-type-header-style]
:list-tag [:span :list-style]
:expandable-tag [:span :expandable-style]
:expandable-inner-tag [:span :expandable-inner-style]
:instance-custom-printing-tag [:span :instance-custom-printing-style]
:default-envelope-tag [:span :default-envelope-style]
; -- DOM tags mapping ----------------------------------------------------------------------------------------------------
:span "span"
:div "div"
:ol "ol"
:li "li"
:table "table"
:td "td"
:tr "tr"
; -- styles --------------------------------------------------------------------------------------------------------------
:cljs-land-style (css (str "background-color: " (named-color :signature-background) ";")
(str "color: " (named-color :base-text-color) ";") ; prevent leaking in text colors from "outside"
"border-radius: 2px;")
:header-style (css "white-space: nowrap;") ; this prevents jumping of content when expanding sections due to content wrapping
:expandable-style (css "white-space: nowrap;"
"padding-left: 3px;")
:expandable-inner-style (css "margin-left: -3px;")
:item-style (css "display: inline-block;"
"white-space: nowrap;"
"border-left: 2px solid rgba(100, 100, 100, 0.2);"
"padding: 0px 4px 0px 4px;"
"margin: 1px 0px 0px 0px;")
:fn-header-style (css)
:fn-prefix-style (css)
:nil-style (css (str "color: " (named-color :nil) ";"))
:keyword-style (css (str "color: " (named-color :keyword) ";"))
:integer-style (css (str "color: " (named-color :integer) ";"))
:float-style (css (str "color: " (named-color :float) ";"))
:string-style (css (str "color: " (named-color :string) ";"))
:symbol-style (css (str "color: " (named-color :symbol) ";"))
:bool-style (css (str "color: " (named-color :bool) ";"))
; native reference wrapper is here to counter some "evil" internal DevTools styles in treeoutline.css
; namely :host padding[1] and li min-height[2]
; [1] https://github.com/binaryage/dirac/blob/acdf79e782510f6cdac609def3f561d5d04c86c8/front_end/ui/treeoutline.css#L9
; [2] https://github.com/binaryage/dirac/blob/acdf79e782510f6cdac609def3f561d5d04c86c8/front_end/ui/treeoutline.css#L80
:native-reference-wrapper-style (css "position: relative;"
"display: inline-flex;")
:native-reference-style (css "padding: 0px 3px;"
"margin: -4px 0px -2px;"
"position: relative;"
"top: 1px;")
:type-wrapper-style (css "position: relative;"
"padding-left: 1px;"
"border-radius: 2px;")
:type-ref-style (css "position: relative;")
:type-header-style (css (d/get-common-type-header-style)
"border-radius: 2px;")
:type-name-style (css "padding-right: 4px;")
:type-basis-style (css "margin-right: 3px;")
:type-basis-item-style (css (str "color: " (named-color :basis) ";")
"margin-right: 6px;")
:protocol-name-style (css "position: relative;")
:fast-protocol-style (css (d/get-common-protocol-style)
(str "color: " (named-color :fast-protocol) ";"))
:slow-protocol-style (css (d/get-common-protocol-style)
(str "color: " (named-color :slow-protocol) ";"))
:protocol-more-style (css "font-size: 8px;"
"position: relative;")
:protocol-ns-name-style (css (str "color: " (named-color :ns) ";"))
:list-style (css)
:body-field-name-style (css (str "color: " (named-color :field) ";"))
:body-field-value-style (css "margin-left: 6px;")
:header-field-name-style (css (str "color: " (named-color :field) ";"))
:body-field-td1-style (css "vertical-align: top;"
"padding: 0;"
"padding-right: 4px;")
:body-field-td2-style (css "vertical-align: top;"
"padding: 0;")
:body-field-td3-style (css "vertical-align: top;"
"padding: 0;")
:instance-header-style (css (d/type-outline-style)
"position:relative;")
:expandable-wrapper-style (css)
:standalone-type-style (css (d/type-outline-style))
:instance-custom-printing-style (css "position: relative;"
"padding: 0 2px 0 4px;")
:instance-custom-printing-wrapper-style (css "position: relative;"
"border-radius: 2px;")
:instance-type-header-style (css (d/get-common-type-header-style)
"border-radius: 2px 0 0 2px;")
:instance-body-fields-table-style (css "border-spacing: 0;"
"border-collapse: collapse;"
"margin-bottom: -2px;" ; weird spacing workaround
"display: inline-block;")
:fields-header-style (css "padding: 0px 3px;")
:protocol-method-name-style (css "margin-right: 6px;"
(str "color: " (named-color :protocol) " ;"))
:meta-wrapper-style (css (str "box-shadow: 0px 0px 0px 1px " (named-color :meta) " inset;")
"margin-top: 1px;"
"border-radius: 2px;")
:meta-reference-style (css (str "background-color:" (named-color :meta) ";")
"border-radius: 0 2px 2px 0;")
:meta-style (css (str "color: " (named-color :meta-text) ";")
"padding: 0px 3px;"
"-webkit-user-select: none;")
:meta-body-style (css (str "background-color: " (named-color :meta 0.1) ";")
(str "box-shadow: 0px 0px 0px 1px " (named-color :meta) " inset;")
"position: relative;"
"top: -1px;"
"padding: 3px 12px;"
"border-bottom-right-radius: 2px;")
:fn-ns-name-style (css (str "color: " (named-color :ns) ";"))
:fn-name-style (css (str "color: " (named-color :fn) ";")
"margin-right: 2px;")
:fn-args-style (css (str "color: " (named-color :fn-args) ";"))
:fn-multi-arity-args-indent-style (css "visibility: hidden;")
:standard-ol-style (css "list-style-type: none;"
"padding-left: 0px;"
"margin-top: 0px;"
"margin-bottom: 0px;"
"margin-left: 0px;")
:standard-ol-no-margin-style (css "list-style-type: none;"
"padding-left: 0px;"
"margin-top: 0px;"
"margin-bottom: 0px;"
"margin-left: 0px;")
:standard-li-style (css "margin-left: 0px;"
(d/get-body-line-common-style))
:standard-li-no-margin-style (css "margin-left: 0px;"
(d/get-body-line-common-style))
:aligned-li-style (css "margin-left: 0px;"
(d/get-body-line-common-style))
:body-items-more-style (css (str "background-color:" (named-color :more-background) ";")
"min-width: 50px;"
"display: inline-block;"
(str "color: " (named-color :more) ";")
"cursor: pointer;"
"line-height: 14px;"
"font-size: 10px;"
"border-radius: 2px;"
"padding: 0px 4px 0px 4px;"
"margin: 1px 0px 0px 0px;"
"-webkit-user-select: none;")
:body-style (css "display: inline-block;"
"padding: 3px 12px;"
(str "border-top: 2px solid " (named-color :body-border) ";")
"margin: 1px;"
"margin-top: 0px;"
(str "background-color: " (named-color :signature-background) ";"))
:index-style (css "min-width: 50px;"
"display: inline-block;"
"text-align: right;"
"vertical-align: top;"
(str "background-color: " (named-color :index-background) ";")
(str "color: " (named-color :index) ";")
"opacity: 0.5;"
"margin-right: 3px;"
"padding: 0px 4px 0px 4px;"
"margin: 1px 0px 0px 0px;"
"-webkit-user-select: none;")
:expanded-string-style (css "padding: 0px 12px 0px 12px;"
(str "color: " (named-color :string) ";")
"white-space: pre;"
(str "border-top: 1px solid " (named-color :expanded-string-border) ";")
"border-radius: 1px;"
"margin: 0px 0px 2px 0px;"
(str "background-color: " (named-color :expanded-string-background) ";"))
:default-envelope-style (css)
; -- pluggable api handlers ----------------------------------------------------------------------------------------------
:header-pre-handler nil
:header-post-handelr nil
:has-body-pre-handler nil
:has-body-post-handler nil
:body-pre-handler nil
:body-post-handler nil
; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
})

File diff suppressed because one or more lines are too long

Some files were not shown because too many files have changed in this diff Show more