diff --git a/404.html b/404.html deleted file mode 100644 index 123d9ad65..000000000 --- a/404.html +++ /dev/null @@ -1,3 +0,0 @@ -404 Page not found | Cyber Docs v0.3 -

404

Page Not Found

Cyber Docs v0.3

\ No newline at end of file diff --git a/book.min.4f0117e74e5337280f18eb9641eae520cb4b25adcf5dd64fafad4664145a5957.css b/book.min.4f0117e74e5337280f18eb9641eae520cb4b25adcf5dd64fafad4664145a5957.css deleted file mode 100644 index 33ac19a3d..000000000 --- a/book.min.4f0117e74e5337280f18eb9641eae520cb4b25adcf5dd64fafad4664145a5957.css +++ /dev/null @@ -1 +0,0 @@ -@charset "UTF-8";:root{--gray-100:rgba(255, 255, 255, 0.1);--gray-200:rgba(255, 255, 255, 0.2);--gray-500:rgba(255, 255, 255, 0.5);--color-link:#84b2ff;--color-visited-link:#b88dff;--body-background:#343a40;--body-font-color:#e9ecef;--icon-filter:brightness(0) invert(1);--hint-color-info:#6bf;--hint-color-warning:#fd6;--hint-color-danger:#f66}/*!normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css*/html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}main{display:block}h1{font-size:2em;margin:.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button}button::-moz-focus-inner,[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner{border-style:none;padding:0}button:-moz-focusring,[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:.35em .75em .625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none}.flex{display:flex}.flex-auto{flex:auto}.flex-even{flex:1 1}.flex-wrap{flex-wrap:wrap}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.align-center{align-items:center}.mx-auto{margin:0 auto}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.hidden{display:none}input.toggle{height:0;width:0;overflow:hidden;opacity:0;position:absolute}.clearfix::after{content:"";display:table;clear:both}html{font-size:16px;scroll-behavior:smooth;touch-action:manipulation}body{min-width:20rem;color:var(--body-font-color);background:var(--body-background);letter-spacing:.33px;font-weight:400;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;box-sizing:border-box}body *{box-sizing:inherit}h1,h2,h3,h4,h5{font-weight:400}a{text-decoration:none;color:var(--color-link)}img{vertical-align:baseline}:focus{outline-style:auto;outline-color:currentColor;outline-color:-webkit-focus-ring-color}aside nav ul{padding:0;margin:0;list-style:none}aside nav ul li{margin:1em 0;position:relative}aside nav ul a{display:block}aside nav ul a:hover{opacity:.5}aside nav ul ul{padding-inline-start:1rem}ul.pagination{display:flex;justify-content:center;list-style-type:none;padding-inline-start:0}ul.pagination .page-item a{padding:1rem}.container{max-width:80rem;margin:0 auto}.book-icon{filter:var(--icon-filter)}.book-brand{margin-top:0;margin-bottom:1rem}.book-brand img{height:1.5em;width:1.5em;margin-inline-end:.5rem}.book-menu{flex:0 0 16rem;font-size:.875rem}.book-menu .book-menu-content{width:16rem;padding:1rem;background:var(--body-background);position:fixed;top:0;bottom:0;overflow-x:hidden;overflow-y:auto}.book-menu a,.book-menu label{color:inherit;cursor:pointer;word-wrap:break-word}.book-menu a.active{color:var(--color-link)}.book-menu input.toggle+label+ul{display:none}.book-menu input.toggle:checked+label+ul{display:block}.book-menu input.toggle+label::after{content:"▸"}.book-menu input.toggle:checked+label::after{content:"▾"}body[dir=rtl] .book-menu input.toggle+label::after{content:"◂"}body[dir=rtl] .book-menu input.toggle:checked+label::after{content:"▾"}.book-section-flat{margin:2rem 0}.book-section-flat>a,.book-section-flat>span,.book-section-flat>label{font-weight:bolder}.book-section-flat>ul{padding-inline-start:0}.book-page{min-width:20rem;flex-grow:1;padding:1rem}.book-post{margin-bottom:3rem}.book-header{display:none;margin-bottom:1rem}.book-header label{line-height:0}.book-header img.book-icon{height:1.5em;width:1.5em}.book-search{position:relative;margin:1rem 0;border-bottom:1px solid transparent}.book-search input{width:100%;padding:.5rem;border:0;border-radius:.25rem;background:var(--gray-100);color:var(--body-font-color)}.book-search input:required+.book-search-spinner{display:block}.book-search .book-search-spinner{position:absolute;top:0;margin:.5rem;margin-inline-start:calc(100% - 1.5rem);width:1rem;height:1rem;border:1px solid transparent;border-top-color:var(--body-font-color);border-radius:50%;animation:spin 1s ease infinite}@keyframes spin{100%{transform:rotate(360deg)}}.book-search small{opacity:.5}.book-toc{flex:0 0 16rem;font-size:.75rem}.book-toc .book-toc-content{width:16rem;padding:1rem;position:fixed;top:0;bottom:0;overflow-x:hidden;overflow-y:auto}.book-toc img{height:1em;width:1em}.book-toc nav>ul>li:first-child{margin-top:0}.book-footer{padding-top:1rem;font-size:.875rem}.book-footer img{height:1em;width:1em;margin-inline-end:.5rem}.book-comments{margin-top:1rem}.book-languages{margin-block-end:2rem}.book-languages .book-icon{height:1em;width:1em;margin-inline-end:.5em}.book-languages ul{padding-inline-start:1.5em}.book-menu-content,.book-toc-content,.book-page,.book-header aside,.markdown{transition:.2s ease-in-out;transition-property:transform,margin,opacity,visibility;will-change:transform,margin,opacity}@media screen and (max-width:56rem){#menu-control,#toc-control{display:inline}.book-menu{visibility:hidden;margin-inline-start:-16rem;font-size:16px;z-index:1}.book-toc{display:none}.book-header{display:block}#menu-control:focus~main label[for=menu-control]{outline-style:auto;outline-color:currentColor;outline-color:-webkit-focus-ring-color}#menu-control:checked~main .book-menu{visibility:initial}#menu-control:checked~main .book-menu .book-menu-content{transform:translateX(16rem);box-shadow:0 0 .5rem rgba(0,0,0,.1)}#menu-control:checked~main .book-page{opacity:.25}#menu-control:checked~main .book-menu-overlay{display:block;position:absolute;top:0;bottom:0;left:0;right:0}#toc-control:focus~main label[for=toc-control]{outline-style:auto;outline-color:currentColor;outline-color:-webkit-focus-ring-color}#toc-control:checked~main .book-header aside{display:block}body[dir=rtl] #menu-control:checked~main .book-menu .book-menu-content{transform:translateX(-16rem)}}@media screen and (min-width:80rem){.book-page,.book-menu .book-menu-content,.book-toc .book-toc-content{padding:2rem 1rem}}@font-face{font-family:roboto;font-style:normal;font-weight:400;font-display:swap;src:local(""),url(fonts/roboto-v27-latin-regular.woff2)format("woff2"),url(fonts/roboto-v27-latin-regular.woff)format("woff")}@font-face{font-family:roboto;font-style:normal;font-weight:700;font-display:swap;src:local(""),url(fonts/roboto-v27-latin-700.woff2)format("woff2"),url(fonts/roboto-v27-latin-700.woff)format("woff")}@font-face{font-family:roboto mono;font-style:normal;font-weight:400;font-display:swap;src:local(""),url(fonts/roboto-mono-v13-latin-regular.woff2)format("woff2"),url(fonts/roboto-mono-v13-latin-regular.woff)format("woff")}body{font-family:roboto,sans-serif}code{font-family:roboto mono,monospace}@media print{.book-menu,.book-footer,.book-toc{display:none}.book-header,.book-header aside{display:block}main{display:block!important}}.markdown{line-height:1.6}.markdown>:first-child{margin-top:0}.markdown h1,.markdown h2,.markdown h3,.markdown h4,.markdown h5,.markdown h6{font-weight:400;line-height:1;margin-top:1.5em;margin-bottom:1rem}.markdown h1 a.anchor,.markdown h2 a.anchor,.markdown h3 a.anchor,.markdown h4 a.anchor,.markdown h5 a.anchor,.markdown h6 a.anchor{opacity:0;font-size:.75em;vertical-align:middle;text-decoration:none}.markdown h1:hover a.anchor,.markdown h1 a.anchor:focus,.markdown h2:hover a.anchor,.markdown h2 a.anchor:focus,.markdown h3:hover a.anchor,.markdown h3 a.anchor:focus,.markdown h4:hover a.anchor,.markdown h4 a.anchor:focus,.markdown h5:hover a.anchor,.markdown h5 a.anchor:focus,.markdown h6:hover a.anchor,.markdown h6 a.anchor:focus{opacity:initial}.markdown h4,.markdown h5,.markdown h6{font-weight:bolder}.markdown h5{font-size:.875em}.markdown h6{font-size:.75em}.markdown b,.markdown optgroup,.markdown strong{font-weight:bolder}.markdown a{text-decoration:none}.markdown a:hover{text-decoration:underline}.markdown a:visited{color:var(--color-visited-link)}.markdown img{max-width:100%;height:auto}.markdown code{padding:0 .25rem;background:var(--gray-200);border-radius:.25rem;font-size:.875em}.markdown pre{padding:1rem;background:var(--gray-100);border-radius:.25rem;overflow-x:auto}.markdown pre code{padding:0;background:0 0}.markdown p{word-wrap:break-word}.markdown blockquote{margin:1rem 0;padding:.5rem 1rem .5rem .75rem;border-inline-start:.25rem solid var(--gray-200);border-radius:.25rem}.markdown blockquote :first-child{margin-top:0}.markdown blockquote :last-child{margin-bottom:0}.markdown table{overflow:auto;display:block;border-spacing:0;border-collapse:collapse;margin-top:1rem;margin-bottom:1rem}.markdown table tr th,.markdown table tr td{padding:.5rem 1rem;border:1px solid var(--gray-200)}.markdown table tr:nth-child(2n){background:var(--gray-100)}.markdown hr{height:1px;border:none;background:var(--gray-200)}.markdown ul,.markdown ol{padding-inline-start:2rem;word-wrap:break-word}.markdown dl dt{font-weight:bolder;margin-top:1rem}.markdown dl dd{margin-inline-start:0;margin-bottom:1rem}.markdown .highlight table tr td:nth-child(1) pre{margin:0;padding-inline-end:0}.markdown .highlight table tr td:nth-child(2) pre{margin:0;padding-inline-start:0}.markdown details{padding:1rem;border:1px solid var(--gray-200);border-radius:.25rem}.markdown details summary{line-height:1;padding:1rem;margin:-1rem;cursor:pointer}.markdown details[open] summary{margin-bottom:0}.markdown figure{margin:1rem 0}.markdown figure figcaption p{margin-top:0}.markdown-inner>:first-child{margin-top:0}.markdown-inner>:last-child{margin-bottom:0}.markdown .book-expand{margin-top:1rem;margin-bottom:1rem;border:1px solid var(--gray-200);border-radius:.25rem;overflow:hidden}.markdown .book-expand .book-expand-head{background:var(--gray-100);padding:.5rem 1rem;cursor:pointer}.markdown .book-expand .book-expand-content{display:none;padding:1rem}.markdown .book-expand input[type=checkbox]:checked+.book-expand-content{display:block}.markdown .book-tabs{margin-top:1rem;margin-bottom:1rem;border:1px solid var(--gray-200);border-radius:.25rem;overflow:hidden;display:flex;flex-wrap:wrap}.markdown .book-tabs label{display:inline-block;padding:.5rem 1rem;border-bottom:1px transparent;cursor:pointer}.markdown .book-tabs .book-tabs-content{order:999;width:100%;border-top:1px solid var(--gray-100);padding:1rem;display:none}.markdown .book-tabs input[type=radio]:checked+label{border-bottom:1px solid var(--color-link)}.markdown .book-tabs input[type=radio]:checked+label+.book-tabs-content{display:block}.markdown .book-tabs input[type=radio]:focus+label{outline-style:auto;outline-color:currentColor;outline-color:-webkit-focus-ring-color}.markdown .book-columns{margin-left:-1rem;margin-right:-1rem}.markdown .book-columns>div{margin:1rem 0;min-width:10rem;padding:0 1rem}.markdown a.book-btn{display:inline-block;font-size:.875rem;color:var(--color-link);line-height:2rem;padding:0 1rem;border:1px solid var(--color-link);border-radius:.25rem;cursor:pointer}.markdown a.book-btn:hover{text-decoration:none}.markdown .book-hint.info{border-color:#6bf;background-color:rgba(102,187,255,.1)}.markdown .book-hint.warning{border-color:#fd6;background-color:rgba(255,221,102,.1)}.markdown .book-hint.danger{border-color:#f66;background-color:rgba(255,102,102,.1)} \ No newline at end of file diff --git a/categories/index.html b/categories/index.html deleted file mode 100644 index ddf4153f8..000000000 --- a/categories/index.html +++ /dev/null @@ -1,6 +0,0 @@ -Categories | Cyber Docs v0.3 - -
Categories -
\ No newline at end of file diff --git a/categories/index.xml b/categories/index.xml deleted file mode 100644 index e0130a536..000000000 --- a/categories/index.xml +++ /dev/null @@ -1 +0,0 @@ -Categories on Cyber Docs v0.3https://fubark.github.io/cyber/categories/Recent content in Categories on Cyber Docs v0.3Hugo -- gohugo.ioen-us \ No newline at end of file diff --git a/categories/page/1/index.html b/categories/page/1/index.html deleted file mode 100644 index f230649c0..000000000 --- a/categories/page/1/index.html +++ /dev/null @@ -1,2 +0,0 @@ -https://fubark.github.io/cyber/categories/ - \ No newline at end of file diff --git a/docs/index.html b/docs/index.html deleted file mode 100644 index 57c05fd89..000000000 --- a/docs/index.html +++ /dev/null @@ -1,6 +0,0 @@ -Docs | Cyber Docs v0.3 - -
Docs -
\ No newline at end of file diff --git a/docs/index.xml b/docs/index.xml deleted file mode 100644 index f8e8c322d..000000000 --- a/docs/index.xml +++ /dev/null @@ -1 +0,0 @@ -Docs on Cyber Docs v0.3https://fubark.github.io/cyber/docs/Recent content in Docs on Cyber Docs v0.3Hugo -- gohugo.ioen-us \ No newline at end of file diff --git a/docs/toc/aot-jit/index.html b/docs/toc/aot-jit/index.html deleted file mode 100644 index a40940000..000000000 --- a/docs/toc/aot-jit/index.html +++ /dev/null @@ -1,14 +0,0 @@ -AOT/JIT | Cyber Docs v0.3 - -
AOT/JIT -

JIT -#

Cyber’s just-in-time compiler is incomplete and unstable. To run your script with JIT enabled:

cyber -jit <script>
-

The JIT compiler is just as fast as the bytecode generation so when it’s enabled, the entire script is compiled from the start.

AOT -#

Work on the ahead-of-time compiler has not begun.

\ No newline at end of file diff --git a/docs/toc/concurrency/index.html b/docs/toc/concurrency/index.html deleted file mode 100644 index 3847d3d36..000000000 --- a/docs/toc/concurrency/index.html +++ /dev/null @@ -1,114 +0,0 @@ -Concurrency | Cyber Docs v0.3 - -
Concurrency -

Concurrency. -#

Cyber supports fibers as a concurrency mechanism. There are plans to support preemptive concurrency with async/await as well as multithreading.

Fibers. -#

A fiber represents a separate execution context as a first-class value. It contains it’s own call stack and program counter. Fibers by themselves do not enable parallelism.

Creating fibers. -#

The coinit keyword creates and returns a new fiber using a function as the entry point:

var count = 0
-
-var foo = func ():
-    count += 1
-    coyield
-    count += 1
-
-var fiber = coinit(foo)
-
-print count          -- '0'
-coresume fiber
-print count          -- '1'
-coresume fiber
-print count          -- '2'
-

A fiber does not start execution until coresume is invoked on it. -coyield pauses the current fiber and execution is returned to the previous fiber that invoked coresume.

Passing arguments. -#

Arguments after the callee are passed into the entry function:

var count = 0
-
-var increment = func (inc):
-    count += inc
-
-var fiber = coinit(increment, 5)
-coresume fiber
-print count          -- '5'
-

When the fiber is created, the arguments are saved inside the fiber’s stack. Once the first coresume is invoked, the entry function is invoked with the saved arguments.

Reset state. -#

To reset a fiber to its initial state, invoke reset(). *Planned Feature -When reset, the existing stack is unwinded, the program counter returns to the starting point, and the state is set to .init:

func fib(n int) int:
-    coyield n
-    if n < 2:
-        return n
-    return fib(n - 1) + fib(n - 2)
-
-var task = coinit(fib, 10)
-
--- Progress the fiber...
-print(coresume task)    -- Prints "10"
-print(coresume task)    -- Prints "9"
-print(coresume task)    -- Prints "8"
-
--- Reset back to the start with the `.init` state.
-fiber.reset()
-print(coresume task)    -- Prints "10"
-

Rebinding arguments. -#

Arguments attached to the fiber can be rebinded with a different set of values. *Planned Feature -This allows fiber reuse, instead of creating a new fiber:

var task = coinit(fib, 10)
-
--- Run task to completion.
-var res = 0
-while fiber.status() != .done:
-    res = coresume fiber
-print res
-
-fiber.reset()
-fiber.bindArgs(20)
-
--- Run task again with the new argument...
-

Fiber block. -#

A fiber block is used to construct a fiber without an entry function. *Planned Feature The counting example can be rewritten to:

var count = 0
-
-var fiber = coinit:
-    count += 1       -- `count is captured`
-    coyield
-    count += 1
-
-print count          -- '0'
-coresume fiber
-print count          -- '1'
-coresume fiber
-print count          -- '2'
-

Referencing parent variables from the fiber block automatically captures them just like a function closure.

Pause and resume. -#

coyield can be used anywhere in a fiber’s call stack to pause execution and return to the previous fiber.

func foo():
-    print 'foo'
-    bar()
-
-func bar():
-    -- Nested coyield in call stack.
-    coyield
-    print 'bar'
-
-var fiber = coinit(foo)
-coresume fiber
-

coresume also returns the resulting value.

func foo():
-    return 123
-
-var fiber = coinit(foo)
-print(coresume fiber)    -- '123'
-

coyield can return a value back to coresume. *Planned Feature

Fiber state. -#

Use Fiber.status() to get the current state of the fiber.

func foo():
-    coyield
-    print 'done'
-
-var fiber = coinit(foo)
-print fiber.status()   -- '.paused'
-coresume fiber
-print fiber.status()   -- '.paused'
-coresume fiber
-print fiber.status()   -- '.done'
-

The main execution context is a fiber as well. Once the main fiber has finished, the VM is done and control is returned to the host.

Gas mileage. -#

Planned Feature

Async. -#

Planned Feature

Multi-thread. -#

Planned Feature

\ No newline at end of file diff --git a/docs/toc/control-flow/index.html b/docs/toc/control-flow/index.html deleted file mode 100644 index 747706511..000000000 --- a/docs/toc/control-flow/index.html +++ /dev/null @@ -1,114 +0,0 @@ -Control Flow | Cyber Docs v0.3 - -
Control Flow -

Control Flow. -#

Cyber provides the common constructs to branch and enter loops.

Branching. -#

if statement. -#

Use if and else statements to branch the execution of your code depending on conditions. The else clause can contain a condition which is only evaluated if the previous if or conditional else clause was false.

var a = 10
-if a == 10:
-    print 'a is 10'
-else a == 20:
-    print 'a is 20'
-else:
-    print 'neither 10 nor 20'
-

Conditional expression. -#

A conditional branch expression evaluates a condition and returns either the true value or false value:

var a = 10
-var str = a == 10 ? 'red' else 'blue'
-

and/or -#

Use and and or logical operators to combine conditions:

var a = 10
-if a > 5 and a < 15:
-    print 'a is between 5 and 15'
-if a == 20 or a == 10: 
-    print 'a is 10 or 20'
-

Iterations. -#

Infinite loop. -#

The while keyword starts an infinite loop which continues to run the code in the block until a break or return is reached.

var count = 0
-while:
-    if count > 100:
-        break
-    count += 1
-

Conditional loop. -#

When the while clause contains a condition, the loop continues to run until the condition is evaluated to false:

var running = true
-var count = 0
-while running:
-    if count > 100:
-        running = false
-    count += 1
-

Unwrapping loop. -#

Using the capture operator -> unwraps the left optional value to the right variable declaration. The loop exits when the left value is none:

var iter = dir.walk()
-while iter.next() -> entry:
-    print entry.name
-

For range. -#

for loops can iterate over a range that starts at an int (inclusive) to a target int (exclusive). -The capture operator -> is used to capture the loop’s counter variable:

for 0..4:
-    performAction() 
-
-for 0..100 -> i:
-    print i    -- 0, 1, 2, ... , 99
-

To decrement the counter instead, use -..:

for 100-..0 -> i:
-    print i    -- 100, 99, 98, ... , 1
-

When the range operator .. is replaced with ..=, the target int is inclusive: *Planned Feature

for 0..=100 -> i:
-    print i    -- 0, 1, 2, ... , 100
-

For each. -#

The for clause can iterate over any type that implements the Iterable trait. An Iterable contains an iterator() method which returns an Iterator object. The for loop continually invokes the Iterator’s next() method until none is returned.

Lists can be iterated since they implement the Iterable trait. The capture operator -> is used to capture the value returned from an iterator’s next():

var list = [1, 2, 3, 4, 5]
-
-for list -> n:
-    print n
-

Maps can be iterated. next() returns a key and value tuple:

var map = [ a: 123, b: 234 ]
-
-for map -> entry:
-    print entry[0]
-    print entry[1]
-

Use the destructure syntax to extract the key and value into two separate variables:

for map -> [ key, val ]:
-    print 'key $(key) -> value $(val)'
-

For each with index. -#

A counting index can be declared after the each variable. The count starts at 0 for the first value:

var list = [1, 2, 3, 4, 5]
-
-for list -> val, i:
-    print 'index $(i), value $(val)'
-

Exit loop. -#

Use break to exit a loop. This loop stops printing once i reaches 4:

for 0..10 -> i:
-    if i == 4:
-        break
-    print i
-

Next iteration. -#

Use continue to skip the rest of the loop and go to the next iteration. -This loop prints 0 through 9 but skips 4:

for 0..10 -> i:
-    if i == 4:
-        continue
-    print i
-

Switch matching. -#

The switch statement branches to a case block from a matching case condition. The expression that is matched against comes after switch statement. Multiple cases can be grouped together using a comma separator. An optional else fallback case is executed when no other cases were matched. -*Incomplete: Not all types can be used in the case conditions such as ranges.

var val = 1000
-switch val:
-case 0..100: print 'at or between 0 and 99'
-case 100   : print 'val is 100'
-case 200:
-    print 'val is 200'
-case 300, 400:
-    print 'combined case'
-else:
-    print 'val is $(val)'
-

Note that the switch block must be empty and requires at least one case block or an else block to come after it.

Switch assignment. -#

Although switch can not be used freely as an expression, it can be assigned to a left variable or destination:

var shu = switch pepper:
-case 'bell'     => 0
-case 'anaheim'  => 500
-case 'jalapeño' => 2000
-case 'serrano'  => 10000
-

When declaring an assignable switch, the cases must have a return value using the syntax case {cond} => {expr} or else => {expr}.

Switch break. -#

A break statement exits the current case block and resumes execution after the end of the switch statement: *Planned Feature

switch value:
-case 0..5:
-    print value
-    if value == 3:
-        break case
-    print value    -- Skips second print if `value` is 3.
-

Try/Catch. -#

The try catch statement, try else and try expressions provide a way to catch a throwing error and resume execution in a different branch. Learn more about Error Handling.

Deferred Execution. -#

Planned Feature

\ No newline at end of file diff --git a/docs/toc/data-types/index.html b/docs/toc/data-types/index.html deleted file mode 100644 index 937050e64..000000000 --- a/docs/toc/data-types/index.html +++ /dev/null @@ -1,237 +0,0 @@ -Data Types | Cyber Docs v0.3 - -
Data Types -

Data Types. -#

In Cyber, there are primitive types and object types. Primitives are copied around by value and don’t need additional heap memory or reference counts.

Primitives include Booleans, Floats, Integers, Enums, Symbols, Error Symbols, and the none value.

Object types include Lists, Tuples, Maps, Strings, Arrays, User Objects, Lambdas, Fibers, Enums with payloads, Pointers, and several internal object types.

None. -#

The none value represents an empty value. This is similar to null in other languages.

Booleans. -#

Booleans can be true or false. See type bool.

var a = true
-if a:
-    print 'a is true'
-

When other value types are coerced to the bool type, the truthy value is determined as follows.

  • The none value is false.
  • Other objects and values are always true.

Numbers. -#

Integers. -#

int is the default integer type. It has 48-bits and can represent integers in the range -(247) to 247-1. See type int.

When a numeric literal is used and the type can not be inferred, it will default to the int type:

var a = 123
-

Integer notations always produce a int value:

var a = 0xFF     -- hex.
-a = 0o17         -- octal.
-a = 0b1010       -- binary.
-a = `🐶`         -- UTF-8 rune.
-

Arbitrary values can be converted to a int using the type as a function.

var a = '123'
-var b = int(a) 
-

In addition to arithmetic operations, integers can also perform bitwise operations.

Floats. -#

float is the default floating point type. It has a (IEEE 754) 64-bit floating point format. See type float.

Although a float represents a decimal number, it can also represent integers between -(253-1) and (253-1). Any integers beyond the safe integer range is not guaranteed to have a unique representation.

A numeric literal can be used to create a float if the inferred type is a float:

var a float = 123
-

Decimal and scientific notations always produce a float value:

var a = 2.34567
-var b = 123.0e4
-

Arbitrary values can be converted to a float using the type as a function.

var a = '12.3'
-var b = float(a) 
-

Big Numbers. -#

Planned Feature

Strings. -#

The string type represents a sequence of UTF-8 codepoints, also known as runes. Each rune is stored internally as 1-4 bytes and can be represented as an int. See type string.

Under the hood, there are multiple string implementations to make operations faster by default.

Strings are immutable, so operations that do string manipulation return a new string. By default, small strings are interned to reduce memory footprint.

To mutate an existing string, use MutString. *Planned Feature

A string is always UTF-8 validated. Using an Array to represent raw bytes of a string is faster but you’ll have to validate them and take care of indexing.

A single line string literal is surrounded in single quotes.

var apple = 'a fruit'
-

You can escape the single quote inside the literal or use double quotes.

var apple = 'Bob\'s fruit'
-apple = "Bob's fruit"
-

Concatenate two strings together with the + operator or the method concat.

var res = 'abc' + 'xyz'
-res = res.concat('end')
-

Strings are UTF-8 encoded.

var str = 'abc🦊xyz🐶'
-

Use double quotes to surround a multi-line string.

var str = "line a
-line b
-line c"
-

You can escape double quotes inside the literal or use triple quotes.

var str = "line a
-line \"b\"
-line c"
-
--- Using triple quotes.
-str = '''line a
-line "b"
-line c
-'''
-

The following escape sequences are supported:

Escape SequenceCodeDescription
\a0x07Terminal bell.
\b0x08Backspace.
\e0x1bEscape character.
\n0x0aLine feed character.
\r0x0dCarriage return character.
\t0x09Horizontal tab character.

The boundary of each line can be set with a vertical line character. This makes it easier to see the whitespace. -*Planned Feature

var poem = "line a
-       |  two spaces from the left
-       |     indented further"
-

Using the index operator will return the UTF-8 rune at the given index as a slice. This is equivalent to calling the method sliceAt().

var str = 'abcd'
-print str[1]     -- "b"
-

Using the slice operator will return a view of the string at the given start and end (exclusive) indexes. The start index defaults to 0 and the end index defaults to the string’s length.

var str = 'abcxyz'
-var sub = str[0..3]
-print sub        -- "abc"
-print str[..5]   -- "abcxy"
-print str[1..]   -- "bcxyz"
-
--- One way to use slices is to continue a string operation.
-str = 'abcabcabc'
-var i = str.findRune(`c`)
-print(i)                            -- "2"
-i += 1
-print(i + str[i..].findRune(`c`))   -- "5"
-

String Interpolation. -#

Expressions can be embedded into string templates with $():

var name = 'Bob'
-var points = 123
-var str = 'Scoreboard: $(name) $(points)'
-

String templates can not contain nested string templates.

String formatting. -#

Values that can be formatted into a string will have a fmt method:

var file = os.openFile('data.bin', .read)
-var bytes = file.readToEnd()
-
--- Dump contents in hex.
-print '$(bytes.fmt(.x))' 
-

Arrays. -#

An array is an immutable sequence of bytes. It can be used to represent strings but it won’t automatically validate their encoding and indexing returns the n’th byte rather than a UTF-8 rune. See type array.

var a = array('abcd')
-a = a.insertByte(1, 255)
-print a[0]     -- "97"
-print a[1]     -- "255"
-

Bracket literals. -#

Bracket literals are delimited with brackets []. They are used to initialize Lists, Maps, and Objects:

var list = [1, 2, 3]
-var map = [ a: 123, b: 234 ]
-var obj = [MyObject a: 123, b: 234]
-

Lists. -#

Lists are a builtin type that holds an ordered collection of elements. Lists grow or shrink as you insert or remove elements. See type List.

-- Construct a new list.
-var list = [1, 2, 3]
-
--- The first element of the list starts at index 0.
-print list[0]    -- Prints '1'
-

Lists can be sliced with the range .. clause. The sliced list becomes a new list that you can modify without affecting the original list. The end index is non-inclusive.

var list = [ 1, 2, 3, 4, 5 ]
-list[0..0]    -- []          
-list[0..3]    -- [ 1, 2, 3 ] 
-list[3..]     -- [ 4, 5 ]    
-list[..3]     -- [ 1, 2, 3 ] 
-

The +.. invokes the slice operator with an end position that is an increment from the start: *Planned Feature

var list = [ 1, 2, 3, 4, 5 ]
-list[2+..2]   -- [ 3, 4 ]
-

List operations.

var list = [234]
-
--- Append a value.
-list.append 123
-
--- Inserting a value at an index.
-list.insert(1, 345)
-
--- Get the length.
-print list.len()  -- Prints '2'
-
--- Sort the list in place.
-list.sort((a, b) => a < b)
-
--- Iterating a list.
-for list -> it:
-    print it
-
--- Remove an element at a specific index.
-list.remove(1)
-

Tuples. -#

Incomplete: Tuples can only be created from @host funcs at the moment.

Maps. -#

Maps are a builtin type that store key value pairs in dictionaries. See type Map.

Create map. -#

Create a map using key value pairs inside a collection literal:

var map = [ a: 123, b: () => 5 ]
-

Maps entries can be listed in multiple lines:

var map = [
-    foo: 1,
-    bar: 2,
-]
-

Empty map. -#

The empty map is initialized using [:]:

var empty = [:]
-

Map indexing. -#

Get a value from the map using the index operator:

print map['a']
-

Maps can be accessed with the . dot operator as well:

print map.a
-

Map operations. -#

var map = [:]
-
--- Set a key value pair.
-map[123] = 234
-
--- Get the size of the map.
-print map.size()
-
--- Remove an entry by key.
-map.remove 123
-
--- Iterating a map.
-for map -> [val, key]:
-    print '$(key) -> $(val)'
-

Map block. -#

Entries can also follow a collection literal block. -This gives structure to the entries and has -the added benefit of allowing multi-line lambdas. -*Planned Feature

var colors = []:
-    red: 0xFF0000
-    green: 0x00FF00
-    blue: 0x0000FF
-    dump func (c):
-        print c.red
-        print c.green
-        print c.blue
-
-    -- Nested map.
-    darker []: 
-        red: 0xAA0000
-        green: 0x00AA00
-        blue: 0x0000AA
-

Objects. -#

Any value that isn’t a primitive is an object. You can declare your own object types using the type object declaration. -Object types are similar to structs and classes in other languages. -Unlike classes, there is no concept of inheritance at the language level.

Fields. -#

Fields must be declared at the top of the type object block using var or my:

type Node object:
-    var value int
-    var next  any
-

When fields are declared with my instead, they become dynamically typed.

Instantiation. -#

New object instances are created using a leading type name and the field values in a collection literal:

var node = [Node value: 123, next: none]
-print node.value       -- Prints "123"
-

Methods. -#

Methods allow invoking a function on an object instance using the . operator:

type Node object:
-    var value int
-    var next  any
-
-    func inc(n):
-        value += n
-
-    func incAndPrint():
-        self.inc(321)
-        print value
-
-var n = [Node value: 123, next: none]
-n.incAndPrint()         -- Prints "444"
-

Methods can also be declared outside of the type declaration. To distinguish a method from a type function, self must be provided as a parameter:

func Node.getNext(self):
-    return self.next
-

self variable. -#

Type members can be implicitly referenced inside the method. *Incomplete: Only the type's fields can be referenced this way.

To reference members explicitly inside a method, use the builtin self:

type Node object:
-    var value int
-    var next  any
-
-    func double():
-        return self.value * 2
-

Type functions. -#

Type functions are declared outside of the type block with an explicit namespace path:

type Node object:
-    var value int
-    var next  any
-
--- Declare namespace function inside `Node`.
-func Node.new():
-    return [Node value: 123, next: none]
-
-var n = Node.new()
-

Type variables. -#

Similarily, type variables are declared outside of the type block:

-- Declare inside the `Node` namespace.
-var Node.DefaultValue = 100
-
-print Node.DefaultValue    -- Prints "100"
-

Enums. -#

A new enum type can be declared with the type enum declaration. -An enum value can only be one of the unique symbols declared in the enum type. -By default, the symbols generate unique ids starting from 0.

type Fruit enum:
-    case apple
-    case orange
-    case banana
-    case kiwi
-
-var fruit = Fruit.kiwi
-print fruit       -- 'Fruit.kiwi'
-print int(fruit)  -- '3'
-

When the type of the value is known to be an enum, it can be assigned using a symbol literal.

var fruit = Fruit.kiwi
-fruit = .orange
-print(fruit == Fruit.orange)   -- 'true'
-

Symbols. -#

Symbol literals begin with ., followed by an identifier. They have their own global unique id.

var currency = .usd
-print(currency == .usd)   -- 'true'
-print int(currency)       -- '123' or some arbitrary id.
-
\ No newline at end of file diff --git a/docs/toc/embedding/index.html b/docs/toc/embedding/index.html deleted file mode 100644 index 056b7e85e..000000000 --- a/docs/toc/embedding/index.html +++ /dev/null @@ -1,177 +0,0 @@ -Embedding | Cyber Docs v0.3 - -
Embedding -

Embed API. -#

The Embed API allows embedding the Cyber compiler and VM as a library into applications. Cyber’s core types and the CLI app were built using the Embed API.

The API is defined in the C header file. -The examples shown below can be found in the repository under c-embedded. C is used as the host language, but it can be easily translated to C++ or any C-ABI compatible language.

Types from the Embed API begin with Cs, constants begin with CS, and functions begin with cs.

Getting started. -#

Create VM. -#

Most operations are tied to a VM handle. To create a new VM instance, call csCreate:

#include "cyber.h"
-
-int main() {
-    CsVM* vm = csCreate();
-    // ...
-    csDestroy(vm);
-    return 0;
-}
-

Override print. -#

The builtin print function does nothing by default, so it needs to be overrided to print to stdout for example:

void print(CsVM* vm, CsStr str) {
-    printf("My print: %.*s\n", (int)str.len, str.buf);
-}
-
-int main() {
-    // ...
-    csSetPrint(vm, print);
-    // ...
-}
-

Eval script. -#

csEval compiles and evaluates a script:

CsStr src = STR(
-    "var a = 1\n"
-    "print(a + 2)\n"
-);
-
-CsValue val;
-int res = csEval(vm, src, &val);
-if (res == CS_SUCCESS) {
-    printf("Success!\n");
-    csRelease(vm, val);
-} else {
-    const char* report = csNewLastErrorReport(vm);
-    printf("%s\n", report);
-    csFreeStrZ(report);
-}
-

If a value is returned from the main block of the script, it’s saved to the result value argument. -Memory is managed by ARC so a value that points to a heap object requires a csRelease when it’s no longer needed.

csEval returns a result code that indicates whether it was successful.

Module Loader. -#

A module loader describes how a module is loaded when an import statement is encountered during script execution. -Only one module loader can be active and is set using csSetModuleLoader:

bool modLoader(CsVM* vm, CsStr spec, CsModuleLoaderResult* out) {
-    if (strncmp("my_mod", spec.buf, spec.len) == 0) {
-        out->src =
-            "@host func add(a float, b float) float\n"
-            "@host var Root.MyConstant float\n"
-            "@host var Root.MyList     List\n"
-            "\n"
-            "@host\n"
-            "type MyCollection object:\n"
-            "    @host func asList() any"
-            "\n"
-            "@host func MyCollection.new(a, b) MyCollection\n";
-        out->funcLoader = funcLoader;
-        out->varLoader = varLoader;
-        out->typeLoader = typeLoader;
-        return true;
-    } else {
-        // Fallback to the default module loader to load `builtins`.
-        return csDefaultModuleLoader(vm, spec, out);
-    }
-}
-
-int main() {
-    //...
-    csSetModuleLoader(vm, modLoader);
-    //...
-}
-

The above example checks whether “my_mod” was imported and returns it’s source code. Additional loaders are returned to load the functions, variables, and types from the source code.

Default module loader. -#

Since only one module loader can be set to the VM instance, a custom loader is required to handle the “builtins” import which contains all of the core types and functions in Cyber. This can simply be delegated to csDefaultModuleLoader.

Function loader. -#

A function loader describes how to load a @host function when it’s encountered by the compiler. -The loader can bind functions and type methods:

struct { char* n; CsFuncFn fn; } funcs[] = {
-    {"add", add},
-    {"asList", myCollectionAsList},
-    {"MyCollection.new", myCollectionNew},
-};
-
-bool funcLoader(CsVM* vm, CsFuncInfo info, CsFuncResult* out) {
-    // Check that the name matches before setting the function pointer.
-    if (strncmp(funcs[info.idx].n, info.name.buf, info.name.len) == 0) {
-        out->ptr = funcs[info.idx].fn;
-        return true;
-    } else {
-        return false;
-    }
-}
-

This example uses the CsFuncInfo.idx of a @host function to index into an array and return a Host function pointer. The name is also compared to ensure it’s binding to the correct pointer.

This is an efficient way to map Cyber functions to host functions. A different implementation might use a hash table to map the name of the function to it’s pointer.

Variable loader. -#

A variable loader describes how to load a @host variable when it’s encountered by the compiler:

// C has limited static initializers (and objects require a vm instance) so initialize them in `main`.
-typedef struct { char* n; CsValue v; } NameValue;
-NameValue vars[2];
-
-bool varLoader(CsVM* vm, CsVarInfo info, CsValue* out) {
-    // Check that the name matches before setting the value.
-    if (strncmp(vars[info.idx].n, info.name.buf, info.name.len) == 0) {
-        // Objects are consumed by the module.
-        *out = vars[info.idx].v;
-        return true;
-    } else {
-        return false;
-    }
-}
-
-int main() {
-    // ...
-
-    // Initialize var array for loader.
-    vars[0] = (NameValue){"Root.MyConstant", csFloat(1.23)};
-    CsValue myInt = csInteger(123);
-    vars[1] = (NameValue){"Root.MyList", csNewList(vm, &myInt, 1)};
-
-    // ...
-}
-

This example uses the same technique as the function loader, but it can be much simpler. It doesn’t matter how the mapping is done as long as the variable loader returns a CsValue.

Type loader. -#

A type loader describes how to load a @host type when it’s encountered by the compiler:

CsTypeId myCollectionId;
-
-bool typeLoader(CsVM* vm, CsTypeInfo info, CsTypeResult* out) {
-    if (strncmp("MyCollection", info.name.buf, info.name.len) == 0) {
-        out->type = CS_TYPE_OBJECT;
-        out->data.object.outTypeId = &myCollectionId;
-        out->data.object.getChildren = myCollectionGetChildren;
-        out->data.object.finalizer = myCollectionFinalizer;
-        return true;
-    } else {
-        return false;
-    }
-}
-

When binding to the “MyCollection” type, it’s typeId is saved to outTypeId. This id is then used to create new instances of this type. See Host types.

Host functions. -#

A host function requires a specific function signature:

CsValue add(CsVM* vm, const CsValue* args, uint8_t nargs) {
-    double res = csAsFloat(args[0]) + csAsFloat(args[1]);
-    return csFloat(res);
-}
-

A host function should always return a CsValue. csNone() can be returned if the function does not intend to return any value.

Host types. -#

A host type are types that are opaque to Cyber scripts but still behave like an object. They can have type functions and methods.

Only the host application can directly create new instances of them, so usually a function is binded to expose a constructor to the user script:

// Binding a C struct with it's own children and finalizer.
-// This struct retains 2 VM values and has 2 arbitrary data values unrelated to the VM.
-typedef struct MyCollection {
-    CsValue val1;
-    CsValue val2;
-    int a;
-    double b;
-} MyCollection;
-
-// Implement the `new` function in MyCollection.
-CsValue myCollectionNew(CsVM* vm, const CsValue* args, uint8_t nargs) {
-    // Instantiate our object.
-    CsValue new = csNewHostObject(vm, myCollectionId, sizeof(MyCollection));
-    MyCollection* my = (MyCollection*)csAsHostObject(new);
-
-    // Assign the constructor args passed in and retain them since the new object now references them.
-    csRetain(vm, args[0]);
-    my->val1 = args[0];
-    csRetain(vm, args[1]);
-    my->val2 = args[1];
-
-    // Assign non VM values.
-    my->a = 123;
-    my->b = 9999.999;
-    return new;
-}
-

csNewHostObject takes the type id (returned from the Type loader) and size (in bytes) and returns a new heap object. Note that the size is allowed to vary. Different instances of the same type can occupy different amounts of memory.

getChildren -#

Since MyCollection contains CsValue children, the Type loader requires a getChildren callback so that memory management can reach them:

CsValueSlice myCollectionGetChildren(CsVM* vm, void* obj) {
-    MyCollection* my = (MyCollection*)obj;
-    return (CsValueSlice){ .ptr = &my->val1, .len = 2 };
-}
-

finalizer -#

A type finalizer is optional since the memory and children of an instance will be freed automatically by ARC. -However, it can be useful to perform additional cleanup tasks for instances that contain external resources.

void myCollectionFinalizer(CsVM* vm, void* obj) {
-    printf("MyCollection finalizer was called.\n");
-}
-
\ No newline at end of file diff --git a/docs/toc/errors/index.html b/docs/toc/errors/index.html deleted file mode 100644 index ea3056267..000000000 --- a/docs/toc/errors/index.html +++ /dev/null @@ -1,110 +0,0 @@ -Error Handling | Cyber Docs v0.3 - -
Error Handling -

Error Handling. -#

Cyber provides a throw/catch mechanism to handle expected errors. For unexpected errors, panics can be used as a fail-fast mechanism to abort the currently running fiber.

Error trait. -#

Only types that implement the Error trait can be thrown or attached to a panic. -Since the Error trait is empty, it’s simple to turn any type into a throwable type.

error value. -#

An error value contains a symbol and implements the Error trait. They can be created without a declaration using the error literal:

var err = error.Oops
-

Use sym() to obtain the underlying symbol:

print err.sym()   -- Prints ".Oops"
-

Since error is a primitive value, it can be compared using the == operator.

if err == error.Oops:
-    handleOops()
-
--- Alternatively.
-if err.sym() == .Oops:
-    handleOops()
-

Enum error. -#

By implementing the Error trait, an enum type can be throwable: *Planned Feature

type MyError enum:
-    with Error
-    boom
-    badArgument
-    nameTooLong
-
-var err = MyError.nameTooLong
-

Throwing errors. -#

Use the throw keyword to throw errors. -A thrown error continues to bubble up the call stack until it is caught by a try block or expression.

func fail():
-    throw error.Oops      -- Throws an error with the symbol `#Oops`
-
-func fail2():
-    throw 123             -- Panic. Can only throw an error
-                          -- that implement the `Error` trait.
-

throw can also be used as an expression.

func fail():
-    var a = false or throw error.False
-

Catching errors. -#

try block. -#

The try block catches thrown errors and resumes execution in a followup catch block:

try:
-    funcThatCanFail()
-catch err:
-    print err      -- 'error.Failed'
-

caught variable. -#

The contextual caught variable is used to reference the caught error: *Planned Feature

try:
-    funcThatCanFail()
-catch:
-    print caught   -- 'error.Failed'
-

catch matching. -#

An inner catch block contains a matching clause: *Planned Feature

try:
-    funcThatCanFail()
-catch error.BadDay:
-    eatSnack()
-catch:
-    print caught
-

Enum errors can be matched: *Planned Feature

try:
-    funcThatCanFail()
-catch MyError.Boom:
-    print 'Kaboom!'
-catch:
-    print caught
-

try expression. -#

The try expression either returns a non-error result or the default value from the catch clause:

var res = try funcThatCanFail() catch 123
-print res         -- '123'
-

Since errors bubble up automatically, any errors thrown from sub-expressions are also caught:

var res = try happyFunc(funcThatCanFail()) catch 123
-print res         -- '123'
-

Value or error. -#

When the catch clause is omitted, the try expression will return either the value or the error:

var res = try funcThatCanFail()
-if res == error.Failed:
-    print 'Result is an error.'
-

Semantic checks. -#

throws specifier. -#

The throws specifier indicates that a function contains a throwing expression that was not caught with try catch.

When a function does not have a return specifier, it’s implicitly given the throws specifier:

func foo():
-    throw error.Failure
-
-func bar() throws:
-    throw error.Failure
-
--- `foo` and `bar` both have the same return specifier.
-

Return types for typed functions are declared after throws using a comma separator:

func result(cond bool) throws, int:
-    if cond:
-        return 123
-    else:
-        throw error.Failure
-

Requiring throws. -#

A compile-time error is issued when a typed function without a throws specifier contains an uncaught throwing expression: *Planned Feature

func foo(a int) int:
-    if a == 10:
-        throw error.Failure -- CompileError. `foo` requires the `throws`
-    else:                   -- specifier or any throwing expression must
-        return a * 2        -- be caught with `try catch`.
-

Stack trace. -#

When an uncaught error bubbles up to the top, its stack trace from the throw callsite is dumped to the console. The builtin errorTrace() and errorReport() are used to obtain the stack trace info.

try:
-    funcThatCanFail()
-catch:
-    -- Prints the stack trace summary of the caught error.
-    print errorReport()
-
-    -- Provides structured info about the stack trace.
-    var info = errorTrace()
-    print info.frames.len()
-

Unexpected errors. -#

An unexpected error is an error that is not meant to be handled at runtime.

Panics. -#

The builtin panic is used as a fail-fast mechanism to quickly exit the current fiber with an error payload:

func kaboom():
-    panic(error.danger)
-
-kaboom()     -- Script ends and prints the stack trace.
-

Panics can not be caught using try catch. Once panic is invoked, the current fiber stops execution and begins to unwind its call stack. Once the error is propagated to the root, the fiber ends and transitions to a panic state. If the main fiber ends this way, the VM begins to shutdown. Otherwise, execution resumes on the next fiber which allows recovery from a panic.

\ No newline at end of file diff --git a/docs/toc/ffi/index.html b/docs/toc/ffi/index.html deleted file mode 100644 index ea312ddce..000000000 --- a/docs/toc/ffi/index.html +++ /dev/null @@ -1,62 +0,0 @@ -FFI | Cyber Docs v0.3 - -
FFI -

FFI. -#

Cyber supports binding to an existing C ABI compatible library at runtime. -This allows you to call into dynamic libraries created in C or other languages. -Cyber uses libtcc to JIT compile the bindings so function calls are fast. -The example shown below can be found in Examples.

FFI context. -#

An FFI context contains declarations that map C to Cyber. Afterwards, it allows you to bind to a dynamic library or create interoperable objects. To create a new FFI context:

import os
-
-var ffi = os.newFFI()
-

Declare functions. -#

Functions from a library are first declared using cfunc which accepts C types in the form of symbols. In a future update they will accept C syntax instead.

ffi.cfunc('add', [.int, .int], .int)
-

The first argument refers to the symbol’s name in the dynamic library. -The second argument contains the function’s parameter types and finally the last argument is the function’s return type.

The example above maps to this C function:

int add(int a, int b) {
-    return a + b;
-}
-

Bind library. -#

bindLib accepts the path to the library and returns a object which can be used to invoke the functions declared from cfunc:

my lib = ffi.bindLib('./mylib.so')
-lib.add(123, 321)
-

Note that my is used to allow lib to be used dynamically since the type is unknown at compile-time.

Search path. -#

If the path argument to bindLib is just a filename, the search steps for the library is specific to the operating system. Provide an absolute (eg. ‘/foo/mylib.so’) or relative (eg. ‘./mylib.so’) path to load from a direct location instead. When the path argument is none, it loads the currently running executable as a library allowing you to bind exported functions from the Cyber CLI or your own application/runtime.

Configuration. -#

By default bindLib returns an anonymous object with the binded C-functions as methods. This is convenient for invoking functions using the method call syntax. If a config is passed into bindLib as the second argument, genMap: true makes bindLib return a map instead with the binded C-functions as Cyber functions.

Finalizer. -#

The resulting object of bindLib holds a reference to an internal TCCState which owns the loaded JIT code. -Once the object is released by ARC, the TCCState is also released which removes the JIT code from memory.

Mappings. -#

When using cfunc or cbind declarations, symbols are used to represent default type mappings from Cyber to C and back:

Incomplete: This is not the final API for dynamically loading and interfacing with C libraries. The plan is to parse a subset of C headers to bind to Cyber types and functions.

BindingCyberCDetails
.boolboolbool
.charintint8_t, signed char
.ucharintuint8_t, unsigned char
.shortintint16_t, short
.ushortintuint16_t, unsigned short
.intintint32_t, int
.uintintuint32_t, unsigned int
.longintint64_t, long long
.ulongintuint64_t, unsigned long long
.usizeintsize_t, uintptr_t
.floatfloatfloat
.doublefloatdouble
.charPtrpointerchar*Use os.cstr() and pointer.fromCstr() to convert between a Cyber string and a null terminated C string.
.voidPtrpointervoid*
type {S} objecttype {S} objectstructThe mapping from a Cyber object type S and the C-struct can be declared with cbind.

Bind to Cyber type. -#

cbind is used to bind a C struct to a Cyber object type. Once declared, the Cyber type can be used as a binding type in function declarations:

import os
-
-type MyObject object:
-    var a float
-    var b pointer
-    var c bool
-
-ffi.cbind(MyObject, [.float, .voidPtr, .bool])
-ffi.cfunc('foo', [MyObject], MyObject)
-my lib = ffi.bindLib('./mylib.so')
-
-var res = lib.foo([MyObject a: 123.0, b: os.cstr('foo'), c: true])
-

The example above maps to these C declarations in mylib.so:

typedef struct MyObject {
-    double a;
-    char* b;
-    bool c;
-} MyObject;
-
-MyObject foo(MyObject o) {
-    // Do something.
-}
-

cbind also generates ptrTo[Type] as a helper function to dereference an opaque ptr to a new Cyber object:

ffi.cfunc('foo', [MyObject], .voidPtr)
-my lib = ffi.bindLib('./mylib.so')
-
-var ptr = lib.foo([MyObject a: 123, b: os.cstr('foo'), c: true])
-var res = lib.ptrToMyObject(ptr)
-

Pointers. -#

A pointer is used to read or write to an exact memory address. This is typically used for FFI to manually map Cyber types to C, and back. See type pointer.

A new pointer can be created with the builtin pointer.

var ptr = pointer(0xDEADBEEF)
-print ptr.value()     --'3735928559'
-

cbindgen.cy -#

cbindgen.cy is a Cyber script that automatically generates bindings given a C header file. Some example bindings that were generated include: Raylib and LLVM.

\ No newline at end of file diff --git a/docs/toc/functions/index.html b/docs/toc/functions/index.html deleted file mode 100644 index 19194393c..000000000 --- a/docs/toc/functions/index.html +++ /dev/null @@ -1,111 +0,0 @@ -Functions | Cyber Docs v0.3 - -
Functions -

Functions. -#

In Cyber, there are first-class functions (or function values) and static functions.

Static Functions. -#

Static functions are not initially values themselves. They allow function calls to be optimal since they don’t need to resolve a dynamic value.

Static functions are declared with the func keyword and must have a name.

import math
-
-func dist(x0 float, y0 float, x1 float, y1 float) float:
-    var dx = x0-x1
-    var dy = y0-y1
-    return math.sqrt(dx^2 + dy^2)
-

Calling static functions is straightforward. You can also reassign or pass them around as function values.

print dist(0, 0, 10, 20)
-
--- Assigning to a local variable.
-var bar = dist
-
--- Passing `dist` as an argument.
-func squareDist(dist, size):
-    return dist(0.0, 0.0, size, size)
-    
-print squareDist(dist, 30.0)
-

Functions can only return one value. However, the value can be destructured: *Planned Feature

import {cos, sin} 'math'
-
-func compute(rad):
-    return [ cos(rad), sin(rad) ]
-
-var [ x, y ] = compute(pi)
-

Function Overloading. -#

Functions can be overloaded by the number of parameters in its signature. Typed functions are further overloaded by their type signatures.

func foo():
-    return 2 + 2
-
-func foo(n):
-    return 10 + n
-
-func foo(n, m):
-    return n * m
-
-print foo()         -- "4"
-print foo(2)        -- "12"
-print foo(20, 5)    -- "100"
-

Lambdas. -#

Lambdas or function values can be assigned to variables or passed as arguments into other constructs.

When a lambda only returns an expression, it can be declared with a simplified syntax.

-- Passing simple lambda as an argument.
-foo(word => toUpper(word))
-
--- A simple lambda with multiple arguments.
-foo((word, prefix) => prefix + toUpper(word))
-
--- Assigning a simple lambda.
-canvas.onUpdate = delta_ms => print delta_ms
-

Lambdas that need a block of statements can be declared with the func keyword without a name.

-- Assigning lambda block to a variable.
-var add = func (a, b):
-    return a + b
-
--- Passing a lambda block as an argument.
-canvas.onUpdate():
-    ..func (delta_ms):
-        print delta_ms
-

Passing a lambda block as a call argument is only possible in a call block. *Planned Feature See Function Calls.

Closures. -#

Lambdas can capture local variables from parent blocks. This example shows the lambda f capturing a from the main scope: *Incomplete, only variables one parent block away can be captured.

var a = 1
-var f = func():
-    return a + 2
-print f()         -- "3"
-

The following lambda expression captures a from the function add:

func add():
-    var a = 123
-    return b => a + b
-var addTo = add()
-print addTo(10)   -- "133"
-

Like static variables, static functions can not reference local variables outside of their scope:

var a = 1
-func foo():
-    print a       -- CompileError: Undeclared variable `a`.
-

Named Parameters. -#

Planned Feature

Optional Parameters. -#

Planned Feature

Variadic Parameters. -#

Planned Feature

Function Calls. -#

The straightforward way to call a function is to use parentheses.

var d = dist(100, 100, 200, 200)
-

You can call functions with named parameters.

Planned Feature

var d = dist(x0: 10, x1: 20, y0: 30, y1: 40)
-

Shorthand syntax. -#

The shorthand method for calling functions omits parentheses and commas. This only works for functions that accept parameters:

Incomplete: Only the most trivial cases work with the shorthand method. The case with operators being separated by spaces might not end up being implemented.

var d = dist 100 100 200 200  -- Calls the function `dist`.
-
-func random():       -- Function with no parameters.
-    return 4
-
-var r = random       -- Returns the function itself as a value.
-                     -- Does not call the function `random`.
-r = random()         -- Calls the function `random`.
-

The top level arguments for the shorthand convention must be separated by whitespace. A string can contain whitespace since it’s surrounded by delimiters.

var a = myFunc 'cyber script'
-

The following has a binary expression with spaces inbetween which is not allowed. Removing that whitespace fixes the call expression.

var a = myFunc 1 + 2     -- Not allowed.
-a = myFunc 1+2       -- Correct.
-

Wrapping arguments in parentheses allows you to keep the whitespace in the sub-expression.

-- This calls the function `myFunc` with 2 arguments.
-var a = myFunc 'hello' (1 + 2 * 3)
-
--- Nested function call using the shorthand convention.
-a = myFunc 'hello' (otherFunc 1+2 'world')
-

Call block syntax. -#

The call expression block continues to add arguments from the block’s body. If arguments are omitted from the initial call expression they can be added inside using the .. syntax. Arguments mapped to named parameters have a key value syntax separated by a :. All other arguments are added into a list and passed as the last argument.

Planned Feature

foo(123):
-    ..func ():
-        return 123
-    param3: 123
-    234
-    bar()
-    'hello'
-

In the example above, the function foo is called with 4 arguments. The first argument 123 is included in the starting call expression. The second argument is a function value inside the call expression block. The third argument is mapped to the param param3. Finally, the fourth argument is a list that contains 234, bar(), and 'hello'.

\ No newline at end of file diff --git a/docs/toc/index.html b/docs/toc/index.html deleted file mode 100644 index ccc1cba0d..000000000 --- a/docs/toc/index.html +++ /dev/null @@ -1,7 +0,0 @@ -Table of Contents | Cyber Docs v0.3 - -
Table of Contents -
\ No newline at end of file diff --git a/docs/toc/index.xml b/docs/toc/index.xml deleted file mode 100644 index 2c1175275..000000000 --- a/docs/toc/index.xml +++ /dev/null @@ -1,28 +0,0 @@ -Table of Contents on Cyber Docs v0.3https://fubark.github.io/cyber/docs/toc/Recent content in Table of Contents on Cyber Docs v0.3Hugo -- gohugo.ioen-usSyntaxhttps://fubark.github.io/cyber/docs/toc/syntax/Mon, 01 Jan 0001 00:00:00 +0000https://fubark.github.io/cyber/docs/toc/syntax/Syntax # Cyber&rsquo;s syntax is concise and easy to read. -Statements. # A statement ends with the new line. --- An assignment statement. var a = 123 Blocks. # Some statements can start a new block with a colon. The first statement in a new block must be indented further. Spaces or tabs can be used for indentation but not both. --- This `if` statement begins a new block. if true: var a = 234 Subsequent statements in the block must follow the same indentation.Data Typeshttps://fubark.github.io/cyber/docs/toc/data-types/Mon, 01 Jan 0001 00:00:00 +0000https://fubark.github.io/cyber/docs/toc/data-types/Data Types. # In Cyber, there are primitive types and object types. Primitives are copied around by value and don&rsquo;t need additional heap memory or reference counts. -Primitives include Booleans, Floats, Integers, Enums, Symbols, Error Symbols, and the none value. -Object types include Lists, Tuples, Maps, Strings, Arrays, User Objects, Lambdas, Fibers, Enums with payloads, Pointers, and several internal object types. -None. # The none value represents an empty value.Control Flowhttps://fubark.github.io/cyber/docs/toc/control-flow/Mon, 01 Jan 0001 00:00:00 +0000https://fubark.github.io/cyber/docs/toc/control-flow/Control Flow. # Cyber provides the common constructs to branch and enter loops. -Branching. # if statement. # Use if and else statements to branch the execution of your code depending on conditions. The else clause can contain a condition which is only evaluated if the previous if or conditional else clause was false. -var a = 10 if a == 10: print &#39;a is 10&#39; else a == 20: print &#39;a is 20&#39; else: print &#39;neither 10 nor 20&#39; Conditional expression.Functionshttps://fubark.github.io/cyber/docs/toc/functions/Mon, 01 Jan 0001 00:00:00 +0000https://fubark.github.io/cyber/docs/toc/functions/Functions. # In Cyber, there are first-class functions (or function values) and static functions. -Static Functions. # Static functions are not initially values themselves. They allow function calls to be optimal since they don&rsquo;t need to resolve a dynamic value. -Static functions are declared with the func keyword and must have a name. -import math func dist(x0 float, y0 float, x1 float, y1 float) float: var dx = x0-x1 var dy = y0-y1 return math.Moduleshttps://fubark.github.io/cyber/docs/toc/modules/Mon, 01 Jan 0001 00:00:00 +0000https://fubark.github.io/cyber/docs/toc/modules/Modules. # Modules have their own namespace and contain accessible static symbols. By default, importing another Cyber script returns a module with its declared symbols. -Importing. # Import declarations create a local alias to the module referenced by the import specifier. The Cyber CLI comes with some builtin modules like math and test. If the specifier does not refer to a builtin module, it looks for a Cyber script file relative to the current script&rsquo;s directory.FFIhttps://fubark.github.io/cyber/docs/toc/ffi/Mon, 01 Jan 0001 00:00:00 +0000https://fubark.github.io/cyber/docs/toc/ffi/FFI. # Cyber supports binding to an existing C ABI compatible library at runtime. This allows you to call into dynamic libraries created in C or other languages. Cyber uses libtcc to JIT compile the bindings so function calls are fast. The example shown below can be found in Examples. -FFI context. # An FFI context contains declarations that map C to Cyber. Afterwards, it allows you to bind to a dynamic library or create interoperable objects.Error Handlinghttps://fubark.github.io/cyber/docs/toc/errors/Mon, 01 Jan 0001 00:00:00 +0000https://fubark.github.io/cyber/docs/toc/errors/Error Handling. # Cyber provides a throw/catch mechanism to handle expected errors. For unexpected errors, panics can be used as a fail-fast mechanism to abort the currently running fiber. -Error trait. # Only types that implement the Error trait can be thrown or attached to a panic. Since the Error trait is empty, it&rsquo;s simple to turn any type into a throwable type. -error value. # An error value contains a symbol and implements the Error trait.Concurrencyhttps://fubark.github.io/cyber/docs/toc/concurrency/Mon, 01 Jan 0001 00:00:00 +0000https://fubark.github.io/cyber/docs/toc/concurrency/Concurrency. # Cyber supports fibers as a concurrency mechanism. There are plans to support preemptive concurrency with async/await as well as multithreading. -Fibers. # A fiber represents a separate execution context as a first-class value. It contains it&rsquo;s own call stack and program counter. Fibers by themselves do not enable parallelism. -Creating fibers. # The coinit keyword creates and returns a new fiber using a function as the entry point:Type Systemhttps://fubark.github.io/cyber/docs/toc/type-system/Mon, 01 Jan 0001 00:00:00 +0000https://fubark.github.io/cyber/docs/toc/type-system/Type System. # Cyber supports the use of both dynamically and statically typed code. -Dynamic typing. # Dynamic typing can reduce the amount of friction when writing code, but it can also result in more runtime errors. -my declaration. # Variables declared with my are assigned the dynamic type: -my a = 123 dynamic vs any # dynamic values can be freely used and copied without any compile errors (if there is a chance it can succeed at runtime, see Recent type inference):Metaprogramminghttps://fubark.github.io/cyber/docs/toc/metaprogramming/Mon, 01 Jan 0001 00:00:00 +0000https://fubark.github.io/cyber/docs/toc/metaprogramming/Metaprogramming. # Operator overloading. # All operators are implemented as object methods. -Incomplete: Not all operators have transitioned to the method paradigm. -Normally this would impact performance, but Cyber generates specialized bytecode for builtin types like int and float. The VM performs inline caching at runtime to eliminate the overhead of evaluating on dynamic operands. -To overload an operator for an object type, declare $prefix, $infix, $postfix methods. See the available builtin operators.Embeddinghttps://fubark.github.io/cyber/docs/toc/embedding/Mon, 01 Jan 0001 00:00:00 +0000https://fubark.github.io/cyber/docs/toc/embedding/Embed API. # The Embed API allows embedding the Cyber compiler and VM as a library into applications. Cyber&rsquo;s core types and the CLI app were built using the Embed API. -The API is defined in the C header file. The examples shown below can be found in the repository under c-embedded. C is used as the host language, but it can be easily translated to C++ or any C-ABI compatible language.Memoryhttps://fubark.github.io/cyber/docs/toc/memory/Mon, 01 Jan 0001 00:00:00 +0000https://fubark.github.io/cyber/docs/toc/memory/Memory. # Cyber provides memory safety by default. -ARC. # Cyber uses ARC or automatic reference counting to manage memory. ARC is deterministic and has less overhead compared to a tracing garbage collector. Reference counting distributes memory management, which reduces GC pauses and makes ARC suitable for realtime applications. One common issue in ARC implementations is reference cycles which Cyber addresses with Weak References and it&rsquo;s very own Cycle Detection.AOT/JIThttps://fubark.github.io/cyber/docs/toc/aot-jit/Mon, 01 Jan 0001 00:00:00 +0000https://fubark.github.io/cyber/docs/toc/aot-jit/JIT # Cyber&rsquo;s just-in-time compiler is incomplete and unstable. To run your script with JIT enabled: -cyber -jit &lt;script&gt; The JIT compiler is just as fast as the bytecode generation so when it&rsquo;s enabled, the entire script is compiled from the start. -AOT # Work on the ahead-of-time compiler has not begun. \ No newline at end of file diff --git a/docs/toc/memory/index.html b/docs/toc/memory/index.html deleted file mode 100644 index 7939911e2..000000000 --- a/docs/toc/memory/index.html +++ /dev/null @@ -1,36 +0,0 @@ -Memory | Cyber Docs v0.3 - -
Memory -

Memory. -#

Cyber provides memory safety by default.

ARC. -#

Cyber uses ARC or automatic reference counting to manage memory. -ARC is deterministic and has less overhead compared to a tracing garbage collector. Reference counting distributes memory management, which reduces GC pauses and makes ARC suitable for realtime applications. One common issue in ARC implementations is reference cycles which Cyber addresses with Weak References and it’s very own Cycle Detection.

Reference Counting. -#

In Cyber, there are primitive and object values. Primitives don’t need any memory management, since they are copied by value and no heap allocation is required (with the exception of primitives being captured by a closure).

Objects are managed by ARC. Each object has its own reference counter. Upon creating a new object, it receives a reference count of 1. When the object is copied, it’s retained and the reference count increments by 1. When an object value is removed from it’s parent or is no longer reachable in the current stack frame, it is released and the reference count decrements by 1.

Once the reference count reaches 0 the object begins its destruction procedure. First, child references are released thereby decrementing their reference counts by 1. If the object is a host object, it will invoke its finalizer function. Afterwards, the object is freed from memory.

Optimizations. -#

The compiler can reduce the number of retain/release ops since it can infer value types even though they are dynamically typed to the user. Arguments passed to functions are only retained depending on the analysis from the callsite.

Closures. -#

When primitive variables are captured by a closure, they are boxed and allocated on the heap. This means they are managed by ARC and cleaned up when there are no more references to them.

Fibers. -#

Fibers are freed by ARC just like any other object. Once there are no references to the fiber, it begins to release it’s child references by unwinding it’s call stack.

Heap. -#

Many object types in Cyber are small enough to be at or under 40 bytes. To take advantage of this, Cyber can reserve object pools to quickly allocate and free these small objects with very little bookkeeping. Bigger objects are allocated and managed by mimalloc which has proven to be a fast and reliable general-purpose heap allocator.

Weak References. -#

Planned Feature

Cycle Detection. -#

The cycle detector is also considered a GC and frees abandoned objects managed by ARC. Although weak references can remove cycles altogether, Cyber does not force you to use them and provides a manual GC as a one-time catch all solution.

Incomplete Feature: Only the main fiber stack is cleaned up at the moment.

To invoke the GC, call the builtin function: performGC.

func foo():
-    -- Create a reference cycle.
-    var a = []
-    var b = []
-    a.append(b)
-    b.append(a)
-
-    -- Cycle still alive in the current stack so no cleanup is done.
-    var res = performGC()
-    print res['numCycFreed']    -- Output: 0
-    print res['numObjFreed']    -- Output: 0
-
-foo()
--- `a` and `b` are no longer reachable, so the GC does work.
-var res = performGC()
-print res['numCycFreed']      -- Output: 2
-print res['numObjFreed']      -- Output: 2
-
\ No newline at end of file diff --git a/docs/toc/metaprogramming/index.html b/docs/toc/metaprogramming/index.html deleted file mode 100644 index c5c103732..000000000 --- a/docs/toc/metaprogramming/index.html +++ /dev/null @@ -1,76 +0,0 @@ -Metaprogramming | Cyber Docs v0.3 - -
Metaprogramming -

Metaprogramming. -#

Operator overloading. -#

All operators are implemented as object methods.

Incomplete: Not all operators have transitioned to the method paradigm.

Normally this would impact performance, but Cyber generates specialized bytecode for builtin types like int and float. The VM performs inline caching at runtime to eliminate the overhead of evaluating on dynamic operands.

To overload an operator for an object type, declare $prefix, $infix, $postfix methods. See the available builtin operators. Since operator names aren’t allowed as standard identifiers, they are contained in a string literal.

type Vec2 object:
-    var x float
-    var y float
-
-    func '$infix+'(o Vec2) Vec2:
-        return [Vec2
-            x: x + o.x,
-            y: y + o.y,
-        ]
-
-    func '$prefix-'() Vec2:
-        return [Vec2 x: -x, y: -y]
-
-var a = [Vec2 x: 1, y: 2]
-var b = a + [Vec2 x: 3, y: 4]
-var c = -a
-

Some special operators have their own name. This example overloads the index operator and the set index operator:

type MyCollection object:
-    var arr List
-
-    func '$index'(idx):
-        return arr[idx * 2]
-
-    func '$setIndex'(idx, val):
-        arr[idx * 2] = val 
-
-var a = [MyCollection arr: [1, 2, 3, 4]]
-print a[1]        -- Prints `3`
-

Builtin operators. -#

A list of all supported operators:

OperatorName
Bitwise not$prefix~
Minus$prefix-
Greater$infix>
Greater equal$infix>=
Less$infix<
Less equal$infix<=
Add$infix+
Subtract$infix-
Multiply$infix*
Divide$infix/
Modulus$infix%
Power$infix^
Bitwise and$infix&
Bitwise or$infix|
Bitwise xor$infix||
Bitwise left shift$infix<<
Bitwise right shift$infix>>
Index$index
Set index$setIndex
Slice$slice

Custom operators. -#

Planned Feature

Magic functions. -#

Call module. -#

Declare a $call function to allow invoking a module as a function.

Incomplete: Although $call function is supported in the VM and builtin modules use it, it is not currently enabled for user modules.

-- Object types are also modules.
-type Vec2 object:
-    var x float
-    var y float
-
-func Vec2.'$call'(x float, y float) Vec2:
-    return [Vec2 x: x, y: y]
-
-var v = Vec2(1, 2)
-

Getter/Setter. -#

Planned Feature

Missing method. -#

Declare a $missing method as a fallback when a method was not found in an instance.

Planned Feature

type A object:
-
-    func '$missing'(args...):
-        return args.len
-
-var a = [A:]
-print a.foo()      -- Output: '0'
-print a.bar(1, 2)  -- Output: '2'
-

Reflection. -#

A metatype object references an internal type. Use the typeof builtin to get the metatype of a value.

var val = 123
-print typeof(val)   -- 'type: float'
-
--- Referencing a type as a value also returns its `metatype`.
-print bool          -- 'type: bool'
-

Annotations. -#

Annotations are used to attach modifiers to declarative statements. The @host annotation is used for embedding to bind a host function to a Cyber function:

@host func compute() float
-

Custom annotations.

Planned Feature

Runtime eval. -#

Planned Feature

Generics. -#

Planned Feature

Compile-time. -#

Planned Feature

\ No newline at end of file diff --git a/docs/toc/modules/index.html b/docs/toc/modules/index.html deleted file mode 100644 index cd1ae9003..000000000 --- a/docs/toc/modules/index.html +++ /dev/null @@ -1,115 +0,0 @@ -Modules | Cyber Docs v0.3 - -
Modules -

Modules. -#

Modules have their own namespace and contain accessible static symbols. By default, importing another Cyber script returns a module with its declared symbols.

Importing. -#

Import declarations create a local alias to the module referenced by the import specifier. The Cyber CLI comes with some builtin modules like math and test. If the specifier does not refer to a builtin module, it looks for a Cyber script file relative to the current script’s directory. An embedder can integrate their own module loader and resolver.

import test
-test.eq(123, 123)
-
--- Imports are static declarations so they can be anywhere in the script.
-import math
-print math.cos(0)
-

When the imported alias needs to be renamed, the import specifier comes after the alias name and must be a string literal.

import m 'math'
-print m.random()
-
--- Loading a Cyber module from the local directory.
-import foo 'bar.cy'
-print foo.myFunc()
-print foo.myVar
-

A Cyber script that is imported doesn’t evaluate its main block. Only static declarations are effectively loaded. If there is code in the main block, it will skip evaluation. In the following, only the print statement in the main.cy is evaluated.

-- main.cy
-import a 'foo.cy'
-print a.foo
-
--- foo.cy
-import 'bar.cy'
-var Root.foo = 123
-print foo         -- Statement is ignored.
-
--- bar.cy
-var Root.bar = 321
-print bar         -- Statement is ignored.
-

You can have circular imports in Cyber. In the following example, main.cy and foo.cy import each other without any problems.

-- main.cy
-import foo 'foo.cy'
-
-func printB():
-    foo.printC()
-
-foo.printA()
-
--- foo.cy
-import main 'main.cy'
-
-func printA():
-    main.printB()
-
-func printC():
-    print 'done'
-

Static variable declarations from imports can have circular references. Read more about this in Static Variables.

Modules can also be destructured using the following syntax:

Planned Feature

import { cos, pi } 'math'
-print cos(pi)
-

Exporting. -#

All static declarations are exported when the script’s module is loaded.

func foo():         -- Exported static function.
-    print 123
-
-var Root.bar = 234  -- Exported static variable.
-
-type Thing object:  -- Exported type.
-    var a float
-

Module URI. -#

To get the absolute path of the current module, reference the compile-time variable ModUri. -This can be used with os.dirName to get the current module directory.

print #ModUri              -- Prints '/some/path/foo.cy'
-
-import os
-print os.dirName(#ModUri)  -- Prints '/some/path'
-

Visibility. -#

The annotation @hide provides a hint to editors that a static symbol should not appear in the auto-complete. Despite this, the symbol is still reachable.

Builtin Modules. -#

Builtin modules are the bare minimum that comes with Cyber. The embeddable library contains these modules and nothing more. They include:

  • builtins: Cyber related functions and commonly used utilities.
  • math: Math constants and functions.

builtins. -#

The builtins module contains functions related to Cyber and common utilities. It is automatically imported into each script’s namespace.

Sample usage:

-- `print` and `typeof` are available without imports.
-print 'hello'
-print typeof('my str').id()
-

func copy(val any) any
Copies a primitive value or creates a shallow copy of an object value.
func dump(val any) none
Prints the result of toCyon on a value.
func errorReport() string
func getObjectRc(val any) int
Returns the current reference count of an object.
func is(a any, b any) bool
Returns whether two values refer to the same instance.
func isAlpha(val int) bool
Returns whether a rune is an alphabetic letter.
func isDigit(val int) bool
Returns whether a rune is a digit.
func must(val any) any
If val is an error, panic(val) is invoked. Otherwise, val is returned.
func panic(err any) none
Stop execution in the current fiber and starts unwinding the call stack. See Unexpected Errors.
func parseCyber(src string) Map
Parses Cyber source string into structured map object. Currently, only metadata about static declarations is made available but this will be extended to include an AST.
func parseCyon(src string) any
Parses a CYON string into a value.
func performGC() Map
Runs the garbage collector once to detect reference cycles and abandoned objects. Returns the statistics of the run in a map value.
func print(str any) none
Prints a value. The host determines how it is printed.
func runestr(val int) string
Converts a rune to a string.
func toCyon(val any) string
Encodes a value to CYON string.
func typeof(val any) metatype
Returns the value’s type as a metatype object.
func typesym(val any) symbol
Returns the value’s type as one of the predefined symbols: .float, .int, .bool, .object, .list, .map, .string, .array, .function, .fiber, .pointer, .symbol, .metatype, .none, .error

type bool -#

func bool.'$call'(val any) bool
Converts a value to either true or false.

type error -#

func sym() symbol
Return the underlying symbol.
func error.'$call'(val any) error
Create an error from an enum or symbol.

type int -#

func $prefix~() int
func $prefix-() int
func $infix<(o any) bool
func $infix<=(o any) bool
func $infix>(o any) bool
func $infix>=(o any) bool
func $infix+(o any) int
func $infix-(o any) int
func $infix*(o any) int
func $infix/(o any) int
func $infix%(o any) int
func $infix^(o any) int
func $infix&(o any) int
func $infix|(o any) int
func $infix||(o any) int
func $infix<<(o any) int
func $infix>>(o any) int
func fmt(kind symbol) string
Formats the integer using a kind specifier which can be binary .b, octal .o, decimal .d, hexadecimal .x, ASCII .c.
func fmt(kind symbol, opts Map) string
opts.pad provides the ASCII rune that is used for padding with a string length of opts.width.
func int.'$call'(val any) int
Converts a value to an 48-bit integer.

type float -#

func $prefix-() float
func $infix<(o any) bool
func $infix<=(o any) bool
func $infix>(o any) bool
func $infix>=(o any) bool
func $infix+(o any) float
func $infix-(o any) float
func $infix*(o any) float
func $infix/(o any) float
func $infix%(o any) float
func $infix^(o any) float
func float.'$call'(val any) float
Converts the value to a float. Panics if type conversion fails.

type List -#

func $index(idx any) any
func $setIndex(idx any, val any) none
func $slice(start any, end any) List
func append(val any) none
Appends a value to the end of the list.
func concat(list List) none
Concats the elements of another list to the end of this list.
func insert(idx int, val any) none
Inserts a value at index idx.
func iterator() ListIterator
Returns a new iterator over the list elements.
func join(sep string) string
Returns a new string that joins the elements with separator.
func len() int
Returns the number of elements in the list.
func remove(idx int) none
Removes an element at index idx.
func resize(size int) none
Resizes the list to len elements. If the new size is bigger, none values are appended to the list. If the new size is smaller, elements at the end of the list are removed.
func slice(start any, end any) List
func List.fill(val any, n int) List
Creates a list with initial capacity of n and values set to val. If the value is an object, it is shallow copied n times.

type ListIterator -#

func next() any

type tuple -#

func $index(idx int) any

type Map -#

func $index(key any) any
func $setIndex(key any, val any) none
func remove(key any) none
Removes the element with the given key key.
func size() int
Returns the number of key-value pairs in the map.
func iterator() MapIterator
Returns a new iterator over the map elements.

type MapIterator -#

func next() any

type string -#

func $infix+(o any) string
func concat(o string) string
Returns a new string that concats this string and str.
func endsWith(suffix string) bool
Returns whether the string ends with suffix.
func find(needle string) any
Returns the first index of substring needle in the string or none if not found.
func findAnyRune(runes string) any
Returns the first index of any UTF-8 rune in runes or none if not found.
func findRune(rune int) int
Returns the first index of UTF-8 rune needle in the string or none if not found.
func insert(idx int, str string) string
Returns a new string with str inserted at index idx.
func isAscii() bool
Returns whether the string contains all ASCII runes.
func len() int
Returns the number of UTF-8 runes in the string.
func less(other string) bool
Returns whether this string is lexicographically before other.
func lower() string
Returns this string in lowercase.
func replace(needle string, replacement string) string
Returns a new string with all occurrences of needle replaced with replacement.
func repeat(n int) string
Returns a new string with this string repeated n times.
func runeAt(n int) int
Returns the UTF-8 rune at index idx.
func slice(start any, end any) string
Returns a slice into this string from start to end (exclusive) indexes. This is equivalent to using the slice index operator [start..end].
func $slice(start any, end any) string
func sliceAt(idx int) string
Returns the UTF-8 rune at index idx as a single rune string.
func $index(idx int) string
func split(sep string) List
Returns a list of UTF-8 strings split at occurrences of sep.
func startsWith(prefix string) bool
Returns whether the string starts with prefix.
func trim(mode symbol, delims string) string
Returns the string with ends trimmed from runes in delims. mode can be .left, .right, or .ends.
func upper() string
Returns this string in uppercase.
func string.'$call'(val any) string
Converts a value to a string.

type array -#

func $infix+(o any) array
func concat(other array) array
Returns a new array that concats this array and other.
func decode() string
Calls decode(.utf8)
func decode(encoding symbol) string
Decodes the array based on an encoding. Supported encodings: .utf8. Returns the decoded string or throws error.Decode.
func endsWith(suffix array) bool
Returns whether the array ends with suffix.
func find(needle array) any
Returns the first index of needle in the array or none if not found.
func findAnyByte(bytes array) any
Returns the first index of any bytes in arrays or none if not found.
func findByte(byte int) any
Returns the first index of byte in the array or none if not found.
func fmt(kind symbol) string
Formats each byte in the array using a kind specifier which can be binary .b, octal .o, decimal .d, hexadecimal .x, ASCII .c. Each byte is zero padded.
func getByte(idx int) int
Returns the byte value (0-255) at the given index idx.
func getInt(idx int, endian symbol) int
Returns the int value of the 6 bytes starting from idx with the given endianness (.little or .big).
func getInt32(idx int, endian symbol) int
Returns the int value of the 4 bytes starting from idx with the given endianness (.little or .big).
func insert(idx int, arr array) array
Returns a new array with arr inserted at index idx.
func insertByte(idx int, byte int) array
Returns a new array with byte inserted at index idx.
func len() int
Returns the number of bytes in the array.
func repeat(n int) array
Returns a new array with this array repeated n times.
func replace(needle array, replacement array) array
Returns a new array with all occurrences of needle replaced with replacement.
func slice(start any, end any) array
Returns a slice into this array from start to end (exclusive) indexes. This is equivalent to using the slice index operator [start..end].
func $slice(start any, end any) array
func $index(idx int) int
func split(sep array) List
Returns a list of arrays split at occurrences of sep.
func startsWith(prefix array) bool
Returns whether the array starts with prefix.
func trim(mode symbol, delims array) array
Returns the array with ends trimmed from runes in delims. mode can be .left, .right, or .ends.
func array.'$call'(val any) array
Converts a string to an byte array.

type arrayIterator -#

type pointer -#

func addr() int
Returns the memory address as an int. The value may be negative since it’s bitcasted from an unsigned 48-bit integer but it retains the original pointer bits.
func asObject() any
Unsafe. Casts the pointer to a Cyber object. The object is retained before it’s returned.
func fromCstr(offset int) array
Unsafe. Returns an array from a null terminated C string.
func get(offset int, ctype symbol) any
Unsafe. Dereferences the pointer at a byte offset and returns the C value converted to Cyber.
func set(offset int, val any) none
Unsafe. Converts the value to a compatible C value and writes it to a byte offset from this pointer.
func toArray(offset int, len int) array
Unsafe. Returns an array with a copy of the byte data starting from an offset to the specified length.
func pointer.'$call'(val any) pointer
Converts a int to a pointer value, or casts to a pointer. This is usually used with FFI.

type Fiber -#

func status() symbol

type metatype -#

func id() int

math. -#

The math module contains commonly used math constants and functions.

Sample usage:

import math
-
-var r = 10.0
-print(math.pi * r^2)
-

var e float
Euler’s number and the base of natural logarithms; approximately 2.718.
var inf float
Infinity.
var log10e float
Base-10 logarithm of E; approximately 0.434.
var log2e float
Base-2 logarithm of E; approximately 1.443.
var ln10 float
Natural logarithm of 10; approximately 2.303.
var ln2 float
Natural logarithm of 2; approximately 0.693.
var maxSafeInt float
The maximum integer value that can be safely represented as a float. 2^53-1 or 9007199254740991.
var minSafeInt float
The minumum integer value that can be safely represented as a float. -(2^53-1) or -9007199254740991.
var nan float
Not a number. Note that nan == nan. However, if a nan came from an arithmetic operation, the comparison is undefined. Use isNaN instead.
var neginf float
Negative infinity.
var pi float
Ratio of a circle’s circumference to its diameter; approximately 3.14159.
var sqrt1_2 float
Square root of ½; approximately 0.707.
var sqrt2 float
Square root of 2; approximately 1.414.
func abs(a float) float
Returns the absolute value of x.
func acos(a float) float
Returns the arccosine of x.
func acosh(a float) float
Returns the hyperbolic arccosine of x.
func asin(a float) float
Returns the arcsine of x.
func asinh(a float) float
Returns the hyperbolic arcsine of a number.
func atan(a float) float
Returns the arctangent of x.
func atan2(a float, b float) float
Returns the arctangent of the quotient of its arguments.
func atanh(a float) float
Returns the hyperbolic arctangent of x.
func cbrt(a float) float
Returns the cube root of x.
func ceil(a float) float
Returns the smallest integer greater than or equal to x.
func clz32(a float) float
Returns the number of leading zero bits of the 32-bit integer x.
func cos(a float) float
Returns the cosine of x.
func cosh(a float) float
Returns the hyperbolic cosine of x.
func exp(a float) float
Returns e^x, where x is the argument, and e is Euler’s number (2.718…, the base of the natural logarithm).
func expm1(a float) float
Returns subtracting 1 from exp(x).
func floor(a float) float
Returns the largest integer less than or equal to x.
func frac(a float) float
Returns the fractional or decimal part of a float value.
func hypot(a float, b float) float
Returns the square root of the sum of squares of its arguments.
func isInt(a float) bool
Returns true if the float has no fractional part, otherwise false.
func isNaN(a float) bool
Returns whether x is not a number.
func ln(a float) float
Returns the natural logarithm (㏒e; also, ㏑) of x.
func log(a float, b float) float
Returns the logarithm of y with base x.
func log10(a float) float
Returns the base-10 logarithm of x.
func log1p(a float) float
Returns the natural logarithm (㏒e; also ㏑) of 1 + x for the number x.
func log2(a float) float
Returns the base-2 logarithm of x.
func max(a float, b float) float
Returns the largest of two numbers.
func min(a float, b float) float
Returns the smallest of two numbers.
func mul32(a float, b float) float
Returns the result of the 32-bit integer multiplication of x and y. Integer overflow is allowed.
func pow(a float, b float) float
Returns base x to the exponent power y (that is, x^y).
func random() float
Returns a pseudo-random number between 0 and 1.
func round(a float) float
Returns the value of the number x rounded to the nearest integer.
func sign(a float) float
Returns the sign of the x, indicating whether x is positive, negative, or zero.
func sin(a float) float
Returns the sine of x.
func sinh(a float) float
Returns the hyperbolic sine of x.
func sqrt(a float) float
Returns the positive square root of x.
func tan(a float) float
Returns the tangent of x.
func tanh(a float) float
Returns the hyperbolic tangent of x.
func trunc(a float) float
Returns the integer portion of x, removing any fractional digits.

Std Modules. -#

Std modules come with Cyber’s CLI. They include:

  • os: System level functions.
  • test: Utilities for testing.

os. -#

Cyber’s os module contains system level functions. It’s still undecided as to how much should be included here so it’s incomplete. You can still access os and libc functions yourself using Cyber’s FFI or embedding API.

Sample usage:

import os
-
-var map = os.getEnvAll()
-for map -> [k, v]:
-    print '$(k) -> $(v)'
-

var cpu string
The current cpu arch’s tag name.
var endian symbol
The current arch’s endianness: .little, .big
var stderr File
Standard error file descriptor.
var stdin File
Standard input file descriptor.
var stdout File
Standard output file descriptor.
var system string
The current operating system’s tag name.
var vecBitSize int
Default SIMD vector bit size.
func access(path string, mode symbol) none
Attempts to access a file at the given path with the .read, .write, or .readWrite mode. Throws an error if unsuccessful.
func args() List
Returns the command line arguments in a List. Each argument is converted to a string.
func cacheUrl(url string) string
Returns the path of a locally cached file of url. If no such file exists locally, it’s fetched from url.
func copyFile(srcPath string, dstPath string) none
Copies a file to a destination path.
func createDir(path string) none
Creates the directory at path. Returns true if successful.
func createFile(path string, truncate bool) File
Creates and opens the file at path. If truncate is true, an existing file will be truncated.
func cstr(s any) pointer
Returns a null terminated C string.
func cwd() string
Returns the current working directory.
func dirName(path string) string
Returns the given path with its last component removed.
func execCmd(args List) Map
Runs a shell command and returns the stdout/stderr.
func exePath() string
Returns the current executable’s path.
func exit(status int) none
Exits the program with a status code.
func fetchUrl(url string) array
Fetches the contents at url using the HTTP GET request method.
func free(ptr pointer) none
Frees the memory located at ptr.
func getEnv(key string) string
Returns an environment variable by key.
func getEnvAll() Map
Returns all environment variables as a Map.
func malloc(size int) pointer
Allocates size bytes of memory and returns a pointer.
func milliTime() float
Return the calendar timestamp, in milliseconds, relative to UTC 1970-01-01. For an high resolution timestamp, use now().
func newFFI() FFI
Returns a new FFI context for declaring C mappings and binding a dynamic library.
func now() float
Returns the current time (in high resolution seconds) since an arbitrary point in time.
func openDir(path string) Dir
Invokes openDir(path, false).
func openDir(path string, iterable bool) Dir
Opens a directory at the given path. iterable indicates that the directory’s entries can be iterated.
func openFile(path string, mode symbol) File
Opens a file at the given path with the .read, .write, or .readWrite mode.
func parseArgs(options List) Map
Given expected ArgOptions, returns a map of the options and a rest entry which contains the non-option arguments.
func readAll() string
Reads stdin to the EOF as a UTF-8 string. To return the bytes instead, use stdin.readAll().
func readFile(path string) string
Reads the file contents from path as a UTF-8 string. To return the bytes instead, use File.readAll().
func readLine() string
Reads stdin until a new line as a string. This is intended to read user input from the command line. For bulk reads from stdin, use stdin.
func realPath(path string) string
Returns the absolute path of the given path.
func removeDir(path string) none
Removes an empty directory at path. Returns true if successful.
func removeFile(path string) none
Removes the file at path. Returns true if successful.
func setEnv(key string, val string) none
Sets an environment variable by key.
func sleep(ms float) none
Pauses the current thread for given milliseconds.
func unsetEnv(key string) none
Removes an environment variable by key.
func writeFile(path string, contents any) none
Writes contents as a string or bytes to a file.

type File -#

func close() none
Closes the file handle. File ops invoked afterwards will return error.Closed.
func iterator() any
func next() any
func read(n int) array
Reads at most n bytes as an array. n must be at least 1. A result with length 0 indicates the end of file was reached.
func readAll() array
Reads to the end of the file and returns the content as an array.
func seek(n int) none
Seeks the read/write position to pos bytes from the start. Negative pos is invalid.
func seekFromCur(n int) none
Seeks the read/write position by pos bytes from the current position.
func seekFromEnd(n int) none
Seeks the read/write position by pos bytes from the end. Positive pos is invalid.
func stat() Map
Returns info about the file as a Map.
func streamLines() File
Equivalent to streamLines(4096).
func streamLines(bufSize int) File
Returns an iterable that streams lines ending in \n, \r, \r\n, or the EOF. The lines returned include the new line character(s). A buffer size of bufSize bytes is allocated for reading. If \r is found at the end of the read buffer, the line is returned instead of waiting to see if the next read has a connecting \n.
func write(val any) int
Writes a string or array at the current file position. The number of bytes written is returned.

type Dir -#

func iterator() DirIterator
Returns a new iterator over the directory entries. If this directory was not opened with the iterable flag, error.NotAllowed is returned instead.
func stat() Map
Returns info about the file as a Map.
func walk() DirIterator
Returns a new iterator over the directory recursive entries. If this directory was not opened with the iterable flag, error.NotAllowed is returned instead.

type DirIterator -#

func next() any

type FFI -#

func bindCallback(fn any, params List, ret symbol) ExternFunc
Creates an ExternFunc that contains a C function pointer with the given signature. The extern function is a wrapper that calls the provided user function. Once created, the extern function is retained and managed by the FFI context.
func bindLib(path any) any
Calls bindLib(path, [:]).
func bindLib(path any, config Map) any
Creates a handle to a dynamic library and functions declared from cfunc. By default, an anonymous object is returned with the C-functions binded as the object’s methods. If config contains genMap: true, a Map is returned instead with C-functions binded as function values.
func bindObjPtr(obj any) pointer
Returns a Cyber object’s pointer. Operations on the pointer is unsafe, but it can be useful when passing it to C as an opaque pointer. The object is also retained and managed by the FFI context.
func cbind(mt metatype, fields List) none
Binds a Cyber type to a C struct.
func cfunc(name string, params List, ret any) none
Declares a C function which will get binded to the library handle created from bindLib.
func new(ctype symbol) pointer
Allocates memory for a C struct or primitive with the given C type specifier. A pointer to the allocated memory is returned. Eventually this will return a cpointer instead which will be more idiomatic to use.
func unbindObjPtr(obj any) none
Releases the object from the FFI context. External code should no longer use the object’s pointer since it’s not guaranteed to exist or point to the correct object.

type CArray -#

type CDimArray -#

map DirEntry -#

EntrySummary
'name' -> arrayThe name of the file or directory.
'type' -> #file | #dir | #unknownThe type of the entry.

map DirWalkEntry -#

EntrySummary
'name' -> arrayThe name of the file or directory.
'path' -> arrayThe path of the file or directory relative to the walker’s root directory.
'type' -> #file | #dir | #unknownThe type of the entry.

map ArgOption -#

EntrySummary
'name' -> stringThe name of the option to match excluding the hyphen prefix. eg. -path
'type' -> metatype(string | float | boolean)Parse as given value type.
'default' -> anyOptional: Default value if option is missing. none is used if this is not provided.

test. -#

The test module contains utilities for testing.

Sample usage:

import t 'test'
-
-var a = 123 + 321
-t.eq(a, 444)
-

func eq(a any, b any) any
Returns whether two values are equal. Panics with error.AssertError if types or values do not match up.
func eqList(a any, b any) any
Returns true if two lists have the same size and the elements are equal as if eq was called on those corresponding elements.
func eqNear(a any, b any) any
Returns two numbers are near each other within epsilon 1e-5.
func fail() any

\ No newline at end of file diff --git a/docs/toc/syntax/index.html b/docs/toc/syntax/index.html deleted file mode 100644 index 9b689d828..000000000 --- a/docs/toc/syntax/index.html +++ /dev/null @@ -1,167 +0,0 @@ -Syntax | Cyber Docs v0.3 - -
Syntax -

Syntax -#

Cyber’s syntax is concise and easy to read.

Statements. -#

A statement ends with the new line.

-- An assignment statement.
-var a = 123
-

Blocks. -#

Some statements can start a new block with a colon. -The first statement in a new block must be indented further. -Spaces or tabs can be used for indentation but not both.

-- This `if` statement begins a new block.
-if true:
-    var a = 234
-

Subsequent statements in the block must follow the same indentation. -The block ends when a statement recedes from this indentation.

var items = [10, 20, 30]
-for items -> it:
-    if it == 20:
-        print it
-    print it      -- This is the first statement outside of the `if` block.
-

Single-line blocks allow only one statement after a starting block.

-- A single line block.
-if true: print 123
-
-if true: print 123
-    -- This is an indentation error since the single-line block is already consumed.
-    print 234
-

Since blocks require at least one statement, use pass as a placeholder statement.

func foo():
-    pass
-

Variables. -#

Cyber supports dynamic and static typing. If you’re used to a dynamic language such as Python, JavaScript, or Lua, use my to declare your variables and object fields. If you’re used to a static language then use var instead. The documentation will use static typing by default.

Local variables. -#

Local variables exist until the end of their scope. -They are declared and initialized using the var keyword:

var a = 123
-

When declared without a type specifier next to the variable, it infers the type from the right initializer. -To declare variables for a specific type, see Typed variables.

Variables can be set afterwards using the = operator:

a = 234
-

Dynamically typed. -#

Dynamically typed variables are easier to work with and there is no friction when using them. They are declared using the my keyword:

my a = 123
-

To understand more about dynamically and statically typed code, see Type System.

Variable scopes. -#

Blocks create a new variable scope. Variables declared in the current scope will take precedence over any parent variables with the same name:

func foo():
-    var a = 234
-
-    if true:
-        var a = 345     -- New `a` declared.
-        print a         -- Prints "345"
-
-    print a             -- Prints "234"
-

Static Variables. -#

Static variables live until the end of the script. -They act as global variables and are visible from anywhere in the script.

They are declared with var but a namespace must be provided before the variable name:

var Root.a = 123
-
-func foo():
-    print a     -- '123'
-

The Root symbol is used to reference the current module’s namespace.

Since static variables are initialized outside of a fiber’s execution flow, they can not reference any local variables:

-- Static declaration.
-var Root.b = a   -- Compile error, initializer can not reference a local variable.
-
--- Main execution.
-var a = 123
-

However, they can be reassigned after initialization:

var Root.b = 0
-
-var a = 123
-b = a            -- Reassigning after initializing.
-

Static variable initializers have a natural order based on when it was encountered by the compiler. -In the case of imported variables, the order of the import would affect this order. -The following would print ‘123’ before ‘234’:

var Root.a = print(123)
-var Root.b = print(234)
-

When the initializers reference other static variables, those child references are initialized first in DFS order and supersede the natural ordering. The following initializes b before a.

var Root.a = b + 321
-var Root.b = 123
-
-print a        -- '444'
-

Circular references in initializers are not allowed. -When initialization encounters a reference that creates a circular dependency an error is reported.

var Root.a = b
-var Root.b = a       -- CompileError. Referencing `a` creates a circular dependency.
-

Sometimes, you may want to initialize a static variable by executing multiple statements in order. -For this use case, you can use a declaration block. *Planned Feature

var Root.myImage =:
-    var img = loadImage('me.png')
-    img.resize(100, 100)
-    img.filter(.blur, 5)
-    break img
-

The final resulting value that is assigned to the static variable is provided by a break statement. If a break statement is not provided, none is assigned instead.

Reserved identifiers. -#

Keywords. -#

There are 25 general keywords. This list categorizes them:

Contextual keywords. -#

These keywords only have meaning in a certain context.

Symbols. -#

Literals. -#

Operators. -#

Cyber supports the following operators. They are ordered from highest to lowest precedence.

OperatorDescription
<< >>Bitwise left shift, right shift.
&Bitwise and.
| ||Bitwise or, exclusive or.
^Power.
/ % *Division, modulus, multiplication.
+ -Addition, subtraction.
asType casting.
> >= < <= != ==Greater, greater or equal, less, less or equal, not equals, equals.
andLogical and.
orLogical or.

Arithmetic Operators. -#

The following arithmetic operators are supported for the numeric data types.

1 + 2     -- Addition, evaluates to 3.
-100 - 10  -- Subtraction, evaluates to 90.
-3 * 4     -- Multiplication, evaluates to 12.
-20 / 5    -- Division, evaluates to 4.
-2 ^ 4     -- Raise to the power, evaluates to 16.
-12 % 5    -- Modulus remainder, evaluates to 2.
--(10)     -- Apply negative, evaluates to -10.
-

Comparison Operators. -#

Cyber supports the following comparison operators. -By default, a comparison operator evaluates to a Boolean value.

The equals operator returns true if the two values are equal. For primitive types, the comparison checks the types and the underlying value. For strings, the underlying bytes are compared for equality. For objects, the comparison checks that the two values reference the same object.

1 == 1      -- Evaluates to `true`
-1 == 2      -- Evaluates to `false`
-1 == true   -- Evaluates to `false`
-
-my a = 'abc'
-a == 'abc'  -- Evaluates to `true`
-
-a = []
-my b = a
-a == b      -- Evaluates to `true`
-a == []     -- Evaluates to `false`
-

The not equals operator returns true if the two values are not equal.

1 != 1      -- Evaluates to `false`
-1 != 2      -- Evaluates to `true`
-

Number types have additional comparison operators.

a > b    -- `true` if a is greater than b
-a >= b   -- `true` if a is greater than or equal to b
-a < b    -- `true` if a is less than b
-a <= b   -- `true` if a is less than or equal to b
-

Logic Operators. -#

The logical operators and, or, and not are supported.

and evaluates to a if a is not truthy. Otherwise, it evaluates to b. If a is not truthy, the evaluation of b is not executed. A numeric value that isn’t 0 is truthy. An object reference is always truthy. The none value is not truthy.

true and true  -- Evaluates to true
-123 and 234    -- Evaluates to 234
-123 and 0      -- Evaluates to false
-

or evaluates to a if a is truthy. Otherwise, it evaluates to b. If a is found to be truthy, the evaluation of b is not executed.

true or false  -- Evaluates to true
-false or true  -- Evaluates to true
-false or false -- Evaluates to false
-123 or false   -- Evaluates to 123
-

The unary operator not performs negation on the boolean value. The unary operator ! can also be used instead of not.

not false     -- Evaluates to true
-not true      -- Evaluates to false
-not 0         -- Evaluates to true      
-not 123       -- Evaluates to false
-!false        -- Evaluates to true
-!true         -- Evaluates to false
-

Bitwise Operators. -#

The following bitwise operators are supported for int number values.

-- Bitwise and: any underlying bits that are set in both integers are set in the new integer.
-a & b
-
--- Bitwise or: any underlying bits that are set in either integer a or integer b are set in the new integer.
-a | b
-
--- Bitwise exclusive or: any underlying bits that are set in either integer a or integer b but not both are set in the new integer.
-a || b
-
--- Bitwise right shift: a's bits are shifted b bits to the least significant end. This performs sign-extension on the 32-bit integer.
-a >> b
-
--- Bitwise left shift: a's bits are shifted b bits to the most significant end. This does not perform sign-extension on the 32-bit integer.
-a << b
-
--- Bitwise not: a's integer bits are flipped.
-~a
-

Operator Overloading. -#

See Operator Overloading in Metaprogramming.

Comments. -#

A single line comment starts with two hyphens and ends at the end of the line.

-- This is a comment.
-
-var a = 123   -- This is a comment on the same line as a statement.
-

There will be multi-line comments in Cyber but the syntax has not been determined.

CYON. -#

CYON or the Cyber object notation is similar to JSON. The format uses the same literal value semantics as Cyber.

[
-    name: 'John Doe',
-    'age': 25,
-    -- This is a comment
-    cities: [
-        'New York',
-        'San Francisco',
-        'Tokyo',
-    ],
-]
-
\ No newline at end of file diff --git a/docs/toc/type-system/index.html b/docs/toc/type-system/index.html deleted file mode 100644 index 11fbabbc4..000000000 --- a/docs/toc/type-system/index.html +++ /dev/null @@ -1,138 +0,0 @@ -Type System | Cyber Docs v0.3 - -
Type System -

Type System. -#

Cyber supports the use of both dynamically and statically typed code.

Dynamic typing. -#

Dynamic typing can reduce the amount of friction when writing code, but it can also result in more runtime errors.

my declaration. -#

Variables declared with my are assigned the dynamic type:

my a = 123
-

dynamic vs any -#

dynamic values can be freely used and copied without any compile errors (if there is a chance it can succeed at runtime, see Recent type inference):

my a = 123
-
-func getFirstRune(s string):
-    return s[0]
-
-getFirstRune(a)       -- RuntimeError. Expected `string`.
-

Since a is dynamic, passing it to a typed function parameter is allowed at compile-time, but will fail when the function is invoked at runtime.

The any type on the otherhand is a static type and must be explicitly declared using var:

var a any = 123
-
-func getFirstRune(s string):
-    return s[0]
-
-getFirstRune(a)       -- CompileError. Expected `string`.
-

This same setup will now fail at compile-time because any does not satisfy the destination’s string type constraint.

The use of the dynamic type effectively defers type checking to runtime while any is a static type and must adhere to type constraints at compile-time.

A dynamic value can be used in any operation. It can be invoked as the callee, invoked as the receiver of a method call, or used with operators.

Invoking dynamic values. -#

When a dynamic value is invoked, checks on whether the callee is a function is deferred to runtime.

my op = 123
-print op(1, 2, 3)      -- RuntimeError. Expected a function.
-

Dynamic return value. -#

When the return type of a function is not specified, it defaults to the dynamic type. -This allows copying the return value to a typed destination without casting:

func getValue():
-    return 123
-
-func add(a int, b int):
-    return a + b
-
-print add(getValue(), 2)    -- Prints "125"
-

The add function defers type checking of getValue() to runtime because it has the dynamic type.

Recent type inference. -#

Although a dynamic variable has the most flexibility, in some situations it is advantageous to know what type it could be.

The compiler keeps a running record of a dynamic variable’s most recent type to gain additional compile-time features without sacrificing flexibility. It can prevent inevitable runtime errors and avoid unnecessary type casts.

When a dynamic variable is first initialized, it has a recent type inferred from its initializer. In the following, a has the recent type of int at compile-time because numeric literals default to the int type:

my a = 123
-

The recent type can change at compile-time from another assignment. -If a is then assigned to a string literal, a from that point on has the recent type of string at compile-time:

my a = 123
-foo(a)           -- Valid call expression.
-a = 'hello'
-foo(a)           -- CompileError. Expected `int` argument, got `string`.
-
-func foo(n int):
-    pass
-

Even though a is dynamic and is usually allowed to defer type checking to runtime, the compiler knows that doing so in this context would always result in a runtime error, so it provides a compile error instead. This provides a quicker feedback to fix the problem.

The recent type of a can also change in branches. However, after the branch block, a will have a recent type after merging the types assigned to a from the two branched code paths. Currently, the any type is used if the types from the two branches differ. At the end of the following if block, a has the recent type of any type after merging the int and string types: *Planned Feature

my a = 123
-if a > 20:
-    a = 'hello'
-    foo(a)       -- Valid call expression. `foo` can be called without type casting.
-
-foo(a)           -- CompileError. Expected `string` argument, got `any`.
-
-func foo(s string):
-    pass
-

Static typing. -#

Static typing can be incrementally applied which provides compile-time guarantees and prevents runtime errors. -Static typing also makes it easier to maintain and refactor your code.

Builtin types. -#

The following builtin types are available in every module: bool, float, int, string, List, Map, error, fiber, any.

var declaration. -#

A var declaration automatically infers the type from the initializer:

-- Initialized as an `int` variable.
-var a = 123
-

var declarations are strictly for static typing. If the assigned value’s type is dynamic, the variable’s type becomes any.

func getValue():
-    return ['a', 'list']
-
--- Initialized as an `any` variable.
-var a = getValue()
-

Typed variables. -#

A typed local variable can be declared by attaching a type specifier after its name. The value assigned to the variable must satisfy the type constraint or a compile error is issued.

var a float = 123
-
-var b int = 123.0    -- CompileError. Expected `int`, got `float`.
-

Any operation afterwards that violates the type constraint of the variable will result in a compile error.

a = 'hello'          -- CompileError. Expected `float`, got `string`.
-

Static variables are declared in a similar way:

var Root.global Map = [:]
-

Unlike local variables, static variable declarations do not infer the type from the right hand side. A specific type must be specified or it will default to the any type.

Object types. -#

A type object declaration creates a new object type. Field types are optional and declared with a type specifier after their name.

type Student object:    -- Creates a new type named `Student`
-    var name string
-    var age  int
-    var gpa  float
-

Instantiating a new object does not require typed fields to be initialized. Missing field values will default to their zero value:

var s = [Student:]
-print s.name       -- Prints ""
-print s.age        -- Prints "0"
-print s.gpa        -- Prints "0.0"
-

Circular type dependencies are allowed if the object can be initialized:

Planned Feature: Optional types are not currently supported.

type Node object:
-    var val  any
-    var next Node?     -- Valid type specifier.
-

In this example, next has an optional Node? type so it can be initialized to none when creating a new Node object.

The following example will fail because this version of Node can not be initialized:

type Node object:
-    var val  any
-    var next Node
-
-var n = [Node:]    -- CompileError. Can not zero initialize `next`
-                   -- because of circular dependency.
-

Zero values. -#

The following shows the zero values of builtin or created types.

TypeZero value
booleanfalse
int0
float0.0
string''
arrayarray('')
List[]
Map[:]
type S object[S:]
@host type S objectS.$zero()
dynamicnone
anynone
S?none

Type aliases. -#

A type alias is declared from a single line type statement. This creates a new type symbol for an existing data type.

import util './util.cy'
-
-type Vec3 util.Vec3
-
-var v = [Vec3 x: 3, y: 4, z: 5]
-

Functions. -#

Function parameter and return type specifiers follows a similiar syntax.

func mul(a float, b float) float:
-    return a * b
-
-print mul(3, 4)
-print mul(3, '4')  -- CompileError. Function signature mismatch.
-

Traits. -#

Planned Feature

Union types. -#

Planned Feature

any type. -#

A variable with the any type can hold any value, but copying it to narrowed type destination will result in a compile error:

func square(i int):
-    return i * i
-
-var a any = 123
-a = ['a', 'list']         -- Valid assignment to a value with a different type.
-a = 10
-
-print square(a)           -- CompileError. Expected `int`, got `any`.
-

a must be explicitly casted to satisfy the type constraint:

print square(a as int)    -- Prints "100".
-

Invoking any values. -#

Since any is a static type, invoking an any value must be explicitly casted to the appropriate function type.

Planned Feature: Casting to a function type is not currently supported.

func add(a int, b int) int:
-    return a + b
-
-var op any = add
-print op(1, 2)         -- CompileError. Expected `func (int, int) any`
-
-var opFunc = op as (func (int, int) int)
-print opFunc(1, 2)     -- Prints "3".
-

Type casting. -#

The as keyword can be used to cast a value to a specific type. Casting lets the compiler know what the expected type is and does not perform any conversions.

If the compiler knows the cast will always fail at runtime, a compile error is returned instead.

print('123' as int)       -- CompileError. Can not cast `string` to `int`.
-

If the cast fails at runtime, a panic is returned.

var erased any = 123
-add(1, erased as int)     -- Success.
-print(erased as string)   -- Panic. Can not cast `int` to `string`.
-
-func add(a int, b int):
-    return a + b
-
\ No newline at end of file diff --git a/en.search-data.min.0750042693284b01efa8fa1d7155f30d0d6e0ad4b200d593276e289c682e49bb.json b/en.search-data.min.0750042693284b01efa8fa1d7155f30d0d6e0ad4b200d593276e289c682e49bb.json deleted file mode 100644 index ede28dec8..000000000 --- a/en.search-data.min.0750042693284b01efa8fa1d7155f30d0d6e0ad4b200d593276e289c682e49bb.json +++ /dev/null @@ -1 +0,0 @@ -[{"id":0,"href":"/cyber/docs/toc/syntax/","title":"Syntax","section":"Table of Contents","content":" Syntax # Cyber\u0026rsquo;s syntax is concise and easy to read.\nStatements. # A statement ends with the new line.\n-- An assignment statement. var a = 123 Blocks. # Some statements can start a new block with a colon. The first statement in a new block must be indented further. Spaces or tabs can be used for indentation but not both.\n-- This `if` statement begins a new block. if true: var a = 234 Subsequent statements in the block must follow the same indentation. The block ends when a statement recedes from this indentation.\nvar items = [10, 20, 30] for items -\u0026gt; it: if it == 20: print it print it -- This is the first statement outside of the `if` block. Single-line blocks allow only one statement after a starting block.\n-- A single line block. if true: print 123 if true: print 123 -- This is an indentation error since the single-line block is already consumed. print 234 Since blocks require at least one statement, use pass as a placeholder statement.\nfunc foo(): pass Variables. # Cyber supports dynamic and static typing. If you\u0026rsquo;re used to a dynamic language such as Python, JavaScript, or Lua, use my to declare your variables and object fields. If you\u0026rsquo;re used to a static language then use var instead. The documentation will use static typing by default.\nLocal variables. # Local variables exist until the end of their scope. They are declared and initialized using the var keyword:\nvar a = 123 When declared without a type specifier next to the variable, it infers the type from the right initializer. To declare variables for a specific type, see Typed variables.\nVariables can be set afterwards using the = operator:\na = 234 Dynamically typed. # Dynamically typed variables are easier to work with and there is no friction when using them. They are declared using the my keyword:\nmy a = 123 To understand more about dynamically and statically typed code, see Type System.\nVariable scopes. # Blocks create a new variable scope. Variables declared in the current scope will take precedence over any parent variables with the same name:\nfunc foo(): var a = 234 if true: var a = 345 -- New `a` declared. print a -- Prints \u0026#34;345\u0026#34; print a -- Prints \u0026#34;234\u0026#34; Static Variables. # Static variables live until the end of the script. They act as global variables and are visible from anywhere in the script.\nThey are declared with var but a namespace must be provided before the variable name:\nvar Root.a = 123 func foo(): print a -- \u0026#39;123\u0026#39; The Root symbol is used to reference the current module\u0026rsquo;s namespace.\nSince static variables are initialized outside of a fiber\u0026rsquo;s execution flow, they can not reference any local variables:\n-- Static declaration. var Root.b = a -- Compile error, initializer can not reference a local variable. -- Main execution. var a = 123 However, they can be reassigned after initialization:\nvar Root.b = 0 var a = 123 b = a -- Reassigning after initializing. Static variable initializers have a natural order based on when it was encountered by the compiler. In the case of imported variables, the order of the import would affect this order. The following would print \u0026lsquo;123\u0026rsquo; before \u0026lsquo;234\u0026rsquo;:\nvar Root.a = print(123) var Root.b = print(234) When the initializers reference other static variables, those child references are initialized first in DFS order and supersede the natural ordering. The following initializes b before a.\nvar Root.a = b + 321 var Root.b = 123 print a -- \u0026#39;444\u0026#39; Circular references in initializers are not allowed. When initialization encounters a reference that creates a circular dependency an error is reported.\nvar Root.a = b var Root.b = a -- CompileError. Referencing `a` creates a circular dependency. Sometimes, you may want to initialize a static variable by executing multiple statements in order. For this use case, you can use a declaration block. *Planned Feature\nvar Root.myImage =: var img = loadImage(\u0026#39;me.png\u0026#39;) img.resize(100, 100) img.filter(.blur, 5) break img The final resulting value that is assigned to the static variable is provided by a break statement. If a break statement is not provided, none is assigned instead.\nReserved identifiers. # Keywords. # There are 25 general keywords. This list categorizes them:\nControl Flow: if else switch case while for break continue pass Operators: or and not Variables: var my Functions: func return Coroutines: coinit coyield, coresume Data Types: type as Error Handling: try catch throw Modules: import Contextual keywords. # These keywords only have meaning in a certain context.\nMethods: self, Self Catching Errors: caught Object Type: object Enum Type: enum Function Throws: throws Symbols. # Modules: Root Literals. # Booleans: true false Error Values: error None: none Operators. # Cyber supports the following operators. They are ordered from highest to lowest precedence.\nOperator Description \u0026lt;\u0026lt; \u0026gt;\u0026gt; Bitwise left shift, right shift. \u0026amp; Bitwise and. | || Bitwise or, exclusive or. ^ Power. / % * Division, modulus, multiplication. + - Addition, subtraction. as Type casting. \u0026gt; \u0026gt;= \u0026lt; \u0026lt;= != == Greater, greater or equal, less, less or equal, not equals, equals. and Logical and. or Logical or. Arithmetic Operators. # The following arithmetic operators are supported for the numeric data types.\n1 + 2 -- Addition, evaluates to 3. 100 - 10 -- Subtraction, evaluates to 90. 3 * 4 -- Multiplication, evaluates to 12. 20 / 5 -- Division, evaluates to 4. 2 ^ 4 -- Raise to the power, evaluates to 16. 12 % 5 -- Modulus remainder, evaluates to 2. -(10) -- Apply negative, evaluates to -10. Comparison Operators. # Cyber supports the following comparison operators. By default, a comparison operator evaluates to a Boolean value.\nThe equals operator returns true if the two values are equal. For primitive types, the comparison checks the types and the underlying value. For strings, the underlying bytes are compared for equality. For objects, the comparison checks that the two values reference the same object.\n1 == 1 -- Evaluates to `true` 1 == 2 -- Evaluates to `false` 1 == true -- Evaluates to `false` my a = \u0026#39;abc\u0026#39; a == \u0026#39;abc\u0026#39; -- Evaluates to `true` a = [] my b = a a == b -- Evaluates to `true` a == [] -- Evaluates to `false` The not equals operator returns true if the two values are not equal.\n1 != 1 -- Evaluates to `false` 1 != 2 -- Evaluates to `true` Number types have additional comparison operators.\na \u0026gt; b -- `true` if a is greater than b a \u0026gt;= b -- `true` if a is greater than or equal to b a \u0026lt; b -- `true` if a is less than b a \u0026lt;= b -- `true` if a is less than or equal to b Logic Operators. # The logical operators and, or, and not are supported.\nand evaluates to a if a is not truthy. Otherwise, it evaluates to b. If a is not truthy, the evaluation of b is not executed. A numeric value that isn\u0026rsquo;t 0 is truthy. An object reference is always truthy. The none value is not truthy.\ntrue and true -- Evaluates to true 123 and 234 -- Evaluates to 234 123 and 0 -- Evaluates to false or evaluates to a if a is truthy. Otherwise, it evaluates to b. If a is found to be truthy, the evaluation of b is not executed.\ntrue or false -- Evaluates to true false or true -- Evaluates to true false or false -- Evaluates to false 123 or false -- Evaluates to 123 The unary operator not performs negation on the boolean value. The unary operator ! can also be used instead of not.\nnot false -- Evaluates to true not true -- Evaluates to false not 0 -- Evaluates to true not 123 -- Evaluates to false !false -- Evaluates to true !true -- Evaluates to false Bitwise Operators. # The following bitwise operators are supported for int number values.\n-- Bitwise and: any underlying bits that are set in both integers are set in the new integer. a \u0026amp; b -- Bitwise or: any underlying bits that are set in either integer a or integer b are set in the new integer. a | b -- Bitwise exclusive or: any underlying bits that are set in either integer a or integer b but not both are set in the new integer. a || b -- Bitwise right shift: a\u0026#39;s bits are shifted b bits to the least significant end. This performs sign-extension on the 32-bit integer. a \u0026gt;\u0026gt; b -- Bitwise left shift: a\u0026#39;s bits are shifted b bits to the most significant end. This does not perform sign-extension on the 32-bit integer. a \u0026lt;\u0026lt; b -- Bitwise not: a\u0026#39;s integer bits are flipped. ~a Operator Overloading. # See Operator Overloading in Metaprogramming.\nComments. # A single line comment starts with two hyphens and ends at the end of the line.\n-- This is a comment. var a = 123 -- This is a comment on the same line as a statement. There will be multi-line comments in Cyber but the syntax has not been determined.\nCYON. # CYON or the Cyber object notation is similar to JSON. The format uses the same literal value semantics as Cyber.\n[ name: \u0026#39;John Doe\u0026#39;, \u0026#39;age\u0026#39;: 25, -- This is a comment cities: [ \u0026#39;New York\u0026#39;, \u0026#39;San Francisco\u0026#39;, \u0026#39;Tokyo\u0026#39;, ], ] "},{"id":1,"href":"/cyber/docs/toc/data-types/","title":"Data Types","section":"Table of Contents","content":" Data Types. # In Cyber, there are primitive types and object types. Primitives are copied around by value and don\u0026rsquo;t need additional heap memory or reference counts.\nPrimitives include Booleans, Floats, Integers, Enums, Symbols, Error Symbols, and the none value.\nObject types include Lists, Tuples, Maps, Strings, Arrays, User Objects, Lambdas, Fibers, Enums with payloads, Pointers, and several internal object types.\nNone. # The none value represents an empty value. This is similar to null in other languages.\nBooleans. # Booleans can be true or false. See type bool.\nvar a = true if a: print \u0026#39;a is true\u0026#39; When other value types are coerced to the bool type, the truthy value is determined as follows.\nThe none value is false. Other objects and values are always true. Numbers. # Integers. # int is the default integer type. It has 48-bits and can represent integers in the range -(247) to 247-1. See type int.\nWhen a numeric literal is used and the type can not be inferred, it will default to the int type:\nvar a = 123 Integer notations always produce a int value:\nvar a = 0xFF -- hex. a = 0o17 -- octal. a = 0b1010 -- binary. a = `🐶` -- UTF-8 rune. Arbitrary values can be converted to a int using the type as a function.\nvar a = \u0026#39;123\u0026#39; var b = int(a) In addition to arithmetic operations, integers can also perform bitwise operations.\nFloats. # float is the default floating point type. It has a (IEEE 754) 64-bit floating point format. See type float.\nAlthough a float represents a decimal number, it can also represent integers between -(253-1) and (253-1). Any integers beyond the safe integer range is not guaranteed to have a unique representation.\nA numeric literal can be used to create a float if the inferred type is a float:\nvar a float = 123 Decimal and scientific notations always produce a float value:\nvar a = 2.34567 var b = 123.0e4 Arbitrary values can be converted to a float using the type as a function.\nvar a = \u0026#39;12.3\u0026#39; var b = float(a) Big Numbers. # Planned Feature\nStrings. # The string type represents a sequence of UTF-8 codepoints, also known as runes. Each rune is stored internally as 1-4 bytes and can be represented as an int. See type string.\nUnder the hood, there are multiple string implementations to make operations faster by default.\nStrings are immutable, so operations that do string manipulation return a new string. By default, small strings are interned to reduce memory footprint.\nTo mutate an existing string, use MutString. *Planned Feature\nA string is always UTF-8 validated. Using an Array to represent raw bytes of a string is faster but you\u0026rsquo;ll have to validate them and take care of indexing.\nA single line string literal is surrounded in single quotes.\nvar apple = \u0026#39;a fruit\u0026#39; You can escape the single quote inside the literal or use double quotes.\nvar apple = \u0026#39;Bob\\\u0026#39;s fruit\u0026#39; apple = \u0026#34;Bob\u0026#39;s fruit\u0026#34; Concatenate two strings together with the + operator or the method concat.\nvar res = \u0026#39;abc\u0026#39; + \u0026#39;xyz\u0026#39; res = res.concat(\u0026#39;end\u0026#39;) Strings are UTF-8 encoded.\nvar str = \u0026#39;abc🦊xyz🐶\u0026#39; Use double quotes to surround a multi-line string.\nvar str = \u0026#34;line a line b line c\u0026#34; You can escape double quotes inside the literal or use triple quotes.\nvar str = \u0026#34;line a line \\\u0026#34;b\\\u0026#34; line c\u0026#34; -- Using triple quotes. str = \u0026#39;\u0026#39;\u0026#39;line a line \u0026#34;b\u0026#34; line c \u0026#39;\u0026#39;\u0026#39; The following escape sequences are supported:\nEscape Sequence Code Description \\a 0x07 Terminal bell. \\b 0x08 Backspace. \\e 0x1b Escape character. \\n 0x0a Line feed character. \\r 0x0d Carriage return character. \\t 0x09 Horizontal tab character. The boundary of each line can be set with a vertical line character. This makes it easier to see the whitespace. *Planned Feature\nvar poem = \u0026#34;line a | two spaces from the left | indented further\u0026#34; Using the index operator will return the UTF-8 rune at the given index as a slice. This is equivalent to calling the method sliceAt().\nvar str = \u0026#39;abcd\u0026#39; print str[1] -- \u0026#34;b\u0026#34; Using the slice operator will return a view of the string at the given start and end (exclusive) indexes. The start index defaults to 0 and the end index defaults to the string\u0026rsquo;s length.\nvar str = \u0026#39;abcxyz\u0026#39; var sub = str[0..3] print sub -- \u0026#34;abc\u0026#34; print str[..5] -- \u0026#34;abcxy\u0026#34; print str[1..] -- \u0026#34;bcxyz\u0026#34; -- One way to use slices is to continue a string operation. str = \u0026#39;abcabcabc\u0026#39; var i = str.findRune(`c`) print(i) -- \u0026#34;2\u0026#34; i += 1 print(i + str[i..].findRune(`c`)) -- \u0026#34;5\u0026#34; String Interpolation. # Expressions can be embedded into string templates with $():\nvar name = \u0026#39;Bob\u0026#39; var points = 123 var str = \u0026#39;Scoreboard: $(name) $(points)\u0026#39; String templates can not contain nested string templates.\nString formatting. # Values that can be formatted into a string will have a fmt method:\nvar file = os.openFile(\u0026#39;data.bin\u0026#39;, .read) var bytes = file.readToEnd() -- Dump contents in hex. print \u0026#39;$(bytes.fmt(.x))\u0026#39; Arrays. # An array is an immutable sequence of bytes. It can be used to represent strings but it won\u0026rsquo;t automatically validate their encoding and indexing returns the n\u0026rsquo;th byte rather than a UTF-8 rune. See type array.\nvar a = array(\u0026#39;abcd\u0026#39;) a = a.insertByte(1, 255) print a[0] -- \u0026#34;97\u0026#34; print a[1] -- \u0026#34;255\u0026#34; Bracket literals. # Bracket literals are delimited with brackets []. They are used to initialize Lists, Maps, and Objects:\nvar list = [1, 2, 3] var map = [ a: 123, b: 234 ] var obj = [MyObject a: 123, b: 234] Lists. # Lists are a builtin type that holds an ordered collection of elements. Lists grow or shrink as you insert or remove elements. See type List.\n-- Construct a new list. var list = [1, 2, 3] -- The first element of the list starts at index 0. print list[0] -- Prints \u0026#39;1\u0026#39; Lists can be sliced with the range .. clause. The sliced list becomes a new list that you can modify without affecting the original list. The end index is non-inclusive.\nvar list = [ 1, 2, 3, 4, 5 ] list[0..0] -- [] list[0..3] -- [ 1, 2, 3 ] list[3..] -- [ 4, 5 ] list[..3] -- [ 1, 2, 3 ] The +.. invokes the slice operator with an end position that is an increment from the start: *Planned Feature\nvar list = [ 1, 2, 3, 4, 5 ] list[2+..2] -- [ 3, 4 ] List operations.\nvar list = [234] -- Append a value. list.append 123 -- Inserting a value at an index. list.insert(1, 345) -- Get the length. print list.len() -- Prints \u0026#39;2\u0026#39; -- Sort the list in place. list.sort((a, b) =\u0026gt; a \u0026lt; b) -- Iterating a list. for list -\u0026gt; it: print it -- Remove an element at a specific index. list.remove(1) Tuples. # Incomplete: Tuples can only be created from @host funcs at the moment.\nMaps. # Maps are a builtin type that store key value pairs in dictionaries. See type Map.\nCreate map. # Create a map using key value pairs inside a collection literal:\nvar map = [ a: 123, b: () =\u0026gt; 5 ] Maps entries can be listed in multiple lines:\nvar map = [ foo: 1, bar: 2, ] Empty map. # The empty map is initialized using [:]:\nvar empty = [:] Map indexing. # Get a value from the map using the index operator:\nprint map[\u0026#39;a\u0026#39;] Maps can be accessed with the . dot operator as well:\nprint map.a Map operations. # var map = [:] -- Set a key value pair. map[123] = 234 -- Get the size of the map. print map.size() -- Remove an entry by key. map.remove 123 -- Iterating a map. for map -\u0026gt; [val, key]: print \u0026#39;$(key) -\u0026gt; $(val)\u0026#39; Map block. # Entries can also follow a collection literal block. This gives structure to the entries and has the added benefit of allowing multi-line lambdas. *Planned Feature\nvar colors = []: red: 0xFF0000 green: 0x00FF00 blue: 0x0000FF dump func (c): print c.red print c.green print c.blue -- Nested map. darker []: red: 0xAA0000 green: 0x00AA00 blue: 0x0000AA Objects. # Any value that isn\u0026rsquo;t a primitive is an object. You can declare your own object types using the type object declaration. Object types are similar to structs and classes in other languages. Unlike classes, there is no concept of inheritance at the language level.\nFields. # Fields must be declared at the top of the type object block using var or my:\ntype Node object: var value int var next any When fields are declared with my instead, they become dynamically typed.\nInstantiation. # New object instances are created using a leading type name and the field values in a collection literal:\nvar node = [Node value: 123, next: none] print node.value -- Prints \u0026#34;123\u0026#34; Methods. # Methods allow invoking a function on an object instance using the . operator:\ntype Node object: var value int var next any func inc(n): value += n func incAndPrint(): self.inc(321) print value var n = [Node value: 123, next: none] n.incAndPrint() -- Prints \u0026#34;444\u0026#34; Methods can also be declared outside of the type declaration. To distinguish a method from a type function, self must be provided as a parameter:\nfunc Node.getNext(self): return self.next self variable. # Type members can be implicitly referenced inside the method. *Incomplete: Only the type\u0026#39;s fields can be referenced this way.\nTo reference members explicitly inside a method, use the builtin self:\ntype Node object: var value int var next any func double(): return self.value * 2 Type functions. # Type functions are declared outside of the type block with an explicit namespace path:\ntype Node object: var value int var next any -- Declare namespace function inside `Node`. func Node.new(): return [Node value: 123, next: none] var n = Node.new() Type variables. # Similarily, type variables are declared outside of the type block:\n-- Declare inside the `Node` namespace. var Node.DefaultValue = 100 print Node.DefaultValue -- Prints \u0026#34;100\u0026#34; Enums. # A new enum type can be declared with the type enum declaration. An enum value can only be one of the unique symbols declared in the enum type. By default, the symbols generate unique ids starting from 0.\ntype Fruit enum: case apple case orange case banana case kiwi var fruit = Fruit.kiwi print fruit -- \u0026#39;Fruit.kiwi\u0026#39; print int(fruit) -- \u0026#39;3\u0026#39; When the type of the value is known to be an enum, it can be assigned using a symbol literal.\nvar fruit = Fruit.kiwi fruit = .orange print(fruit == Fruit.orange) -- \u0026#39;true\u0026#39; Symbols. # Symbol literals begin with ., followed by an identifier. They have their own global unique id.\nvar currency = .usd print(currency == .usd) -- \u0026#39;true\u0026#39; print int(currency) -- \u0026#39;123\u0026#39; or some arbitrary id. "},{"id":2,"href":"/cyber/docs/toc/control-flow/","title":"Control Flow","section":"Table of Contents","content":" Control Flow. # Cyber provides the common constructs to branch and enter loops.\nBranching. # if statement. # Use if and else statements to branch the execution of your code depending on conditions. The else clause can contain a condition which is only evaluated if the previous if or conditional else clause was false.\nvar a = 10 if a == 10: print \u0026#39;a is 10\u0026#39; else a == 20: print \u0026#39;a is 20\u0026#39; else: print \u0026#39;neither 10 nor 20\u0026#39; Conditional expression. # A conditional branch expression evaluates a condition and returns either the true value or false value:\nvar a = 10 var str = a == 10 ? \u0026#39;red\u0026#39; else \u0026#39;blue\u0026#39; and/or # Use and and or logical operators to combine conditions:\nvar a = 10 if a \u0026gt; 5 and a \u0026lt; 15: print \u0026#39;a is between 5 and 15\u0026#39; if a == 20 or a == 10: print \u0026#39;a is 10 or 20\u0026#39; Iterations. # Infinite loop. # The while keyword starts an infinite loop which continues to run the code in the block until a break or return is reached.\nvar count = 0 while: if count \u0026gt; 100: break count += 1 Conditional loop. # When the while clause contains a condition, the loop continues to run until the condition is evaluated to false:\nvar running = true var count = 0 while running: if count \u0026gt; 100: running = false count += 1 Unwrapping loop. # Using the capture operator -\u0026gt; unwraps the left optional value to the right variable declaration. The loop exits when the left value is none:\nvar iter = dir.walk() while iter.next() -\u0026gt; entry: print entry.name For range. # for loops can iterate over a range that starts at an int (inclusive) to a target int (exclusive). The capture operator -\u0026gt; is used to capture the loop\u0026rsquo;s counter variable:\nfor 0..4: performAction() for 0..100 -\u0026gt; i: print i -- 0, 1, 2, ... , 99 To decrement the counter instead, use -..:\nfor 100-..0 -\u0026gt; i: print i -- 100, 99, 98, ... , 1 When the range operator .. is replaced with ..=, the target int is inclusive: *Planned Feature\nfor 0..=100 -\u0026gt; i: print i -- 0, 1, 2, ... , 100 For each. # The for clause can iterate over any type that implements the Iterable trait. An Iterable contains an iterator() method which returns an Iterator object. The for loop continually invokes the Iterator\u0026rsquo;s next() method until none is returned.\nLists can be iterated since they implement the Iterable trait. The capture operator -\u0026gt; is used to capture the value returned from an iterator\u0026rsquo;s next():\nvar list = [1, 2, 3, 4, 5] for list -\u0026gt; n: print n Maps can be iterated. next() returns a key and value tuple:\nvar map = [ a: 123, b: 234 ] for map -\u0026gt; entry: print entry[0] print entry[1] Use the destructure syntax to extract the key and value into two separate variables:\nfor map -\u0026gt; [ key, val ]: print \u0026#39;key $(key) -\u0026gt; value $(val)\u0026#39; For each with index. # A counting index can be declared after the each variable. The count starts at 0 for the first value:\nvar list = [1, 2, 3, 4, 5] for list -\u0026gt; val, i: print \u0026#39;index $(i), value $(val)\u0026#39; Exit loop. # Use break to exit a loop. This loop stops printing once i reaches 4:\nfor 0..10 -\u0026gt; i: if i == 4: break print i Next iteration. # Use continue to skip the rest of the loop and go to the next iteration. This loop prints 0 through 9 but skips 4:\nfor 0..10 -\u0026gt; i: if i == 4: continue print i Switch matching. # The switch statement branches to a case block from a matching case condition. The expression that is matched against comes after switch statement. Multiple cases can be grouped together using a comma separator. An optional else fallback case is executed when no other cases were matched. *Incomplete: Not all types can be used in the case conditions such as ranges.\nvar val = 1000 switch val: case 0..100: print \u0026#39;at or between 0 and 99\u0026#39; case 100 : print \u0026#39;val is 100\u0026#39; case 200: print \u0026#39;val is 200\u0026#39; case 300, 400: print \u0026#39;combined case\u0026#39; else: print \u0026#39;val is $(val)\u0026#39; Note that the switch block must be empty and requires at least one case block or an else block to come after it.\nSwitch assignment. # Although switch can not be used freely as an expression, it can be assigned to a left variable or destination:\nvar shu = switch pepper: case \u0026#39;bell\u0026#39; =\u0026gt; 0 case \u0026#39;anaheim\u0026#39; =\u0026gt; 500 case \u0026#39;jalapeño\u0026#39; =\u0026gt; 2000 case \u0026#39;serrano\u0026#39; =\u0026gt; 10000 When declaring an assignable switch, the cases must have a return value using the syntax case {cond} =\u0026gt; {expr} or else =\u0026gt; {expr}.\nSwitch break. # A break statement exits the current case block and resumes execution after the end of the switch statement: *Planned Feature\nswitch value: case 0..5: print value if value == 3: break case print value -- Skips second print if `value` is 3. Try/Catch. # The try catch statement, try else and try expressions provide a way to catch a throwing error and resume execution in a different branch. Learn more about Error Handling.\nDeferred Execution. # Planned Feature\n"},{"id":3,"href":"/cyber/docs/toc/functions/","title":"Functions","section":"Table of Contents","content":" Functions. # In Cyber, there are first-class functions (or function values) and static functions.\nStatic Functions. # Static functions are not initially values themselves. They allow function calls to be optimal since they don\u0026rsquo;t need to resolve a dynamic value.\nStatic functions are declared with the func keyword and must have a name.\nimport math func dist(x0 float, y0 float, x1 float, y1 float) float: var dx = x0-x1 var dy = y0-y1 return math.sqrt(dx^2 + dy^2) Calling static functions is straightforward. You can also reassign or pass them around as function values.\nprint dist(0, 0, 10, 20) -- Assigning to a local variable. var bar = dist -- Passing `dist` as an argument. func squareDist(dist, size): return dist(0.0, 0.0, size, size) print squareDist(dist, 30.0) Functions can only return one value. However, the value can be destructured: *Planned Feature\nimport {cos, sin} \u0026#39;math\u0026#39; func compute(rad): return [ cos(rad), sin(rad) ] var [ x, y ] = compute(pi) Function Overloading. # Functions can be overloaded by the number of parameters in its signature. Typed functions are further overloaded by their type signatures.\nfunc foo(): return 2 + 2 func foo(n): return 10 + n func foo(n, m): return n * m print foo() -- \u0026#34;4\u0026#34; print foo(2) -- \u0026#34;12\u0026#34; print foo(20, 5) -- \u0026#34;100\u0026#34; Lambdas. # Lambdas or function values can be assigned to variables or passed as arguments into other constructs.\nWhen a lambda only returns an expression, it can be declared with a simplified syntax.\n-- Passing simple lambda as an argument. foo(word =\u0026gt; toUpper(word)) -- A simple lambda with multiple arguments. foo((word, prefix) =\u0026gt; prefix + toUpper(word)) -- Assigning a simple lambda. canvas.onUpdate = delta_ms =\u0026gt; print delta_ms Lambdas that need a block of statements can be declared with the func keyword without a name.\n-- Assigning lambda block to a variable. var add = func (a, b): return a + b -- Passing a lambda block as an argument. canvas.onUpdate(): ..func (delta_ms): print delta_ms Passing a lambda block as a call argument is only possible in a call block. *Planned Feature See Function Calls.\nClosures. # Lambdas can capture local variables from parent blocks. This example shows the lambda f capturing a from the main scope: *Incomplete, only variables one parent block away can be captured.\nvar a = 1 var f = func(): return a + 2 print f() -- \u0026#34;3\u0026#34; The following lambda expression captures a from the function add:\nfunc add(): var a = 123 return b =\u0026gt; a + b var addTo = add() print addTo(10) -- \u0026#34;133\u0026#34; Like static variables, static functions can not reference local variables outside of their scope:\nvar a = 1 func foo(): print a -- CompileError: Undeclared variable `a`. Named Parameters. # Planned Feature\nOptional Parameters. # Planned Feature\nVariadic Parameters. # Planned Feature\nFunction Calls. # The straightforward way to call a function is to use parentheses.\nvar d = dist(100, 100, 200, 200) You can call functions with named parameters.\nPlanned Feature\nvar d = dist(x0: 10, x1: 20, y0: 30, y1: 40) Shorthand syntax. # The shorthand method for calling functions omits parentheses and commas. This only works for functions that accept parameters:\nIncomplete: Only the most trivial cases work with the shorthand method. The case with operators being separated by spaces might not end up being implemented.\nvar d = dist 100 100 200 200 -- Calls the function `dist`. func random(): -- Function with no parameters. return 4 var r = random -- Returns the function itself as a value. -- Does not call the function `random`. r = random() -- Calls the function `random`. The top level arguments for the shorthand convention must be separated by whitespace. A string can contain whitespace since it\u0026rsquo;s surrounded by delimiters.\nvar a = myFunc \u0026#39;cyber script\u0026#39; The following has a binary expression with spaces inbetween which is not allowed. Removing that whitespace fixes the call expression.\nvar a = myFunc 1 + 2 -- Not allowed. a = myFunc 1+2 -- Correct. Wrapping arguments in parentheses allows you to keep the whitespace in the sub-expression.\n-- This calls the function `myFunc` with 2 arguments. var a = myFunc \u0026#39;hello\u0026#39; (1 + 2 * 3) -- Nested function call using the shorthand convention. a = myFunc \u0026#39;hello\u0026#39; (otherFunc 1+2 \u0026#39;world\u0026#39;) Call block syntax. # The call expression block continues to add arguments from the block\u0026rsquo;s body. If arguments are omitted from the initial call expression they can be added inside using the .. syntax. Arguments mapped to named parameters have a key value syntax separated by a :. All other arguments are added into a list and passed as the last argument.\nPlanned Feature\nfoo(123): ..func (): return 123 param3: 123 234 bar() \u0026#39;hello\u0026#39; In the example above, the function foo is called with 4 arguments. The first argument 123 is included in the starting call expression. The second argument is a function value inside the call expression block. The third argument is mapped to the param param3. Finally, the fourth argument is a list that contains 234, bar(), and 'hello'.\n"},{"id":4,"href":"/cyber/docs/toc/modules/","title":"Modules","section":"Table of Contents","content":" Modules. # Modules have their own namespace and contain accessible static symbols. By default, importing another Cyber script returns a module with its declared symbols.\nImporting. # Import declarations create a local alias to the module referenced by the import specifier. The Cyber CLI comes with some builtin modules like math and test. If the specifier does not refer to a builtin module, it looks for a Cyber script file relative to the current script\u0026rsquo;s directory. An embedder can integrate their own module loader and resolver.\nimport test test.eq(123, 123) -- Imports are static declarations so they can be anywhere in the script. import math print math.cos(0) When the imported alias needs to be renamed, the import specifier comes after the alias name and must be a string literal.\nimport m \u0026#39;math\u0026#39; print m.random() -- Loading a Cyber module from the local directory. import foo \u0026#39;bar.cy\u0026#39; print foo.myFunc() print foo.myVar A Cyber script that is imported doesn\u0026rsquo;t evaluate its main block. Only static declarations are effectively loaded. If there is code in the main block, it will skip evaluation. In the following, only the print statement in the main.cy is evaluated.\n-- main.cy import a \u0026#39;foo.cy\u0026#39; print a.foo -- foo.cy import \u0026#39;bar.cy\u0026#39; var Root.foo = 123 print foo -- Statement is ignored. -- bar.cy var Root.bar = 321 print bar -- Statement is ignored. You can have circular imports in Cyber. In the following example, main.cy and foo.cy import each other without any problems.\n-- main.cy import foo \u0026#39;foo.cy\u0026#39; func printB(): foo.printC() foo.printA() -- foo.cy import main \u0026#39;main.cy\u0026#39; func printA(): main.printB() func printC(): print \u0026#39;done\u0026#39; Static variable declarations from imports can have circular references. Read more about this in Static Variables.\nModules can also be destructured using the following syntax:\nPlanned Feature\nimport { cos, pi } \u0026#39;math\u0026#39; print cos(pi) Exporting. # All static declarations are exported when the script\u0026rsquo;s module is loaded.\nfunc foo(): -- Exported static function. print 123 var Root.bar = 234 -- Exported static variable. type Thing object: -- Exported type. var a float Module URI. # To get the absolute path of the current module, reference the compile-time variable ModUri. This can be used with os.dirName to get the current module directory.\nprint #ModUri -- Prints \u0026#39;/some/path/foo.cy\u0026#39; import os print os.dirName(#ModUri) -- Prints \u0026#39;/some/path\u0026#39; Visibility. # The annotation @hide provides a hint to editors that a static symbol should not appear in the auto-complete. Despite this, the symbol is still reachable.\nBuiltin Modules. # Builtin modules are the bare minimum that comes with Cyber. The embeddable library contains these modules and nothing more. They include:\nbuiltins: Cyber related functions and commonly used utilities. math: Math constants and functions. builtins. # The builtins module contains functions related to Cyber and common utilities. It is automatically imported into each script\u0026rsquo;s namespace.\nSample usage:\n-- `print` and `typeof` are available without imports. print \u0026#39;hello\u0026#39; print typeof(\u0026#39;my str\u0026#39;).id() func copy(val any) any Copies a primitive value or creates a shallow copy of an object value. func dump(val any) none Prints the result of toCyon on a value. func errorReport() string func getObjectRc(val any) int Returns the current reference count of an object. func is(a any, b any) bool Returns whether two values refer to the same instance. func isAlpha(val int) bool Returns whether a rune is an alphabetic letter. func isDigit(val int) bool Returns whether a rune is a digit. func must(val any) any If val is an error, panic(val) is invoked. Otherwise, val is returned. func panic(err any) none Stop execution in the current fiber and starts unwinding the call stack. See Unexpected Errors. func parseCyber(src string) Map Parses Cyber source string into structured map object. Currently, only metadata about static declarations is made available but this will be extended to include an AST. func parseCyon(src string) any Parses a CYON string into a value. func performGC() Map Runs the garbage collector once to detect reference cycles and abandoned objects. Returns the statistics of the run in a map value. func print(str any) none Prints a value. The host determines how it is printed. func runestr(val int) string Converts a rune to a string. func toCyon(val any) string Encodes a value to CYON string. func typeof(val any) metatype Returns the value\u0026rsquo;s type as a metatype object. func typesym(val any) symbol Returns the value\u0026rsquo;s type as one of the predefined symbols: .float, .int, .bool, .object, .list, .map, .string, .array, .function, .fiber, .pointer, .symbol, .metatype, .none, .error type bool # func bool.\u0026#39;$call\u0026#39;(val any) bool Converts a value to either true or false. type error # func sym() symbol Return the underlying symbol. func error.\u0026#39;$call\u0026#39;(val any) error Create an error from an enum or symbol. type int # func $prefix~() int func $prefix-() int func $infix\u0026lt;(o any) bool func $infix\u0026lt;=(o any) bool func $infix\u0026gt;(o any) bool func $infix\u0026gt;=(o any) bool func $infix\u0026#43;(o any) int func $infix-(o any) int func $infix*(o any) int func $infix/(o any) int func $infix%(o any) int func $infix^(o any) int func $infix\u0026amp;(o any) int func $infix|(o any) int func $infix||(o any) int func $infix\u0026lt;\u0026lt;(o any) int func $infix\u0026gt;\u0026gt;(o any) int func fmt(kind symbol) string Formats the integer using a kind specifier which can be binary .b, octal .o, decimal .d, hexadecimal .x, ASCII .c. func fmt(kind symbol, opts Map) string opts.pad provides the ASCII rune that is used for padding with a string length of opts.width. func int.\u0026#39;$call\u0026#39;(val any) int Converts a value to an 48-bit integer. type float # func $prefix-() float func $infix\u0026lt;(o any) bool func $infix\u0026lt;=(o any) bool func $infix\u0026gt;(o any) bool func $infix\u0026gt;=(o any) bool func $infix\u0026#43;(o any) float func $infix-(o any) float func $infix*(o any) float func $infix/(o any) float func $infix%(o any) float func $infix^(o any) float func float.\u0026#39;$call\u0026#39;(val any) float Converts the value to a float. Panics if type conversion fails. type List # func $index(idx any) any func $setIndex(idx any, val any) none func $slice(start any, end any) List func append(val any) none Appends a value to the end of the list. func concat(list List) none Concats the elements of another list to the end of this list. func insert(idx int, val any) none Inserts a value at index idx. func iterator() ListIterator Returns a new iterator over the list elements. func join(sep string) string Returns a new string that joins the elements with separator. func len() int Returns the number of elements in the list. func remove(idx int) none Removes an element at index idx. func resize(size int) none Resizes the list to len elements. If the new size is bigger, none values are appended to the list. If the new size is smaller, elements at the end of the list are removed. func slice(start any, end any) List func List.fill(val any, n int) List Creates a list with initial capacity of n and values set to val. If the value is an object, it is shallow copied n times. type ListIterator # func next() any type tuple # func $index(idx int) any type Map # func $index(key any) any func $setIndex(key any, val any) none func remove(key any) none Removes the element with the given key key. func size() int Returns the number of key-value pairs in the map. func iterator() MapIterator Returns a new iterator over the map elements. type MapIterator # func next() any type string # func $infix\u0026#43;(o any) string func concat(o string) string Returns a new string that concats this string and str. func endsWith(suffix string) bool Returns whether the string ends with suffix. func find(needle string) any Returns the first index of substring needle in the string or none if not found. func findAnyRune(runes string) any Returns the first index of any UTF-8 rune in runes or none if not found. func findRune(rune int) int Returns the first index of UTF-8 rune needle in the string or none if not found. func insert(idx int, str string) string Returns a new string with str inserted at index idx. func isAscii() bool Returns whether the string contains all ASCII runes. func len() int Returns the number of UTF-8 runes in the string. func less(other string) bool Returns whether this string is lexicographically before other. func lower() string Returns this string in lowercase. func replace(needle string, replacement string) string Returns a new string with all occurrences of needle replaced with replacement. func repeat(n int) string Returns a new string with this string repeated n times. func runeAt(n int) int Returns the UTF-8 rune at index idx. func slice(start any, end any) string Returns a slice into this string from start to end (exclusive) indexes. This is equivalent to using the slice index operator [start..end]. func $slice(start any, end any) string func sliceAt(idx int) string Returns the UTF-8 rune at index idx as a single rune string. func $index(idx int) string func split(sep string) List Returns a list of UTF-8 strings split at occurrences of sep. func startsWith(prefix string) bool Returns whether the string starts with prefix. func trim(mode symbol, delims string) string Returns the string with ends trimmed from runes in delims. mode can be .left, .right, or .ends. func upper() string Returns this string in uppercase. func string.\u0026#39;$call\u0026#39;(val any) string Converts a value to a string. type array # func $infix\u0026#43;(o any) array func concat(other array) array Returns a new array that concats this array and other. func decode() string Calls decode(.utf8) func decode(encoding symbol) string Decodes the array based on an encoding. Supported encodings: .utf8. Returns the decoded string or throws error.Decode. func endsWith(suffix array) bool Returns whether the array ends with suffix. func find(needle array) any Returns the first index of needle in the array or none if not found. func findAnyByte(bytes array) any Returns the first index of any bytes in arrays or none if not found. func findByte(byte int) any Returns the first index of byte in the array or none if not found. func fmt(kind symbol) string Formats each byte in the array using a kind specifier which can be binary .b, octal .o, decimal .d, hexadecimal .x, ASCII .c. Each byte is zero padded. func getByte(idx int) int Returns the byte value (0-255) at the given index idx. func getInt(idx int, endian symbol) int Returns the int value of the 6 bytes starting from idx with the given endianness (.little or .big). func getInt32(idx int, endian symbol) int Returns the int value of the 4 bytes starting from idx with the given endianness (.little or .big). func insert(idx int, arr array) array Returns a new array with arr inserted at index idx. func insertByte(idx int, byte int) array Returns a new array with byte inserted at index idx. func len() int Returns the number of bytes in the array. func repeat(n int) array Returns a new array with this array repeated n times. func replace(needle array, replacement array) array Returns a new array with all occurrences of needle replaced with replacement. func slice(start any, end any) array Returns a slice into this array from start to end (exclusive) indexes. This is equivalent to using the slice index operator [start..end]. func $slice(start any, end any) array func $index(idx int) int func split(sep array) List Returns a list of arrays split at occurrences of sep. func startsWith(prefix array) bool Returns whether the array starts with prefix. func trim(mode symbol, delims array) array Returns the array with ends trimmed from runes in delims. mode can be .left, .right, or .ends. func array.\u0026#39;$call\u0026#39;(val any) array Converts a string to an byte array. type arrayIterator # type pointer # func addr() int Returns the memory address as an int. The value may be negative since it\u0026rsquo;s bitcasted from an unsigned 48-bit integer but it retains the original pointer bits. func asObject() any Unsafe. Casts the pointer to a Cyber object. The object is retained before it\u0026rsquo;s returned. func fromCstr(offset int) array Unsafe. Returns an array from a null terminated C string. func get(offset int, ctype symbol) any Unsafe. Dereferences the pointer at a byte offset and returns the C value converted to Cyber. func set(offset int, val any) none Unsafe. Converts the value to a compatible C value and writes it to a byte offset from this pointer. func toArray(offset int, len int) array Unsafe. Returns an array with a copy of the byte data starting from an offset to the specified length. func pointer.\u0026#39;$call\u0026#39;(val any) pointer Converts a int to a pointer value, or casts to a pointer. This is usually used with FFI. type Fiber # func status() symbol type metatype # func id() int math. # The math module contains commonly used math constants and functions.\nSample usage:\nimport math var r = 10.0 print(math.pi * r^2) var e float Euler\u0026rsquo;s number and the base of natural logarithms; approximately 2.718. var inf float Infinity. var log10e float Base-10 logarithm of E; approximately 0.434. var log2e float Base-2 logarithm of E; approximately 1.443. var ln10 float Natural logarithm of 10; approximately 2.303. var ln2 float Natural logarithm of 2; approximately 0.693. var maxSafeInt float The maximum integer value that can be safely represented as a float. 2^53-1 or 9007199254740991. var minSafeInt float The minumum integer value that can be safely represented as a float. -(2^53-1) or -9007199254740991. var nan float Not a number. Note that nan == nan. However, if a nan came from an arithmetic operation, the comparison is undefined. Use isNaN instead. var neginf float Negative infinity. var pi float Ratio of a circle\u0026rsquo;s circumference to its diameter; approximately 3.14159. var sqrt1_2 float Square root of ½; approximately 0.707. var sqrt2 float Square root of 2; approximately 1.414. func abs(a float) float Returns the absolute value of x. func acos(a float) float Returns the arccosine of x. func acosh(a float) float Returns the hyperbolic arccosine of x. func asin(a float) float Returns the arcsine of x. func asinh(a float) float Returns the hyperbolic arcsine of a number. func atan(a float) float Returns the arctangent of x. func atan2(a float, b float) float Returns the arctangent of the quotient of its arguments. func atanh(a float) float Returns the hyperbolic arctangent of x. func cbrt(a float) float Returns the cube root of x. func ceil(a float) float Returns the smallest integer greater than or equal to x. func clz32(a float) float Returns the number of leading zero bits of the 32-bit integer x. func cos(a float) float Returns the cosine of x. func cosh(a float) float Returns the hyperbolic cosine of x. func exp(a float) float Returns e^x, where x is the argument, and e is Euler\u0026rsquo;s number (2.718…, the base of the natural logarithm). func expm1(a float) float Returns subtracting 1 from exp(x). func floor(a float) float Returns the largest integer less than or equal to x. func frac(a float) float Returns the fractional or decimal part of a float value. func hypot(a float, b float) float Returns the square root of the sum of squares of its arguments. func isInt(a float) bool Returns true if the float has no fractional part, otherwise false. func isNaN(a float) bool Returns whether x is not a number. func ln(a float) float Returns the natural logarithm (㏒e; also, ㏑) of x. func log(a float, b float) float Returns the logarithm of y with base x. func log10(a float) float Returns the base-10 logarithm of x. func log1p(a float) float Returns the natural logarithm (㏒e; also ㏑) of 1 + x for the number x. func log2(a float) float Returns the base-2 logarithm of x. func max(a float, b float) float Returns the largest of two numbers. func min(a float, b float) float Returns the smallest of two numbers. func mul32(a float, b float) float Returns the result of the 32-bit integer multiplication of x and y. Integer overflow is allowed. func pow(a float, b float) float Returns base x to the exponent power y (that is, x^y). func random() float Returns a pseudo-random number between 0 and 1. func round(a float) float Returns the value of the number x rounded to the nearest integer. func sign(a float) float Returns the sign of the x, indicating whether x is positive, negative, or zero. func sin(a float) float Returns the sine of x. func sinh(a float) float Returns the hyperbolic sine of x. func sqrt(a float) float Returns the positive square root of x. func tan(a float) float Returns the tangent of x. func tanh(a float) float Returns the hyperbolic tangent of x. func trunc(a float) float Returns the integer portion of x, removing any fractional digits. Std Modules. # Std modules come with Cyber\u0026rsquo;s CLI. They include:\nos: System level functions. test: Utilities for testing. os. # Cyber\u0026rsquo;s os module contains system level functions. It\u0026rsquo;s still undecided as to how much should be included here so it\u0026rsquo;s incomplete. You can still access os and libc functions yourself using Cyber\u0026rsquo;s FFI or embedding API.\nSample usage:\nimport os var map = os.getEnvAll() for map -\u0026gt; [k, v]: print \u0026#39;$(k) -\u0026gt; $(v)\u0026#39; var cpu string The current cpu arch\u0026rsquo;s tag name. var endian symbol The current arch\u0026rsquo;s endianness: .little, .big var stderr File Standard error file descriptor. var stdin File Standard input file descriptor. var stdout File Standard output file descriptor. var system string The current operating system\u0026rsquo;s tag name. var vecBitSize int Default SIMD vector bit size. func access(path string, mode symbol) none Attempts to access a file at the given path with the .read, .write, or .readWrite mode. Throws an error if unsuccessful. func args() List Returns the command line arguments in a List. Each argument is converted to a string. func cacheUrl(url string) string Returns the path of a locally cached file of url. If no such file exists locally, it\u0026rsquo;s fetched from url. func copyFile(srcPath string, dstPath string) none Copies a file to a destination path. func createDir(path string) none Creates the directory at path. Returns true if successful. func createFile(path string, truncate bool) File Creates and opens the file at path. If truncate is true, an existing file will be truncated. func cstr(s any) pointer Returns a null terminated C string. func cwd() string Returns the current working directory. func dirName(path string) string Returns the given path with its last component removed. func execCmd(args List) Map Runs a shell command and returns the stdout/stderr. func exePath() string Returns the current executable\u0026rsquo;s path. func exit(status int) none Exits the program with a status code. func fetchUrl(url string) array Fetches the contents at url using the HTTP GET request method. func free(ptr pointer) none Frees the memory located at ptr. func getEnv(key string) string Returns an environment variable by key. func getEnvAll() Map Returns all environment variables as a Map. func malloc(size int) pointer Allocates size bytes of memory and returns a pointer. func milliTime() float Return the calendar timestamp, in milliseconds, relative to UTC 1970-01-01. For an high resolution timestamp, use now(). func newFFI() FFI Returns a new FFI context for declaring C mappings and binding a dynamic library. func now() float Returns the current time (in high resolution seconds) since an arbitrary point in time. func openDir(path string) Dir Invokes openDir(path, false). func openDir(path string, iterable bool) Dir Opens a directory at the given path. iterable indicates that the directory\u0026rsquo;s entries can be iterated. func openFile(path string, mode symbol) File Opens a file at the given path with the .read, .write, or .readWrite mode. func parseArgs(options List) Map Given expected ArgOptions, returns a map of the options and a rest entry which contains the non-option arguments. func readAll() string Reads stdin to the EOF as a UTF-8 string. To return the bytes instead, use stdin.readAll(). func readFile(path string) string Reads the file contents from path as a UTF-8 string. To return the bytes instead, use File.readAll(). func readLine() string Reads stdin until a new line as a string. This is intended to read user input from the command line. For bulk reads from stdin, use stdin. func realPath(path string) string Returns the absolute path of the given path. func removeDir(path string) none Removes an empty directory at path. Returns true if successful. func removeFile(path string) none Removes the file at path. Returns true if successful. func setEnv(key string, val string) none Sets an environment variable by key. func sleep(ms float) none Pauses the current thread for given milliseconds. func unsetEnv(key string) none Removes an environment variable by key. func writeFile(path string, contents any) none Writes contents as a string or bytes to a file. type File # func close() none Closes the file handle. File ops invoked afterwards will return error.Closed. func iterator() any func next() any func read(n int) array Reads at most n bytes as an array. n must be at least 1. A result with length 0 indicates the end of file was reached. func readAll() array Reads to the end of the file and returns the content as an array. func seek(n int) none Seeks the read/write position to pos bytes from the start. Negative pos is invalid. func seekFromCur(n int) none Seeks the read/write position by pos bytes from the current position. func seekFromEnd(n int) none Seeks the read/write position by pos bytes from the end. Positive pos is invalid. func stat() Map Returns info about the file as a Map. func streamLines() File Equivalent to streamLines(4096). func streamLines(bufSize int) File Returns an iterable that streams lines ending in \\n, \\r, \\r\\n, or the EOF. The lines returned include the new line character(s). A buffer size of bufSize bytes is allocated for reading. If \\r is found at the end of the read buffer, the line is returned instead of waiting to see if the next read has a connecting \\n. func write(val any) int Writes a string or array at the current file position. The number of bytes written is returned. type Dir # func iterator() DirIterator Returns a new iterator over the directory entries. If this directory was not opened with the iterable flag, error.NotAllowed is returned instead. func stat() Map Returns info about the file as a Map. func walk() DirIterator Returns a new iterator over the directory recursive entries. If this directory was not opened with the iterable flag, error.NotAllowed is returned instead. type DirIterator # func next() any type FFI # func bindCallback(fn any, params List, ret symbol) ExternFunc Creates an ExternFunc that contains a C function pointer with the given signature. The extern function is a wrapper that calls the provided user function. Once created, the extern function is retained and managed by the FFI context. func bindLib(path any) any Calls bindLib(path, [:]). func bindLib(path any, config Map) any Creates a handle to a dynamic library and functions declared from cfunc. By default, an anonymous object is returned with the C-functions binded as the object\u0026rsquo;s methods. If config contains genMap: true, a Map is returned instead with C-functions binded as function values. func bindObjPtr(obj any) pointer Returns a Cyber object\u0026rsquo;s pointer. Operations on the pointer is unsafe, but it can be useful when passing it to C as an opaque pointer. The object is also retained and managed by the FFI context. func cbind(mt metatype, fields List) none Binds a Cyber type to a C struct. func cfunc(name string, params List, ret any) none Declares a C function which will get binded to the library handle created from bindLib. func new(ctype symbol) pointer Allocates memory for a C struct or primitive with the given C type specifier. A pointer to the allocated memory is returned. Eventually this will return a cpointer instead which will be more idiomatic to use. func unbindObjPtr(obj any) none Releases the object from the FFI context. External code should no longer use the object\u0026rsquo;s pointer since it\u0026rsquo;s not guaranteed to exist or point to the correct object. type CArray # type CDimArray # map DirEntry # Entry Summary 'name' -\u0026gt; array The name of the file or directory. 'type' -\u0026gt; #file | #dir | #unknown The type of the entry. map DirWalkEntry # Entry Summary 'name' -\u0026gt; array The name of the file or directory. 'path' -\u0026gt; array The path of the file or directory relative to the walker\u0026rsquo;s root directory. 'type' -\u0026gt; #file | #dir | #unknown The type of the entry. map ArgOption # Entry Summary 'name' -\u0026gt; string The name of the option to match excluding the hyphen prefix. eg. -path 'type' -\u0026gt; metatype(string | float | boolean) Parse as given value type. 'default' -\u0026gt; any Optional: Default value if option is missing. none is used if this is not provided. test. # The test module contains utilities for testing.\nSample usage:\nimport t \u0026#39;test\u0026#39; var a = 123 + 321 t.eq(a, 444) func eq(a any, b any) any Returns whether two values are equal. Panics with error.AssertError if types or values do not match up. func eqList(a any, b any) any Returns true if two lists have the same size and the elements are equal as if eq was called on those corresponding elements. func eqNear(a any, b any) any Returns two numbers are near each other within epsilon 1e-5. func fail() any "},{"id":5,"href":"/cyber/docs/toc/ffi/","title":"FFI","section":"Table of Contents","content":" FFI. # Cyber supports binding to an existing C ABI compatible library at runtime. This allows you to call into dynamic libraries created in C or other languages. Cyber uses libtcc to JIT compile the bindings so function calls are fast. The example shown below can be found in Examples.\nFFI context. # An FFI context contains declarations that map C to Cyber. Afterwards, it allows you to bind to a dynamic library or create interoperable objects. To create a new FFI context:\nimport os var ffi = os.newFFI() Declare functions. # Functions from a library are first declared using cfunc which accepts C types in the form of symbols. In a future update they will accept C syntax instead.\nffi.cfunc(\u0026#39;add\u0026#39;, [.int, .int], .int) The first argument refers to the symbol\u0026rsquo;s name in the dynamic library. The second argument contains the function\u0026rsquo;s parameter types and finally the last argument is the function\u0026rsquo;s return type.\nThe example above maps to this C function:\nint add(int a, int b) { return a + b; } Bind library. # bindLib accepts the path to the library and returns a object which can be used to invoke the functions declared from cfunc:\nmy lib = ffi.bindLib(\u0026#39;./mylib.so\u0026#39;) lib.add(123, 321) Note that my is used to allow lib to be used dynamically since the type is unknown at compile-time.\nSearch path. # If the path argument to bindLib is just a filename, the search steps for the library is specific to the operating system. Provide an absolute (eg. \u0026lsquo;/foo/mylib.so\u0026rsquo;) or relative (eg. \u0026lsquo;./mylib.so\u0026rsquo;) path to load from a direct location instead. When the path argument is none, it loads the currently running executable as a library allowing you to bind exported functions from the Cyber CLI or your own application/runtime.\nConfiguration. # By default bindLib returns an anonymous object with the binded C-functions as methods. This is convenient for invoking functions using the method call syntax. If a config is passed into bindLib as the second argument, genMap: true makes bindLib return a map instead with the binded C-functions as Cyber functions.\nFinalizer. # The resulting object of bindLib holds a reference to an internal TCCState which owns the loaded JIT code. Once the object is released by ARC, the TCCState is also released which removes the JIT code from memory.\nMappings. # When using cfunc or cbind declarations, symbols are used to represent default type mappings from Cyber to C and back:\nIncomplete: This is not the final API for dynamically loading and interfacing with C libraries. The plan is to parse a subset of C headers to bind to Cyber types and functions.\nBinding Cyber C Details .bool bool bool .char int int8_t, signed char .uchar int uint8_t, unsigned char .short int int16_t, short .ushort int uint16_t, unsigned short .int int int32_t, int .uint int uint32_t, unsigned int .long int int64_t, long long .ulong int uint64_t, unsigned long long .usize int size_t, uintptr_t .float float float .double float double .charPtr pointer char* Use os.cstr() and pointer.fromCstr() to convert between a Cyber string and a null terminated C string. .voidPtr pointer void* type {S} object type {S} object struct The mapping from a Cyber object type S and the C-struct can be declared with cbind. Bind to Cyber type. # cbind is used to bind a C struct to a Cyber object type. Once declared, the Cyber type can be used as a binding type in function declarations:\nimport os type MyObject object: var a float var b pointer var c bool ffi.cbind(MyObject, [.float, .voidPtr, .bool]) ffi.cfunc(\u0026#39;foo\u0026#39;, [MyObject], MyObject) my lib = ffi.bindLib(\u0026#39;./mylib.so\u0026#39;) var res = lib.foo([MyObject a: 123.0, b: os.cstr(\u0026#39;foo\u0026#39;), c: true]) The example above maps to these C declarations in mylib.so:\ntypedef struct MyObject { double a; char* b; bool c; } MyObject; MyObject foo(MyObject o) { // Do something. } cbind also generates ptrTo[Type] as a helper function to dereference an opaque ptr to a new Cyber object:\nffi.cfunc(\u0026#39;foo\u0026#39;, [MyObject], .voidPtr) my lib = ffi.bindLib(\u0026#39;./mylib.so\u0026#39;) var ptr = lib.foo([MyObject a: 123, b: os.cstr(\u0026#39;foo\u0026#39;), c: true]) var res = lib.ptrToMyObject(ptr) Pointers. # A pointer is used to read or write to an exact memory address. This is typically used for FFI to manually map Cyber types to C, and back. See type pointer.\nA new pointer can be created with the builtin pointer.\nvar ptr = pointer(0xDEADBEEF) print ptr.value() --\u0026#39;3735928559\u0026#39; cbindgen.cy # cbindgen.cy is a Cyber script that automatically generates bindings given a C header file. Some example bindings that were generated include: Raylib and LLVM.\n"},{"id":6,"href":"/cyber/docs/toc/errors/","title":"Error Handling","section":"Table of Contents","content":" Error Handling. # Cyber provides a throw/catch mechanism to handle expected errors. For unexpected errors, panics can be used as a fail-fast mechanism to abort the currently running fiber.\nError trait. # Only types that implement the Error trait can be thrown or attached to a panic. Since the Error trait is empty, it\u0026rsquo;s simple to turn any type into a throwable type.\nerror value. # An error value contains a symbol and implements the Error trait. They can be created without a declaration using the error literal:\nvar err = error.Oops Use sym() to obtain the underlying symbol:\nprint err.sym() -- Prints \u0026#34;.Oops\u0026#34; Since error is a primitive value, it can be compared using the == operator.\nif err == error.Oops: handleOops() -- Alternatively. if err.sym() == .Oops: handleOops() Enum error. # By implementing the Error trait, an enum type can be throwable: *Planned Feature\ntype MyError enum: with Error boom badArgument nameTooLong var err = MyError.nameTooLong Throwing errors. # Use the throw keyword to throw errors. A thrown error continues to bubble up the call stack until it is caught by a try block or expression.\nfunc fail(): throw error.Oops -- Throws an error with the symbol `#Oops` func fail2(): throw 123 -- Panic. Can only throw an error -- that implement the `Error` trait. throw can also be used as an expression.\nfunc fail(): var a = false or throw error.False Catching errors. # try block. # The try block catches thrown errors and resumes execution in a followup catch block:\ntry: funcThatCanFail() catch err: print err -- \u0026#39;error.Failed\u0026#39; caught variable. # The contextual caught variable is used to reference the caught error: *Planned Feature\ntry: funcThatCanFail() catch: print caught -- \u0026#39;error.Failed\u0026#39; catch matching. # An inner catch block contains a matching clause: *Planned Feature\ntry: funcThatCanFail() catch error.BadDay: eatSnack() catch: print caught Enum errors can be matched: *Planned Feature\ntry: funcThatCanFail() catch MyError.Boom: print \u0026#39;Kaboom!\u0026#39; catch: print caught try expression. # The try expression either returns a non-error result or the default value from the catch clause:\nvar res = try funcThatCanFail() catch 123 print res -- \u0026#39;123\u0026#39; Since errors bubble up automatically, any errors thrown from sub-expressions are also caught:\nvar res = try happyFunc(funcThatCanFail()) catch 123 print res -- \u0026#39;123\u0026#39; Value or error. # When the catch clause is omitted, the try expression will return either the value or the error:\nvar res = try funcThatCanFail() if res == error.Failed: print \u0026#39;Result is an error.\u0026#39; Semantic checks. # throws specifier. # The throws specifier indicates that a function contains a throwing expression that was not caught with try catch.\nWhen a function does not have a return specifier, it\u0026rsquo;s implicitly given the throws specifier:\nfunc foo(): throw error.Failure func bar() throws: throw error.Failure -- `foo` and `bar` both have the same return specifier. Return types for typed functions are declared after throws using a comma separator:\nfunc result(cond bool) throws, int: if cond: return 123 else: throw error.Failure Requiring throws. # A compile-time error is issued when a typed function without a throws specifier contains an uncaught throwing expression: *Planned Feature\nfunc foo(a int) int: if a == 10: throw error.Failure -- CompileError. `foo` requires the `throws` else: -- specifier or any throwing expression must return a * 2 -- be caught with `try catch`. Stack trace. # When an uncaught error bubbles up to the top, its stack trace from the throw callsite is dumped to the console. The builtin errorTrace() and errorReport() are used to obtain the stack trace info.\ntry: funcThatCanFail() catch: -- Prints the stack trace summary of the caught error. print errorReport() -- Provides structured info about the stack trace. var info = errorTrace() print info.frames.len() Unexpected errors. # An unexpected error is an error that is not meant to be handled at runtime.\nPanics. # The builtin panic is used as a fail-fast mechanism to quickly exit the current fiber with an error payload:\nfunc kaboom(): panic(error.danger) kaboom() -- Script ends and prints the stack trace. Panics can not be caught using try catch. Once panic is invoked, the current fiber stops execution and begins to unwind its call stack. Once the error is propagated to the root, the fiber ends and transitions to a panic state. If the main fiber ends this way, the VM begins to shutdown. Otherwise, execution resumes on the next fiber which allows recovery from a panic.\n"},{"id":7,"href":"/cyber/docs/toc/concurrency/","title":"Concurrency","section":"Table of Contents","content":" Concurrency. # Cyber supports fibers as a concurrency mechanism. There are plans to support preemptive concurrency with async/await as well as multithreading.\nFibers. # A fiber represents a separate execution context as a first-class value. It contains it\u0026rsquo;s own call stack and program counter. Fibers by themselves do not enable parallelism.\nCreating fibers. # The coinit keyword creates and returns a new fiber using a function as the entry point:\nvar count = 0 var foo = func (): count += 1 coyield count += 1 var fiber = coinit(foo) print count -- \u0026#39;0\u0026#39; coresume fiber print count -- \u0026#39;1\u0026#39; coresume fiber print count -- \u0026#39;2\u0026#39; A fiber does not start execution until coresume is invoked on it. coyield pauses the current fiber and execution is returned to the previous fiber that invoked coresume.\nPassing arguments. # Arguments after the callee are passed into the entry function:\nvar count = 0 var increment = func (inc): count += inc var fiber = coinit(increment, 5) coresume fiber print count -- \u0026#39;5\u0026#39; When the fiber is created, the arguments are saved inside the fiber\u0026rsquo;s stack. Once the first coresume is invoked, the entry function is invoked with the saved arguments.\nReset state. # To reset a fiber to its initial state, invoke reset(). *Planned Feature When reset, the existing stack is unwinded, the program counter returns to the starting point, and the state is set to .init:\nfunc fib(n int) int: coyield n if n \u0026lt; 2: return n return fib(n - 1) + fib(n - 2) var task = coinit(fib, 10) -- Progress the fiber... print(coresume task) -- Prints \u0026#34;10\u0026#34; print(coresume task) -- Prints \u0026#34;9\u0026#34; print(coresume task) -- Prints \u0026#34;8\u0026#34; -- Reset back to the start with the `.init` state. fiber.reset() print(coresume task) -- Prints \u0026#34;10\u0026#34; Rebinding arguments. # Arguments attached to the fiber can be rebinded with a different set of values. *Planned Feature This allows fiber reuse, instead of creating a new fiber:\nvar task = coinit(fib, 10) -- Run task to completion. var res = 0 while fiber.status() != .done: res = coresume fiber print res fiber.reset() fiber.bindArgs(20) -- Run task again with the new argument... Fiber block. # A fiber block is used to construct a fiber without an entry function. *Planned Feature The counting example can be rewritten to:\nvar count = 0 var fiber = coinit: count += 1 -- `count is captured` coyield count += 1 print count -- \u0026#39;0\u0026#39; coresume fiber print count -- \u0026#39;1\u0026#39; coresume fiber print count -- \u0026#39;2\u0026#39; Referencing parent variables from the fiber block automatically captures them just like a function closure.\nPause and resume. # coyield can be used anywhere in a fiber\u0026rsquo;s call stack to pause execution and return to the previous fiber.\nfunc foo(): print \u0026#39;foo\u0026#39; bar() func bar(): -- Nested coyield in call stack. coyield print \u0026#39;bar\u0026#39; var fiber = coinit(foo) coresume fiber coresume also returns the resulting value.\nfunc foo(): return 123 var fiber = coinit(foo) print(coresume fiber) -- \u0026#39;123\u0026#39; coyield can return a value back to coresume. *Planned Feature\nFiber state. # Use Fiber.status() to get the current state of the fiber.\nfunc foo(): coyield print \u0026#39;done\u0026#39; var fiber = coinit(foo) print fiber.status() -- \u0026#39;.paused\u0026#39; coresume fiber print fiber.status() -- \u0026#39;.paused\u0026#39; coresume fiber print fiber.status() -- \u0026#39;.done\u0026#39; The main execution context is a fiber as well. Once the main fiber has finished, the VM is done and control is returned to the host.\nGas mileage. # Planned Feature\nAsync. # Planned Feature\nMulti-thread. # Planned Feature\n"},{"id":8,"href":"/cyber/docs/toc/type-system/","title":"Type System","section":"Table of Contents","content":" Type System. # Cyber supports the use of both dynamically and statically typed code.\nDynamic typing. # Dynamic typing can reduce the amount of friction when writing code, but it can also result in more runtime errors.\nmy declaration. # Variables declared with my are assigned the dynamic type:\nmy a = 123 dynamic vs any # dynamic values can be freely used and copied without any compile errors (if there is a chance it can succeed at runtime, see Recent type inference):\nmy a = 123 func getFirstRune(s string): return s[0] getFirstRune(a) -- RuntimeError. Expected `string`. Since a is dynamic, passing it to a typed function parameter is allowed at compile-time, but will fail when the function is invoked at runtime.\nThe any type on the otherhand is a static type and must be explicitly declared using var:\nvar a any = 123 func getFirstRune(s string): return s[0] getFirstRune(a) -- CompileError. Expected `string`. This same setup will now fail at compile-time because any does not satisfy the destination\u0026rsquo;s string type constraint.\nThe use of the dynamic type effectively defers type checking to runtime while any is a static type and must adhere to type constraints at compile-time.\nA dynamic value can be used in any operation. It can be invoked as the callee, invoked as the receiver of a method call, or used with operators.\nInvoking dynamic values. # When a dynamic value is invoked, checks on whether the callee is a function is deferred to runtime.\nmy op = 123 print op(1, 2, 3) -- RuntimeError. Expected a function. Dynamic return value. # When the return type of a function is not specified, it defaults to the dynamic type. This allows copying the return value to a typed destination without casting:\nfunc getValue(): return 123 func add(a int, b int): return a + b print add(getValue(), 2) -- Prints \u0026#34;125\u0026#34; The add function defers type checking of getValue() to runtime because it has the dynamic type.\nRecent type inference. # Although a dynamic variable has the most flexibility, in some situations it is advantageous to know what type it could be.\nThe compiler keeps a running record of a dynamic variable\u0026rsquo;s most recent type to gain additional compile-time features without sacrificing flexibility. It can prevent inevitable runtime errors and avoid unnecessary type casts.\nWhen a dynamic variable is first initialized, it has a recent type inferred from its initializer. In the following, a has the recent type of int at compile-time because numeric literals default to the int type:\nmy a = 123 The recent type can change at compile-time from another assignment. If a is then assigned to a string literal, a from that point on has the recent type of string at compile-time:\nmy a = 123 foo(a) -- Valid call expression. a = \u0026#39;hello\u0026#39; foo(a) -- CompileError. Expected `int` argument, got `string`. func foo(n int): pass Even though a is dynamic and is usually allowed to defer type checking to runtime, the compiler knows that doing so in this context would always result in a runtime error, so it provides a compile error instead. This provides a quicker feedback to fix the problem.\nThe recent type of a can also change in branches. However, after the branch block, a will have a recent type after merging the types assigned to a from the two branched code paths. Currently, the any type is used if the types from the two branches differ. At the end of the following if block, a has the recent type of any type after merging the int and string types: *Planned Feature\nmy a = 123 if a \u0026gt; 20: a = \u0026#39;hello\u0026#39; foo(a) -- Valid call expression. `foo` can be called without type casting. foo(a) -- CompileError. Expected `string` argument, got `any`. func foo(s string): pass Static typing. # Static typing can be incrementally applied which provides compile-time guarantees and prevents runtime errors. Static typing also makes it easier to maintain and refactor your code.\nBuiltin types. # The following builtin types are available in every module: bool, float, int, string, List, Map, error, fiber, any.\nvar declaration. # A var declaration automatically infers the type from the initializer:\n-- Initialized as an `int` variable. var a = 123 var declarations are strictly for static typing. If the assigned value\u0026rsquo;s type is dynamic, the variable\u0026rsquo;s type becomes any.\nfunc getValue(): return [\u0026#39;a\u0026#39;, \u0026#39;list\u0026#39;] -- Initialized as an `any` variable. var a = getValue() Typed variables. # A typed local variable can be declared by attaching a type specifier after its name. The value assigned to the variable must satisfy the type constraint or a compile error is issued.\nvar a float = 123 var b int = 123.0 -- CompileError. Expected `int`, got `float`. Any operation afterwards that violates the type constraint of the variable will result in a compile error.\na = \u0026#39;hello\u0026#39; -- CompileError. Expected `float`, got `string`. Static variables are declared in a similar way:\nvar Root.global Map = [:] Unlike local variables, static variable declarations do not infer the type from the right hand side. A specific type must be specified or it will default to the any type.\nObject types. # A type object declaration creates a new object type. Field types are optional and declared with a type specifier after their name.\ntype Student object: -- Creates a new type named `Student` var name string var age int var gpa float Instantiating a new object does not require typed fields to be initialized. Missing field values will default to their zero value:\nvar s = [Student:] print s.name -- Prints \u0026#34;\u0026#34; print s.age -- Prints \u0026#34;0\u0026#34; print s.gpa -- Prints \u0026#34;0.0\u0026#34; Circular type dependencies are allowed if the object can be initialized:\nPlanned Feature: Optional types are not currently supported.\ntype Node object: var val any var next Node? -- Valid type specifier. In this example, next has an optional Node? type so it can be initialized to none when creating a new Node object.\nThe following example will fail because this version of Node can not be initialized:\ntype Node object: var val any var next Node var n = [Node:] -- CompileError. Can not zero initialize `next` -- because of circular dependency. Zero values. # The following shows the zero values of builtin or created types.\nType Zero value boolean false int 0 float 0.0 string '' array array('') List [] Map [:] type S object [S:] @host type S object S.$zero() dynamic none any none S? none Type aliases. # A type alias is declared from a single line type statement. This creates a new type symbol for an existing data type.\nimport util \u0026#39;./util.cy\u0026#39; type Vec3 util.Vec3 var v = [Vec3 x: 3, y: 4, z: 5] Functions. # Function parameter and return type specifiers follows a similiar syntax.\nfunc mul(a float, b float) float: return a * b print mul(3, 4) print mul(3, \u0026#39;4\u0026#39;) -- CompileError. Function signature mismatch. Traits. # Planned Feature\nUnion types. # Planned Feature\nany type. # A variable with the any type can hold any value, but copying it to narrowed type destination will result in a compile error:\nfunc square(i int): return i * i var a any = 123 a = [\u0026#39;a\u0026#39;, \u0026#39;list\u0026#39;] -- Valid assignment to a value with a different type. a = 10 print square(a) -- CompileError. Expected `int`, got `any`. a must be explicitly casted to satisfy the type constraint:\nprint square(a as int) -- Prints \u0026#34;100\u0026#34;. Invoking any values. # Since any is a static type, invoking an any value must be explicitly casted to the appropriate function type.\nPlanned Feature: Casting to a function type is not currently supported.\nfunc add(a int, b int) int: return a + b var op any = add print op(1, 2) -- CompileError. Expected `func (int, int) any` var opFunc = op as (func (int, int) int) print opFunc(1, 2) -- Prints \u0026#34;3\u0026#34;. Type casting. # The as keyword can be used to cast a value to a specific type. Casting lets the compiler know what the expected type is and does not perform any conversions.\nIf the compiler knows the cast will always fail at runtime, a compile error is returned instead.\nprint(\u0026#39;123\u0026#39; as int) -- CompileError. Can not cast `string` to `int`. If the cast fails at runtime, a panic is returned.\nvar erased any = 123 add(1, erased as int) -- Success. print(erased as string) -- Panic. Can not cast `int` to `string`. func add(a int, b int): return a + b "},{"id":9,"href":"/cyber/docs/toc/metaprogramming/","title":"Metaprogramming","section":"Table of Contents","content":" Metaprogramming. # Operator overloading. # All operators are implemented as object methods.\nIncomplete: Not all operators have transitioned to the method paradigm.\nNormally this would impact performance, but Cyber generates specialized bytecode for builtin types like int and float. The VM performs inline caching at runtime to eliminate the overhead of evaluating on dynamic operands.\nTo overload an operator for an object type, declare $prefix, $infix, $postfix methods. See the available builtin operators. Since operator names aren\u0026rsquo;t allowed as standard identifiers, they are contained in a string literal.\ntype Vec2 object: var x float var y float func \u0026#39;$infix+\u0026#39;(o Vec2) Vec2: return [Vec2 x: x + o.x, y: y + o.y, ] func \u0026#39;$prefix-\u0026#39;() Vec2: return [Vec2 x: -x, y: -y] var a = [Vec2 x: 1, y: 2] var b = a + [Vec2 x: 3, y: 4] var c = -a Some special operators have their own name. This example overloads the index operator and the set index operator:\ntype MyCollection object: var arr List func \u0026#39;$index\u0026#39;(idx): return arr[idx * 2] func \u0026#39;$setIndex\u0026#39;(idx, val): arr[idx * 2] = val var a = [MyCollection arr: [1, 2, 3, 4]] print a[1] -- Prints `3` Builtin operators. # A list of all supported operators:\nOperator Name Bitwise not $prefix~ Minus $prefix- Greater $infix\u0026gt; Greater equal $infix\u0026gt;= Less $infix\u0026lt; Less equal $infix\u0026lt;= Add $infix+ Subtract $infix- Multiply $infix* Divide $infix/ Modulus $infix% Power $infix^ Bitwise and $infix\u0026amp; Bitwise or $infix| Bitwise xor $infix|| Bitwise left shift $infix\u0026lt;\u0026lt; Bitwise right shift $infix\u0026gt;\u0026gt; Index $index Set index $setIndex Slice $slice Custom operators. # Planned Feature\nMagic functions. # Call module. # Declare a $call function to allow invoking a module as a function.\nIncomplete: Although $call function is supported in the VM and builtin modules use it, it is not currently enabled for user modules.\n-- Object types are also modules. type Vec2 object: var x float var y float func Vec2.\u0026#39;$call\u0026#39;(x float, y float) Vec2: return [Vec2 x: x, y: y] var v = Vec2(1, 2) Getter/Setter. # Planned Feature\nMissing method. # Declare a $missing method as a fallback when a method was not found in an instance.\nPlanned Feature\ntype A object: func \u0026#39;$missing\u0026#39;(args...): return args.len var a = [A:] print a.foo() -- Output: \u0026#39;0\u0026#39; print a.bar(1, 2) -- Output: \u0026#39;2\u0026#39; Reflection. # A metatype object references an internal type. Use the typeof builtin to get the metatype of a value.\nvar val = 123 print typeof(val) -- \u0026#39;type: float\u0026#39; -- Referencing a type as a value also returns its `metatype`. print bool -- \u0026#39;type: bool\u0026#39; Annotations. # Annotations are used to attach modifiers to declarative statements. The @host annotation is used for embedding to bind a host function to a Cyber function:\n@host func compute() float Custom annotations.\nPlanned Feature\nRuntime eval. # Planned Feature\nGenerics. # Planned Feature\nCompile-time. # Planned Feature\n"},{"id":10,"href":"/cyber/docs/toc/embedding/","title":"Embedding","section":"Table of Contents","content":" Embed API. # The Embed API allows embedding the Cyber compiler and VM as a library into applications. Cyber\u0026rsquo;s core types and the CLI app were built using the Embed API.\nThe API is defined in the C header file. The examples shown below can be found in the repository under c-embedded. C is used as the host language, but it can be easily translated to C++ or any C-ABI compatible language.\nTypes from the Embed API begin with Cs, constants begin with CS, and functions begin with cs.\nGetting started. # Create VM. # Most operations are tied to a VM handle. To create a new VM instance, call csCreate:\n#include \u0026#34;cyber.h\u0026#34; int main() { CsVM* vm = csCreate(); // ... csDestroy(vm); return 0; } Override print. # The builtin print function does nothing by default, so it needs to be overrided to print to stdout for example:\nvoid print(CsVM* vm, CsStr str) { printf(\u0026#34;My print: %.*s\\n\u0026#34;, (int)str.len, str.buf); } int main() { // ... csSetPrint(vm, print); // ... } Eval script. # csEval compiles and evaluates a script:\nCsStr src = STR( \u0026#34;var a = 1\\n\u0026#34; \u0026#34;print(a + 2)\\n\u0026#34; ); CsValue val; int res = csEval(vm, src, \u0026amp;val); if (res == CS_SUCCESS) { printf(\u0026#34;Success!\\n\u0026#34;); csRelease(vm, val); } else { const char* report = csNewLastErrorReport(vm); printf(\u0026#34;%s\\n\u0026#34;, report); csFreeStrZ(report); } If a value is returned from the main block of the script, it\u0026rsquo;s saved to the result value argument. Memory is managed by ARC so a value that points to a heap object requires a csRelease when it\u0026rsquo;s no longer needed.\ncsEval returns a result code that indicates whether it was successful.\nModule Loader. # A module loader describes how a module is loaded when an import statement is encountered during script execution. Only one module loader can be active and is set using csSetModuleLoader:\nbool modLoader(CsVM* vm, CsStr spec, CsModuleLoaderResult* out) { if (strncmp(\u0026#34;my_mod\u0026#34;, spec.buf, spec.len) == 0) { out-\u0026gt;src = \u0026#34;@host func add(a float, b float) float\\n\u0026#34; \u0026#34;@host var Root.MyConstant float\\n\u0026#34; \u0026#34;@host var Root.MyList List\\n\u0026#34; \u0026#34;\\n\u0026#34; \u0026#34;@host\\n\u0026#34; \u0026#34;type MyCollection object:\\n\u0026#34; \u0026#34; @host func asList() any\u0026#34; \u0026#34;\\n\u0026#34; \u0026#34;@host func MyCollection.new(a, b) MyCollection\\n\u0026#34;; out-\u0026gt;funcLoader = funcLoader; out-\u0026gt;varLoader = varLoader; out-\u0026gt;typeLoader = typeLoader; return true; } else { // Fallback to the default module loader to load `builtins`. return csDefaultModuleLoader(vm, spec, out); } } int main() { //... csSetModuleLoader(vm, modLoader); //... } The above example checks whether \u0026ldquo;my_mod\u0026rdquo; was imported and returns it\u0026rsquo;s source code. Additional loaders are returned to load the functions, variables, and types from the source code.\nDefault module loader. # Since only one module loader can be set to the VM instance, a custom loader is required to handle the \u0026ldquo;builtins\u0026rdquo; import which contains all of the core types and functions in Cyber. This can simply be delegated to csDefaultModuleLoader.\nFunction loader. # A function loader describes how to load a @host function when it\u0026rsquo;s encountered by the compiler. The loader can bind functions and type methods:\nstruct { char* n; CsFuncFn fn; } funcs[] = { {\u0026#34;add\u0026#34;, add}, {\u0026#34;asList\u0026#34;, myCollectionAsList}, {\u0026#34;MyCollection.new\u0026#34;, myCollectionNew}, }; bool funcLoader(CsVM* vm, CsFuncInfo info, CsFuncResult* out) { // Check that the name matches before setting the function pointer. if (strncmp(funcs[info.idx].n, info.name.buf, info.name.len) == 0) { out-\u0026gt;ptr = funcs[info.idx].fn; return true; } else { return false; } } This example uses the CsFuncInfo.idx of a @host function to index into an array and return a Host function pointer. The name is also compared to ensure it\u0026rsquo;s binding to the correct pointer.\nThis is an efficient way to map Cyber functions to host functions. A different implementation might use a hash table to map the name of the function to it\u0026rsquo;s pointer.\nVariable loader. # A variable loader describes how to load a @host variable when it\u0026rsquo;s encountered by the compiler:\n// C has limited static initializers (and objects require a vm instance) so initialize them in `main`. typedef struct { char* n; CsValue v; } NameValue; NameValue vars[2]; bool varLoader(CsVM* vm, CsVarInfo info, CsValue* out) { // Check that the name matches before setting the value. if (strncmp(vars[info.idx].n, info.name.buf, info.name.len) == 0) { // Objects are consumed by the module. *out = vars[info.idx].v; return true; } else { return false; } } int main() { // ... // Initialize var array for loader. vars[0] = (NameValue){\u0026#34;Root.MyConstant\u0026#34;, csFloat(1.23)}; CsValue myInt = csInteger(123); vars[1] = (NameValue){\u0026#34;Root.MyList\u0026#34;, csNewList(vm, \u0026amp;myInt, 1)}; // ... } This example uses the same technique as the function loader, but it can be much simpler. It doesn\u0026rsquo;t matter how the mapping is done as long as the variable loader returns a CsValue.\nType loader. # A type loader describes how to load a @host type when it\u0026rsquo;s encountered by the compiler:\nCsTypeId myCollectionId; bool typeLoader(CsVM* vm, CsTypeInfo info, CsTypeResult* out) { if (strncmp(\u0026#34;MyCollection\u0026#34;, info.name.buf, info.name.len) == 0) { out-\u0026gt;type = CS_TYPE_OBJECT; out-\u0026gt;data.object.outTypeId = \u0026amp;myCollectionId; out-\u0026gt;data.object.getChildren = myCollectionGetChildren; out-\u0026gt;data.object.finalizer = myCollectionFinalizer; return true; } else { return false; } } When binding to the \u0026ldquo;MyCollection\u0026rdquo; type, it\u0026rsquo;s typeId is saved to outTypeId. This id is then used to create new instances of this type. See Host types.\nHost functions. # A host function requires a specific function signature:\nCsValue add(CsVM* vm, const CsValue* args, uint8_t nargs) { double res = csAsFloat(args[0]) + csAsFloat(args[1]); return csFloat(res); } A host function should always return a CsValue. csNone() can be returned if the function does not intend to return any value.\nHost types. # A host type are types that are opaque to Cyber scripts but still behave like an object. They can have type functions and methods.\nOnly the host application can directly create new instances of them, so usually a function is binded to expose a constructor to the user script:\n// Binding a C struct with it\u0026#39;s own children and finalizer. // This struct retains 2 VM values and has 2 arbitrary data values unrelated to the VM. typedef struct MyCollection { CsValue val1; CsValue val2; int a; double b; } MyCollection; // Implement the `new` function in MyCollection. CsValue myCollectionNew(CsVM* vm, const CsValue* args, uint8_t nargs) { // Instantiate our object. CsValue new = csNewHostObject(vm, myCollectionId, sizeof(MyCollection)); MyCollection* my = (MyCollection*)csAsHostObject(new); // Assign the constructor args passed in and retain them since the new object now references them. csRetain(vm, args[0]); my-\u0026gt;val1 = args[0]; csRetain(vm, args[1]); my-\u0026gt;val2 = args[1]; // Assign non VM values. my-\u0026gt;a = 123; my-\u0026gt;b = 9999.999; return new; } csNewHostObject takes the type id (returned from the Type loader) and size (in bytes) and returns a new heap object. Note that the size is allowed to vary. Different instances of the same type can occupy different amounts of memory.\ngetChildren # Since MyCollection contains CsValue children, the Type loader requires a getChildren callback so that memory management can reach them:\nCsValueSlice myCollectionGetChildren(CsVM* vm, void* obj) { MyCollection* my = (MyCollection*)obj; return (CsValueSlice){ .ptr = \u0026amp;my-\u0026gt;val1, .len = 2 }; } finalizer # A type finalizer is optional since the memory and children of an instance will be freed automatically by ARC. However, it can be useful to perform additional cleanup tasks for instances that contain external resources.\nvoid myCollectionFinalizer(CsVM* vm, void* obj) { printf(\u0026#34;MyCollection finalizer was called.\\n\u0026#34;); } "},{"id":11,"href":"/cyber/docs/toc/memory/","title":"Memory","section":"Table of Contents","content":" Memory. # Cyber provides memory safety by default.\nARC. # Cyber uses ARC or automatic reference counting to manage memory. ARC is deterministic and has less overhead compared to a tracing garbage collector. Reference counting distributes memory management, which reduces GC pauses and makes ARC suitable for realtime applications. One common issue in ARC implementations is reference cycles which Cyber addresses with Weak References and it\u0026rsquo;s very own Cycle Detection.\nReference Counting. # In Cyber, there are primitive and object values. Primitives don\u0026rsquo;t need any memory management, since they are copied by value and no heap allocation is required (with the exception of primitives being captured by a closure).\nObjects are managed by ARC. Each object has its own reference counter. Upon creating a new object, it receives a reference count of 1. When the object is copied, it\u0026rsquo;s retained and the reference count increments by 1. When an object value is removed from it\u0026rsquo;s parent or is no longer reachable in the current stack frame, it is released and the reference count decrements by 1.\nOnce the reference count reaches 0 the object begins its destruction procedure. First, child references are released thereby decrementing their reference counts by 1. If the object is a host object, it will invoke its finalizer function. Afterwards, the object is freed from memory.\nOptimizations. # The compiler can reduce the number of retain/release ops since it can infer value types even though they are dynamically typed to the user. Arguments passed to functions are only retained depending on the analysis from the callsite.\nClosures. # When primitive variables are captured by a closure, they are boxed and allocated on the heap. This means they are managed by ARC and cleaned up when there are no more references to them.\nFibers. # Fibers are freed by ARC just like any other object. Once there are no references to the fiber, it begins to release it\u0026rsquo;s child references by unwinding it\u0026rsquo;s call stack.\nHeap. # Many object types in Cyber are small enough to be at or under 40 bytes. To take advantage of this, Cyber can reserve object pools to quickly allocate and free these small objects with very little bookkeeping. Bigger objects are allocated and managed by mimalloc which has proven to be a fast and reliable general-purpose heap allocator.\nWeak References. # Planned Feature\nCycle Detection. # The cycle detector is also considered a GC and frees abandoned objects managed by ARC. Although weak references can remove cycles altogether, Cyber does not force you to use them and provides a manual GC as a one-time catch all solution.\nIncomplete Feature: Only the main fiber stack is cleaned up at the moment.\nTo invoke the GC, call the builtin function: performGC.\nfunc foo(): -- Create a reference cycle. var a = [] var b = [] a.append(b) b.append(a) -- Cycle still alive in the current stack so no cleanup is done. var res = performGC() print res[\u0026#39;numCycFreed\u0026#39;] -- Output: 0 print res[\u0026#39;numObjFreed\u0026#39;] -- Output: 0 foo() -- `a` and `b` are no longer reachable, so the GC does work. var res = performGC() print res[\u0026#39;numCycFreed\u0026#39;] -- Output: 2 print res[\u0026#39;numObjFreed\u0026#39;] -- Output: 2 "},{"id":12,"href":"/cyber/docs/toc/aot-jit/","title":"AOT/JIT","section":"Table of Contents","content":" JIT # Cyber\u0026rsquo;s just-in-time compiler is incomplete and unstable. To run your script with JIT enabled:\ncyber -jit \u0026lt;script\u0026gt; The JIT compiler is just as fast as the bytecode generation so when it\u0026rsquo;s enabled, the entire script is compiled from the start.\nAOT # Work on the ahead-of-time compiler has not begun.\n"}] \ No newline at end of file diff --git a/en.search.min.54914396522947ee2cd15cfb7cfb84c86d5e41d03376665e9b92e44f3871f1ee.js b/en.search.min.54914396522947ee2cd15cfb7cfb84c86d5e41d03376665e9b92e44f3871f1ee.js deleted file mode 100644 index e943a1dd5..000000000 --- a/en.search.min.54914396522947ee2cd15cfb7cfb84c86d5e41d03376665e9b92e44f3871f1ee.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(function(){const o="/cyber/en.search-data.min.0750042693284b01efa8fa1d7155f30d0d6e0ad4b200d593276e289c682e49bb.json",i=Object.assign({cache:!0},{doc:{id:"id",field:["title","content"],store:["title","href","section"]}}),e=document.querySelector("#book-search-input"),t=document.querySelector("#book-search-results");if(!e)return;e.addEventListener("focus",n),e.addEventListener("keyup",s),document.addEventListener("keypress",a);function a(t){if(t.target.value!==void 0)return;if(e===document.activeElement)return;const n=String.fromCharCode(t.charCode);if(!r(n))return;e.focus(),t.preventDefault()}function r(t){const n=e.getAttribute("data-hotkeys")||"";return n.indexOf(t)>=0}function n(){e.removeEventListener("focus",n),e.required=!0,fetch(o).then(e=>e.json()).then(e=>{window.bookSearchIndex=FlexSearch.create("balance",i),window.bookSearchIndex.add(e)}).then(()=>e.required=!1).then(s)}function s(){for(;t.firstChild;)t.removeChild(t.firstChild);if(!e.value)return;const n=window.bookSearchIndex.search(e.value,10);n.forEach(function(e){const n=c("
  • "),s=n.querySelector("a"),o=n.querySelector("small");s.href=e.href,s.textContent=e.title,o.textContent=e.section,t.appendChild(n)})}function c(e){const t=document.createElement("div");return t.innerHTML=e,t.firstChild}})() \ No newline at end of file diff --git a/favicon.png b/favicon.png deleted file mode 100644 index 59c7c2a21..000000000 Binary files a/favicon.png and /dev/null differ diff --git a/favicon.svg b/favicon.svg deleted file mode 100644 index a3c696de2..000000000 --- a/favicon.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/flexsearch.min.js b/flexsearch.min.js deleted file mode 100644 index 984d8c6e6..000000000 --- a/flexsearch.min.js +++ /dev/null @@ -1,42 +0,0 @@ -/* - FlexSearch v0.6.30 - Copyright 2019 Nextapps GmbH - Author: Thomas Wilkerling - Released under the Apache 2.0 Licence - https://github.com/nextapps-de/flexsearch -*/ -'use strict';(function(K,R,w){let L;(L=w.define)&&L.amd?L([],function(){return R}):(L=w.modules)?L[K.toLowerCase()]=R:"object"===typeof exports?module.exports=R:w[K]=R})("FlexSearch",function ma(K){function w(a,c){const b=c?c.id:a&&a.id;this.id=b||0===b?b:na++;this.init(a,c);fa(this,"index",function(){return this.a?Object.keys(this.a.index[this.a.keys[0]].c):Object.keys(this.c)});fa(this,"length",function(){return this.index.length})}function L(a,c,b,d){this.u!==this.g&&(this.o=this.o.concat(b),this.u++, -d&&this.o.length>=d&&(this.u=this.g),this.u===this.g&&(this.cache&&this.j.set(c,this.o),this.F&&this.F(this.o)));return this}function S(a){const c=B();for(const b in a)if(a.hasOwnProperty(b)){const d=a[b];F(d)?c[b]=d.slice(0):G(d)?c[b]=S(d):c[b]=d}return c}function W(a,c){const b=a.length,d=O(c),e=[];for(let f=0,h=0;f=h&&(a=a[g-(e+.5>>0)],a=a[b]||(a[b]=[]), -a[a.length]=d);return e}function ba(a,c){if(a){const b=Object.keys(a);for(let d=0,e=b.length;da?1:a?-1:0}function pa(a,c){a=a[M];c=c[M];return ac?1:0}function oa(a,c){const b=M.length;for(let d=0;dc?1:0}function T(a,c,b){return a?{page:a,next:c?""+c:null,result:b}:b}function ha(a,c,b,d,e,f,h){let g,k=[];if(!0===b){b="0";var l=""}else l=b&&b.split(":");const p=a.length;if(1h&&(l=0),l=l||0,g=l+c,g=this.m.length&&(this.C=0),this.m[this.C].postMessage({add:!0,id:a, -content:c}),this.c[f]=""+this.C,b&&b(),this;if(!e){if(this.async&&"function"!==typeof importScripts){let t=this;f=new Promise(function(v){setTimeout(function(){t.add(a,c,null,d,!0);t=null;v()})});if(b)f.then(b);else return f;return this}if(b)return this.add(a,c,null,d,!0),b(),this}c=this.encode(c);if(!c.length)return this;b=this.f;e=O(b)?b(c):c.split(this.split);this.filter&&(e=W(e,this.filter));const n=B();n._ctx=B();const m=e.length,u=this.threshold,q=this.depth,A=this.b,z=this.i,y=this.D;for(let t= -0;tp;x--)l=h.substring(p,x),V(z,n,l,a,v,k,u,A-1)}break;default:if(g=V(z,n,h,a,1,k,u,A-1),q&&1=u)for(g=n._ctx[h]||(n._ctx[h]=B()),h=this.h[h]||(this.h[h]=ia(A-(u||0))),k=t-q,l=t+q+1,0>k&&(k=0),l> -m&&(l=m);kh;d--)e=g[d-1],g[d]=e,f[e]=d;g[h]=c;f[c]=h}}}return b};return a}();return w}(function(){const K={},R="undefined"!==typeof Blob&& -"undefined"!==typeof URL&&URL.createObjectURL;return function(w,L,S,W,P){S=R?URL.createObjectURL(new Blob(["("+S.toString()+")()"],{type:"text/javascript"})):w+".min.js";w+="-"+L;K[w]||(K[w]=[]);K[w][P]=new Worker(S);K[w][P].onmessage=W;return K[w][P]}}()),this); diff --git a/fonts/roboto-mono-v13-latin-regular.woff b/fonts/roboto-mono-v13-latin-regular.woff deleted file mode 100644 index f319fbfa4..000000000 Binary files a/fonts/roboto-mono-v13-latin-regular.woff and /dev/null differ diff --git a/fonts/roboto-mono-v13-latin-regular.woff2 b/fonts/roboto-mono-v13-latin-regular.woff2 deleted file mode 100644 index ed384d22f..000000000 Binary files a/fonts/roboto-mono-v13-latin-regular.woff2 and /dev/null differ diff --git a/fonts/roboto-v27-latin-700.woff b/fonts/roboto-v27-latin-700.woff deleted file mode 100644 index a5d98fc62..000000000 Binary files a/fonts/roboto-v27-latin-700.woff and /dev/null differ diff --git a/fonts/roboto-v27-latin-700.woff2 b/fonts/roboto-v27-latin-700.woff2 deleted file mode 100644 index 01d05fa50..000000000 Binary files a/fonts/roboto-v27-latin-700.woff2 and /dev/null differ diff --git a/fonts/roboto-v27-latin-regular.woff b/fonts/roboto-v27-latin-regular.woff deleted file mode 100644 index 86b386372..000000000 Binary files a/fonts/roboto-v27-latin-regular.woff and /dev/null differ diff --git a/fonts/roboto-v27-latin-regular.woff2 b/fonts/roboto-v27-latin-regular.woff2 deleted file mode 100644 index ebe1795f8..000000000 Binary files a/fonts/roboto-v27-latin-regular.woff2 and /dev/null differ diff --git a/highlight.min.js b/highlight.min.js deleted file mode 100644 index c7555dbe0..000000000 --- a/highlight.min.js +++ /dev/null @@ -1,1202 +0,0 @@ -/*! - Highlight.js v11.7.0 (git: 82688fad18) - (c) 2006-2022 undefined and other contributors - License: BSD-3-Clause - */ - var hljs=function(){"use strict";var e={exports:{}};function n(e){ - return e instanceof Map?e.clear=e.delete=e.set=()=>{ - throw Error("map is read-only")}:e instanceof Set&&(e.add=e.clear=e.delete=()=>{ - throw Error("set is read-only") - }),Object.freeze(e),Object.getOwnPropertyNames(e).forEach((t=>{var a=e[t] - ;"object"!=typeof a||Object.isFrozen(a)||n(a)})),e} - e.exports=n,e.exports.default=n;class t{constructor(e){ - void 0===e.data&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1} - ignoreMatch(){this.isMatchIgnored=!0}}function a(e){ - return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'") - }function i(e,...n){const t=Object.create(null);for(const n in e)t[n]=e[n] - ;return n.forEach((e=>{for(const n in e)t[n]=e[n]})),t} - const r=e=>!!e.scope||e.sublanguage&&e.language;class s{constructor(e,n){ - this.buffer="",this.classPrefix=n.classPrefix,e.walk(this)}addText(e){ - this.buffer+=a(e)}openNode(e){if(!r(e))return;let n="" - ;n=e.sublanguage?"language-"+e.language:((e,{prefix:n})=>{if(e.includes(".")){ - const t=e.split(".") - ;return[`${n}${t.shift()}`,...t.map(((e,n)=>`${e}${"_".repeat(n+1)}`))].join(" ") - }return`${n}${e}`})(e.scope,{prefix:this.classPrefix}),this.span(n)} - closeNode(e){r(e)&&(this.buffer+="")}value(){return this.buffer}span(e){ - this.buffer+=``}}const o=(e={})=>{const n={children:[]} - ;return Object.assign(n,e),n};class l{constructor(){ - this.rootNode=o(),this.stack=[this.rootNode]}get top(){ - return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){ - this.top.children.push(e)}openNode(e){const n=o({scope:e}) - ;this.add(n),this.stack.push(n)}closeNode(){ - if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){ - for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)} - walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,n){ - return"string"==typeof n?e.addText(n):n.children&&(e.openNode(n), - n.children.forEach((n=>this._walk(e,n))),e.closeNode(n)),e}static _collapse(e){ - "string"!=typeof e&&e.children&&(e.children.every((e=>"string"==typeof e))?e.children=[e.children.join("")]:e.children.forEach((e=>{ - l._collapse(e)})))}}class c extends l{constructor(e){super(),this.options=e} - addKeyword(e,n){""!==e&&(this.openNode(n),this.addText(e),this.closeNode())} - addText(e){""!==e&&this.add(e)}addSublanguage(e,n){const t=e.root - ;t.sublanguage=!0,t.language=n,this.add(t)}toHTML(){ - return new s(this,this.options).value()}finalize(){return!0}}function d(e){ - return e?"string"==typeof e?e:e.source:null}function g(e){return m("(?=",e,")")} - function u(e){return m("(?:",e,")*")}function b(e){return m("(?:",e,")?")} - function m(...e){return e.map((e=>d(e))).join("")}function p(...e){const n=(e=>{ - const n=e[e.length-1] - ;return"object"==typeof n&&n.constructor===Object?(e.splice(e.length-1,1),n):{} - })(e);return"("+(n.capture?"":"?:")+e.map((e=>d(e))).join("|")+")"} - function _(e){return RegExp(e.toString()+"|").exec("").length-1} - const h=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./ - ;function f(e,{joinWith:n}){let t=0;return e.map((e=>{t+=1;const n=t - ;let a=d(e),i="";for(;a.length>0;){const e=h.exec(a);if(!e){i+=a;break} - i+=a.substring(0,e.index), - a=a.substring(e.index+e[0].length),"\\"===e[0][0]&&e[1]?i+="\\"+(Number(e[1])+n):(i+=e[0], - "("===e[0]&&t++)}return i})).map((e=>`(${e})`)).join(n)} - const E="[a-zA-Z]\\w*",y="[a-zA-Z_]\\w*",w="\\b\\d+(\\.\\d+)?",N="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",v="\\b(0b[01]+)",O={ - begin:"\\\\[\\s\\S]",relevance:0},k={scope:"string",begin:"'",end:"'", - illegal:"\\n",contains:[O]},x={scope:"string",begin:'"',end:'"',illegal:"\\n", - contains:[O]},M=(e,n,t={})=>{const a=i({scope:"comment",begin:e,end:n, - contains:[]},t);a.contains.push({scope:"doctag", - begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)", - end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0}) - ;const r=p("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/) - ;return a.contains.push({begin:m(/[ ]+/,"(",r,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),a - },S=M("//","$"),A=M("/\\*","\\*/"),C=M("#","$");var T=Object.freeze({ - __proto__:null,MATCH_NOTHING_RE:/\b\B/,IDENT_RE:E,UNDERSCORE_IDENT_RE:y, - NUMBER_RE:w,C_NUMBER_RE:N,BINARY_NUMBER_RE:v, - RE_STARTERS_RE:"!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~", - SHEBANG:(e={})=>{const n=/^#![ ]*\// - ;return e.binary&&(e.begin=m(n,/.*\b/,e.binary,/\b.*/)),i({scope:"meta",begin:n, - end:/$/,relevance:0,"on:begin":(e,n)=>{0!==e.index&&n.ignoreMatch()}},e)}, - BACKSLASH_ESCAPE:O,APOS_STRING_MODE:k,QUOTE_STRING_MODE:x,PHRASAL_WORDS_MODE:{ - begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/ - },COMMENT:M,C_LINE_COMMENT_MODE:S,C_BLOCK_COMMENT_MODE:A,HASH_COMMENT_MODE:C, - NUMBER_MODE:{scope:"number",begin:w,relevance:0},C_NUMBER_MODE:{scope:"number", - begin:N,relevance:0},BINARY_NUMBER_MODE:{scope:"number",begin:v,relevance:0}, - REGEXP_MODE:{begin:/(?=\/[^/\n]*\/)/,contains:[{scope:"regexp",begin:/\//, - end:/\/[gimuy]*/,illegal:/\n/,contains:[O,{begin:/\[/,end:/\]/,relevance:0, - contains:[O]}]}]},TITLE_MODE:{scope:"title",begin:E,relevance:0}, - UNDERSCORE_TITLE_MODE:{scope:"title",begin:y,relevance:0},METHOD_GUARD:{ - begin:"\\.\\s*[a-zA-Z_]\\w*",relevance:0},END_SAME_AS_BEGIN:e=>Object.assign(e,{ - "on:begin":(e,n)=>{n.data._beginMatch=e[1]},"on:end":(e,n)=>{ - n.data._beginMatch!==e[1]&&n.ignoreMatch()}})});function R(e,n){ - "."===e.input[e.index-1]&&n.ignoreMatch()}function D(e,n){ - void 0!==e.className&&(e.scope=e.className,delete e.className)}function I(e,n){ - n&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)", - e.__beforeBegin=R,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords, - void 0===e.relevance&&(e.relevance=0))}function L(e,n){ - Array.isArray(e.illegal)&&(e.illegal=p(...e.illegal))}function B(e,n){ - if(e.match){ - if(e.begin||e.end)throw Error("begin & end are not supported with match") - ;e.begin=e.match,delete e.match}}function $(e,n){ - void 0===e.relevance&&(e.relevance=1)}const z=(e,n)=>{if(!e.beforeMatch)return - ;if(e.starts)throw Error("beforeMatch cannot be used with starts") - ;const t=Object.assign({},e);Object.keys(e).forEach((n=>{delete e[n] - })),e.keywords=t.keywords,e.begin=m(t.beforeMatch,g(t.begin)),e.starts={ - relevance:0,contains:[Object.assign(t,{endsParent:!0})] - },e.relevance=0,delete t.beforeMatch - },F=["of","and","for","in","not","or","if","then","parent","list","value"] - ;function U(e,n,t="keyword"){const a=Object.create(null) - ;return"string"==typeof e?i(t,e.split(" ")):Array.isArray(e)?i(t,e):Object.keys(e).forEach((t=>{ - Object.assign(a,U(e[t],n,t))})),a;function i(e,t){ - n&&(t=t.map((e=>e.toLowerCase()))),t.forEach((n=>{const t=n.split("|") - ;a[t[0]]=[e,j(t[0],t[1])]}))}}function j(e,n){ - return n?Number(n):(e=>F.includes(e.toLowerCase()))(e)?0:1}const P={},K=e=>{ - console.error(e)},H=(e,...n)=>{console.log("WARN: "+e,...n)},q=(e,n)=>{ - P[`${e}/${n}`]||(console.log(`Deprecated as of ${e}. ${n}`),P[`${e}/${n}`]=!0) - },Z=Error();function G(e,n,{key:t}){let a=0;const i=e[t],r={},s={} - ;for(let e=1;e<=n.length;e++)s[e+a]=i[e],r[e+a]=!0,a+=_(n[e-1]) - ;e[t]=s,e[t]._emit=r,e[t]._multi=!0}function W(e){(e=>{ - e.scope&&"object"==typeof e.scope&&null!==e.scope&&(e.beginScope=e.scope, - delete e.scope)})(e),"string"==typeof e.beginScope&&(e.beginScope={ - _wrap:e.beginScope}),"string"==typeof e.endScope&&(e.endScope={_wrap:e.endScope - }),(e=>{if(Array.isArray(e.begin)){ - if(e.skip||e.excludeBegin||e.returnBegin)throw K("skip, excludeBegin, returnBegin not compatible with beginScope: {}"), - Z - ;if("object"!=typeof e.beginScope||null===e.beginScope)throw K("beginScope must be object"), - Z;G(e,e.begin,{key:"beginScope"}),e.begin=f(e.begin,{joinWith:""})}})(e),(e=>{ - if(Array.isArray(e.end)){ - if(e.skip||e.excludeEnd||e.returnEnd)throw K("skip, excludeEnd, returnEnd not compatible with endScope: {}"), - Z - ;if("object"!=typeof e.endScope||null===e.endScope)throw K("endScope must be object"), - Z;G(e,e.end,{key:"endScope"}),e.end=f(e.end,{joinWith:""})}})(e)}function Q(e){ - function n(n,t){ - return RegExp(d(n),"m"+(e.case_insensitive?"i":"")+(e.unicodeRegex?"u":"")+(t?"g":"")) - }class t{constructor(){ - this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0} - addRule(e,n){ - n.position=this.position++,this.matchIndexes[this.matchAt]=n,this.regexes.push([n,e]), - this.matchAt+=_(e)+1}compile(){0===this.regexes.length&&(this.exec=()=>null) - ;const e=this.regexes.map((e=>e[1]));this.matcherRe=n(f(e,{joinWith:"|" - }),!0),this.lastIndex=0}exec(e){this.matcherRe.lastIndex=this.lastIndex - ;const n=this.matcherRe.exec(e);if(!n)return null - ;const t=n.findIndex(((e,n)=>n>0&&void 0!==e)),a=this.matchIndexes[t] - ;return n.splice(0,t),Object.assign(n,a)}}class a{constructor(){ - this.rules=[],this.multiRegexes=[], - this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(e){ - if(this.multiRegexes[e])return this.multiRegexes[e];const n=new t - ;return this.rules.slice(e).forEach((([e,t])=>n.addRule(e,t))), - n.compile(),this.multiRegexes[e]=n,n}resumingScanAtSamePosition(){ - return 0!==this.regexIndex}considerAll(){this.regexIndex=0}addRule(e,n){ - this.rules.push([e,n]),"begin"===n.type&&this.count++}exec(e){ - const n=this.getMatcher(this.regexIndex);n.lastIndex=this.lastIndex - ;let t=n.exec(e) - ;if(this.resumingScanAtSamePosition())if(t&&t.index===this.lastIndex);else{ - const n=this.getMatcher(0);n.lastIndex=this.lastIndex+1,t=n.exec(e)} - return t&&(this.regexIndex+=t.position+1, - this.regexIndex===this.count&&this.considerAll()),t}} - if(e.compilerExtensions||(e.compilerExtensions=[]), - e.contains&&e.contains.includes("self"))throw Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.") - ;return e.classNameAliases=i(e.classNameAliases||{}),function t(r,s){const o=r - ;if(r.isCompiled)return o - ;[D,B,W,z].forEach((e=>e(r,s))),e.compilerExtensions.forEach((e=>e(r,s))), - r.__beforeBegin=null,[I,L,$].forEach((e=>e(r,s))),r.isCompiled=!0;let l=null - ;return"object"==typeof r.keywords&&r.keywords.$pattern&&(r.keywords=Object.assign({},r.keywords), - l=r.keywords.$pattern, - delete r.keywords.$pattern),l=l||/\w+/,r.keywords&&(r.keywords=U(r.keywords,e.case_insensitive)), - o.keywordPatternRe=n(l,!0), - s&&(r.begin||(r.begin=/\B|\b/),o.beginRe=n(o.begin),r.end||r.endsWithParent||(r.end=/\B|\b/), - r.end&&(o.endRe=n(o.end)), - o.terminatorEnd=d(o.end)||"",r.endsWithParent&&s.terminatorEnd&&(o.terminatorEnd+=(r.end?"|":"")+s.terminatorEnd)), - r.illegal&&(o.illegalRe=n(r.illegal)), - r.contains||(r.contains=[]),r.contains=[].concat(...r.contains.map((e=>(e=>(e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map((n=>i(e,{ - variants:null},n)))),e.cachedVariants?e.cachedVariants:X(e)?i(e,{ - starts:e.starts?i(e.starts):null - }):Object.isFrozen(e)?i(e):e))("self"===e?r:e)))),r.contains.forEach((e=>{t(e,o) - })),r.starts&&t(r.starts,s),o.matcher=(e=>{const n=new a - ;return e.contains.forEach((e=>n.addRule(e.begin,{rule:e,type:"begin" - }))),e.terminatorEnd&&n.addRule(e.terminatorEnd,{type:"end" - }),e.illegal&&n.addRule(e.illegal,{type:"illegal"}),n})(o),o}(e)}function X(e){ - return!!e&&(e.endsWithParent||X(e.starts))}class V extends Error{ - constructor(e,n){super(e),this.name="HTMLInjectionError",this.html=n}} - const J=a,Y=i,ee=Symbol("nomatch");var ne=(n=>{ - const a=Object.create(null),i=Object.create(null),r=[];let s=!0 - ;const o="Could not find the language '{}', did you forget to load/include a language module?",l={ - disableAutodetect:!0,name:"Plain text",contains:[]};let d={ - ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i, - languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-", - cssSelector:"pre code",languages:null,__emitter:c};function _(e){ - return d.noHighlightRe.test(e)}function h(e,n,t){let a="",i="" - ;"object"==typeof n?(a=e, - t=n.ignoreIllegals,i=n.language):(q("10.7.0","highlight(lang, code, ...args) has been deprecated."), - q("10.7.0","Please use highlight(code, options) instead.\nhttps://github.com/highlightjs/highlight.js/issues/2277"), - i=e,a=n),void 0===t&&(t=!0);const r={code:a,language:i};x("before:highlight",r) - ;const s=r.result?r.result:f(r.language,r.code,t) - ;return s.code=r.code,x("after:highlight",s),s}function f(e,n,i,r){ - const l=Object.create(null);function c(){if(!k.keywords)return void M.addText(S) - ;let e=0;k.keywordPatternRe.lastIndex=0;let n=k.keywordPatternRe.exec(S),t="" - ;for(;n;){t+=S.substring(e,n.index) - ;const i=w.case_insensitive?n[0].toLowerCase():n[0],r=(a=i,k.keywords[a]);if(r){ - const[e,a]=r - ;if(M.addText(t),t="",l[i]=(l[i]||0)+1,l[i]<=7&&(A+=a),e.startsWith("_"))t+=n[0];else{ - const t=w.classNameAliases[e]||e;M.addKeyword(n[0],t)}}else t+=n[0] - ;e=k.keywordPatternRe.lastIndex,n=k.keywordPatternRe.exec(S)}var a - ;t+=S.substring(e),M.addText(t)}function g(){null!=k.subLanguage?(()=>{ - if(""===S)return;let e=null;if("string"==typeof k.subLanguage){ - if(!a[k.subLanguage])return void M.addText(S) - ;e=f(k.subLanguage,S,!0,x[k.subLanguage]),x[k.subLanguage]=e._top - }else e=E(S,k.subLanguage.length?k.subLanguage:null) - ;k.relevance>0&&(A+=e.relevance),M.addSublanguage(e._emitter,e.language) - })():c(),S=""}function u(e,n){let t=1;const a=n.length-1;for(;t<=a;){ - if(!e._emit[t]){t++;continue}const a=w.classNameAliases[e[t]]||e[t],i=n[t] - ;a?M.addKeyword(i,a):(S=i,c(),S=""),t++}}function b(e,n){ - return e.scope&&"string"==typeof e.scope&&M.openNode(w.classNameAliases[e.scope]||e.scope), - e.beginScope&&(e.beginScope._wrap?(M.addKeyword(S,w.classNameAliases[e.beginScope._wrap]||e.beginScope._wrap), - S=""):e.beginScope._multi&&(u(e.beginScope,n),S="")),k=Object.create(e,{parent:{ - value:k}}),k}function m(e,n,a){let i=((e,n)=>{const t=e&&e.exec(n) - ;return t&&0===t.index})(e.endRe,a);if(i){if(e["on:end"]){const a=new t(e) - ;e["on:end"](n,a),a.isMatchIgnored&&(i=!1)}if(i){ - for(;e.endsParent&&e.parent;)e=e.parent;return e}} - if(e.endsWithParent)return m(e.parent,n,a)}function p(e){ - return 0===k.matcher.regexIndex?(S+=e[0],1):(R=!0,0)}function _(e){ - const t=e[0],a=n.substring(e.index),i=m(k,e,a);if(!i)return ee;const r=k - ;k.endScope&&k.endScope._wrap?(g(), - M.addKeyword(t,k.endScope._wrap)):k.endScope&&k.endScope._multi?(g(), - u(k.endScope,e)):r.skip?S+=t:(r.returnEnd||r.excludeEnd||(S+=t), - g(),r.excludeEnd&&(S=t));do{ - k.scope&&M.closeNode(),k.skip||k.subLanguage||(A+=k.relevance),k=k.parent - }while(k!==i.parent);return i.starts&&b(i.starts,e),r.returnEnd?0:t.length} - let h={};function y(a,r){const o=r&&r[0];if(S+=a,null==o)return g(),0 - ;if("begin"===h.type&&"end"===r.type&&h.index===r.index&&""===o){ - if(S+=n.slice(r.index,r.index+1),!s){const n=Error(`0 width match regex (${e})`) - ;throw n.languageName=e,n.badRule=h.rule,n}return 1} - if(h=r,"begin"===r.type)return(e=>{ - const n=e[0],a=e.rule,i=new t(a),r=[a.__beforeBegin,a["on:begin"]] - ;for(const t of r)if(t&&(t(e,i),i.isMatchIgnored))return p(n) - ;return a.skip?S+=n:(a.excludeBegin&&(S+=n), - g(),a.returnBegin||a.excludeBegin||(S=n)),b(a,e),a.returnBegin?0:n.length})(r) - ;if("illegal"===r.type&&!i){ - const e=Error('Illegal lexeme "'+o+'" for mode "'+(k.scope||"")+'"') - ;throw e.mode=k,e}if("end"===r.type){const e=_(r);if(e!==ee)return e} - if("illegal"===r.type&&""===o)return 1 - ;if(T>1e5&&T>3*r.index)throw Error("potential infinite loop, way more iterations than matches") - ;return S+=o,o.length}const w=v(e) - ;if(!w)throw K(o.replace("{}",e)),Error('Unknown language: "'+e+'"') - ;const N=Q(w);let O="",k=r||N;const x={},M=new d.__emitter(d);(()=>{const e=[] - ;for(let n=k;n!==w;n=n.parent)n.scope&&e.unshift(n.scope) - ;e.forEach((e=>M.openNode(e)))})();let S="",A=0,C=0,T=0,R=!1;try{ - for(k.matcher.considerAll();;){ - T++,R?R=!1:k.matcher.considerAll(),k.matcher.lastIndex=C - ;const e=k.matcher.exec(n);if(!e)break;const t=y(n.substring(C,e.index),e) - ;C=e.index+t} - return y(n.substring(C)),M.closeAllNodes(),M.finalize(),O=M.toHTML(),{ - language:e,value:O,relevance:A,illegal:!1,_emitter:M,_top:k}}catch(t){ - if(t.message&&t.message.includes("Illegal"))return{language:e,value:J(n), - illegal:!0,relevance:0,_illegalBy:{message:t.message,index:C, - context:n.slice(C-100,C+100),mode:t.mode,resultSoFar:O},_emitter:M};if(s)return{ - language:e,value:J(n),illegal:!1,relevance:0,errorRaised:t,_emitter:M,_top:k} - ;throw t}}function E(e,n){n=n||d.languages||Object.keys(a);const t=(e=>{ - const n={value:J(e),illegal:!1,relevance:0,_top:l,_emitter:new d.__emitter(d)} - ;return n._emitter.addText(e),n})(e),i=n.filter(v).filter(k).map((n=>f(n,e,!1))) - ;i.unshift(t);const r=i.sort(((e,n)=>{ - if(e.relevance!==n.relevance)return n.relevance-e.relevance - ;if(e.language&&n.language){if(v(e.language).supersetOf===n.language)return 1 - ;if(v(n.language).supersetOf===e.language)return-1}return 0})),[s,o]=r,c=s - ;return c.secondBest=o,c}function y(e){let n=null;const t=(e=>{ - let n=e.className+" ";n+=e.parentNode?e.parentNode.className:"" - ;const t=d.languageDetectRe.exec(n);if(t){const n=v(t[1]) - ;return n||(H(o.replace("{}",t[1])), - H("Falling back to no-highlight mode for this block.",e)),n?t[1]:"no-highlight"} - return n.split(/\s+/).find((e=>_(e)||v(e)))})(e);if(_(t))return - ;if(x("before:highlightElement",{el:e,language:t - }),e.children.length>0&&(d.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."), - console.warn("https://github.com/highlightjs/highlight.js/wiki/security"), - console.warn("The element with unescaped HTML:"), - console.warn(e)),d.throwUnescapedHTML))throw new V("One of your code blocks includes unescaped HTML.",e.innerHTML) - ;n=e;const a=n.textContent,r=t?h(a,{language:t,ignoreIllegals:!0}):E(a) - ;e.innerHTML=r.value,((e,n,t)=>{const a=n&&i[n]||t - ;e.classList.add("hljs"),e.classList.add("language-"+a) - })(e,t,r.language),e.result={language:r.language,re:r.relevance, - relevance:r.relevance},r.secondBest&&(e.secondBest={ - language:r.secondBest.language,relevance:r.secondBest.relevance - }),x("after:highlightElement",{el:e,result:r,text:a})}let w=!1;function N(){ - "loading"!==document.readyState?document.querySelectorAll(d.cssSelector).forEach(y):w=!0 - }function v(e){return e=(e||"").toLowerCase(),a[e]||a[i[e]]} - function O(e,{languageName:n}){"string"==typeof e&&(e=[e]),e.forEach((e=>{ - i[e.toLowerCase()]=n}))}function k(e){const n=v(e) - ;return n&&!n.disableAutodetect}function x(e,n){const t=e;r.forEach((e=>{ - e[t]&&e[t](n)}))} - "undefined"!=typeof window&&window.addEventListener&&window.addEventListener("DOMContentLoaded",(()=>{ - w&&N()}),!1),Object.assign(n,{highlight:h,highlightAuto:E,highlightAll:N, - highlightElement:y, - highlightBlock:e=>(q("10.7.0","highlightBlock will be removed entirely in v12.0"), - q("10.7.0","Please use highlightElement now."),y(e)),configure:e=>{d=Y(d,e)}, - initHighlighting:()=>{ - N(),q("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")}, - initHighlightingOnLoad:()=>{ - N(),q("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.") - },registerLanguage:(e,t)=>{let i=null;try{i=t(n)}catch(n){ - if(K("Language definition for '{}' could not be registered.".replace("{}",e)), - !s)throw n;K(n),i=l} - i.name||(i.name=e),a[e]=i,i.rawDefinition=t.bind(null,n),i.aliases&&O(i.aliases,{ - languageName:e})},unregisterLanguage:e=>{delete a[e] - ;for(const n of Object.keys(i))i[n]===e&&delete i[n]}, - listLanguages:()=>Object.keys(a),getLanguage:v,registerAliases:O, - autoDetection:k,inherit:Y,addPlugin:e=>{(e=>{ - e["before:highlightBlock"]&&!e["before:highlightElement"]&&(e["before:highlightElement"]=n=>{ - e["before:highlightBlock"](Object.assign({block:n.el},n)) - }),e["after:highlightBlock"]&&!e["after:highlightElement"]&&(e["after:highlightElement"]=n=>{ - e["after:highlightBlock"](Object.assign({block:n.el},n))})})(e),r.push(e)} - }),n.debugMode=()=>{s=!1},n.safeMode=()=>{s=!0 - },n.versionString="11.7.0",n.regex={concat:m,lookahead:g,either:p,optional:b, - anyNumberOfTimes:u};for(const n in T)"object"==typeof T[n]&&e.exports(T[n]) - ;return Object.assign(n,T),n})({});const te=e=>({IMPORTANT:{scope:"meta", - begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{ - scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/}, - FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/}, - ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$", - contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{ - scope:"number", - begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?", - relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z][A-Za-z0-9_-]*/} - }),ae=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","p","q","quote","samp","section","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],ie=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"],re=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"],se=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"],oe=["align-content","align-items","align-self","all","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","content","content-visibility","counter-increment","counter-reset","cue","cue-after","cue-before","cursor","direction","display","empty-cells","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-size","font-size-adjust","font-smoothing","font-stretch","font-style","font-synthesis","font-variant","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","gap","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","inline-size","isolation","justify-content","left","letter-spacing","line-break","line-height","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-wrap","overflow-x","overflow-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page-break-after","page-break-before","page-break-inside","pause","pause-after","pause-before","perspective","perspective-origin","pointer-events","position","quotes","resize","rest","rest-after","rest-before","right","row-gap","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","speak","speak-as","src","tab-size","table-layout","text-align","text-align-all","text-align-last","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-transform","text-underline-position","top","transform","transform-box","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","z-index"].reverse(),le=re.concat(se) - ;var ce="\\.([0-9](_*[0-9])*)",de="[0-9a-fA-F](_*[0-9a-fA-F])*",ge={ - className:"number",variants:[{ - begin:`(\\b([0-9](_*[0-9])*)((${ce})|\\.)?|(${ce}))[eE][+-]?([0-9](_*[0-9])*)[fFdD]?\\b` - },{begin:`\\b([0-9](_*[0-9])*)((${ce})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{ - begin:`(${ce})[fFdD]?\\b`},{begin:"\\b([0-9](_*[0-9])*)[fFdD]\\b"},{ - begin:`\\b0[xX]((${de})\\.?|(${de})?\\.(${de}))[pP][+-]?([0-9](_*[0-9])*)[fFdD]?\\b` - },{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${de})[lL]?\\b`},{ - begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}], - relevance:0};function ue(e,n,t){return-1===t?"":e.replace(n,(a=>ue(e,n,t-1)))} - const be="[A-Za-z$_][0-9A-Za-z$_]*",me=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends"],pe=["true","false","null","undefined","NaN","Infinity"],_e=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],he=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],fe=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],Ee=["arguments","this","super","console","window","document","localStorage","module","global"],ye=[].concat(fe,_e,he) - ;function we(e){const n=e.regex,t=be,a={begin:/<[A-Za-z0-9\\._:-]+/, - end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(e,n)=>{ - const t=e[0].length+e.index,a=e.input[t] - ;if("<"===a||","===a)return void n.ignoreMatch();let i - ;">"===a&&(((e,{after:n})=>{const t="",k={ - match:[/const|var|let/,/\s+/,t,/\s*/,/=\s*/,/(async\s*)?/,n.lookahead(O)], - keywords:"async",className:{1:"keyword",3:"title.function"},contains:[_]} - ;return{name:"Javascript",aliases:["js","jsx","mjs","cjs"],keywords:i,exports:{ - PARAMS_CONTAINS:p,CLASS_REFERENCE:f},illegal:/#(?![$_A-z])/, - contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),{ - label:"use_strict",className:"meta",relevance:10, - begin:/^\s*['"]use (strict|asm)['"]/ - },e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,c,d,g,u,{match:/\$\d+/},o,f,{ - className:"attr",begin:t+n.lookahead(":"),relevance:0},k,{ - begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*", - keywords:"return throw case",relevance:0,contains:[u,e.REGEXP_MODE,{ - className:"function",begin:O,returnBegin:!0,end:"\\s*=>",contains:[{ - className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{ - className:null,begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0, - excludeEnd:!0,keywords:i,contains:p}]}]},{begin:/,/,relevance:0},{match:/\s+/, - relevance:0},{variants:[{begin:"<>",end:""},{ - match:/<[A-Za-z0-9\\._:-]+\s*\/>/},{begin:a.begin, - "on:begin":a.isTrulyOpeningTag,end:a.end}],subLanguage:"xml",contains:[{ - begin:a.begin,end:a.end,skip:!0,contains:["self"]}]}]},E,{ - beginKeywords:"while if switch catch for"},{ - begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{", - returnBegin:!0,label:"func.def",contains:[_,e.inherit(e.TITLE_MODE,{begin:t, - className:"title.function"})]},{match:/\.\.\./,relevance:0},N,{match:"\\$"+t, - relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"}, - contains:[_]},y,{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/, - className:"variable.constant"},h,v,{match:/\$[(.]/}]}} - const Ne=e=>m(/\b/,e,/\w$/.test(e)?/\b/:/\B/),ve=["Protocol","Type"].map(Ne),Oe=["init","self"].map(Ne),ke=["Any","Self"],xe=["actor","any","associatedtype","async","await",/as\?/,/as!/,"as","break","case","catch","class","continue","convenience","default","defer","deinit","didSet","distributed","do","dynamic","else","enum","extension","fallthrough",/fileprivate\(set\)/,"fileprivate","final","for","func","get","guard","if","import","indirect","infix",/init\?/,/init!/,"inout",/internal\(set\)/,"internal","in","is","isolated","nonisolated","lazy","let","mutating","nonmutating",/open\(set\)/,"open","operator","optional","override","postfix","precedencegroup","prefix",/private\(set\)/,"private","protocol",/public\(set\)/,"public","repeat","required","rethrows","return","set","some","static","struct","subscript","super","switch","throws","throw",/try\?/,/try!/,"try","typealias",/unowned\(safe\)/,/unowned\(unsafe\)/,"unowned","var","weak","where","while","willSet"],Me=["false","nil","true"],Se=["assignment","associativity","higherThan","left","lowerThan","none","right"],Ae=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warn_unqualified_access","#warning"],Ce=["abs","all","any","assert","assertionFailure","debugPrint","dump","fatalError","getVaList","isKnownUniquelyReferenced","max","min","numericCast","pointwiseMax","pointwiseMin","precondition","preconditionFailure","print","readLine","repeatElement","sequence","stride","swap","swift_unboxFromSwiftValueWithType","transcode","type","unsafeBitCast","unsafeDowncast","withExtendedLifetime","withUnsafeMutablePointer","withUnsafePointer","withVaList","withoutActuallyEscaping","zip"],Te=p(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),Re=p(Te,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),De=m(Te,Re,"*"),Ie=p(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),Le=p(Ie,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),Be=m(Ie,Le,"*"),$e=m(/[A-Z]/,Le,"*"),ze=["autoclosure",m(/convention\(/,p("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",m(/objc\(/,Be,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","testable","UIApplicationMain","unknown","usableFromInline"],Fe=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"] - ;var Ue=Object.freeze({__proto__:null,grmr_bash:e=>{const n=e.regex,t={},a={ - begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[t]}]} - ;Object.assign(t,{className:"variable",variants:[{ - begin:n.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},a]});const i={ - className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},r={ - begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/, - end:/(\w+)/,className:"string"})]}},s={className:"string",begin:/"/,end:/"/, - contains:[e.BACKSLASH_ESCAPE,t,i]};i.contains.push(s);const o={begin:/\$?\(\(/, - end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,t] - },l=e.SHEBANG({binary:"(fish|bash|zsh|sh|csh|ksh|tcsh|dash|scsh)",relevance:10 - }),c={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0, - contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0};return{ - name:"Bash",aliases:["sh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/, - keyword:["if","then","else","elif","fi","for","while","in","do","done","case","esac","function"], - literal:["true","false"], - built_in:["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset","alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","type","typeset","ulimit","unalias","set","shopt","autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp","chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"] - },contains:[l,e.SHEBANG(),c,o,e.HASH_COMMENT_MODE,r,{match:/(\/[a-z._-]+)+/},s,{ - className:"",begin:/\\"/},{className:"string",begin:/'/,end:/'/},t]}}, - grmr_c:e=>{const n=e.regex,t=e.COMMENT("//","$",{contains:[{begin:/\\\n/}] - }),a="[a-zA-Z_]\\w*::",i="(decltype\\(auto\\)|"+n.optional(a)+"[a-zA-Z_]\\w*"+n.optional("<[^<>]+>")+")",r={ - className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{ - match:/\batomic_[a-z]{3,6}\b/}]},s={className:"string",variants:[{ - begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{ - begin:"(u8?|U|L)?'(\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)|.)", - end:"'",illegal:"."},e.END_SAME_AS_BEGIN({ - begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},o={ - className:"number",variants:[{begin:"\\b(0b[01']+)"},{ - begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)" - },{ - begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)" - }],relevance:0},l={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{ - keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include" - },contains:[{begin:/\\\n/,relevance:0},e.inherit(s,{className:"string"}),{ - className:"string",begin:/<.*?>/},t,e.C_BLOCK_COMMENT_MODE]},c={ - className:"title",begin:n.optional(a)+e.IDENT_RE,relevance:0 - },d=n.optional(a)+e.IDENT_RE+"\\s*\\(",g={ - keyword:["asm","auto","break","case","continue","default","do","else","enum","extern","for","fortran","goto","if","inline","register","restrict","return","sizeof","struct","switch","typedef","union","volatile","while","_Alignas","_Alignof","_Atomic","_Generic","_Noreturn","_Static_assert","_Thread_local","alignas","alignof","noreturn","static_assert","thread_local","_Pragma"], - type:["float","double","signed","unsigned","int","short","long","char","void","_Bool","_Complex","_Imaginary","_Decimal32","_Decimal64","_Decimal128","const","static","complex","bool","imaginary"], - literal:"true false NULL", - built_in:"std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr" - },u=[l,r,t,e.C_BLOCK_COMMENT_MODE,o,s],b={variants:[{begin:/=/,end:/;/},{ - begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}], - keywords:g,contains:u.concat([{begin:/\(/,end:/\)/,keywords:g, - contains:u.concat(["self"]),relevance:0}]),relevance:0},m={ - begin:"("+i+"[\\*&\\s]+)+"+d,returnBegin:!0,end:/[{;=]/,excludeEnd:!0, - keywords:g,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:"decltype\\(auto\\)", - keywords:g,relevance:0},{begin:d,returnBegin:!0,contains:[e.inherit(c,{ - className:"title.function"})],relevance:0},{relevance:0,match:/,/},{ - className:"params",begin:/\(/,end:/\)/,keywords:g,relevance:0, - contains:[t,e.C_BLOCK_COMMENT_MODE,s,o,r,{begin:/\(/,end:/\)/,keywords:g, - relevance:0,contains:["self",t,e.C_BLOCK_COMMENT_MODE,s,o,r]}] - },r,t,e.C_BLOCK_COMMENT_MODE,l]};return{name:"C",aliases:["h"],keywords:g, - disableAutodetect:!0,illegal:"=]/,contains:[{ - beginKeywords:"final class struct"},e.TITLE_MODE]}]),exports:{preprocessor:l, - strings:s,keywords:g}}},grmr_cpp:e=>{const n=e.regex,t=e.COMMENT("//","$",{ - contains:[{begin:/\\\n/}] - }),a="[a-zA-Z_]\\w*::",i="(?!struct)(decltype\\(auto\\)|"+n.optional(a)+"[a-zA-Z_]\\w*"+n.optional("<[^<>]+>")+")",r={ - className:"type",begin:"\\b[a-z\\d_]*_t\\b"},s={className:"string",variants:[{ - begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{ - begin:"(u8?|U|L)?'(\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)|.)", - end:"'",illegal:"."},e.END_SAME_AS_BEGIN({ - begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},o={ - className:"number",variants:[{begin:"\\b(0b[01']+)"},{ - begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)" - },{ - begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)" - }],relevance:0},l={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{ - keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include" - },contains:[{begin:/\\\n/,relevance:0},e.inherit(s,{className:"string"}),{ - className:"string",begin:/<.*?>/},t,e.C_BLOCK_COMMENT_MODE]},c={ - className:"title",begin:n.optional(a)+e.IDENT_RE,relevance:0 - },d=n.optional(a)+e.IDENT_RE+"\\s*\\(",g={ - type:["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"], - keyword:["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"], - literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"], - _type_hints:["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"] - },u={className:"function.dispatch",relevance:0,keywords:{ - _hint:["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"] - }, - begin:n.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,n.lookahead(/(<[^<>]+>|)\s*\(/)) - },b=[u,l,r,t,e.C_BLOCK_COMMENT_MODE,o,s],m={variants:[{begin:/=/,end:/;/},{ - begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}], - keywords:g,contains:b.concat([{begin:/\(/,end:/\)/,keywords:g, - contains:b.concat(["self"]),relevance:0}]),relevance:0},p={className:"function", - begin:"("+i+"[\\*&\\s]+)+"+d,returnBegin:!0,end:/[{;=]/,excludeEnd:!0, - keywords:g,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:"decltype\\(auto\\)", - keywords:g,relevance:0},{begin:d,returnBegin:!0,contains:[c],relevance:0},{ - begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[s,o]},{ - relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:g, - relevance:0,contains:[t,e.C_BLOCK_COMMENT_MODE,s,o,r,{begin:/\(/,end:/\)/, - keywords:g,relevance:0,contains:["self",t,e.C_BLOCK_COMMENT_MODE,s,o,r]}] - },r,t,e.C_BLOCK_COMMENT_MODE,l]};return{name:"C++", - aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:g,illegal:"",keywords:g,contains:["self",r]},{begin:e.IDENT_RE+"::",keywords:g},{ - match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/], - className:{1:"keyword",3:"title.class"}}])}},grmr_csharp:e=>{const n={ - keyword:["abstract","as","base","break","case","catch","class","const","continue","do","else","event","explicit","extern","finally","fixed","for","foreach","goto","if","implicit","in","interface","internal","is","lock","namespace","new","operator","out","override","params","private","protected","public","readonly","record","ref","return","scoped","sealed","sizeof","stackalloc","static","struct","switch","this","throw","try","typeof","unchecked","unsafe","using","virtual","void","volatile","while"].concat(["add","alias","and","ascending","async","await","by","descending","equals","from","get","global","group","init","into","join","let","nameof","not","notnull","on","or","orderby","partial","remove","select","set","unmanaged","value|0","var","when","where","with","yield"]), - built_in:["bool","byte","char","decimal","delegate","double","dynamic","enum","float","int","long","nint","nuint","object","sbyte","short","string","ulong","uint","ushort"], - literal:["default","false","null","true"]},t=e.inherit(e.TITLE_MODE,{ - begin:"[a-zA-Z](\\.?\\w)*"}),a={className:"number",variants:[{ - begin:"\\b(0b[01']+)"},{ - begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{ - begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)" - }],relevance:0},i={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}] - },r=e.inherit(i,{illegal:/\n/}),s={className:"subst",begin:/\{/,end:/\}/, - keywords:n},o=e.inherit(s,{illegal:/\n/}),l={className:"string",begin:/\$"/, - end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/ - },e.BACKSLASH_ESCAPE,o]},c={className:"string",begin:/\$@"/,end:'"',contains:[{ - begin:/\{\{/},{begin:/\}\}/},{begin:'""'},s]},d=e.inherit(c,{illegal:/\n/, - contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},o]}) - ;s.contains=[c,l,i,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,a,e.C_BLOCK_COMMENT_MODE], - o.contains=[d,l,r,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,a,e.inherit(e.C_BLOCK_COMMENT_MODE,{ - illegal:/\n/})];const g={variants:[c,l,i,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE] - },u={begin:"<",end:">",contains:[{beginKeywords:"in out"},t] - },b=e.IDENT_RE+"(<"+e.IDENT_RE+"(\\s*,\\s*"+e.IDENT_RE+")*>)?(\\[\\])?",m={ - begin:"@"+e.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"], - keywords:n,illegal:/::/,contains:[e.COMMENT("///","$",{returnBegin:!0, - contains:[{className:"doctag",variants:[{begin:"///",relevance:0},{ - begin:"\x3c!--|--\x3e"},{begin:""}]}] - }),e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:"meta",begin:"#", - end:"$",keywords:{ - keyword:"if else elif endif define undef warning error line region endregion pragma checksum" - }},g,a,{beginKeywords:"class interface",relevance:0,end:/[{;=]/, - illegal:/[^\s:,]/,contains:[{beginKeywords:"where class" - },t,u,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace", - relevance:0,end:/[{;=]/,illegal:/[^\s:]/, - contains:[t,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{ - beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/, - contains:[t,u,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"meta", - begin:"^\\s*\\[(?=[\\w])",excludeBegin:!0,end:"\\]",excludeEnd:!0,contains:[{ - className:"string",begin:/"/,end:/"/}]},{ - beginKeywords:"new return throw await else",relevance:0},{className:"function", - begin:"("+b+"\\s+)+"+e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0, - end:/\s*[{;=]/,excludeEnd:!0,keywords:n,contains:[{ - beginKeywords:"public private protected static internal protected abstract async extern override unsafe virtual new sealed partial", - relevance:0},{begin:e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0, - contains:[e.TITLE_MODE,u],relevance:0},{match:/\(\)/},{className:"params", - begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:n,relevance:0, - contains:[g,a,e.C_BLOCK_COMMENT_MODE] - },e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},m]}},grmr_css:e=>{ - const n=e.regex,t=te(e),a=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE];return{ - name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{ - keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"}, - contains:[t.BLOCK_COMMENT,{begin:/-(webkit|moz|ms|o)-(?=[a-z])/ - },t.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0 - },{className:"selector-class",begin:"\\.[a-zA-Z-][a-zA-Z0-9_-]*",relevance:0 - },t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{ - begin:":("+re.join("|")+")"},{begin:":(:)?("+se.join("|")+")"}] - },t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+oe.join("|")+")\\b"},{ - begin:/:/,end:/[;}{]/, - contains:[t.BLOCK_COMMENT,t.HEXCOLOR,t.IMPORTANT,t.CSS_NUMBER_MODE,...a,{ - begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri" - },contains:[...a,{className:"string",begin:/[^)]/,endsWithParent:!0, - excludeEnd:!0}]},t.FUNCTION_DISPATCH]},{begin:n.lookahead(/@/),end:"[{;]", - relevance:0,illegal:/:/,contains:[{className:"keyword",begin:/@-?\w[\w]*(-\w+)*/ - },{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{ - $pattern:/[a-z-]+/,keyword:"and or not only",attribute:ie.join(" ")},contains:[{ - begin:/[a-z-]+(?=:)/,className:"attribute"},...a,t.CSS_NUMBER_MODE]}]},{ - className:"selector-tag",begin:"\\b("+ae.join("|")+")\\b"}]}},grmr_diff:e=>{ - const n=e.regex;return{name:"Diff",aliases:["patch"],contains:[{ - className:"meta",relevance:10, - match:n.either(/^@@ +-\d+,\d+ +\+\d+,\d+ +@@/,/^\*\*\* +\d+,\d+ +\*\*\*\*$/,/^--- +\d+,\d+ +----$/) - },{className:"comment",variants:[{ - begin:n.either(/Index: /,/^index/,/={3,}/,/^-{3}/,/^\*{3} /,/^\+{3}/,/^diff --git/), - end:/$/},{match:/^\*{15}$/}]},{className:"addition",begin:/^\+/,end:/$/},{ - className:"deletion",begin:/^-/,end:/$/},{className:"addition",begin:/^!/, - end:/$/}]}},grmr_go:e=>{const n={ - keyword:["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var"], - type:["bool","byte","complex64","complex128","error","float32","float64","int8","int16","int32","int64","string","uint8","uint16","uint32","uint64","int","uint","uintptr","rune"], - literal:["true","false","iota","nil"], - built_in:["append","cap","close","complex","copy","imag","len","make","new","panic","print","println","real","recover","delete"] - };return{name:"Go",aliases:["golang"],keywords:n,illegal:"{const n=e.regex;return{name:"GraphQL",aliases:["gql"], - case_insensitive:!0,disableAutodetect:!1,keywords:{ - keyword:["query","mutation","subscription","type","input","schema","directive","interface","union","scalar","fragment","enum","on"], - literal:["true","false","null"]}, - contains:[e.HASH_COMMENT_MODE,e.QUOTE_STRING_MODE,e.NUMBER_MODE,{ - scope:"punctuation",match:/[.]{3}/,relevance:0},{scope:"punctuation", - begin:/[\!\(\)\:\=\[\]\{\|\}]{1}/,relevance:0},{scope:"variable",begin:/\$/, - end:/\W/,excludeEnd:!0,relevance:0},{scope:"meta",match:/@\w+/,excludeEnd:!0},{ - scope:"symbol",begin:n.concat(/[_A-Za-z][_0-9A-Za-z]*/,n.lookahead(/\s*:/)), - relevance:0}],illegal:[/[;<']/,/BEGIN/]}},grmr_ini:e=>{const n=e.regex,t={ - className:"number",relevance:0,variants:[{begin:/([+-]+)?[\d]+_[\d_]+/},{ - begin:e.NUMBER_RE}]},a=e.COMMENT();a.variants=[{begin:/;/,end:/$/},{begin:/#/, - end:/$/}];const i={className:"variable",variants:[{begin:/\$[\w\d"][\w\d_]*/},{ - begin:/\$\{(.*?)\}/}]},r={className:"literal", - begin:/\bon|off|true|false|yes|no\b/},s={className:"string", - contains:[e.BACKSLASH_ESCAPE],variants:[{begin:"'''",end:"'''",relevance:10},{ - begin:'"""',end:'"""',relevance:10},{begin:'"',end:'"'},{begin:"'",end:"'"}] - },o={begin:/\[/,end:/\]/,contains:[a,r,i,s,t,"self"],relevance:0 - },l=n.either(/[A-Za-z0-9_-]+/,/"(\\"|[^"])*"/,/'[^']*'/);return{ - name:"TOML, also INI",aliases:["toml"],case_insensitive:!0,illegal:/\S/, - contains:[a,{className:"section",begin:/\[+/,end:/\]+/},{ - begin:n.concat(l,"(\\s*\\.\\s*",l,")*",n.lookahead(/\s*=\s*[^#\s]/)), - className:"attr",starts:{end:/$/,contains:[a,o,r,i,s,t]}}]}},grmr_java:e=>{ - const n=e.regex,t="[\xc0-\u02b8a-zA-Z_$][\xc0-\u02b8a-zA-Z_$0-9]*",a=t+ue("(?:<"+t+"~~~(?:\\s*,\\s*"+t+"~~~)*>)?",/~~~/g,2),i={ - keyword:["synchronized","abstract","private","var","static","if","const ","for","while","strictfp","finally","protected","import","native","final","void","enum","else","break","transient","catch","instanceof","volatile","case","assert","package","default","public","try","switch","continue","throws","protected","public","private","module","requires","exports","do","sealed","yield","permits"], - literal:["false","true","null"], - type:["char","boolean","long","float","int","byte","short","double"], - built_in:["super","this"]},r={className:"meta",begin:"@"+t,contains:[{ - begin:/\(/,end:/\)/,contains:["self"]}]},s={className:"params",begin:/\(/, - end:/\)/,keywords:i,relevance:0,contains:[e.C_BLOCK_COMMENT_MODE],endsParent:!0} - ;return{name:"Java",aliases:["jsp"],keywords:i,illegal:/<\/|#/, - contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/, - relevance:0},{className:"doctag",begin:"@[A-Za-z]+"}]}),{ - begin:/import java\.[a-z]+\./,keywords:"import",relevance:2 - },e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/, - className:"string",contains:[e.BACKSLASH_ESCAPE] - },e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{ - match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,t],className:{ - 1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{ - begin:[n.concat(/(?!else)/,t),/\s+/,t,/\s+/,/=(?!=)/],className:{1:"type", - 3:"variable",5:"operator"}},{begin:[/record/,/\s+/,t],className:{1:"keyword", - 3:"title.class"},contains:[s,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{ - beginKeywords:"new throw return else",relevance:0},{ - begin:["(?:"+a+"\\s+)",e.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{ - 2:"title.function"},keywords:i,contains:[{className:"params",begin:/\(/, - end:/\)/,keywords:i,relevance:0, - contains:[r,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,ge,e.C_BLOCK_COMMENT_MODE] - },e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},ge,r]}},grmr_javascript:we, - grmr_json:e=>{const n=["true","false","null"],t={scope:"literal", - beginKeywords:n.join(" ")};return{name:"JSON",keywords:{literal:n},contains:[{ - className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},{ - match:/[{}[\],:]/,className:"punctuation",relevance:0 - },e.QUOTE_STRING_MODE,t,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE], - illegal:"\\S"}},grmr_kotlin:e=>{const n={ - keyword:"abstract as val var vararg get set class object open private protected public noinline crossinline dynamic final enum if else do while for when throw try catch finally import package is in fun override companion reified inline lateinit init interface annotation data sealed internal infix operator out by constructor super tailrec where const inner suspend typealias external expect actual", - built_in:"Byte Short Char Int Long Boolean Float Double Void Unit Nothing", - literal:"true false null"},t={className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"@" - },a={className:"subst",begin:/\$\{/,end:/\}/,contains:[e.C_NUMBER_MODE]},i={ - className:"variable",begin:"\\$"+e.UNDERSCORE_IDENT_RE},r={className:"string", - variants:[{begin:'"""',end:'"""(?=[^"])',contains:[i,a]},{begin:"'",end:"'", - illegal:/\n/,contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/, - contains:[e.BACKSLASH_ESCAPE,i,a]}]};a.contains.push(r);const s={ - className:"meta", - begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+e.UNDERSCORE_IDENT_RE+")?" - },o={className:"meta",begin:"@"+e.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/, - end:/\)/,contains:[e.inherit(r,{className:"string"}),"self"]}] - },l=ge,c=e.COMMENT("/\\*","\\*/",{contains:[e.C_BLOCK_COMMENT_MODE]}),d={ - variants:[{className:"type",begin:e.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/, - contains:[]}]},g=d;return g.variants[1].contains=[d],d.variants[1].contains=[g], - {name:"Kotlin",aliases:["kt","kts"],keywords:n, - contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag", - begin:"@[A-Za-z]+"}]}),e.C_LINE_COMMENT_MODE,c,{className:"keyword", - begin:/\b(break|continue|return|this)\b/,starts:{contains:[{className:"symbol", - begin:/@\w+/}]}},t,s,o,{className:"function",beginKeywords:"fun",end:"[(]|$", - returnBegin:!0,excludeEnd:!0,keywords:n,relevance:5,contains:[{ - begin:e.UNDERSCORE_IDENT_RE+"\\s*\\(",returnBegin:!0,relevance:0, - contains:[e.UNDERSCORE_TITLE_MODE]},{className:"type",begin://, - keywords:"reified",relevance:0},{className:"params",begin:/\(/,end:/\)/, - endsParent:!0,keywords:n,relevance:0,contains:[{begin:/:/,end:/[=,\/]/, - endsWithParent:!0,contains:[d,e.C_LINE_COMMENT_MODE,c],relevance:0 - },e.C_LINE_COMMENT_MODE,c,s,o,r,e.C_NUMBER_MODE]},c]},{ - begin:[/class|interface|trait/,/\s+/,e.UNDERSCORE_IDENT_RE],beginScope:{ - 3:"title.class"},keywords:"class interface trait",end:/[:\{(]|$/,excludeEnd:!0, - illegal:"extends implements",contains:[{ - beginKeywords:"public protected internal private constructor" - },e.UNDERSCORE_TITLE_MODE,{className:"type",begin://,excludeBegin:!0, - excludeEnd:!0,relevance:0},{className:"type",begin:/[,:]\s*/,end:/[<\(,){\s]|$/, - excludeBegin:!0,returnEnd:!0},s,o]},r,{className:"meta",begin:"^#!/usr/bin/env", - end:"$",illegal:"\n"},l]}},grmr_less:e=>{ - const n=te(e),t=le,a="([\\w-]+|@\\{[\\w-]+\\})",i=[],r=[],s=e=>({ - className:"string",begin:"~?"+e+".*?"+e}),o=(e,n,t)=>({className:e,begin:n, - relevance:t}),l={$pattern:/[a-z-]+/,keyword:"and or not only", - attribute:ie.join(" ")},c={begin:"\\(",end:"\\)",contains:r,keywords:l, - relevance:0} - ;r.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,s("'"),s('"'),n.CSS_NUMBER_MODE,{ - begin:"(url|data-uri)\\(",starts:{className:"string",end:"[\\)\\n]", - excludeEnd:!0} - },n.HEXCOLOR,c,o("variable","@@?[\\w-]+",10),o("variable","@\\{[\\w-]+\\}"),o("built_in","~?`[^`]*?`"),{ - className:"attribute",begin:"[\\w-]+\\s*:",end:":",returnBegin:!0,excludeEnd:!0 - },n.IMPORTANT,{beginKeywords:"and not"},n.FUNCTION_DISPATCH);const d=r.concat({ - begin:/\{/,end:/\}/,contains:i}),g={beginKeywords:"when",endsWithParent:!0, - contains:[{beginKeywords:"and not"}].concat(r)},u={begin:a+"\\s*:", - returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/ - },n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+oe.join("|")+")\\b", - end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:r}}] - },b={className:"keyword", - begin:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b", - starts:{end:"[;{}]",keywords:l,returnEnd:!0,contains:r,relevance:0}},m={ - className:"variable",variants:[{begin:"@[\\w-]+\\s*:",relevance:15},{ - begin:"@[\\w-]+"}],starts:{end:"[;}]",returnEnd:!0,contains:d}},p={variants:[{ - begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:a,end:/\{/}],returnBegin:!0, - returnEnd:!0,illegal:"[<='$\"]",relevance:0, - contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,g,o("keyword","all\\b"),o("variable","@\\{[\\w-]+\\}"),{ - begin:"\\b("+ae.join("|")+")\\b",className:"selector-tag" - },n.CSS_NUMBER_MODE,o("selector-tag",a,0),o("selector-id","#"+a),o("selector-class","\\."+a,0),o("selector-tag","&",0),n.ATTRIBUTE_SELECTOR_MODE,{ - className:"selector-pseudo",begin:":("+re.join("|")+")"},{ - className:"selector-pseudo",begin:":(:)?("+se.join("|")+")"},{begin:/\(/, - end:/\)/,relevance:0,contains:d},{begin:"!important"},n.FUNCTION_DISPATCH]},_={ - begin:`[\\w-]+:(:)?(${t.join("|")})`,returnBegin:!0,contains:[p]} - ;return i.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,b,m,_,u,p,g,n.FUNCTION_DISPATCH), - {name:"Less",case_insensitive:!0,illegal:"[=>'/<($\"]",contains:i}}, - grmr_lua:e=>{const n="\\[=*\\[",t="\\]=*\\]",a={begin:n,end:t,contains:["self"] - },i=[e.COMMENT("--(?!\\[=*\\[)","$"),e.COMMENT("--\\[=*\\[",t,{contains:[a], - relevance:10})];return{name:"Lua",keywords:{$pattern:e.UNDERSCORE_IDENT_RE, - literal:"true false nil", - keyword:"and break do else elseif end for goto if in local not or repeat return then until while", - built_in:"_G _ENV _VERSION __index __newindex __mode __call __metatable __tostring __len __gc __add __sub __mul __div __mod __pow __concat __unm __eq __lt __le assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall arg self coroutine resume yield status wrap create running debug getupvalue debug sethook getmetatable gethook setmetatable setlocal traceback setfenv getinfo setupvalue getlocal getregistry getfenv io lines write close flush open output type read stderr stdin input stdout popen tmpfile math log max acos huge ldexp pi cos tanh pow deg tan cosh sinh random randomseed frexp ceil floor rad abs sqrt modf asin min mod fmod log10 atan2 exp sin atan os exit setlocale date getenv difftime remove time clock tmpname rename execute package preload loadlib loaded loaders cpath config path seeall string sub upper len gfind rep find match char dump gmatch reverse byte format gsub lower table setn insert getn foreachi maxn foreach concat sort remove" - },contains:i.concat([{className:"function",beginKeywords:"function",end:"\\)", - contains:[e.inherit(e.TITLE_MODE,{ - begin:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"}),{className:"params", - begin:"\\(",endsWithParent:!0,contains:i}].concat(i) - },e.C_NUMBER_MODE,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{className:"string", - begin:n,end:t,contains:[a],relevance:5}])}},grmr_makefile:e=>{const n={ - className:"variable",variants:[{begin:"\\$\\("+e.UNDERSCORE_IDENT_RE+"\\)", - contains:[e.BACKSLASH_ESCAPE]},{begin:/\$[@%{ - const n=e.regex,t=n.concat(/[\p{L}_]/u,n.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),a={ - className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},i={begin:/\s/, - contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}] - },r=e.inherit(i,{begin:/\(/,end:/\)/}),s=e.inherit(e.APOS_STRING_MODE,{ - className:"string"}),o=e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),l={ - endsWithParent:!0,illegal:/`]+/}]}]}]};return{ - name:"HTML, XML", - aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"], - case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin://,relevance:10,contains:[i,o,s,r,{begin:/\[/,end:/\]/,contains:[{ - className:"meta",begin://,contains:[i,r,o,s]}]}] - },e.COMMENT(//,{relevance:10}),{begin://, - relevance:10},a,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/, - relevance:10,contains:[o]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag", - begin:/)/,end:/>/,keywords:{name:"style"},contains:[l],starts:{ - end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag", - begin:/)/,end:/>/,keywords:{name:"script"},contains:[l],starts:{ - end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{ - className:"tag",begin:/<>|<\/>/},{className:"tag", - begin:n.concat(//,/>/,/\s/)))), - end:/\/?>/,contains:[{className:"name",begin:t,relevance:0,starts:l}]},{ - className:"tag",begin:n.concat(/<\//,n.lookahead(n.concat(t,/>/))),contains:[{ - className:"name",begin:t,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]} - },grmr_markdown:e=>{const n={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml", - relevance:0},t={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{ - begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/, - relevance:2},{ - begin:e.regex.concat(/\[.+?\]\(/,/[A-Za-z][A-Za-z0-9+.-]*/,/:\/\/.*?\)/), - relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{ - begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/ - },{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0, - returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)", - excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[", - end:"\\]",excludeBegin:!0,excludeEnd:!0}]},a={className:"strong",contains:[], - variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}] - },i={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{ - begin:/_(?![_\s])/,end:/_/,relevance:0}]},r=e.inherit(a,{contains:[] - }),s=e.inherit(i,{contains:[]});a.contains.push(s),i.contains.push(r) - ;let o=[n,t];return[a,i,r,s].forEach((e=>{e.contains=e.contains.concat(o) - })),o=o.concat(a,i),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{ - className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:o},{ - begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n", - contains:o}]}]},n,{className:"bullet",begin:"^[ \t]*([*+-]|(\\d+\\.))(?=\\s+)", - end:"\\s+",excludeEnd:!0},a,i,{className:"quote",begin:"^>\\s+",contains:o, - end:"$"},{className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{ - begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{ - begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))", - contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},{ - begin:"^[-\\*]{3,}",end:"$"},t,{begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{ - className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{ - className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]}]}},grmr_objectivec:e=>{ - const n=/[a-zA-Z@][a-zA-Z0-9_]*/,t={$pattern:n, - keyword:["@interface","@class","@protocol","@implementation"]};return{ - name:"Objective-C",aliases:["mm","objc","obj-c","obj-c++","objective-c++"], - keywords:{"variable.language":["this","super"],$pattern:n, - keyword:["while","export","sizeof","typedef","const","struct","for","union","volatile","static","mutable","if","do","return","goto","enum","else","break","extern","asm","case","default","register","explicit","typename","switch","continue","inline","readonly","assign","readwrite","self","@synchronized","id","typeof","nonatomic","IBOutlet","IBAction","strong","weak","copy","in","out","inout","bycopy","byref","oneway","__strong","__weak","__block","__autoreleasing","@private","@protected","@public","@try","@property","@end","@throw","@catch","@finally","@autoreleasepool","@synthesize","@dynamic","@selector","@optional","@required","@encode","@package","@import","@defs","@compatibility_alias","__bridge","__bridge_transfer","__bridge_retained","__bridge_retain","__covariant","__contravariant","__kindof","_Nonnull","_Nullable","_Null_unspecified","__FUNCTION__","__PRETTY_FUNCTION__","__attribute__","getter","setter","retain","unsafe_unretained","nonnull","nullable","null_unspecified","null_resettable","class","instancetype","NS_DESIGNATED_INITIALIZER","NS_UNAVAILABLE","NS_REQUIRES_SUPER","NS_RETURNS_INNER_POINTER","NS_INLINE","NS_AVAILABLE","NS_DEPRECATED","NS_ENUM","NS_OPTIONS","NS_SWIFT_UNAVAILABLE","NS_ASSUME_NONNULL_BEGIN","NS_ASSUME_NONNULL_END","NS_REFINED_FOR_SWIFT","NS_SWIFT_NAME","NS_SWIFT_NOTHROW","NS_DURING","NS_HANDLER","NS_ENDHANDLER","NS_VALUERETURN","NS_VOIDRETURN"], - literal:["false","true","FALSE","TRUE","nil","YES","NO","NULL"], - built_in:["dispatch_once_t","dispatch_queue_t","dispatch_sync","dispatch_async","dispatch_once"], - type:["int","float","char","unsigned","signed","short","long","double","wchar_t","unichar","void","bool","BOOL","id|0","_Bool"] - },illegal:"/,end:/$/,illegal:"\\n" - },e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"class", - begin:"("+t.keyword.join("|")+")\\b",end:/(\{|$)/,excludeEnd:!0,keywords:t, - contains:[e.UNDERSCORE_TITLE_MODE]},{begin:"\\."+e.UNDERSCORE_IDENT_RE, - relevance:0}]}},grmr_perl:e=>{const n=e.regex,t=/[dualxmsipngr]{0,12}/,a={ - $pattern:/[\w.]+/, - keyword:"abs accept alarm and atan2 bind binmode bless break caller chdir chmod chomp chop chown chr chroot close closedir connect continue cos crypt dbmclose dbmopen defined delete die do dump each else elsif endgrent endhostent endnetent endprotoent endpwent endservent eof eval exec exists exit exp fcntl fileno flock for foreach fork format formline getc getgrent getgrgid getgrnam gethostbyaddr gethostbyname gethostent getlogin getnetbyaddr getnetbyname getnetent getpeername getpgrp getpriority getprotobyname getprotobynumber getprotoent getpwent getpwnam getpwuid getservbyname getservbyport getservent getsockname getsockopt given glob gmtime goto grep gt hex if index int ioctl join keys kill last lc lcfirst length link listen local localtime log lstat lt ma map mkdir msgctl msgget msgrcv msgsnd my ne next no not oct open opendir or ord our pack package pipe pop pos print printf prototype push q|0 qq quotemeta qw qx rand read readdir readline readlink readpipe recv redo ref rename require reset return reverse rewinddir rindex rmdir say scalar seek seekdir select semctl semget semop send setgrent sethostent setnetent setpgrp setpriority setprotoent setpwent setservent setsockopt shift shmctl shmget shmread shmwrite shutdown sin sleep socket socketpair sort splice split sprintf sqrt srand stat state study sub substr symlink syscall sysopen sysread sysseek system syswrite tell telldir tie tied time times tr truncate uc ucfirst umask undef unless unlink unpack unshift untie until use utime values vec wait waitpid wantarray warn when while write x|0 xor y|0" - },i={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:a},r={begin:/->\{/, - end:/\}/},s={variants:[{begin:/\$\d/},{ - begin:n.concat(/[$%@](\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,"(?![A-Za-z])(?![@$%])") - },{begin:/[$%@][^\s\w{]/,relevance:0}] - },o=[e.BACKSLASH_ESCAPE,i,s],l=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],c=(e,a,i="\\1")=>{ - const r="\\1"===i?i:n.concat(i,a) - ;return n.concat(n.concat("(?:",e,")"),a,/(?:\\.|[^\\\/])*?/,r,/(?:\\.|[^\\\/])*?/,i,t) - },d=(e,a,i)=>n.concat(n.concat("(?:",e,")"),a,/(?:\\.|[^\\\/])*?/,i,t),g=[s,e.HASH_COMMENT_MODE,e.COMMENT(/^=\w/,/=cut/,{ - endsWithParent:!0}),r,{className:"string",contains:o,variants:[{ - begin:"q[qwxr]?\\s*\\(",end:"\\)",relevance:5},{begin:"q[qwxr]?\\s*\\[", - end:"\\]",relevance:5},{begin:"q[qwxr]?\\s*\\{",end:"\\}",relevance:5},{ - begin:"q[qwxr]?\\s*\\|",end:"\\|",relevance:5},{begin:"q[qwxr]?\\s*<",end:">", - relevance:5},{begin:"qw\\s+q",end:"q",relevance:5},{begin:"'",end:"'", - contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"'},{begin:"`",end:"`", - contains:[e.BACKSLASH_ESCAPE]},{begin:/\{\w+\}/,relevance:0},{ - begin:"-?\\w+\\s*=>",relevance:0}]},{className:"number", - begin:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b", - relevance:0},{ - begin:"(\\/\\/|"+e.RE_STARTERS_RE+"|\\b(split|return|print|reverse|grep)\\b)\\s*", - keywords:"split return print reverse grep",relevance:0, - contains:[e.HASH_COMMENT_MODE,{className:"regexp",variants:[{ - begin:c("s|tr|y",n.either(...l,{capture:!0}))},{begin:c("s|tr|y","\\(","\\)")},{ - begin:c("s|tr|y","\\[","\\]")},{begin:c("s|tr|y","\\{","\\}")}],relevance:2},{ - className:"regexp",variants:[{begin:/(m|qr)\/\//,relevance:0},{ - begin:d("(?:m|qr)?",/\//,/\//)},{begin:d("m|qr",n.either(...l,{capture:!0 - }),/\1/)},{begin:d("m|qr",/\(/,/\)/)},{begin:d("m|qr",/\[/,/\]/)},{ - begin:d("m|qr",/\{/,/\}/)}]}]},{className:"function",beginKeywords:"sub", - end:"(\\s*\\(.*?\\))?[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE]},{ - begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$", - subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}] - }];return i.contains=g,r.contains=g,{name:"Perl",aliases:["pl","pm"],keywords:a, - contains:g}},grmr_php:e=>{ - const n=e.regex,t=/(?![A-Za-z0-9])(?![$])/,a=n.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,t),i=n.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,t),r={ - scope:"variable",match:"\\$+"+a},s={scope:"subst",variants:[{begin:/\$\w+/},{ - begin:/\{\$/,end:/\}/}]},o=e.inherit(e.APOS_STRING_MODE,{illegal:null - }),l="[ \t\n]",c={scope:"string",variants:[e.inherit(e.QUOTE_STRING_MODE,{ - illegal:null,contains:e.QUOTE_STRING_MODE.contains.concat(s) - }),o,e.END_SAME_AS_BEGIN({begin:/<<<[ \t]*(\w+)\n/,end:/[ \t]*(\w+)\b/, - contains:e.QUOTE_STRING_MODE.contains.concat(s)})]},d={scope:"number", - variants:[{begin:"\\b0[bB][01]+(?:_[01]+)*\\b"},{ - begin:"\\b0[oO][0-7]+(?:_[0-7]+)*\\b"},{ - begin:"\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b"},{ - begin:"(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?" - }],relevance:0 - },g=["false","null","true"],u=["__CLASS__","__DIR__","__FILE__","__FUNCTION__","__COMPILER_HALT_OFFSET__","__LINE__","__METHOD__","__NAMESPACE__","__TRAIT__","die","echo","exit","include","include_once","print","require","require_once","array","abstract","and","as","binary","bool","boolean","break","callable","case","catch","class","clone","const","continue","declare","default","do","double","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","enum","eval","extends","final","finally","float","for","foreach","from","global","goto","if","implements","instanceof","insteadof","int","integer","interface","isset","iterable","list","match|0","mixed","new","never","object","or","private","protected","public","readonly","real","return","string","switch","throw","trait","try","unset","use","var","void","while","xor","yield"],b=["Error|0","AppendIterator","ArgumentCountError","ArithmeticError","ArrayIterator","ArrayObject","AssertionError","BadFunctionCallException","BadMethodCallException","CachingIterator","CallbackFilterIterator","CompileError","Countable","DirectoryIterator","DivisionByZeroError","DomainException","EmptyIterator","ErrorException","Exception","FilesystemIterator","FilterIterator","GlobIterator","InfiniteIterator","InvalidArgumentException","IteratorIterator","LengthException","LimitIterator","LogicException","MultipleIterator","NoRewindIterator","OutOfBoundsException","OutOfRangeException","OuterIterator","OverflowException","ParentIterator","ParseError","RangeException","RecursiveArrayIterator","RecursiveCachingIterator","RecursiveCallbackFilterIterator","RecursiveDirectoryIterator","RecursiveFilterIterator","RecursiveIterator","RecursiveIteratorIterator","RecursiveRegexIterator","RecursiveTreeIterator","RegexIterator","RuntimeException","SeekableIterator","SplDoublyLinkedList","SplFileInfo","SplFileObject","SplFixedArray","SplHeap","SplMaxHeap","SplMinHeap","SplObjectStorage","SplObserver","SplPriorityQueue","SplQueue","SplStack","SplSubject","SplTempFileObject","TypeError","UnderflowException","UnexpectedValueException","UnhandledMatchError","ArrayAccess","BackedEnum","Closure","Fiber","Generator","Iterator","IteratorAggregate","Serializable","Stringable","Throwable","Traversable","UnitEnum","WeakReference","WeakMap","Directory","__PHP_Incomplete_Class","parent","php_user_filter","self","static","stdClass"],m={ - keyword:u,literal:(e=>{const n=[];return e.forEach((e=>{ - n.push(e),e.toLowerCase()===e?n.push(e.toUpperCase()):n.push(e.toLowerCase()) - })),n})(g),built_in:b},p=e=>e.map((e=>e.replace(/\|\d+$/,""))),_={variants:[{ - match:[/new/,n.concat(l,"+"),n.concat("(?!",p(b).join("\\b|"),"\\b)"),i],scope:{ - 1:"keyword",4:"title.class"}}]},h=n.concat(a,"\\b(?!\\()"),f={variants:[{ - match:[n.concat(/::/,n.lookahead(/(?!class\b)/)),h],scope:{2:"variable.constant" - }},{match:[/::/,/class/],scope:{2:"variable.language"}},{ - match:[i,n.concat(/::/,n.lookahead(/(?!class\b)/)),h],scope:{1:"title.class", - 3:"variable.constant"}},{match:[i,n.concat("::",n.lookahead(/(?!class\b)/))], - scope:{1:"title.class"}},{match:[i,/::/,/class/],scope:{1:"title.class", - 3:"variable.language"}}]},E={scope:"attr", - match:n.concat(a,n.lookahead(":"),n.lookahead(/(?!::)/))},y={relevance:0, - begin:/\(/,end:/\)/,keywords:m,contains:[E,r,f,e.C_BLOCK_COMMENT_MODE,c,d,_] - },w={relevance:0, - match:[/\b/,n.concat("(?!fn\\b|function\\b|",p(u).join("\\b|"),"|",p(b).join("\\b|"),"\\b)"),a,n.concat(l,"*"),n.lookahead(/(?=\()/)], - scope:{3:"title.function.invoke"},contains:[y]};y.contains.push(w) - ;const N=[E,f,e.C_BLOCK_COMMENT_MODE,c,d,_];return{case_insensitive:!1, - keywords:m,contains:[{begin:n.concat(/#\[\s*/,i),beginScope:"meta",end:/]/, - endScope:"meta",keywords:{literal:g,keyword:["new","array"]},contains:[{ - begin:/\[/,end:/]/,keywords:{literal:g,keyword:["new","array"]}, - contains:["self",...N]},...N,{scope:"meta",match:i}] - },e.HASH_COMMENT_MODE,e.COMMENT("//","$"),e.COMMENT("/\\*","\\*/",{contains:[{ - scope:"doctag",match:"@[A-Za-z]+"}]}),{match:/__halt_compiler\(\);/, - keywords:"__halt_compiler",starts:{scope:"comment",end:e.MATCH_NOTHING_RE, - contains:[{match:/\?>/,scope:"meta",endsParent:!0}]}},{scope:"meta",variants:[{ - begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{ - begin:/\?>/}]},{scope:"variable.language",match:/\$this\b/},r,w,f,{ - match:[/const/,/\s/,a],scope:{1:"keyword",3:"variable.constant"}},_,{ - scope:"function",relevance:0,beginKeywords:"fn function",end:/[;{]/, - excludeEnd:!0,illegal:"[$%\\[]",contains:[{beginKeywords:"use" - },e.UNDERSCORE_TITLE_MODE,{begin:"=>",endsParent:!0},{scope:"params", - begin:"\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0,keywords:m, - contains:["self",r,f,e.C_BLOCK_COMMENT_MODE,c,d]}]},{scope:"class",variants:[{ - beginKeywords:"enum",illegal:/[($"]/},{beginKeywords:"class interface trait", - illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{ - beginKeywords:"extends implements"},e.UNDERSCORE_TITLE_MODE]},{ - beginKeywords:"namespace",relevance:0,end:";",illegal:/[.']/, - contains:[e.inherit(e.UNDERSCORE_TITLE_MODE,{scope:"title.class"})]},{ - beginKeywords:"use",relevance:0,end:";",contains:[{ - match:/\b(as|const|function)\b/,scope:"keyword"},e.UNDERSCORE_TITLE_MODE]},c,d]} - },grmr_php_template:e=>({name:"PHP template",subLanguage:"xml",contains:[{ - begin:/<\?(php|=)?/,end:/\?>/,subLanguage:"php",contains:[{begin:"/\\*", - end:"\\*/",skip:!0},{begin:'b"',end:'"',skip:!0},{begin:"b'",end:"'",skip:!0 - },e.inherit(e.APOS_STRING_MODE,{illegal:null,className:null,contains:null, - skip:!0}),e.inherit(e.QUOTE_STRING_MODE,{illegal:null,className:null, - contains:null,skip:!0})]}]}),grmr_plaintext:e=>({name:"Plain text", - aliases:["text","txt"],disableAutodetect:!0}),grmr_python:e=>{ - const n=e.regex,t=/[\p{XID_Start}_]\p{XID_Continue}*/u,a=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],i={ - $pattern:/[A-Za-z]\w+|__\w+__/,keyword:a, - built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"], - literal:["__debug__","Ellipsis","False","None","NotImplemented","True"], - type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"] - },r={className:"meta",begin:/^(>>>|\.\.\.) /},s={className:"subst",begin:/\{/, - end:/\}/,keywords:i,illegal:/#/},o={begin:/\{\{/,relevance:0},l={ - className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{ - begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/, - contains:[e.BACKSLASH_ESCAPE,r],relevance:10},{ - begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/, - contains:[e.BACKSLASH_ESCAPE,r],relevance:10},{ - begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/, - contains:[e.BACKSLASH_ESCAPE,r,o,s]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/, - end:/"""/,contains:[e.BACKSLASH_ESCAPE,r,o,s]},{begin:/([uU]|[rR])'/,end:/'/, - relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{ - begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/, - end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/, - contains:[e.BACKSLASH_ESCAPE,o,s]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/, - contains:[e.BACKSLASH_ESCAPE,o,s]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE] - },c="[0-9](_?[0-9])*",d=`(\\b(${c}))?\\.(${c})|\\b(${c})\\.`,g="\\b|"+a.join("|"),u={ - className:"number",relevance:0,variants:[{ - begin:`(\\b(${c})|(${d}))[eE][+-]?(${c})[jJ]?(?=${g})`},{begin:`(${d})[jJ]?`},{ - begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${g})`},{ - begin:`\\b0[bB](_?[01])+[lL]?(?=${g})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${g})` - },{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${g})`},{begin:`\\b(${c})[jJ](?=${g})` - }]},b={className:"comment",begin:n.lookahead(/# type:/),end:/$/,keywords:i, - contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},m={ - className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/, - end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:i, - contains:["self",r,u,l,e.HASH_COMMENT_MODE]}]};return s.contains=[l,u,r],{ - name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:i, - illegal:/(<\/|->|\?)|=>/,contains:[r,u,{begin:/\bself\b/},{beginKeywords:"if", - relevance:0},l,b,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,t],scope:{ - 1:"keyword",3:"title.function"},contains:[m]},{variants:[{ - match:[/\bclass/,/\s+/,t,/\s*/,/\(\s*/,t,/\s*\)/]},{match:[/\bclass/,/\s+/,t]}], - scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{ - className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[u,m,l]}]}}, - grmr_python_repl:e=>({aliases:["pycon"],contains:[{className:"meta.prompt", - starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{ - begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}),grmr_r:e=>{ - const n=e.regex,t=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,a=n.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,/0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/,/(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/),i=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,r=n.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/) - ;return{name:"R",keywords:{$pattern:t, - keyword:"function if in break next repeat else for while", - literal:"NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10", - built_in:"LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm" - },contains:[e.COMMENT(/#'/,/$/,{contains:[{scope:"doctag",match:/@examples/, - starts:{end:n.lookahead(n.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)), - endsParent:!0}},{scope:"doctag",begin:"@param",end:/$/,contains:[{ - scope:"variable",variants:[{match:t},{match:/`(?:\\.|[^`\\])+`/}],endsParent:!0 - }]},{scope:"doctag",match:/@[a-zA-Z]+/},{scope:"keyword",match:/\\[a-zA-Z]+/}] - }),e.HASH_COMMENT_MODE,{scope:"string",contains:[e.BACKSLASH_ESCAPE], - variants:[e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\(/,end:/\)(-*)"/ - }),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\{/,end:/\}(-*)"/ - }),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\[/,end:/\](-*)"/ - }),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\(/,end:/\)(-*)'/ - }),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\{/,end:/\}(-*)'/ - }),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\[/,end:/\](-*)'/}),{begin:'"',end:'"', - relevance:0},{begin:"'",end:"'",relevance:0}]},{relevance:0,variants:[{scope:{ - 1:"operator",2:"number"},match:[i,a]},{scope:{1:"operator",2:"number"}, - match:[/%[^%]*%/,a]},{scope:{1:"punctuation",2:"number"},match:[r,a]},{scope:{ - 2:"number"},match:[/[^a-zA-Z0-9._]|^/,a]}]},{scope:{3:"operator"}, - match:[t,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:i},{ - match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:r},{begin:"`",end:"`", - contains:[{begin:/\\./}]}]}},grmr_ruby:e=>{ - const n=e.regex,t="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",a=n.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),i=n.concat(a,/(::\w+)*/),r={ - "variable.constant":["__FILE__","__LINE__","__ENCODING__"], - "variable.language":["self","super"], - keyword:["alias","and","begin","BEGIN","break","case","class","defined","do","else","elsif","end","END","ensure","for","if","in","module","next","not","or","redo","require","rescue","retry","return","then","undef","unless","until","when","while","yield","include","extend","prepend","public","private","protected","raise","throw"], - built_in:["proc","lambda","attr_accessor","attr_reader","attr_writer","define_method","private_constant","module_function"], - literal:["true","false","nil"]},s={className:"doctag",begin:"@[A-Za-z]+"},o={ - begin:"#<",end:">"},l=[e.COMMENT("#","$",{contains:[s] - }),e.COMMENT("^=begin","^=end",{contains:[s],relevance:10 - }),e.COMMENT("^__END__",e.MATCH_NOTHING_RE)],c={className:"subst",begin:/#\{/, - end:/\}/,keywords:r},d={className:"string",contains:[e.BACKSLASH_ESCAPE,c], - variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{ - begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{ - begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?/},{begin:/%[qQwWx]?\//, - end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{ - begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{ - begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{ - begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{ - begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{ - begin:n.concat(/<<[-~]?'?/,n.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)), - contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/, - contains:[e.BACKSLASH_ESCAPE,c]})]}]},g="[0-9](_?[0-9])*",u={className:"number", - relevance:0,variants:[{ - begin:`\\b([1-9](_?[0-9])*|0)(\\.(${g}))?([eE][+-]?(${g})|r)?i?\\b`},{ - begin:"\\b0[dD][0-9](_?[0-9])*r?i?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*r?i?\\b" - },{begin:"\\b0[oO][0-7](_?[0-7])*r?i?\\b"},{ - begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b"},{ - begin:"\\b0(_?[0-7])+r?i?\\b"}]},b={variants:[{match:/\(\)/},{ - className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0, - keywords:r}]},m=[d,{variants:[{match:[/class\s+/,i,/\s+<\s+/,i]},{ - match:[/\b(class|module)\s+/,i]}],scope:{2:"title.class", - 4:"title.class.inherited"},keywords:r},{match:[/(include|extend)\s+/,i],scope:{ - 2:"title.class"},keywords:r},{relevance:0,match:[i,/\.new[. (]/],scope:{ - 1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/, - className:"variable.constant"},{relevance:0,match:a,scope:"title.class"},{ - match:[/def/,/\s+/,t],scope:{1:"keyword",3:"title.function"},contains:[b]},{ - begin:e.IDENT_RE+"::"},{className:"symbol", - begin:e.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol", - begin:":(?!\\s)",contains:[d,{begin:t}],relevance:0},u,{className:"variable", - begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{ - className:"params",begin:/\|/,end:/\|/,excludeBegin:!0,excludeEnd:!0, - relevance:0,keywords:r},{begin:"("+e.RE_STARTERS_RE+"|unless)\\s*", - keywords:"unless",contains:[{className:"regexp",contains:[e.BACKSLASH_ESCAPE,c], - illegal:/\n/,variants:[{begin:"/",end:"/[a-z]*"},{begin:/%r\{/,end:/\}[a-z]*/},{ - begin:"%r\\(",end:"\\)[a-z]*"},{begin:"%r!",end:"![a-z]*"},{begin:"%r\\[", - end:"\\][a-z]*"}]}].concat(o,l),relevance:0}].concat(o,l) - ;c.contains=m,b.contains=m;const p=[{begin:/^\s*=>/,starts:{end:"$",contains:m} - },{className:"meta.prompt", - begin:"^([>?]>|[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]|(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>)(?=[ ])", - starts:{end:"$",keywords:r,contains:m}}];return l.unshift(o),{name:"Ruby", - aliases:["rb","gemspec","podspec","thor","irb"],keywords:r,illegal:/\/\*/, - contains:[e.SHEBANG({binary:"ruby"})].concat(p).concat(l).concat(m)}}, - grmr_rust:e=>{const n=e.regex,t={className:"title.function.invoke",relevance:0, - begin:n.concat(/\b/,/(?!let\b)/,e.IDENT_RE,n.lookahead(/\s*\(/)) - },a="([ui](8|16|32|64|128|size)|f(32|64))?",i=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],r=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f32","f64","str","char","bool","Box","Option","Result","String","Vec"] - ;return{name:"Rust",aliases:["rs"],keywords:{$pattern:e.IDENT_RE+"!?",type:r, - keyword:["abstract","as","async","await","become","box","break","const","continue","crate","do","dyn","else","enum","extern","false","final","fn","for","if","impl","in","let","loop","macro","match","mod","move","mut","override","priv","pub","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","unsafe","unsized","use","virtual","where","while","yield"], - literal:["true","false","Some","None","Ok","Err"],built_in:i},illegal:""},t]}}, - grmr_scss:e=>{const n=te(e),t=se,a=re,i="@[a-z-]+",r={className:"variable", - begin:"(\\$[a-zA-Z-][a-zA-Z0-9_-]*)\\b",relevance:0};return{name:"SCSS", - case_insensitive:!0,illegal:"[=/|']", - contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,n.CSS_NUMBER_MODE,{ - className:"selector-id",begin:"#[A-Za-z0-9_-]+",relevance:0},{ - className:"selector-class",begin:"\\.[A-Za-z0-9_-]+",relevance:0 - },n.ATTRIBUTE_SELECTOR_MODE,{className:"selector-tag", - begin:"\\b("+ae.join("|")+")\\b",relevance:0},{className:"selector-pseudo", - begin:":("+a.join("|")+")"},{className:"selector-pseudo", - begin:":(:)?("+t.join("|")+")"},r,{begin:/\(/,end:/\)/, - contains:[n.CSS_NUMBER_MODE]},n.CSS_VARIABLE,{className:"attribute", - begin:"\\b("+oe.join("|")+")\\b"},{ - begin:"\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b" - },{begin:/:/,end:/[;}{]/,relevance:0, - contains:[n.BLOCK_COMMENT,r,n.HEXCOLOR,n.CSS_NUMBER_MODE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,n.IMPORTANT,n.FUNCTION_DISPATCH] - },{begin:"@(page|font-face)",keywords:{$pattern:i,keyword:"@page @font-face"}},{ - begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/, - keyword:"and or not only",attribute:ie.join(" ")},contains:[{begin:i, - className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute" - },r,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,n.HEXCOLOR,n.CSS_NUMBER_MODE] - },n.FUNCTION_DISPATCH]}},grmr_shell:e=>({name:"Shell Session", - aliases:["console","shellsession"],contains:[{className:"meta.prompt", - begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/, - subLanguage:"bash"}}]}),grmr_sql:e=>{ - const n=e.regex,t=e.COMMENT("--","$"),a=["true","false","unknown"],i=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],r=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],s=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],o=r,l=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year","add","asc","collation","desc","final","first","last","view"].filter((e=>!r.includes(e))),c={ - begin:n.concat(/\b/,n.either(...o),/\s*\(/),relevance:0,keywords:{built_in:o}} - ;return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{ - $pattern:/\b[\w\.]+/,keyword:((e,{exceptions:n,when:t}={})=>{const a=t - ;return n=n||[],e.map((e=>e.match(/\|\d+$/)||n.includes(e)?e:a(e)?e+"|0":e)) - })(l,{when:e=>e.length<3}),literal:a,type:i, - built_in:["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"] - },contains:[{begin:n.either(...s),relevance:0,keywords:{$pattern:/[\w\.]+/, - keyword:l.concat(s),literal:a,type:i}},{className:"type", - begin:n.either("double precision","large object","with timezone","without timezone") - },c,{className:"variable",begin:/@[a-z0-9]+/},{className:"string",variants:[{ - begin:/'/,end:/'/,contains:[{begin:/''/}]}]},{begin:/"/,end:/"/,contains:[{ - begin:/""/}]},e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,t,{className:"operator", - begin:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0}]}}, - grmr_swift:e=>{const n={match:/\s+/,relevance:0},t=e.COMMENT("/\\*","\\*/",{ - contains:["self"]}),a=[e.C_LINE_COMMENT_MODE,t],i={match:[/\./,p(...ve,...Oe)], - className:{2:"keyword"}},r={match:m(/\./,p(...xe)),relevance:0 - },s=xe.filter((e=>"string"==typeof e)).concat(["_|0"]),o={variants:[{ - className:"keyword", - match:p(...xe.filter((e=>"string"!=typeof e)).concat(ke).map(Ne),...Oe)}]},l={ - $pattern:p(/\b\w+/,/#\w+/),keyword:s.concat(Ae),literal:Me},c=[i,r,o],d=[{ - match:m(/\./,p(...Ce)),relevance:0},{className:"built_in", - match:m(/\b/,p(...Ce),/(?=\()/)}],u={match:/->/,relevance:0},b=[u,{ - className:"operator",relevance:0,variants:[{match:De},{match:`\\.(\\.|${Re})+`}] - }],_="([0-9a-fA-F]_*)+",h={className:"number",relevance:0,variants:[{ - match:"\\b(([0-9]_*)+)(\\.(([0-9]_*)+))?([eE][+-]?(([0-9]_*)+))?\\b"},{ - match:`\\b0x(${_})(\\.(${_}))?([pP][+-]?(([0-9]_*)+))?\\b`},{ - match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},f=(e="")=>({ - className:"subst",variants:[{match:m(/\\/,e,/[0\\tnr"']/)},{ - match:m(/\\/,e,/u\{[0-9a-fA-F]{1,8}\}/)}]}),E=(e="")=>({className:"subst", - match:m(/\\/,e,/[\t ]*(?:[\r\n]|\r\n)/)}),y=(e="")=>({className:"subst", - label:"interpol",begin:m(/\\/,e,/\(/),end:/\)/}),w=(e="")=>({begin:m(e,/"""/), - end:m(/"""/,e),contains:[f(e),E(e),y(e)]}),N=(e="")=>({begin:m(e,/"/), - end:m(/"/,e),contains:[f(e),y(e)]}),v={className:"string", - variants:[w(),w("#"),w("##"),w("###"),N(),N("#"),N("##"),N("###")]},O={ - match:m(/`/,Be,/`/)},k=[O,{className:"variable",match:/\$\d+/},{ - className:"variable",match:`\\$${Le}+`}],x=[{match:/(@|#(un)?)available/, - className:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:Fe, - contains:[...b,h,v]}]}},{className:"keyword",match:m(/@/,p(...ze))},{ - className:"meta",match:m(/@/,Be)}],M={match:g(/\b[A-Z]/),relevance:0,contains:[{ - className:"type", - match:m(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,Le,"+") - },{className:"type",match:$e,relevance:0},{match:/[?!]+/,relevance:0},{ - match:/\.\.\./,relevance:0},{match:m(/\s+&\s+/,g($e)),relevance:0}]},S={ - begin://,keywords:l,contains:[...a,...c,...x,u,M]};M.contains.push(S) - ;const A={begin:/\(/,end:/\)/,relevance:0,keywords:l,contains:["self",{ - match:m(Be,/\s*:/),keywords:"_|0",relevance:0 - },...a,...c,...d,...b,h,v,...k,...x,M]},C={begin://,contains:[...a,M] - },T={begin:/\(/,end:/\)/,keywords:l,contains:[{ - begin:p(g(m(Be,/\s*:/)),g(m(Be,/\s+/,Be,/\s*:/))),end:/:/,relevance:0, - contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:Be}] - },...a,...c,...b,h,v,...x,M,A],endsParent:!0,illegal:/["']/},R={ - match:[/func/,/\s+/,p(O.match,Be,De)],className:{1:"keyword",3:"title.function" - },contains:[C,T,n],illegal:[/\[/,/%/]},D={ - match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"}, - contains:[C,T,n],illegal:/\[|%/},I={match:[/operator/,/\s+/,De],className:{ - 1:"keyword",3:"title"}},L={begin:[/precedencegroup/,/\s+/,$e],className:{ - 1:"keyword",3:"title"},contains:[M],keywords:[...Se,...Me],end:/}/} - ;for(const e of v.variants){const n=e.contains.find((e=>"interpol"===e.label)) - ;n.keywords=l;const t=[...c,...d,...b,h,v,...k];n.contains=[...t,{begin:/\(/, - end:/\)/,contains:["self",...t]}]}return{name:"Swift",keywords:l, - contains:[...a,R,D,{beginKeywords:"struct protocol class extension enum actor", - end:"\\{",excludeEnd:!0,keywords:l,contains:[e.inherit(e.TITLE_MODE,{ - className:"title.class",begin:/[A-Za-z$_][\u00C0-\u02B80-9A-Za-z$_]*/}),...c] - },I,L,{beginKeywords:"import",end:/$/,contains:[...a],relevance:0 - },...c,...d,...b,h,v,...k,...x,M,A]}},grmr_typescript:e=>{ - const n=we(e),t=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],a={ - beginKeywords:"namespace",end:/\{/,excludeEnd:!0, - contains:[n.exports.CLASS_REFERENCE]},i={beginKeywords:"interface",end:/\{/, - excludeEnd:!0,keywords:{keyword:"interface extends",built_in:t}, - contains:[n.exports.CLASS_REFERENCE]},r={$pattern:be, - keyword:me.concat(["type","namespace","interface","public","private","protected","implements","declare","abstract","readonly","enum","override"]), - literal:pe,built_in:ye.concat(t),"variable.language":Ee},s={className:"meta", - begin:"@[A-Za-z$_][0-9A-Za-z$_]*"},o=(e,n,t)=>{ - const a=e.contains.findIndex((e=>e.label===n)) - ;if(-1===a)throw Error("can not find mode to replace");e.contains.splice(a,1,t)} - ;return Object.assign(n.keywords,r), - n.exports.PARAMS_CONTAINS.push(s),n.contains=n.contains.concat([s,a,i]), - o(n,"shebang",e.SHEBANG()),o(n,"use_strict",{className:"meta",relevance:10, - begin:/^\s*['"]use strict['"]/ - }),n.contains.find((e=>"func.def"===e.label)).relevance=0,Object.assign(n,{ - name:"TypeScript",aliases:["ts","tsx"]}),n},grmr_vbnet:e=>{ - const n=e.regex,t=/\d{1,2}\/\d{1,2}\/\d{4}/,a=/\d{4}-\d{1,2}-\d{1,2}/,i=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,r=/\d{1,2}(:\d{1,2}){1,2}/,s={ - className:"literal",variants:[{begin:n.concat(/# */,n.either(a,t),/ *#/)},{ - begin:n.concat(/# */,r,/ *#/)},{begin:n.concat(/# */,i,/ *#/)},{ - begin:n.concat(/# */,n.either(a,t),/ +/,n.either(i,r),/ *#/)}] - },o=e.COMMENT(/'''/,/$/,{contains:[{className:"doctag",begin:/<\/?/,end:/>/}] - }),l=e.COMMENT(null,/$/,{variants:[{begin:/'/},{begin:/([\t ]|^)REM(?=\s)/}]}) - ;return{name:"Visual Basic .NET",aliases:["vb"],case_insensitive:!0, - classNameAliases:{label:"symbol"},keywords:{ - keyword:"addhandler alias aggregate ansi as async assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into iterator join key let lib loop me mid module mustinherit mustoverride mybase myclass namespace narrowing new next notinheritable notoverridable of off on operator option optional order overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly yield", - built_in:"addressof and andalso await directcast gettype getxmlnamespace is isfalse isnot istrue like mod nameof new not or orelse trycast typeof xor cbool cbyte cchar cdate cdbl cdec cint clng cobj csbyte cshort csng cstr cuint culng cushort", - type:"boolean byte char date decimal double integer long object sbyte short single string uinteger ulong ushort", - literal:"true false nothing"}, - illegal:"//|\\{|\\}|endif|gosub|variant|wend|^\\$ ",contains:[{ - className:"string",begin:/"(""|[^/n])"C\b/},{className:"string",begin:/"/, - end:/"/,illegal:/\n/,contains:[{begin:/""/}]},s,{className:"number",relevance:0, - variants:[{begin:/\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/ - },{begin:/\b\d[\d_]*((U?[SIL])|[%&])?/},{begin:/&H[\dA-F_]+((U?[SIL])|[%&])?/},{ - begin:/&O[0-7_]+((U?[SIL])|[%&])?/},{begin:/&B[01_]+((U?[SIL])|[%&])?/}]},{ - className:"label",begin:/^\w+:/},o,l,{className:"meta", - begin:/[\t ]*#(const|disable|else|elseif|enable|end|externalsource|if|region)\b/, - end:/$/,keywords:{ - keyword:"const disable else elseif enable end externalsource if region then"}, - contains:[l]}]}},grmr_wasm:e=>{e.regex;const n=e.COMMENT(/\(;/,/;\)/) - ;return n.contains.push("self"),{name:"WebAssembly",keywords:{$pattern:/[\w.]+/, - keyword:["anyfunc","block","br","br_if","br_table","call","call_indirect","data","drop","elem","else","end","export","func","global.get","global.set","local.get","local.set","local.tee","get_global","get_local","global","if","import","local","loop","memory","memory.grow","memory.size","module","mut","nop","offset","param","result","return","select","set_global","set_local","start","table","tee_local","then","type","unreachable"] - },contains:[e.COMMENT(/;;/,/$/),n,{match:[/(?:offset|align)/,/\s*/,/=/], - className:{1:"keyword",3:"operator"}},{className:"variable",begin:/\$[\w_]+/},{ - match:/(\((?!;)|\))+/,className:"punctuation",relevance:0},{ - begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword", - 3:"title.function"}},e.QUOTE_STRING_MODE,{match:/(i32|i64|f32|f64)(?!\.)/, - className:"type"},{className:"keyword", - match:/\b(f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|nearest|neg?|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|store(?:8|16|32)?|sqrt|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))\b/ - },{className:"number",relevance:0, - match:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/ - }]}},grmr_yaml:e=>{ - const n="true false yes no null",t="[\\w#;/?:@&=+$,.~*'()[\\]]+",a={ - className:"string",relevance:0,variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/ - },{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,{className:"template-variable", - variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]}]},i=e.inherit(a,{ - variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),r={ - end:",",endsWithParent:!0,excludeEnd:!0,keywords:n,relevance:0},s={begin:/\{/, - end:/\}/,contains:[r],illegal:"\\n",relevance:0},o={begin:"\\[",end:"\\]", - contains:[r],illegal:"\\n",relevance:0},l=[{className:"attr",variants:[{ - begin:"\\w[\\w :\\/.-]*:(?=[ \t]|$)"},{begin:'"\\w[\\w :\\/.-]*":(?=[ \t]|$)'},{ - begin:"'\\w[\\w :\\/.-]*':(?=[ \t]|$)"}]},{className:"meta",begin:"^---\\s*$", - relevance:10},{className:"string", - begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{ - begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0, - relevance:0},{className:"type",begin:"!\\w+!"+t},{className:"type", - begin:"!<"+t+">"},{className:"type",begin:"!"+t},{className:"type",begin:"!!"+t - },{className:"meta",begin:"&"+e.UNDERSCORE_IDENT_RE+"$"},{className:"meta", - begin:"\\*"+e.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)", - relevance:0},e.HASH_COMMENT_MODE,{beginKeywords:n,keywords:{literal:n}},{ - className:"number", - begin:"\\b[0-9]{4}(-[0-9][0-9]){0,2}([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?(\\.[0-9]*)?([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?\\b" - },{className:"number",begin:e.C_NUMBER_RE+"\\b",relevance:0},s,o,a],c=[...l] - ;return c.pop(),c.push(i),r.contains=c,{name:"YAML",case_insensitive:!0, - aliases:["yml"],contains:l}}});const je=ne;for(const e of Object.keys(Ue)){ - const n=e.replace("grmr_","").replace("_","-");je.registerLanguage(n,Ue[e])} - return je}() - ;"object"==typeof exports&&"undefined"!=typeof module&&(module.exports=hljs); \ No newline at end of file diff --git a/hljs.min.css b/hljs.min.css deleted file mode 100644 index a75ea9116..000000000 --- a/hljs.min.css +++ /dev/null @@ -1,9 +0,0 @@ -/*! - Theme: Default - Description: Original highlight.js style - Author: (c) Ivan Sagalaev - Maintainer: @highlightjs/core-team - Website: https://highlightjs.org/ - License: see project LICENSE - Touched: 2021 -*/pre code.hljs{display:block;overflow-x:auto;padding:1em}code.hljs{padding:3px 5px}.hljs{background:#f3f3f3;color:#444}.hljs-comment{color:#697070}.hljs-punctuation,.hljs-tag{color:#444a}.hljs-tag .hljs-attr,.hljs-tag .hljs-name{color:#444}.hljs-attribute,.hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-name,.hljs-selector-tag{font-weight:700}.hljs-deletion,.hljs-number,.hljs-quote,.hljs-selector-class,.hljs-selector-id,.hljs-string,.hljs-template-tag,.hljs-type{color:#800}.hljs-section,.hljs-title{color:#800;font-weight:700}.hljs-link,.hljs-operator,.hljs-regexp,.hljs-selector-attr,.hljs-selector-pseudo,.hljs-symbol,.hljs-template-variable,.hljs-variable{color:#ab5656}.hljs-literal{color:#695}.hljs-addition,.hljs-built_in,.hljs-bullet,.hljs-code{color:#397300}.hljs-meta{color:#1f7199}.hljs-meta .hljs-string{color:#38a}.hljs-emphasis{font-style:italic}.hljs-strong{font-weight:700} \ No newline at end of file diff --git a/index.html b/index.html index 30291b588..f54f9febc 100644 --- a/index.html +++ b/index.html @@ -1,17 +1,5143 @@ -Introduction | Cyber Docs v0.3 - -
    Introduction -

    Introduction. -#

    Cyber is a fast, efficient, and concurrent scripting language. To learn more about Cyber itself visit the website at cyberscript.dev.

    Cyber is easy to learn. These docs provide a reference manual for the language. You can read it in order or jump around using the navigation.

    You may come across features that are marked Incomplete or Planned. This is because the docs are written as if all features have been completed already.

    Hello World. -#

    import math
    -
    -var worlds = ['World', '世界', 'दुनिया', 'mundo']
    +
    +
    +    
    +    
    +    Cyber Docs
    +    
    +    
    +    
    +
    +
    +
    +

    Cyber Docs

    +
    dev
    + +
    Table of Contents
    + +
    +
    + +

    Introduction. #

    +

    Cyber is a fast, efficient, and concurrent scripting language. The landing page is at cyberscript.dev and contains performance metrics and release notes.

    +

    Cyber is easy to learn. These docs provide a reference manual for the language. You can read it in order or jump around using the navigation.

    +

    You may come across features that are marked Incomplete or Planned. This is because the docs are written as if all features have been completed already.

    +

    Hello World. #

    +
    import math
    +
    +var worlds = ['World', '世界', 'दुनिया', 'mundo']
     worlds.append(math.random())
    -for worlds -> w:
    -    print 'Hello, $(w)!'
    -
    \ No newline at end of file +for worlds -> w: + print 'Hello, $(w)!' + +

    Syntax. #

    + + +
    + + + +
    +

    top

    +

    Cyber's syntax is concise and easy to read.

    +

    Statements. #

    +

    A statement ends with the new line.

    +
    -- An assignment statement.
    +var a = 123
    +
    +

    parent

    +

    Blocks. #

    +

    Some statements can start a new block with a colon. +The first statement in a new block must be indented further. +Spaces or tabs can be used for indentation but not both.

    +
    -- This `if` statement begins a new block.
    +if true:
    +    var a = 234
    +
    +

    Subsequent statements in the block must follow the same indentation. +The block ends when a statement recedes from this indentation.

    +
    var items = [10, 20, 30]
    +for items -> it:
    +    if it == 20:
    +        print it
    +    print it      -- This is the first statement outside of the `if` block.
    +
    +

    Single-line blocks allow only one statement after a starting block.

    +
    -- A single line block.
    +if true: print 123
    +
    +if true: print 123
    +    -- This is an indentation error since the single-line block is already consumed.
    +    print 234
    +
    +

    Since blocks require at least one statement, use pass as a placeholder statement.

    +
    func foo():
    +    pass
    +
    +

    parent

    +

    Variables. #

    +

    Cyber supports dynamic and static typing. If you're used to a dynamic language such as Python, JavaScript, or Lua, use my to declare your variables and object fields. If you're used to a static language then use var instead. The documentation will use static typing by default.

    +

    parent

    +

    Local variables. #

    +

    Local variables exist until the end of their scope. +They are declared and initialized using the var keyword:

    +
    var a = 123
    +
    +

    When declared without a type specifier next to the variable, it infers the type from the right initializer. +To declare variables for a specific type, see Typed variables.

    +

    Variables can be set afterwards using the = operator:

    +
    a = 234
    +
    +

    parent

    +

    Dynamic variables. #

    +

    Dynamically typed variables are easier to work with and there is no friction when using them. They are declared using the my keyword:

    +
    my a = 123
    +
    +

    To understand more about dynamically and statically typed code, see Type System.

    +

    parent

    +

    Variable scopes. #

    +

    Blocks create a new variable scope. Variables declared in the current scope will take precedence over any parent variables with the same name:

    +
    func foo():
    +    var a = 234
    +
    +    if true:
    +        var a = 345     -- New `a` declared.
    +        print a         -- Prints "345"
    +
    +    print a             -- Prints "234"
    +
    +

    parent

    +

    Static Variables. #

    +

    Static variables live until the end of the script. +They act as global variables and are visible from anywhere in the script.

    +

    They are declared with var but a namespace must be provided before the variable name:

    +
    var Root.a = 123
    +
    +func foo():
    +    print a     -- '123'
    +
    +

    The Root symbol is used to reference the current module's namespace.

    +

    Since static variables are initialized outside of a fiber's execution flow, they can not reference any local variables:

    +
    -- Static declaration.
    +var Root.b = a   -- Compile error, initializer can not reference a local variable.
    +
    +-- Main execution.
    +var a = 123
    +
    +

    However, they can be reassigned after initialization:

    +
    var Root.b = 0
    +
    +var a = 123
    +b = a            -- Reassigning after initializing.
    +
    +

    Static variable initializers have a natural order based on when it was encountered by the compiler. +In the case of imported variables, the order of the import would affect this order. +The following would print '123' before '234':

    +
    var Root.a = print(123)
    +var Root.b = print(234)
    +
    +

    When the initializers reference other static variables, those child references are initialized first in DFS order and supersede the natural ordering. The following initializes b before a.

    +
    var Root.a = b + 321
    +var Root.b = 123
    +
    +print a        -- '444'
    +
    +

    Circular references in initializers are not allowed. +When initialization encounters a reference that creates a circular dependency an error is reported.

    +
    var Root.a = b
    +var Root.b = a       -- CompileError. Referencing `a` creates a circular dependency.
    +
    +

    Sometimes, you may want to initialize a static variable by executing multiple statements in order. +For this use case, you can use a declaration block. Planned Feature

    +
    var Root.myImage =:
    +    var img = loadImage('me.png')
    +    img.resize(100, 100)
    +    img.filter(.blur, 5)
    +    break img
    +
    +

    The final resulting value that is assigned to the static variable is provided by a break statement. If a break statement is not provided, none is assigned instead.

    +

    parent

    +

    Reserved identifiers. #

    +

    Keywords. #

    +

    There are 25 general keywords. This list categorizes them:

    + +

    parent

    +

    Contextual keywords. #

    +

    These keywords only have meaning in a certain context.

    + +

    parent

    +

    Symbols. #

    + +

    parent

    +

    Literals. #

    + +

    parent

    +

    Operators. #

    +

    Cyber supports the following operators. They are ordered from highest to lowest precedence.

    +
    OperatorDescription
    << >>Bitwise left shift, right shift.
    &Bitwise and.
    \| \|\|Bitwise or, exclusive or.
    ^Power.
    / % *Division, modulus, multiplication.
    + -Addition, subtraction.
    asType casting.
    > >= < <= != ==Greater, greater or equal, less, less or equal, not equals, equals.
    andLogical and.
    orLogical or.

    parent

    +

    Arithmetic Operators. #

    +

    The following arithmetic operators are supported for the numeric data types.

    +
    1 + 2     -- Addition, evaluates to 3.
    +100 - 10  -- Subtraction, evaluates to 90.
    +3 * 4     -- Multiplication, evaluates to 12.
    +20 / 5    -- Division, evaluates to 4.
    +2 ^ 4     -- Raise to the power, evaluates to 16.
    +12 % 5    -- Modulus remainder, evaluates to 2.
    +-(10)     -- Apply negative, evaluates to -10.
    +
    +

    parent

    +

    Comparison Operators. #

    +

    Cyber supports the following comparison operators. +By default, a comparison operator evaluates to a Boolean value.

    +

    The equals operator returns true if the two values are equal. For primitive types, the comparison checks the types and the underlying value. For strings, the underlying bytes are compared for equality. For objects, the comparison checks that the two values reference the same object.

    +
    1 == 1      -- Evaluates to `true`
    +1 == 2      -- Evaluates to `false`
    +1 == true   -- Evaluates to `false`
    +
    +my a = 'abc'
    +a == 'abc'  -- Evaluates to `true`
    +
    +a = []
    +my b = a
    +a == b      -- Evaluates to `true`
    +a == []     -- Evaluates to `false`
    +
    +

    The not equals operator returns true if the two values are not equal.

    +
    1 != 1      -- Evaluates to `false`
    +1 != 2      -- Evaluates to `true`
    +
    +

    Number types have additional comparison operators.

    +
    a > b    -- `true` if a is greater than b
    +a >= b   -- `true` if a is greater than or equal to b
    +a < b    -- `true` if a is less than b
    +a <= b   -- `true` if a is less than or equal to b
    +
    +

    parent

    +

    Logic Operators. #

    +

    The logical operators and, or, and not are supported.

    +

    and evaluates to a if a is not truthy. Otherwise, it evaluates to b. If a is not truthy, the evaluation of b is not executed. A numeric value that isn't 0 is truthy. An object reference is always truthy. The none value is not truthy.

    +
    true and true  -- Evaluates to true
    +123 and 234    -- Evaluates to 234
    +123 and 0      -- Evaluates to false
    +
    +

    or evaluates to a if a is truthy. Otherwise, it evaluates to b. If a is found to be truthy, the evaluation of b is not executed.

    +
    true or false  -- Evaluates to true
    +false or true  -- Evaluates to true
    +false or false -- Evaluates to false
    +123 or false   -- Evaluates to 123
    +
    +

    The unary operator not performs negation on the boolean value. The unary operator ! can also be used instead of not.

    +
    not false     -- Evaluates to true
    +not true      -- Evaluates to false
    +not 0         -- Evaluates to true      
    +not 123       -- Evaluates to false
    +!false        -- Evaluates to true
    +!true         -- Evaluates to false
    +
    +

    parent

    +

    Bitwise Operators. #

    +

    The following bitwise operators are supported for int number values.

    +
    -- Bitwise and: any underlying bits that are set in both integers are set in the new integer.
    +a & b
    +
    +-- Bitwise or: any underlying bits that are set in either integer a or integer b are set in the new integer.
    +a | b
    +
    +-- Bitwise exclusive or: any underlying bits that are set in either integer a or integer b but not both are set in the new integer.
    +a || b
    +
    +-- Bitwise right shift: a's bits are shifted b bits to the least significant end. This performs sign-extension on the 32-bit integer.
    +a >> b
    +
    +-- Bitwise left shift: a's bits are shifted b bits to the most significant end. This does not perform sign-extension on the 32-bit integer.
    +a << b
    +
    +-- Bitwise not: a's integer bits are flipped.
    +~a
    +
    +

    parent

    +

    Operator overloading. #

    +

    See Operator overloading in Metaprogramming.

    +

    parent

    +

    Comments. #

    +

    A single line comment starts with two hyphens and ends at the end of the line.

    +
    -- This is a comment.
    +
    +var a = 123   -- This is a comment on the same line as a statement.
    +
    +

    There will be multi-line comments in Cyber but the syntax has not been determined.

    +

    parent

    +

    CYON. #

    +

    CYON or the Cyber object notation is similar to JSON. The format uses the same literal value semantics as Cyber.

    +
    [
    +    name: 'John Doe',
    +    'age': 25,
    +    -- This is a comment
    +    cities: [
    +        'New York',
    +        'San Francisco',
    +        'Tokyo',
    +    ],
    +]
    +
    +

    parent

    +

    Data Types. #

    + + + +
    + + + +
    +

    top

    +

    In Cyber, there are primitive types and object types. Primitives are copied around by value and don't need additional heap memory or reference counts.

    +

    Primitives include Booleans, Floats, Integers, Enums, Symbols, Error Values, and the none value.

    +

    Object types include Lists, Tuples, Maps, Strings, Arrays, User Objects, Lambdas, Fibers, Enums with payloads, Pointers, and several internal object types.

    +

    None. #

    +

    The none value represents an empty value. This is similar to null in other languages.

    +

    parent

    +

    Booleans. #

    +

    Booleans can be true or false. See type bool.

    +
    var a = true
    +if a:
    +    print 'a is true'
    +
    +

    When other value types are coerced to the bool type, the truthy value is determined as follows.

    +
      +
    • The none value is false.
    • +
    • Other objects and values are always true.
    • +
    +

    parent

    +

    Numbers. #

    +

    Integers. #

    +

    int is the default integer type. It has 48-bits and can represent integers in the range -(247) to 247-1. See type int.

    +

    When a numeric literal is used and the type can not be inferred, it will default to the int type:

    +
    var a = 123
    +
    +

    Integer notations always produce a int value:

    +
    var a = 0xFF     -- hex.
    +a = 0o17         -- octal.
    +a = 0b1010       -- binary.
    +a = `🐶`         -- UTF-8 rune.
    +
    +

    Arbitrary values can be converted to a int using the type as a function.

    +
    var a = '123'
    +var b = int(a) 
    +
    +

    In addition to arithmetic operations, integers can also perform bitwise operations.

    +

    parent

    +

    Floats. #

    +

    float is the default floating point type. It has a (IEEE 754) 64-bit floating point format. See type float.

    +

    Although a float represents a decimal number, it can also represent integers between -(253-1) and (253-1). Any integers beyond the safe integer range is not guaranteed to have a unique representation.

    +

    A numeric literal can be used to create a float if the inferred type is a float:

    +
    var a float = 123
    +
    +

    Decimal and scientific notations always produce a float value:

    +
    var a = 2.34567
    +var b = 123.0e4
    +
    +

    Arbitrary values can be converted to a float using the type as a function.

    +
    var a = '12.3'
    +var b = float(a) 
    +
    +

    parent

    +

    Big Numbers. #

    +

    Planned Feature

    +

    parent

    +

    Strings. #

    +

    The string type represents a sequence of UTF-8 codepoints, also known as runes. Each rune is stored internally as 1-4 bytes and can be represented as an int. See type string.

    +

    Under the hood, there are multiple string implementations to make operations faster by default.

    +

    Strings are immutable, so operations that do string manipulation return a new string. By default, small strings are interned to reduce memory footprint.

    +

    To mutate an existing string, use MutString. Planned Feature

    +

    A string is always UTF-8 validated. Using an Array to represent raw bytes of a string is faster but you'll have to validate them and take care of indexing.

    +

    A single line string literal is surrounded in single quotes.

    +
    var apple = 'a fruit'
    +
    +

    You can escape the single quote inside the literal or use double quotes.

    +
    var apple = 'Bob\'s fruit'
    +apple = "Bob's fruit"
    +
    +

    Concatenate two strings together with the + operator or the method concat.

    +
    var res = 'abc' + 'xyz'
    +res = res.concat('end')
    +
    +

    Strings are UTF-8 encoded.

    +
    var str = 'abc🦊xyz🐶'
    +
    +

    Use double quotes to surround a multi-line string.

    +
    var str = "line a
    +line b
    +line c"
    +
    +

    You can escape double quotes inside the literal or use triple quotes.

    +
    var str = "line a
    +line \"b\"
    +line c"
    +
    +-- Using triple quotes.
    +str = '''line a
    +line "b"
    +line c
    +'''
    +
    +

    The following escape sequences are supported:

    +
    Escape SequenceCodeDescription
    \a0x07Terminal bell.
    \b0x08Backspace.
    \e0x1bEscape character.
    \n0x0aLine feed character.
    \r0x0dCarriage return character.
    \t0x09Horizontal tab character.

    The boundary of each line can be set with a vertical line character. This makes it easier to see the whitespace. +Planned Feature

    +
    var poem = "line a
    +       |  two spaces from the left
    +       |     indented further"
    +
    +

    Using the index operator will return the UTF-8 rune at the given index as a slice. This is equivalent to calling the method sliceAt().

    +
    var str = 'abcd'
    +print str[1]     -- "b"
    +
    +

    Using the slice operator will return a view of the string at the given start and end (exclusive) indexes. The start index defaults to 0 and the end index defaults to the string's length.

    +
    var str = 'abcxyz'
    +var sub = str[0..3]
    +print sub        -- "abc"
    +print str[..5]   -- "abcxy"
    +print str[1..]   -- "bcxyz"
    +
    +-- One way to use slices is to continue a string operation.
    +str = 'abcabcabc'
    +var i = str.findRune(`c`)
    +print(i)                            -- "2"
    +i += 1
    +print(i + str[i..].findRune(`c`))   -- "5"
    +
    +

    parent

    +

    String Interpolation. #

    +

    Expressions can be embedded into string templates with $():

    +
    var name = 'Bob'
    +var points = 123
    +var str = 'Scoreboard: $(name) $(points)'
    +
    +

    String templates can not contain nested string templates.

    +

    parent

    +

    String formatting. #

    +

    Values that can be formatted into a string will have a fmt method:

    +
    var file = os.openFile('data.bin', .read)
    +var bytes = file.readToEnd()
    +
    +-- Dump contents in hex.
    +print '$(bytes.fmt(.x))' 
    +
    +

    parent

    +

    Arrays. #

    +

    An array is an immutable sequence of bytes. It can be used to represent strings but it won't automatically validate their encoding and indexing returns the n'th byte rather than a UTF-8 rune. See type array.

    +
    var a = array('abcd')
    +a = a.insertByte(1, 255)
    +print a[0]     -- "97"
    +print a[1]     -- "255"
    +
    +

    parent

    +

    Bracket literals. #

    +

    Bracket literals are delimited with brackets []. They are used to initialize Lists, Maps, and Objects:

    +
    var list = [1, 2, 3]
    +var map = [ a: 123, b: 234 ]
    +var obj = [MyObject a: 123, b: 234]
    +
    +

    parent

    +

    Lists. #

    +

    Lists are a builtin type that holds an ordered collection of elements. Lists grow or shrink as you insert or remove elements. See type List.

    +
    -- Construct a new list.
    +var list = [1, 2, 3]
    +
    +-- The first element of the list starts at index 0.
    +print list[0]    -- Prints '1'
    +
    +

    Lists can be sliced with the range .. clause. The sliced list becomes a new list that you can modify without affecting the original list. The end index is non-inclusive.

    +
    var list = [ 1, 2, 3, 4, 5 ]
    +list[0..0]    -- []          
    +list[0..3]    -- [ 1, 2, 3 ] 
    +list[3..]     -- [ 4, 5 ]    
    +list[..3]     -- [ 1, 2, 3 ] 
    +
    +

    The +.. invokes the slice operator with an end position that is an increment from the start: Planned Feature

    +
    var list = [ 1, 2, 3, 4, 5 ]
    +list[2+..2]   -- [ 3, 4 ]
    +
    +

    List operations.

    +
    var list = [234]
    +
    +-- Append a value.
    +list.append 123
    +
    +-- Inserting a value at an index.
    +list.insert(1, 345)
    +
    +-- Get the length.
    +print list.len()  -- Prints '2'
    +
    +-- Sort the list in place.
    +list.sort((a, b) => a < b)
    +
    +-- Iterating a list.
    +for list -> it:
    +    print it
    +
    +-- Remove an element at a specific index.
    +list.remove(1)
    +
    +

    parent

    +

    Tuples. #

    +

    Incomplete: Tuples can only be created from @host funcs at the moment.

    +

    parent

    +

    Maps. #

    +

    Maps are a builtin type that store key value pairs in dictionaries. See type Map.

    +

    parent

    +

    Create map. #

    +

    Create a map using key value pairs inside a collection literal:

    +
    var map = [ a: 123, b: () => 5 ]
    +
    +

    Maps entries can be listed in multiple lines:

    +
    var map = [
    +    foo: 1,
    +    bar: 2,
    +]
    +
    +

    parent

    +

    Empty map. #

    +

    The empty map is initialized using [:]:

    +
    var empty = [:]
    +
    +

    parent

    +

    Map indexing. #

    +

    Get a value from the map using the index operator:

    +
    print map['a']
    +
    +

    Maps can be accessed with the . dot operator as well:

    +
    print map.a
    +
    +

    parent

    +

    Map operations. #

    +
    var map = [:]
    +
    +-- Set a key value pair.
    +map[123] = 234
    +
    +-- Get the size of the map.
    +print map.size()
    +
    +-- Remove an entry by key.
    +map.remove 123
    +
    +-- Iterating a map.
    +for map -> [val, key]:
    +    print '$(key) -> $(val)'
    +
    +

    parent

    +

    Map block. #

    +

    Entries can also follow a collection literal block. +This gives structure to the entries and has +the added benefit of allowing multi-line lambdas. +Planned Feature

    +
    var colors = []:
    +    red: 0xFF0000
    +    green: 0x00FF00
    +    blue: 0x0000FF
    +    dump func (c):
    +        print c.red
    +        print c.green
    +        print c.blue
    +
    +    -- Nested map.
    +    darker []: 
    +        red: 0xAA0000
    +        green: 0x00AA00
    +        blue: 0x0000AA
    +
    +

    parent

    +

    Objects. #

    +

    Any value that isn't a primitive is an object. You can declare your own object types using the type object declaration. +Object types are similar to structs and classes in other languages. +Unlike classes, there is no concept of inheritance at the language level.

    +

    parent

    +

    Fields. #

    +

    Fields must be declared at the top of the type object block using var or my:

    +
    type Node object:
    +    var value int
    +    var next  any
    +
    +

    When fields are declared with my instead, they become dynamically typed.

    +

    parent

    +

    Instantiation. #

    +

    New object instances are created using a leading type name and the field values in a collection literal:

    +
    var node = [Node value: 123, next: none]
    +print node.value       -- Prints "123"
    +
    +

    parent

    +

    Methods. #

    +

    Methods allow invoking a function on an object instance using the . operator:

    +
    type Node object:
    +    var value int
    +    var next  any
    +
    +    func inc(n):
    +        value += n
    +
    +    func incAndPrint():
    +        self.inc(321)
    +        print value
    +
    +var n = [Node value: 123, next: none]
    +n.incAndPrint()         -- Prints "444"
    +
    +

    Methods can also be declared outside of the type declaration. To distinguish a method from a type function, self must be provided as a parameter:

    +
    func Node.getNext(self):
    +    return self.next
    +
    +

    parent

    +

    self variable. #

    +

    Type members can be implicitly referenced inside the method. Incomplete: Only the type's fields can be referenced this way.

    +

    To reference members explicitly inside a method, use the builtin self:

    +
    type Node object:
    +    var value int
    +    var next  any
    +
    +    func double():
    +        return self.value * 2
    +
    +

    parent

    +

    Type functions. #

    +

    Type functions are declared outside of the type block with an explicit namespace path:

    +
    type Node object:
    +    var value int
    +    var next  any
    +
    +-- Declare namespace function inside `Node`.
    +func Node.new():
    +    return [Node value: 123, next: none]
    +
    +var n = Node.new()
    +
    +

    parent

    +

    Type variables. #

    +

    Similarily, type variables are declared outside of the type block:

    +
    -- Declare inside the `Node` namespace.
    +var Node.DefaultValue = 100
    +
    +print Node.DefaultValue    -- Prints "100"
    +
    +

    parent

    +

    Enums. #

    +

    A new enum type can be declared with the type enum declaration. +An enum value can only be one of the unique symbols declared in the enum type. +By default, the symbols generate unique ids starting from 0.

    +
    type Fruit enum:
    +    case apple
    +    case orange
    +    case banana
    +    case kiwi
    +
    +var fruit = Fruit.kiwi
    +print fruit       -- 'Fruit.kiwi'
    +print int(fruit)  -- '3'
    +
    +

    When the type of the value is known to be an enum, it can be assigned using a symbol literal.

    +
    var fruit = Fruit.kiwi
    +fruit = .orange
    +print(fruit == Fruit.orange)   -- 'true'
    +
    +

    parent

    +

    Symbols. #

    +

    Symbol literals begin with ., followed by an identifier. They have their own global unique id.

    +
    var currency = .usd
    +print(currency == .usd)   -- 'true'
    +print int(currency)       -- '123' or some arbitrary id.
    +
    +

    parent

    +

    Control Flow. #

    + + +
    + + + +
    +

    top

    +

    Cyber provides the common constructs to branch and enter loops.

    +

    Branching. #

    +

    if statement. #

    +

    Use if and else statements to branch the execution of your code depending on conditions. The else clause can contain a condition which is only evaluated if the previous if or conditional else clause was false.

    +
    var a = 10
    +if a == 10:
    +    print 'a is 10'
    +else a == 20:
    +    print 'a is 20'
    +else:
    +    print 'neither 10 nor 20'
    +
    +

    parent

    +

    Conditional expression. #

    +

    A conditional branch expression evaluates a condition and returns either the true value or false value:

    +
    var a = 10
    +var str = a == 10 ? 'red' else 'blue'
    +
    +

    parent

    +

    and/or #

    +

    Use and and or logical operators to combine conditions:

    +
    var a = 10
    +if a > 5 and a < 15:
    +    print 'a is between 5 and 15'
    +if a == 20 or a == 10: 
    +    print 'a is 10 or 20'
    +
    +

    parent

    +

    Iterations. #

    +

    Infinite loop. #

    +

    The while keyword starts an infinite loop which continues to run the code in the block until a break or return is reached.

    +
    var count = 0
    +while:
    +    if count > 100:
    +        break
    +    count += 1
    +
    +

    parent

    +

    Conditional loop. #

    +

    When the while clause contains a condition, the loop continues to run until the condition is evaluated to false:

    +
    var running = true
    +var count = 0
    +while running:
    +    if count > 100:
    +        running = false
    +    count += 1
    +
    +

    parent

    +

    Unwrapping loop. #

    +

    Using the capture operator -> unwraps the left optional value to the right variable declaration. The loop exits when the left value is none:

    +
    var iter = dir.walk()
    +while iter.next() -> entry:
    +    print entry.name
    +
    +

    parent

    +

    for range. #

    +

    for loops can iterate over a range that starts at an int (inclusive) to a target int (exclusive). +The capture operator -> is used to capture the loop's counter variable:

    +
    for 0..4:
    +    performAction() 
    +
    +for 0..100 -> i:
    +    print i    -- 0, 1, 2, ... , 99
    +
    +

    To decrement the counter instead, use -..:

    +
    for 100-..0 -> i:
    +    print i    -- 100, 99, 98, ... , 1
    +
    +

    When the range operator .. is replaced with ..=, the target int is inclusive: Planned Feature

    +
    for 0..=100 -> i:
    +    print i    -- 0, 1, 2, ... , 100
    +
    +

    parent

    +

    for each. #

    +

    The for clause can iterate over any type that implements the Iterable trait. An Iterable contains an iterator() method which returns an Iterator object. The for loop continually invokes the Iterator's next() method until none is returned.

    +

    Lists can be iterated since they implement the Iterable trait. The capture operator -> is used to capture the value returned from an iterator's next():

    +
    var list = [1, 2, 3, 4, 5]
    +
    +for list -> n:
    +    print n
    +
    +

    Maps can be iterated. next() returns a key and value tuple:

    +
    var map = [ a: 123, b: 234 ]
    +
    +for map -> entry:
    +    print entry[0]
    +    print entry[1]
    +
    +

    Use the destructure syntax to extract the key and value into two separate variables:

    +
    for map -> [ key, val ]:
    +    print 'key $(key) -> value $(val)'
    +
    +

    parent

    +

    for each with index. #

    +

    A counting index can be declared after the each variable. The count starts at 0 for the first value:

    +
    var list = [1, 2, 3, 4, 5]
    +
    +for list -> val, i:
    +    print 'index $(i), value $(val)'
    +
    +

    parent

    +

    Exit loop. #

    +

    Use break to exit a loop. This loop stops printing once i reaches 4:

    +
    for 0..10 -> i:
    +    if i == 4:
    +        break
    +    print i
    +
    +

    parent

    +

    Next iteration. #

    +

    Use continue to skip the rest of the loop and go to the next iteration. +This loop prints 0 through 9 but skips 4:

    +
    for 0..10 -> i:
    +    if i == 4:
    +        continue
    +    print i
    +
    +

    parent

    +

    switch matching. #

    +

    The switch statement branches to a case block from a matching case condition. The expression that is matched against comes after switch statement. Multiple cases can be grouped together using a comma separator. An optional else fallback case is executed when no other cases were matched. +Incomplete: Not all types can be used in the case conditions such as ranges.

    +
    var val = 1000
    +switch val:
    +case 0..100: print 'at or between 0 and 99'
    +case 100   : print 'val is 100'
    +case 200:
    +    print 'val is 200'
    +case 300, 400:
    +    print 'combined case'
    +else:
    +    print 'val is $(val)'
    +
    +

    Note that the switch block must be empty and requires at least one case block or an else block to come after it.

    +

    parent

    +

    switch assignment. #

    +

    Although switch can not be used freely as an expression, it can be assigned to a left variable or destination:

    +
    var shu = switch pepper:
    +case 'bell'     => 0
    +case 'anaheim'  => 500
    +case 'jalapeño' => 2000
    +case 'serrano'  => 10000
    +
    +

    When declaring an assignable switch, the cases must have a return value using the syntax case {cond} => {expr} or else => {expr}.

    +

    parent

    +

    switch break. #

    +

    A break statement exits the current case block and resumes execution after the end of the switch statement: Planned Feature

    +
    switch value:
    +case 0..5:
    +    print value
    +    if value == 3:
    +        break case
    +    print value    -- Skips second print if `value` is 3.
    +
    +

    parent

    +

    Try/Catch. #

    +

    The try catch statement, try else and try expressions provide a way to catch a throwing error and resume execution in a different branch. Learn more about Error Handling.

    +

    parent

    +

    Deferred Execution. #

    +

    Planned Feature

    +

    parent

    +

    Functions. #

    + +

    top

    +

    In Cyber, there are first-class functions (or function values) and static functions.

    +

    Static functions. #

    +

    Static functions are not initially values themselves. They allow function calls to be optimal since they don't need to resolve a dynamic value.

    +

    Static functions are declared with the func keyword and must have a name.

    +
    import math
    +
    +func dist(x0 float, y0 float, x1 float, y1 float) float:
    +    var dx = x0-x1
    +    var dy = y0-y1
    +    return math.sqrt(dx^2 + dy^2)
    +
    +

    Calling static functions is straightforward. You can also reassign or pass them around as function values.

    +
    print dist(0, 0, 10, 20)
    +
    +-- Assigning to a local variable.
    +var bar = dist
    +
    +-- Passing `dist` as an argument.
    +func squareDist(dist, size):
    +    return dist(0.0, 0.0, size, size)
    +    
    +print squareDist(dist, 30.0)
    +
    +

    Functions can only return one value. However, the value can be destructured: Planned Feature

    +
    import {cos, sin} 'math'
    +
    +func compute(rad):
    +    return [ cos(rad), sin(rad) ]
    +
    +var [ x, y ] = compute(pi)
    +
    +

    parent

    +

    Function overloading. #

    +

    Functions can be overloaded by the number of parameters in its signature. Typed functions are further overloaded by their type signatures.

    +
    func foo():
    +    return 2 + 2
    +
    +func foo(n):
    +    return 10 + n
    +
    +func foo(n, m):
    +    return n * m
    +
    +print foo()         -- "4"
    +print foo(2)        -- "12"
    +print foo(20, 5)    -- "100"
    +
    +

    parent

    +

    Lambdas. #

    +

    Lambdas or function values can be assigned to variables or passed as arguments into other constructs.

    +

    When a lambda only returns an expression, it can be declared with a simplified syntax.

    +
    -- Passing simple lambda as an argument.
    +foo(word => toUpper(word))
    +
    +-- A simple lambda with multiple arguments.
    +foo((word, prefix) => prefix + toUpper(word))
    +
    +-- Assigning a simple lambda.
    +canvas.onUpdate = delta_ms => print delta_ms
    +
    +

    Lambdas that need a block of statements can be declared with the func keyword without a name.

    +
    -- Assigning lambda block to a variable.
    +var add = func (a, b):
    +    return a + b
    +
    +-- Passing a lambda block as an argument.
    +canvas.onUpdate():
    +    ..func (delta_ms):
    +        print delta_ms
    +
    +

    Passing a lambda block as a call argument is only possible in a call block. Planned Feature See Function calls.

    +

    parent

    +

    Closures. #

    +

    Lambdas can capture local variables from parent blocks. This example shows the lambda f capturing a from the main scope: Incomplete, only variables one parent block away can be captured.

    +
    var a = 1
    +var f = func():
    +    return a + 2
    +print f()         -- "3"
    +
    +

    The following lambda expression captures a from the function add:

    +
    func add():
    +    var a = 123
    +    return b => a + b
    +var addTo = add()
    +print addTo(10)   -- "133"
    +
    +

    Like static variables, static functions can not reference local variables outside of their scope:

    +
    var a = 1
    +func foo():
    +    print a       -- CompileError: Undeclared variable `a`.
    +
    +

    parent

    +

    Named parameters. #

    +

    Planned Feature

    +

    parent

    +

    Optional parameters. #

    +

    Planned Feature

    +

    parent

    +

    Variadic parameters. #

    +

    Planned Feature

    +

    parent

    +

    Function calls. #

    +

    The straightforward way to call a function is to use parentheses.

    +
    var d = dist(100, 100, 200, 200)
    +
    +

    You can call functions with named parameters.

    +

    Planned Feature

    +
    var d = dist(x0: 10, x1: 20, y0: 30, y1: 40)
    +
    +

    parent

    +

    Shorthand syntax. #

    +

    The shorthand method for calling functions omits parentheses and commas. This only works for functions that accept parameters:

    +

    Incomplete: Only the most trivial cases work with the shorthand method. The case with operators being separated by spaces might not end up being implemented.

    +
    var d = dist 100 100 200 200  -- Calls the function `dist`.
    +
    +func random():       -- Function with no parameters.
    +    return 4
    +
    +var r = random       -- Returns the function itself as a value.
    +                     -- Does not call the function `random`.
    +r = random()         -- Calls the function `random`.
    +
    +

    The top level arguments for the shorthand convention must be separated by whitespace. A string can contain whitespace since it's surrounded by delimiters.

    +
    var a = myFunc 'cyber script'
    +
    +

    The following has a binary expression with spaces inbetween which is not allowed. Removing that whitespace fixes the call expression.

    +
    var a = myFunc 1 + 2     -- Not allowed.
    +a = myFunc 1+2       -- Correct.
    +
    +

    Wrapping arguments in parentheses allows you to keep the whitespace in the sub-expression.

    +
    -- This calls the function `myFunc` with 2 arguments.
    +var a = myFunc 'hello' (1 + 2 * 3)
    +
    +-- Nested function call using the shorthand convention.
    +a = myFunc 'hello' (otherFunc 1+2 'world')
    +
    +

    parent

    +

    Call block syntax. #

    +

    The call expression block continues to add arguments from the block's body. If arguments are omitted from the initial call expression they can be added inside using the .. syntax. Arguments mapped to named parameters have a key value syntax separated by a :. All other arguments are added into a list and passed as the last argument.

    +

    Planned Feature

    +
    foo(123):
    +    ..func ():
    +        return 123
    +    param3: 123
    +    234
    +    bar()
    +    'hello'
    +
    +

    In the example above, the function foo is called with 4 arguments. The first argument 123 is included in the starting call expression. The second argument is a function value inside the call expression block. The third argument is mapped to the param param3. Finally, the fourth argument is a list that contains 234, bar(), and 'hello'.

    +

    parent

    +

    Modules. #

    + + +
    + + + +
    +

    top

    +

    Modules have their own namespace and contain accessible static symbols. By default, importing another Cyber script returns a module with its declared symbols.

    +

    Importing. #

    +

    Import declarations create a local alias to the module referenced by the import specifier. The Cyber CLI comes with some builtin modules like math and test. If the specifier does not refer to a builtin module, it looks for a Cyber script file relative to the current script's directory. An embedder can integrate their own module loader and resolver.

    +
    import test
    +test.eq(123, 123)
    +
    +-- Imports are static declarations so they can be anywhere in the script.
    +import math
    +print math.cos(0)
    +
    +

    When the imported alias needs to be renamed, the import specifier comes after the alias name and must be a string literal.

    +
    import m 'math'
    +print m.random()
    +
    +-- Loading a Cyber module from the local directory.
    +import foo 'bar.cy'
    +print foo.myFunc()
    +print foo.myVar
    +
    +

    A Cyber script that is imported doesn't evaluate its main block. Only static declarations are effectively loaded. If there is code in the main block, it will skip evaluation. In the following, only the print statement in the main.cy is evaluated.

    +
    -- main.cy
    +import a 'foo.cy'
    +print a.foo
    +
    +-- foo.cy
    +import 'bar.cy'
    +var Root.foo = 123
    +print foo         -- Statement is ignored.
    +
    +-- bar.cy
    +var Root.bar = 321
    +print bar         -- Statement is ignored.
    +
    +

    You can have circular imports in Cyber. In the following example, main.cy and foo.cy import each other without any problems.

    +
    -- main.cy
    +import foo 'foo.cy'
    +
    +func printB():
    +    foo.printC()
    +
    +foo.printA()
    +
    +-- foo.cy
    +import main 'main.cy'
    +
    +func printA():
    +    main.printB()
    +
    +func printC():
    +    print 'done'
    +
    +

    Static variable declarations from imports can have circular references. Read more about this in Static Variables.

    +

    Modules can also be destructured using the following syntax:

    +

    Planned Feature

    +
    import { cos, pi } 'math'
    +print cos(pi)
    +
    +

    parent

    +

    Exporting. #

    +

    All static declarations are exported when the script's module is loaded.

    +
    func foo():         -- Exported static function.
    +    print 123
    +
    +var Root.bar = 234  -- Exported static variable.
    +
    +type Thing object:  -- Exported type.
    +    var a float
    +
    +

    parent

    +

    Module URI. #

    +

    To get the absolute path of the current module, reference the compile-time variable ModUri. +This can be used with os.dirName to get the current module directory.

    +
    print #ModUri              -- Prints '/some/path/foo.cy'
    +
    +import os
    +print os.dirName(#ModUri)  -- Prints '/some/path'
    +
    +

    parent

    +

    Visibility. #

    +

    The annotation @hide provides a hint to editors that a static symbol should not appear in the auto-complete. Despite this, the symbol is still reachable.

    +

    parent

    +

    Builtin modules. #

    +

    Builtin modules are the bare minimum that comes with Cyber. The embeddable library contains these modules and nothing more. They include:

    +
      +
    • builtins: Cyber related functions and commonly used utilities.
    • +
    • math: Math constants and functions.
    • +
    +

    parent

    +

    builtins. #

    +

    The builtins module contains functions related to Cyber and common utilities. It is automatically imported into each script's namespace.

    +

    Sample usage:

    +
    -- `print` and `typeof` are available without imports.
    +print 'hello'
    +print typeof('my str').id()
    +
    +

    parent

    + +

    func copy(val any) any

    +

    Copies a primitive value or creates a shallow copy of an object value.

    +

    func dump(val any) none

    +

    Prints the result of toCyon on a value.

    +

    func errorReport() string

    +

    func getObjectRc(val any) int

    +

    Returns the current reference count of an object.

    +

    func is(a any, b any) bool

    +

    Returns whether two values refer to the same instance.

    +

    func isAlpha(val int) bool

    +

    Returns whether a rune is an alphabetic letter.

    +

    func isDigit(val int) bool

    +

    Returns whether a rune is a digit.

    +

    func must(val any) any

    +

    If val is an error, panic(val) is invoked. Otherwise, val is returned.

    +

    func panic(err any) none

    +

    Stop execution in the current fiber and starts unwinding the call stack. See Unexpected Errors.

    +

    func parseCyber(src string) Map

    +

    Parses Cyber source string into structured map object. Currently, only metadata about static declarations is made available but this will be extended to include an AST.

    +

    func parseCyon(src string) any

    +

    Parses a CYON string into a value.

    +

    func performGC() Map

    +

    Runs the garbage collector once to detect reference cycles and abandoned objects. Returns the statistics of the run in a map value.

    +

    func print(str any) none

    +

    Prints a value. The host determines how it is printed.

    +

    func runestr(val int) string

    +

    Converts a rune to a string.

    +

    func toCyon(val any) string

    +

    Encodes a value to CYON string.

    +

    func typeof(val any) metatype

    +

    Returns the value's type as a metatype object.

    +

    func typesym(val any) symbol

    +

    Returns the value's type as one of the predefined symbols: .float, .int, .bool, .object, .list, .map, .string, .array, .function, .fiber, .pointer, .symbol, .metatype, .none, .error

    +

    type bool #

    +

    func bool.'$call'(val any) bool

    +

    Converts a value to either true or false.

    +

    type error #

    +

    func sym() symbol

    +

    Return the underlying symbol.

    +

    func error.'$call'(val any) error

    +

    Create an error from an enum or symbol.

    +

    type int #

    +

    func $prefix~() int

    +

    func $prefix-() int

    +

    func $infix<(o any) bool

    +

    func $infix<=(o any) bool

    +

    func $infix>(o any) bool

    +

    func $infix>=(o any) bool

    +

    func $infix+(o any) int

    +

    func $infix-(o any) int

    +

    func $infix*(o any) int

    +

    func $infix/(o any) int

    +

    func $infix%(o any) int

    +

    func $infix^(o any) int

    +

    func $infix&(o any) int

    +

    func $infix|(o any) int

    +

    func $infix||(o any) int

    +

    func $infix<<(o any) int

    +

    func $infix>>(o any) int

    +

    func fmt(kind symbol) string

    +

    Formats the integer using a kind specifier which can be binary .b, octal .o, decimal .d, hexadecimal .x, ASCII .c.

    +

    func fmt(kind symbol, opts Map) string

    +

    opts.pad provides the ASCII rune that is used for padding with a string length of opts.width.

    +

    func int.'$call'(val any) int

    +

    Converts a value to an 48-bit integer.

    +

    type float #

    +

    func $prefix-() float

    +

    func $infix<(o any) bool

    +

    func $infix<=(o any) bool

    +

    func $infix>(o any) bool

    +

    func $infix>=(o any) bool

    +

    func $infix+(o any) float

    +

    func $infix-(o any) float

    +

    func $infix*(o any) float

    +

    func $infix/(o any) float

    +

    func $infix%(o any) float

    +

    func $infix^(o any) float

    +

    func float.'$call'(val any) float

    +

    Converts the value to a float. Panics if type conversion fails.

    +

    type List #

    +

    func $index(idx any) any

    +

    func $setIndex(idx any, val any) none

    +

    func $slice(start any, end any) List

    +

    func append(val any) none

    +

    Appends a value to the end of the list.

    +

    func concat(list List) none

    +

    Concats the elements of another list to the end of this list.

    +

    func insert(idx int, val any) none

    +

    Inserts a value at index idx.

    +

    func iterator() ListIterator

    +

    Returns a new iterator over the list elements.

    +

    func join(sep string) string

    +

    Returns a new string that joins the elements with separator.

    +

    func len() int

    +

    Returns the number of elements in the list.

    +

    func remove(idx int) none

    +

    Removes an element at index idx.

    +

    func resize(size int) none

    +

    Resizes the list to len elements. If the new size is bigger, none values are appended to the list. If the new size is smaller, elements at the end of the list are removed.

    +

    func slice(start any, end any) List

    +

    func List.fill(val any, n int) List

    +

    Creates a list with initial capacity of n and values set to val. If the value is an object, it is shallow copied n times.

    +

    type ListIterator #

    +

    func next() any

    +

    type tuple #

    +

    func $index(idx int) any

    +

    type Map #

    +

    func $index(key any) any

    +

    func $setIndex(key any, val any) none

    +

    func remove(key any) none

    +

    Removes the element with the given key key.

    +

    func size() int

    +

    Returns the number of key-value pairs in the map.

    +

    func iterator() MapIterator

    +

    Returns a new iterator over the map elements.

    +

    type MapIterator #

    +

    func next() any

    +

    type string #

    +

    func $infix+(o any) string

    +

    func concat(o string) string

    +

    Returns a new string that concats this string and str.

    +

    func endsWith(suffix string) bool

    +

    Returns whether the string ends with suffix.

    +

    func find(needle string) any

    +

    Returns the first index of substring needle in the string or none if not found. SIMD enabled.

    +

    func findAnyRune(runes string) any

    +

    Returns the first index of any UTF-8 rune in runes or none if not found. SIMD enabled.

    +

    func findRune(rune int) int

    +

    Returns the first index of UTF-8 rune needle in the string or none if not found. SIMD enabled.

    +

    func insert(idx int, str string) string

    +

    Returns a new string with str inserted at index idx.

    +

    func isAscii() bool

    +

    Returns whether the string contains all ASCII runes.

    +

    func len() int

    +

    Returns the number of UTF-8 runes in the string.

    +

    func less(other string) bool

    +

    Returns whether this string is lexicographically before other.

    +

    func lower() string

    +

    Returns this string in lowercase.

    +

    func replace(needle string, replacement string) string

    +

    Returns a new string with all occurrences of needle replaced with replacement.

    +

    func repeat(n int) string

    +

    Returns a new string with this string repeated n times.

    +

    func runeAt(n int) int

    +

    Returns the UTF-8 rune at index idx.

    +

    func slice(start any, end any) string

    +

    Returns a slice into this string from start to end (exclusive) indexes. This is equivalent to using the slice index operator [start..end].

    +

    func $slice(start any, end any) string

    +

    func sliceAt(idx int) string

    +

    Returns the UTF-8 rune at index idx as a single rune string.

    +

    func $index(idx int) string

    +

    func split(sep string) List

    +

    Returns a list of UTF-8 strings split at occurrences of sep.

    +

    func startsWith(prefix string) bool

    +

    Returns whether the string starts with prefix.

    +

    func trim(mode symbol, delims string) string

    +

    Returns the string with ends trimmed from runes in delims. mode can be .left, .right, or .ends.

    +

    func upper() string

    +

    Returns this string in uppercase.

    +

    func string.'$call'(val any) string

    +

    Converts a value to a string.

    +

    type array #

    +

    func $infix+(o any) array

    +

    func concat(other array) array

    +

    Returns a new array that concats this array and other.

    +

    func decode() string

    +

    Calls decode(.utf8)

    +

    func decode(encoding symbol) string

    +

    Decodes the array based on an encoding. Supported encodings: .utf8. Returns the decoded string or throws error.Decode.

    +

    func endsWith(suffix array) bool

    +

    Returns whether the array ends with suffix.

    +

    func find(needle array) any

    +

    Returns the first index of needle in the array or none if not found.

    +

    func findAnyByte(bytes array) any

    +

    Returns the first index of any bytes in arrays or none if not found.

    +

    func findByte(byte int) any

    +

    Returns the first index of byte in the array or none if not found.

    +

    func fmt(kind symbol) string

    +

    Formats each byte in the array using a kind specifier which can be binary .b, octal .o, decimal .d, hexadecimal .x, ASCII .c. Each byte is zero padded.

    +

    func getByte(idx int) int

    +

    Returns the byte value (0-255) at the given index idx.

    +

    func getInt(idx int, endian symbol) int

    +

    Returns the int value of the 6 bytes starting from idx with the given endianness (.little or .big).

    +

    func getInt32(idx int, endian symbol) int

    +

    Returns the int value of the 4 bytes starting from idx with the given endianness (.little or .big).

    +

    func insert(idx int, arr array) array

    +

    Returns a new array with arr inserted at index idx.

    +

    func insertByte(idx int, byte int) array

    +

    Returns a new array with byte inserted at index idx.

    +

    func len() int

    +

    Returns the number of bytes in the array.

    +

    func repeat(n int) array

    +

    Returns a new array with this array repeated n times.

    +

    func replace(needle array, replacement array) array

    +

    Returns a new array with all occurrences of needle replaced with replacement.

    +

    func slice(start any, end any) array

    +

    Returns a slice into this array from start to end (exclusive) indexes. This is equivalent to using the slice index operator [start..end].

    +

    func $slice(start any, end any) array

    +

    func $index(idx int) int

    +

    func split(sep array) List

    +

    Returns a list of arrays split at occurrences of sep.

    +

    func startsWith(prefix array) bool

    +

    Returns whether the array starts with prefix.

    +

    func trim(mode symbol, delims array) array

    +

    Returns the array with ends trimmed from runes in delims. mode can be .left, .right, or .ends.

    +

    func array.'$call'(val any) array

    +

    Converts a string to an byte array.

    +

    type arrayIterator #

    +

    type pointer #

    +

    func addr() int

    +

    Returns the memory address as an int. The value may be negative since it's bitcasted from an unsigned 48-bit integer but it retains the original pointer bits.

    +

    func asObject() any

    +

    Unsafe. Casts the pointer to a Cyber object. The object is retained before it's returned.

    +

    func fromCstr(offset int) array

    +

    Unsafe. Returns an array from a null terminated C string.

    +

    func get(offset int, ctype symbol) any

    +

    Unsafe. Dereferences the pointer at a byte offset and returns the C value converted to Cyber.

    +

    func set(offset int, ctype symbol, val any) none

    +

    Unsafe. Converts the value to a compatible C value and writes it to a byte offset from this pointer.

    +

    func toArray(offset int, len int) array

    +

    Unsafe. Returns an array with a copy of the byte data starting from an offset to the specified length.

    +

    func pointer.'$call'(val any) pointer

    +

    Converts a int to a pointer value, or casts to a pointer. This is usually used with FFI.

    +

    type ExternFunc #

    +

    func addr() int

    +

    Returns the memory address as an int. The value may be negative since it's bitcasted from an unsigned 48-bit integer but it retains the original pointer bits.

    +

    type Fiber #

    +

    func status() symbol

    +

    type metatype #

    +

    func id() int

    +
    +

    math. #

    +

    The math module contains commonly used math constants and functions.

    +

    Sample usage:

    +
    import math
    +
    +var r = 10.0
    +print(math.pi * r^2)
    +
    +

    parent

    + +

    var e float

    +

    Euler's number and the base of natural logarithms; approximately 2.718.

    +

    var inf float

    +

    Infinity.

    +

    var log10e float

    +

    Base-10 logarithm of E; approximately 0.434.

    +

    var log2e float

    +

    Base-2 logarithm of E; approximately 1.443.

    +

    var ln10 float

    +

    Natural logarithm of 10; approximately 2.303.

    +

    var ln2 float

    +

    Natural logarithm of 2; approximately 0.693.

    +

    var maxSafeInt float

    +

    The maximum integer value that can be safely represented as a float. 2^53-1 or 9007199254740991.

    +

    var minSafeInt float

    +

    The minumum integer value that can be safely represented as a float. -(2^53-1) or -9007199254740991.

    +

    var nan float

    +

    Not a number. Note that nan == nan. However, if a nan came from an arithmetic operation, the comparison is undefined. Use isNaN instead.

    +

    var neginf float

    +

    Negative infinity.

    +

    var pi float

    +

    Ratio of a circle's circumference to its diameter; approximately 3.14159.

    +

    var sqrt1_2 float

    +

    Square root of ½; approximately 0.707.

    +

    var sqrt2 float

    +

    Square root of 2; approximately 1.414.

    +

    func abs(a float) float

    +

    Returns the absolute value of x.

    +

    func acos(a float) float

    +

    Returns the arccosine of x.

    +

    func acosh(a float) float

    +

    Returns the hyperbolic arccosine of x.

    +

    func asin(a float) float

    +

    Returns the arcsine of x.

    +

    func asinh(a float) float

    +

    Returns the hyperbolic arcsine of a number.

    +

    func atan(a float) float

    +

    Returns the arctangent of x.

    +

    func atan2(a float, b float) float

    +

    Returns the arctangent of the quotient of its arguments.

    +

    func atanh(a float) float

    +

    Returns the hyperbolic arctangent of x.

    +

    func cbrt(a float) float

    +

    Returns the cube root of x.

    +

    func ceil(a float) float

    +

    Returns the smallest integer greater than or equal to x.

    +

    func clz32(a float) float

    +

    Returns the number of leading zero bits of the 32-bit integer x.

    +

    func cos(a float) float

    +

    Returns the cosine of x.

    +

    func cosh(a float) float

    +

    Returns the hyperbolic cosine of x.

    +

    func exp(a float) float

    +

    Returns e^x, where x is the argument, and e is Euler's number (2.718…, the base of the natural logarithm).

    +

    func expm1(a float) float

    +

    Returns subtracting 1 from exp(x).

    +

    func floor(a float) float

    +

    Returns the largest integer less than or equal to x.

    +

    func frac(a float) float

    +

    Returns the fractional or decimal part of a float value.

    +

    func hypot(a float, b float) float

    +

    Returns the square root of the sum of squares of its arguments.

    +

    func isInt(a float) bool

    +

    Returns true if the float has no fractional part, otherwise false.

    +

    func isNaN(a float) bool

    +

    Returns whether x is not a number.

    +

    func ln(a float) float

    +

    Returns the natural logarithm (㏒e; also, ㏑) of x.

    +

    func log(a float, b float) float

    +

    Returns the logarithm of y with base x.

    +

    func log10(a float) float

    +

    Returns the base-10 logarithm of x.

    +

    func log1p(a float) float

    +

    Returns the natural logarithm (㏒e; also ㏑) of 1 + x for the number x.

    +

    func log2(a float) float

    +

    Returns the base-2 logarithm of x.

    +

    func max(a float, b float) float

    +

    Returns the largest of two numbers.

    +

    func min(a float, b float) float

    +

    Returns the smallest of two numbers.

    +

    func mul32(a float, b float) float

    +

    Returns the result of the 32-bit integer multiplication of x and y. Integer overflow is allowed.

    +

    func pow(a float, b float) float

    +

    Returns base x to the exponent power y (that is, x^y).

    +

    func random() float

    +

    Returns a pseudo-random number between 0 and 1.

    +

    func round(a float) float

    +

    Returns the value of the number x rounded to the nearest integer.

    +

    func sign(a float) float

    +

    Returns the sign of the x, indicating whether x is positive, negative, or zero.

    +

    func sin(a float) float

    +

    Returns the sine of x.

    +

    func sinh(a float) float

    +

    Returns the hyperbolic sine of x.

    +

    func sqrt(a float) float

    +

    Returns the positive square root of x.

    +

    func tan(a float) float

    +

    Returns the tangent of x.

    +

    func tanh(a float) float

    +

    Returns the hyperbolic tangent of x.

    +

    func trunc(a float) float

    +

    Returns the integer portion of x, removing any fractional digits.

    +
    +

    Std modules. #

    +

    Std modules come with Cyber's CLI. They include:

    +
      +
    • os: System level functions.
    • +
    • test: Utilities for testing.
    • +
    +

    parent

    +

    os. #

    +

    Cyber's os module contains system level functions. It's still undecided as to how much should be included here so it's incomplete. You can still access os and libc functions yourself using Cyber's FFI or embedding API.

    +

    Sample usage:

    +
    import os
    +
    +var map = os.getEnvAll()
    +for map -> [k, v]:
    +    print '$(k) -> $(v)'
    +
    +

    parent

    + +

    var cpu string

    +

    The current cpu arch's tag name.

    +

    var endian symbol

    +

    The current arch's endianness: .little, .big

    +

    var stderr File

    +

    Standard error file descriptor.

    +

    var stdin File

    +

    Standard input file descriptor.

    +

    var stdout File

    +

    Standard output file descriptor.

    +

    var system string

    +

    The current operating system's tag name.

    +

    var vecBitSize int

    +

    Default SIMD vector bit size.

    +

    func access(path string, mode symbol) none

    +

    Attempts to access a file at the given path with the .read, .write, or .readWrite mode. Throws an error if unsuccessful.

    +

    func args() List

    +

    Returns the command line arguments in a List. Each argument is converted to a string.

    +

    func cacheUrl(url string) string

    +

    Returns the path of a locally cached file of url. If no such file exists locally, it's fetched from url.

    +

    func copyFile(srcPath string, dstPath string) none

    +

    Copies a file to a destination path.

    +

    func createDir(path string) none

    +

    Creates the directory at path. Returns true if successful.

    +

    func createFile(path string, truncate bool) File

    +

    Creates and opens the file at path. If truncate is true, an existing file will be truncated.

    +

    func cstr(s any) pointer

    +

    Returns a null terminated C string.

    +

    func cwd() string

    +

    Returns the current working directory.

    +

    func dirName(path string) string

    +

    Returns the given path with its last component removed.

    +

    func execCmd(args List) Map

    +

    Runs a shell command and returns the stdout/stderr.

    +

    func exePath() string

    +

    Returns the current executable's path.

    +

    func exit(status int) none

    +

    Exits the program with a status code.

    +

    func fetchUrl(url string) array

    +

    Fetches the contents at url using the HTTP GET request method.

    +

    func free(ptr pointer) none

    +

    Frees the memory located at ptr.

    +

    func getEnv(key string) string

    +

    Returns an environment variable by key.

    +

    func getEnvAll() Map

    +

    Returns all environment variables as a Map.

    +

    func malloc(size int) pointer

    +

    Allocates size bytes of memory and returns a pointer.

    +

    func milliTime() float

    +

    Return the calendar timestamp, in milliseconds, relative to UTC 1970-01-01. For an high resolution timestamp, use now().

    +

    func newFFI() FFI

    +

    Returns a new FFI context for declaring C mappings and binding a dynamic library.

    +

    func now() float

    +

    Returns the current time (in high resolution seconds) since an arbitrary point in time.

    +

    func openDir(path string) Dir

    +

    Invokes openDir(path, false).

    +

    func openDir(path string, iterable bool) Dir

    +

    Opens a directory at the given path. iterable indicates that the directory's entries can be iterated.

    +

    func openFile(path string, mode symbol) File

    +

    Opens a file at the given path with the .read, .write, or .readWrite mode.

    +

    func parseArgs(options List) Map

    +

    Given expected ArgOptions, returns a map of the options and a rest entry which contains the non-option arguments.

    +

    func readAll() string

    +

    Reads stdin to the EOF as a UTF-8 string. To return the bytes instead, use stdin.readAll().

    +

    func readFile(path string) string

    +

    Reads the file contents from path as a UTF-8 string. To return the bytes instead, use File.readAll().

    +

    func readLine() string

    +

    Reads stdin until a new line as a string. This is intended to read user input from the command line. For bulk reads from stdin, use stdin.

    +

    func realPath(path string) string

    +

    Returns the absolute path of the given path.

    +

    func removeDir(path string) none

    +

    Removes an empty directory at path. Returns true if successful.

    +

    func removeFile(path string) none

    +

    Removes the file at path. Returns true if successful.

    +

    func setEnv(key string, val string) none

    +

    Sets an environment variable by key.

    +

    func sleep(ms float) none

    +

    Pauses the current thread for given milliseconds.

    +

    func unsetEnv(key string) none

    +

    Removes an environment variable by key.

    +

    func writeFile(path string, contents any) none

    +

    Writes contents as a string or bytes to a file.

    +

    type File #

    +

    func close() none

    +

    Closes the file handle. File ops invoked afterwards will return error.Closed.

    +

    func iterator() any

    +

    func next() any

    +

    func read(n int) array

    +

    Reads at most n bytes as an array. n must be at least 1. A result with length 0 indicates the end of file was reached.

    +

    func readAll() array

    +

    Reads to the end of the file and returns the content as an array.

    +

    func seek(n int) none

    +

    Seeks the read/write position to pos bytes from the start. Negative pos is invalid.

    +

    func seekFromCur(n int) none

    +

    Seeks the read/write position by pos bytes from the current position.

    +

    func seekFromEnd(n int) none

    +

    Seeks the read/write position by pos bytes from the end. Positive pos is invalid.

    +

    func stat() Map

    +

    Returns info about the file as a Map.

    +

    func streamLines() File

    +

    Equivalent to streamLines(4096).

    +

    func streamLines(bufSize int) File

    +

    Returns an iterable that streams lines ending in \n, \r, \r\n, or the EOF. The lines returned include the new line character(s). A buffer size of bufSize bytes is allocated for reading. If \r is found at the end of the read buffer, the line is returned instead of waiting to see if the next read has a connecting \n.

    +

    func write(val any) int

    +

    Writes a string or array at the current file position. The number of bytes written is returned.

    +

    type Dir #

    +

    func iterator() DirIterator

    +

    Returns a new iterator over the directory entries. If this directory was not opened with the iterable flag, error.NotAllowed is returned instead.

    +

    func stat() Map

    +

    Returns info about the file as a Map.

    +

    func walk() DirIterator

    +

    Returns a new iterator over the directory recursive entries. If this directory was not opened with the iterable flag, error.NotAllowed is returned instead.

    +

    type DirIterator #

    +

    func next() any

    +

    type FFI #

    +

    func bindCallback(fn any, params List, ret symbol) ExternFunc

    +

    Creates an ExternFunc that contains a C function pointer with the given signature. The extern function is a wrapper that calls the provided user function. Once created, the extern function is retained and managed by the FFI context.

    +

    func bindLib(path any) any

    +

    Calls bindLib(path, [:]).

    +

    func bindLib(path any, config Map) any

    +

    Creates a handle to a dynamic library and functions declared from cfunc. By default, an anonymous object is returned with the C-functions binded as the object's methods. If config contains genMap: true, a Map is returned instead with C-functions binded as function values.

    +

    func bindObjPtr(obj any) pointer

    +

    Returns a Cyber object's pointer. Operations on the pointer is unsafe, but it can be useful when passing it to C as an opaque pointer. The object is also retained and managed by the FFI context.

    +

    func cbind(mt metatype, fields List) none

    +

    Binds a Cyber type to a C struct.

    +

    func cfunc(name string, params List, ret any) none

    +

    Declares a C function which will get binded to the library handle created from bindLib.

    +

    func new(ctype symbol) pointer

    +

    Allocates memory for a C struct or primitive with the given C type specifier. A pointer to the allocated memory is returned. Eventually this will return a cpointer instead which will be more idiomatic to use.

    +

    func unbindObjPtr(obj any) none

    +

    Releases the object from the FFI context. External code should no longer use the object's pointer since it's not guaranteed to exist or point to the correct object.

    +

    type CArray #

    +

    type CDimArray #

    + +

    map DirEntry #

    +
    keysummary
    'name' -> arrayThe name of the file or directory.
    'type' -> #file | #dir | #unknownThe type of the entry.

    parent

    +

    map DirWalkEntry #

    +
    keysummary
    'name' -> arrayThe name of the file or directory.
    'path' -> arrayThe path of the file or directory relative to the walker's root directory.
    'type' -> #file | #dir | #unknownThe type of the entry.

    parent

    +

    map ArgOption #

    +
    keysummary
    'name' -> stringThe name of the option to match excluding the hyphen prefix. eg. -path
    'type' -> metatype(string | float | boolean)Parse as given value type.
    'default' -> anyOptional: Default value if option is missing. none is used if this is not provided.

    parent

    +

    test. #

    +

    The test module contains utilities for testing.

    +

    Sample usage:

    +
    import t 'test'
    +
    +var a = 123 + 321
    +t.eq(a, 444)
    +
    +

    parent

    + +

    func eq(a any, b any) any

    +

    Returns whether two values are equal. Panics with error.AssertError if types or values do not match up.

    +

    func eqList(a any, b any) any

    +

    Returns true if two lists have the same size and the elements are equal as if eq was called on those corresponding elements.

    +

    func eqNear(a any, b any) any

    +

    Returns two numbers are near each other within epsilon 1e-5.

    +

    func fail() any

    +
    +

    FFI. #

    + +

    top

    +

    Cyber supports binding to an existing C ABI compatible library at runtime. +This allows you to call into dynamic libraries created in C or other languages. +Cyber uses libtcc to JIT compile the bindings so function calls are fast. +The example shown below can be found in Examples.

    +

    FFI context. #

    +

    An FFI context contains declarations that map C to Cyber. Afterwards, it allows you to bind to a dynamic library or create interoperable objects. To create a new FFI context:

    +
    import os
    +
    +var ffi = os.newFFI()
    +
    +

    parent

    +

    Declare functions. #

    +

    Functions from a library are first declared using cfunc which accepts C types in the form of symbols. In a future update they will accept C syntax instead.

    +
    ffi.cfunc('add', [.int, .int], .int)
    +
    +

    The first argument refers to the symbol's name in the dynamic library. +The second argument contains the function's parameter types and finally the last argument is the function's return type.

    +

    The example above maps to this C function:

    +
    int add(int a, int b) {
    +    return a + b;
    +}
    +
    +

    parent

    +

    Bind library. #

    +

    bindLib accepts the path to the library and returns a object which can be used to invoke the functions declared from cfunc:

    +
    my lib = ffi.bindLib('./mylib.so')
    +lib.add(123, 321)
    +
    +

    Note that my is used to allow lib to be used dynamically since the type is unknown at compile-time.

    +

    parent

    +

    Search path. #

    +

    If the path argument to bindLib is just a filename, the search steps for the library is specific to the operating system. Provide an absolute (eg. '/foo/mylib.so') or relative (eg. './mylib.so') path to load from a direct location instead. When the path argument is none, it loads the currently running executable as a library allowing you to bind exported functions from the Cyber CLI or your own application/runtime.

    +

    parent

    +

    Configuration. #

    +

    By default bindLib returns an anonymous object with the binded C-functions as methods. This is convenient for invoking functions using the method call syntax. If a config is passed into bindLib as the second argument, genMap: true makes bindLib return a map instead with the binded C-functions as Cyber functions.

    +

    parent

    +

    Finalizer. #

    +

    The resulting object of bindLib holds a reference to an internal TCCState which owns the loaded JIT code. +Once the object is released by ARC, the TCCState is also released which removes the JIT code from memory.

    +

    parent

    +

    Mappings. #

    +

    When using cfunc or cbind declarations, symbols are used to represent default type mappings from Cyber to C and back:

    +

    Incomplete: This is not the final API for dynamically loading and interfacing with C libraries. The plan is to parse a subset of C headers to bind to Cyber types and functions.

    +
    BindingCyberCDetails
    .boolboolbool
    .charintint8_t, signed char
    .ucharintuint8_t, unsigned char
    .shortintint16_t, short
    .ushortintuint16_t, unsigned short
    .intintint32_t, int
    .uintintuint32_t, unsigned int
    .longintint64_t, long long
    .ulongintuint64_t, unsigned long long
    .usizeintsize_t, uintptr_t
    .floatfloatfloat
    .doublefloatdouble
    .charPtrpointerchar*Use os.cstr() and pointer.fromCstr() to convert between a Cyber string and a null terminated C string.
    .voidPtrpointervoid*
    type {S} objecttype {S} objectstructThe mapping from a Cyber object type S and the C-struct can be declared with cbind.

    parent

    +

    Bind to Cyber type. #

    +

    cbind is used to bind a C struct to a Cyber object type. Once declared, the Cyber type can be used as a binding type in function declarations:

    +
    import os
    +
    +type MyObject object:
    +    var a float
    +    var b pointer
    +    var c bool
    +
    +ffi.cbind(MyObject, [.float, .voidPtr, .bool])
    +ffi.cfunc('foo', [MyObject], MyObject)
    +my lib = ffi.bindLib('./mylib.so')
    +
    +var res = lib.foo([MyObject a: 123.0, b: os.cstr('foo'), c: true])
    +
    +

    The example above maps to these C declarations in mylib.so:

    +
    typedef struct MyObject {
    +    double a;
    +    char* b;
    +    bool c;
    +} MyObject;
    +
    +MyObject foo(MyObject o) {
    +    // Do something.
    +}
    +
    +

    cbind also generates ptrTo[Type] as a helper function to dereference an opaque ptr to a new Cyber object:

    +
    ffi.cfunc('foo', [MyObject], .voidPtr)
    +my lib = ffi.bindLib('./mylib.so')
    +
    +var ptr = lib.foo([MyObject a: 123, b: os.cstr('foo'), c: true])
    +var res = lib.ptrToMyObject(ptr)
    +
    +

    parent

    +

    Pointers. #

    +

    A pointer is used to read or write to an exact memory address. This is typically used for FFI to manually map Cyber types to C, and back. See type pointer.

    +

    A new pointer can be created with the builtin pointer.

    +
    var ptr = pointer(0xDEADBEEF)
    +print ptr.value()     --'3735928559'
    +
    +

    parent

    +

    cbindgen.cy #

    +

    cbindgen.cy is a Cyber script that automatically generates bindings given a C header file. Some example bindings that were generated include: Raylib and LLVM.

    +

    parent

    +

    Error Handling. #

    + + +
    + + + +
    +

    top

    +

    Cyber provides a throw/catch mechanism to handle expected errors. For unexpected errors, panics can be used as a fail-fast mechanism to abort the currently running fiber.

    +

    Error trait. #

    +

    Only types that implement the Error trait can be thrown or attached to a panic. +Since the Error trait is empty, it's simple to turn any type into a throwable type.

    +

    parent

    +

    error value. #

    +

    An error value contains a symbol and implements the Error trait. They can be created without a declaration using the error literal:

    +
    var err = error.Oops
    +
    +

    Use sym() to obtain the underlying symbol:

    +
    print err.sym()   -- Prints ".Oops"
    +
    +

    Since error is a primitive value, it can be compared using the == operator.

    +
    if err == error.Oops:
    +    handleOops()
    +
    +-- Alternatively.
    +if err.sym() == .Oops:
    +    handleOops()
    +
    +

    parent

    +

    Enum error. #

    +

    By implementing the Error trait, an enum type can be throwable: Planned Feature

    +
    type MyError enum:
    +    with Error
    +    boom
    +    badArgument
    +    nameTooLong
    +
    +var err = MyError.nameTooLong
    +
    +

    parent

    +

    Throwing errors. #

    +

    Use the throw keyword to throw errors. +A thrown error continues to bubble up the call stack until it is caught by a try block or expression.

    +
    func fail():
    +    throw error.Oops      -- Throws an error with the symbol `#Oops`
    +
    +func fail2():
    +    throw 123             -- Panic. Can only throw an error
    +                          -- that implement the `Error` trait.
    +
    +

    throw can also be used as an expression.

    +
    func fail():
    +    var a = false or throw error.False
    +
    +

    parent

    +

    Catching errors. #

    +

    try block. #

    +

    The try block catches thrown errors and resumes execution in a followup catch block:

    +
    try:
    +    funcThatCanFail()
    +catch err:
    +    print err      -- 'error.Failed'
    +
    +

    parent

    +

    caught variable. #

    +

    The contextual caught variable is used to reference the caught error: Planned Feature

    +
    try:
    +    funcThatCanFail()
    +catch:
    +    print caught   -- 'error.Failed'
    +
    +

    parent

    +

    catch matching. #

    +

    An inner catch block contains a matching clause: Planned Feature

    +
    try:
    +    funcThatCanFail()
    +catch error.BadDay:
    +    eatSnack()
    +catch:
    +    print caught
    +
    +

    Enum errors can be matched: Planned Feature

    +
    try:
    +    funcThatCanFail()
    +catch MyError.Boom:
    +    print 'Kaboom!'
    +catch:
    +    print caught
    +
    +

    parent

    +

    try expression. #

    +

    The try expression either returns a non-error result or the default value from the catch clause:

    +
    var res = try funcThatCanFail() catch 123
    +print res         -- '123'
    +
    +

    Since errors bubble up automatically, any errors thrown from sub-expressions are also caught:

    +
    var res = try happyFunc(funcThatCanFail()) catch 123
    +print res         -- '123'
    +
    +

    parent

    +

    Value or error. #

    +

    When the catch clause is omitted, the try expression will return either the value or the error:

    +
    var res = try funcThatCanFail()
    +if res == error.Failed:
    +    print 'Result is an error.'
    +
    +

    parent

    +

    Semantic checks. #

    +

    throws specifier. #

    +

    The throws specifier indicates that a function contains a throwing expression that was not caught with try catch.

    +

    When a function does not have a return specifier, it's implicitly given the throws specifier:

    +
    func foo():
    +    throw error.Failure
    +
    +func bar() throws:
    +    throw error.Failure
    +
    +-- `foo` and `bar` both have the same return specifier.
    +
    +

    Return types for typed functions are declared after throws using a comma separator:

    +
    func result(cond bool) throws, int:
    +    if cond:
    +        return 123
    +    else:
    +        throw error.Failure
    +
    +

    parent

    +

    Requiring throws. #

    +

    A compile-time error is issued when a typed function without a throws specifier contains an uncaught throwing expression: Planned Feature

    +
    func foo(a int) int:
    +    if a == 10:
    +        throw error.Failure -- CompileError. `foo` requires the `throws`
    +    else:                   -- specifier or any throwing expression must
    +        return a * 2        -- be caught with `try catch`.
    +
    +

    parent

    +

    Stack trace. #

    +

    When an uncaught error bubbles up to the top, its stack trace from the throw callsite is dumped to the console. The builtin errorTrace() and errorReport() are used to obtain the stack trace info.

    +
    try:
    +    funcThatCanFail()
    +catch:
    +    -- Prints the stack trace summary of the caught error.
    +    print errorReport()
    +
    +    -- Provides structured info about the stack trace.
    +    var info = errorTrace()
    +    print info.frames.len()
    +
    +

    parent

    +

    Unexpected errors. #

    +

    An unexpected error is an error that is not meant to be handled at runtime.

    +

    parent

    +

    Panics. #

    +

    The builtin panic is used as a fail-fast mechanism to quickly exit the current fiber with an error payload:

    +
    func kaboom():
    +    panic(error.danger)
    +
    +kaboom()     -- Script ends and prints the stack trace.
    +
    +

    Panics can not be caught using try catch. Once panic is invoked, the current fiber stops execution and begins to unwind its call stack. Once the error is propagated to the root, the fiber ends and transitions to a panic state. If the main fiber ends this way, the VM begins to shutdown. Otherwise, execution resumes on the next fiber which allows recovery from a panic.

    +

    parent

    +

    Concurrency. #

    + +

    top

    +

    Cyber supports fibers as a concurrency mechanism. There are plans to support preemptive concurrency with async/await as well as multithreading.

    +

    Fibers. #

    +

    A fiber represents a separate execution context as a first-class value. It contains it's own call stack and program counter. Fibers by themselves do not enable parallelism.

    +

    parent

    +

    Creating fibers. #

    +

    The coinit keyword creates and returns a new fiber using a function as the entry point:

    +
    var count = 0
    +
    +var foo = func ():
    +    count += 1
    +    coyield
    +    count += 1
    +
    +var fiber = coinit(foo)
    +
    +print count          -- '0'
    +coresume fiber
    +print count          -- '1'
    +coresume fiber
    +print count          -- '2'
    +
    +

    A fiber does not start execution until coresume is invoked on it. +coyield pauses the current fiber and execution is returned to the previous fiber that invoked coresume.

    +

    parent

    +

    Passing arguments. #

    +

    Arguments after the callee are passed into the entry function:

    +
    var count = 0
    +
    +var increment = func (inc):
    +    count += inc
    +
    +var fiber = coinit(increment, 5)
    +coresume fiber
    +print count          -- '5'
    +
    +

    When the fiber is created, the arguments are saved inside the fiber's stack. Once the first coresume is invoked, the entry function is invoked with the saved arguments.

    +

    parent

    +

    Reset state. #

    +

    To reset a fiber to its initial state, invoke reset(). Planned Feature +When reset, the existing stack is unwinded, the program counter returns to the starting point, and the state is set to .init:

    +
    func fib(n int) int:
    +    coyield n
    +    if n < 2:
    +        return n
    +    return fib(n - 1) + fib(n - 2)
    +
    +var task = coinit(fib, 10)
    +
    +-- Progress the fiber...
    +print(coresume task)    -- Prints "10"
    +print(coresume task)    -- Prints "9"
    +print(coresume task)    -- Prints "8"
    +
    +-- Reset back to the start with the `.init` state.
    +fiber.reset()
    +print(coresume task)    -- Prints "10"
    +
    +

    parent

    +

    Rebinding arguments. #

    +

    Arguments attached to the fiber can be rebinded with a different set of values. Planned Feature +This allows fiber reuse, instead of creating a new fiber:

    +
    var task = coinit(fib, 10)
    +
    +-- Run task to completion.
    +var res = 0
    +while fiber.status() != .done:
    +    res = coresume fiber
    +print res
    +
    +fiber.reset()
    +fiber.bindArgs(20)
    +
    +-- Run task again with the new argument...
    +
    +

    parent

    +

    Fiber block. #

    +

    A fiber block is used to construct a fiber without an entry function. Planned Feature The counting example can be rewritten to:

    +
    var count = 0
    +
    +var fiber = coinit:
    +    count += 1       -- `count is captured`
    +    coyield
    +    count += 1
    +
    +print count          -- '0'
    +coresume fiber
    +print count          -- '1'
    +coresume fiber
    +print count          -- '2'
    +
    +

    Referencing parent variables from the fiber block automatically captures them just like a function closure.

    +

    parent

    +

    Pause and resume. #

    +

    coyield can be used anywhere in a fiber's call stack to pause execution and return to the previous fiber.

    +
    func foo():
    +    print 'foo'
    +    bar()
    +
    +func bar():
    +    -- Nested coyield in call stack.
    +    coyield
    +    print 'bar'
    +
    +var fiber = coinit(foo)
    +coresume fiber
    +
    +

    coresume also returns the resulting value.

    +
    func foo():
    +    return 123
    +
    +var fiber = coinit(foo)
    +print(coresume fiber)    -- '123'
    +
    +

    coyield can return a value back to coresume. Planned Feature

    +

    parent

    +

    Fiber state. #

    +

    Use Fiber.status() to get the current state of the fiber.

    +
    func foo():
    +    coyield
    +    print 'done'
    +
    +var fiber = coinit(foo)
    +print fiber.status()   -- '.paused'
    +coresume fiber
    +print fiber.status()   -- '.paused'
    +coresume fiber
    +print fiber.status()   -- '.done'
    +
    +

    The main execution context is a fiber as well. Once the main fiber has finished, the VM is done and control is returned to the host.

    +

    parent

    +

    Gas mileage. #

    +

    Planned Feature

    +

    parent

    +

    Async. #

    +

    Planned Feature

    +

    parent

    +

    Multi-thread. #

    +

    Planned Feature

    +

    parent

    +

    Type System. #

    + + +
    + + + +
    +

    top

    +

    Cyber supports the use of both dynamically and statically typed code.

    +

    Dynamic typing. #

    +

    Dynamic typing can reduce the amount of friction when writing code, but it can also result in more runtime errors.

    +

    parent

    +

    my declaration. #

    +

    Variables declared with my are assigned the dynamic type:

    +
    my a = 123
    +
    +

    parent

    +

    dynamic vs any #

    +

    dynamic values can be freely used and copied without any compile errors (if there is a chance it can succeed at runtime, see Recent type inference):

    +
    my a = 123
    +
    +func getFirstRune(s string):
    +    return s[0]
    +
    +getFirstRune(a)       -- RuntimeError. Expected `string`.
    +
    +

    Since a is dynamic, passing it to a typed function parameter is allowed at compile-time, but will fail when the function is invoked at runtime.

    +

    The any type on the otherhand is a static type and must be explicitly declared using var:

    +
    var a any = 123
    +
    +func getFirstRune(s string):
    +    return s[0]
    +
    +getFirstRune(a)       -- CompileError. Expected `string`.
    +
    +

    This same setup will now fail at compile-time because any does not satisfy the destination's string type constraint.

    +

    The use of the dynamic type effectively defers type checking to runtime while any is a static type and must adhere to type constraints at compile-time.

    +

    A dynamic value can be used in any operation. It can be invoked as the callee, invoked as the receiver of a method call, or used with operators.

    +

    parent

    +

    Invoking dynamic values. #

    +

    When a dynamic value is invoked, checks on whether the callee is a function is deferred to runtime.

    +
    my op = 123
    +print op(1, 2, 3)      -- RuntimeError. Expected a function.
    +
    +

    parent

    +

    Dynamic return value. #

    +

    When the return type of a function is not specified, it defaults to the dynamic type. +This allows copying the return value to a typed destination without casting:

    +
    func getValue():
    +    return 123
    +
    +func add(a int, b int):
    +    return a + b
    +
    +print add(getValue(), 2)    -- Prints "125"
    +
    +

    The add function defers type checking of getValue() to runtime because it has the dynamic type.

    +

    parent

    +

    Recent type inference. #

    +

    Although a dynamic variable has the most flexibility, in some situations it is advantageous to know what type it could be.

    +

    The compiler keeps a running record of a dynamic variable's most recent type to gain additional compile-time features without sacrificing flexibility. It can prevent inevitable runtime errors and avoid unnecessary type casts.

    +

    When a dynamic variable is first initialized, it has a recent type inferred from its initializer. In the following, a has the recent type of int at compile-time because numeric literals default to the int type:

    +
    my a = 123
    +
    +

    The recent type can change at compile-time from another assignment. +If a is then assigned to a string literal, a from that point on has the recent type of string at compile-time:

    +
    my a = 123
    +foo(a)           -- Valid call expression.
    +a = 'hello'
    +foo(a)           -- CompileError. Expected `int` argument, got `string`.
    +
    +func foo(n int):
    +    pass
    +
    +

    Even though a is dynamic and is usually allowed to defer type checking to runtime, the compiler knows that doing so in this context would always result in a runtime error, so it provides a compile error instead. This provides a quicker feedback to fix the problem.

    +

    The recent type of a can also change in branches. However, after the branch block, a will have a recent type after merging the types assigned to a from the two branched code paths. Currently, the any type is used if the types from the two branches differ. At the end of the following if block, a has the recent type of any type after merging the int and string types: Planned Feature

    +
    my a = 123
    +if a > 20:
    +    a = 'hello'
    +    foo(a)       -- Valid call expression. `foo` can be called without type casting.
    +
    +foo(a)           -- CompileError. Expected `string` argument, got `any`.
    +
    +func foo(s string):
    +    pass
    +
    +

    parent

    +

    Static typing. #

    +

    Static typing can be incrementally applied which provides compile-time guarantees and prevents runtime errors. +Static typing also makes it easier to maintain and refactor your code.

    +

    parent

    +

    Builtin types. #

    +

    The following builtin types are available in every module: bool, float, int, string, List, Map, error, fiber, any.

    +

    parent

    +

    var declaration. #

    +

    A var declaration automatically infers the type from the initializer:

    +
    -- Initialized as an `int` variable.
    +var a = 123
    +
    +

    var declarations are strictly for static typing. If the assigned value's type is dynamic, the variable's type becomes any.

    +
    func getValue():
    +    return ['a', 'list']
    +
    +-- Initialized as an `any` variable.
    +var a = getValue()
    +
    +

    parent

    +

    Typed variables. #

    +

    A typed local variable can be declared by attaching a type specifier after its name. The value assigned to the variable must satisfy the type constraint or a compile error is issued.

    +
    var a float = 123
    +
    +var b int = 123.0    -- CompileError. Expected `int`, got `float`.
    +
    +

    Any operation afterwards that violates the type constraint of the variable will result in a compile error.

    +
    a = 'hello'          -- CompileError. Expected `float`, got `string`.
    +
    +

    Static variables are declared in a similar way:

    +
    var Root.global Map = [:]
    +
    +

    Unlike local variables, static variable declarations do not infer the type from the right hand side. A specific type must be specified or it will default to the any type.

    +

    parent

    +

    Object types. #

    +

    A type object declaration creates a new object type. Field types are optional and declared with a type specifier after their name.

    +
    type Student object:    -- Creates a new type named `Student`
    +    var name string
    +    var age  int
    +    var gpa  float
    +
    +

    Instantiating a new object does not require typed fields to be initialized. Missing field values will default to their zero value:

    +
    var s = [Student:]
    +print s.name       -- Prints ""
    +print s.age        -- Prints "0"
    +print s.gpa        -- Prints "0.0"
    +
    +

    Circular type dependencies are allowed if the object can be initialized:

    +

    Planned Feature: Optional types are not currently supported.

    +
    type Node object:
    +    var val  any
    +    var next Node?     -- Valid type specifier.
    +
    +

    In this example, next has an optional Node? type so it can be initialized to none when creating a new Node object.

    +

    The following example will fail because this version of Node can not be initialized:

    +
    type Node object:
    +    var val  any
    +    var next Node
    +
    +var n = [Node:]    -- CompileError. Can not zero initialize `next`
    +                   -- because of circular dependency.
    +
    +

    parent

    +

    Zero values. #

    +

    The following shows the zero values of builtin or created types.

    +
    TypeZero value
    booleanfalse
    int0
    float0.0
    string''
    arrayarray('')
    List[]
    Map[:]
    type S object[S:]
    @host type S objectS.$zero()
    dynamicnone
    anynone
    S?none

    parent

    +

    Type aliases. #

    +

    A type alias is declared from a single line type statement. This creates a new type symbol for an existing data type.

    +
    import util './util.cy'
    +
    +type Vec3 util.Vec3
    +
    +var v = [Vec3 x: 3, y: 4, z: 5]
    +
    +

    parent

    +

    Functions. #

    +

    Function parameter and return type specifiers follows a similiar syntax.

    +
    func mul(a float, b float) float:
    +    return a * b
    +
    +print mul(3, 4)
    +print mul(3, '4')  -- CompileError. Function signature mismatch.
    +
    +

    parent

    +

    Traits. #

    +

    Planned Feature

    +

    parent

    +

    Union types. #

    +

    Planned Feature

    +

    parent

    +

    any type. #

    +

    A variable with the any type can hold any value, but copying it to narrowed type destination will result in a compile error:

    +
    func square(i int):
    +    return i * i
    +
    +var a any = 123
    +a = ['a', 'list']         -- Valid assignment to a value with a different type.
    +a = 10
    +
    +print square(a)           -- CompileError. Expected `int`, got `any`.
    +
    +

    a must be explicitly casted to satisfy the type constraint:

    +
    print square(a as int)    -- Prints "100".
    +
    +

    parent

    +

    Invoking any values. #

    +

    Since any is a static type, invoking an any value must be explicitly casted to the appropriate function type.

    +

    Planned Feature: Casting to a function type is not currently supported.

    +
    func add(a int, b int) int:
    +    return a + b
    +
    +var op any = add
    +print op(1, 2)         -- CompileError. Expected `func (int, int) any`
    +
    +var opFunc = op as (func (int, int) int)
    +print opFunc(1, 2)     -- Prints "3".
    +
    +

    parent

    +

    Type casting. #

    +

    The as keyword can be used to cast a value to a specific type. Casting lets the compiler know what the expected type is and does not perform any conversions.

    +

    If the compiler knows the cast will always fail at runtime, a compile error is returned instead.

    +
    print('123' as int)       -- CompileError. Can not cast `string` to `int`.
    +
    +

    If the cast fails at runtime, a panic is returned.

    +
    var erased any = 123
    +add(1, erased as int)     -- Success.
    +print(erased as string)   -- Panic. Can not cast `int` to `string`.
    +
    +func add(a int, b int):
    +    return a + b
    +
    +

    parent

    +

    Metaprogramming. #

    + + +
    + + + +
    +

    top

    +

    Operator overloading. #

    +

    All operators are implemented as object methods.

    +

    Incomplete: Not all operators have transitioned to the method paradigm.

    +

    Normally this would impact performance, but Cyber generates specialized bytecode for builtin types like int and float. The VM performs inline caching at runtime to eliminate the overhead of evaluating on dynamic operands.

    +

    To overload an operator for an object type, declare $prefix, $infix, $postfix methods. See the available builtin operators. Since operator names aren't allowed as standard identifiers, they are contained in a string literal.

    +
    type Vec2 object:
    +    var x float
    +    var y float
    +
    +    func '$infix+'(o Vec2) Vec2:
    +        return [Vec2
    +            x: x + o.x,
    +            y: y + o.y,
    +        ]
    +
    +    func '$prefix-'() Vec2:
    +        return [Vec2 x: -x, y: -y]
    +
    +var a = [Vec2 x: 1, y: 2]
    +var b = a + [Vec2 x: 3, y: 4]
    +var c = -a
    +
    +

    Some special operators have their own name. This example overloads the index operator and the set index operator:

    +
    type MyCollection object:
    +    var arr List
    +
    +    func '$index'(idx):
    +        return arr[idx * 2]
    +
    +    func '$setIndex'(idx, val):
    +        arr[idx * 2] = val 
    +
    +var a = [MyCollection arr: [1, 2, 3, 4]]
    +print a[1]        -- Prints `3`
    +
    +

    parent

    +

    Builtin operators. #

    +

    A list of all supported operators:

    +
    OperatorName
    Bitwise not$prefix~
    Minus$prefix-
    Greater$infix>
    Greater equal$infix>=
    Less$infix<
    Less equal$infix<=
    Add$infix+
    Subtract$infix-
    Multiply$infix*
    Divide$infix/
    Modulus$infix%
    Power$infix^
    Bitwise and$infix&
    Bitwise or$infix\|
    Bitwise xor$infix\|\|
    Bitwise left shift$infix<<
    Bitwise right shift$infix>>
    Index$index
    Set index$setIndex
    Slice$slice

    parent

    +

    Custom operators. #

    +

    Planned Feature

    +

    parent

    +

    Magic functions. #

    +

    Call module. #

    +

    Declare a $call function to allow invoking a module as a function.

    +
    -- Object types are also modules.
    +type Vec2 object:
    +    var x float
    +    var y float
    +
    +func Vec2.'$call'(x float, y float) Vec2:
    +    return [Vec2 x: x, y: y]
    +
    +var v = Vec2(1, 2)
    +
    +

    parent

    +

    Getter/Setter. #

    +

    Planned Feature

    +

    parent

    +

    Missing method. #

    +

    Declare a $missing method as a fallback when a method was not found in an instance.

    +

    Planned Feature

    +
    type A object:
    +
    +    func '$missing'(args...):
    +        return args.len
    +
    +var a = [A:]
    +print a.foo()      -- Output: '0'
    +print a.bar(1, 2)  -- Output: '2'
    +
    +

    parent

    +

    Reflection. #

    +

    A type metatype object references an internal type. Use the typeof builtin to get the metatype of a value.

    +
    var val = 123
    +print typeof(val)   -- 'type: float'
    +
    +-- Referencing a type as a value also returns its `metatype`.
    +print bool          -- 'type: bool'
    +
    +

    parent

    +

    Annotations. #

    +

    Annotations are used to attach modifiers to declarative statements. The @host annotation is used for embedding to bind a host function to a Cyber function:

    +
    @host func compute() float
    +
    +

    Custom annotations.

    +

    Planned Feature

    +

    parent

    +

    Runtime eval. #

    +

    Planned Feature

    +

    parent

    +

    Generics. #

    +

    Planned Feature

    +

    parent

    +

    Compile-time. #

    +

    Planned Feature

    +

    parent

    +

    Embedding. #

    + + +
    + + + +
    +

    top

    +

    The Embed API allows embedding the Cyber compiler and VM as a library into applications. Cyber's core types and the CLI app were built using the Embed API.

    +

    The API is defined in the C header file. +The examples shown below can be found in the repository under c-embedded. C is used as the host language, but it can be easily translated to C++ or any C-ABI compatible language.

    +

    Types from the Embed API begin with Cs, constants begin with CS, and functions begin with cs.

    +

    Getting started. #

    +

    Create VM. #

    +

    Most operations are tied to a VM handle. To create a new VM instance, call csCreate:

    +
    #include "cyber.h"
    +
    +int main() {
    +    CsVM* vm = csCreate();
    +    // ...
    +    csDestroy(vm);
    +    return 0;
    +}
    +
    +

    parent

    +

    Override print. #

    +

    The builtin print function does nothing by default, so it needs to be overrided to print to stdout for example:

    +
    void print(CsVM* vm, CsStr str) {
    +    printf("My print: %.*s\n", (int)str.len, str.buf);
    +}
    +
    +int main() {
    +    // ...
    +    csSetPrint(vm, print);
    +    // ...
    +}
    +
    +

    parent

    +

    Eval script. #

    +

    csEval compiles and evaluates a script:

    +
    CsStr src = STR(
    +    "var a = 1\n"
    +    "print(a + 2)\n"
    +);
    +
    +CsValue val;
    +int res = csEval(vm, src, &val);
    +if (res == CS_SUCCESS) {
    +    printf("Success!\n");
    +    csRelease(vm, val);
    +} else {
    +    const char* report = csNewLastErrorReport(vm);
    +    printf("%s\n", report);
    +    csFreeStrZ(report);
    +}
    +
    +

    If a value is returned from the main block of the script, it's saved to the result value argument. +Memory is managed by ARC so a value that points to a heap object requires a csRelease when it's no longer needed.

    +

    csEval returns a result code that indicates whether it was successful.

    +

    parent

    +

    Module Loader. #

    +

    A module loader describes how a module is loaded when an import statement is encountered during script execution. +Only one module loader can be active and is set using csSetModuleLoader:

    +
    bool modLoader(CsVM* vm, CsStr spec, CsModuleLoaderResult* out) {
    +    if (strncmp("my_mod", spec.buf, spec.len) == 0) {
    +        out->src =
    +            "@host func add(a float, b float) float\n"
    +            "@host var Root.MyConstant float\n"
    +            "@host var Root.MyList     List\n"
    +            "\n"
    +            "@host\n"
    +            "type MyCollection object:\n"
    +            "    @host func asList() any"
    +            "\n"
    +            "@host func MyCollection.new(a, b) MyCollection\n";
    +        out->funcLoader = funcLoader;
    +        out->varLoader = varLoader;
    +        out->typeLoader = typeLoader;
    +        return true;
    +    } else {
    +        // Fallback to the default module loader to load `builtins`.
    +        return csDefaultModuleLoader(vm, spec, out);
    +    }
    +}
    +
    +int main() {
    +    //...
    +    csSetModuleLoader(vm, modLoader);
    +    //...
    +}
    +
    +

    The above example checks whether "my_mod" was imported and returns it's source code. Additional loaders are returned to load the functions, variables, and types from the source code.

    +

    parent

    +

    Default module loader. #

    +

    Since only one module loader can be set to the VM instance, a custom loader is required to handle the "builtins" import which contains all of the core types and functions in Cyber. This can simply be delegated to csDefaultModuleLoader.

    +

    parent

    +

    Function loader. #

    +

    A function loader describes how to load a @host function when it's encountered by the compiler. +The loader can bind functions and type methods:

    +
    struct { char* n; CsFuncFn fn; } funcs[] = {
    +    {"add", add},
    +    {"asList", myCollectionAsList},
    +    {"MyCollection.new", myCollectionNew},
    +};
    +
    +bool funcLoader(CsVM* vm, CsFuncInfo info, CsFuncResult* out) {
    +    // Check that the name matches before setting the function pointer.
    +    if (strncmp(funcs[info.idx].n, info.name.buf, info.name.len) == 0) {
    +        out->ptr = funcs[info.idx].fn;
    +        return true;
    +    } else {
    +        return false;
    +    }
    +}
    +
    +

    This example uses the CsFuncInfo.idx of a @host function to index into an array and return a Host function pointer. The name is also compared to ensure it's binding to the correct pointer.

    +

    This is an efficient way to map Cyber functions to host functions. A different implementation might use a hash table to map the name of the function to it's pointer.

    +

    parent

    +

    Variable loader. #

    +

    A variable loader describes how to load a @host variable when it's encountered by the compiler:

    +
    // C has limited static initializers (and objects require a vm instance) so initialize them in `main`.
    +typedef struct { char* n; CsValue v; } NameValue;
    +NameValue vars[2];
    +
    +bool varLoader(CsVM* vm, CsVarInfo info, CsValue* out) {
    +    // Check that the name matches before setting the value.
    +    if (strncmp(vars[info.idx].n, info.name.buf, info.name.len) == 0) {
    +        // Objects are consumed by the module.
    +        *out = vars[info.idx].v;
    +        return true;
    +    } else {
    +        return false;
    +    }
    +}
    +
    +int main() {
    +    // ...
    +
    +    // Initialize var array for loader.
    +    vars[0] = (NameValue){"Root.MyConstant", csFloat(1.23)};
    +    CsValue myInt = csInteger(123);
    +    vars[1] = (NameValue){"Root.MyList", csNewList(vm, &myInt, 1)};
    +
    +    // ...
    +}
    +
    +

    This example uses the same technique as the function loader, but it can be much simpler. It doesn't matter how the mapping is done as long as the variable loader returns a CsValue.

    +

    parent

    +

    Type loader. #

    +

    A type loader describes how to load a @host type when it's encountered by the compiler:

    +
    CsTypeId myCollectionId;
    +
    +bool typeLoader(CsVM* vm, CsTypeInfo info, CsTypeResult* out) {
    +    if (strncmp("MyCollection", info.name.buf, info.name.len) == 0) {
    +        out->type = CS_TYPE_OBJECT;
    +        out->data.object.outTypeId = &myCollectionId;
    +        out->data.object.getChildren = myCollectionGetChildren;
    +        out->data.object.finalizer = myCollectionFinalizer;
    +        return true;
    +    } else {
    +        return false;
    +    }
    +}
    +
    +

    When binding to the "MyCollection" type, it's typeId is saved to outTypeId. This id is then used to create new instances of this type. See Host types.

    +

    parent

    +

    Host functions. #

    +

    A host function requires a specific function signature:

    +
    CsValue add(CsVM* vm, const CsValue* args, uint8_t nargs) {
    +    double res = csAsFloat(args[0]) + csAsFloat(args[1]);
    +    return csFloat(res);
    +}
    +
    +

    A host function should always return a CsValue. csNone() can be returned if the function does not intend to return any value.

    +

    parent

    +

    Host types. #

    +

    A host type are types that are opaque to Cyber scripts but still behave like an object. They can have type functions and methods.

    +

    Only the host application can directly create new instances of them, so usually a function is binded to expose a constructor to the user script:

    +
    // Binding a C struct with it's own children and finalizer.
    +// This struct retains 2 VM values and has 2 arbitrary data values unrelated to the VM.
    +typedef struct MyCollection {
    +    CsValue val1;
    +    CsValue val2;
    +    int a;
    +    double b;
    +} MyCollection;
    +
    +// Implement the `new` function in MyCollection.
    +CsValue myCollectionNew(CsVM* vm, const CsValue* args, uint8_t nargs) {
    +    // Instantiate our object.
    +    CsValue new = csNewHostObject(vm, myCollectionId, sizeof(MyCollection));
    +    MyCollection* my = (MyCollection*)csAsHostObject(new);
    +
    +    // Assign the constructor args passed in and retain them since the new object now references them.
    +    csRetain(vm, args[0]);
    +    my->val1 = args[0];
    +    csRetain(vm, args[1]);
    +    my->val2 = args[1];
    +
    +    // Assign non VM values.
    +    my->a = 123;
    +    my->b = 9999.999;
    +    return new;
    +}
    +
    +

    csNewHostObject takes the type id (returned from the Type loader) and size (in bytes) and returns a new heap object. Note that the size is allowed to vary. Different instances of the same type can occupy different amounts of memory.

    +

    parent

    +

    getChildren #

    +

    Since MyCollection contains CsValue children, the Type loader requires a getChildren callback so that memory management can reach them:

    +
    CsValueSlice myCollectionGetChildren(CsVM* vm, void* obj) {
    +    MyCollection* my = (MyCollection*)obj;
    +    return (CsValueSlice){ .ptr = &my->val1, .len = 2 };
    +}
    +
    +

    parent

    +

    finalizer #

    +

    A type finalizer is optional since the memory and children of an instance will be freed automatically by ARC. +However, it can be useful to perform additional cleanup tasks for instances that contain external resources.

    +
    void myCollectionFinalizer(CsVM* vm, void* obj) {
    +    printf("MyCollection finalizer was called.\n");
    +}
    +
    +

    parent

    +

    Memory. #

    + +

    top

    +

    Cyber provides memory safety by default.

    +

    ARC. #

    +

    Cyber uses ARC or automatic reference counting to manage memory. +ARC is deterministic and has less overhead compared to a tracing garbage collector. Reference counting distributes memory management, which reduces GC pauses and makes ARC suitable for realtime applications. One common issue in ARC implementations is reference cycles which Cyber addresses with Weak References and it's very own Cycle Detection.

    +

    parent

    +

    Reference counting. #

    +

    In Cyber, there are primitive and object values. Primitives don't need any memory management, since they are copied by value and no heap allocation is required (with the exception of primitives being captured by a closure.

    +

    Objects are managed by ARC. Each object has its own reference counter. Upon creating a new object, it receives a reference count of 1. When the object is copied, it's retained and the reference count increments by 1. When an object value is removed from it's parent or is no longer reachable in the current stack frame, it is released and the reference count decrements by 1.

    +

    Once the reference count reaches 0 the object begins its destruction procedure. First, child references are released thereby decrementing their reference counts by 1. If the object is a host object, it will invoke its finalizer function. Afterwards, the object is freed from memory.

    +

    parent

    +

    Optimizations. #

    +

    The compiler can reduce the number of retain/release ops since it can infer value types even though they are dynamically typed to the user. Arguments passed to functions are only retained depending on the analysis from the callsite.

    +

    parent

    +

    Closures. #

    +

    When primitive variables are captured by a closure, they are boxed and allocated on the heap. This means they are managed by ARC and cleaned up when there are no more references to them.

    +

    parent

    +

    Fibers. #

    +

    Fibers are freed by ARC just like any other object. Once there are no references to the fiber, it begins to release it's child references by unwinding it's call stack.

    +

    parent

    +

    Heap. #

    +

    Many object types in Cyber are small enough to be at or under 40 bytes. To take advantage of this, Cyber can reserve object pools to quickly allocate and free these small objects with very little bookkeeping. Bigger objects are allocated and managed by mimalloc which has proven to be a fast and reliable general-purpose heap allocator.

    +

    parent

    +

    Weak references. #

    +

    Planned Feature

    +

    parent

    +

    Cycle detection. #

    +

    The cycle detector is also considered a GC and frees abandoned objects managed by ARC. Although weak references can remove cycles altogether, Cyber does not force you to use them and provides a manual GC as a one-time catch all solution.

    +

    Incomplete Feature: Only the main fiber stack is cleaned up at the moment.

    +

    To invoke the GC, call the builtin function: performGC.

    +
    func foo():
    +    -- Create a reference cycle.
    +    var a = []
    +    var b = []
    +    a.append(b)
    +    b.append(a)
    +
    +    -- Cycle still alive in the current stack so no cleanup is done.
    +    var res = performGC()
    +    print res['numCycFreed']    -- Output: 0
    +    print res['numObjFreed']    -- Output: 0
    +
    +foo()
    +-- `a` and `b` are no longer reachable, so the GC does work.
    +var res = performGC()
    +print res['numCycFreed']      -- Output: 2
    +print res['numObjFreed']      -- Output: 2
    +
    +

    parent

    +

    Backends. #

    + +

    top

    +

    JIT. #

    +

    Cyber's just-in-time compiler is incomplete and unstable. To run your script with JIT enabled:

    +
    cyber -jit <script>
    +
    +

    The JIT compiler is just as fast as the bytecode generation so when it's enabled, the entire script is compiled from the start.

    +

    parent

    +

    AOT #

    +

    Work on the ahead-of-time compiler has not begun.

    +

    parent

    + + + + + + \ No newline at end of file diff --git a/index.xml b/index.xml deleted file mode 100644 index e1cd044b5..000000000 --- a/index.xml +++ /dev/null @@ -1,28 +0,0 @@ -Introduction on Cyber Docs v0.3https://fubark.github.io/cyber/Recent content in Introduction on Cyber Docs v0.3Hugo -- gohugo.ioen-usSyntaxhttps://fubark.github.io/cyber/docs/toc/syntax/Mon, 01 Jan 0001 00:00:00 +0000https://fubark.github.io/cyber/docs/toc/syntax/Syntax # Cyber&rsquo;s syntax is concise and easy to read. -Statements. # A statement ends with the new line. --- An assignment statement. var a = 123 Blocks. # Some statements can start a new block with a colon. The first statement in a new block must be indented further. Spaces or tabs can be used for indentation but not both. --- This `if` statement begins a new block. if true: var a = 234 Subsequent statements in the block must follow the same indentation.Data Typeshttps://fubark.github.io/cyber/docs/toc/data-types/Mon, 01 Jan 0001 00:00:00 +0000https://fubark.github.io/cyber/docs/toc/data-types/Data Types. # In Cyber, there are primitive types and object types. Primitives are copied around by value and don&rsquo;t need additional heap memory or reference counts. -Primitives include Booleans, Floats, Integers, Enums, Symbols, Error Symbols, and the none value. -Object types include Lists, Tuples, Maps, Strings, Arrays, User Objects, Lambdas, Fibers, Enums with payloads, Pointers, and several internal object types. -None. # The none value represents an empty value.Control Flowhttps://fubark.github.io/cyber/docs/toc/control-flow/Mon, 01 Jan 0001 00:00:00 +0000https://fubark.github.io/cyber/docs/toc/control-flow/Control Flow. # Cyber provides the common constructs to branch and enter loops. -Branching. # if statement. # Use if and else statements to branch the execution of your code depending on conditions. The else clause can contain a condition which is only evaluated if the previous if or conditional else clause was false. -var a = 10 if a == 10: print &#39;a is 10&#39; else a == 20: print &#39;a is 20&#39; else: print &#39;neither 10 nor 20&#39; Conditional expression.Functionshttps://fubark.github.io/cyber/docs/toc/functions/Mon, 01 Jan 0001 00:00:00 +0000https://fubark.github.io/cyber/docs/toc/functions/Functions. # In Cyber, there are first-class functions (or function values) and static functions. -Static Functions. # Static functions are not initially values themselves. They allow function calls to be optimal since they don&rsquo;t need to resolve a dynamic value. -Static functions are declared with the func keyword and must have a name. -import math func dist(x0 float, y0 float, x1 float, y1 float) float: var dx = x0-x1 var dy = y0-y1 return math.Moduleshttps://fubark.github.io/cyber/docs/toc/modules/Mon, 01 Jan 0001 00:00:00 +0000https://fubark.github.io/cyber/docs/toc/modules/Modules. # Modules have their own namespace and contain accessible static symbols. By default, importing another Cyber script returns a module with its declared symbols. -Importing. # Import declarations create a local alias to the module referenced by the import specifier. The Cyber CLI comes with some builtin modules like math and test. If the specifier does not refer to a builtin module, it looks for a Cyber script file relative to the current script&rsquo;s directory.FFIhttps://fubark.github.io/cyber/docs/toc/ffi/Mon, 01 Jan 0001 00:00:00 +0000https://fubark.github.io/cyber/docs/toc/ffi/FFI. # Cyber supports binding to an existing C ABI compatible library at runtime. This allows you to call into dynamic libraries created in C or other languages. Cyber uses libtcc to JIT compile the bindings so function calls are fast. The example shown below can be found in Examples. -FFI context. # An FFI context contains declarations that map C to Cyber. Afterwards, it allows you to bind to a dynamic library or create interoperable objects.Error Handlinghttps://fubark.github.io/cyber/docs/toc/errors/Mon, 01 Jan 0001 00:00:00 +0000https://fubark.github.io/cyber/docs/toc/errors/Error Handling. # Cyber provides a throw/catch mechanism to handle expected errors. For unexpected errors, panics can be used as a fail-fast mechanism to abort the currently running fiber. -Error trait. # Only types that implement the Error trait can be thrown or attached to a panic. Since the Error trait is empty, it&rsquo;s simple to turn any type into a throwable type. -error value. # An error value contains a symbol and implements the Error trait.Concurrencyhttps://fubark.github.io/cyber/docs/toc/concurrency/Mon, 01 Jan 0001 00:00:00 +0000https://fubark.github.io/cyber/docs/toc/concurrency/Concurrency. # Cyber supports fibers as a concurrency mechanism. There are plans to support preemptive concurrency with async/await as well as multithreading. -Fibers. # A fiber represents a separate execution context as a first-class value. It contains it&rsquo;s own call stack and program counter. Fibers by themselves do not enable parallelism. -Creating fibers. # The coinit keyword creates and returns a new fiber using a function as the entry point:Type Systemhttps://fubark.github.io/cyber/docs/toc/type-system/Mon, 01 Jan 0001 00:00:00 +0000https://fubark.github.io/cyber/docs/toc/type-system/Type System. # Cyber supports the use of both dynamically and statically typed code. -Dynamic typing. # Dynamic typing can reduce the amount of friction when writing code, but it can also result in more runtime errors. -my declaration. # Variables declared with my are assigned the dynamic type: -my a = 123 dynamic vs any # dynamic values can be freely used and copied without any compile errors (if there is a chance it can succeed at runtime, see Recent type inference):Metaprogramminghttps://fubark.github.io/cyber/docs/toc/metaprogramming/Mon, 01 Jan 0001 00:00:00 +0000https://fubark.github.io/cyber/docs/toc/metaprogramming/Metaprogramming. # Operator overloading. # All operators are implemented as object methods. -Incomplete: Not all operators have transitioned to the method paradigm. -Normally this would impact performance, but Cyber generates specialized bytecode for builtin types like int and float. The VM performs inline caching at runtime to eliminate the overhead of evaluating on dynamic operands. -To overload an operator for an object type, declare $prefix, $infix, $postfix methods. See the available builtin operators.Embeddinghttps://fubark.github.io/cyber/docs/toc/embedding/Mon, 01 Jan 0001 00:00:00 +0000https://fubark.github.io/cyber/docs/toc/embedding/Embed API. # The Embed API allows embedding the Cyber compiler and VM as a library into applications. Cyber&rsquo;s core types and the CLI app were built using the Embed API. -The API is defined in the C header file. The examples shown below can be found in the repository under c-embedded. C is used as the host language, but it can be easily translated to C++ or any C-ABI compatible language.Memoryhttps://fubark.github.io/cyber/docs/toc/memory/Mon, 01 Jan 0001 00:00:00 +0000https://fubark.github.io/cyber/docs/toc/memory/Memory. # Cyber provides memory safety by default. -ARC. # Cyber uses ARC or automatic reference counting to manage memory. ARC is deterministic and has less overhead compared to a tracing garbage collector. Reference counting distributes memory management, which reduces GC pauses and makes ARC suitable for realtime applications. One common issue in ARC implementations is reference cycles which Cyber addresses with Weak References and it&rsquo;s very own Cycle Detection.AOT/JIThttps://fubark.github.io/cyber/docs/toc/aot-jit/Mon, 01 Jan 0001 00:00:00 +0000https://fubark.github.io/cyber/docs/toc/aot-jit/JIT # Cyber&rsquo;s just-in-time compiler is incomplete and unstable. To run your script with JIT enabled: -cyber -jit &lt;script&gt; The JIT compiler is just as fast as the bytecode generation so when it&rsquo;s enabled, the entire script is compiled from the start. -AOT # Work on the ahead-of-time compiler has not begun. \ No newline at end of file diff --git a/katex/auto-render.min.js b/katex/auto-render.min.js deleted file mode 100644 index 3a6d66390..000000000 --- a/katex/auto-render.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("katex")):"function"==typeof define&&define.amd?define(["katex"],t):"object"==typeof exports?exports.renderMathInElement=t(require("katex")):e.renderMathInElement=t(e.katex)}("undefined"!=typeof self?self:this,function(e){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=1)}([function(t,r){t.exports=e},function(e,t,r){"use strict";r.r(t);var n=r(0),o=r.n(n),a=function(e,t,r){for(var n=r,o=0,a=e.length;n.newline{display:block}.katex .base{position:relative;white-space:nowrap;width:min-content}.katex .base,.katex .strut{display:inline-block}.katex .textbf{font-weight:700}.katex .textit{font-style:italic}.katex .textrm{font-family:KaTeX_Main}.katex .textsf{font-family:KaTeX_SansSerif}.katex .texttt{font-family:KaTeX_Typewriter}.katex .mathdefault{font-family:KaTeX_Math;font-style:italic}.katex .mathit{font-family:KaTeX_Main;font-style:italic}.katex .mathrm{font-style:normal}.katex .mathbf{font-family:KaTeX_Main;font-weight:700}.katex .boldsymbol{font-family:KaTeX_Math;font-weight:700;font-style:italic}.katex .amsrm,.katex .mathbb,.katex .textbb{font-family:KaTeX_AMS}.katex .mathcal{font-family:KaTeX_Caligraphic}.katex .mathfrak,.katex .textfrak{font-family:KaTeX_Fraktur}.katex .mathtt{font-family:KaTeX_Typewriter}.katex .mathscr,.katex .textscr{font-family:KaTeX_Script}.katex .mathsf,.katex .textsf{font-family:KaTeX_SansSerif}.katex .mathboldsf,.katex .textboldsf{font-family:KaTeX_SansSerif;font-weight:700}.katex .mathitsf,.katex .textitsf{font-family:KaTeX_SansSerif;font-style:italic}.katex .mainrm{font-family:KaTeX_Main;font-style:normal}.katex .vlist-t{display:inline-table;table-layout:fixed}.katex .vlist-r{display:table-row}.katex .vlist{display:table-cell;vertical-align:bottom;position:relative}.katex .vlist>span{display:block;height:0;position:relative}.katex .vlist>span>span{display:inline-block}.katex .vlist>span>.pstrut{overflow:hidden;width:0}.katex .vlist-t2{margin-right:-2px}.katex .vlist-s{display:table-cell;vertical-align:bottom;font-size:1px;width:2px;min-width:2px}.katex .msupsub{text-align:left}.katex .mfrac>span>span{text-align:center}.katex .mfrac .frac-line{display:inline-block;width:100%;border-bottom-style:solid}.katex .hdashline,.katex .hline,.katex .mfrac .frac-line,.katex .overline .overline-line,.katex .rule,.katex .underline .underline-line{min-height:1px}.katex .mspace{display:inline-block}.katex .clap,.katex .llap,.katex .rlap{width:0;position:relative}.katex .clap>.inner,.katex .llap>.inner,.katex .rlap>.inner{position:absolute}.katex .clap>.fix,.katex .llap>.fix,.katex .rlap>.fix{display:inline-block}.katex .llap>.inner{right:0}.katex .clap>.inner,.katex .rlap>.inner{left:0}.katex .clap>.inner>span{margin-left:-50%;margin-right:50%}.katex .rule{display:inline-block;border:0 solid;position:relative}.katex .hline,.katex .overline .overline-line,.katex .underline .underline-line{display:inline-block;width:100%;border-bottom-style:solid}.katex .hdashline{display:inline-block;width:100%;border-bottom-style:dashed}.katex .sqrt>.root{margin-left:.27777778em;margin-right:-.55555556em}.katex .fontsize-ensurer.reset-size1.size1,.katex .sizing.reset-size1.size1{font-size:1em}.katex .fontsize-ensurer.reset-size1.size2,.katex .sizing.reset-size1.size2{font-size:1.2em}.katex .fontsize-ensurer.reset-size1.size3,.katex .sizing.reset-size1.size3{font-size:1.4em}.katex .fontsize-ensurer.reset-size1.size4,.katex .sizing.reset-size1.size4{font-size:1.6em}.katex .fontsize-ensurer.reset-size1.size5,.katex .sizing.reset-size1.size5{font-size:1.8em}.katex .fontsize-ensurer.reset-size1.size6,.katex .sizing.reset-size1.size6{font-size:2em}.katex .fontsize-ensurer.reset-size1.size7,.katex .sizing.reset-size1.size7{font-size:2.4em}.katex .fontsize-ensurer.reset-size1.size8,.katex .sizing.reset-size1.size8{font-size:2.88em}.katex .fontsize-ensurer.reset-size1.size9,.katex .sizing.reset-size1.size9{font-size:3.456em}.katex .fontsize-ensurer.reset-size1.size10,.katex .sizing.reset-size1.size10{font-size:4.148em}.katex .fontsize-ensurer.reset-size1.size11,.katex .sizing.reset-size1.size11{font-size:4.976em}.katex .fontsize-ensurer.reset-size2.size1,.katex .sizing.reset-size2.size1{font-size:.83333333em}.katex .fontsize-ensurer.reset-size2.size2,.katex .sizing.reset-size2.size2{font-size:1em}.katex .fontsize-ensurer.reset-size2.size3,.katex .sizing.reset-size2.size3{font-size:1.16666667em}.katex .fontsize-ensurer.reset-size2.size4,.katex .sizing.reset-size2.size4{font-size:1.33333333em}.katex .fontsize-ensurer.reset-size2.size5,.katex .sizing.reset-size2.size5{font-size:1.5em}.katex .fontsize-ensurer.reset-size2.size6,.katex .sizing.reset-size2.size6{font-size:1.66666667em}.katex .fontsize-ensurer.reset-size2.size7,.katex .sizing.reset-size2.size7{font-size:2em}.katex .fontsize-ensurer.reset-size2.size8,.katex .sizing.reset-size2.size8{font-size:2.4em}.katex .fontsize-ensurer.reset-size2.size9,.katex .sizing.reset-size2.size9{font-size:2.88em}.katex .fontsize-ensurer.reset-size2.size10,.katex .sizing.reset-size2.size10{font-size:3.45666667em}.katex .fontsize-ensurer.reset-size2.size11,.katex .sizing.reset-size2.size11{font-size:4.14666667em}.katex .fontsize-ensurer.reset-size3.size1,.katex .sizing.reset-size3.size1{font-size:.71428571em}.katex .fontsize-ensurer.reset-size3.size2,.katex .sizing.reset-size3.size2{font-size:.85714286em}.katex .fontsize-ensurer.reset-size3.size3,.katex .sizing.reset-size3.size3{font-size:1em}.katex .fontsize-ensurer.reset-size3.size4,.katex .sizing.reset-size3.size4{font-size:1.14285714em}.katex .fontsize-ensurer.reset-size3.size5,.katex .sizing.reset-size3.size5{font-size:1.28571429em}.katex .fontsize-ensurer.reset-size3.size6,.katex .sizing.reset-size3.size6{font-size:1.42857143em}.katex .fontsize-ensurer.reset-size3.size7,.katex .sizing.reset-size3.size7{font-size:1.71428571em}.katex .fontsize-ensurer.reset-size3.size8,.katex .sizing.reset-size3.size8{font-size:2.05714286em}.katex .fontsize-ensurer.reset-size3.size9,.katex .sizing.reset-size3.size9{font-size:2.46857143em}.katex .fontsize-ensurer.reset-size3.size10,.katex .sizing.reset-size3.size10{font-size:2.96285714em}.katex .fontsize-ensurer.reset-size3.size11,.katex .sizing.reset-size3.size11{font-size:3.55428571em}.katex .fontsize-ensurer.reset-size4.size1,.katex .sizing.reset-size4.size1{font-size:.625em}.katex .fontsize-ensurer.reset-size4.size2,.katex .sizing.reset-size4.size2{font-size:.75em}.katex .fontsize-ensurer.reset-size4.size3,.katex .sizing.reset-size4.size3{font-size:.875em}.katex .fontsize-ensurer.reset-size4.size4,.katex .sizing.reset-size4.size4{font-size:1em}.katex .fontsize-ensurer.reset-size4.size5,.katex .sizing.reset-size4.size5{font-size:1.125em}.katex .fontsize-ensurer.reset-size4.size6,.katex .sizing.reset-size4.size6{font-size:1.25em}.katex .fontsize-ensurer.reset-size4.size7,.katex .sizing.reset-size4.size7{font-size:1.5em}.katex .fontsize-ensurer.reset-size4.size8,.katex .sizing.reset-size4.size8{font-size:1.8em}.katex .fontsize-ensurer.reset-size4.size9,.katex .sizing.reset-size4.size9{font-size:2.16em}.katex .fontsize-ensurer.reset-size4.size10,.katex .sizing.reset-size4.size10{font-size:2.5925em}.katex .fontsize-ensurer.reset-size4.size11,.katex .sizing.reset-size4.size11{font-size:3.11em}.katex .fontsize-ensurer.reset-size5.size1,.katex .sizing.reset-size5.size1{font-size:.55555556em}.katex .fontsize-ensurer.reset-size5.size2,.katex .sizing.reset-size5.size2{font-size:.66666667em}.katex .fontsize-ensurer.reset-size5.size3,.katex .sizing.reset-size5.size3{font-size:.77777778em}.katex .fontsize-ensurer.reset-size5.size4,.katex .sizing.reset-size5.size4{font-size:.88888889em}.katex .fontsize-ensurer.reset-size5.size5,.katex .sizing.reset-size5.size5{font-size:1em}.katex .fontsize-ensurer.reset-size5.size6,.katex .sizing.reset-size5.size6{font-size:1.11111111em}.katex .fontsize-ensurer.reset-size5.size7,.katex .sizing.reset-size5.size7{font-size:1.33333333em}.katex .fontsize-ensurer.reset-size5.size8,.katex .sizing.reset-size5.size8{font-size:1.6em}.katex .fontsize-ensurer.reset-size5.size9,.katex .sizing.reset-size5.size9{font-size:1.92em}.katex .fontsize-ensurer.reset-size5.size10,.katex .sizing.reset-size5.size10{font-size:2.30444444em}.katex .fontsize-ensurer.reset-size5.size11,.katex .sizing.reset-size5.size11{font-size:2.76444444em}.katex .fontsize-ensurer.reset-size6.size1,.katex .sizing.reset-size6.size1{font-size:.5em}.katex .fontsize-ensurer.reset-size6.size2,.katex .sizing.reset-size6.size2{font-size:.6em}.katex .fontsize-ensurer.reset-size6.size3,.katex .sizing.reset-size6.size3{font-size:.7em}.katex .fontsize-ensurer.reset-size6.size4,.katex .sizing.reset-size6.size4{font-size:.8em}.katex .fontsize-ensurer.reset-size6.size5,.katex .sizing.reset-size6.size5{font-size:.9em}.katex .fontsize-ensurer.reset-size6.size6,.katex .sizing.reset-size6.size6{font-size:1em}.katex .fontsize-ensurer.reset-size6.size7,.katex .sizing.reset-size6.size7{font-size:1.2em}.katex .fontsize-ensurer.reset-size6.size8,.katex .sizing.reset-size6.size8{font-size:1.44em}.katex .fontsize-ensurer.reset-size6.size9,.katex .sizing.reset-size6.size9{font-size:1.728em}.katex .fontsize-ensurer.reset-size6.size10,.katex .sizing.reset-size6.size10{font-size:2.074em}.katex .fontsize-ensurer.reset-size6.size11,.katex .sizing.reset-size6.size11{font-size:2.488em}.katex .fontsize-ensurer.reset-size7.size1,.katex .sizing.reset-size7.size1{font-size:.41666667em}.katex .fontsize-ensurer.reset-size7.size2,.katex .sizing.reset-size7.size2{font-size:.5em}.katex .fontsize-ensurer.reset-size7.size3,.katex .sizing.reset-size7.size3{font-size:.58333333em}.katex .fontsize-ensurer.reset-size7.size4,.katex .sizing.reset-size7.size4{font-size:.66666667em}.katex .fontsize-ensurer.reset-size7.size5,.katex .sizing.reset-size7.size5{font-size:.75em}.katex .fontsize-ensurer.reset-size7.size6,.katex .sizing.reset-size7.size6{font-size:.83333333em}.katex .fontsize-ensurer.reset-size7.size7,.katex .sizing.reset-size7.size7{font-size:1em}.katex .fontsize-ensurer.reset-size7.size8,.katex .sizing.reset-size7.size8{font-size:1.2em}.katex .fontsize-ensurer.reset-size7.size9,.katex .sizing.reset-size7.size9{font-size:1.44em}.katex .fontsize-ensurer.reset-size7.size10,.katex .sizing.reset-size7.size10{font-size:1.72833333em}.katex .fontsize-ensurer.reset-size7.size11,.katex .sizing.reset-size7.size11{font-size:2.07333333em}.katex .fontsize-ensurer.reset-size8.size1,.katex .sizing.reset-size8.size1{font-size:.34722222em}.katex .fontsize-ensurer.reset-size8.size2,.katex .sizing.reset-size8.size2{font-size:.41666667em}.katex .fontsize-ensurer.reset-size8.size3,.katex .sizing.reset-size8.size3{font-size:.48611111em}.katex .fontsize-ensurer.reset-size8.size4,.katex .sizing.reset-size8.size4{font-size:.55555556em}.katex .fontsize-ensurer.reset-size8.size5,.katex .sizing.reset-size8.size5{font-size:.625em}.katex .fontsize-ensurer.reset-size8.size6,.katex .sizing.reset-size8.size6{font-size:.69444444em}.katex .fontsize-ensurer.reset-size8.size7,.katex .sizing.reset-size8.size7{font-size:.83333333em}.katex .fontsize-ensurer.reset-size8.size8,.katex .sizing.reset-size8.size8{font-size:1em}.katex .fontsize-ensurer.reset-size8.size9,.katex .sizing.reset-size8.size9{font-size:1.2em}.katex .fontsize-ensurer.reset-size8.size10,.katex .sizing.reset-size8.size10{font-size:1.44027778em}.katex .fontsize-ensurer.reset-size8.size11,.katex .sizing.reset-size8.size11{font-size:1.72777778em}.katex .fontsize-ensurer.reset-size9.size1,.katex .sizing.reset-size9.size1{font-size:.28935185em}.katex .fontsize-ensurer.reset-size9.size2,.katex .sizing.reset-size9.size2{font-size:.34722222em}.katex .fontsize-ensurer.reset-size9.size3,.katex .sizing.reset-size9.size3{font-size:.40509259em}.katex .fontsize-ensurer.reset-size9.size4,.katex .sizing.reset-size9.size4{font-size:.46296296em}.katex .fontsize-ensurer.reset-size9.size5,.katex .sizing.reset-size9.size5{font-size:.52083333em}.katex .fontsize-ensurer.reset-size9.size6,.katex .sizing.reset-size9.size6{font-size:.5787037em}.katex .fontsize-ensurer.reset-size9.size7,.katex .sizing.reset-size9.size7{font-size:.69444444em}.katex .fontsize-ensurer.reset-size9.size8,.katex .sizing.reset-size9.size8{font-size:.83333333em}.katex .fontsize-ensurer.reset-size9.size9,.katex .sizing.reset-size9.size9{font-size:1em}.katex .fontsize-ensurer.reset-size9.size10,.katex .sizing.reset-size9.size10{font-size:1.20023148em}.katex .fontsize-ensurer.reset-size9.size11,.katex .sizing.reset-size9.size11{font-size:1.43981481em}.katex .fontsize-ensurer.reset-size10.size1,.katex .sizing.reset-size10.size1{font-size:.24108004em}.katex .fontsize-ensurer.reset-size10.size2,.katex .sizing.reset-size10.size2{font-size:.28929605em}.katex .fontsize-ensurer.reset-size10.size3,.katex .sizing.reset-size10.size3{font-size:.33751205em}.katex .fontsize-ensurer.reset-size10.size4,.katex .sizing.reset-size10.size4{font-size:.38572806em}.katex .fontsize-ensurer.reset-size10.size5,.katex .sizing.reset-size10.size5{font-size:.43394407em}.katex .fontsize-ensurer.reset-size10.size6,.katex .sizing.reset-size10.size6{font-size:.48216008em}.katex .fontsize-ensurer.reset-size10.size7,.katex .sizing.reset-size10.size7{font-size:.57859209em}.katex .fontsize-ensurer.reset-size10.size8,.katex .sizing.reset-size10.size8{font-size:.69431051em}.katex .fontsize-ensurer.reset-size10.size9,.katex .sizing.reset-size10.size9{font-size:.83317261em}.katex .fontsize-ensurer.reset-size10.size10,.katex .sizing.reset-size10.size10{font-size:1em}.katex .fontsize-ensurer.reset-size10.size11,.katex .sizing.reset-size10.size11{font-size:1.19961427em}.katex .fontsize-ensurer.reset-size11.size1,.katex .sizing.reset-size11.size1{font-size:.20096463em}.katex .fontsize-ensurer.reset-size11.size2,.katex .sizing.reset-size11.size2{font-size:.24115756em}.katex .fontsize-ensurer.reset-size11.size3,.katex .sizing.reset-size11.size3{font-size:.28135048em}.katex .fontsize-ensurer.reset-size11.size4,.katex .sizing.reset-size11.size4{font-size:.32154341em}.katex .fontsize-ensurer.reset-size11.size5,.katex .sizing.reset-size11.size5{font-size:.36173633em}.katex .fontsize-ensurer.reset-size11.size6,.katex .sizing.reset-size11.size6{font-size:.40192926em}.katex .fontsize-ensurer.reset-size11.size7,.katex .sizing.reset-size11.size7{font-size:.48231511em}.katex .fontsize-ensurer.reset-size11.size8,.katex .sizing.reset-size11.size8{font-size:.57877814em}.katex .fontsize-ensurer.reset-size11.size9,.katex .sizing.reset-size11.size9{font-size:.69453376em}.katex .fontsize-ensurer.reset-size11.size10,.katex .sizing.reset-size11.size10{font-size:.83360129em}.katex .fontsize-ensurer.reset-size11.size11,.katex .sizing.reset-size11.size11{font-size:1em}.katex .delimsizing.size1{font-family:KaTeX_Size1}.katex .delimsizing.size2{font-family:KaTeX_Size2}.katex .delimsizing.size3{font-family:KaTeX_Size3}.katex .delimsizing.size4{font-family:KaTeX_Size4}.katex .delimsizing.mult .delim-size1>span{font-family:KaTeX_Size1}.katex .delimsizing.mult .delim-size4>span{font-family:KaTeX_Size4}.katex .nulldelimiter{display:inline-block;width:.12em}.katex .delimcenter,.katex .op-symbol{position:relative}.katex .op-symbol.small-op{font-family:KaTeX_Size1}.katex .op-symbol.large-op{font-family:KaTeX_Size2}.katex .op-limits>.vlist-t{text-align:center}.katex .accent>.vlist-t{text-align:center}.katex .accent .accent-body{position:relative}.katex .accent .accent-body:not(.accent-full){width:0}.katex .overlay{display:block}.katex .mtable .vertical-separator{display:inline-block;min-width:1px}.katex .mtable .arraycolsep{display:inline-block}.katex .mtable .col-align-c>.vlist-t{text-align:center}.katex .mtable .col-align-l>.vlist-t{text-align:left}.katex .mtable .col-align-r>.vlist-t{text-align:right}.katex .svg-align{text-align:left}.katex svg{display:block;position:absolute;width:100%;height:inherit;fill:currentColor;stroke:currentColor;fill-rule:nonzero;fill-opacity:1;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1}.katex svg path{stroke:none}.katex img{border-style:none;min-width:0;min-height:0;max-width:none;max-height:none}.katex .stretchy{width:100%;display:block;position:relative;overflow:hidden}.katex .stretchy:after,.katex .stretchy:before{content:""}.katex .hide-tail{width:100%;position:relative;overflow:hidden}.katex .halfarrow-left{position:absolute;left:0;width:50.2%;overflow:hidden}.katex .halfarrow-right{position:absolute;right:0;width:50.2%;overflow:hidden}.katex .brace-left{position:absolute;left:0;width:25.1%;overflow:hidden}.katex .brace-center{position:absolute;left:25%;width:50%;overflow:hidden}.katex .brace-right{position:absolute;right:0;width:25.1%;overflow:hidden}.katex .x-arrow-pad{padding:0 .5em}.katex .mover,.katex .munder,.katex .x-arrow{text-align:center}.katex .boxpad{padding:0 .3em}.katex .fbox,.katex .fcolorbox{box-sizing:border-box;border:.04em solid}.katex .cancel-pad{padding:0 .2em}.katex .cancel-lap{margin-left:-.2em;margin-right:-.2em}.katex .sout{border-bottom-style:solid;border-bottom-width:.08em}.katex-display{display:block;margin:1em 0;text-align:center}.katex-display>.katex{display:block;text-align:center;white-space:nowrap}.katex-display>.katex>.katex-html{display:block;position:relative}.katex-display>.katex>.katex-html>.tag{position:absolute;right:0}.katex-display.leqno>.katex>.katex-html>.tag{left:0;right:auto}.katex-display.fleqn>.katex{text-align:left} diff --git a/katex/katex.min.js b/katex/katex.min.js deleted file mode 100644 index 906ce1282..000000000 --- a/katex/katex.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.katex=e():t.katex=e()}("undefined"!=typeof self?self:this,function(){return function(t){var e={};function r(a){if(e[a])return e[a].exports;var n=e[a]={i:a,l:!1,exports:{}};return t[a].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=t,r.c=e,r.d=function(t,e,a){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:a})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var a=Object.create(null);if(r.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)r.d(a,n,function(e){return t[e]}.bind(null,n));return a},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=1)}([function(t,e,r){},function(t,e,r){"use strict";r.r(e);r(0);var a=function(){function t(t,e,r){this.lexer=void 0,this.start=void 0,this.end=void 0,this.lexer=t,this.start=e,this.end=r}return t.range=function(e,r){return r?e&&e.loc&&r.loc&&e.loc.lexer===r.loc.lexer?new t(e.loc.lexer,e.loc.start,r.loc.end):null:e&&e.loc},t}(),n=function(){function t(t,e){this.text=void 0,this.loc=void 0,this.text=t,this.loc=e}return t.prototype.range=function(e,r){return new t(r,a.range(this,e))},t}(),i=function t(e,r){this.position=void 0;var a,n="KaTeX parse error: "+e,i=r&&r.loc;if(i&&i.start<=i.end){var o=i.lexer.input;a=i.start;var s=i.end;a===o.length?n+=" at end of input: ":n+=" at position "+(a+1)+": ";var h=o.slice(a,s).replace(/[^]/g,"$&\u0332");n+=(a>15?"\u2026"+o.slice(a-15,a):o.slice(0,a))+h+(s+15":">","<":"<",'"':""","'":"'"},l=/[&><"']/g;var m=function t(e){return"ordgroup"===e.type?1===e.body.length?t(e.body[0]):e:"color"===e.type?1===e.body.length?t(e.body[0]):e:"font"===e.type?t(e.body):e},c={contains:function(t,e){return-1!==t.indexOf(e)},deflt:function(t,e){return void 0===t?e:t},escape:function(t){return String(t).replace(l,function(t){return h[t]})},hyphenate:function(t){return t.replace(s,"-$1").toLowerCase()},getBaseElem:m,isCharacterBox:function(t){var e=m(t);return"mathord"===e.type||"textord"===e.type||"atom"===e.type},protocolFromUrl:function(t){var e=/^\s*([^\\\/#]*?)(?::|�*58|�*3a)/i.exec(t);return null!=e?e[1]:"_relative"}},u=function(){function t(t){this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,t=t||{},this.displayMode=c.deflt(t.displayMode,!1),this.output=c.deflt(t.output,"htmlAndMathml"),this.leqno=c.deflt(t.leqno,!1),this.fleqn=c.deflt(t.fleqn,!1),this.throwOnError=c.deflt(t.throwOnError,!0),this.errorColor=c.deflt(t.errorColor,"#cc0000"),this.macros=t.macros||{},this.minRuleThickness=Math.max(0,c.deflt(t.minRuleThickness,0)),this.colorIsTextColor=c.deflt(t.colorIsTextColor,!1),this.strict=c.deflt(t.strict,"warn"),this.trust=c.deflt(t.trust,!1),this.maxSize=Math.max(0,c.deflt(t.maxSize,1/0)),this.maxExpand=Math.max(0,c.deflt(t.maxExpand,1e3))}var e=t.prototype;return e.reportNonstrict=function(t,e,r){var a=this.strict;if("function"==typeof a&&(a=a(t,e,r)),a&&"ignore"!==a){if(!0===a||"error"===a)throw new o("LaTeX-incompatible input and strict mode is set to 'error': "+e+" ["+t+"]",r);"warn"===a?"undefined"!=typeof console&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+e+" ["+t+"]"):"undefined"!=typeof console&&console.warn("LaTeX-incompatible input and strict mode is set to unrecognized '"+a+"': "+e+" ["+t+"]")}},e.useStrictBehavior=function(t,e,r){var a=this.strict;if("function"==typeof a)try{a=a(t,e,r)}catch(t){a="error"}return!(!a||"ignore"===a)&&(!0===a||"error"===a||("warn"===a?("undefined"!=typeof console&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+e+" ["+t+"]"),!1):("undefined"!=typeof console&&console.warn("LaTeX-incompatible input and strict mode is set to unrecognized '"+a+"': "+e+" ["+t+"]"),!1)))},e.isTrusted=function(t){t.url&&!t.protocol&&(t.protocol=c.protocolFromUrl(t.url));var e="function"==typeof this.trust?this.trust(t):this.trust;return Boolean(e)},t}(),p=function(){function t(t,e,r){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=t,this.size=e,this.cramped=r}var e=t.prototype;return e.sup=function(){return d[f[this.id]]},e.sub=function(){return d[g[this.id]]},e.fracNum=function(){return d[x[this.id]]},e.fracDen=function(){return d[v[this.id]]},e.cramp=function(){return d[b[this.id]]},e.text=function(){return d[y[this.id]]},e.isTight=function(){return this.size>=2},t}(),d=[new p(0,0,!1),new p(1,0,!0),new p(2,1,!1),new p(3,1,!0),new p(4,2,!1),new p(5,2,!0),new p(6,3,!1),new p(7,3,!0)],f=[4,5,4,5,6,7,6,7],g=[5,5,5,5,7,7,7,7],x=[2,3,4,5,6,7,6,7],v=[3,3,5,5,7,7,7,7],b=[1,1,3,3,5,5,7,7],y=[0,1,2,3,2,3,2,3],w={DISPLAY:d[0],TEXT:d[2],SCRIPT:d[4],SCRIPTSCRIPT:d[6]},k=[{name:"latin",blocks:[[256,591],[768,879]]},{name:"cyrillic",blocks:[[1024,1279]]},{name:"brahmic",blocks:[[2304,4255]]},{name:"georgian",blocks:[[4256,4351]]},{name:"cjk",blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:"hangul",blocks:[[44032,55215]]}];var S=[];function M(t){for(var e=0;e=S[e]&&t<=S[e+1])return!0;return!1}k.forEach(function(t){return t.blocks.forEach(function(t){return S.push.apply(S,t)})});var z={doubleleftarrow:"M262 157\nl10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3\n 0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28\n 14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5\nc2 1.7 6.3 3.5 13 5.5 68 17.3 128.2 47.8 180.5 91.5 52.3 43.7 93.8 96.2 124.5\n 157.5 9.3 8 15.3 12.3 18 13h6c12-.7 18-4 18-10 0-2-1.7-7-5-15-23.3-46-52-87\n-86-123l-10-10h399738v-40H218c328 0 0 0 0 0l-10-8c-26.7-20-65.7-43-117-69 2.7\n-2 6-3.7 10-5 36.7-16 72.3-37.3 107-64l10-8h399782v-40z\nm8 0v40h399730v-40zm0 194v40h399730v-40z",doublerightarrow:"M399738 392l\n-10 10c-34 36-62.7 77-86 123-3.3 8-5 13.3-5 16 0 5.3 6.7 8 20 8 7.3 0 12.2-.5\n 14.5-1.5 2.3-1 4.8-4.5 7.5-10.5 49.3-97.3 121.7-169.3 217-216 28-14 57.3-25 88\n-33 6.7-2 11-3.8 13-5.5 2-1.7 3-4.2 3-7.5s-1-5.8-3-7.5c-2-1.7-6.3-3.5-13-5.5-68\n-17.3-128.2-47.8-180.5-91.5-52.3-43.7-93.8-96.2-124.5-157.5-9.3-8-15.3-12.3-18\n-13h-6c-12 .7-18 4-18 10 0 2 1.7 7 5 15 23.3 46 52 87 86 123l10 10H0v40h399782\nc-328 0 0 0 0 0l10 8c26.7 20 65.7 43 117 69-2.7 2-6 3.7-10 5-36.7 16-72.3 37.3\n-107 64l-10 8H0v40zM0 157v40h399730v-40zm0 194v40h399730v-40z",leftarrow:"M400000 241H110l3-3c68.7-52.7 113.7-120\n 135-202 4-14.7 6-23 6-25 0-7.3-7-11-21-11-8 0-13.2.8-15.5 2.5-2.3 1.7-4.2 5.8\n-5.5 12.5-1.3 4.7-2.7 10.3-4 17-12 48.7-34.8 92-68.5 130S65.3 228.3 18 247\nc-10 4-16 7.7-18 11 0 8.7 6 14.3 18 17 47.3 18.7 87.8 47 121.5 85S196 441.3 208\n 490c.7 2 1.3 5 2 9s1.2 6.7 1.5 8c.3 1.3 1 3.3 2 6s2.2 4.5 3.5 5.5c1.3 1 3.3\n 1.8 6 2.5s6 1 10 1c14 0 21-3.7 21-11 0-2-2-10.3-6-25-20-79.3-65-146.7-135-202\n l-3-3h399890zM100 241v40h399900v-40z",leftbrace:"M6 548l-6-6v-35l6-11c56-104 135.3-181.3 238-232 57.3-28.7 117\n-45 179-50h399577v120H403c-43.3 7-81 15-113 26-100.7 33-179.7 91-237 174-2.7\n 5-6 9-10 13-.7 1-7.3 1-20 1H6z",leftbraceunder:"M0 6l6-6h17c12.688 0 19.313.3 20 1 4 4 7.313 8.3 10 13\n 35.313 51.3 80.813 93.8 136.5 127.5 55.688 33.7 117.188 55.8 184.5 66.5.688\n 0 2 .3 4 1 18.688 2.7 76 4.3 172 5h399450v120H429l-6-1c-124.688-8-235-61.7\n-331-161C60.687 138.7 32.312 99.3 7 54L0 41V6z",leftgroup:"M400000 80\nH435C64 80 168.3 229.4 21 260c-5.9 1.2-18 0-18 0-2 0-3-1-3-3v-38C76 61 257 0\n 435 0h399565z",leftgroupunder:"M400000 262\nH435C64 262 168.3 112.6 21 82c-5.9-1.2-18 0-18 0-2 0-3 1-3 3v38c76 158 257 219\n 435 219h399565z",leftharpoon:"M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3\n-3.3 10.2-9.5 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5\n-18.3 3-21-1.3-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7\n-196 228-6.7 4.7-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40z",leftharpoonplus:"M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3-3.3 10.2-9.5\n 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5-18.3 3-21-1.3\n-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7-196 228-6.7 4.7\n-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40zM0 435v40h400000v-40z\nm0 0v40h400000v-40z",leftharpoondown:"M7 241c-4 4-6.333 8.667-7 14 0 5.333.667 9 2 11s5.333\n 5.333 12 10c90.667 54 156 130 196 228 3.333 10.667 6.333 16.333 9 17 2 .667 5\n 1 9 1h5c10.667 0 16.667-2 18-6 2-2.667 1-9.667-3-21-32-87.333-82.667-157.667\n-152-211l-3-3h399907v-40zM93 281 H400000 v-40L7 241z",leftharpoondownplus:"M7 435c-4 4-6.3 8.7-7 14 0 5.3.7 9 2 11s5.3 5.3 12\n 10c90.7 54 156 130 196 228 3.3 10.7 6.3 16.3 9 17 2 .7 5 1 9 1h5c10.7 0 16.7\n-2 18-6 2-2.7 1-9.7-3-21-32-87.3-82.7-157.7-152-211l-3-3h399907v-40H7zm93 0\nv40h399900v-40zM0 241v40h399900v-40zm0 0v40h399900v-40z",lefthook:"M400000 281 H103s-33-11.2-61-33.5S0 197.3 0 164s14.2-61.2 42.5\n-83.5C70.8 58.2 104 47 142 47 c16.7 0 25 6.7 25 20 0 12-8.7 18.7-26 20-40 3.3\n-68.7 15.7-86 37-10 12-15 25.3-15 40 0 22.7 9.8 40.7 29.5 54 19.7 13.3 43.5 21\n 71.5 23h399859zM103 281v-40h399897v40z",leftlinesegment:"M40 281 V428 H0 V94 H40 V241 H400000 v40z\nM40 281 V428 H0 V94 H40 V241 H400000 v40z",leftmapsto:"M40 281 V448H0V74H40V241H400000v40z\nM40 281 V448H0V74H40V241H400000v40z",leftToFrom:"M0 147h400000v40H0zm0 214c68 40 115.7 95.7 143 167h22c15.3 0 23\n-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69-70-101l-7-8h399905v-40H95l7-8\nc28.7-32 52-65.7 70-101 10.7-23.3 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 265.3\n 68 321 0 361zm0-174v-40h399900v40zm100 154v40h399900v-40z",longequal:"M0 50 h400000 v40H0z m0 194h40000v40H0z\nM0 50 h400000 v40H0z m0 194h40000v40H0z",midbrace:"M200428 334\nc-100.7-8.3-195.3-44-280-108-55.3-42-101.7-93-139-153l-9-14c-2.7 4-5.7 8.7-9 14\n-53.3 86.7-123.7 153-211 199-66.7 36-137.3 56.3-212 62H0V214h199568c178.3-11.7\n 311.7-78.3 403-201 6-8 9.7-12 11-12 .7-.7 6.7-1 18-1s17.3.3 18 1c1.3 0 5 4 11\n 12 44.7 59.3 101.3 106.3 170 141s145.3 54.3 229 60h199572v120z",midbraceunder:"M199572 214\nc100.7 8.3 195.3 44 280 108 55.3 42 101.7 93 139 153l9 14c2.7-4 5.7-8.7 9-14\n 53.3-86.7 123.7-153 211-199 66.7-36 137.3-56.3 212-62h199568v120H200432c-178.3\n 11.7-311.7 78.3-403 201-6 8-9.7 12-11 12-.7.7-6.7 1-18 1s-17.3-.3-18-1c-1.3 0\n-5-4-11-12-44.7-59.3-101.3-106.3-170-141s-145.3-54.3-229-60H0V214z",oiintSize1:"M512.6 71.6c272.6 0 320.3 106.8 320.3 178.2 0 70.8-47.7 177.6\n-320.3 177.6S193.1 320.6 193.1 249.8c0-71.4 46.9-178.2 319.5-178.2z\nm368.1 178.2c0-86.4-60.9-215.4-368.1-215.4-306.4 0-367.3 129-367.3 215.4 0 85.8\n60.9 214.8 367.3 214.8 307.2 0 368.1-129 368.1-214.8z",oiintSize2:"M757.8 100.1c384.7 0 451.1 137.6 451.1 230 0 91.3-66.4 228.8\n-451.1 228.8-386.3 0-452.7-137.5-452.7-228.8 0-92.4 66.4-230 452.7-230z\nm502.4 230c0-111.2-82.4-277.2-502.4-277.2s-504 166-504 277.2\nc0 110 84 276 504 276s502.4-166 502.4-276z",oiiintSize1:"M681.4 71.6c408.9 0 480.5 106.8 480.5 178.2 0 70.8-71.6 177.6\n-480.5 177.6S202.1 320.6 202.1 249.8c0-71.4 70.5-178.2 479.3-178.2z\nm525.8 178.2c0-86.4-86.8-215.4-525.7-215.4-437.9 0-524.7 129-524.7 215.4 0\n85.8 86.8 214.8 524.7 214.8 438.9 0 525.7-129 525.7-214.8z",oiiintSize2:"M1021.2 53c603.6 0 707.8 165.8 707.8 277.2 0 110-104.2 275.8\n-707.8 275.8-606 0-710.2-165.8-710.2-275.8C311 218.8 415.2 53 1021.2 53z\nm770.4 277.1c0-131.2-126.4-327.6-770.5-327.6S248.4 198.9 248.4 330.1\nc0 130 128.8 326.4 772.7 326.4s770.5-196.4 770.5-326.4z",rightarrow:"M0 241v40h399891c-47.3 35.3-84 78-110 128\n-16.7 32-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20\n 11 8 0 13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7\n 39-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85\n-40.5-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5\n-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67\n 151.7 139 205zm0 0v40h399900v-40z",rightbrace:"M400000 542l\n-6 6h-17c-12.7 0-19.3-.3-20-1-4-4-7.3-8.3-10-13-35.3-51.3-80.8-93.8-136.5-127.5\ns-117.2-55.8-184.5-66.5c-.7 0-2-.3-4-1-18.7-2.7-76-4.3-172-5H0V214h399571l6 1\nc124.7 8 235 61.7 331 161 31.3 33.3 59.7 72.7 85 118l7 13v35z",rightbraceunder:"M399994 0l6 6v35l-6 11c-56 104-135.3 181.3-238 232-57.3\n 28.7-117 45-179 50H-300V214h399897c43.3-7 81-15 113-26 100.7-33 179.7-91 237\n-174 2.7-5 6-9 10-13 .7-1 7.3-1 20-1h17z",rightgroup:"M0 80h399565c371 0 266.7 149.4 414 180 5.9 1.2 18 0 18 0 2 0\n 3-1 3-3v-38c-76-158-257-219-435-219H0z",rightgroupunder:"M0 262h399565c371 0 266.7-149.4 414-180 5.9-1.2 18 0 18\n 0 2 0 3 1 3 3v38c-76 158-257 219-435 219H0z",rightharpoon:"M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3\n-3.7-15.3-11-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2\n-10.7 0-16.7 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58\n 69.2 92 94.5zm0 0v40h399900v-40z",rightharpoonplus:"M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3-3.7-15.3-11\n-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2-10.7 0-16.7\n 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 69.2 92 94.5z\nm0 0v40h399900v-40z m100 194v40h399900v-40zm0 0v40h399900v-40z",rightharpoondown:"M399747 511c0 7.3 6.7 11 20 11 8 0 13-.8 15-2.5s4.7-6.8\n 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 8.5-5.8 9.5\n-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3-64.7 57-92 95\n-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 241v40h399900v-40z",rightharpoondownplus:"M399747 705c0 7.3 6.7 11 20 11 8 0 13-.8\n 15-2.5s4.7-6.8 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3\n 8.5-5.8 9.5-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3\n-64.7 57-92 95-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 435v40h399900v-40z\nm0-194v40h400000v-40zm0 0v40h400000v-40z",righthook:"M399859 241c-764 0 0 0 0 0 40-3.3 68.7-15.7 86-37 10-12 15-25.3\n 15-40 0-22.7-9.8-40.7-29.5-54-19.7-13.3-43.5-21-71.5-23-17.3-1.3-26-8-26-20 0\n-13.3 8.7-20 26-20 38 0 71 11.2 99 33.5 0 0 7 5.6 21 16.7 14 11.2 21 33.5 21\n 66.8s-14 61.2-42 83.5c-28 22.3-61 33.5-99 33.5L0 241z M0 281v-40h399859v40z",rightlinesegment:"M399960 241 V94 h40 V428 h-40 V281 H0 v-40z\nM399960 241 V94 h40 V428 h-40 V281 H0 v-40z",rightToFrom:"M400000 167c-70.7-42-118-97.7-142-167h-23c-15.3 0-23 .3-23\n 1 0 1.3 5.3 13.7 16 37 18 35.3 41.3 69 70 101l7 8H0v40h399905l-7 8c-28.7 32\n-52 65.7-70 101-10.7 23.3-16 35.7-16 37 0 .7 7.7 1 23 1h23c24-69.3 71.3-125 142\n-167z M100 147v40h399900v-40zM0 341v40h399900v-40z",twoheadleftarrow:"M0 167c68 40\n 115.7 95.7 143 167h22c15.3 0 23-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69\n-70-101l-7-8h125l9 7c50.7 39.3 85 86 103 140h46c0-4.7-6.3-18.7-19-42-18-35.3\n-40-67.3-66-96l-9-9h399716v-40H284l9-9c26-28.7 48-60.7 66-96 12.7-23.333 19\n-37.333 19-42h-46c-18 54-52.3 100.7-103 140l-9 7H95l7-8c28.7-32 52-65.7 70-101\n 10.7-23.333 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 71.3 68 127 0 167z",twoheadrightarrow:"M400000 167\nc-68-40-115.7-95.7-143-167h-22c-15.3 0-23 .3-23 1 0 1.3 5.3 13.7 16 37 18 35.3\n 41.3 69 70 101l7 8h-125l-9-7c-50.7-39.3-85-86-103-140h-46c0 4.7 6.3 18.7 19 42\n 18 35.3 40 67.3 66 96l9 9H0v40h399716l-9 9c-26 28.7-48 60.7-66 96-12.7 23.333\n-19 37.333-19 42h46c18-54 52.3-100.7 103-140l9-7h125l-7 8c-28.7 32-52 65.7-70\n 101-10.7 23.333-16 35.7-16 37 0 .7 7.7 1 23 1h22c27.3-71.3 75-127 143-167z",tilde1:"M200 55.538c-77 0-168 73.953-177 73.953-3 0-7\n-2.175-9-5.437L2 97c-1-2-2-4-2-6 0-4 2-7 5-9l20-12C116 12 171 0 207 0c86 0\n 114 68 191 68 78 0 168-68 177-68 4 0 7 2 9 5l12 19c1 2.175 2 4.35 2 6.525 0\n 4.35-2 7.613-5 9.788l-19 13.05c-92 63.077-116.937 75.308-183 76.128\n-68.267.847-113-73.952-191-73.952z",tilde2:"M344 55.266c-142 0-300.638 81.316-311.5 86.418\n-8.01 3.762-22.5 10.91-23.5 5.562L1 120c-1-2-1-3-1-4 0-5 3-9 8-10l18.4-9C160.9\n 31.9 283 0 358 0c148 0 188 122 331 122s314-97 326-97c4 0 8 2 10 7l7 21.114\nc1 2.14 1 3.21 1 4.28 0 5.347-3 9.626-7 10.696l-22.3 12.622C852.6 158.372 751\n 181.476 676 181.476c-149 0-189-126.21-332-126.21z",tilde3:"M786 59C457 59 32 175.242 13 175.242c-6 0-10-3.457\n-11-10.37L.15 138c-1-7 3-12 10-13l19.2-6.4C378.4 40.7 634.3 0 804.3 0c337 0\n 411.8 157 746.8 157 328 0 754-112 773-112 5 0 10 3 11 9l1 14.075c1 8.066-.697\n 16.595-6.697 17.492l-21.052 7.31c-367.9 98.146-609.15 122.696-778.15 122.696\n -338 0-409-156.573-744-156.573z",tilde4:"M786 58C457 58 32 177.487 13 177.487c-6 0-10-3.345\n-11-10.035L.15 143c-1-7 3-12 10-13l22-6.7C381.2 35 637.15 0 807.15 0c337 0 409\n 177 744 177 328 0 754-127 773-127 5 0 10 3 11 9l1 14.794c1 7.805-3 13.38-9\n 14.495l-20.7 5.574c-366.85 99.79-607.3 139.372-776.3 139.372-338 0-409\n -175.236-744-175.236z",vec:"M377 20c0-5.333 1.833-10 5.5-14S391 0 397 0c4.667 0 8.667 1.667 12 5\n3.333 2.667 6.667 9 10 19 6.667 24.667 20.333 43.667 41 57 7.333 4.667 11\n10.667 11 18 0 6-1 10-3 12s-6.667 5-14 9c-28.667 14.667-53.667 35.667-75 63\n-1.333 1.333-3.167 3.5-5.5 6.5s-4 4.833-5 5.5c-1 .667-2.5 1.333-4.5 2s-4.333 1\n-7 1c-4.667 0-9.167-1.833-13.5-5.5S337 184 337 178c0-12.667 15.667-32.333 47-59\nH213l-171-1c-8.667-6-13-12.333-13-19 0-4.667 4.333-11.333 13-20h359\nc-16-25.333-24-45-24-59z",widehat1:"M529 0h5l519 115c5 1 9 5 9 10 0 1-1 2-1 3l-4 22\nc-1 5-5 9-11 9h-2L532 67 19 159h-2c-5 0-9-4-11-9l-5-22c-1-6 2-12 8-13z",widehat2:"M1181 0h2l1171 176c6 0 10 5 10 11l-2 23c-1 6-5 10\n-11 10h-1L1182 67 15 220h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z",widehat3:"M1181 0h2l1171 236c6 0 10 5 10 11l-2 23c-1 6-5 10\n-11 10h-1L1182 67 15 280h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z",widehat4:"M1181 0h2l1171 296c6 0 10 5 10 11l-2 23c-1 6-5 10\n-11 10h-1L1182 67 15 340h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z",widecheck1:"M529,159h5l519,-115c5,-1,9,-5,9,-10c0,-1,-1,-2,-1,-3l-4,-22c-1,\n-5,-5,-9,-11,-9h-2l-512,92l-513,-92h-2c-5,0,-9,4,-11,9l-5,22c-1,6,2,12,8,13z",widecheck2:"M1181,220h2l1171,-176c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,153l-1167,-153h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z",widecheck3:"M1181,280h2l1171,-236c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,213l-1167,-213h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z",widecheck4:"M1181,340h2l1171,-296c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,\n-11,-10h-1l-1168,273l-1167,-273h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z",baraboveleftarrow:"M400000 620h-399890l3 -3c68.7 -52.7 113.7 -120 135 -202\nc4 -14.7 6 -23 6 -25c0 -7.3 -7 -11 -21 -11c-8 0 -13.2 0.8 -15.5 2.5\nc-2.3 1.7 -4.2 5.8 -5.5 12.5c-1.3 4.7 -2.7 10.3 -4 17c-12 48.7 -34.8 92 -68.5 130\ns-74.2 66.3 -121.5 85c-10 4 -16 7.7 -18 11c0 8.7 6 14.3 18 17c47.3 18.7 87.8 47\n121.5 85s56.5 81.3 68.5 130c0.7 2 1.3 5 2 9s1.2 6.7 1.5 8c0.3 1.3 1 3.3 2 6\ns2.2 4.5 3.5 5.5c1.3 1 3.3 1.8 6 2.5s6 1 10 1c14 0 21 -3.7 21 -11\nc0 -2 -2 -10.3 -6 -25c-20 -79.3 -65 -146.7 -135 -202l-3 -3h399890z\nM100 620v40h399900v-40z M0 241v40h399900v-40zM0 241v40h399900v-40z",rightarrowabovebar:"M0 241v40h399891c-47.3 35.3-84 78-110 128-16.7 32\n-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 11 8 0\n13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 39\n-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85-40.5\n-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5\n-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67\n151.7 139 205zm96 379h399894v40H0zm0 0h399904v40H0z",baraboveshortleftharpoon:"M507,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11\nc1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17\nc2,0.7,5,1,9,1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21\nc-32,-87.3,-82.7,-157.7,-152,-211c0,0,-3,-3,-3,-3l399351,0l0,-40\nc-398570,0,-399437,0,-399437,0z M593 435 v40 H399500 v-40z\nM0 281 v-40 H399908 v40z M0 281 v-40 H399908 v40z",rightharpoonaboveshortbar:"M0,241 l0,40c399126,0,399993,0,399993,0\nc4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,\n-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6\nc-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z\nM0 241 v40 H399908 v-40z M0 475 v-40 H399500 v40z M0 475 v-40 H399500 v40z",shortbaraboveleftharpoon:"M7,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11\nc1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17c2,0.7,5,1,9,\n1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21c-32,-87.3,-82.7,-157.7,\n-152,-211c0,0,-3,-3,-3,-3l399907,0l0,-40c-399126,0,-399993,0,-399993,0z\nM93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z",shortrightharpoonabovebar:"M53,241l0,40c398570,0,399437,0,399437,0\nc4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,\n-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6\nc-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z\nM500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z"},A=function(){function t(t){this.children=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.children=t,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}var e=t.prototype;return e.hasClass=function(t){return c.contains(this.classes,t)},e.toNode=function(){for(var t=document.createDocumentFragment(),e=0;e"},N=function(){function t(t,e,r,a){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.width=void 0,this.maxFontSize=void 0,this.style=void 0,B.call(this,t,r,a),this.children=e||[]}var e=t.prototype;return e.setAttribute=function(t,e){this.attributes[t]=e},e.hasClass=function(t){return c.contains(this.classes,t)},e.toNode=function(){return C.call(this,"span")},e.toMarkup=function(){return q.call(this,"span")},t}(),I=function(){function t(t,e,r,a){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,B.call(this,e,a),this.children=r||[],this.setAttribute("href",t)}var e=t.prototype;return e.setAttribute=function(t,e){this.attributes[t]=e},e.hasClass=function(t){return c.contains(this.classes,t)},e.toNode=function(){return C.call(this,"a")},e.toMarkup=function(){return q.call(this,"a")},t}(),R=function(){function t(t,e,r){this.src=void 0,this.alt=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.alt=e,this.src=t,this.classes=["mord"],this.style=r}var e=t.prototype;return e.hasClass=function(t){return c.contains(this.classes,t)},e.toNode=function(){var t=document.createElement("img");for(var e in t.src=this.src,t.alt=this.alt,t.className="mord",this.style)this.style.hasOwnProperty(e)&&(t.style[e]=this.style[e]);return t},e.toMarkup=function(){var t=""+this.alt+"=n[0]&&t<=n[1])return r.name}return null}(this.text.charCodeAt(0));h&&this.classes.push(h+"_fallback"),/[\xee\xef\xed\xec]/.test(this.text)&&(this.text=O[this.text])}var e=t.prototype;return e.hasClass=function(t){return c.contains(this.classes,t)},e.toNode=function(){var t=document.createTextNode(this.text),e=null;for(var r in this.italic>0&&((e=document.createElement("span")).style.marginRight=this.italic+"em"),this.classes.length>0&&((e=e||document.createElement("span")).className=T(this.classes)),this.style)this.style.hasOwnProperty(r)&&((e=e||document.createElement("span")).style[r]=this.style[r]);return e?(e.appendChild(t),e):t},e.toMarkup=function(){var t=!1,e="0&&(r+="margin-right:"+this.italic+"em;"),this.style)this.style.hasOwnProperty(a)&&(r+=c.hyphenate(a)+":"+this.style[a]+";");r&&(t=!0,e+=' style="'+c.escape(r)+'"');var n=c.escape(this.text);return t?(e+=">",e+=n,e+="
    "):n},t}(),L=function(){function t(t,e){this.children=void 0,this.attributes=void 0,this.children=t||[],this.attributes=e||{}}var e=t.prototype;return e.toNode=function(){var t=document.createElementNS("http://www.w3.org/2000/svg","svg");for(var e in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,e)&&t.setAttribute(e,this.attributes[e]);for(var r=0;r":""},t}(),P=function(){function t(t){this.attributes=void 0,this.attributes=t||{}}var e=t.prototype;return e.toNode=function(){var t=document.createElementNS("http://www.w3.org/2000/svg","line");for(var e in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,e)&&t.setAttribute(e,this.attributes[e]);return t},e.toMarkup=function(){var t="",">"),$("math",Z,et,":",":"),$("math",Z,et,"\u2248","\\approx",!0),$("math",Z,et,"\u2245","\\cong",!0),$("math",Z,et,"\u2265","\\ge"),$("math",Z,et,"\u2265","\\geq",!0),$("math",Z,et,"\u2190","\\gets"),$("math",Z,et,">","\\gt"),$("math",Z,et,"\u2208","\\in",!0),$("math",Z,et,"\ue020","\\@not"),$("math",Z,et,"\u2282","\\subset",!0),$("math",Z,et,"\u2283","\\supset",!0),$("math",Z,et,"\u2286","\\subseteq",!0),$("math",Z,et,"\u2287","\\supseteq",!0),$("math",K,et,"\u2288","\\nsubseteq",!0),$("math",K,et,"\u2289","\\nsupseteq",!0),$("math",Z,et,"\u22a8","\\models"),$("math",Z,et,"\u2190","\\leftarrow",!0),$("math",Z,et,"\u2264","\\le"),$("math",Z,et,"\u2264","\\leq",!0),$("math",Z,et,"<","\\lt"),$("math",Z,et,"\u2192","\\rightarrow",!0),$("math",Z,et,"\u2192","\\to"),$("math",K,et,"\u2271","\\ngeq",!0),$("math",K,et,"\u2270","\\nleq",!0),$("math",Z,"spacing","\xa0","\\ "),$("math",Z,"spacing","\xa0","~"),$("math",Z,"spacing","\xa0","\\space"),$("math",Z,"spacing","\xa0","\\nobreakspace"),$("text",Z,"spacing","\xa0","\\ "),$("text",Z,"spacing","\xa0","~"),$("text",Z,"spacing","\xa0","\\space"),$("text",Z,"spacing","\xa0","\\nobreakspace"),$("math",Z,"spacing",null,"\\nobreak"),$("math",Z,"spacing",null,"\\allowbreak"),$("math",Z,"punct",",",","),$("math",Z,"punct",";",";"),$("math",K,J,"\u22bc","\\barwedge",!0),$("math",K,J,"\u22bb","\\veebar",!0),$("math",Z,J,"\u2299","\\odot",!0),$("math",Z,J,"\u2295","\\oplus",!0),$("math",Z,J,"\u2297","\\otimes",!0),$("math",Z,"textord","\u2202","\\partial",!0),$("math",Z,J,"\u2298","\\oslash",!0),$("math",K,J,"\u229a","\\circledcirc",!0),$("math",K,J,"\u22a1","\\boxdot",!0),$("math",Z,J,"\u25b3","\\bigtriangleup"),$("math",Z,J,"\u25bd","\\bigtriangledown"),$("math",Z,J,"\u2020","\\dagger"),$("math",Z,J,"\u22c4","\\diamond"),$("math",Z,J,"\u22c6","\\star"),$("math",Z,J,"\u25c3","\\triangleleft"),$("math",Z,J,"\u25b9","\\triangleright"),$("math",Z,"open","{","\\{"),$("text",Z,"textord","{","\\{"),$("text",Z,"textord","{","\\textbraceleft"),$("math",Z,"close","}","\\}"),$("text",Z,"textord","}","\\}"),$("text",Z,"textord","}","\\textbraceright"),$("math",Z,"open","{","\\lbrace"),$("math",Z,"close","}","\\rbrace"),$("math",Z,"open","[","\\lbrack"),$("text",Z,"textord","[","\\lbrack"),$("math",Z,"close","]","\\rbrack"),$("text",Z,"textord","]","\\rbrack"),$("math",Z,"open","(","\\lparen"),$("math",Z,"close",")","\\rparen"),$("text",Z,"textord","<","\\textless"),$("text",Z,"textord",">","\\textgreater"),$("math",Z,"open","\u230a","\\lfloor",!0),$("math",Z,"close","\u230b","\\rfloor",!0),$("math",Z,"open","\u2308","\\lceil",!0),$("math",Z,"close","\u2309","\\rceil",!0),$("math",Z,"textord","\\","\\backslash"),$("math",Z,"textord","\u2223","|"),$("math",Z,"textord","\u2223","\\vert"),$("text",Z,"textord","|","\\textbar"),$("math",Z,"textord","\u2225","\\|"),$("math",Z,"textord","\u2225","\\Vert"),$("text",Z,"textord","\u2225","\\textbardbl"),$("text",Z,"textord","~","\\textasciitilde"),$("text",Z,"textord","\\","\\textbackslash"),$("text",Z,"textord","^","\\textasciicircum"),$("math",Z,et,"\u2191","\\uparrow",!0),$("math",Z,et,"\u21d1","\\Uparrow",!0),$("math",Z,et,"\u2193","\\downarrow",!0),$("math",Z,et,"\u21d3","\\Downarrow",!0),$("math",Z,et,"\u2195","\\updownarrow",!0),$("math",Z,et,"\u21d5","\\Updownarrow",!0),$("math",Z,tt,"\u2210","\\coprod"),$("math",Z,tt,"\u22c1","\\bigvee"),$("math",Z,tt,"\u22c0","\\bigwedge"),$("math",Z,tt,"\u2a04","\\biguplus"),$("math",Z,tt,"\u22c2","\\bigcap"),$("math",Z,tt,"\u22c3","\\bigcup"),$("math",Z,tt,"\u222b","\\int"),$("math",Z,tt,"\u222b","\\intop"),$("math",Z,tt,"\u222c","\\iint"),$("math",Z,tt,"\u222d","\\iiint"),$("math",Z,tt,"\u220f","\\prod"),$("math",Z,tt,"\u2211","\\sum"),$("math",Z,tt,"\u2a02","\\bigotimes"),$("math",Z,tt,"\u2a01","\\bigoplus"),$("math",Z,tt,"\u2a00","\\bigodot"),$("math",Z,tt,"\u222e","\\oint"),$("math",Z,tt,"\u222f","\\oiint"),$("math",Z,tt,"\u2230","\\oiiint"),$("math",Z,tt,"\u2a06","\\bigsqcup"),$("math",Z,tt,"\u222b","\\smallint"),$("text",Z,"inner","\u2026","\\textellipsis"),$("math",Z,"inner","\u2026","\\mathellipsis"),$("text",Z,"inner","\u2026","\\ldots",!0),$("math",Z,"inner","\u2026","\\ldots",!0),$("math",Z,"inner","\u22ef","\\@cdots",!0),$("math",Z,"inner","\u22f1","\\ddots",!0),$("math",Z,"textord","\u22ee","\\varvdots"),$("math",Z,"accent-token","\u02ca","\\acute"),$("math",Z,"accent-token","\u02cb","\\grave"),$("math",Z,"accent-token","\xa8","\\ddot"),$("math",Z,"accent-token","~","\\tilde"),$("math",Z,"accent-token","\u02c9","\\bar"),$("math",Z,"accent-token","\u02d8","\\breve"),$("math",Z,"accent-token","\u02c7","\\check"),$("math",Z,"accent-token","^","\\hat"),$("math",Z,"accent-token","\u20d7","\\vec"),$("math",Z,"accent-token","\u02d9","\\dot"),$("math",Z,"accent-token","\u02da","\\mathring"),$("math",Z,Q,"\u0131","\\imath",!0),$("math",Z,Q,"\u0237","\\jmath",!0),$("text",Z,"textord","\u0131","\\i",!0),$("text",Z,"textord","\u0237","\\j",!0),$("text",Z,"textord","\xdf","\\ss",!0),$("text",Z,"textord","\xe6","\\ae",!0),$("text",Z,"textord","\xe6","\\ae",!0),$("text",Z,"textord","\u0153","\\oe",!0),$("text",Z,"textord","\xf8","\\o",!0),$("text",Z,"textord","\xc6","\\AE",!0),$("text",Z,"textord","\u0152","\\OE",!0),$("text",Z,"textord","\xd8","\\O",!0),$("text",Z,"accent-token","\u02ca","\\'"),$("text",Z,"accent-token","\u02cb","\\`"),$("text",Z,"accent-token","\u02c6","\\^"),$("text",Z,"accent-token","\u02dc","\\~"),$("text",Z,"accent-token","\u02c9","\\="),$("text",Z,"accent-token","\u02d8","\\u"),$("text",Z,"accent-token","\u02d9","\\."),$("text",Z,"accent-token","\u02da","\\r"),$("text",Z,"accent-token","\u02c7","\\v"),$("text",Z,"accent-token","\xa8",'\\"'),$("text",Z,"accent-token","\u02dd","\\H"),$("text",Z,"accent-token","\u25ef","\\textcircled");var rt={"--":!0,"---":!0,"``":!0,"''":!0};$("text",Z,"textord","\u2013","--"),$("text",Z,"textord","\u2013","\\textendash"),$("text",Z,"textord","\u2014","---"),$("text",Z,"textord","\u2014","\\textemdash"),$("text",Z,"textord","\u2018","`"),$("text",Z,"textord","\u2018","\\textquoteleft"),$("text",Z,"textord","\u2019","'"),$("text",Z,"textord","\u2019","\\textquoteright"),$("text",Z,"textord","\u201c","``"),$("text",Z,"textord","\u201c","\\textquotedblleft"),$("text",Z,"textord","\u201d","''"),$("text",Z,"textord","\u201d","\\textquotedblright"),$("math",Z,"textord","\xb0","\\degree",!0),$("text",Z,"textord","\xb0","\\degree"),$("text",Z,"textord","\xb0","\\textdegree",!0),$("math",Z,Q,"\xa3","\\pounds"),$("math",Z,Q,"\xa3","\\mathsterling",!0),$("text",Z,Q,"\xa3","\\pounds"),$("text",Z,Q,"\xa3","\\textsterling",!0),$("math",K,"textord","\u2720","\\maltese"),$("text",K,"textord","\u2720","\\maltese"),$("text",Z,"spacing","\xa0","\\ "),$("text",Z,"spacing","\xa0"," "),$("text",Z,"spacing","\xa0","~");for(var at=0;at<'0123456789/@."'.length;at++){var nt='0123456789/@."'.charAt(at);$("math",Z,"textord",nt,nt)}for(var it=0;it<'0123456789!@*()-=+[]<>|";:?/.,'.length;it++){var ot='0123456789!@*()-=+[]<>|";:?/.,'.charAt(it);$("text",Z,"textord",ot,ot)}for(var st="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",ht=0;ht=5?0:t>=3?1:2]){var r=Y[e]={cssEmPerMu:V.quad[e]/18};for(var a in V)V.hasOwnProperty(a)&&(r[a]=V[a][e])}return Y[e]}(this.size)),this._fontMetrics},e.getColor=function(){return this.phantom?"transparent":this.color},t}();kt.BASESIZE=6;var St=kt,Mt={pt:1,mm:7227/2540,cm:7227/254,in:72.27,bp:1.00375,pc:12,dd:1238/1157,cc:14856/1157,nd:685/642,nc:1370/107,sp:1/65536,px:1.00375},zt={ex:!0,em:!0,mu:!0},At=function(t){return"string"!=typeof t&&(t=t.unit),t in Mt||t in zt||"ex"===t},Tt=function(t,e){var r;if(t.unit in Mt)r=Mt[t.unit]/e.fontMetrics().ptPerEm/e.sizeMultiplier;else if("mu"===t.unit)r=e.fontMetrics().cssEmPerMu;else{var a;if(a=e.style.isTight()?e.havingStyle(e.style.text()):e,"ex"===t.unit)r=a.fontMetrics().xHeight;else{if("em"!==t.unit)throw new o("Invalid unit: '"+t.unit+"'");r=a.fontMetrics().quad}a!==e&&(r*=a.sizeMultiplier/e.sizeMultiplier)}return Math.min(t.number*r,e.maxSize)},Bt=["\\imath","\u0131","\\jmath","\u0237","\\pounds","\\mathsterling","\\textsterling","\xa3"],Ct=function(t,e,r){return j[r][t]&&j[r][t].replace&&(t=j[r][t].replace),{value:t,metrics:G(t,e,r)}},qt=function(t,e,r,a,n){var i,o=Ct(t,e,r),s=o.metrics;if(t=o.value,s){var h=s.italic;("text"===r||a&&"mathit"===a.font)&&(h=0),i=new E(t,s.height,s.depth,h,s.skew,s.width,n)}else"undefined"!=typeof console&&console.warn("No character metrics for '"+t+"' in style '"+e+"' and mode '"+r+"'"),i=new E(t,0,0,0,0,0,n);if(a){i.maxFontSize=a.sizeMultiplier,a.style.isTight()&&i.classes.push("mtight");var l=a.getColor();l&&(i.style.color=l)}return i},Nt=function(t,e){if(T(t.classes)!==T(e.classes)||t.skew!==e.skew||t.maxFontSize!==e.maxFontSize)return!1;for(var r in t.style)if(t.style.hasOwnProperty(r)&&t.style[r]!==e.style[r])return!1;for(var a in e.style)if(e.style.hasOwnProperty(a)&&t.style[a]!==e.style[a])return!1;return!0},It=function(t){for(var e=0,r=0,a=0,n=0;ne&&(e=i.height),i.depth>r&&(r=i.depth),i.maxFontSize>a&&(a=i.maxFontSize)}t.height=e,t.depth=r,t.maxFontSize=a},Rt=function(t,e,r,a){var n=new N(t,e,r,a);return It(n),n},Ot=function(t,e,r,a){return new N(t,e,r,a)},Et=function(t){var e=new A(t);return It(e),e},Lt=function(t,e,r){var a="";switch(t){case"amsrm":a="AMS";break;case"textrm":a="Main";break;case"textsf":a="SansSerif";break;case"texttt":a="Typewriter";break;default:a=t}return a+"-"+("textbf"===e&&"textit"===r?"BoldItalic":"textbf"===e?"Bold":"textit"===e?"Italic":"Regular")},Ht={mathbf:{variant:"bold",fontName:"Main-Bold"},mathrm:{variant:"normal",fontName:"Main-Regular"},textit:{variant:"italic",fontName:"Main-Italic"},mathit:{variant:"italic",fontName:"Main-Italic"},mathbb:{variant:"double-struck",fontName:"AMS-Regular"},mathcal:{variant:"script",fontName:"Caligraphic-Regular"},mathfrak:{variant:"fraktur",fontName:"Fraktur-Regular"},mathscr:{variant:"script",fontName:"Script-Regular"},mathsf:{variant:"sans-serif",fontName:"SansSerif-Regular"},mathtt:{variant:"monospace",fontName:"Typewriter-Regular"}},Pt={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},Dt={fontMap:Ht,makeSymbol:qt,mathsym:function(t,e,r,a){return void 0===a&&(a=[]),"boldsymbol"===r.font&&Ct(t,"Main-Bold",e).metrics?qt(t,"Main-Bold",e,r,a.concat(["mathbf"])):"\\"===t||"main"===j[e][t].font?qt(t,"Main-Regular",e,r,a):qt(t,"AMS-Regular",e,r,a.concat(["amsrm"]))},makeSpan:Rt,makeSvgSpan:Ot,makeLineSpan:function(t,e,r){var a=Rt([t],[],e);return a.height=Math.max(r||e.fontMetrics().defaultRuleThickness,e.minRuleThickness),a.style.borderBottomWidth=a.height+"em",a.maxFontSize=1,a},makeAnchor:function(t,e,r,a){var n=new I(t,e,r,a);return It(n),n},makeFragment:Et,wrapFragment:function(t,e){return t instanceof A?Rt([],[t],e):t},makeVList:function(t,e){for(var r=function(t){if("individualShift"===t.positionType){for(var e=t.children,r=[e[0]],a=-e[0].shift-e[0].elem.depth,n=a,i=1;i0&&(i.push(pe(o,e)),o=[]),i.push(n[s]));o.length>0&&i.push(pe(o,e)),r&&((a=pe(se(r,e,!0))).classes=["tag"],i.push(a));var l=re(["katex-html"],i);if(l.setAttribute("aria-hidden","true"),a){var m=a.children[0];m.style.height=l.height+l.depth+"em",m.style.verticalAlign=-l.depth+"em"}return l}function fe(t){return new A(t)}var ge=function(){function t(t,e){this.type=void 0,this.attributes=void 0,this.children=void 0,this.type=t,this.attributes={},this.children=e||[]}var e=t.prototype;return e.setAttribute=function(t,e){this.attributes[t]=e},e.getAttribute=function(t){return this.attributes[t]},e.toNode=function(){var t=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(var e in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,e)&&t.setAttribute(e,this.attributes[e]);for(var r=0;r"},e.toText=function(){return this.children.map(function(t){return t.toText()}).join("")},t}(),xe=function(){function t(t){this.text=void 0,this.text=t}var e=t.prototype;return e.toNode=function(){return document.createTextNode(this.text)},e.toMarkup=function(){return c.escape(this.toText())},e.toText=function(){return this.text},t}(),ve={MathNode:ge,TextNode:xe,SpaceNode:function(){function t(t){this.width=void 0,this.character=void 0,this.width=t,this.character=t>=.05555&&t<=.05556?"\u200a":t>=.1666&&t<=.1667?"\u2009":t>=.2222&&t<=.2223?"\u2005":t>=.2777&&t<=.2778?"\u2005\u200a":t>=-.05556&&t<=-.05555?"\u200a\u2063":t>=-.1667&&t<=-.1666?"\u2009\u2063":t>=-.2223&&t<=-.2222?"\u205f\u2063":t>=-.2778&&t<=-.2777?"\u2005\u2063":null}var e=t.prototype;return e.toNode=function(){if(this.character)return document.createTextNode(this.character);var t=document.createElementNS("http://www.w3.org/1998/Math/MathML","mspace");return t.setAttribute("width",this.width+"em"),t},e.toMarkup=function(){return this.character?""+this.character+"":''},e.toText=function(){return this.character?this.character:" "},t}(),newDocumentFragment:fe},be=function(t,e,r){return!j[e][t]||!j[e][t].replace||55349===t.charCodeAt(0)||rt.hasOwnProperty(t)&&r&&(r.fontFamily&&"tt"===r.fontFamily.substr(4,2)||r.font&&"tt"===r.font.substr(4,2))||(t=j[e][t].replace),new ve.TextNode(t)},ye=function(t){return 1===t.length?t[0]:new ve.MathNode("mrow",t)},we=function(t,e){if("texttt"===e.fontFamily)return"monospace";if("textsf"===e.fontFamily)return"textit"===e.fontShape&&"textbf"===e.fontWeight?"sans-serif-bold-italic":"textit"===e.fontShape?"sans-serif-italic":"textbf"===e.fontWeight?"bold-sans-serif":"sans-serif";if("textit"===e.fontShape&&"textbf"===e.fontWeight)return"bold-italic";if("textit"===e.fontShape)return"italic";if("textbf"===e.fontWeight)return"bold";var r=e.font;if(!r||"mathnormal"===r)return null;var a=t.mode;if("mathit"===r)return"italic";if("boldsymbol"===r)return"bold-italic";if("mathbf"===r)return"bold";if("mathbb"===r)return"double-struck";if("mathfrak"===r)return"fraktur";if("mathscr"===r||"mathcal"===r)return"script";if("mathsf"===r)return"sans-serif";if("mathtt"===r)return"monospace";var n=t.text;return c.contains(["\\imath","\\jmath"],n)?null:(j[a][n]&&j[a][n].replace&&(n=j[a][n].replace),G(n,Dt.fontMap[r].fontName,a)?Dt.fontMap[r].variant:null)},ke=function(t,e,r){if(1===t.length){var a=Me(t[0],e);return r&&a instanceof ge&&"mo"===a.type&&(a.setAttribute("lspace","0em"),a.setAttribute("rspace","0em")),[a]}for(var n,i=[],o=0;o0&&(p.text=p.text.slice(0,1)+"\u0338"+p.text.slice(1),i.pop())}}}i.push(s),n=s}return i},Se=function(t,e,r){return ye(ke(t,e,r))},Me=function(t,e){if(!t)return new ve.MathNode("mrow");if(Jt[t.type])return Jt[t.type](t,e);throw new o("Got group of unknown type: '"+t.type+"'")};function ze(t,e,r,a){var n,i=ke(t,r);n=1===i.length&&i[0]instanceof ge&&c.contains(["mrow","mtable"],i[0].type)?i[0]:new ve.MathNode("mrow",i);var o=new ve.MathNode("annotation",[new ve.TextNode(e)]);o.setAttribute("encoding","application/x-tex");var s=new ve.MathNode("semantics",[n,o]),h=new ve.MathNode("math",[s]);h.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML");var l=a?"katex":"katex-mathml";return Dt.makeSpan([l],[h])}var Ae=function(t){return new St({style:t.displayMode?w.DISPLAY:w.TEXT,maxSize:t.maxSize,minRuleThickness:t.minRuleThickness})},Te=function(t,e){if(e.displayMode){var r=["katex-display"];e.leqno&&r.push("leqno"),e.fleqn&&r.push("fleqn"),t=Dt.makeSpan(r,[t])}return t},Be=function(t,e,r){var a,n=Ae(r);if("mathml"===r.output)return ze(t,e,n,!0);if("html"===r.output){var i=de(t,n);a=Dt.makeSpan(["katex"],[i])}else{var o=ze(t,e,n,!1),s=de(t,n);a=Dt.makeSpan(["katex"],[o,s])}return Te(a,r)},Ce={widehat:"^",widecheck:"\u02c7",widetilde:"~",utilde:"~",overleftarrow:"\u2190",underleftarrow:"\u2190",xleftarrow:"\u2190",overrightarrow:"\u2192",underrightarrow:"\u2192",xrightarrow:"\u2192",underbrace:"\u23df",overbrace:"\u23de",overgroup:"\u23e0",undergroup:"\u23e1",overleftrightarrow:"\u2194",underleftrightarrow:"\u2194",xleftrightarrow:"\u2194",Overrightarrow:"\u21d2",xRightarrow:"\u21d2",overleftharpoon:"\u21bc",xleftharpoonup:"\u21bc",overrightharpoon:"\u21c0",xrightharpoonup:"\u21c0",xLeftarrow:"\u21d0",xLeftrightarrow:"\u21d4",xhookleftarrow:"\u21a9",xhookrightarrow:"\u21aa",xmapsto:"\u21a6",xrightharpoondown:"\u21c1",xleftharpoondown:"\u21bd",xrightleftharpoons:"\u21cc",xleftrightharpoons:"\u21cb",xtwoheadleftarrow:"\u219e",xtwoheadrightarrow:"\u21a0",xlongequal:"=",xtofrom:"\u21c4",xrightleftarrows:"\u21c4",xrightequilibrium:"\u21cc",xleftequilibrium:"\u21cb"},qe={overrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],overleftarrow:[["leftarrow"],.888,522,"xMinYMin"],underrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],underleftarrow:[["leftarrow"],.888,522,"xMinYMin"],xrightarrow:[["rightarrow"],1.469,522,"xMaxYMin"],xleftarrow:[["leftarrow"],1.469,522,"xMinYMin"],Overrightarrow:[["doublerightarrow"],.888,560,"xMaxYMin"],xRightarrow:[["doublerightarrow"],1.526,560,"xMaxYMin"],xLeftarrow:[["doubleleftarrow"],1.526,560,"xMinYMin"],overleftharpoon:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoonup:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoondown:[["leftharpoondown"],.888,522,"xMinYMin"],overrightharpoon:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoonup:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoondown:[["rightharpoondown"],.888,522,"xMaxYMin"],xlongequal:[["longequal"],.888,334,"xMinYMin"],xtwoheadleftarrow:[["twoheadleftarrow"],.888,334,"xMinYMin"],xtwoheadrightarrow:[["twoheadrightarrow"],.888,334,"xMaxYMin"],overleftrightarrow:[["leftarrow","rightarrow"],.888,522],overbrace:[["leftbrace","midbrace","rightbrace"],1.6,548],underbrace:[["leftbraceunder","midbraceunder","rightbraceunder"],1.6,548],underleftrightarrow:[["leftarrow","rightarrow"],.888,522],xleftrightarrow:[["leftarrow","rightarrow"],1.75,522],xLeftrightarrow:[["doubleleftarrow","doublerightarrow"],1.75,560],xrightleftharpoons:[["leftharpoondownplus","rightharpoonplus"],1.75,716],xleftrightharpoons:[["leftharpoonplus","rightharpoondownplus"],1.75,716],xhookleftarrow:[["leftarrow","righthook"],1.08,522],xhookrightarrow:[["lefthook","rightarrow"],1.08,522],overlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],underlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],overgroup:[["leftgroup","rightgroup"],.888,342],undergroup:[["leftgroupunder","rightgroupunder"],.888,342],xmapsto:[["leftmapsto","rightarrow"],1.5,522],xtofrom:[["leftToFrom","rightToFrom"],1.75,528],xrightleftarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],xrightequilibrium:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],xleftequilibrium:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716]},Ne=function(t){return"ordgroup"===t.type?t.body.length:1},Ie=function(t,e,r,a){var n,i=t.height+t.depth+2*r;if(/fbox|color/.test(e)){if(n=Dt.makeSpan(["stretchy",e],[],a),"fbox"===e){var o=a.color&&a.getColor();o&&(n.style.borderColor=o)}}else{var s=[];/^[bx]cancel$/.test(e)&&s.push(new P({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(e)&&s.push(new P({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var h=new L(s,{width:"100%",height:i+"em"});n=Dt.makeSvgSpan([],[h],a)}return n.height=i,n.style.height=i+"em",n},Re=function(t){var e=new ve.MathNode("mo",[new ve.TextNode(Ce[t.substr(1)])]);return e.setAttribute("stretchy","true"),e},Oe=function(t,e){var r=function(){var r=4e5,a=t.label.substr(1);if(c.contains(["widehat","widecheck","widetilde","utilde"],a)){var n,i,o,s=Ne(t.base);if(s>5)"widehat"===a||"widecheck"===a?(n=420,r=2364,o=.42,i=a+"4"):(n=312,r=2340,o=.34,i="tilde4");else{var h=[1,1,2,2,3,3][s];"widehat"===a||"widecheck"===a?(r=[0,1062,2364,2364,2364][h],n=[0,239,300,360,420][h],o=[0,.24,.3,.3,.36,.42][h],i=a+h):(r=[0,600,1033,2339,2340][h],n=[0,260,286,306,312][h],o=[0,.26,.286,.3,.306,.34][h],i="tilde"+h)}var l=new H(i),m=new L([l],{width:"100%",height:o+"em",viewBox:"0 0 "+r+" "+n,preserveAspectRatio:"none"});return{span:Dt.makeSvgSpan([],[m],e),minWidth:0,height:o}}var u,p,d=[],f=qe[a],g=f[0],x=f[1],v=f[2],b=v/1e3,y=g.length;if(1===y)u=["hide-tail"],p=[f[3]];else if(2===y)u=["halfarrow-left","halfarrow-right"],p=["xMinYMin","xMaxYMin"];else{if(3!==y)throw new Error("Correct katexImagesData or update code here to support\n "+y+" children.");u=["brace-left","brace-center","brace-right"],p=["xMinYMin","xMidYMin","xMaxYMin"]}for(var w=0;w0&&(a.style.minWidth=n+"em"),a},Ee=function(t,e){var r,a,n,i=Vt(t,"supsub");i?(r=(a=Ft(i.base,"accent")).base,i.base=r,n=function(t){if(t instanceof N)return t;throw new Error("Expected span but got "+String(t)+".")}(ue(i,e)),i.base=a):r=(a=Ft(t,"accent")).base;var o=ue(r,e.havingCrampedStyle()),s=0;if(a.isShifty&&c.isCharacterBox(r)){var h=c.getBaseElem(r);s=D(ue(h,e.havingCrampedStyle())).skew}var l,m=Math.min(o.height,e.fontMetrics().xHeight);if(a.isStretchy)l=Oe(a,e),l=Dt.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:o},{type:"elem",elem:l,wrapperClasses:["svg-align"],wrapperStyle:s>0?{width:"calc(100% - "+2*s+"em)",marginLeft:2*s+"em"}:void 0}]},e);else{var u,p;"\\vec"===a.label?(u=Dt.staticSvg("vec",e),p=Dt.svgData.vec[1]):((u=D(u=Dt.makeOrd({mode:a.mode,text:a.label},e,"textord"))).italic=0,p=u.width),l=Dt.makeSpan(["accent-body"],[u]);var d="\\textcircled"===a.label;d&&(l.classes.push("accent-full"),m=o.height);var f=s;d||(f-=p/2),l.style.left=f+"em","\\textcircled"===a.label&&(l.style.top=".2em"),l=Dt.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:o},{type:"kern",size:-m},{type:"elem",elem:l}]},e)}var g=Dt.makeSpan(["mord","accent"],[l],e);return n?(n.children[0]=g,n.height=Math.max(g.height,n.height),n.classes[0]="mord",n):g},Le=function(t,e){var r=t.isStretchy?Re(t.label):new ve.MathNode("mo",[be(t.label,t.mode)]),a=new ve.MathNode("mover",[Me(t.base,e),r]);return a.setAttribute("accent","true"),a},He=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(function(t){return"\\"+t}).join("|"));Qt({type:"accent",names:["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring","\\widecheck","\\widehat","\\widetilde","\\overrightarrow","\\overleftarrow","\\Overrightarrow","\\overleftrightarrow","\\overgroup","\\overlinesegment","\\overleftharpoon","\\overrightharpoon"],props:{numArgs:1},handler:function(t,e){var r=e[0],a=!He.test(t.funcName),n=!a||"\\widehat"===t.funcName||"\\widetilde"===t.funcName||"\\widecheck"===t.funcName;return{type:"accent",mode:t.parser.mode,label:t.funcName,isStretchy:a,isShifty:n,base:r}},htmlBuilder:Ee,mathmlBuilder:Le}),Qt({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.",'\\"',"\\r","\\H","\\v","\\textcircled"],props:{numArgs:1,allowedInText:!0,allowedInMath:!1},handler:function(t,e){var r=e[0];return{type:"accent",mode:t.parser.mode,label:t.funcName,isStretchy:!1,isShifty:!0,base:r}},htmlBuilder:Ee,mathmlBuilder:Le}),Qt({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],props:{numArgs:1},handler:function(t,e){var r=t.parser,a=t.funcName,n=e[0];return{type:"accentUnder",mode:r.mode,label:a,base:n}},htmlBuilder:function(t,e){var r=ue(t.base,e),a=Oe(t,e),n="\\utilde"===t.label?.12:0,i=Dt.makeVList({positionType:"bottom",positionData:a.height+n,children:[{type:"elem",elem:a,wrapperClasses:["svg-align"]},{type:"kern",size:n},{type:"elem",elem:r}]},e);return Dt.makeSpan(["mord","accentunder"],[i],e)},mathmlBuilder:function(t,e){var r=Re(t.label),a=new ve.MathNode("munder",[Me(t.base,e),r]);return a.setAttribute("accentunder","true"),a}});var Pe=function(t){var e=new ve.MathNode("mpadded",t?[t]:[]);return e.setAttribute("width","+0.6em"),e.setAttribute("lspace","0.3em"),e};Qt({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xrightleftharpoons","\\xleftrightharpoons","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom","\\xrightleftarrows","\\xrightequilibrium","\\xleftequilibrium"],props:{numArgs:1,numOptionalArgs:1},handler:function(t,e,r){var a=t.parser,n=t.funcName;return{type:"xArrow",mode:a.mode,label:n,body:e[0],below:r[0]}},htmlBuilder:function(t,e){var r,a=e.style,n=e.havingStyle(a.sup()),i=Dt.wrapFragment(ue(t.body,n,e),e);i.classes.push("x-arrow-pad"),t.below&&(n=e.havingStyle(a.sub()),(r=Dt.wrapFragment(ue(t.below,n,e),e)).classes.push("x-arrow-pad"));var o,s=Oe(t,e),h=-e.fontMetrics().axisHeight+.5*s.height,l=-e.fontMetrics().axisHeight-.5*s.height-.111;if((i.depth>.25||"\\xleftequilibrium"===t.label)&&(l-=i.depth),r){var m=-e.fontMetrics().axisHeight+r.height+.5*s.height+.111;o=Dt.makeVList({positionType:"individualShift",children:[{type:"elem",elem:i,shift:l},{type:"elem",elem:s,shift:h},{type:"elem",elem:r,shift:m}]},e)}else o=Dt.makeVList({positionType:"individualShift",children:[{type:"elem",elem:i,shift:l},{type:"elem",elem:s,shift:h}]},e);return o.children[0].children[0].children[1].classes.push("svg-align"),Dt.makeSpan(["mrel","x-arrow"],[o],e)},mathmlBuilder:function(t,e){var r,a=Re(t.label);if(t.body){var n=Pe(Me(t.body,e));if(t.below){var i=Pe(Me(t.below,e));r=new ve.MathNode("munderover",[a,i,n])}else r=new ve.MathNode("mover",[a,n])}else if(t.below){var o=Pe(Me(t.below,e));r=new ve.MathNode("munder",[a,o])}else r=Pe(),r=new ve.MathNode("mover",[a,r]);return r}}),Qt({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler:function(t,e){for(var r=t.parser,a=Ft(e[0],"ordgroup").body,n="",i=0;i","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"],Je=[0,1.2,1.8,2.4,3],Qe=[{type:"small",style:w.SCRIPTSCRIPT},{type:"small",style:w.SCRIPT},{type:"small",style:w.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],tr=[{type:"small",style:w.SCRIPTSCRIPT},{type:"small",style:w.SCRIPT},{type:"small",style:w.TEXT},{type:"stack"}],er=[{type:"small",style:w.SCRIPTSCRIPT},{type:"small",style:w.SCRIPT},{type:"small",style:w.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],rr=function(t){if("small"===t.type)return"Main-Regular";if("large"===t.type)return"Size"+t.size+"-Regular";if("stack"===t.type)return"Size4-Regular";throw new Error("Add support for delim type '"+t.type+"' here.")},ar=function(t,e,r,a){for(var n=Math.min(2,3-a.style.size);ne)return r[n]}return r[r.length-1]},nr=function(t,e,r,a,n,i){var o;"<"===t||"\\lt"===t||"\u27e8"===t?t="\\langle":">"!==t&&"\\gt"!==t&&"\u27e9"!==t||(t="\\rangle"),o=c.contains(Ke,t)?Qe:c.contains($e,t)?er:tr;var s=ar(t,e,o,a);return"small"===s.type?function(t,e,r,a,n,i){var o=Dt.makeSymbol(t,"Main-Regular",n,a),s=Ue(o,e,a,i);return r&&Ge(s,a,e),s}(t,s.style,r,a,n,i):"large"===s.type?Ye(t,s.size,r,a,n,i):_e(t,e,r,a,n,i)},ir=function(t,e){var r,a,n=e.havingBaseSizing(),i=ar("\\surd",t*n.sizeMultiplier,er,n),o=n.sizeMultiplier,s=Math.max(0,e.minRuleThickness-e.fontMetrics().sqrtRuleThickness),h=0,l=0,m=0;return"small"===i.type?(t<1?o=1:t<1.4&&(o=.7),l=(1+s)/o,(r=je("sqrtMain",h=(1+s+.08)/o,m=1e3+1e3*s+80,s,e)).style.minWidth="0.853em",a=.833/o):"large"===i.type?(m=1080*Je[i.size],l=(Je[i.size]+s)/o,h=(Je[i.size]+s+.08)/o,(r=je("sqrtSize"+i.size,h,m,s,e)).style.minWidth="1.02em",a=1/o):(h=t+s+.08,l=t+s,m=Math.floor(1e3*t+s)+80,(r=je("sqrtTall",h,m,s,e)).style.minWidth="0.742em",a=1.056),r.height=l,r.style.height=h+"em",{span:r,advanceWidth:a,ruleWidth:(e.fontMetrics().sqrtRuleThickness+s)*o}},or=function(t,e,r,a,n){if("<"===t||"\\lt"===t||"\u27e8"===t?t="\\langle":">"!==t&&"\\gt"!==t&&"\u27e9"!==t||(t="\\rangle"),c.contains($e,t)||c.contains(Ke,t))return Ye(t,e,!1,r,a,n);if(c.contains(Ze,t))return _e(t,Je[e],!1,r,a,n);throw new o("Illegal delimiter: '"+t+"'")},sr=nr,hr=function(t,e,r,a,n,i){var o=a.fontMetrics().axisHeight*a.sizeMultiplier,s=5/a.fontMetrics().ptPerEm,h=Math.max(e-o,r+o),l=Math.max(h/500*901,2*h-s);return nr(t,l,!0,a,n,i)},lr={"\\bigl":{mclass:"mopen",size:1},"\\Bigl":{mclass:"mopen",size:2},"\\biggl":{mclass:"mopen",size:3},"\\Biggl":{mclass:"mopen",size:4},"\\bigr":{mclass:"mclose",size:1},"\\Bigr":{mclass:"mclose",size:2},"\\biggr":{mclass:"mclose",size:3},"\\Biggr":{mclass:"mclose",size:4},"\\bigm":{mclass:"mrel",size:1},"\\Bigm":{mclass:"mrel",size:2},"\\biggm":{mclass:"mrel",size:3},"\\Biggm":{mclass:"mrel",size:4},"\\big":{mclass:"mord",size:1},"\\Big":{mclass:"mord",size:2},"\\bigg":{mclass:"mord",size:3},"\\Bigg":{mclass:"mord",size:4}},mr=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","\u230a","\u230b","\\lceil","\\rceil","\u2308","\u2309","<",">","\\langle","\u27e8","\\rangle","\u27e9","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","\u27ee","\u27ef","\\lmoustache","\\rmoustache","\u23b0","\u23b1","/","\\backslash","|","\\vert","\\|","\\Vert","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."];function cr(t,e){var r=Yt(t);if(r&&c.contains(mr,r.text))return r;throw new o("Invalid delimiter: '"+(r?r.text:JSON.stringify(t))+"' after '"+e.funcName+"'",t)}function ur(t){if(!t.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}Qt({type:"delimsizing",names:["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],props:{numArgs:1},handler:function(t,e){var r=cr(e[0],t);return{type:"delimsizing",mode:t.parser.mode,size:lr[t.funcName].size,mclass:lr[t.funcName].mclass,delim:r.text}},htmlBuilder:function(t,e){return"."===t.delim?Dt.makeSpan([t.mclass]):or(t.delim,t.size,e,t.mode,[t.mclass])},mathmlBuilder:function(t){var e=[];"."!==t.delim&&e.push(be(t.delim,t.mode));var r=new ve.MathNode("mo",e);return"mopen"===t.mclass||"mclose"===t.mclass?r.setAttribute("fence","true"):r.setAttribute("fence","false"),r}}),Qt({type:"leftright-right",names:["\\right"],props:{numArgs:1},handler:function(t,e){var r=t.parser.gullet.macros.get("\\current@color");if(r&&"string"!=typeof r)throw new o("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:t.parser.mode,delim:cr(e[0],t).text,color:r}}}),Qt({type:"leftright",names:["\\left"],props:{numArgs:1},handler:function(t,e){var r=cr(e[0],t),a=t.parser;++a.leftrightDepth;var n=a.parseExpression(!1);--a.leftrightDepth,a.expect("\\right",!1);var i=Ft(a.parseFunction(),"leftright-right");return{type:"leftright",mode:a.mode,body:n,left:r.text,right:i.delim,rightColor:i.color}},htmlBuilder:function(t,e){ur(t);for(var r,a,n=se(t.body,e,!0,["mopen","mclose"]),i=0,o=0,s=!1,h=0;h-1?"mpadded":"menclose",[Me(t.body,e)]);switch(t.label){case"\\cancel":a.setAttribute("notation","updiagonalstrike");break;case"\\bcancel":a.setAttribute("notation","downdiagonalstrike");break;case"\\sout":a.setAttribute("notation","horizontalstrike");break;case"\\fbox":a.setAttribute("notation","box");break;case"\\fcolorbox":case"\\colorbox":if(r=e.fontMetrics().fboxsep*e.fontMetrics().ptPerEm,a.setAttribute("width","+"+2*r+"pt"),a.setAttribute("height","+"+2*r+"pt"),a.setAttribute("lspace",r+"pt"),a.setAttribute("voffset",r+"pt"),"\\fcolorbox"===t.label){var n=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness);a.setAttribute("style","border: "+n+"em solid "+String(t.borderColor))}break;case"\\xcancel":a.setAttribute("notation","updiagonalstrike downdiagonalstrike")}return t.backgroundColor&&a.setAttribute("mathbackground",t.backgroundColor),a};Qt({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,greediness:3,argTypes:["color","text"]},handler:function(t,e,r){var a=t.parser,n=t.funcName,i=Ft(e[0],"color-token").color,o=e[1];return{type:"enclose",mode:a.mode,label:n,backgroundColor:i,body:o}},htmlBuilder:pr,mathmlBuilder:dr}),Qt({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,greediness:3,argTypes:["color","color","text"]},handler:function(t,e,r){var a=t.parser,n=t.funcName,i=Ft(e[0],"color-token").color,o=Ft(e[1],"color-token").color,s=e[2];return{type:"enclose",mode:a.mode,label:n,backgroundColor:o,borderColor:i,body:s}},htmlBuilder:pr,mathmlBuilder:dr}),Qt({type:"enclose",names:["\\fbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler:function(t,e){return{type:"enclose",mode:t.parser.mode,label:"\\fbox",body:e[0]}}}),Qt({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\sout"],props:{numArgs:1},handler:function(t,e,r){var a=t.parser,n=t.funcName,i=e[0];return{type:"enclose",mode:a.mode,label:n,body:i}},htmlBuilder:pr,mathmlBuilder:dr});var fr={};function gr(t){for(var e=t.type,r=t.names,a=t.props,n=t.handler,i=t.htmlBuilder,o=t.mathmlBuilder,s={type:e,numArgs:a.numArgs||0,greediness:1,allowedInText:!1,numOptionalArgs:0,handler:n},h=0;h0&&(b+=.25),l.push({pos:b,isDashed:t[e]})}for(y(i[0]),r=0;r0&&(M<(B+=v)&&(M=B),B=0),t.addJot&&(M+=f),z.height=S,z.depth=M,b+=S,z.pos=b,b+=M+B,h[r]=z,y(i[r+1])}var C,q,N=b/2+e.fontMetrics().axisHeight,I=t.cols||[],R=[];for(a=0,q=0;a=s)){var P=void 0;(a>0||t.hskipBeforeAndAfter)&&0!==(P=c.deflt(O.pregap,p))&&((C=Dt.makeSpan(["arraycolsep"],[])).style.width=P+"em",R.push(C));var D=[];for(r=0;r0){for(var G=Dt.makeLineSpan("hline",e,m),Y=Dt.makeLineSpan("hdashline",e,m),W=[{type:"elem",elem:h,shift:0}];l.length>0;){var X=l.pop(),_=X.pos-N;X.isDashed?W.push({type:"elem",elem:Y,shift:_}):W.push({type:"elem",elem:G,shift:_})}h=Dt.makeVList({positionType:"individualShift",children:W},e)}return Dt.makeSpan(["mord"],[h],e)},wr={c:"center ",l:"left ",r:"right "},kr=function(t,e){var r=new ve.MathNode("mtable",t.body.map(function(t){return new ve.MathNode("mtr",t.map(function(t){return new ve.MathNode("mtd",[Me(t,e)])}))})),a=.5===t.arraystretch?.1:.16+t.arraystretch-1+(t.addJot?.09:0);r.setAttribute("rowspacing",a+"em");var n="",i="";if(t.cols){var o=t.cols,s="",h=!1,l=0,m=o.length;"separator"===o[0].type&&(n+="top ",l=1),"separator"===o[o.length-1].type&&(n+="bottom ",m-=1);for(var c=l;c0?"left ":"",n+=g[g.length-1].length>0?"right ":"";for(var x=1;x0&&c&&(d=1),a[u]={type:"align",align:p,pregap:d,postgap:0}}return n.colSeparationType=c?"align":"alignat",n};gr({type:"array",names:["array","darray"],props:{numArgs:1},handler:function(t,e){var r={cols:(Yt(e[0])?[e[0]]:Ft(e[0],"ordgroup").body).map(function(t){var e=Gt(t).text;if(-1!=="lcr".indexOf(e))return{type:"align",align:e};if("|"===e)return{type:"separator",separator:"|"};if(":"===e)return{type:"separator",separator:":"};throw new o("Unknown column alignment: "+e,t)}),hskipBeforeAndAfter:!0};return vr(t.parser,r,br(t.envName))},htmlBuilder:yr,mathmlBuilder:kr}),gr({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix"],props:{numArgs:0},handler:function(t){var e={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[t.envName],r=vr(t.parser,{hskipBeforeAndAfter:!1},br(t.envName));return e?{type:"leftright",mode:t.mode,body:[r],left:e[0],right:e[1],rightColor:void 0}:r},htmlBuilder:yr,mathmlBuilder:kr}),gr({type:"array",names:["smallmatrix"],props:{numArgs:0},handler:function(t){var e=vr(t.parser,{arraystretch:.5},"script");return e.colSeparationType="small",e},htmlBuilder:yr,mathmlBuilder:kr}),gr({type:"array",names:["subarray"],props:{numArgs:1},handler:function(t,e){var r=(Yt(e[0])?[e[0]]:Ft(e[0],"ordgroup").body).map(function(t){var e=Gt(t).text;if(-1!=="lc".indexOf(e))return{type:"align",align:e};throw new o("Unknown column alignment: "+e,t)});if(r.length>1)throw new o("{subarray} can contain only one column");var a={cols:r,hskipBeforeAndAfter:!1,arraystretch:.5};if((a=vr(t.parser,a,"script")).body[0].length>1)throw new o("{subarray} can contain only one column");return a},htmlBuilder:yr,mathmlBuilder:kr}),gr({type:"array",names:["cases","dcases"],props:{numArgs:0},handler:function(t){var e=vr(t.parser,{arraystretch:1.2,cols:[{type:"align",align:"l",pregap:0,postgap:1},{type:"align",align:"l",pregap:0,postgap:0}]},br(t.envName));return{type:"leftright",mode:t.mode,body:[e],left:"\\{",right:".",rightColor:void 0}},htmlBuilder:yr,mathmlBuilder:kr}),gr({type:"array",names:["aligned"],props:{numArgs:0},handler:Sr,htmlBuilder:yr,mathmlBuilder:kr}),gr({type:"array",names:["gathered"],props:{numArgs:0},handler:function(t){return vr(t.parser,{cols:[{type:"align",align:"c"}],addJot:!0},"display")},htmlBuilder:yr,mathmlBuilder:kr}),gr({type:"array",names:["alignedat"],props:{numArgs:1},handler:Sr,htmlBuilder:yr,mathmlBuilder:kr}),Qt({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler:function(t,e){throw new o(t.funcName+" valid only within array environment")}});var Mr=fr;Qt({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,argTypes:["text"]},handler:function(t,e){var r=t.parser,a=t.funcName,n=e[0];if("ordgroup"!==n.type)throw new o("Invalid environment name",n);for(var i="",s=0;s=w.SCRIPT.id?r.text():w.DISPLAY:"text"===t&&r.size===w.DISPLAY.size?r=w.TEXT:"script"===t?r=w.SCRIPT:"scriptscript"===t&&(r=w.SCRIPTSCRIPT),r},Rr=function(t,e){var r,a=Ir(t.size,e.style),n=a.fracNum(),i=a.fracDen();r=e.havingStyle(n);var o=ue(t.numer,r,e);if(t.continued){var s=8.5/e.fontMetrics().ptPerEm,h=3.5/e.fontMetrics().ptPerEm;o.height=o.height0?3*c:7*c,d=e.fontMetrics().denom1):(m>0?(u=e.fontMetrics().num2,p=c):(u=e.fontMetrics().num3,p=3*c),d=e.fontMetrics().denom2),l){var y=e.fontMetrics().axisHeight;u-o.depth-(y+.5*m)0&&(e="."===(e=t)?null:e),e};Qt({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,greediness:6,argTypes:["math","math","size","text","math","math"]},handler:function(t,e){var r=t.parser,a=e[4],n=e[5],i=Vt(e[0],"atom");i&&(i=Ut(e[0],"open"));var o=i?Lr(i.text):null,s=Vt(e[1],"atom");s&&(s=Ut(e[1],"close"));var h,l=s?Lr(s.text):null,m=Ft(e[2],"size"),c=null;h=!!m.isBlank||(c=m.value).number>0;var u="auto",p=Vt(e[3],"ordgroup");if(p){if(p.body.length>0){var d=Ft(p.body[0],"textord");u=Er[Number(d.text)]}}else p=Ft(e[3],"textord"),u=Er[Number(p.text)];return{type:"genfrac",mode:r.mode,numer:a,denom:n,continued:!1,hasBarLine:h,barSize:c,leftDelim:o,rightDelim:l,size:u}},htmlBuilder:Rr,mathmlBuilder:Or}),Qt({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler:function(t,e){var r=t.parser,a=(t.funcName,t.token);return{type:"infix",mode:r.mode,replaceWith:"\\\\abovefrac",size:Ft(e[0],"size").value,token:a}}}),Qt({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:function(t,e){var r=t.parser,a=(t.funcName,e[0]),n=function(t){if(!t)throw new Error("Expected non-null, but got "+String(t));return t}(Ft(e[1],"infix").size),i=e[2],o=n.number>0;return{type:"genfrac",mode:r.mode,numer:a,denom:i,continued:!1,hasBarLine:o,barSize:n,leftDelim:null,rightDelim:null,size:"auto"}},htmlBuilder:Rr,mathmlBuilder:Or});var Hr=function(t,e){var r,a,n=e.style,i=Vt(t,"supsub");i?(r=i.sup?ue(i.sup,e.havingStyle(n.sup()),e):ue(i.sub,e.havingStyle(n.sub()),e),a=Ft(i.base,"horizBrace")):a=Ft(t,"horizBrace");var o,s=ue(a.base,e.havingBaseStyle(w.DISPLAY)),h=Oe(a,e);if(a.isOver?(o=Dt.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:s},{type:"kern",size:.1},{type:"elem",elem:h}]},e)).children[0].children[0].children[1].classes.push("svg-align"):(o=Dt.makeVList({positionType:"bottom",positionData:s.depth+.1+h.height,children:[{type:"elem",elem:h},{type:"kern",size:.1},{type:"elem",elem:s}]},e)).children[0].children[0].children[0].classes.push("svg-align"),r){var l=Dt.makeSpan(["mord",a.isOver?"mover":"munder"],[o],e);o=a.isOver?Dt.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:l},{type:"kern",size:.2},{type:"elem",elem:r}]},e):Dt.makeVList({positionType:"bottom",positionData:l.depth+.2+r.height+r.depth,children:[{type:"elem",elem:r},{type:"kern",size:.2},{type:"elem",elem:l}]},e)}return Dt.makeSpan(["mord",a.isOver?"mover":"munder"],[o],e)};Qt({type:"horizBrace",names:["\\overbrace","\\underbrace"],props:{numArgs:1},handler:function(t,e){var r=t.parser,a=t.funcName;return{type:"horizBrace",mode:r.mode,label:a,isOver:/^\\over/.test(a),base:e[0]}},htmlBuilder:Hr,mathmlBuilder:function(t,e){var r=Re(t.label);return new ve.MathNode(t.isOver?"mover":"munder",[Me(t.base,e),r])}}),Qt({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:function(t,e){var r=t.parser,a=e[1],n=Ft(e[0],"url").url;return r.settings.isTrusted({command:"\\href",url:n})?{type:"href",mode:r.mode,href:n,body:ee(a)}:r.formatUnsupportedCmd("\\href")},htmlBuilder:function(t,e){var r=se(t.body,e,!1);return Dt.makeAnchor(t.href,[],r,e)},mathmlBuilder:function(t,e){var r=Se(t.body,e);return r instanceof ge||(r=new ge("mrow",[r])),r.setAttribute("href",t.href),r}}),Qt({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:function(t,e){var r=t.parser,a=Ft(e[0],"url").url;if(!r.settings.isTrusted({command:"\\url",url:a}))return r.formatUnsupportedCmd("\\url");for(var n=[],i=0;i0&&(a=Tt(t.totalheight,e)-r,a=Number(a.toFixed(2)));var n=0;t.width.number>0&&(n=Tt(t.width,e));var i={height:r+a+"em"};n>0&&(i.width=n+"em"),a>0&&(i.verticalAlign=-a+"em");var o=new R(t.src,t.alt,i);return o.height=r,o.depth=a,o},mathmlBuilder:function(t,e){var r=new ve.MathNode("mglyph",[]);r.setAttribute("alt",t.alt);var a=Tt(t.height,e),n=0;if(t.totalheight.number>0&&(n=(n=Tt(t.totalheight,e)-a).toFixed(2),r.setAttribute("valign","-"+n+"em")),r.setAttribute("height",a+n+"em"),t.width.number>0){var i=Tt(t.width,e);r.setAttribute("width",i+"em")}return r.setAttribute("src",t.src),r}}),Qt({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],allowedInText:!0},handler:function(t,e){var r=t.parser,a=t.funcName,n=Ft(e[0],"size");if(r.settings.strict){var i="m"===a[1],o="mu"===n.value.unit;i?(o||r.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+a+" supports only mu units, not "+n.value.unit+" units"),"math"!==r.mode&&r.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+a+" works only in math mode")):o&&r.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+a+" doesn't support mu units")}return{type:"kern",mode:r.mode,dimension:n.value}},htmlBuilder:function(t,e){return Dt.makeGlue(t.dimension,e)},mathmlBuilder:function(t,e){var r=Tt(t.dimension,e);return new ve.SpaceNode(r)}}),Qt({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],props:{numArgs:1,allowedInText:!0},handler:function(t,e){var r=t.parser,a=t.funcName,n=e[0];return{type:"lap",mode:r.mode,alignment:a.slice(5),body:n}},htmlBuilder:function(t,e){var r;"clap"===t.alignment?(r=Dt.makeSpan([],[ue(t.body,e)]),r=Dt.makeSpan(["inner"],[r],e)):r=Dt.makeSpan(["inner"],[ue(t.body,e)]);var a=Dt.makeSpan(["fix"],[]),n=Dt.makeSpan([t.alignment],[r,a],e),i=Dt.makeSpan(["strut"]);return i.style.height=n.height+n.depth+"em",i.style.verticalAlign=-n.depth+"em",n.children.unshift(i),n=Dt.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:n}]},e),Dt.makeSpan(["mord"],[n],e)},mathmlBuilder:function(t,e){var r=new ve.MathNode("mpadded",[Me(t.body,e)]);if("rlap"!==t.alignment){var a="llap"===t.alignment?"-1":"-0.5";r.setAttribute("lspace",a+"width")}return r.setAttribute("width","0px"),r}}),Qt({type:"styling",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler:function(t,e){var r=t.funcName,a=t.parser,n=a.mode;a.switchMode("math");var i="\\("===r?"\\)":"$",o=a.parseExpression(!1,i);return a.expect(i),a.switchMode(n),{type:"styling",mode:a.mode,style:"text",body:o}}}),Qt({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler:function(t,e){throw new o("Mismatched "+t.funcName)}});var Dr=function(t,e){switch(e.style.size){case w.DISPLAY.size:return t.display;case w.TEXT.size:return t.text;case w.SCRIPT.size:return t.script;case w.SCRIPTSCRIPT.size:return t.scriptscript;default:return t.text}};Qt({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4},handler:function(t,e){return{type:"mathchoice",mode:t.parser.mode,display:ee(e[0]),text:ee(e[1]),script:ee(e[2]),scriptscript:ee(e[3])}},htmlBuilder:function(t,e){var r=Dr(t,e),a=se(r,e,!1);return Dt.makeFragment(a)},mathmlBuilder:function(t,e){var r=Dr(t,e);return Se(r,e)}});var Fr=function(t,e,r,a,n,i,o){var s,h,l;if(t=Dt.makeSpan([],[t]),e){var m=ue(e,a.havingStyle(n.sup()),a);h={elem:m,kern:Math.max(a.fontMetrics().bigOpSpacing1,a.fontMetrics().bigOpSpacing3-m.depth)}}if(r){var c=ue(r,a.havingStyle(n.sub()),a);s={elem:c,kern:Math.max(a.fontMetrics().bigOpSpacing2,a.fontMetrics().bigOpSpacing4-c.height)}}if(h&&s){var u=a.fontMetrics().bigOpSpacing5+s.elem.height+s.elem.depth+s.kern+t.depth+o;l=Dt.makeVList({positionType:"bottom",positionData:u,children:[{type:"kern",size:a.fontMetrics().bigOpSpacing5},{type:"elem",elem:s.elem,marginLeft:-i+"em"},{type:"kern",size:s.kern},{type:"elem",elem:t},{type:"kern",size:h.kern},{type:"elem",elem:h.elem,marginLeft:i+"em"},{type:"kern",size:a.fontMetrics().bigOpSpacing5}]},a)}else if(s){var p=t.height-o;l=Dt.makeVList({positionType:"top",positionData:p,children:[{type:"kern",size:a.fontMetrics().bigOpSpacing5},{type:"elem",elem:s.elem,marginLeft:-i+"em"},{type:"kern",size:s.kern},{type:"elem",elem:t}]},a)}else{if(!h)return t;var d=t.depth+o;l=Dt.makeVList({positionType:"bottom",positionData:d,children:[{type:"elem",elem:t},{type:"kern",size:h.kern},{type:"elem",elem:h.elem,marginLeft:i+"em"},{type:"kern",size:a.fontMetrics().bigOpSpacing5}]},a)}return Dt.makeSpan(["mop","op-limits"],[l],a)},Vr=["\\smallint"],Ur=function(t,e){var r,a,n,i=!1,o=Vt(t,"supsub");o?(r=o.sup,a=o.sub,n=Ft(o.base,"op"),i=!0):n=Ft(t,"op");var s,h=e.style,l=!1;if(h.size===w.DISPLAY.size&&n.symbol&&!c.contains(Vr,n.name)&&(l=!0),n.symbol){var m=l?"Size2-Regular":"Size1-Regular",u="";if("\\oiint"!==n.name&&"\\oiiint"!==n.name||(u=n.name.substr(1),n.name="oiint"===u?"\\iint":"\\iiint"),s=Dt.makeSymbol(n.name,m,"math",e,["mop","op-symbol",l?"large-op":"small-op"]),u.length>0){var p=s.italic,d=Dt.staticSvg(u+"Size"+(l?"2":"1"),e);s=Dt.makeVList({positionType:"individualShift",children:[{type:"elem",elem:s,shift:0},{type:"elem",elem:d,shift:l?.08:0}]},e),n.name="\\"+u,s.classes.unshift("mop"),s.italic=p}}else if(n.body){var f=se(n.body,e,!0);1===f.length&&f[0]instanceof E?(s=f[0]).classes[0]="mop":s=Dt.makeSpan(["mop"],Dt.tryCombineChars(f),e)}else{for(var g=[],x=1;x0){for(var h=n.body.map(function(t){var e=t.text;return"string"==typeof e?{type:"textord",mode:t.mode,text:e}:t}),l=se(h,e.withFont("mathrm"),!0),m=0;m=0?s.setAttribute("height","+"+n+"em"):(s.setAttribute("height",n+"em"),s.setAttribute("depth","+"+-n+"em")),s.setAttribute("voffset",n+"em"),s}});var jr=["\\tiny","\\sixptsize","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"];Qt({type:"sizing",names:jr,props:{numArgs:0,allowedInText:!0},handler:function(t,e){var r=t.breakOnTokenText,a=t.funcName,n=t.parser,i=n.parseExpression(!1,r);return{type:"sizing",mode:n.mode,size:jr.indexOf(a)+1,body:i}},htmlBuilder:function(t,e){var r=e.havingSize(t.size);return _r(t.body,r,e)},mathmlBuilder:function(t,e){var r=e.havingSize(t.size),a=ke(t.body,r),n=new ve.MathNode("mstyle",a);return n.setAttribute("mathsize",r.sizeMultiplier+"em"),n}}),Qt({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:function(t,e,r){var a=t.parser,n=!1,i=!1,o=r[0]&&Ft(r[0],"ordgroup");if(o)for(var s="",h=0;hr.height+r.depth+i&&(i=(i+c-r.height-r.depth)/2);var u=h.height-r.height-i-l;r.style.paddingLeft=m+"em";var p=Dt.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:r,wrapperClasses:["svg-align"]},{type:"kern",size:-(r.height+u)},{type:"elem",elem:h},{type:"kern",size:l}]},e);if(t.index){var d=e.havingStyle(w.SCRIPTSCRIPT),f=ue(t.index,d,e),g=.6*(p.height-p.depth),x=Dt.makeVList({positionType:"shift",positionData:-g,children:[{type:"elem",elem:f}]},e),v=Dt.makeSpan(["root"],[x]);return Dt.makeSpan(["mord","sqrt"],[v,p],e)}return Dt.makeSpan(["mord","sqrt"],[p],e)},mathmlBuilder:function(t,e){var r=t.body,a=t.index;return a?new ve.MathNode("mroot",[Me(r,e),Me(a,e)]):new ve.MathNode("msqrt",[Me(r,e)])}});var $r={display:w.DISPLAY,text:w.TEXT,script:w.SCRIPT,scriptscript:w.SCRIPTSCRIPT};Qt({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0},handler:function(t,e){var r=t.breakOnTokenText,a=t.funcName,n=t.parser,i=n.parseExpression(!0,r),o=a.slice(1,a.length-5);return{type:"styling",mode:n.mode,style:o,body:i}},htmlBuilder:function(t,e){var r=$r[t.style],a=e.havingStyle(r).withFont("");return _r(t.body,a,e)},mathmlBuilder:function(t,e){var r=$r[t.style],a=e.havingStyle(r),n=ke(t.body,a),i=new ve.MathNode("mstyle",n),o={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]}[t.style];return i.setAttribute("scriptlevel",o[0]),i.setAttribute("displaystyle",o[1]),i}});te({type:"supsub",htmlBuilder:function(t,e){var r=function(t,e){var r=t.base;return r?"op"===r.type?r.limits&&(e.style.size===w.DISPLAY.size||r.alwaysHandleSupSub)?Ur:null:"operatorname"===r.type?r.alwaysHandleSupSub&&(e.style.size===w.DISPLAY.size||r.limits)?Xr:null:"accent"===r.type?c.isCharacterBox(r.base)?Ee:null:"horizBrace"===r.type&&!t.sub===r.isOver?Hr:null:null}(t,e);if(r)return r(t,e);var a,n,i,o=t.base,s=t.sup,h=t.sub,l=ue(o,e),m=e.fontMetrics(),u=0,p=0,d=o&&c.isCharacterBox(o);if(s){var f=e.havingStyle(e.style.sup());a=ue(s,f,e),d||(u=l.height-f.fontMetrics().supDrop*f.sizeMultiplier/e.sizeMultiplier)}if(h){var g=e.havingStyle(e.style.sub());n=ue(h,g,e),d||(p=l.depth+g.fontMetrics().subDrop*g.sizeMultiplier/e.sizeMultiplier)}i=e.style===w.DISPLAY?m.sup1:e.style.cramped?m.sup3:m.sup2;var x,v=e.sizeMultiplier,b=.5/m.ptPerEm/v+"em",y=null;if(n){var k=t.base&&"op"===t.base.type&&t.base.name&&("\\oiint"===t.base.name||"\\oiiint"===t.base.name);(l instanceof E||k)&&(y=-l.italic+"em")}if(a&&n){u=Math.max(u,i,a.depth+.25*m.xHeight),p=Math.max(p,m.sub2);var S=4*m.defaultRuleThickness;if(u-a.depth-(n.height-p)0&&(u+=M,p-=M)}var z=[{type:"elem",elem:n,shift:p,marginRight:b,marginLeft:y},{type:"elem",elem:a,shift:-u,marginRight:b}];x=Dt.makeVList({positionType:"individualShift",children:z},e)}else if(n){p=Math.max(p,m.sub1,n.height-.8*m.xHeight);var A=[{type:"elem",elem:n,marginLeft:y,marginRight:b}];x=Dt.makeVList({positionType:"shift",positionData:p,children:A},e)}else{if(!a)throw new Error("supsub must have either sup or sub.");u=Math.max(u,i,a.depth+.25*m.xHeight),x=Dt.makeVList({positionType:"shift",positionData:-u,children:[{type:"elem",elem:a,marginRight:b}]},e)}var T=me(l,"right")||"mord";return Dt.makeSpan([T],[l,Dt.makeSpan(["msupsub"],[x])],e)},mathmlBuilder:function(t,e){var r,a=!1,n=Vt(t.base,"horizBrace");n&&!!t.sup===n.isOver&&(a=!0,r=n.isOver),!t.base||"op"!==t.base.type&&"operatorname"!==t.base.type||(t.base.parentIsSupSub=!0);var i,o=[Me(t.base,e)];if(t.sub&&o.push(Me(t.sub,e)),t.sup&&o.push(Me(t.sup,e)),a)i=r?"mover":"munder";else if(t.sub)if(t.sup){var s=t.base;i=s&&"op"===s.type&&s.limits&&e.style===w.DISPLAY?"munderover":s&&"operatorname"===s.type&&s.alwaysHandleSupSub&&(e.style===w.DISPLAY||s.limits)?"munderover":"msubsup"}else{var h=t.base;i=h&&"op"===h.type&&h.limits&&(e.style===w.DISPLAY||h.alwaysHandleSupSub)?"munder":h&&"operatorname"===h.type&&h.alwaysHandleSupSub&&(h.limits||e.style===w.DISPLAY)?"munder":"msub"}else{var l=t.base;i=l&&"op"===l.type&&l.limits&&(e.style===w.DISPLAY||l.alwaysHandleSupSub)?"mover":l&&"operatorname"===l.type&&l.alwaysHandleSupSub&&(l.limits||e.style===w.DISPLAY)?"mover":"msup"}return new ve.MathNode(i,o)}}),te({type:"atom",htmlBuilder:function(t,e){return Dt.mathsym(t.text,t.mode,e,["m"+t.family])},mathmlBuilder:function(t,e){var r=new ve.MathNode("mo",[be(t.text,t.mode)]);if("bin"===t.family){var a=we(t,e);"bold-italic"===a&&r.setAttribute("mathvariant",a)}else"punct"===t.family?r.setAttribute("separator","true"):"open"!==t.family&&"close"!==t.family||r.setAttribute("stretchy","false");return r}});var Zr={mi:"italic",mn:"normal",mtext:"normal"};te({type:"mathord",htmlBuilder:function(t,e){return Dt.makeOrd(t,e,"mathord")},mathmlBuilder:function(t,e){var r=new ve.MathNode("mi",[be(t.text,t.mode,e)]),a=we(t,e)||"italic";return a!==Zr[r.type]&&r.setAttribute("mathvariant",a),r}}),te({type:"textord",htmlBuilder:function(t,e){return Dt.makeOrd(t,e,"textord")},mathmlBuilder:function(t,e){var r,a=be(t.text,t.mode,e),n=we(t,e)||"normal";return r="text"===t.mode?new ve.MathNode("mtext",[a]):/[0-9]/.test(t.text)?new ve.MathNode("mn",[a]):"\\prime"===t.text?new ve.MathNode("mo",[a]):new ve.MathNode("mi",[a]),n!==Zr[r.type]&&r.setAttribute("mathvariant",n),r}});var Kr={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},Jr={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};te({type:"spacing",htmlBuilder:function(t,e){if(Jr.hasOwnProperty(t.text)){var r=Jr[t.text].className||"";if("text"===t.mode){var a=Dt.makeOrd(t,e,"textord");return a.classes.push(r),a}return Dt.makeSpan(["mspace",r],[Dt.mathsym(t.text,t.mode,e)],e)}if(Kr.hasOwnProperty(t.text))return Dt.makeSpan(["mspace",Kr[t.text]],[],e);throw new o('Unknown type of space "'+t.text+'"')},mathmlBuilder:function(t,e){if(!Jr.hasOwnProperty(t.text)){if(Kr.hasOwnProperty(t.text))return new ve.MathNode("mspace");throw new o('Unknown type of space "'+t.text+'"')}return new ve.MathNode("mtext",[new ve.TextNode("\xa0")])}});var Qr=function(){var t=new ve.MathNode("mtd",[]);return t.setAttribute("width","50%"),t};te({type:"tag",mathmlBuilder:function(t,e){var r=new ve.MathNode("mtable",[new ve.MathNode("mtr",[Qr(),new ve.MathNode("mtd",[Se(t.body,e)]),Qr(),new ve.MathNode("mtd",[Se(t.tag,e)])])]);return r.setAttribute("width","100%"),r}});var ta={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},ea={"\\textbf":"textbf","\\textmd":"textmd"},ra={"\\textit":"textit","\\textup":"textup"},aa=function(t,e){var r=t.font;return r?ta[r]?e.withTextFontFamily(ta[r]):ea[r]?e.withTextFontWeight(ea[r]):e.withTextFontShape(ra[r]):e};Qt({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textbf","\\textmd","\\textit","\\textup"],props:{numArgs:1,argTypes:["text"],greediness:2,allowedInText:!0},handler:function(t,e){var r=t.parser,a=t.funcName,n=e[0];return{type:"text",mode:r.mode,body:ee(n),font:a}},htmlBuilder:function(t,e){var r=aa(t,e),a=se(t.body,r,!0);return Dt.makeSpan(["mord","text"],Dt.tryCombineChars(a),r)},mathmlBuilder:function(t,e){var r=aa(t,e);return Se(t.body,r)}}),Qt({type:"underline",names:["\\underline"],props:{numArgs:1,allowedInText:!0},handler:function(t,e){return{type:"underline",mode:t.parser.mode,body:e[0]}},htmlBuilder:function(t,e){var r=ue(t.body,e),a=Dt.makeLineSpan("underline-line",e),n=e.fontMetrics().defaultRuleThickness,i=Dt.makeVList({positionType:"top",positionData:r.height,children:[{type:"kern",size:n},{type:"elem",elem:a},{type:"kern",size:3*n},{type:"elem",elem:r}]},e);return Dt.makeSpan(["mord","underline"],[i],e)},mathmlBuilder:function(t,e){var r=new ve.MathNode("mo",[new ve.TextNode("\u203e")]);r.setAttribute("stretchy","true");var a=new ve.MathNode("munder",[Me(t.body,e),r]);return a.setAttribute("accentunder","true"),a}}),Qt({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler:function(t,e,r){throw new o("\\verb ended by end of line instead of matching delimiter")},htmlBuilder:function(t,e){for(var r=na(t),a=[],n=e.havingStyle(e.style.text()),i=0;i0&&(this.undefStack[this.undefStack.length-1][t]=e)}else{var n=this.undefStack[this.undefStack.length-1];n&&!n.hasOwnProperty(t)&&(n[t]=this.current[t])}this.current[t]=e},t}(),ca={},ua=ca;function pa(t,e){ca[t]=e}pa("\\@firstoftwo",function(t){return{tokens:t.consumeArgs(2)[0],numArgs:0}}),pa("\\@secondoftwo",function(t){return{tokens:t.consumeArgs(2)[1],numArgs:0}}),pa("\\@ifnextchar",function(t){var e=t.consumeArgs(3),r=t.future();return 1===e[0].length&&e[0][0].text===r.text?{tokens:e[1],numArgs:0}:{tokens:e[2],numArgs:0}}),pa("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}"),pa("\\TextOrMath",function(t){var e=t.consumeArgs(2);return"text"===t.mode?{tokens:e[0],numArgs:0}:{tokens:e[1],numArgs:0}});var da={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};pa("\\char",function(t){var e,r=t.popToken(),a="";if("'"===r.text)e=8,r=t.popToken();else if('"'===r.text)e=16,r=t.popToken();else if("`"===r.text)if("\\"===(r=t.popToken()).text[0])a=r.text.charCodeAt(1);else{if("EOF"===r.text)throw new o("\\char` missing argument");a=r.text.charCodeAt(0)}else e=10;if(e){if(null==(a=da[r.text])||a>=e)throw new o("Invalid base-"+e+" digit "+r.text);for(var n;null!=(n=da[t.future().text])&&n":"\\dotsb","-":"\\dotsb","*":"\\dotsb",":":"\\dotsb","\\DOTSB":"\\dotsb","\\coprod":"\\dotsb","\\bigvee":"\\dotsb","\\bigwedge":"\\dotsb","\\biguplus":"\\dotsb","\\bigcap":"\\dotsb","\\bigcup":"\\dotsb","\\prod":"\\dotsb","\\sum":"\\dotsb","\\bigotimes":"\\dotsb","\\bigoplus":"\\dotsb","\\bigodot":"\\dotsb","\\bigsqcup":"\\dotsb","\\And":"\\dotsb","\\longrightarrow":"\\dotsb","\\Longrightarrow":"\\dotsb","\\longleftarrow":"\\dotsb","\\Longleftarrow":"\\dotsb","\\longleftrightarrow":"\\dotsb","\\Longleftrightarrow":"\\dotsb","\\mapsto":"\\dotsb","\\longmapsto":"\\dotsb","\\hookrightarrow":"\\dotsb","\\doteq":"\\dotsb","\\mathbin":"\\dotsb","\\mathrel":"\\dotsb","\\relbar":"\\dotsb","\\Relbar":"\\dotsb","\\xrightarrow":"\\dotsb","\\xleftarrow":"\\dotsb","\\DOTSI":"\\dotsi","\\int":"\\dotsi","\\oint":"\\dotsi","\\iint":"\\dotsi","\\iiint":"\\dotsi","\\iiiint":"\\dotsi","\\idotsint":"\\dotsi","\\DOTSX":"\\dotsx"};pa("\\dots",function(t){var e="\\dotso",r=t.expandAfterFuture().text;return r in xa?e=xa[r]:"\\not"===r.substr(0,4)?e="\\dotsb":r in j.math&&c.contains(["bin","rel"],j.math[r].group)&&(e="\\dotsb"),e});var va={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};pa("\\dotso",function(t){return t.future().text in va?"\\ldots\\,":"\\ldots"}),pa("\\dotsc",function(t){var e=t.future().text;return e in va&&","!==e?"\\ldots\\,":"\\ldots"}),pa("\\cdots",function(t){return t.future().text in va?"\\@cdots\\,":"\\@cdots"}),pa("\\dotsb","\\cdots"),pa("\\dotsm","\\cdots"),pa("\\dotsi","\\!\\cdots"),pa("\\dotsx","\\ldots\\,"),pa("\\DOTSI","\\relax"),pa("\\DOTSB","\\relax"),pa("\\DOTSX","\\relax"),pa("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax"),pa("\\,","\\tmspace+{3mu}{.1667em}"),pa("\\thinspace","\\,"),pa("\\>","\\mskip{4mu}"),pa("\\:","\\tmspace+{4mu}{.2222em}"),pa("\\medspace","\\:"),pa("\\;","\\tmspace+{5mu}{.2777em}"),pa("\\thickspace","\\;"),pa("\\!","\\tmspace-{3mu}{.1667em}"),pa("\\negthinspace","\\!"),pa("\\negmedspace","\\tmspace-{4mu}{.2222em}"),pa("\\negthickspace","\\tmspace-{5mu}{.277em}"),pa("\\enspace","\\kern.5em "),pa("\\enskip","\\hskip.5em\\relax"),pa("\\quad","\\hskip1em\\relax"),pa("\\qquad","\\hskip2em\\relax"),pa("\\tag","\\@ifstar\\tag@literal\\tag@paren"),pa("\\tag@paren","\\tag@literal{({#1})}"),pa("\\tag@literal",function(t){if(t.macros.get("\\df@tag"))throw new o("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"}),pa("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}"),pa("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)"),pa("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}"),pa("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1"),pa("\\pmb","\\html@mathml{\\@binrel{#1}{\\mathrlap{#1}\\kern0.5px#1}}{\\mathbf{#1}}"),pa("\\\\","\\newline"),pa("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var ba=F["Main-Regular"]["T".charCodeAt(0)][1]-.7*F["Main-Regular"]["A".charCodeAt(0)][1]+"em";pa("\\LaTeX","\\textrm{\\html@mathml{L\\kern-.36em\\raisebox{"+ba+"}{\\scriptstyle A}\\kern-.15em\\TeX}{LaTeX}}"),pa("\\KaTeX","\\textrm{\\html@mathml{K\\kern-.17em\\raisebox{"+ba+"}{\\scriptstyle A}\\kern-.15em\\TeX}{KaTeX}}"),pa("\\hspace","\\@ifstar\\@hspacer\\@hspace"),pa("\\@hspace","\\hskip #1\\relax"),pa("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax"),pa("\\ordinarycolon",":"),pa("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}"),pa("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}'),pa("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}'),pa("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}'),pa("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}'),pa("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}'),pa("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}'),pa("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}'),pa("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}'),pa("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}'),pa("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}'),pa("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}'),pa("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}'),pa("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}'),pa("\u2237","\\dblcolon"),pa("\u2239","\\eqcolon"),pa("\u2254","\\coloneqq"),pa("\u2255","\\eqqcolon"),pa("\u2a74","\\Coloneqq"),pa("\\ratio","\\vcentcolon"),pa("\\coloncolon","\\dblcolon"),pa("\\colonequals","\\coloneqq"),pa("\\coloncolonequals","\\Coloneqq"),pa("\\equalscolon","\\eqqcolon"),pa("\\equalscoloncolon","\\Eqqcolon"),pa("\\colonminus","\\coloneq"),pa("\\coloncolonminus","\\Coloneq"),pa("\\minuscolon","\\eqcolon"),pa("\\minuscoloncolon","\\Eqcolon"),pa("\\coloncolonapprox","\\Colonapprox"),pa("\\coloncolonsim","\\Colonsim"),pa("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}"),pa("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}"),pa("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}"),pa("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}"),pa("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`\u220c}}"),pa("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}"),pa("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}"),pa("\\gvertneqq","\\html@mathml{\\@gvertneqq}{\u2269}"),pa("\\lvertneqq","\\html@mathml{\\@lvertneqq}{\u2268}"),pa("\\ngeqq","\\html@mathml{\\@ngeqq}{\u2271}"),pa("\\ngeqslant","\\html@mathml{\\@ngeqslant}{\u2271}"),pa("\\nleqq","\\html@mathml{\\@nleqq}{\u2270}"),pa("\\nleqslant","\\html@mathml{\\@nleqslant}{\u2270}"),pa("\\nshortmid","\\html@mathml{\\@nshortmid}{\u2224}"),pa("\\nshortparallel","\\html@mathml{\\@nshortparallel}{\u2226}"),pa("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{\u2288}"),pa("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{\u2289}"),pa("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{\u228a}"),pa("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{\u2acb}"),pa("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{\u228b}"),pa("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{\u2acc}"),pa("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`\u27e6}}"),pa("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`\u27e7}}"),pa("\u27e6","\\llbracket"),pa("\u27e7","\\rrbracket"),pa("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`\u2983}}"),pa("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`\u2984}}"),pa("\u2983","\\lBrace"),pa("\u2984","\\rBrace"),pa("\\darr","\\downarrow"),pa("\\dArr","\\Downarrow"),pa("\\Darr","\\Downarrow"),pa("\\lang","\\langle"),pa("\\rang","\\rangle"),pa("\\uarr","\\uparrow"),pa("\\uArr","\\Uparrow"),pa("\\Uarr","\\Uparrow"),pa("\\N","\\mathbb{N}"),pa("\\R","\\mathbb{R}"),pa("\\Z","\\mathbb{Z}"),pa("\\alef","\\aleph"),pa("\\alefsym","\\aleph"),pa("\\Alpha","\\mathrm{A}"),pa("\\Beta","\\mathrm{B}"),pa("\\bull","\\bullet"),pa("\\Chi","\\mathrm{X}"),pa("\\clubs","\\clubsuit"),pa("\\cnums","\\mathbb{C}"),pa("\\Complex","\\mathbb{C}"),pa("\\Dagger","\\ddagger"),pa("\\diamonds","\\diamondsuit"),pa("\\empty","\\emptyset"),pa("\\Epsilon","\\mathrm{E}"),pa("\\Eta","\\mathrm{H}"),pa("\\exist","\\exists"),pa("\\harr","\\leftrightarrow"),pa("\\hArr","\\Leftrightarrow"),pa("\\Harr","\\Leftrightarrow"),pa("\\hearts","\\heartsuit"),pa("\\image","\\Im"),pa("\\infin","\\infty"),pa("\\Iota","\\mathrm{I}"),pa("\\isin","\\in"),pa("\\Kappa","\\mathrm{K}"),pa("\\larr","\\leftarrow"),pa("\\lArr","\\Leftarrow"),pa("\\Larr","\\Leftarrow"),pa("\\lrarr","\\leftrightarrow"),pa("\\lrArr","\\Leftrightarrow"),pa("\\Lrarr","\\Leftrightarrow"),pa("\\Mu","\\mathrm{M}"),pa("\\natnums","\\mathbb{N}"),pa("\\Nu","\\mathrm{N}"),pa("\\Omicron","\\mathrm{O}"),pa("\\plusmn","\\pm"),pa("\\rarr","\\rightarrow"),pa("\\rArr","\\Rightarrow"),pa("\\Rarr","\\Rightarrow"),pa("\\real","\\Re"),pa("\\reals","\\mathbb{R}"),pa("\\Reals","\\mathbb{R}"),pa("\\Rho","\\mathrm{P}"),pa("\\sdot","\\cdot"),pa("\\sect","\\S"),pa("\\spades","\\spadesuit"),pa("\\sub","\\subset"),pa("\\sube","\\subseteq"),pa("\\supe","\\supseteq"),pa("\\Tau","\\mathrm{T}"),pa("\\thetasym","\\vartheta"),pa("\\weierp","\\wp"),pa("\\Zeta","\\mathrm{Z}"),pa("\\argmin","\\DOTSB\\operatorname*{arg\\,min}"),pa("\\argmax","\\DOTSB\\operatorname*{arg\\,max}"),pa("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits"),pa("\\blue","\\textcolor{##6495ed}{#1}"),pa("\\orange","\\textcolor{##ffa500}{#1}"),pa("\\pink","\\textcolor{##ff00af}{#1}"),pa("\\red","\\textcolor{##df0030}{#1}"),pa("\\green","\\textcolor{##28ae7b}{#1}"),pa("\\gray","\\textcolor{gray}{#1}"),pa("\\purple","\\textcolor{##9d38bd}{#1}"),pa("\\blueA","\\textcolor{##ccfaff}{#1}"),pa("\\blueB","\\textcolor{##80f6ff}{#1}"),pa("\\blueC","\\textcolor{##63d9ea}{#1}"),pa("\\blueD","\\textcolor{##11accd}{#1}"),pa("\\blueE","\\textcolor{##0c7f99}{#1}"),pa("\\tealA","\\textcolor{##94fff5}{#1}"),pa("\\tealB","\\textcolor{##26edd5}{#1}"),pa("\\tealC","\\textcolor{##01d1c1}{#1}"),pa("\\tealD","\\textcolor{##01a995}{#1}"),pa("\\tealE","\\textcolor{##208170}{#1}"),pa("\\greenA","\\textcolor{##b6ffb0}{#1}"),pa("\\greenB","\\textcolor{##8af281}{#1}"),pa("\\greenC","\\textcolor{##74cf70}{#1}"),pa("\\greenD","\\textcolor{##1fab54}{#1}"),pa("\\greenE","\\textcolor{##0d923f}{#1}"),pa("\\goldA","\\textcolor{##ffd0a9}{#1}"),pa("\\goldB","\\textcolor{##ffbb71}{#1}"),pa("\\goldC","\\textcolor{##ff9c39}{#1}"),pa("\\goldD","\\textcolor{##e07d10}{#1}"),pa("\\goldE","\\textcolor{##a75a05}{#1}"),pa("\\redA","\\textcolor{##fca9a9}{#1}"),pa("\\redB","\\textcolor{##ff8482}{#1}"),pa("\\redC","\\textcolor{##f9685d}{#1}"),pa("\\redD","\\textcolor{##e84d39}{#1}"),pa("\\redE","\\textcolor{##bc2612}{#1}"),pa("\\maroonA","\\textcolor{##ffbde0}{#1}"),pa("\\maroonB","\\textcolor{##ff92c6}{#1}"),pa("\\maroonC","\\textcolor{##ed5fa6}{#1}"),pa("\\maroonD","\\textcolor{##ca337c}{#1}"),pa("\\maroonE","\\textcolor{##9e034e}{#1}"),pa("\\purpleA","\\textcolor{##ddd7ff}{#1}"),pa("\\purpleB","\\textcolor{##c6b9fc}{#1}"),pa("\\purpleC","\\textcolor{##aa87ff}{#1}"),pa("\\purpleD","\\textcolor{##7854ab}{#1}"),pa("\\purpleE","\\textcolor{##543b78}{#1}"),pa("\\mintA","\\textcolor{##f5f9e8}{#1}"),pa("\\mintB","\\textcolor{##edf2df}{#1}"),pa("\\mintC","\\textcolor{##e0e5cc}{#1}"),pa("\\grayA","\\textcolor{##f6f7f7}{#1}"),pa("\\grayB","\\textcolor{##f0f1f2}{#1}"),pa("\\grayC","\\textcolor{##e3e5e6}{#1}"),pa("\\grayD","\\textcolor{##d6d8da}{#1}"),pa("\\grayE","\\textcolor{##babec2}{#1}"),pa("\\grayF","\\textcolor{##888d93}{#1}"),pa("\\grayG","\\textcolor{##626569}{#1}"),pa("\\grayH","\\textcolor{##3b3e40}{#1}"),pa("\\grayI","\\textcolor{##21242c}{#1}"),pa("\\kaBlue","\\textcolor{##314453}{#1}"),pa("\\kaGreen","\\textcolor{##71B307}{#1}");var ya={"\\relax":!0,"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0},wa=function(){function t(t,e,r){this.settings=void 0,this.expansionCount=void 0,this.lexer=void 0,this.macros=void 0,this.stack=void 0,this.mode=void 0,this.settings=e,this.expansionCount=0,this.feed(t),this.macros=new ma(ua,e.macros),this.mode=r,this.stack=[]}var e=t.prototype;return e.feed=function(t){this.lexer=new la(t,this.settings)},e.switchMode=function(t){this.mode=t},e.beginGroup=function(){this.macros.beginGroup()},e.endGroup=function(){this.macros.endGroup()},e.future=function(){return 0===this.stack.length&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]},e.popToken=function(){return this.future(),this.stack.pop()},e.pushToken=function(t){this.stack.push(t)},e.pushTokens=function(t){var e;(e=this.stack).push.apply(e,t)},e.consumeSpaces=function(){for(;;){if(" "!==this.future().text)break;this.stack.pop()}},e.consumeArgs=function(t){for(var e=[],r=0;rthis.settings.maxExpand)throw new o("Too many expansions: infinite loop or need to increase maxExpand setting");var a=r.tokens;if(r.numArgs)for(var n=this.consumeArgs(r.numArgs),i=(a=a.slice()).length-1;i>=0;--i){var s=a[i];if("#"===s.text){if(0===i)throw new o("Incomplete placeholder at end of macro body",s);if("#"===(s=a[--i]).text)a.splice(i+1,1);else{if(!/^[1-9]$/.test(s.text))throw new o("Not a valid argument number",s);var h;(h=a).splice.apply(h,[i,2].concat(n[+s.text-1]))}}}return this.pushTokens(a),a},e.expandAfterFuture=function(){return this.expandOnce(),this.future()},e.expandNextToken=function(){for(;;){var t=this.expandOnce();if(t instanceof n){if("\\relax"!==t.text)return this.stack.pop();this.stack.pop()}}throw new Error},e.expandMacro=function(t){if(this.macros.get(t)){var e=[],r=this.stack.length;for(this.pushToken(new n(t));this.stack.length>r;){this.expandOnce()instanceof n&&e.push(this.stack.pop())}return e}},e.expandMacroAsText=function(t){var e=this.expandMacro(t);return e?e.map(function(t){return t.text}).join(""):e},e._getExpansion=function(t){var e=this.macros.get(t);if(null==e)return e;var r="function"==typeof e?e(this):e;if("string"==typeof r){var a=0;if(-1!==r.indexOf("#"))for(var n=r.replace(/##/g,"");-1!==n.indexOf("#"+(a+1));)++a;for(var i=new la(r,this.settings),o=[],s=i.lex();"EOF"!==s.text;)o.push(s),s=i.lex();return o.reverse(),{tokens:o,numArgs:a}}return r},e.isDefined=function(t){return this.macros.has(t)||ia.hasOwnProperty(t)||j.math.hasOwnProperty(t)||j.text.hasOwnProperty(t)||ya.hasOwnProperty(t)},t}(),ka={"\u0301":{text:"\\'",math:"\\acute"},"\u0300":{text:"\\`",math:"\\grave"},"\u0308":{text:'\\"',math:"\\ddot"},"\u0303":{text:"\\~",math:"\\tilde"},"\u0304":{text:"\\=",math:"\\bar"},"\u0306":{text:"\\u",math:"\\breve"},"\u030c":{text:"\\v",math:"\\check"},"\u0302":{text:"\\^",math:"\\hat"},"\u0307":{text:"\\.",math:"\\dot"},"\u030a":{text:"\\r",math:"\\mathring"},"\u030b":{text:"\\H"}},Sa={"\xe1":"a\u0301","\xe0":"a\u0300","\xe4":"a\u0308","\u01df":"a\u0308\u0304","\xe3":"a\u0303","\u0101":"a\u0304","\u0103":"a\u0306","\u1eaf":"a\u0306\u0301","\u1eb1":"a\u0306\u0300","\u1eb5":"a\u0306\u0303","\u01ce":"a\u030c","\xe2":"a\u0302","\u1ea5":"a\u0302\u0301","\u1ea7":"a\u0302\u0300","\u1eab":"a\u0302\u0303","\u0227":"a\u0307","\u01e1":"a\u0307\u0304","\xe5":"a\u030a","\u01fb":"a\u030a\u0301","\u1e03":"b\u0307","\u0107":"c\u0301","\u010d":"c\u030c","\u0109":"c\u0302","\u010b":"c\u0307","\u010f":"d\u030c","\u1e0b":"d\u0307","\xe9":"e\u0301","\xe8":"e\u0300","\xeb":"e\u0308","\u1ebd":"e\u0303","\u0113":"e\u0304","\u1e17":"e\u0304\u0301","\u1e15":"e\u0304\u0300","\u0115":"e\u0306","\u011b":"e\u030c","\xea":"e\u0302","\u1ebf":"e\u0302\u0301","\u1ec1":"e\u0302\u0300","\u1ec5":"e\u0302\u0303","\u0117":"e\u0307","\u1e1f":"f\u0307","\u01f5":"g\u0301","\u1e21":"g\u0304","\u011f":"g\u0306","\u01e7":"g\u030c","\u011d":"g\u0302","\u0121":"g\u0307","\u1e27":"h\u0308","\u021f":"h\u030c","\u0125":"h\u0302","\u1e23":"h\u0307","\xed":"i\u0301","\xec":"i\u0300","\xef":"i\u0308","\u1e2f":"i\u0308\u0301","\u0129":"i\u0303","\u012b":"i\u0304","\u012d":"i\u0306","\u01d0":"i\u030c","\xee":"i\u0302","\u01f0":"j\u030c","\u0135":"j\u0302","\u1e31":"k\u0301","\u01e9":"k\u030c","\u013a":"l\u0301","\u013e":"l\u030c","\u1e3f":"m\u0301","\u1e41":"m\u0307","\u0144":"n\u0301","\u01f9":"n\u0300","\xf1":"n\u0303","\u0148":"n\u030c","\u1e45":"n\u0307","\xf3":"o\u0301","\xf2":"o\u0300","\xf6":"o\u0308","\u022b":"o\u0308\u0304","\xf5":"o\u0303","\u1e4d":"o\u0303\u0301","\u1e4f":"o\u0303\u0308","\u022d":"o\u0303\u0304","\u014d":"o\u0304","\u1e53":"o\u0304\u0301","\u1e51":"o\u0304\u0300","\u014f":"o\u0306","\u01d2":"o\u030c","\xf4":"o\u0302","\u1ed1":"o\u0302\u0301","\u1ed3":"o\u0302\u0300","\u1ed7":"o\u0302\u0303","\u022f":"o\u0307","\u0231":"o\u0307\u0304","\u0151":"o\u030b","\u1e55":"p\u0301","\u1e57":"p\u0307","\u0155":"r\u0301","\u0159":"r\u030c","\u1e59":"r\u0307","\u015b":"s\u0301","\u1e65":"s\u0301\u0307","\u0161":"s\u030c","\u1e67":"s\u030c\u0307","\u015d":"s\u0302","\u1e61":"s\u0307","\u1e97":"t\u0308","\u0165":"t\u030c","\u1e6b":"t\u0307","\xfa":"u\u0301","\xf9":"u\u0300","\xfc":"u\u0308","\u01d8":"u\u0308\u0301","\u01dc":"u\u0308\u0300","\u01d6":"u\u0308\u0304","\u01da":"u\u0308\u030c","\u0169":"u\u0303","\u1e79":"u\u0303\u0301","\u016b":"u\u0304","\u1e7b":"u\u0304\u0308","\u016d":"u\u0306","\u01d4":"u\u030c","\xfb":"u\u0302","\u016f":"u\u030a","\u0171":"u\u030b","\u1e7d":"v\u0303","\u1e83":"w\u0301","\u1e81":"w\u0300","\u1e85":"w\u0308","\u0175":"w\u0302","\u1e87":"w\u0307","\u1e98":"w\u030a","\u1e8d":"x\u0308","\u1e8b":"x\u0307","\xfd":"y\u0301","\u1ef3":"y\u0300","\xff":"y\u0308","\u1ef9":"y\u0303","\u0233":"y\u0304","\u0177":"y\u0302","\u1e8f":"y\u0307","\u1e99":"y\u030a","\u017a":"z\u0301","\u017e":"z\u030c","\u1e91":"z\u0302","\u017c":"z\u0307","\xc1":"A\u0301","\xc0":"A\u0300","\xc4":"A\u0308","\u01de":"A\u0308\u0304","\xc3":"A\u0303","\u0100":"A\u0304","\u0102":"A\u0306","\u1eae":"A\u0306\u0301","\u1eb0":"A\u0306\u0300","\u1eb4":"A\u0306\u0303","\u01cd":"A\u030c","\xc2":"A\u0302","\u1ea4":"A\u0302\u0301","\u1ea6":"A\u0302\u0300","\u1eaa":"A\u0302\u0303","\u0226":"A\u0307","\u01e0":"A\u0307\u0304","\xc5":"A\u030a","\u01fa":"A\u030a\u0301","\u1e02":"B\u0307","\u0106":"C\u0301","\u010c":"C\u030c","\u0108":"C\u0302","\u010a":"C\u0307","\u010e":"D\u030c","\u1e0a":"D\u0307","\xc9":"E\u0301","\xc8":"E\u0300","\xcb":"E\u0308","\u1ebc":"E\u0303","\u0112":"E\u0304","\u1e16":"E\u0304\u0301","\u1e14":"E\u0304\u0300","\u0114":"E\u0306","\u011a":"E\u030c","\xca":"E\u0302","\u1ebe":"E\u0302\u0301","\u1ec0":"E\u0302\u0300","\u1ec4":"E\u0302\u0303","\u0116":"E\u0307","\u1e1e":"F\u0307","\u01f4":"G\u0301","\u1e20":"G\u0304","\u011e":"G\u0306","\u01e6":"G\u030c","\u011c":"G\u0302","\u0120":"G\u0307","\u1e26":"H\u0308","\u021e":"H\u030c","\u0124":"H\u0302","\u1e22":"H\u0307","\xcd":"I\u0301","\xcc":"I\u0300","\xcf":"I\u0308","\u1e2e":"I\u0308\u0301","\u0128":"I\u0303","\u012a":"I\u0304","\u012c":"I\u0306","\u01cf":"I\u030c","\xce":"I\u0302","\u0130":"I\u0307","\u0134":"J\u0302","\u1e30":"K\u0301","\u01e8":"K\u030c","\u0139":"L\u0301","\u013d":"L\u030c","\u1e3e":"M\u0301","\u1e40":"M\u0307","\u0143":"N\u0301","\u01f8":"N\u0300","\xd1":"N\u0303","\u0147":"N\u030c","\u1e44":"N\u0307","\xd3":"O\u0301","\xd2":"O\u0300","\xd6":"O\u0308","\u022a":"O\u0308\u0304","\xd5":"O\u0303","\u1e4c":"O\u0303\u0301","\u1e4e":"O\u0303\u0308","\u022c":"O\u0303\u0304","\u014c":"O\u0304","\u1e52":"O\u0304\u0301","\u1e50":"O\u0304\u0300","\u014e":"O\u0306","\u01d1":"O\u030c","\xd4":"O\u0302","\u1ed0":"O\u0302\u0301","\u1ed2":"O\u0302\u0300","\u1ed6":"O\u0302\u0303","\u022e":"O\u0307","\u0230":"O\u0307\u0304","\u0150":"O\u030b","\u1e54":"P\u0301","\u1e56":"P\u0307","\u0154":"R\u0301","\u0158":"R\u030c","\u1e58":"R\u0307","\u015a":"S\u0301","\u1e64":"S\u0301\u0307","\u0160":"S\u030c","\u1e66":"S\u030c\u0307","\u015c":"S\u0302","\u1e60":"S\u0307","\u0164":"T\u030c","\u1e6a":"T\u0307","\xda":"U\u0301","\xd9":"U\u0300","\xdc":"U\u0308","\u01d7":"U\u0308\u0301","\u01db":"U\u0308\u0300","\u01d5":"U\u0308\u0304","\u01d9":"U\u0308\u030c","\u0168":"U\u0303","\u1e78":"U\u0303\u0301","\u016a":"U\u0304","\u1e7a":"U\u0304\u0308","\u016c":"U\u0306","\u01d3":"U\u030c","\xdb":"U\u0302","\u016e":"U\u030a","\u0170":"U\u030b","\u1e7c":"V\u0303","\u1e82":"W\u0301","\u1e80":"W\u0300","\u1e84":"W\u0308","\u0174":"W\u0302","\u1e86":"W\u0307","\u1e8c":"X\u0308","\u1e8a":"X\u0307","\xdd":"Y\u0301","\u1ef2":"Y\u0300","\u0178":"Y\u0308","\u1ef8":"Y\u0303","\u0232":"Y\u0304","\u0176":"Y\u0302","\u1e8e":"Y\u0307","\u0179":"Z\u0301","\u017d":"Z\u030c","\u1e90":"Z\u0302","\u017b":"Z\u0307","\u03ac":"\u03b1\u0301","\u1f70":"\u03b1\u0300","\u1fb1":"\u03b1\u0304","\u1fb0":"\u03b1\u0306","\u03ad":"\u03b5\u0301","\u1f72":"\u03b5\u0300","\u03ae":"\u03b7\u0301","\u1f74":"\u03b7\u0300","\u03af":"\u03b9\u0301","\u1f76":"\u03b9\u0300","\u03ca":"\u03b9\u0308","\u0390":"\u03b9\u0308\u0301","\u1fd2":"\u03b9\u0308\u0300","\u1fd1":"\u03b9\u0304","\u1fd0":"\u03b9\u0306","\u03cc":"\u03bf\u0301","\u1f78":"\u03bf\u0300","\u03cd":"\u03c5\u0301","\u1f7a":"\u03c5\u0300","\u03cb":"\u03c5\u0308","\u03b0":"\u03c5\u0308\u0301","\u1fe2":"\u03c5\u0308\u0300","\u1fe1":"\u03c5\u0304","\u1fe0":"\u03c5\u0306","\u03ce":"\u03c9\u0301","\u1f7c":"\u03c9\u0300","\u038e":"\u03a5\u0301","\u1fea":"\u03a5\u0300","\u03ab":"\u03a5\u0308","\u1fe9":"\u03a5\u0304","\u1fe8":"\u03a5\u0306","\u038f":"\u03a9\u0301","\u1ffa":"\u03a9\u0300"},Ma=function(){function t(t,e){this.mode=void 0,this.gullet=void 0,this.settings=void 0,this.leftrightDepth=void 0,this.nextToken=void 0,this.mode="math",this.gullet=new wa(t,e,this.mode),this.settings=e,this.leftrightDepth=0}var e=t.prototype;return e.expect=function(t,e){if(void 0===e&&(e=!0),this.fetch().text!==t)throw new o("Expected '"+t+"', got '"+this.fetch().text+"'",this.fetch());e&&this.consume()},e.consume=function(){this.nextToken=null},e.fetch=function(){return null==this.nextToken&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken},e.switchMode=function(t){this.mode=t,this.gullet.switchMode(t)},e.parse=function(){this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");var t=this.parseExpression(!1);return this.expect("EOF"),this.gullet.endGroup(),t},e.parseExpression=function(e,r){for(var a=[];;){"math"===this.mode&&this.consumeSpaces();var n=this.fetch();if(-1!==t.endOfExpression.indexOf(n.text))break;if(r&&n.text===r)break;if(e&&ia[n.text]&&ia[n.text].infix)break;var i=this.parseAtom(r);if(!i)break;a.push(i)}return"text"===this.mode&&this.formLigatures(a),this.handleInfixNodes(a)},e.handleInfixNodes=function(t){for(var e,r=-1,a=0;a0&&!l||0===s&&!l&&"math"===this.mode,c=this.parseGroupOfType("argument to '"+t+"'",h,l,a,m);if(!c){if(l){i.push(null);continue}throw new o("Expected group after '"+t+"'",this.fetch())}(l?i:n).push(c)}return{args:n,optArgs:i}},e.parseGroupOfType=function(t,e,r,a,n){switch(e){case"color":return n&&this.consumeSpaces(),this.parseColorGroup(r);case"size":return n&&this.consumeSpaces(),this.parseSizeGroup(r);case"url":return this.parseUrlGroup(r,n);case"math":case"text":return this.parseGroup(t,r,a,void 0,e,n);case"hbox":var i=this.parseGroup(t,r,a,void 0,"text",n);return i?{type:"styling",mode:i.mode,body:[i],style:"text"}:i;case"raw":if(n&&this.consumeSpaces(),r&&"{"===this.fetch().text)return null;var s=this.parseStringGroup("raw",r,!0);if(s)return{type:"raw",mode:"text",string:s.text};throw new o("Expected raw group",this.fetch());case"original":case null:case void 0:return this.parseGroup(t,r,a,void 0,void 0,n);default:throw new o("Unknown group type as "+t,this.fetch())}},e.consumeSpaces=function(){for(;" "===this.fetch().text;)this.consume()},e.parseStringGroup=function(t,e,r){var a=e?"[":"{",n=e?"]":"}",i=this.fetch();if(i.text!==a){if(e)return null;if(r&&"EOF"!==i.text&&/[^{}[\]]/.test(i.text))return this.consume(),i}var s=this.mode;this.mode="text",this.expect(a);for(var h,l="",m=this.fetch(),c=0,u=m;(h=this.fetch()).text!==n||r&&c>0;){switch(h.text){case"EOF":throw new o("Unexpected end of input in "+t,m.range(u,l));case a:c++;break;case n:c--}l+=(u=h).text,this.consume()}return this.expect(n),this.mode=s,m.range(u,l)},e.parseRegexGroup=function(t,e){var r=this.mode;this.mode="text";for(var a,n=this.fetch(),i=n,s="";"EOF"!==(a=this.fetch()).text&&t.test(s+a.text);)s+=(i=a).text,this.consume();if(""===s)throw new o("Invalid "+e+": '"+n.text+"'",n);return this.mode=r,n.range(i,s)},e.parseColorGroup=function(t){var e=this.parseStringGroup("color",t);if(!e)return null;var r=/^(#[a-f0-9]{3}|#?[a-f0-9]{6}|[a-z]+)$/i.exec(e.text);if(!r)throw new o("Invalid color: '"+e.text+"'",e);var a=r[0];return/^[0-9a-f]{6}$/i.test(a)&&(a="#"+a),{type:"color-token",mode:this.mode,color:a}},e.parseSizeGroup=function(t){var e,r=!1;if(!(e=t||"{"===this.fetch().text?this.parseStringGroup("size",t):this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/,"size")))return null;t||0!==e.text.length||(e.text="0pt",r=!0);var a=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(e.text);if(!a)throw new o("Invalid size: '"+e.text+"'",e);var n={number:+(a[1]+a[2]),unit:a[3]};if(!At(n))throw new o("Invalid unit: '"+n.unit+"'",e);return{type:"size",mode:this.mode,value:n,isBlank:r}},e.parseUrlGroup=function(t,e){this.gullet.lexer.setCatcode("%",13);var r=this.parseStringGroup("url",t,!0);if(this.gullet.lexer.setCatcode("%",14),!r)return null;var a=r.text.replace(/\\([#$%&~_^{}])/g,"$1");return{type:"url",mode:this.mode,url:a}},e.parseGroup=function(e,r,n,i,s,h){var l=this.mode;s&&this.switchMode(s),h&&this.consumeSpaces();var m,c=this.fetch(),u=c.text;if(r?"["===u:"{"===u||"\\begingroup"===u){this.consume();var p=t.endOfGroup[u];this.gullet.beginGroup();var d=this.parseExpression(!1,p),f=this.fetch();this.expect(p),this.gullet.endGroup(),m={type:"ordgroup",mode:this.mode,loc:a.range(c,f),body:d,semisimple:"\\begingroup"===u||void 0}}else if(r)m=null;else if(null==(m=this.parseFunction(i,e,n)||this.parseSymbol())&&"\\"===u[0]&&!ya.hasOwnProperty(u)){if(this.settings.throwOnError)throw new o("Undefined control sequence: "+u,c);m=this.formatUnsupportedCmd(u),this.consume()}return s&&this.switchMode(l),m},e.formLigatures=function(t){for(var e=t.length-1,r=0;r=0&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+e[0]+'" used in math mode',t);var h,l=j[this.mode][e].group,m=a.range(t);if(W.hasOwnProperty(l)){var c=l;h={type:"atom",mode:this.mode,family:c,loc:m,text:e}}else h={type:l,mode:this.mode,loc:m,text:e};i=h}else{if(!(e.charCodeAt(0)>=128))return null;this.settings.strict&&(M(e.charCodeAt(0))?"math"===this.mode&&this.settings.reportNonstrict("unicodeTextInMathMode",'Unicode text character "'+e[0]+'" used in math mode',t):this.settings.reportNonstrict("unknownSymbol",'Unrecognized Unicode character "'+e[0]+'" ('+e.charCodeAt(0)+")",t)),i={type:"textord",mode:"text",loc:a.range(t),text:e}}if(this.consume(),s)for(var u=0;uwn in jr?Nst(jr,wn,{enumerable:!0,configurable:!0,writable:!0,value:fn}):jr[wn]=fn;var vl=(jr,wn,fn)=>(Bst(jr,typeof wn!="symbol"?wn+"":wn,fn),fn);var jr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function wn(t){var e=t.default;if(typeof e=="function"){var r=function(){return e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}),r}function fn(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var b_={exports:{}};(function(t,e){(function(r,n){t.exports=n()})(jr,function(){var r;function n(){return r.apply(null,arguments)}function i(g){return g instanceof Array||Object.prototype.toString.call(g)==="[object Array]"}function a(g){return g!=null&&Object.prototype.toString.call(g)==="[object Object]"}function s(g,E){return Object.prototype.hasOwnProperty.call(g,E)}function o(g){if(Object.getOwnPropertyNames)return Object.getOwnPropertyNames(g).length===0;for(var E in g)if(s(g,E))return;return 1}function l(g){return g===void 0}function u(g){return typeof g=="number"||Object.prototype.toString.call(g)==="[object Number]"}function h(g){return g instanceof Date||Object.prototype.toString.call(g)==="[object Date]"}function d(g,E){for(var I=[],O=g.length,G=0;G>>0,O=0;Oue(g)?(ht=g+1,xt-ue(g)):(ht=g,xt);return{year:ht,dayOfYear:Mt}}function Ke(g,E,I){var O,G,ht=Ie(g.year(),E,I),ht=Math.floor((g.dayOfYear()-ht-1)/7)+1;return ht<1?O=ht+wr(G=g.year()-1,E,I):ht>wr(g.year(),E,I)?(O=ht-wr(g.year(),E,I),G=g.year()+1):(G=g.year(),O=ht),{week:O,year:G}}function wr(g,G,I){var O=Ie(g,G,I),G=Ie(g+1,G,I);return(ue(g)-O+G)/7}Y("w",["ww",2],"wo","week"),Y("W",["WW",2],"Wo","isoWeek"),W("week","w"),W("isoWeek","W"),Z("week",5),Z("isoWeek",5),ft("w",at),ft("ww",at,fe),ft("W",at),ft("WW",at,fe),we(["w","ww","W","WW"],function(g,E,I,O){E[O.substr(0,1)]=q(g)});function je(g,E){return g.slice(E,7).concat(g.slice(0,E))}Y("d",0,"do","day"),Y("dd",0,0,function(g){return this.localeData().weekdaysMin(this,g)}),Y("ddd",0,0,function(g){return this.localeData().weekdaysShort(this,g)}),Y("dddd",0,0,function(g){return this.localeData().weekdays(this,g)}),Y("e",0,0,"weekday"),Y("E",0,0,"isoWeekday"),W("day","d"),W("weekday","e"),W("isoWeekday","E"),Z("day",11),Z("weekday",11),Z("isoWeekday",11),ft("d",at),ft("e",at),ft("E",at),ft("dd",function(g,E){return E.weekdaysMinRegex(g)}),ft("ddd",function(g,E){return E.weekdaysShortRegex(g)}),ft("dddd",function(g,E){return E.weekdaysRegex(g)}),we(["dd","ddd","dddd"],function(g,E,I,O){O=I._locale.weekdaysParse(g,O,I._strict),O!=null?E.d=O:m(I).invalidWeekday=g}),we(["d","e","E"],function(g,E,I,O){E[O]=q(g)});var Ze="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),qt="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),st="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),At=Tt,Nt=Tt,Jt=Tt;function ze(){function g(Ot,de){return de.length-Ot.length}for(var E,I,O,G=[],ht=[],xt=[],Mt=[],Vt=0;Vt<7;Vt++)O=p([2e3,1]).day(Vt),E=Dt(this.weekdaysMin(O,"")),I=Dt(this.weekdaysShort(O,"")),O=Dt(this.weekdays(O,"")),G.push(E),ht.push(I),xt.push(O),Mt.push(E),Mt.push(I),Mt.push(O);G.sort(g),ht.sort(g),xt.sort(g),Mt.sort(g),this._weekdaysRegex=new RegExp("^("+Mt.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+xt.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+ht.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+G.join("|")+")","i")}function Pe(){return this.hours()%12||12}function qe(g,E){Y(g,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),E)})}function Tr(g,E){return E._meridiemParse}Y("H",["HH",2],0,"hour"),Y("h",["hh",2],0,Pe),Y("k",["kk",2],0,function(){return this.hours()||24}),Y("hmm",0,0,function(){return""+Pe.apply(this)+N(this.minutes(),2)}),Y("hmmss",0,0,function(){return""+Pe.apply(this)+N(this.minutes(),2)+N(this.seconds(),2)}),Y("Hmm",0,0,function(){return""+this.hours()+N(this.minutes(),2)}),Y("Hmmss",0,0,function(){return""+this.hours()+N(this.minutes(),2)+N(this.seconds(),2)}),qe("a",!0),qe("A",!1),W("hour","h"),Z("hour",13),ft("a",Tr),ft("A",Tr),ft("H",at),ft("h",at),ft("k",at),ft("HH",at,fe),ft("hh",at,fe),ft("kk",at,fe),ft("hmm",It),ft("hmmss",Lt),ft("Hmm",It),ft("Hmmss",Lt),Qt(["H","HH"],bt),Qt(["k","kk"],function(g,E,I){g=q(g),E[bt]=g===24?0:g}),Qt(["a","A"],function(g,E,I){I._isPm=I._locale.isPM(g),I._meridiem=g}),Qt(["h","hh"],function(g,E,I){E[bt]=q(g),m(I).bigHour=!0}),Qt("hmm",function(g,E,I){var O=g.length-2;E[bt]=q(g.substr(0,O)),E[Et]=q(g.substr(O)),m(I).bigHour=!0}),Qt("hmmss",function(g,E,I){var O=g.length-4,G=g.length-2;E[bt]=q(g.substr(0,O)),E[Et]=q(g.substr(O,2)),E[kt]=q(g.substr(G)),m(I).bigHour=!0}),Qt("Hmm",function(g,E,I){var O=g.length-2;E[bt]=q(g.substr(0,O)),E[Et]=q(g.substr(O))}),Qt("Hmmss",function(g,E,I){var O=g.length-4,G=g.length-2;E[bt]=q(g.substr(0,O)),E[Et]=q(g.substr(O,2)),E[kt]=q(g.substr(G))}),Tt=U("Hours",!0);var Ve,va={calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},longDateFormat:{LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},invalidDate:"Invalid date",ordinal:"%d",dayOfMonthOrdinalParse:/\d{1,2}/,relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},months:ne,monthsShort:ve,week:{dow:0,doy:6},weekdays:Ze,weekdaysMin:st,weekdaysShort:qt,meridiemParse:/[ap]\.?m?\.?/i},Ce={},Wi={};function E0(g){return g&&g.toLowerCase().replace("_","-")}function bu(g){for(var E,I,O,G,ht=0;ht=E&&function(xt,Mt){for(var Vt=Math.min(xt.length,Mt.length),Ot=0;Ot=E-1)break;E--}ht++}return Ve}function Ln(g){var E;if(Ce[g]===void 0&&!0&&t&&t.exports&&g.match("^[^/\\\\]*$")!=null)try{E=Ve._abbr,fn("./locale/"+g),Xt(E)}catch{Ce[g]=null}return Ce[g]}function Xt(g,E){return g&&((E=l(E)?ce(g):ee(g,E))?Ve=E:typeof console<"u"&&console.warn&&console.warn("Locale "+g+" not found. Did you forget to load it?")),Ve._abbr}function ee(g,E){if(E===null)return delete Ce[g],null;var I,O=va;if(E.abbr=g,Ce[g]!=null)L("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),O=Ce[g]._config;else if(E.parentLocale!=null)if(Ce[E.parentLocale]!=null)O=Ce[E.parentLocale]._config;else{if((I=Ln(E.parentLocale))==null)return Wi[E.parentLocale]||(Wi[E.parentLocale]=[]),Wi[E.parentLocale].push({name:g,config:E}),null;O=I._config}return Ce[g]=new w(B(O,E)),Wi[g]&&Wi[g].forEach(function(G){ee(G.name,G.config)}),Xt(g),Ce[g]}function ce(g){var E;if(!(g=g&&g._locale&&g._locale._abbr?g._locale._abbr:g))return Ve;if(!i(g)){if(E=Ln(g))return E;g=[g]}return bu(g)}function Pt(g){var E=g._a;return E&&m(g).overflow===-2&&(E=E[zt]<0||11yt(E[Ft],E[zt])?wt:E[bt]<0||24wr(ht,Vt,Ot)?m(O)._overflowWeeks=!0:de!=null?m(O)._overflowWeekday=!0:(ie=oe(ht,xt,Mt,Vt,Ot),O._a[Ft]=ie.year,O._dayOfYear=ie.dayOfYear)),g._dayOfYear!=null&&(G=Gi(g._a[Ft],I[Ft]),(g._dayOfYear>ue(G)||g._dayOfYear===0)&&(m(g)._overflowDayOfYear=!0),de=Hr(G,0,g._dayOfYear),g._a[zt]=de.getUTCMonth(),g._a[wt]=de.getUTCDate()),E=0;E<3&&g._a[E]==null;++E)g._a[E]=er[E]=I[E];for(;E<7;E++)g._a[E]=er[E]=g._a[E]==null?E===2?1:0:g._a[E];g._a[bt]===24&&g._a[Et]===0&&g._a[kt]===0&&g._a[Ut]===0&&(g._nextDay=!0,g._a[bt]=0),g._d=(g._useUTC?Hr:_a).apply(null,er),ht=g._useUTC?g._d.getUTCDay():g._d.getDay(),g._tzm!=null&&g._d.setUTCMinutes(g._d.getUTCMinutes()-g._tzm),g._nextDay&&(g._a[bt]=24),g._w&&g._w.d!==void 0&&g._w.d!==ht&&(m(g).weekdayMismatch=!0)}}function _u(g){if(g._f===n.ISO_8601)A0(g);else if(g._f===n.RFC_2822)Hi(g);else{g._a=[],m(g).empty=!0;for(var E,I,O,G,ht,xt=""+g._i,Mt=xt.length,Vt=0,Ot=lt(g._f,g._locale).match(z)||[],de=Ot.length,ie=0;ieg.valueOf():g.valueOf()"}),P.toJSON=function(){return this.isValid()?this.toISOString():null},P.toString=function(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},P.unix=function(){return Math.floor(this.valueOf()/1e3)},P.valueOf=function(){return this._d.valueOf()-6e4*(this._offset||0)},P.creationData=function(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}},P.eraName=function(){for(var g,E=this.localeData().eras(),I=0,O=E.length;Ithis.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()},P.isLocal=function(){return!!this.isValid()&&!this._isUTC},P.isUtcOffset=function(){return!!this.isValid()&&this._isUTC},P.isUtc=eR,P.isUTC=eR,P.zoneAbbr=function(){return this._isUTC?"UTC":""},P.zoneName=function(){return this._isUTC?"Coordinated Universal Time":""},P.dates=R("dates accessor is deprecated. Use date instead.",ls),P.months=R("months accessor is deprecated. Use month instead",se),P.years=R("years accessor is deprecated. Use year instead",N0),P.zone=R("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",function(g,E){return g!=null?(this.utcOffset(g=typeof g!="string"?-g:g,E),this):-this.utcOffset()}),P.isDSTShifted=R("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",function(){if(!l(this._isDSTShifted))return this._isDSTShifted;var g,E={};return T(E,this),(E=M0(E))._a?(g=(E._isUTC?p:De)(E._a),this._isDSTShifted=this.isValid()&&0{},debug:(...t)=>{},info:(...t)=>{},warn:(...t)=>{},error:(...t)=>{},fatal:(...t)=>{}},D0=function(t="fatal"){let e=ji.fatal;typeof t=="string"?(t=t.toLowerCase(),t in ji&&(e=ji[t])):typeof t=="number"&&(e=t),H.trace=()=>{},H.debug=()=>{},H.info=()=>{},H.warn=()=>{},H.error=()=>{},H.fatal=()=>{},e<=ji.fatal&&(H.fatal=console.error?console.error.bind(console,Nn("FATAL"),"color: orange"):console.log.bind(console,"\x1B[35m",Nn("FATAL"))),e<=ji.error&&(H.error=console.error?console.error.bind(console,Nn("ERROR"),"color: orange"):console.log.bind(console,"\x1B[31m",Nn("ERROR"))),e<=ji.warn&&(H.warn=console.warn?console.warn.bind(console,Nn("WARN"),"color: orange"):console.log.bind(console,"\x1B[33m",Nn("WARN"))),e<=ji.info&&(H.info=console.info?console.info.bind(console,Nn("INFO"),"color: lightblue"):console.log.bind(console,"\x1B[34m",Nn("INFO"))),e<=ji.debug&&(H.debug=console.debug?console.debug.bind(console,Nn("DEBUG"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",Nn("DEBUG"))),e<=ji.trace&&(H.trace=console.debug?console.debug.bind(console,Nn("TRACE"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",Nn("TRACE")))},Nn=t=>`%c${Xn().format("ss.SSS")} : ${t} : `;var O0={};Object.defineProperty(O0,"__esModule",{value:!0});var ki=O0.sanitizeUrl=void 0,mR=/^([^\w]*)(javascript|data|vbscript)/im,bR=/&#(\w+)(^\w|;)?/g,_R=/[\u0000-\u001F\u007F-\u009F\u2000-\u200D\uFEFF]/gim,vR=/^([^:]+):/gm,xR=[".","/"];function kR(t){return xR.indexOf(t[0])>-1}function wR(t){return t.replace(bR,function(e,r){return String.fromCharCode(r)})}function TR(t){var e=wR(t||"").replace(_R,"").trim();if(!e)return"about:blank";if(kR(e))return e;var r=e.match(vR);if(!r)return e;var n=r[0];return mR.test(n)?"about:blank":e}ki=O0.sanitizeUrl=TR;function Qe(t,e){return t==null||e==null?NaN:te?1:t>=e?0:NaN}function __(t,e){return t==null||e==null?NaN:et?1:e>=t?0:NaN}function xu(t){let e,r,n;t.length!==2?(e=Qe,r=(o,l)=>Qe(t(o),l),n=(o,l)=>t(o)-l):(e=t===Qe||t===__?t:ER,r=t,n=t);function i(o,l,u=0,h=o.length){if(u>>1;r(o[d],l)<0?u=d+1:h=d}while(u>>1;r(o[d],l)<=0?u=d+1:h=d}while(uu&&n(o[d-1],l)>-n(o[d],l)?d-1:d}return{left:i,center:s,right:a}}function ER(){return 0}function v_(t){return t===null?NaN:+t}function*x_(t,e){if(e===void 0)for(let r of t)r!=null&&(r=+r)>=r&&(yield r);else{let r=-1;for(let n of t)(n=e(n,++r,t))!=null&&(n=+n)>=n&&(yield n)}}const k_=xu(Qe),w_=k_.right,CR=k_.left,SR=xu(v_).center,cs=w_;function AR(t,e){if(!((e=+e)>=0))throw new RangeError("invalid r");let r=t.length;if(!((r=Math.floor(r))>=0))throw new RangeError("invalid length");if(!r||!e)return t;const n=F0(e),i=t.slice();return n(t,i,0,r,1),n(i,t,0,r,1),n(t,i,0,r,1),t}const T_=E_(F0),MR=E_(LR);function E_(t){return function(e,r,n=r){if(!((r=+r)>=0))throw new RangeError("invalid rx");if(!((n=+n)>=0))throw new RangeError("invalid ry");let{data:i,width:a,height:s}=e;if(!((a=Math.floor(a))>=0))throw new RangeError("invalid width");if(!((s=Math.floor(s!==void 0?s:i.length/a))>=0))throw new RangeError("invalid height");if(!a||!s||!r&&!n)return e;const o=r&&t(r),l=n&&t(n),u=i.slice();return o&&l?(ro(o,u,i,a,s),ro(o,i,u,a,s),ro(o,u,i,a,s),no(l,i,u,a,s),no(l,u,i,a,s),no(l,i,u,a,s)):o?(ro(o,i,u,a,s),ro(o,u,i,a,s),ro(o,i,u,a,s)):l&&(no(l,i,u,a,s),no(l,u,i,a,s),no(l,i,u,a,s)),e}}function ro(t,e,r,n,i){for(let a=0,s=n*i;a{i<<=2,a<<=2,s<<=2,e(r,n,i+0,a+0,s),e(r,n,i+1,a+1,s),e(r,n,i+2,a+2,s),e(r,n,i+3,a+3,s)}}function F0(t){const e=Math.floor(t);if(e===t)return RR(t);const r=t-e,n=2*t+1;return(i,a,s,o,l)=>{if(!((o-=l)>=s))return;let u=e*a[s];const h=l*e,d=h+l;for(let f=s,p=s+h;f{if(!((a-=s)>=i))return;let o=t*n[i];const l=s*t;for(let u=i,h=i+l;u=n&&++r;else{let n=-1;for(let i of t)(i=e(i,++n,t))!=null&&(i=+i)>=i&&++r}return r}function IR(t){return t.length|0}function NR(t){return!(t>0)}function BR(t){return typeof t!="object"||"length"in t?t:Array.from(t)}function DR(t){return e=>t(...e)}function OR(...t){const e=typeof t[t.length-1]=="function"&&DR(t.pop());t=t.map(BR);const r=t.map(IR),n=t.length-1,i=new Array(n+1).fill(0),a=[];if(n<0||r.some(NR))return a;for(;;){a.push(i.map((o,l)=>t[l][o]));let s=n;for(;++i[s]===r[s];){if(s===0)return e?a.map(e):a;i[s--]=0}}}function FR(t,e){var r=0,n=0;return Float64Array.from(t,e===void 0?i=>r+=+i||0:i=>r+=+e(i,n++,t)||0)}function C_(t,e){let r=0,n,i=0,a=0;if(e===void 0)for(let s of t)s!=null&&(s=+s)>=s&&(n=s-i,i+=n/++r,a+=n*(s-i));else{let s=-1;for(let o of t)(o=e(o,++s,t))!=null&&(o=+o)>=o&&(n=o-i,i+=n/++r,a+=n*(o-i))}if(r>1)return a/(r-1)}function S_(t,e){const r=C_(t,e);return r&&Math.sqrt(r)}function xl(t,e){let r,n;if(e===void 0)for(const i of t)i!=null&&(r===void 0?i>=i&&(r=n=i):(r>i&&(r=i),n=a&&(r=n=a):(r>a&&(r=a),n0){for(s=e[--r];r>0&&(n=s,i=e[--r],s=n+i,a=i-(s-n),!a););r>0&&(a<0&&e[r-1]<0||a>0&&e[r-1]>0)&&(i=a*2,n=s+i,i==n-s&&(s=n))}return s}}function PR(t,e){const r=new _r;if(e===void 0)for(let n of t)(n=+n)&&r.add(n);else{let n=-1;for(let i of t)(i=+e(i,++n,t))&&r.add(i)}return+r}function qR(t,e){const r=new _r;let n=-1;return Float64Array.from(t,e===void 0?i=>r.add(+i||0):i=>r.add(+e(i,++n,t)||0))}class kl extends Map{constructor(e,r=L_){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),e!=null)for(const[n,i]of e)this.set(n,i)}get(e){return super.get(P0(this,e))}has(e){return super.has(P0(this,e))}set(e,r){return super.set(A_(this,e),r)}delete(e){return super.delete(M_(this,e))}}class us extends Set{constructor(e,r=L_){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),e!=null)for(const n of e)this.add(n)}has(e){return super.has(P0(this,e))}add(e){return super.add(A_(this,e))}delete(e){return super.delete(M_(this,e))}}function P0({_intern:t,_key:e},r){const n=e(r);return t.has(n)?t.get(n):r}function A_({_intern:t,_key:e},r){const n=e(r);return t.has(n)?t.get(n):(t.set(n,r),r)}function M_({_intern:t,_key:e},r){const n=e(r);return t.has(n)&&(r=t.get(n),t.delete(n)),r}function L_(t){return t!==null&&typeof t=="object"?t.valueOf():t}function io(t){return t}function R_(t,...e){return ao(t,io,io,e)}function I_(t,...e){return ao(t,Array.from,io,e)}function N_(t,e){for(let r=1,n=e.length;ri.pop().map(([a,s])=>[...i,a,s]));return t}function VR(t,...e){return N_(I_(t,...e),e)}function zR(t,e,...r){return N_(D_(t,e,...r),r)}function B_(t,e,...r){return ao(t,io,e,r)}function D_(t,e,...r){return ao(t,Array.from,e,r)}function YR(t,...e){return ao(t,io,O_,e)}function UR(t,...e){return ao(t,Array.from,O_,e)}function O_(t){if(t.length!==1)throw new Error("duplicate key");return t[0]}function ao(t,e,r,n){return function i(a,s){if(s>=n.length)return r(a);const o=new kl,l=n[s++];let u=-1;for(const h of a){const d=l(h,++u,a),f=o.get(d);f?f.push(h):o.set(d,[h])}for(const[h,d]of o)o.set(h,i(d,s));return e(o)}(t,0)}function F_(t,e){return Array.from(e,r=>t[r])}function q0(t,...e){if(typeof t[Symbol.iterator]!="function")throw new TypeError("values is not iterable");t=Array.from(t);let[r]=e;if(r&&r.length!==2||e.length>1){const n=Uint32Array.from(t,(i,a)=>a);return e.length>1?(e=e.map(i=>t.map(i)),n.sort((i,a)=>{for(const s of e){const o=so(s[i],s[a]);if(o)return o}})):(r=t.map(r),n.sort((i,a)=>so(r[i],r[a]))),F_(t,n)}return t.sort(V0(r))}function V0(t=Qe){if(t===Qe)return so;if(typeof t!="function")throw new TypeError("compare is not a function");return(e,r)=>{const n=t(e,r);return n||n===0?n:(t(r,r)===0)-(t(e,e)===0)}}function so(t,e){return(t==null||!(t>=t))-(e==null||!(e>=e))||(te?1:0)}function WR(t,e,r){return(e.length!==2?q0(B_(t,e,r),([n,i],[a,s])=>Qe(i,s)||Qe(n,a)):q0(R_(t,r),([n,i],[a,s])=>e(i,s)||Qe(n,a))).map(([n])=>n)}var HR=Array.prototype,GR=HR.slice;function wu(t){return()=>t}var z0=Math.sqrt(50),Y0=Math.sqrt(10),U0=Math.sqrt(2);function hs(t,e,r){var n,i=-1,a,s,o;if(e=+e,t=+t,r=+r,t===e&&r>0)return[t];if((n=e0){let l=Math.round(t/o),u=Math.round(e/o);for(l*oe&&--u,s=new Array(a=u-l+1);++ie&&--u,s=new Array(a=u-l+1);++i=0?(a>=z0?10:a>=Y0?5:a>=U0?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(a>=z0?10:a>=Y0?5:a>=U0?2:1)}function wl(t,e,r){var n=Math.abs(e-t)/Math.max(0,r),i=Math.pow(10,Math.floor(Math.log(n)/Math.LN10)),a=n/i;return a>=z0?i*=10:a>=Y0?i*=5:a>=U0&&(i*=2),e0?(t=Math.floor(t/i)*i,e=Math.ceil(e/i)*i):i<0&&(t=Math.ceil(t*i)/i,e=Math.floor(e*i)/i),n=i}}function W0(t){return Math.ceil(Math.log(ku(t))/Math.LN2)+1}function q_(){var t=io,e=xl,r=W0;function n(i){Array.isArray(i)||(i=Array.from(i));var a,s=i.length,o,l,u=new Array(s);for(a=0;a=f)if(b>=f&&e===xl){const k=oo(d,f,x);isFinite(k)&&(k>0?f=(Math.floor(f/k)+1)*k:k<0&&(f=(Math.ceil(f*-k)+1)/-k))}else p.pop()}for(var m=p.length;p[0]<=d;)p.shift(),--m;for(;p[m-1]>f;)p.pop(),--m;var _=new Array(m+1),y;for(a=0;a<=m;++a)y=_[a]=[],y.x0=a>0?p[a-1]:d,y.x1=a0)for(a=0;a=n)&&(r=n);else{let n=-1;for(let i of t)(i=e(i,++n,t))!=null&&(r=i)&&(r=i)}return r}function H0(t,e){let r,n=-1,i=-1;if(e===void 0)for(const a of t)++i,a!=null&&(r=a)&&(r=a,n=i);else for(let a of t)(a=e(a,++i,t))!=null&&(r=a)&&(r=a,n=i);return n}function Tl(t,e){let r;if(e===void 0)for(const n of t)n!=null&&(r>n||r===void 0&&n>=n)&&(r=n);else{let n=-1;for(let i of t)(i=e(i,++n,t))!=null&&(r>i||r===void 0&&i>=i)&&(r=i)}return r}function G0(t,e){let r,n=-1,i=-1;if(e===void 0)for(const a of t)++i,a!=null&&(r>a||r===void 0&&a>=a)&&(r=a,n=i);else for(let a of t)(a=e(a,++i,t))!=null&&(r>a||r===void 0&&a>=a)&&(r=a,n=i);return n}function Tu(t,e,r=0,n=t.length-1,i){for(i=i===void 0?so:V0(i);n>r;){if(n-r>600){const l=n-r+1,u=e-r+1,h=Math.log(l),d=.5*Math.exp(2*h/3),f=.5*Math.sqrt(h*d*(l-d)/l)*(u-l/2<0?-1:1),p=Math.max(r,Math.floor(e-u*d/l+f)),m=Math.min(n,Math.floor(e+(l-u)*d/l+f));Tu(t,e,p,m,i)}const a=t[e];let s=r,o=n;for(El(t,r,e),i(t[n],a)>0&&El(t,r,n);s0;)--o}i(t[r],a)===0?El(t,r,o):(++o,El(t,o,n)),o<=e&&(r=o+1),e<=o&&(n=o-1)}return t}function El(t,e,r){const n=t[e];t[e]=t[r],t[r]=n}function V_(t,e=Qe){let r,n=!1;if(e.length===1){let i;for(const a of t){const s=e(a);(n?Qe(s,i)>0:Qe(s,s)===0)&&(r=a,i=s,n=!0)}}else for(const i of t)(n?e(i,r)>0:e(i,i)===0)&&(r=i,n=!0);return r}function Cl(t,e,r){if(t=Float64Array.from(x_(t,r)),!!(n=t.length)){if((e=+e)<=0||n<2)return Tl(t);if(e>=1)return lo(t);var n,i=(n-1)*e,a=Math.floor(i),s=lo(Tu(t,a).subarray(0,a+1)),o=Tl(t.subarray(a+1));return s+(o-s)*(i-a)}}function z_(t,e,r=v_){if(!!(n=t.length)){if((e=+e)<=0||n<2)return+r(t[0],0,t);if(e>=1)return+r(t[n-1],n-1,t);var n,i=(n-1)*e,a=Math.floor(i),s=+r(t[a],a,t),o=+r(t[a+1],a+1,t);return s+(o-s)*(i-a)}}function Y_(t,e,r){if(t=Float64Array.from(x_(t,r)),!!(n=t.length)){if((e=+e)<=0||n<2)return G0(t);if(e>=1)return H0(t);var n,i=Math.floor((n-1)*e),a=(o,l)=>so(t[o],t[l]),s=Tu(Uint32Array.from(t,(o,l)=>l),i,0,n-1,a);return V_(s.subarray(0,i+1),o=>t[o])}}function jR(t,e,r){return Math.ceil((r-e)/(2*(Cl(t,.75)-Cl(t,.25))*Math.pow(ku(t),-1/3)))}function $R(t,e,r){return Math.ceil((r-e)*Math.cbrt(ku(t))/(3.49*S_(t)))}function XR(t,e){let r=0,n=0;if(e===void 0)for(let i of t)i!=null&&(i=+i)>=i&&(++r,n+=i);else{let i=-1;for(let a of t)(a=e(a,++i,t))!=null&&(a=+a)>=a&&(++r,n+=a)}if(r)return n/r}function KR(t,e){return Cl(t,.5,e)}function ZR(t,e){return Y_(t,.5,e)}function*QR(t){for(const e of t)yield*e}function j0(t){return Array.from(QR(t))}function JR(t,e){const r=new kl;if(e===void 0)for(let a of t)a!=null&&a>=a&&r.set(a,(r.get(a)||0)+1);else{let a=-1;for(let s of t)(s=e(s,++a,t))!=null&&s>=s&&r.set(s,(r.get(s)||0)+1)}let n,i=0;for(const[a,s]of r)s>i&&(i=s,n=a);return n}function tI(t,e=eI){const r=[];let n,i=!1;for(const a of t)i&&r.push(e(n,a)),n=a,i=!0;return r}function eI(t,e){return[t,e]}function Ca(t,e,r){t=+t,e=+e,r=(i=arguments.length)<2?(e=t,t=0,1):i<3?1:+r;for(var n=-1,i=Math.max(0,Math.ceil((e-t)/r))|0,a=new Array(i);++ne(r[o],r[l]);let a,s;return Uint32Array.from(r,(o,l)=>l).sort(e===Qe?(o,l)=>so(r[o],r[l]):V0(i)).forEach((o,l)=>{const u=i(o,a===void 0?o:a);u>=0?((a===void 0||u>0)&&(a=o,s=l),n[o]=s):n[o]=NaN}),n}function nI(t,e=Qe){let r,n=!1;if(e.length===1){let i;for(const a of t){const s=e(a);(n?Qe(s,i)<0:Qe(s,s)===0)&&(r=a,i=s,n=!0)}}else for(const i of t)(n?e(i,r)<0:e(i,i)===0)&&(r=i,n=!0);return r}function U_(t,e=Qe){if(e.length===1)return G0(t,e);let r,n=-1,i=-1;for(const a of t)++i,(n<0?e(a,a)===0:e(a,r)<0)&&(r=a,n=i);return n}function iI(t,e=Qe){if(e.length===1)return H0(t,e);let r,n=-1,i=-1;for(const a of t)++i,(n<0?e(a,a)===0:e(a,r)>0)&&(r=a,n=i);return n}function aI(t,e){const r=U_(t,e);return r<0?void 0:r}const sI=W_(Math.random);function W_(t){return function(r,n=0,i=r.length){let a=i-(n=+n);for(;a;){const s=t()*a--|0,o=r[a+n];r[a+n]=r[s+n],r[s+n]=o}return r}}function oI(t,e){let r=0;if(e===void 0)for(let n of t)(n=+n)&&(r+=n);else{let n=-1;for(let i of t)(i=+e(i,++n,t))&&(r+=i)}return r}function H_(t){if(!(a=t.length))return[];for(var e=-1,r=Tl(t,lI),n=new Array(r);++ee(r,n,t))}function pI(t,e,r){if(typeof e!="function")throw new TypeError("reducer is not a function");const n=t[Symbol.iterator]();let i,a,s=-1;if(arguments.length<3){if({done:i,value:r}=n.next(),i)return;++s}for(;{done:i,value:a}=n.next(),!i;)r=e(r,a,++s,t);return r}function gI(t){if(typeof t[Symbol.iterator]!="function")throw new TypeError("values is not iterable");return Array.from(t).reverse()}function yI(t,...e){t=new us(t);for(const r of e)for(const n of r)t.delete(n);return t}function mI(t,e){const r=e[Symbol.iterator](),n=new us;for(const i of t){if(n.has(i))return!1;let a,s;for(;({value:a,done:s}=r.next())&&!s;){if(Object.is(i,a))return!1;n.add(a)}}return!0}function bI(t,...e){t=new us(t),e=e.map(_I);t:for(const r of t)for(const n of e)if(!n.has(r)){t.delete(r);continue t}return t}function _I(t){return t instanceof us?t:new us(t)}function G_(t,e){const r=t[Symbol.iterator](),n=new Set;for(const i of e){const a=j_(i);if(n.has(a))continue;let s,o;for(;{value:s,done:o}=r.next();){if(o)return!1;const l=j_(s);if(n.add(l),Object.is(a,l))break}}return!0}function j_(t){return t!==null&&typeof t=="object"?t.valueOf():t}function vI(t,e){return G_(e,t)}function xI(...t){const e=new us;for(const r of t)for(const n of r)e.add(n);return e}function kI(t){return t}var Eu=1,Cu=2,$0=3,Sl=4,$_=1e-6;function wI(t){return"translate("+t+",0)"}function TI(t){return"translate(0,"+t+")"}function EI(t){return e=>+t(e)}function CI(t,e){return e=Math.max(0,t.bandwidth()-e*2)/2,t.round()&&(e=Math.round(e)),r=>+t(r)+e}function SI(){return!this.__axis}function Su(t,e){var r=[],n=null,i=null,a=6,s=6,o=3,l=typeof window<"u"&&window.devicePixelRatio>1?0:.5,u=t===Eu||t===Sl?-1:1,h=t===Sl||t===Cu?"x":"y",d=t===Eu||t===$0?wI:TI;function f(p){var m=n==null?e.ticks?e.ticks.apply(e,r):e.domain():n,_=i==null?e.tickFormat?e.tickFormat.apply(e,r):kI:i,y=Math.max(a,0)+o,b=e.range(),x=+b[0]+l,k=+b[b.length-1]+l,T=(e.bandwidth?CI:EI)(e.copy(),l),C=p.selection?p.selection():p,M=C.selectAll(".domain").data([null]),S=C.selectAll(".tick").data(m,e).order(),R=S.exit(),A=S.enter().append("g").attr("class","tick"),L=S.select("line"),v=S.select("text");M=M.merge(M.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),S=S.merge(A),L=L.merge(A.append("line").attr("stroke","currentColor").attr(h+"2",u*a)),v=v.merge(A.append("text").attr("fill","currentColor").attr(h,u*y).attr("dy",t===Eu?"0em":t===$0?"0.71em":"0.32em")),p!==C&&(M=M.transition(p),S=S.transition(p),L=L.transition(p),v=v.transition(p),R=R.transition(p).attr("opacity",$_).attr("transform",function(B){return isFinite(B=T(B))?d(B+l):this.getAttribute("transform")}),A.attr("opacity",$_).attr("transform",function(B){var w=this.parentNode.__axis;return d((w&&isFinite(w=w(B))?w:T(B))+l)})),R.remove(),M.attr("d",t===Sl||t===Cu?s?"M"+u*s+","+x+"H"+l+"V"+k+"H"+u*s:"M"+l+","+x+"V"+k:s?"M"+x+","+u*s+"V"+l+"H"+k+"V"+u*s:"M"+x+","+l+"H"+k),S.attr("opacity",1).attr("transform",function(B){return d(T(B)+l)}),L.attr(h+"2",u*a),v.attr(h,u*y).text(_),C.filter(SI).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",t===Cu?"start":t===Sl?"end":"middle"),C.each(function(){this.__axis=T})}return f.scale=function(p){return arguments.length?(e=p,f):e},f.ticks=function(){return r=Array.from(arguments),f},f.tickArguments=function(p){return arguments.length?(r=p==null?[]:Array.from(p),f):r.slice()},f.tickValues=function(p){return arguments.length?(n=p==null?null:Array.from(p),f):n&&n.slice()},f.tickFormat=function(p){return arguments.length?(i=p,f):i},f.tickSize=function(p){return arguments.length?(a=s=+p,f):a},f.tickSizeInner=function(p){return arguments.length?(a=+p,f):a},f.tickSizeOuter=function(p){return arguments.length?(s=+p,f):s},f.tickPadding=function(p){return arguments.length?(o=+p,f):o},f.offset=function(p){return arguments.length?(l=+p,f):l},f}function X_(t){return Su(Eu,t)}function AI(t){return Su(Cu,t)}function K_(t){return Su($0,t)}function MI(t){return Su(Sl,t)}var LI={value:()=>{}};function fs(){for(var t=0,e=arguments.length,r={},n;t=0&&(n=r.slice(i+1),r=r.slice(0,i)),r&&!e.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:n}})}Au.prototype=fs.prototype={constructor:Au,on:function(t,e){var r=this._,n=RI(t+"",r),i,a=-1,s=n.length;if(arguments.length<2){for(;++a0)for(var r=new Array(i),n=0,i,a;n=0&&(e=t.slice(0,r))!=="xmlns"&&(t=t.slice(r+1)),K0.hasOwnProperty(e)?{space:K0[e],local:t}:t}function NI(t){return function(){var e=this.ownerDocument,r=this.namespaceURI;return r===X0&&e.documentElement.namespaceURI===X0?e.createElement(t):e.createElementNS(r,t)}}function BI(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function Mu(t){var e=Al(t);return(e.local?BI:NI)(e)}function DI(){}function Lu(t){return t==null?DI:function(){return this.querySelector(t)}}function OI(t){typeof t!="function"&&(t=Lu(t));for(var e=this._groups,r=e.length,n=new Array(r),i=0;i=k&&(k=x+1);!(C=y[k])&&++k=0;)(s=n[i])&&(a&&s.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(s,a),a=s);return this}function sN(t){t||(t=oN);function e(d,f){return d&&f?t(d.__data__,f.__data__):!d-!f}for(var r=this._groups,n=r.length,i=new Array(n),a=0;ae?1:t>=e?0:NaN}function lN(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function cN(){return Array.from(this)}function uN(){for(var t=this._groups,e=0,r=t.length;e1?this.each((e==null?xN:typeof e=="function"?wN:kN)(t,e,r==null?"":r)):ds(this.node(),t)}function ds(t,e){return t.style.getPropertyValue(e)||J0(t).getComputedStyle(t,null).getPropertyValue(e)}function EN(t){return function(){delete this[t]}}function CN(t,e){return function(){this[t]=e}}function SN(t,e){return function(){var r=e.apply(this,arguments);r==null?delete this[t]:this[t]=r}}function AN(t,e){return arguments.length>1?this.each((e==null?EN:typeof e=="function"?SN:CN)(t,e)):this.node()[t]}function e5(t){return t.trim().split(/^|\s+/)}function td(t){return t.classList||new r5(t)}function r5(t){this._node=t,this._names=e5(t.getAttribute("class")||"")}r5.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function n5(t,e){for(var r=td(t),n=-1,i=e.length;++n=0&&(r=e.slice(n+1),e=e.slice(0,n)),{type:e,name:r}})}function rB(t){return function(){var e=this.__on;if(!!e){for(var r=0,n=-1,i=e.length,a;rTn(r,e))}function Iu(t){return typeof t=="string"?new $r([document.querySelectorAll(t)],[document.documentElement]):new $r([Q_(t)],ed)}const dB={passive:!1},Ml={capture:!0,passive:!1};function nd(t){t.stopImmediatePropagation()}function co(t){t.preventDefault(),t.stopImmediatePropagation()}function Nu(t){var e=t.document.documentElement,r=St(t).on("dragstart.drag",co,Ml);"onselectstart"in e?r.on("selectstart.drag",co,Ml):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function Bu(t,e){var r=t.document.documentElement,n=St(t).on("dragstart.drag",null);e&&(n.on("click.drag",co,Ml),setTimeout(function(){n.on("click.drag",null)},0)),"onselectstart"in r?n.on("selectstart.drag",null):(r.style.MozUserSelect=r.__noselect,delete r.__noselect)}const Du=t=>()=>t;function id(t,{sourceEvent:e,subject:r,target:n,identifier:i,active:a,x:s,y:o,dx:l,dy:u,dispatch:h}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:r,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:o,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:h}})}id.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};function pB(t){return!t.ctrlKey&&!t.button}function gB(){return this.parentNode}function yB(t,e){return e==null?{x:t.x,y:t.y}:e}function mB(){return navigator.maxTouchPoints||"ontouchstart"in this}function bB(){var t=pB,e=gB,r=yB,n=mB,i={},a=fs("start","drag","end"),s=0,o,l,u,h,d=0;function f(T){T.on("mousedown.drag",p).filter(n).on("touchstart.drag",y).on("touchmove.drag",b,dB).on("touchend.drag touchcancel.drag",x).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(T,C){if(!(h||!t.call(this,T,C))){var M=k(this,e.call(this,T,C),T,C,"mouse");!M||(St(T.view).on("mousemove.drag",m,Ml).on("mouseup.drag",_,Ml),Nu(T.view),nd(T),u=!1,o=T.clientX,l=T.clientY,M("start",T))}}function m(T){if(co(T),!u){var C=T.clientX-o,M=T.clientY-l;u=C*C+M*M>d}i.mouse("drag",T)}function _(T){St(T.view).on("mousemove.drag mouseup.drag",null),Bu(T.view,u),co(T),i.mouse("end",T)}function y(T,C){if(!!t.call(this,T,C)){var M=T.changedTouches,S=e.call(this,T,C),R=M.length,A,L;for(A=0;A>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):r===8?Ou(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):r===4?Ou(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=vB.exec(t))?new Er(e[1],e[2],e[3],1):(e=xB.exec(t))?new Er(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=kB.exec(t))?Ou(e[1],e[2],e[3],e[4]):(e=wB.exec(t))?Ou(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=TB.exec(t))?p5(e[1],e[2]/100,e[3]/100,1):(e=EB.exec(t))?p5(e[1],e[2]/100,e[3]/100,e[4]):l5.hasOwnProperty(t)?h5(l5[t]):t==="transparent"?new Er(NaN,NaN,NaN,0):null}function h5(t){return new Er(t>>16&255,t>>8&255,t&255,1)}function Ou(t,e,r,n){return n<=0&&(t=e=r=NaN),new Er(t,e,r,n)}function ad(t){return t instanceof Sa||(t=Aa(t)),t?(t=t.rgb(),new Er(t.r,t.g,t.b,t.opacity)):new Er}function po(t,e,r,n){return arguments.length===1?ad(t):new Er(t,e,r,n==null?1:n)}function Er(t,e,r,n){this.r=+t,this.g=+e,this.b=+r,this.opacity=+n}uo(Er,po,Ll(Sa,{brighter(t){return t=t==null?ho:Math.pow(ho,t),new Er(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?gs:Math.pow(gs,t),new Er(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Er(ys(this.r),ys(this.g),ys(this.b),Fu(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:f5,formatHex:f5,formatHex8:AB,formatRgb:d5,toString:d5}));function f5(){return`#${ms(this.r)}${ms(this.g)}${ms(this.b)}`}function AB(){return`#${ms(this.r)}${ms(this.g)}${ms(this.b)}${ms((isNaN(this.opacity)?1:this.opacity)*255)}`}function d5(){const t=Fu(this.opacity);return`${t===1?"rgb(":"rgba("}${ys(this.r)}, ${ys(this.g)}, ${ys(this.b)}${t===1?")":`, ${t})`}`}function Fu(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function ys(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function ms(t){return t=ys(t),(t<16?"0":"")+t.toString(16)}function p5(t,e,r,n){return n<=0?t=e=r=NaN:r<=0||r>=1?t=e=NaN:e<=0&&(t=NaN),new Kn(t,e,r,n)}function g5(t){if(t instanceof Kn)return new Kn(t.h,t.s,t.l,t.opacity);if(t instanceof Sa||(t=Aa(t)),!t)return new Kn;if(t instanceof Kn)return t;t=t.rgb();var e=t.r/255,r=t.g/255,n=t.b/255,i=Math.min(e,r,n),a=Math.max(e,r,n),s=NaN,o=a-i,l=(a+i)/2;return o?(e===a?s=(r-n)/o+(r0&&l<1?0:s,new Kn(s,o,l,t.opacity)}function Pu(t,e,r,n){return arguments.length===1?g5(t):new Kn(t,e,r,n==null?1:n)}function Kn(t,e,r,n){this.h=+t,this.s=+e,this.l=+r,this.opacity=+n}uo(Kn,Pu,Ll(Sa,{brighter(t){return t=t==null?ho:Math.pow(ho,t),new Kn(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?gs:Math.pow(gs,t),new Kn(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*e,i=2*r-n;return new Er(sd(t>=240?t-240:t+120,i,n),sd(t,i,n),sd(t<120?t+240:t-120,i,n),this.opacity)},clamp(){return new Kn(y5(this.h),qu(this.s),qu(this.l),Fu(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=Fu(this.opacity);return`${t===1?"hsl(":"hsla("}${y5(this.h)}, ${qu(this.s)*100}%, ${qu(this.l)*100}%${t===1?")":`, ${t})`}`}}));function y5(t){return t=(t||0)%360,t<0?t+360:t}function qu(t){return Math.max(0,Math.min(1,t||0))}function sd(t,e,r){return(t<60?e+(r-e)*t/60:t<180?r:t<240?e+(r-e)*(240-t)/60:e)*255}const m5=Math.PI/180,b5=180/Math.PI,Vu=18,_5=.96422,v5=1,x5=.82521,k5=4/29,go=6/29,w5=3*go*go,MB=go*go*go;function T5(t){if(t instanceof Zn)return new Zn(t.l,t.a,t.b,t.opacity);if(t instanceof Ti)return C5(t);t instanceof Er||(t=ad(t));var e=ud(t.r),r=ud(t.g),n=ud(t.b),i=od((.2225045*e+.7168786*r+.0606169*n)/v5),a,s;return e===r&&r===n?a=s=i:(a=od((.4360747*e+.3850649*r+.1430804*n)/_5),s=od((.0139322*e+.0971045*r+.7141733*n)/x5)),new Zn(116*i-16,500*(a-i),200*(i-s),t.opacity)}function LB(t,e){return new Zn(t,0,0,e==null?1:e)}function zu(t,e,r,n){return arguments.length===1?T5(t):new Zn(t,e,r,n==null?1:n)}function Zn(t,e,r,n){this.l=+t,this.a=+e,this.b=+r,this.opacity=+n}uo(Zn,zu,Ll(Sa,{brighter(t){return new Zn(this.l+Vu*(t==null?1:t),this.a,this.b,this.opacity)},darker(t){return new Zn(this.l-Vu*(t==null?1:t),this.a,this.b,this.opacity)},rgb(){var t=(this.l+16)/116,e=isNaN(this.a)?t:t+this.a/500,r=isNaN(this.b)?t:t-this.b/200;return e=_5*ld(e),t=v5*ld(t),r=x5*ld(r),new Er(cd(3.1338561*e-1.6168667*t-.4906146*r),cd(-.9787684*e+1.9161415*t+.033454*r),cd(.0719453*e-.2289914*t+1.4052427*r),this.opacity)}}));function od(t){return t>MB?Math.pow(t,1/3):t/w5+k5}function ld(t){return t>go?t*t*t:w5*(t-k5)}function cd(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function ud(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function E5(t){if(t instanceof Ti)return new Ti(t.h,t.c,t.l,t.opacity);if(t instanceof Zn||(t=T5(t)),t.a===0&&t.b===0)return new Ti(NaN,0=1?(r=1,e-1):Math.floor(r*e),i=t[n],a=t[n+1],s=n>0?t[n-1]:2*i-a,o=n()=>t;function B5(t,e){return function(r){return t+r*e}}function NB(t,e,r){return t=Math.pow(t,r),e=Math.pow(e,r)-t,r=1/r,function(n){return Math.pow(t+n*e,r)}}function Hu(t,e){var r=e-t;return r?B5(t,r>180||r<-180?r-360*Math.round(r/360):r):Wu(isNaN(t)?e:t)}function BB(t){return(t=+t)==1?Cr:function(e,r){return r-e?NB(e,r,t):Wu(isNaN(e)?r:e)}}function Cr(t,e){var r=e-t;return r?B5(t,r):Wu(isNaN(t)?e:t)}const Nl=function t(e){var r=BB(e);function n(i,a){var s=r((i=po(i)).r,(a=po(a)).r),o=r(i.g,a.g),l=r(i.b,a.b),u=Cr(i.opacity,a.opacity);return function(h){return i.r=s(h),i.g=o(h),i.b=l(h),i.opacity=u(h),i+""}}return n.gamma=t,n}(1);function D5(t){return function(e){var r=e.length,n=new Array(r),i=new Array(r),a=new Array(r),s,o;for(s=0;sr&&(a=e.slice(r,a),o[s]?o[s]+=a:o[++s]=a),(n=n[0])===(i=i[0])?o[s]?o[s]+=i:o[++s]=i:(o[++s]=null,l.push({i:s,x:Bn(n,i)})),r=gd.lastIndex;return r180?h+=360:h-u>180&&(u+=360),f.push({i:d.push(i(d)+"rotate(",null,n)-2,x:Bn(u,h)})):h&&d.push(i(d)+"rotate("+h+n)}function o(u,h,d,f){u!==h?f.push({i:d.push(i(d)+"skewX(",null,n)-2,x:Bn(u,h)}):h&&d.push(i(d)+"skewX("+h+n)}function l(u,h,d,f,p,m){if(u!==d||h!==f){var _=p.push(i(p)+"scale(",null,",",null,")");m.push({i:_-4,x:Bn(u,d)},{i:_-2,x:Bn(h,f)})}else(d!==1||f!==1)&&p.push(i(p)+"scale("+d+","+f+")")}return function(u,h){var d=[],f=[];return u=t(u),h=t(h),a(u.translateX,u.translateY,h.translateX,h.translateY,d,f),s(u.rotate,h.rotate,d,f),o(u.skewX,h.skewX,d,f),l(u.scaleX,u.scaleY,h.scaleX,h.scaleY,d,f),u=h=null,function(p){for(var m=-1,_=f.length,y;++m<_;)d[(y=f[m]).i]=y.x(p);return d.join("")}}}var W5=U5(zB,"px, ","px)","deg)"),H5=U5(YB,", ",")",")"),UB=1e-12;function G5(t){return((t=Math.exp(t))+1/t)/2}function WB(t){return((t=Math.exp(t))-1/t)/2}function HB(t){return((t=Math.exp(2*t))-1)/(t+1)}const j5=function t(e,r,n){function i(a,s){var o=a[0],l=a[1],u=a[2],h=s[0],d=s[1],f=s[2],p=h-o,m=d-l,_=p*p+m*m,y,b;if(_=0&&t._call.call(void 0,e),t=t._next;--yo}function rv(){_s=(Ku=Fl.now())+Zu,yo=Bl=0;try{ev()}finally{yo=0,tD(),_s=0}}function JB(){var t=Fl.now(),e=t-Ku;e>J5&&(Zu-=e,Ku=t)}function tD(){for(var t,e=Xu,r,n=1/0;e;)e._call?(n>e._time&&(n=e._time),t=e,e=e._next):(r=e._next,e._next=null,e=t?t._next=r:Xu=r);Ol=t,bd(n)}function bd(t){if(!yo){Bl&&(Bl=clearTimeout(Bl));var e=t-_s;e>24?(t<1/0&&(Bl=setTimeout(rv,t-Fl.now()-Zu)),Dl&&(Dl=clearInterval(Dl))):(Dl||(Ku=Fl.now(),Dl=setInterval(JB,J5)),yo=1,tv(rv))}}function _d(t,e,r){var n=new ql;return e=e==null?0:+e,n.restart(i=>{n.stop(),t(i+e)},e,r),n}function eD(t,e,r){var n=new ql,i=e;return e==null?(n.restart(t,e,r),n):(n._restart=n.restart,n.restart=function(a,s,o){s=+s,o=o==null?Pl():+o,n._restart(function l(u){u+=i,n._restart(l,i+=s,o),a(u)},s,o)},n.restart(t,e,r),n)}var rD=fs("start","end","cancel","interrupt"),nD=[],nv=0,vd=1,xd=2,Ju=3,iv=4,kd=5,th=6;function eh(t,e,r,n,i,a){var s=t.__transition;if(!s)t.__transition={};else if(r in s)return;iD(t,r,{name:e,index:n,group:i,on:rD,tween:nD,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:nv})}function wd(t,e){var r=Jn(t,e);if(r.state>nv)throw new Error("too late; already scheduled");return r}function Ei(t,e){var r=Jn(t,e);if(r.state>Ju)throw new Error("too late; already running");return r}function Jn(t,e){var r=t.__transition;if(!r||!(r=r[e]))throw new Error("transition not found");return r}function iD(t,e,r){var n=t.__transition,i;n[e]=r,r.timer=Qu(a,0,r.time);function a(u){r.state=vd,r.timer.restart(s,r.delay,r.time),r.delay<=u&&s(u-r.delay)}function s(u){var h,d,f,p;if(r.state!==vd)return l();for(h in n)if(p=n[h],p.name===r.name){if(p.state===Ju)return _d(s);p.state===iv?(p.state=th,p.timer.stop(),p.on.call("interrupt",t,t.__data__,p.index,p.group),delete n[h]):+hxd&&n.state=0&&(e=e.slice(0,r)),!e||e==="start"})}function BD(t,e,r){var n,i,a=ND(e)?wd:Ei;return function(){var s=a(this,t),o=s.on;o!==n&&(i=(n=o).copy()).on(e,r),s.on=i}}function DD(t,e){var r=this._id;return arguments.length<2?Jn(this.node(),r).on.on(t):this.each(BD(r,t,e))}function OD(t){return function(){var e=this.parentNode;for(var r in this.__transition)if(+r!==t)return;e&&e.removeChild(this)}}function FD(){return this.on("end.remove",OD(this._id))}function PD(t){var e=this._name,r=this._id;typeof t!="function"&&(t=Lu(t));for(var n=this._groups,i=n.length,a=new Array(i),s=0;s+t;function sO(t){return t*t}function oO(t){return t*(2-t)}function cv(t){return((t*=2)<=1?t*t:--t*(2-t)+1)/2}function lO(t){return t*t*t}function cO(t){return--t*t*t+1}function Ed(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var Cd=3,uO=function t(e){e=+e;function r(n){return Math.pow(n,e)}return r.exponent=t,r}(Cd),hO=function t(e){e=+e;function r(n){return 1-Math.pow(1-n,e)}return r.exponent=t,r}(Cd),uv=function t(e){e=+e;function r(n){return((n*=2)<=1?Math.pow(n,e):2-Math.pow(2-n,e))/2}return r.exponent=t,r}(Cd),hv=Math.PI,fv=hv/2;function fO(t){return+t==1?1:1-Math.cos(t*fv)}function dO(t){return Math.sin(t*fv)}function dv(t){return(1-Math.cos(hv*t))/2}function La(t){return(Math.pow(2,-10*t)-.0009765625)*1.0009775171065494}function pO(t){return La(1-+t)}function gO(t){return 1-La(t)}function pv(t){return((t*=2)<=1?La(1-t):2-La(t-1))/2}function yO(t){return 1-Math.sqrt(1-t*t)}function mO(t){return Math.sqrt(1- --t*t)}function gv(t){return((t*=2)<=1?1-Math.sqrt(1-t*t):Math.sqrt(1-(t-=2)*t)+1)/2}var Sd=4/11,bO=6/11,_O=8/11,vO=3/4,xO=9/11,kO=10/11,wO=15/16,TO=21/22,EO=63/64,rh=1/Sd/Sd;function CO(t){return 1-Vl(1-t)}function Vl(t){return(t=+t)vd&&n.name===e)return new Ci([[t]],DO,e,+i)}return null}const Rd=t=>()=>t;function FO(t,{sourceEvent:e,target:r,selection:n,mode:i,dispatch:a}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},selection:{value:n,enumerable:!0,configurable:!0},mode:{value:i,enumerable:!0,configurable:!0},_:{value:a}})}function PO(t){t.stopImmediatePropagation()}function Id(t){t.preventDefault(),t.stopImmediatePropagation()}var bv={name:"drag"},Nd={name:"space"},bo={name:"handle"},_o={name:"center"};const{abs:_v,max:Or,min:Fr}=Math;function vv(t){return[+t[0],+t[1]]}function Bd(t){return[vv(t[0]),vv(t[1])]}var nh={name:"x",handles:["w","e"].map(zl),input:function(t,e){return t==null?null:[[+t[0],e[0][1]],[+t[1],e[1][1]]]},output:function(t){return t&&[t[0][0],t[1][0]]}},ih={name:"y",handles:["n","s"].map(zl),input:function(t,e){return t==null?null:[[e[0][0],+t[0]],[e[1][0],+t[1]]]},output:function(t){return t&&[t[0][1],t[1][1]]}},qO={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(zl),input:function(t){return t==null?null:Bd(t)},output:function(t){return t}},Xi={overlay:"crosshair",selection:"move",n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},xv={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},kv={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},VO={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},zO={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function zl(t){return{type:t}}function YO(t){return!t.ctrlKey&&!t.button}function UO(){var t=this.ownerSVGElement||this;return t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]}function WO(){return navigator.maxTouchPoints||"ontouchstart"in this}function Dd(t){for(;!t.__brush;)if(!(t=t.parentNode))return;return t.__brush}function HO(t){return t[0][0]===t[1][0]||t[0][1]===t[1][1]}function GO(t){var e=t.__brush;return e?e.dim.output(e.selection):null}function jO(){return Od(nh)}function $O(){return Od(ih)}function XO(){return Od(qO)}function Od(t){var e=UO,r=YO,n=WO,i=!0,a=fs("start","brush","end"),s=6,o;function l(y){var b=y.property("__brush",_).selectAll(".overlay").data([zl("overlay")]);b.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",Xi.overlay).merge(b).each(function(){var k=Dd(this).extent;St(this).attr("x",k[0][0]).attr("y",k[0][1]).attr("width",k[1][0]-k[0][0]).attr("height",k[1][1]-k[0][1])}),y.selectAll(".selection").data([zl("selection")]).enter().append("rect").attr("class","selection").attr("cursor",Xi.selection).attr("fill","#777").attr("fill-opacity",.3).attr("stroke","#fff").attr("shape-rendering","crispEdges");var x=y.selectAll(".handle").data(t.handles,function(k){return k.type});x.exit().remove(),x.enter().append("rect").attr("class",function(k){return"handle handle--"+k.type}).attr("cursor",function(k){return Xi[k.type]}),y.each(u).attr("fill","none").attr("pointer-events","all").on("mousedown.brush",f).filter(n).on("touchstart.brush",f).on("touchmove.brush",p).on("touchend.brush touchcancel.brush",m).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}l.move=function(y,b,x){y.tween?y.on("start.brush",function(k){h(this,arguments).beforestart().start(k)}).on("interrupt.brush end.brush",function(k){h(this,arguments).end(k)}).tween("brush",function(){var k=this,T=k.__brush,C=h(k,arguments),M=T.selection,S=t.input(typeof b=="function"?b.apply(this,arguments):b,T.extent),R=Ma(M,S);function A(L){T.selection=L===1&&S===null?null:R(L),u.call(k),C.brush()}return M!==null&&S!==null?A:A(1)}):y.each(function(){var k=this,T=arguments,C=k.__brush,M=t.input(typeof b=="function"?b.apply(k,T):b,C.extent),S=h(k,T).beforestart();vs(k),C.selection=M===null?null:M,u.call(k),S.start(x).brush(x).end(x)})},l.clear=function(y,b){l.move(y,null,b)};function u(){var y=St(this),b=Dd(this).selection;b?(y.selectAll(".selection").style("display",null).attr("x",b[0][0]).attr("y",b[0][1]).attr("width",b[1][0]-b[0][0]).attr("height",b[1][1]-b[0][1]),y.selectAll(".handle").style("display",null).attr("x",function(x){return x.type[x.type.length-1]==="e"?b[1][0]-s/2:b[0][0]-s/2}).attr("y",function(x){return x.type[0]==="s"?b[1][1]-s/2:b[0][1]-s/2}).attr("width",function(x){return x.type==="n"||x.type==="s"?b[1][0]-b[0][0]+s:s}).attr("height",function(x){return x.type==="e"||x.type==="w"?b[1][1]-b[0][1]+s:s})):y.selectAll(".selection,.handle").style("display","none").attr("x",null).attr("y",null).attr("width",null).attr("height",null)}function h(y,b,x){var k=y.__brush.emitter;return k&&(!x||!k.clean)?k:new d(y,b,x)}function d(y,b,x){this.that=y,this.args=b,this.state=y.__brush,this.active=0,this.clean=x}d.prototype={beforestart:function(){return++this.active===1&&(this.state.emitter=this,this.starting=!0),this},start:function(y,b){return this.starting?(this.starting=!1,this.emit("start",y,b)):this.emit("brush",y),this},brush:function(y,b){return this.emit("brush",y,b),this},end:function(y,b){return--this.active===0&&(delete this.state.emitter,this.emit("end",y,b)),this},emit:function(y,b,x){var k=St(this.that).datum();a.call(y,this.that,new FO(y,{sourceEvent:b,target:l,selection:t.output(this.state.selection),mode:x,dispatch:a}),k)}};function f(y){if(o&&!y.touches||!r.apply(this,arguments))return;var b=this,x=y.target.__data__.type,k=(i&&y.metaKey?x="overlay":x)==="selection"?bv:i&&y.altKey?_o:bo,T=t===ih?null:VO[x],C=t===nh?null:zO[x],M=Dd(b),S=M.extent,R=M.selection,A=S[0][0],L,v,B=S[0][1],w,D,N=S[1][0],z,X,ct=S[1][1],J,Y,$=0,lt=0,ut,W=T&&C&&i&&y.shiftKey,tt,K,it=Array.from(y.touches||[y],at=>{const It=at.identifier;return at=Tn(at,b),at.point0=at.slice(),at.identifier=It,at});vs(b);var Z=h(b,arguments,!0).beforestart();if(x==="overlay"){R&&(ut=!0);const at=[it[0],it[1]||it[0]];M.selection=R=[[L=t===ih?A:Fr(at[0][0],at[1][0]),w=t===nh?B:Fr(at[0][1],at[1][1])],[z=t===ih?N:Or(at[0][0],at[1][0]),J=t===nh?ct:Or(at[0][1],at[1][1])]],it.length>1&&F(y)}else L=R[0][0],w=R[0][1],z=R[1][0],J=R[1][1];v=L,D=w,X=z,Y=J;var V=St(b).attr("pointer-events","none"),Q=V.selectAll(".overlay").attr("cursor",Xi[x]);if(y.touches)Z.moved=U,Z.ended=j;else{var q=St(y.view).on("mousemove.brush",U,!0).on("mouseup.brush",j,!0);i&&q.on("keydown.brush",P,!0).on("keyup.brush",et,!0),Nu(y.view)}u.call(b),Z.start(y,k.name);function U(at){for(const It of at.changedTouches||[at])for(const Lt of it)Lt.identifier===It.identifier&&(Lt.cur=Tn(It,b));if(W&&!tt&&!K&&it.length===1){const It=it[0];_v(It.cur[0]-It[0])>_v(It.cur[1]-It[1])?K=!0:tt=!0}for(const It of it)It.cur&&(It[0]=It.cur[0],It[1]=It.cur[1]);ut=!0,Id(at),F(at)}function F(at){const It=it[0],Lt=It.point0;var Rt;switch($=It[0]-Lt[0],lt=It[1]-Lt[1],k){case Nd:case bv:{T&&($=Or(A-L,Fr(N-z,$)),v=L+$,X=z+$),C&&(lt=Or(B-w,Fr(ct-J,lt)),D=w+lt,Y=J+lt);break}case bo:{it[1]?(T&&(v=Or(A,Fr(N,it[0][0])),X=Or(A,Fr(N,it[1][0])),T=1),C&&(D=Or(B,Fr(ct,it[0][1])),Y=Or(B,Fr(ct,it[1][1])),C=1)):(T<0?($=Or(A-L,Fr(N-L,$)),v=L+$,X=z):T>0&&($=Or(A-z,Fr(N-z,$)),v=L,X=z+$),C<0?(lt=Or(B-w,Fr(ct-w,lt)),D=w+lt,Y=J):C>0&&(lt=Or(B-J,Fr(ct-J,lt)),D=w,Y=J+lt));break}case _o:{T&&(v=Or(A,Fr(N,L-$*T)),X=Or(A,Fr(N,z+$*T))),C&&(D=Or(B,Fr(ct,w-lt*C)),Y=Or(B,Fr(ct,J+lt*C)));break}}X0&&(L=v-$),C<0?J=Y-lt:C>0&&(w=D-lt),k=Nd,Q.attr("cursor",Xi.selection),F(at));break}default:return}Id(at)}function et(at){switch(at.keyCode){case 16:{W&&(tt=K=W=!1,F(at));break}case 18:{k===_o&&(T<0?z=X:T>0&&(L=v),C<0?J=Y:C>0&&(w=D),k=bo,F(at));break}case 32:{k===Nd&&(at.altKey?(T&&(z=X-$*T,L=v+$*T),C&&(J=Y-lt*C,w=D+lt*C),k=_o):(T<0?z=X:T>0&&(L=v),C<0?J=Y:C>0&&(w=D),k=bo),Q.attr("cursor",Xi[x]),F(at));break}default:return}Id(at)}}function p(y){h(this,arguments).moved(y)}function m(y){h(this,arguments).ended(y)}function _(){var y=this.__brush||{selection:null};return y.extent=Bd(e.apply(this,arguments)),y.dim=t,y}return l.extent=function(y){return arguments.length?(e=typeof y=="function"?y:Rd(Bd(y)),l):e},l.filter=function(y){return arguments.length?(r=typeof y=="function"?y:Rd(!!y),l):r},l.touchable=function(y){return arguments.length?(n=typeof y=="function"?y:Rd(!!y),l):n},l.handleSize=function(y){return arguments.length?(s=+y,l):s},l.keyModifiers=function(y){return arguments.length?(i=!!y,l):i},l.on=function(){var y=a.on.apply(a,arguments);return y===a?l:y},l}var wv=Math.abs,vo=Math.cos,xo=Math.sin,Tv=Math.PI,ah=Tv/2,Ev=Tv*2,Cv=Math.max,Fd=1e-12;function Pd(t,e){return Array.from({length:e-t},(r,n)=>t+n)}function KO(t){return function(e,r){return t(e.source.value+e.target.value,r.source.value+r.target.value)}}function ZO(){return qd(!1,!1)}function QO(){return qd(!1,!0)}function JO(){return qd(!0,!1)}function qd(t,e){var r=0,n=null,i=null,a=null;function s(o){var l=o.length,u=new Array(l),h=Pd(0,l),d=new Array(l*l),f=new Array(l),p=0,m;o=Float64Array.from({length:l*l},e?(_,y)=>o[y%l][y/l|0]:(_,y)=>o[y/l|0][y%l]);for(let _=0;_n(u[y],u[b]));for(const y of h){const b=_;if(t){const x=Pd(~l+1,l).filter(k=>k<0?o[~k*l+y]:o[y*l+k]);i&&x.sort((k,T)=>i(k<0?-o[~k*l+y]:o[y*l+k],T<0?-o[~T*l+y]:o[y*l+T]));for(const k of x)if(k<0){const T=d[~k*l+y]||(d[~k*l+y]={source:null,target:null});T.target={index:y,startAngle:_,endAngle:_+=o[~k*l+y]*p,value:o[~k*l+y]}}else{const T=d[y*l+k]||(d[y*l+k]={source:null,target:null});T.source={index:y,startAngle:_,endAngle:_+=o[y*l+k]*p,value:o[y*l+k]}}f[y]={index:y,startAngle:b,endAngle:_,value:u[y]}}else{const x=Pd(0,l).filter(k=>o[y*l+k]||o[k*l+y]);i&&x.sort((k,T)=>i(o[y*l+k],o[y*l+T]));for(const k of x){let T;if(yxs)if(!(Math.abs(h*o-l*u)>xs)||!i)this._+="L"+(this._x1=t)+","+(this._y1=e);else{var f=r-a,p=n-s,m=o*o+l*l,_=f*f+p*p,y=Math.sqrt(m),b=Math.sqrt(d),x=i*Math.tan((Vd-Math.acos((m+d-_)/(2*y*b)))/2),k=x/b,T=x/y;Math.abs(k-1)>xs&&(this._+="L"+(t+k*u)+","+(e+k*h)),this._+="A"+i+","+i+",0,0,"+ +(h*f>u*p)+","+(this._x1=t+T*o)+","+(this._y1=e+T*l)}},arc:function(t,e,r,n,i,a){t=+t,e=+e,r=+r,a=!!a;var s=r*Math.cos(n),o=r*Math.sin(n),l=t+s,u=e+o,h=1^a,d=a?n-i:i-n;if(r<0)throw new Error("negative radius: "+r);this._x1===null?this._+="M"+l+","+u:(Math.abs(this._x1-l)>xs||Math.abs(this._y1-u)>xs)&&(this._+="L"+l+","+u),r&&(d<0&&(d=d%zd+zd),d>tF?this._+="A"+r+","+r+",0,1,"+h+","+(t-s)+","+(e-o)+"A"+r+","+r+",0,1,"+h+","+(this._x1=l)+","+(this._y1=u):d>xs&&(this._+="A"+r+","+r+",0,"+ +(d>=Vd)+","+h+","+(this._x1=t+r*Math.cos(i))+","+(this._y1=e+r*Math.sin(i))))},rect:function(t,e,r,n){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)+"h"+ +r+"v"+ +n+"h"+-r+"Z"},toString:function(){return this._}};var eF=Array.prototype.slice;function ks(t){return function(){return t}}function rF(t){return t.source}function nF(t){return t.target}function Sv(t){return t.radius}function iF(t){return t.startAngle}function aF(t){return t.endAngle}function sF(){return 0}function oF(){return 10}function Av(t){var e=rF,r=nF,n=Sv,i=Sv,a=iF,s=aF,o=sF,l=null;function u(){var h,d=e.apply(this,arguments),f=r.apply(this,arguments),p=o.apply(this,arguments)/2,m=eF.call(arguments),_=+n.apply(this,(m[0]=d,m)),y=a.apply(this,m)-ah,b=s.apply(this,m)-ah,x=+i.apply(this,(m[0]=f,m)),k=a.apply(this,m)-ah,T=s.apply(this,m)-ah;if(l||(l=h=Ra()),p>Fd&&(wv(b-y)>p*2+Fd?b>y?(y+=p,b-=p):(y-=p,b+=p):y=b=(y+b)/2,wv(T-k)>p*2+Fd?T>k?(k+=p,T-=p):(k-=p,T+=p):k=T=(k+T)/2),l.moveTo(_*vo(y),_*xo(y)),l.arc(0,0,_,y,b),y!==k||b!==T)if(t){var C=+t.apply(this,arguments),M=x-C,S=(k+T)/2;l.quadraticCurveTo(0,0,M*vo(k),M*xo(k)),l.lineTo(x*vo(S),x*xo(S)),l.lineTo(M*vo(T),M*xo(T))}else l.quadraticCurveTo(0,0,x*vo(k),x*xo(k)),l.arc(0,0,x,k,T);if(l.quadraticCurveTo(0,0,_*vo(y),_*xo(y)),l.closePath(),h)return l=null,h+""||null}return t&&(u.headRadius=function(h){return arguments.length?(t=typeof h=="function"?h:ks(+h),u):t}),u.radius=function(h){return arguments.length?(n=i=typeof h=="function"?h:ks(+h),u):n},u.sourceRadius=function(h){return arguments.length?(n=typeof h=="function"?h:ks(+h),u):n},u.targetRadius=function(h){return arguments.length?(i=typeof h=="function"?h:ks(+h),u):i},u.startAngle=function(h){return arguments.length?(a=typeof h=="function"?h:ks(+h),u):a},u.endAngle=function(h){return arguments.length?(s=typeof h=="function"?h:ks(+h),u):s},u.padAngle=function(h){return arguments.length?(o=typeof h=="function"?h:ks(+h),u):o},u.source=function(h){return arguments.length?(e=h,u):e},u.target=function(h){return arguments.length?(r=h,u):r},u.context=function(h){return arguments.length?(l=h==null?null:h,u):l},u}function lF(){return Av()}function cF(){return Av(oF)}var uF=Array.prototype,Mv=uF.slice;function hF(t,e){return t-e}function fF(t){for(var e=0,r=t.length,n=t[r-1][1]*t[0][0]-t[r-1][0]*t[0][1];++e()=>t;function dF(t,e){for(var r=-1,n=e.length,i;++rn!=p>n&&r<(f-u)*(n-h)/(p-h)+u&&(i=-i)}return i}function gF(t,e,r){var n;return yF(t,e,r)&&mF(t[n=+(t[0]===e[0])],r[n],e[n])}function yF(t,e,r){return(e[0]-t[0])*(r[1]-t[1])===(r[0]-t[0])*(e[1]-t[1])}function mF(t,e,r){return t<=e&&e<=r||r<=e&&e<=t}function bF(){}var Ki=[[],[[[1,1.5],[.5,1]]],[[[1.5,1],[1,1.5]]],[[[1.5,1],[.5,1]]],[[[1,.5],[1.5,1]]],[[[1,1.5],[.5,1]],[[1,.5],[1.5,1]]],[[[1,.5],[1,1.5]]],[[[1,.5],[.5,1]]],[[[.5,1],[1,.5]]],[[[1,1.5],[1,.5]]],[[[.5,1],[1,.5]],[[1.5,1],[1,1.5]]],[[[1.5,1],[1,.5]]],[[[.5,1],[1.5,1]]],[[[1,1.5],[1.5,1]]],[[[.5,1],[1,1.5]]],[]];function Ud(){var t=1,e=1,r=W0,n=l;function i(u){var h=r(u);if(Array.isArray(h))h=h.slice().sort(hF);else{const d=xl(u),f=wl(d[0],d[1],h);h=hs(Math.floor(d[0]/f)*f,Math.floor(d[1]/f-1)*f,h)}return h.map(d=>a(u,d))}function a(u,h){var d=[],f=[];return s(u,h,function(p){n(p,u,h),fF(p)>0?d.push([p]):f.push(p)}),f.forEach(function(p){for(var m=0,_=d.length,y;m<_;++m)if(dF((y=d[m])[0],p)!==-1){y.push(p);return}}),{type:"MultiPolygon",value:h,coordinates:d}}function s(u,h,d){var f=new Array,p=new Array,m,_,y,b,x,k;for(m=_=-1,b=u[0]>=h,Ki[b<<1].forEach(T);++m=h,Ki[y|b<<1].forEach(T);for(Ki[b<<0].forEach(T);++_=h,x=u[_*t]>=h,Ki[b<<1|x<<2].forEach(T);++m=h,k=x,x=u[_*t+m+1]>=h,Ki[y|b<<1|x<<2|k<<3].forEach(T);Ki[b|x<<3].forEach(T)}for(m=-1,x=u[_*t]>=h,Ki[x<<2].forEach(T);++m=h,Ki[x<<2|k<<3].forEach(T);Ki[x<<3].forEach(T);function T(C){var M=[C[0][0]+m,C[0][1]+_],S=[C[1][0]+m,C[1][1]+_],R=o(M),A=o(S),L,v;(L=p[R])?(v=f[A])?(delete p[L.end],delete f[v.start],L===v?(L.ring.push(S),d(L.ring)):f[L.start]=p[v.end]={start:L.start,end:v.end,ring:L.ring.concat(v.ring)}):(delete p[L.end],L.ring.push(S),p[L.end=A]=L):(L=f[A])?(v=p[R])?(delete f[L.start],delete p[v.end],L===v?(L.ring.push(S),d(L.ring)):f[v.start]=p[L.end]={start:v.start,end:L.end,ring:v.ring.concat(L.ring)}):(delete f[L.start],L.ring.unshift(M),f[L.start=R]=L):f[R]=p[A]={start:R,end:A,ring:[M,S]}}}function o(u){return u[0]*2+u[1]*(t+1)*4}function l(u,h,d){u.forEach(function(f){var p=f[0],m=f[1],_=p|0,y=m|0,b,x=h[y*t+_];p>0&&p0&&m=0&&d>=0))throw new Error("invalid size");return t=h,e=d,i},i.thresholds=function(u){return arguments.length?(r=typeof u=="function"?u:Array.isArray(u)?Ia(Mv.call(u)):Ia(u),i):r},i.smooth=function(u){return arguments.length?(n=u?l:bF,i):n===l},i}function _F(t){return t[0]}function vF(t){return t[1]}function xF(){return 1}function kF(){var t=_F,e=vF,r=xF,n=960,i=500,a=20,s=2,o=a*3,l=n+o*2>>s,u=i+o*2>>s,h=Ia(20);function d(x){var k=new Float32Array(l*u),T=Math.pow(2,-s),C=-1;for(const w of x){var M=(t(w,++C,x)+o)*T,S=(e(w,C,x)+o)*T,R=+r(w,C,x);if(M>=0&&M=0&&SM*C))(k).map((M,S)=>(M.value=+T[S],p(M)))}f.contours=function(x){var k=d(x),T=Ud().size([l,u]),C=Math.pow(2,2*s),M=S=>{S=+S;var R=p(T.contour(k,S*C));return R.value=S,R};return Object.defineProperty(M,"max",{get:()=>lo(k)/C}),M};function p(x){return x.coordinates.forEach(m),x}function m(x){x.forEach(_)}function _(x){x.forEach(y)}function y(x){x[0]=x[0]*Math.pow(2,s)-o,x[1]=x[1]*Math.pow(2,s)-o}function b(){return o=a*3,l=n+o*2>>s,u=i+o*2>>s,f}return f.x=function(x){return arguments.length?(t=typeof x=="function"?x:Ia(+x),f):t},f.y=function(x){return arguments.length?(e=typeof x=="function"?x:Ia(+x),f):e},f.weight=function(x){return arguments.length?(r=typeof x=="function"?x:Ia(+x),f):r},f.size=function(x){if(!arguments.length)return[n,i];var k=+x[0],T=+x[1];if(!(k>=0&&T>=0))throw new Error("invalid size");return n=k,i=T,b()},f.cellSize=function(x){if(!arguments.length)return 1<=1))throw new Error("invalid cell size");return s=Math.floor(Math.log(x)/Math.LN2),b()},f.thresholds=function(x){return arguments.length?(h=typeof x=="function"?x:Array.isArray(x)?Ia(Mv.call(x)):Ia(x),f):h},f.bandwidth=function(x){if(!arguments.length)return Math.sqrt(a*(a+1));if(!((x=+x)>=0))throw new Error("invalid bandwidth");return a=(Math.sqrt(4*x*x+1)-1)/2,b()},f}const Zi=11102230246251565e-32,Pr=134217729,wF=(3+8*Zi)*Zi;function Wd(t,e,r,n,i){let a,s,o,l,u=e[0],h=n[0],d=0,f=0;h>u==h>-u?(a=u,u=e[++d]):(a=h,h=n[++f]);let p=0;if(du==h>-u?(s=u+a,o=a-(s-u),u=e[++d]):(s=h+a,o=a-(s-h),h=n[++f]),a=s,o!==0&&(i[p++]=o);du==h>-u?(s=a+u,l=s-a,o=a-(s-l)+(u-l),u=e[++d]):(s=a+h,l=s-a,o=a-(s-l)+(h-l),h=n[++f]),a=s,o!==0&&(i[p++]=o);for(;d=D||-w>=D||(d=t-A,o=t-(A+d)+(d-i),d=r-L,u=r-(L+d)+(d-i),d=e-v,l=e-(v+d)+(d-a),d=n-B,h=n-(B+d)+(d-a),o===0&&l===0&&u===0&&h===0)||(D=SF*s+wF*Math.abs(w),w+=A*h+B*o-(v*u+L*l),w>=D||-w>=D))return w;T=o*B,f=Pr*o,p=f-(f-o),m=o-p,f=Pr*B,_=f-(f-B),y=B-_,C=m*y-(T-p*_-m*_-p*y),M=l*L,f=Pr*l,p=f-(f-l),m=l-p,f=Pr*L,_=f-(f-L),y=L-_,S=m*y-(M-p*_-m*_-p*y),b=C-S,d=C-b,Xr[0]=C-(b+d)+(d-S),x=T+b,d=x-T,k=T-(x-d)+(b-d),b=k-M,d=k-b,Xr[1]=k-(b+d)+(d-M),R=x+b,d=R-x,Xr[2]=x-(R-d)+(b-d),Xr[3]=R;const N=Wd(4,ko,4,Xr,Lv);T=A*h,f=Pr*A,p=f-(f-A),m=A-p,f=Pr*h,_=f-(f-h),y=h-_,C=m*y-(T-p*_-m*_-p*y),M=v*u,f=Pr*v,p=f-(f-v),m=v-p,f=Pr*u,_=f-(f-u),y=u-_,S=m*y-(M-p*_-m*_-p*y),b=C-S,d=C-b,Xr[0]=C-(b+d)+(d-S),x=T+b,d=x-T,k=T-(x-d)+(b-d),b=k-M,d=k-b,Xr[1]=k-(b+d)+(d-M),R=x+b,d=R-x,Xr[2]=x-(R-d)+(b-d),Xr[3]=R;const z=Wd(N,Lv,4,Xr,Rv);T=o*h,f=Pr*o,p=f-(f-o),m=o-p,f=Pr*h,_=f-(f-h),y=h-_,C=m*y-(T-p*_-m*_-p*y),M=l*u,f=Pr*l,p=f-(f-l),m=l-p,f=Pr*u,_=f-(f-u),y=u-_,S=m*y-(M-p*_-m*_-p*y),b=C-S,d=C-b,Xr[0]=C-(b+d)+(d-S),x=T+b,d=x-T,k=T-(x-d)+(b-d),b=k-M,d=k-b,Xr[1]=k-(b+d)+(d-M),R=x+b,d=R-x,Xr[2]=x-(R-d)+(b-d),Xr[3]=R;const X=Wd(z,Rv,4,Xr,Iv);return Iv[X-1]}function sh(t,e,r,n,i,a){const s=(e-a)*(r-i),o=(t-i)*(n-a),l=s-o;if(s===0||o===0||s>0!=o>0)return l;const u=Math.abs(s+o);return Math.abs(l)>=EF*u?l:-AF(t,e,r,n,i,a,u)}const Nv=Math.pow(2,-52),oh=new Uint32Array(512);class lh{static from(e,r=NF,n=BF){const i=e.length,a=new Float64Array(i*2);for(let s=0;s>1;if(r>0&&typeof e[0]!="number")throw new Error("Expected coords to contain numbers.");this.coords=e;const n=Math.max(2*r-5,0);this._triangles=new Uint32Array(n*3),this._halfedges=new Int32Array(n*3),this._hashSize=Math.ceil(Math.sqrt(r)),this._hullPrev=new Uint32Array(r),this._hullNext=new Uint32Array(r),this._hullTri=new Uint32Array(r),this._hullHash=new Int32Array(this._hashSize).fill(-1),this._ids=new Uint32Array(r),this._dists=new Float64Array(r),this.update()}update(){const{coords:e,_hullPrev:r,_hullNext:n,_hullTri:i,_hullHash:a}=this,s=e.length>>1;let o=1/0,l=1/0,u=-1/0,h=-1/0;for(let L=0;Lu&&(u=v),B>h&&(h=B),this._ids[L]=L}const d=(o+u)/2,f=(l+h)/2;let p=1/0,m,_,y;for(let L=0;L0&&(_=L,p=v)}let k=e[2*_],T=e[2*_+1],C=1/0;for(let L=0;Lw&&(L[v++]=D,w=this._dists[D])}this.hull=L.subarray(0,v),this.triangles=new Uint32Array(0),this.halfedges=new Uint32Array(0);return}if(sh(b,x,k,T,M,S)<0){const L=_,v=k,B=T;_=y,k=M,T=S,y=L,M=v,S=B}const R=IF(b,x,k,T,M,S);this._cx=R.x,this._cy=R.y;for(let L=0;L0&&Math.abs(D-v)<=Nv&&Math.abs(N-B)<=Nv||(v=D,B=N,w===m||w===_||w===y))continue;let z=0;for(let $=0,lt=this._hashKey(D,N);$=0;)if(X=ct,X===z){X=-1;break}if(X===-1)continue;let J=this._addTriangle(X,w,n[X],-1,-1,i[X]);i[w]=this._legalize(J+2),i[X]=J,A++;let Y=n[X];for(;ct=n[Y],sh(D,N,e[2*Y],e[2*Y+1],e[2*ct],e[2*ct+1])<0;)J=this._addTriangle(Y,w,ct,i[w],-1,i[Y]),i[w]=this._legalize(J+2),n[Y]=Y,A--,Y=ct;if(X===z)for(;ct=r[X],sh(D,N,e[2*ct],e[2*ct+1],e[2*X],e[2*X+1])<0;)J=this._addTriangle(ct,w,X,-1,i[X],i[ct]),this._legalize(J+2),i[ct]=J,n[X]=X,A--,X=ct;this._hullStart=r[w]=X,n[X]=r[Y]=w,n[w]=Y,a[this._hashKey(D,N)]=w,a[this._hashKey(e[2*X],e[2*X+1])]=X}this.hull=new Uint32Array(A);for(let L=0,v=this._hullStart;L0?3-r:1+r)/4}function Hd(t,e,r,n){const i=t-r,a=e-n;return i*i+a*a}function LF(t,e,r,n,i,a,s,o){const l=t-s,u=e-o,h=r-s,d=n-o,f=i-s,p=a-o,m=l*l+u*u,_=h*h+d*d,y=f*f+p*p;return l*(d*y-_*p)-u*(h*y-_*f)+m*(h*p-d*f)<0}function RF(t,e,r,n,i,a){const s=r-t,o=n-e,l=i-t,u=a-e,h=s*s+o*o,d=l*l+u*u,f=.5/(s*u-o*l),p=(u*h-o*d)*f,m=(s*d-l*h)*f;return p*p+m*m}function IF(t,e,r,n,i,a){const s=r-t,o=n-e,l=i-t,u=a-e,h=s*s+o*o,d=l*l+u*u,f=.5/(s*u-o*l),p=t+(u*h-o*d)*f,m=e+(s*d-l*h)*f;return{x:p,y:m}}function wo(t,e,r,n){if(n-r<=20)for(let i=r+1;i<=n;i++){const a=t[i],s=e[a];let o=i-1;for(;o>=r&&e[t[o]]>s;)t[o+1]=t[o--];t[o+1]=a}else{const i=r+n>>1;let a=r+1,s=n;Ul(t,i,a),e[t[r]]>e[t[n]]&&Ul(t,r,n),e[t[a]]>e[t[n]]&&Ul(t,a,n),e[t[r]]>e[t[a]]&&Ul(t,r,a);const o=t[a],l=e[o];for(;;){do a++;while(e[t[a]]l);if(s=s-r?(wo(t,e,a,n),wo(t,e,r,s-1)):(wo(t,e,r,s-1),wo(t,e,a,n))}}function Ul(t,e,r){const n=t[e];t[e]=t[r],t[r]=n}function NF(t){return t[0]}function BF(t){return t[1]}const Bv=1e-6;class ws{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(e,r){this._+=`M${this._x0=this._x1=+e},${this._y0=this._y1=+r}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(e,r){this._+=`L${this._x1=+e},${this._y1=+r}`}arc(e,r,n){e=+e,r=+r,n=+n;const i=e+n,a=r;if(n<0)throw new Error("negative radius");this._x1===null?this._+=`M${i},${a}`:(Math.abs(this._x1-i)>Bv||Math.abs(this._y1-a)>Bv)&&(this._+="L"+i+","+a),n&&(this._+=`A${n},${n},0,1,1,${e-n},${r}A${n},${n},0,1,1,${this._x1=i},${this._y1=a}`)}rect(e,r,n,i){this._+=`M${this._x0=this._x1=+e},${this._y0=this._y1=+r}h${+n}v${+i}h${-n}Z`}value(){return this._||null}}class Gd{constructor(){this._=[]}moveTo(e,r){this._.push([e,r])}closePath(){this._.push(this._[0].slice())}lineTo(e,r){this._.push([e,r])}value(){return this._.length?this._:null}}class Dv{constructor(e,[r,n,i,a]=[0,0,960,500]){if(!((i=+i)>=(r=+r))||!((a=+a)>=(n=+n)))throw new Error("invalid bounds");this.delaunay=e,this._circumcenters=new Float64Array(e.points.length*2),this.vectors=new Float64Array(e.points.length*2),this.xmax=i,this.xmin=r,this.ymax=a,this.ymin=n,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){const{delaunay:{points:e,hull:r,triangles:n},vectors:i}=this,a=this.circumcenters=this._circumcenters.subarray(0,n.length/3*2);for(let p=0,m=0,_=n.length,y,b;p<_;p+=3,m+=2){const x=n[p]*2,k=n[p+1]*2,T=n[p+2]*2,C=e[x],M=e[x+1],S=e[k],R=e[k+1],A=e[T],L=e[T+1],v=S-C,B=R-M,w=A-C,D=L-M,N=(v*D-B*w)*2;if(Math.abs(N)<1e-9){let z=1e9;const X=n[0]*2;z*=Math.sign((e[X]-C)*D-(e[X+1]-M)*w),y=(C+A)/2-z*D,b=(M+L)/2+z*w}else{const z=1/N,X=v*v+B*B,ct=w*w+D*D;y=C+(D*X-B*ct)*z,b=M+(v*ct-w*X)*z}a[m]=y,a[m+1]=b}let s=r[r.length-1],o,l=s*4,u,h=e[2*s],d,f=e[2*s+1];i.fill(0);for(let p=0;p1;)a-=2;for(let s=2;s4)for(let s=0;s0){if(r>=this.ymax)return null;(s=(this.ymax-r)/i)0){if(e>=this.xmax)return null;(s=(this.xmax-e)/n)this.xmax?2:0)|(rthis.ymax?8:0)}}const DF=2*Math.PI,To=Math.pow;function OF(t){return t[0]}function FF(t){return t[1]}function PF(t){const{triangles:e,coords:r}=t;for(let n=0;n1e-10)return!1}return!0}function qF(t,e,r){return[t+Math.sin(t+e)*r,e+Math.cos(t-e)*r]}class jd{static from(e,r=OF,n=FF,i){return new jd("length"in e?VF(e,r,n,i):Float64Array.from(zF(e,r,n,i)))}constructor(e){this._delaunator=new lh(e),this.inedges=new Int32Array(e.length/2),this._hullIndex=new Int32Array(e.length/2),this.points=this._delaunator.coords,this._init()}update(){return this._delaunator.update(),this._init(),this}_init(){const e=this._delaunator,r=this.points;if(e.hull&&e.hull.length>2&&PF(e)){this.collinear=Int32Array.from({length:r.length/2},(f,p)=>p).sort((f,p)=>r[2*f]-r[2*p]||r[2*f+1]-r[2*p+1]);const l=this.collinear[0],u=this.collinear[this.collinear.length-1],h=[r[2*l],r[2*l+1],r[2*u],r[2*u+1]],d=1e-8*Math.hypot(h[3]-h[1],h[2]-h[0]);for(let f=0,p=r.length/2;f0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=i[0],s[i[0]]=1,i.length===2&&(s[i[1]]=0,this.triangles[1]=i[1],this.triangles[2]=i[1]))}voronoi(e){return new Dv(this,e)}*neighbors(e){const{inedges:r,hull:n,_hullIndex:i,halfedges:a,triangles:s,collinear:o}=this;if(o){const d=o.indexOf(e);d>0&&(yield o[d-1]),d=0&&a!==n&&a!==i;)n=a;return a}_step(e,r,n){const{inedges:i,hull:a,_hullIndex:s,halfedges:o,triangles:l,points:u}=this;if(i[e]===-1||!u.length)return(e+1)%(u.length>>1);let h=e,d=To(r-u[e*2],2)+To(n-u[e*2+1],2);const f=i[e];let p=f;do{let m=l[p];const _=To(r-u[m*2],2)+To(n-u[m*2+1],2);if(_9999?"+"+dn(t,6):dn(t,4)}function WF(t){var e=t.getUTCHours(),r=t.getUTCMinutes(),n=t.getUTCSeconds(),i=t.getUTCMilliseconds();return isNaN(t)?"Invalid Date":UF(t.getUTCFullYear())+"-"+dn(t.getUTCMonth()+1,2)+"-"+dn(t.getUTCDate(),2)+(i?"T"+dn(e,2)+":"+dn(r,2)+":"+dn(n,2)+"."+dn(i,3)+"Z":n?"T"+dn(e,2)+":"+dn(r,2)+":"+dn(n,2)+"Z":r||e?"T"+dn(e,2)+":"+dn(r,2)+"Z":"")}function ch(t){var e=new RegExp('["'+t+` -\r]`),r=t.charCodeAt(0);function n(d,f){var p,m,_=i(d,function(y,b){if(p)return p(y,b-1);m=y,p=f?YF(y,f):Fv(y)});return _.columns=m||[],_}function i(d,f){var p=[],m=d.length,_=0,y=0,b,x=m<=0,k=!1;d.charCodeAt(m-1)===Wl&&--m,d.charCodeAt(m-1)===Kd&&--m;function T(){if(x)return $d;if(k)return k=!1,Ov;var M,S=_,R;if(d.charCodeAt(S)===Xd){for(;_++=m?x=!0:(R=d.charCodeAt(_++))===Wl?k=!0:R===Kd&&(k=!0,d.charCodeAt(_)===Wl&&++_),d.slice(S+1,M-1).replace(/""/g,'"')}for(;_uh(e,r).then(n=>new DOMParser().parseFromString(n,t))}const yP=Zd("application/xml");var mP=Zd("text/html"),bP=Zd("image/svg+xml");function _P(t,e){var r,n=1;t==null&&(t=0),e==null&&(e=0);function i(){var a,s=r.length,o,l=0,u=0;for(a=0;a=(d=(o+u)/2))?o=d:u=d,(y=r>=(f=(l+h)/2))?l=f:h=f,i=a,!(a=a[b=y<<1|_]))return i[b]=s,t;if(p=+t._x.call(null,a.data),m=+t._y.call(null,a.data),e===p&&r===m)return s.next=a,i?i[b]=s:t._root=s,t;do i=i?i[b]=new Array(4):t._root=new Array(4),(_=e>=(d=(o+u)/2))?o=d:u=d,(y=r>=(f=(l+h)/2))?l=f:h=f;while((b=y<<1|_)===(x=(m>=f)<<1|p>=d));return i[x]=a,i[b]=s,t}function xP(t){var e,r,n=t.length,i,a,s=new Array(n),o=new Array(n),l=1/0,u=1/0,h=-1/0,d=-1/0;for(r=0;rh&&(h=i),ad&&(d=a));if(l>h||u>d)return this;for(this.cover(l,u).cover(h,d),r=0;rt||t>=i||n>e||e>=a;)switch(u=(eh||(o=m.y0)>d||(l=m.x1)=b)<<1|t>=y)&&(m=f[f.length-1],f[f.length-1]=f[f.length-1-_],f[f.length-1-_]=m)}else{var x=t-+this._x.call(null,p.data),k=e-+this._y.call(null,p.data),T=x*x+k*k;if(T=(f=(s+l)/2))?s=f:l=f,(_=d>=(p=(o+u)/2))?o=p:u=p,e=r,!(r=r[y=_<<1|m]))return this;if(!r.length)break;(e[y+1&3]||e[y+2&3]||e[y+3&3])&&(n=e,b=y)}for(;r.data!==t;)if(i=r,!(r=r.next))return this;return(a=r.next)&&delete r.next,i?(a?i.next=a:delete i.next,this):e?(a?e[y]=a:delete e[y],(r=e[0]||e[1]||e[2]||e[3])&&r===(e[3]||e[2]||e[1]||e[0])&&!r.length&&(n?n[b]=r:this._root=r),this):(this._root=a,this)}function SP(t){for(var e=0,r=t.length;ef.index){var v=p-R.x-R.vx,B=m-R.y-R.vy,w=v*v+B*B;wp+L||Mm+L||Su.r&&(u.r=u[h].r)}function l(){if(!!e){var u,h=e.length,d;for(r=new Array(h),u=0;u[e(C,M,s),C])),T;for(y=0,o=new Array(b);y(t=(zP*t+YP)%Hv)/Hv}function WP(t){return t.x}function HP(t){return t.y}var GP=10,jP=Math.PI*(3-Math.sqrt(5));function $P(t){var e,r=1,n=.001,i=1-Math.pow(n,1/300),a=0,s=.6,o=new Map,l=Qu(d),u=fs("tick","end"),h=UP();t==null&&(t=[]);function d(){f(),u.call("tick",e),r1?(y==null?o.delete(_):o.set(_,m(y)),e):o.get(_)},find:function(_,y,b){var x=0,k=t.length,T,C,M,S,R;for(b==null?b=1/0:b*=b,x=0;x1?(u.on(_,y),e):u.on(_)}}}function XP(){var t,e,r,n,i=vr(-30),a,s=1,o=1/0,l=.81;function u(p){var m,_=t.length,y=hh(t,WP,HP).visitAfter(d);for(n=p,m=0;m<_;++m)e=t[m],y.visit(f)}function h(){if(!!t){var p,m=t.length,_;for(a=new Array(m),p=0;p=o)return;(p.data!==e||p.next)&&(b===0&&(b=Na(r),T+=b*b),x===0&&(x=Na(r),T+=x*x),T=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function fh(t,e){if((r=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var r,n=t.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+t.slice(r+1)]}function Eo(t){return t=fh(Math.abs(t)),t?t[1]:NaN}function tq(t,e){return function(r,n){for(var i=r.length,a=[],s=0,o=t[0],l=0;i>0&&o>0&&(l+o+1>n&&(o=Math.max(1,n-l)),a.push(r.substring(i-=o,i+o)),!((l+=o+1)>n));)o=t[s=(s+1)%t.length];return a.reverse().join(e)}}function eq(t){return function(e){return e.replace(/[0-9]/g,function(r){return t[+r]})}}var rq=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Co(t){if(!(e=rq.exec(t)))throw new Error("invalid format: "+t);var e;return new dh({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}Co.prototype=dh.prototype;function dh(t){this.fill=t.fill===void 0?" ":t.fill+"",this.align=t.align===void 0?">":t.align+"",this.sign=t.sign===void 0?"-":t.sign+"",this.symbol=t.symbol===void 0?"":t.symbol+"",this.zero=!!t.zero,this.width=t.width===void 0?void 0:+t.width,this.comma=!!t.comma,this.precision=t.precision===void 0?void 0:+t.precision,this.trim=!!t.trim,this.type=t.type===void 0?"":t.type+""}dh.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function nq(t){t:for(var e=t.length,r=1,n=-1,i;r0&&(n=0);break}return n>0?t.slice(0,n)+t.slice(i+1):t}var Gv;function iq(t,e){var r=fh(t,e);if(!r)return t+"";var n=r[0],i=r[1],a=i-(Gv=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,s=n.length;return a===s?n:a>s?n+new Array(a-s+1).join("0"):a>0?n.slice(0,a)+"."+n.slice(a):"0."+new Array(1-a).join("0")+fh(t,Math.max(0,e+a-1))[0]}function jv(t,e){var r=fh(t,e);if(!r)return t+"";var n=r[0],i=r[1];return i<0?"0."+new Array(-i).join("0")+n:n.length>i+1?n.slice(0,i+1)+"."+n.slice(i+1):n+new Array(i-n.length+2).join("0")}const $v={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:JP,e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>jv(t*100,e),r:jv,s:iq,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function Xv(t){return t}var Kv=Array.prototype.map,Zv=["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"];function Qv(t){var e=t.grouping===void 0||t.thousands===void 0?Xv:tq(Kv.call(t.grouping,Number),t.thousands+""),r=t.currency===void 0?"":t.currency[0]+"",n=t.currency===void 0?"":t.currency[1]+"",i=t.decimal===void 0?".":t.decimal+"",a=t.numerals===void 0?Xv:eq(Kv.call(t.numerals,String)),s=t.percent===void 0?"%":t.percent+"",o=t.minus===void 0?"\u2212":t.minus+"",l=t.nan===void 0?"NaN":t.nan+"";function u(d){d=Co(d);var f=d.fill,p=d.align,m=d.sign,_=d.symbol,y=d.zero,b=d.width,x=d.comma,k=d.precision,T=d.trim,C=d.type;C==="n"?(x=!0,C="g"):$v[C]||(k===void 0&&(k=12),T=!0,C="g"),(y||f==="0"&&p==="=")&&(y=!0,f="0",p="=");var M=_==="$"?r:_==="#"&&/[boxX]/.test(C)?"0"+C.toLowerCase():"",S=_==="$"?n:/[%p]/.test(C)?s:"",R=$v[C],A=/[defgprs%]/.test(C);k=k===void 0?6:/[gprs]/.test(C)?Math.max(1,Math.min(21,k)):Math.max(0,Math.min(20,k));function L(v){var B=M,w=S,D,N,z;if(C==="c")w=R(v)+w,v="";else{v=+v;var X=v<0||1/v<0;if(v=isNaN(v)?l:R(Math.abs(v),k),T&&(v=nq(v)),X&&+v==0&&m!=="+"&&(X=!1),B=(X?m==="("?m:o:m==="-"||m==="("?"":m)+B,w=(C==="s"?Zv[8+Gv/3]:"")+w+(X&&m==="("?")":""),A){for(D=-1,N=v.length;++Dz||z>57){w=(z===46?i+v.slice(D+1):v.slice(D))+w,v=v.slice(0,D);break}}}x&&!y&&(v=e(v,1/0));var ct=B.length+v.length+w.length,J=ct>1)+B+v+w+J.slice(ct);break;default:v=J+B+v+w;break}return a(v)}return L.toString=function(){return d+""},L}function h(d,f){var p=u((d=Co(d),d.type="f",d)),m=Math.max(-8,Math.min(8,Math.floor(Eo(f)/3)))*3,_=Math.pow(10,-m),y=Zv[8+m/3];return function(b){return p(_*b)+y}}return{format:u,formatPrefix:h}}var ph,gh,Jd;Jv({thousands:",",grouping:[3],currency:["$",""]});function Jv(t){return ph=Qv(t),gh=ph.format,Jd=ph.formatPrefix,ph}function t6(t){return Math.max(0,-Eo(Math.abs(t)))}function e6(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Eo(e)/3)))*3-Eo(Math.abs(t)))}function r6(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,Eo(e)-Eo(t))+1}var te=1e-6,Hl=1e-12,Ae=Math.PI,rr=Ae/2,yh=Ae/4,Qr=Ae*2,Ue=180/Ae,re=Ae/180,Ne=Math.abs,So=Math.atan,Jr=Math.atan2,Kt=Math.cos,mh=Math.ceil,n6=Math.exp,t2=Math.hypot,bh=Math.log,e2=Math.pow,Ht=Math.sin,Dn=Math.sign||function(t){return t>0?1:t<0?-1:0},Sr=Math.sqrt,r2=Math.tan;function i6(t){return t>1?0:t<-1?Ae:Math.acos(t)}function tn(t){return t>1?rr:t<-1?-rr:Math.asin(t)}function a6(t){return(t=Ht(t/2))*t}function Je(){}function _h(t,e){t&&o6.hasOwnProperty(t.type)&&o6[t.type](t,e)}var s6={Feature:function(t,e){_h(t.geometry,e)},FeatureCollection:function(t,e){for(var r=t.features,n=-1,i=r.length;++n=0?1:-1,i=n*r,a=Kt(e),s=Ht(e),o=s2*s,l=a2*a+o*Kt(i),u=o*n*Ht(i);vh.add(Jr(u,l)),i2=t,a2=a,s2=s}function lq(t){return xh=new _r,ti(t,Si),xh*2}function kh(t){return[Jr(t[1],t[0]),tn(t[2])]}function Cs(t){var e=t[0],r=t[1],n=Kt(r);return[n*Kt(e),n*Ht(e),Ht(r)]}function wh(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function Ao(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function o2(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function Th(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function Eh(t){var e=Sr(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}var tr,pn,nr,En,Ss,f6,d6,Mo,Gl,Ba,Qi,Ji={point:l2,lineStart:g6,lineEnd:y6,polygonStart:function(){Ji.point=m6,Ji.lineStart=cq,Ji.lineEnd=uq,Gl=new _r,Si.polygonStart()},polygonEnd:function(){Si.polygonEnd(),Ji.point=l2,Ji.lineStart=g6,Ji.lineEnd=y6,vh<0?(tr=-(nr=180),pn=-(En=90)):Gl>te?En=90:Gl<-te&&(pn=-90),Qi[0]=tr,Qi[1]=nr},sphere:function(){tr=-(nr=180),pn=-(En=90)}};function l2(t,e){Ba.push(Qi=[tr=t,nr=t]),eEn&&(En=e)}function p6(t,e){var r=Cs([t*re,e*re]);if(Mo){var n=Ao(Mo,r),i=[n[1],-n[0],0],a=Ao(i,n);Eh(a),a=kh(a);var s=t-Ss,o=s>0?1:-1,l=a[0]*Ue*o,u,h=Ne(s)>180;h^(o*SsEn&&(En=u)):(l=(l+360)%360-180,h^(o*SsEn&&(En=e))),h?tCn(tr,nr)&&(nr=t):Cn(t,nr)>Cn(tr,nr)&&(tr=t):nr>=tr?(tnr&&(nr=t)):t>Ss?Cn(tr,t)>Cn(tr,nr)&&(nr=t):Cn(t,nr)>Cn(tr,nr)&&(tr=t)}else Ba.push(Qi=[tr=t,nr=t]);eEn&&(En=e),Mo=r,Ss=t}function g6(){Ji.point=p6}function y6(){Qi[0]=tr,Qi[1]=nr,Ji.point=l2,Mo=null}function m6(t,e){if(Mo){var r=t-Ss;Gl.add(Ne(r)>180?r+(r>0?360:-360):r)}else f6=t,d6=e;Si.point(t,e),p6(t,e)}function cq(){Si.lineStart()}function uq(){m6(f6,d6),Si.lineEnd(),Ne(Gl)>te&&(tr=-(nr=180)),Qi[0]=tr,Qi[1]=nr,Mo=null}function Cn(t,e){return(e-=t)<0?e+360:e}function hq(t,e){return t[0]-e[0]}function b6(t,e){return t[0]<=t[1]?t[0]<=e&&e<=t[1]:eCn(n[0],n[1])&&(n[1]=i[1]),Cn(i[0],n[1])>Cn(n[0],n[1])&&(n[0]=i[0])):a.push(n=i);for(s=-1/0,r=a.length-1,e=0,n=a[r];e<=r;n=i,++e)i=a[e],(o=Cn(n[1],i[0]))>s&&(s=o,tr=i[0],nr=n[1])}return Ba=Qi=null,tr===1/0||pn===1/0?[[NaN,NaN],[NaN,NaN]]:[[tr,pn],[nr,En]]}var jl,Ch,Sh,Ah,Mh,Lh,Rh,Ih,c2,u2,h2,_6,v6,en,rn,nn,ei={sphere:Je,point:f2,lineStart:x6,lineEnd:k6,polygonStart:function(){ei.lineStart=gq,ei.lineEnd=yq},polygonEnd:function(){ei.lineStart=x6,ei.lineEnd=k6}};function f2(t,e){t*=re,e*=re;var r=Kt(e);$l(r*Kt(t),r*Ht(t),Ht(e))}function $l(t,e,r){++jl,Sh+=(t-Sh)/jl,Ah+=(e-Ah)/jl,Mh+=(r-Mh)/jl}function x6(){ei.point=dq}function dq(t,e){t*=re,e*=re;var r=Kt(e);en=r*Kt(t),rn=r*Ht(t),nn=Ht(e),ei.point=pq,$l(en,rn,nn)}function pq(t,e){t*=re,e*=re;var r=Kt(e),n=r*Kt(t),i=r*Ht(t),a=Ht(e),s=Jr(Sr((s=rn*a-nn*i)*s+(s=nn*n-en*a)*s+(s=en*i-rn*n)*s),en*n+rn*i+nn*a);Ch+=s,Lh+=s*(en+(en=n)),Rh+=s*(rn+(rn=i)),Ih+=s*(nn+(nn=a)),$l(en,rn,nn)}function k6(){ei.point=f2}function gq(){ei.point=mq}function yq(){w6(_6,v6),ei.point=f2}function mq(t,e){_6=t,v6=e,t*=re,e*=re,ei.point=w6;var r=Kt(e);en=r*Kt(t),rn=r*Ht(t),nn=Ht(e),$l(en,rn,nn)}function w6(t,e){t*=re,e*=re;var r=Kt(e),n=r*Kt(t),i=r*Ht(t),a=Ht(e),s=rn*a-nn*i,o=nn*n-en*a,l=en*i-rn*n,u=t2(s,o,l),h=tn(u),d=u&&-h/u;c2.add(d*s),u2.add(d*o),h2.add(d*l),Ch+=h,Lh+=h*(en+(en=n)),Rh+=h*(rn+(rn=i)),Ih+=h*(nn+(nn=a)),$l(en,rn,nn)}function bq(t){jl=Ch=Sh=Ah=Mh=Lh=Rh=Ih=0,c2=new _r,u2=new _r,h2=new _r,ti(t,ei);var e=+c2,r=+u2,n=+h2,i=t2(e,r,n);return iAe?t+Math.round(-t/Qr)*Qr:t,e]}p2.invert=p2;function g2(t,e,r){return(t%=Qr)?e||r?d2(E6(t),C6(e,r)):E6(t):e||r?C6(e,r):p2}function T6(t){return function(e,r){return e+=t,[e>Ae?e-Qr:e<-Ae?e+Qr:e,r]}}function E6(t){var e=T6(t);return e.invert=T6(-t),e}function C6(t,e){var r=Kt(t),n=Ht(t),i=Kt(e),a=Ht(e);function s(o,l){var u=Kt(l),h=Kt(o)*u,d=Ht(o)*u,f=Ht(l),p=f*r+h*n;return[Jr(d*i-p*a,h*r-f*n),tn(p*i+d*a)]}return s.invert=function(o,l){var u=Kt(l),h=Kt(o)*u,d=Ht(o)*u,f=Ht(l),p=f*i-d*a;return[Jr(d*i+f*a,h*r+p*n),tn(p*r-h*n)]},s}function S6(t){t=g2(t[0]*re,t[1]*re,t.length>2?t[2]*re:0);function e(r){return r=t(r[0]*re,r[1]*re),r[0]*=Ue,r[1]*=Ue,r}return e.invert=function(r){return r=t.invert(r[0]*re,r[1]*re),r[0]*=Ue,r[1]*=Ue,r},e}function A6(t,e,r,n,i,a){if(!!r){var s=Kt(e),o=Ht(e),l=n*r;i==null?(i=e+n*Qr,a=e-l/2):(i=M6(s,i),a=M6(s,a),(n>0?ia)&&(i+=n*Qr));for(var u,h=i;n>0?h>a:h1&&t.push(t.pop().concat(t.shift()))},result:function(){var r=t;return t=[],e=null,r}}}function Nh(t,e){return Ne(t[0]-e[0])=0;--o)i.point((d=h[o])[0],d[1]);else n(f.x,f.p.x,-1,i);f=f.p}f=f.o,h=f.z,p=!p}while(!f.v);i.lineEnd()}}}function I6(t){if(!!(e=t.length)){for(var e,r=0,n=t[0],i;++r=0?1:-1,L=A*R,v=L>Ae,B=y*M;if(l.add(Jr(B*A*Ht(L),b*S+B*Kt(L))),s+=v?R+A*Qr:R,v^m>=r^T>=r){var w=Ao(Cs(p),Cs(k));Eh(w);var D=Ao(a,w);Eh(D);var N=(v^R>=0?-1:1)*tn(D[2]);(n>N||n===N&&(w[0]||w[1]))&&(o+=v^R>=0?1:-1)}}return(s<-te||s0){for(l||(i.polygonStart(),l=!0),i.lineStart(),M=0;M1&&T&2&&C.push(C.pop().concat(C.shift())),h.push(C.filter(vq))}}return f}}function vq(t){return t.length>1}function xq(t,e){return((t=t.x)[0]<0?t[1]-rr-te:rr-t[1])-((e=e.x)[0]<0?e[1]-rr-te:rr-e[1])}const m2=B6(function(){return!0},kq,Tq,[-Ae,-rr]);function kq(t){var e=NaN,r=NaN,n=NaN,i;return{lineStart:function(){t.lineStart(),i=1},point:function(a,s){var o=a>0?Ae:-Ae,l=Ne(a-e);Ne(l-Ae)0?rr:-rr),t.point(n,r),t.lineEnd(),t.lineStart(),t.point(o,r),t.point(a,r),i=0):n!==o&&l>=Ae&&(Ne(e-n)te?So((Ht(e)*(a=Kt(n))*Ht(r)-Ht(n)*(i=Kt(e))*Ht(t))/(i*a*s)):(e+n)/2}function Tq(t,e,r,n){var i;if(t==null)i=r*rr,n.point(-Ae,i),n.point(0,i),n.point(Ae,i),n.point(Ae,0),n.point(Ae,-i),n.point(0,-i),n.point(-Ae,-i),n.point(-Ae,0),n.point(-Ae,i);else if(Ne(t[0]-e[0])>te){var a=t[0]0,i=Ne(e)>te;function a(h,d,f,p){A6(p,t,r,f,h,d)}function s(h,d){return Kt(h)*Kt(d)>e}function o(h){var d,f,p,m,_;return{lineStart:function(){m=p=!1,_=1},point:function(y,b){var x=[y,b],k,T=s(y,b),C=n?T?0:u(y,b):T?u(y+(y<0?Ae:-Ae),b):0;if(!d&&(m=p=T)&&h.lineStart(),T!==p&&(k=l(d,x),(!k||Nh(d,k)||Nh(x,k))&&(x[2]=1)),T!==p)_=0,T?(h.lineStart(),k=l(x,d),h.point(k[0],k[1])):(k=l(d,x),h.point(k[0],k[1],2),h.lineEnd()),d=k;else if(i&&d&&n^T){var M;!(C&f)&&(M=l(x,d,!0))&&(_=0,n?(h.lineStart(),h.point(M[0][0],M[0][1]),h.point(M[1][0],M[1][1]),h.lineEnd()):(h.point(M[1][0],M[1][1]),h.lineEnd(),h.lineStart(),h.point(M[0][0],M[0][1],3)))}T&&(!d||!Nh(d,x))&&h.point(x[0],x[1]),d=x,p=T,f=C},lineEnd:function(){p&&h.lineEnd(),d=null},clean:function(){return _|(m&&p)<<1}}}function l(h,d,f){var p=Cs(h),m=Cs(d),_=[1,0,0],y=Ao(p,m),b=wh(y,y),x=y[0],k=b-x*x;if(!k)return!f&&h;var T=e*b/k,C=-e*x/k,M=Ao(_,y),S=Th(_,T),R=Th(y,C);o2(S,R);var A=M,L=wh(S,A),v=wh(A,A),B=L*L-v*(wh(S,S)-1);if(!(B<0)){var w=Sr(B),D=Th(A,(-L-w)/v);if(o2(D,S),D=kh(D),!f)return D;var N=h[0],z=d[0],X=h[1],ct=d[1],J;z0^D[1]<(Ne(D[0]-N)Ae^(N<=D[0]&&D[0]<=z)){var ut=Th(A,(-L+w)/v);return o2(ut,S),[D,kh(ut)]}}}function u(h,d){var f=n?t:Ae-t,p=0;return h<-f?p|=1:h>f&&(p|=2),d<-f?p|=4:d>f&&(p|=8),p}return B6(s,o,a,n?[0,-t]:[-Ae,t-Ae])}function Eq(t,e,r,n,i,a){var s=t[0],o=t[1],l=e[0],u=e[1],h=0,d=1,f=l-s,p=u-o,m;if(m=r-s,!(!f&&m>0)){if(m/=f,f<0){if(m0){if(m>d)return;m>h&&(h=m)}if(m=i-s,!(!f&&m<0)){if(m/=f,f<0){if(m>d)return;m>h&&(h=m)}else if(f>0){if(m0)){if(m/=p,p<0){if(m0){if(m>d)return;m>h&&(h=m)}if(m=a-o,!(!p&&m<0)){if(m/=p,p<0){if(m>d)return;m>h&&(h=m)}else if(p>0){if(m0&&(t[0]=s+h*f,t[1]=o+h*p),d<1&&(e[0]=s+d*f,e[1]=o+d*p),!0}}}}}var Xl=1e9,Dh=-Xl;function Oh(t,e,r,n){function i(u,h){return t<=u&&u<=r&&e<=h&&h<=n}function a(u,h,d,f){var p=0,m=0;if(u==null||(p=s(u,d))!==(m=s(h,d))||l(u,h)<0^d>0)do f.point(p===0||p===3?t:r,p>1?n:e);while((p=(p+d+4)%4)!==m);else f.point(h[0],h[1])}function s(u,h){return Ne(u[0]-t)0?0:3:Ne(u[0]-r)0?2:1:Ne(u[1]-e)0?1:0:h>0?3:2}function o(u,h){return l(u.x,h.x)}function l(u,h){var d=s(u,1),f=s(h,1);return d!==f?d-f:d===0?h[1]-u[1]:d===1?u[0]-h[0]:d===2?u[1]-h[1]:h[0]-u[0]}return function(u){var h=u,d=L6(),f,p,m,_,y,b,x,k,T,C,M,S={point:R,lineStart:B,lineEnd:w,polygonStart:L,polygonEnd:v};function R(N,z){i(N,z)&&h.point(N,z)}function A(){for(var N=0,z=0,X=p.length;zn&&(W-lt)*(n-ut)>(tt-ut)*(t-lt)&&++N:tt<=n&&(W-lt)*(n-ut)<(tt-ut)*(t-lt)&&--N;return N}function L(){h=d,f=[],p=[],M=!0}function v(){var N=A(),z=M&&N,X=(f=j0(f)).length;(z||X)&&(u.polygonStart(),z&&(u.lineStart(),a(null,null,1,u),u.lineEnd()),X&&R6(f,o,N,a,u),u.polygonEnd()),h=u,f=p=m=null}function B(){S.point=D,p&&p.push(m=[]),C=!0,T=!1,x=k=NaN}function w(){f&&(D(_,y),b&&T&&d.rejoin(),f.push(d.result())),S.point=R,T&&h.lineEnd()}function D(N,z){var X=i(N,z);if(p&&m.push([N,z]),C)_=N,y=z,b=X,C=!1,X&&(h.lineStart(),h.point(N,z));else if(X&&T)h.point(N,z);else{var ct=[x=Math.max(Dh,Math.min(Xl,x)),k=Math.max(Dh,Math.min(Xl,k))],J=[N=Math.max(Dh,Math.min(Xl,N)),z=Math.max(Dh,Math.min(Xl,z))];Eq(ct,J,t,e,r,n)?(T||(h.lineStart(),h.point(ct[0],ct[1])),h.point(J[0],J[1]),X||h.lineEnd(),M=!1):X&&(h.lineStart(),h.point(N,z),M=!1)}x=N,k=z,T=X}return S}}function Cq(){var t=0,e=0,r=960,n=500,i,a,s;return s={stream:function(o){return i&&a===o?i:i=Oh(t,e,r,n)(a=o)},extent:function(o){return arguments.length?(t=+o[0][0],e=+o[0][1],r=+o[1][0],n=+o[1][1],i=a=null,s):[[t,e],[r,n]]}}}var b2,_2,Fh,Ph,Ro={sphere:Je,point:Je,lineStart:Sq,lineEnd:Je,polygonStart:Je,polygonEnd:Je};function Sq(){Ro.point=Mq,Ro.lineEnd=Aq}function Aq(){Ro.point=Ro.lineEnd=Je}function Mq(t,e){t*=re,e*=re,_2=t,Fh=Ht(e),Ph=Kt(e),Ro.point=Lq}function Lq(t,e){t*=re,e*=re;var r=Ht(e),n=Kt(e),i=Ne(t-_2),a=Kt(i),s=Ht(i),o=n*s,l=Ph*r-Fh*n*a,u=Fh*r+Ph*n*a;b2.add(Jr(Sr(o*o+l*l),u)),_2=t,Fh=r,Ph=n}function O6(t){return b2=new _r,ti(t,Ro),+b2}var v2=[null,null],Rq={type:"LineString",coordinates:v2};function qh(t,e){return v2[0]=t,v2[1]=e,O6(Rq)}var F6={Feature:function(t,e){return Vh(t.geometry,e)},FeatureCollection:function(t,e){for(var r=t.features,n=-1,i=r.length;++n0&&(i=qh(t[a],t[a-1]),i>0&&r<=i&&n<=i&&(r+n-i)*(1-Math.pow((r-n)/i,2))te}).map(f)).concat(Ca(mh(a/u)*u,i,u).filter(function(k){return Ne(k%d)>te}).map(p))}return b.lines=function(){return x().map(function(k){return{type:"LineString",coordinates:k}})},b.outline=function(){return{type:"Polygon",coordinates:[m(n).concat(_(s).slice(1),m(r).reverse().slice(1),_(o).reverse().slice(1))]}},b.extent=function(k){return arguments.length?b.extentMajor(k).extentMinor(k):b.extentMinor()},b.extentMajor=function(k){return arguments.length?(n=+k[0][0],r=+k[1][0],o=+k[0][1],s=+k[1][1],n>r&&(k=n,n=r,r=k),o>s&&(k=o,o=s,s=k),b.precision(y)):[[n,o],[r,s]]},b.extentMinor=function(k){return arguments.length?(e=+k[0][0],t=+k[1][0],a=+k[0][1],i=+k[1][1],e>t&&(k=e,e=t,t=k),a>i&&(k=a,a=i,i=k),b.precision(y)):[[e,a],[t,i]]},b.step=function(k){return arguments.length?b.stepMajor(k).stepMinor(k):b.stepMinor()},b.stepMajor=function(k){return arguments.length?(h=+k[0],d=+k[1],b):[h,d]},b.stepMinor=function(k){return arguments.length?(l=+k[0],u=+k[1],b):[l,u]},b.precision=function(k){return arguments.length?(y=+k,f=U6(a,i,90),p=W6(e,t,y),m=U6(o,s,90),_=W6(n,r,y),b):y},b.extentMajor([[-180,-90+te],[180,90-te]]).extentMinor([[-180,-80-te],[180,80+te]])}function Bq(){return H6()()}function Dq(t,e){var r=t[0]*re,n=t[1]*re,i=e[0]*re,a=e[1]*re,s=Kt(n),o=Ht(n),l=Kt(a),u=Ht(a),h=s*Kt(r),d=s*Ht(r),f=l*Kt(i),p=l*Ht(i),m=2*tn(Sr(a6(a-n)+s*l*a6(i-r))),_=Ht(m),y=m?function(b){var x=Ht(b*=m)/_,k=Ht(m-b)/_,T=k*h+x*f,C=k*d+x*p,M=k*o+x*u;return[Jr(C,T)*Ue,Jr(M,Sr(T*T+C*C))*Ue]}:function(){return[r*Ue,n*Ue]};return y.distance=m,y}const Kl=t=>t;var x2=new _r,k2=new _r,G6,j6,w2,T2,Da={point:Je,lineStart:Je,lineEnd:Je,polygonStart:function(){Da.lineStart=Oq,Da.lineEnd=Pq},polygonEnd:function(){Da.lineStart=Da.lineEnd=Da.point=Je,x2.add(Ne(k2)),k2=new _r},result:function(){var t=x2/2;return x2=new _r,t}};function Oq(){Da.point=Fq}function Fq(t,e){Da.point=$6,G6=w2=t,j6=T2=e}function $6(t,e){k2.add(T2*t-w2*e),w2=t,T2=e}function Pq(){$6(G6,j6)}const X6=Da;var Io=1/0,zh=Io,Zl=-Io,Yh=Zl,qq={point:Vq,lineStart:Je,lineEnd:Je,polygonStart:Je,polygonEnd:Je,result:function(){var t=[[Io,zh],[Zl,Yh]];return Zl=Yh=-(zh=Io=1/0),t}};function Vq(t,e){tZl&&(Zl=t),eYh&&(Yh=e)}const Uh=qq;var E2=0,C2=0,Ql=0,Wh=0,Hh=0,No=0,S2=0,A2=0,Jl=0,K6,Z6,Ai,Mi,ri={point:As,lineStart:Q6,lineEnd:J6,polygonStart:function(){ri.lineStart=Uq,ri.lineEnd=Wq},polygonEnd:function(){ri.point=As,ri.lineStart=Q6,ri.lineEnd=J6},result:function(){var t=Jl?[S2/Jl,A2/Jl]:No?[Wh/No,Hh/No]:Ql?[E2/Ql,C2/Ql]:[NaN,NaN];return E2=C2=Ql=Wh=Hh=No=S2=A2=Jl=0,t}};function As(t,e){E2+=t,C2+=e,++Ql}function Q6(){ri.point=zq}function zq(t,e){ri.point=Yq,As(Ai=t,Mi=e)}function Yq(t,e){var r=t-Ai,n=e-Mi,i=Sr(r*r+n*n);Wh+=i*(Ai+t)/2,Hh+=i*(Mi+e)/2,No+=i,As(Ai=t,Mi=e)}function J6(){ri.point=As}function Uq(){ri.point=Hq}function Wq(){tx(K6,Z6)}function Hq(t,e){ri.point=tx,As(K6=Ai=t,Z6=Mi=e)}function tx(t,e){var r=t-Ai,n=e-Mi,i=Sr(r*r+n*n);Wh+=i*(Ai+t)/2,Hh+=i*(Mi+e)/2,No+=i,i=Mi*t-Ai*e,S2+=i*(Ai+t),A2+=i*(Mi+e),Jl+=i*3,As(Ai=t,Mi=e)}const ex=ri;function rx(t){this._context=t}rx.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._context.closePath(),this._point=NaN},point:function(t,e){switch(this._point){case 0:{this._context.moveTo(t,e),this._point=1;break}case 1:{this._context.lineTo(t,e);break}default:{this._context.moveTo(t+this._radius,e),this._context.arc(t,e,this._radius,0,Qr);break}}},result:Je};var M2=new _r,L2,nx,ix,tc,ec,Gh={point:Je,lineStart:function(){Gh.point=Gq},lineEnd:function(){L2&&ax(nx,ix),Gh.point=Je},polygonStart:function(){L2=!0},polygonEnd:function(){L2=null},result:function(){var t=+M2;return M2=new _r,t}};function Gq(t,e){Gh.point=ax,nx=tc=t,ix=ec=e}function ax(t,e){tc-=t,ec-=e,M2.add(Sr(tc*tc+ec*ec)),tc=t,ec=e}const sx=Gh;function ox(){this._string=[]}ox.prototype={_radius:4.5,_circle:lx(4.5),pointRadius:function(t){return(t=+t)!==this._radius&&(this._radius=t,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._string.push("Z"),this._point=NaN},point:function(t,e){switch(this._point){case 0:{this._string.push("M",t,",",e),this._point=1;break}case 1:{this._string.push("L",t,",",e);break}default:{this._circle==null&&(this._circle=lx(this._radius)),this._string.push("M",t,",",e,this._circle);break}}},result:function(){if(this._string.length){var t=this._string.join("");return this._string=[],t}else return null}};function lx(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function jq(t,e){var r=4.5,n,i;function a(s){return s&&(typeof r=="function"&&i.pointRadius(+r.apply(this,arguments)),ti(s,n(i))),i.result()}return a.area=function(s){return ti(s,n(X6)),X6.result()},a.measure=function(s){return ti(s,n(sx)),sx.result()},a.bounds=function(s){return ti(s,n(Uh)),Uh.result()},a.centroid=function(s){return ti(s,n(ex)),ex.result()},a.projection=function(s){return arguments.length?(n=s==null?(t=null,Kl):(t=s).stream,a):t},a.context=function(s){return arguments.length?(i=s==null?(e=null,new ox):new rx(e=s),typeof r!="function"&&i.pointRadius(r),a):e},a.pointRadius=function(s){return arguments.length?(r=typeof s=="function"?s:(i.pointRadius(+s),+s),a):r},a.projection(t).context(e)}function $q(t){return{stream:rc(t)}}function rc(t){return function(e){var r=new R2;for(var n in t)r[n]=t[n];return r.stream=e,r}}function R2(){}R2.prototype={constructor:R2,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function I2(t,e,r){var n=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),n!=null&&t.clipExtent(null),ti(r,t.stream(Uh)),e(Uh.result()),n!=null&&t.clipExtent(n),t}function jh(t,e,r){return I2(t,function(n){var i=e[1][0]-e[0][0],a=e[1][1]-e[0][1],s=Math.min(i/(n[1][0]-n[0][0]),a/(n[1][1]-n[0][1])),o=+e[0][0]+(i-s*(n[1][0]+n[0][0]))/2,l=+e[0][1]+(a-s*(n[1][1]+n[0][1]))/2;t.scale(150*s).translate([o,l])},r)}function N2(t,e,r){return jh(t,[[0,0],e],r)}function B2(t,e,r){return I2(t,function(n){var i=+e,a=i/(n[1][0]-n[0][0]),s=(i-a*(n[1][0]+n[0][0]))/2,o=-a*n[0][1];t.scale(150*a).translate([s,o])},r)}function D2(t,e,r){return I2(t,function(n){var i=+e,a=i/(n[1][1]-n[0][1]),s=-a*n[0][0],o=(i-a*(n[1][1]+n[0][1]))/2;t.scale(150*a).translate([s,o])},r)}var cx=16,Xq=Kt(30*re);function ux(t,e){return+e?Zq(t,e):Kq(t)}function Kq(t){return rc({point:function(e,r){e=t(e,r),this.stream.point(e[0],e[1])}})}function Zq(t,e){function r(n,i,a,s,o,l,u,h,d,f,p,m,_,y){var b=u-n,x=h-i,k=b*b+x*x;if(k>4*e&&_--){var T=s+f,C=o+p,M=l+m,S=Sr(T*T+C*C+M*M),R=tn(M/=S),A=Ne(Ne(M)-1)e||Ne((b*w+x*D)/k-.5)>.3||s*f+o*p+l*m2?N[2]%360*re:0,w()):[o*Ue,l*Ue,u*Ue]},v.angle=function(N){return arguments.length?(d=N%360*re,w()):d*Ue},v.reflectX=function(N){return arguments.length?(f=N?-1:1,w()):f<0},v.reflectY=function(N){return arguments.length?(p=N?-1:1,w()):p<0},v.precision=function(N){return arguments.length?(M=ux(S,C=N*N),D()):Sr(C)},v.fitExtent=function(N,z){return jh(v,N,z)},v.fitSize=function(N,z){return N2(v,N,z)},v.fitWidth=function(N,z){return B2(v,N,z)},v.fitHeight=function(N,z){return D2(v,N,z)};function w(){var N=hx(r,0,0,f,p,d).apply(null,e(a,s)),z=hx(r,n-N[0],i-N[1],f,p,d);return h=g2(o,l,u),S=d2(e,z),R=d2(h,S),M=ux(S,C),D()}function D(){return A=L=null,v}return function(){return e=t.apply(this,arguments),v.invert=e.invert&&B,w()}}function F2(t){var e=0,r=Ae/3,n=O2(t),i=n(e,r);return i.parallels=function(a){return arguments.length?n(e=a[0]*re,r=a[1]*re):[e*Ue,r*Ue]},i}function eV(t){var e=Kt(t);function r(n,i){return[n*e,Ht(i)/e]}return r.invert=function(n,i){return[n/e,tn(i*e)]},r}function fx(t,e){var r=Ht(t),n=(r+Ht(e))/2;if(Ne(n)=.12&&y<.234&&_>=-.425&&_<-.214?i:y>=.166&&y<.234&&_>=-.214&&_<-.115?s:r).invert(f)},h.stream=function(f){return t&&e===f?t:t=rV([r.stream(e=f),i.stream(f),s.stream(f)])},h.precision=function(f){return arguments.length?(r.precision(f),i.precision(f),s.precision(f),d()):r.precision()},h.scale=function(f){return arguments.length?(r.scale(f),i.scale(f*.35),s.scale(f),h.translate(r.translate())):r.scale()},h.translate=function(f){if(!arguments.length)return r.translate();var p=r.scale(),m=+f[0],_=+f[1];return n=r.translate(f).clipExtent([[m-.455*p,_-.238*p],[m+.455*p,_+.238*p]]).stream(u),a=i.translate([m-.307*p,_+.201*p]).clipExtent([[m-.425*p+te,_+.12*p+te],[m-.214*p-te,_+.234*p-te]]).stream(u),o=s.translate([m-.205*p,_+.212*p]).clipExtent([[m-.214*p+te,_+.166*p+te],[m-.115*p-te,_+.234*p-te]]).stream(u),d()},h.fitExtent=function(f,p){return jh(h,f,p)},h.fitSize=function(f,p){return N2(h,f,p)},h.fitWidth=function(f,p){return B2(h,f,p)},h.fitHeight=function(f,p){return D2(h,f,p)};function d(){return t=e=null,h}return h.scale(1070)}function px(t){return function(e,r){var n=Kt(e),i=Kt(r),a=t(n*i);return a===1/0?[2,0]:[a*i*Ht(e),a*Ht(r)]}}function nc(t){return function(e,r){var n=Sr(e*e+r*r),i=t(n),a=Ht(i),s=Kt(i);return[Jr(e*a,n*s),tn(n&&r*a/n)]}}var P2=px(function(t){return Sr(2/(1+t))});P2.invert=nc(function(t){return 2*tn(t/2)});function iV(){return Li(P2).scale(124.75).clipAngle(180-.001)}var q2=px(function(t){return(t=i6(t))&&t/Ht(t)});q2.invert=nc(function(t){return t});function aV(){return Li(q2).scale(79.4188).clipAngle(180-.001)}function ic(t,e){return[t,bh(r2((rr+e)/2))]}ic.invert=function(t,e){return[t,2*So(n6(e))-rr]};function sV(){return gx(ic).scale(961/Qr)}function gx(t){var e=Li(t),r=e.center,n=e.scale,i=e.translate,a=e.clipExtent,s=null,o,l,u;e.scale=function(d){return arguments.length?(n(d),h()):n()},e.translate=function(d){return arguments.length?(i(d),h()):i()},e.center=function(d){return arguments.length?(r(d),h()):r()},e.clipExtent=function(d){return arguments.length?(d==null?s=o=l=u=null:(s=+d[0][0],o=+d[0][1],l=+d[1][0],u=+d[1][1]),h()):s==null?null:[[s,o],[l,u]]};function h(){var d=Ae*n(),f=e(S6(e.rotate()).invert([0,0]));return a(s==null?[[f[0]-d,f[1]-d],[f[0]+d,f[1]+d]]:t===ic?[[Math.max(f[0]-d,s),o],[Math.min(f[0]+d,l),u]]:[[s,Math.max(f[1]-d,o)],[l,Math.min(f[1]+d,u)]])}return h()}function Xh(t){return r2((rr+t)/2)}function yx(t,e){var r=Kt(t),n=t===e?Ht(t):bh(r/Kt(e))/bh(Xh(e)/Xh(t)),i=r*e2(Xh(t),n)/n;if(!n)return ic;function a(s,o){i>0?o<-rr+te&&(o=-rr+te):o>rr-te&&(o=rr-te);var l=i/e2(Xh(o),n);return[l*Ht(n*s),i-l*Kt(n*s)]}return a.invert=function(s,o){var l=i-o,u=Dn(n)*Sr(s*s+l*l),h=Jr(s,Ne(l))*Dn(l);return l*n<0&&(h-=Ae*Dn(s)*Dn(l)),[h/n,2*So(e2(i/u,1/n))-rr]},a}function oV(){return F2(yx).scale(109.5).parallels([30,30])}function ac(t,e){return[t,e]}ac.invert=ac;function lV(){return Li(ac).scale(152.63)}function mx(t,e){var r=Kt(t),n=t===e?Ht(t):(r-Kt(e))/(e-t),i=r/n+t;if(Ne(n)te&&--n>0);return[t/(.8707+(a=r*r)*(-.131979+a*(-.013791+a*a*a*(.003971-.001529*a)))),r]};function pV(){return Li(Y2).scale(175.295)}function U2(t,e){return[Kt(e)*Ht(t),Ht(e)]}U2.invert=nc(tn);function gV(){return Li(U2).scale(249.5).clipAngle(90+te)}function W2(t,e){var r=Kt(e),n=1+Kt(t)*r;return[r*Ht(t)/n,Ht(e)/n]}W2.invert=nc(function(t){return 2*So(t)});function yV(){return Li(W2).scale(250).clipAngle(142)}function H2(t,e){return[bh(r2((rr+e)/2)),-t]}H2.invert=function(t,e){return[-e,2*So(n6(t))-rr]};function mV(){var t=gx(H2),e=t.center,r=t.rotate;return t.center=function(n){return arguments.length?e([-n[1],n[0]]):(n=e(),[n[1],-n[0]])},t.rotate=function(n){return arguments.length?r([n[0],n[1],n.length>2?n[2]+90:90]):(n=r(),[n[0],n[1],n[2]-90])},r([0,0,90]).scale(159.155)}function bV(t,e){return t.parent===e.parent?1:2}function _V(t){return t.reduce(vV,0)/t.length}function vV(t,e){return t+e.x}function xV(t){return 1+t.reduce(kV,0)}function kV(t,e){return Math.max(t,e.y)}function wV(t){for(var e;e=t.children;)t=e[0];return t}function TV(t){for(var e;e=t.children;)t=e[e.length-1];return t}function EV(){var t=bV,e=1,r=1,n=!1;function i(a){var s,o=0;a.eachAfter(function(f){var p=f.children;p?(f.x=_V(p),f.y=xV(p)):(f.x=s?o+=t(f,s):0,f.y=0,s=f)});var l=wV(a),u=TV(a),h=l.x-t(l,u)/2,d=u.x+t(u,l)/2;return a.eachAfter(n?function(f){f.x=(f.x-a.x)*e,f.y=(a.y-f.y)*r}:function(f){f.x=(f.x-h)/(d-h)*e,f.y=(1-(a.y?f.y/a.y:1))*r})}return i.separation=function(a){return arguments.length?(t=a,i):t},i.size=function(a){return arguments.length?(n=!1,e=+a[0],r=+a[1],i):n?null:[e,r]},i.nodeSize=function(a){return arguments.length?(n=!0,e=+a[0],r=+a[1],i):n?[e,r]:null},i}function CV(t){var e=0,r=t.children,n=r&&r.length;if(!n)e=1;else for(;--n>=0;)e+=r[n].value;t.value=e}function SV(){return this.eachAfter(CV)}function AV(t,e){let r=-1;for(const n of this)t.call(e,n,++r,this);return this}function MV(t,e){for(var r=this,n=[r],i,a,s=-1;r=n.pop();)if(t.call(e,r,++s,this),i=r.children)for(a=i.length-1;a>=0;--a)n.push(i[a]);return this}function LV(t,e){for(var r=this,n=[r],i=[],a,s,o,l=-1;r=n.pop();)if(i.push(r),a=r.children)for(s=0,o=a.length;s=0;)r+=n[i].value;e.value=r})}function NV(t){return this.eachBefore(function(e){e.children&&e.children.sort(t)})}function BV(t){for(var e=this,r=DV(e,t),n=[e];e!==r;)e=e.parent,n.push(e);for(var i=n.length;t!==r;)n.splice(i,0,t),t=t.parent;return n}function DV(t,e){if(t===e)return t;var r=t.ancestors(),n=e.ancestors(),i=null;for(t=r.pop(),e=n.pop();t===e;)i=t,t=r.pop(),e=n.pop();return i}function OV(){for(var t=this,e=[t];t=t.parent;)e.push(t);return e}function FV(){return Array.from(this)}function PV(){var t=[];return this.eachBefore(function(e){e.children||t.push(e)}),t}function qV(){var t=this,e=[];return t.each(function(r){r!==t&&e.push({source:r.parent,target:r})}),e}function*VV(){var t=this,e,r=[t],n,i,a;do for(e=r.reverse(),r=[];t=e.pop();)if(yield t,n=t.children)for(i=0,a=n.length;i=0;--o)i.push(a=s[o]=new Ms(s[o])),a.parent=n,a.depth=n.depth+1;return r.eachBefore(bx)}function zV(){return G2(this).eachBefore(WV)}function YV(t){return t.children}function UV(t){return Array.isArray(t)?t[1]:null}function WV(t){t.data.value!==void 0&&(t.value=t.data.value),t.data=t.data.data}function bx(t){var e=0;do t.height=e;while((t=t.parent)&&t.height<++e)}function Ms(t){this.data=t,this.depth=this.height=0,this.parent=null}Ms.prototype=G2.prototype={constructor:Ms,count:SV,each:AV,eachAfter:LV,eachBefore:MV,find:RV,sum:IV,sort:NV,path:BV,ancestors:OV,descendants:FV,leaves:PV,links:qV,copy:zV,[Symbol.iterator]:VV};function Zh(t){return t==null?null:_x(t)}function _x(t){if(typeof t!="function")throw new Error;return t}function Ls(){return 0}function Bo(t){return function(){return t}}const HV=1664525,GV=1013904223,vx=4294967296;function j2(){let t=1;return()=>(t=(HV*t+GV)%vx)/vx}function jV(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function $V(t,e){let r=t.length,n,i;for(;r;)i=e()*r--|0,n=t[r],t[r]=t[i],t[i]=n;return t}function XV(t){return xx(t,j2())}function xx(t,e){for(var r=0,n=(t=$V(Array.from(t),e)).length,i=[],a,s;r0&&r*r>n*n+i*i}function $2(t,e){for(var r=0;r1e-6?(v+Math.sqrt(v*v-4*L*B))/(2*L):B/v);return{x:n+M+S*w,y:i+R+A*w,r:w}}function Tx(t,e,r){var n=t.x-e.x,i,a,s=t.y-e.y,o,l,u=n*n+s*s;u?(a=e.r+r.r,a*=a,l=t.r+r.r,l*=l,a>l?(i=(u+l-a)/(2*u),o=Math.sqrt(Math.max(0,l/u-i*i)),r.x=t.x-i*n-o*s,r.y=t.y-i*s+o*n):(i=(u+a-l)/(2*u),o=Math.sqrt(Math.max(0,a/u-i*i)),r.x=e.x+i*n-o*s,r.y=e.y+i*s+o*n)):(r.x=e.x+r.r,r.y=e.y)}function Ex(t,e){var r=t.r+e.r-1e-6,n=e.x-t.x,i=e.y-t.y;return r>0&&r*r>n*n+i*i}function Cx(t){var e=t._,r=t.next._,n=e.r+r.r,i=(e.x*r.r+r.x*e.r)/n,a=(e.y*r.r+r.y*e.r)/n;return i*i+a*a}function Jh(t){this._=t,this.next=null,this.previous=null}function Sx(t,e){if(!(a=(t=jV(t)).length))return 0;var r,n,i,a,s,o,l,u,h,d,f;if(r=t[0],r.x=0,r.y=0,!(a>1))return r.r;if(n=t[1],r.x=-n.r,n.x=r.r,n.y=0,!(a>2))return r.r+n.r;Tx(n,r,i=t[2]),r=new Jh(r),n=new Jh(n),i=new Jh(i),r.next=i.previous=n,n.next=r.previous=i,i.next=n.previous=r;t:for(l=3;loz(r(T,C,i))),x=b.map(Ix),k=new Set(b).add("");for(const T of x)k.has(T)||(k.add(T),b.push(T),x.push(Ix(T)),a.push(K2));s=(T,C)=>b[C],o=(T,C)=>x[C]}for(h=0,l=a.length;h=0&&(p=a[b],p.data===K2);--b)p.data=null}if(d.parent=nz,d.eachBefore(function(b){b.depth=b.parent.depth+1,--l}).eachBefore(bx),d.parent=null,l>0)throw new Error("cycle");return d}return n.id=function(i){return arguments.length?(t=Zh(i),n):t},n.parentId=function(i){return arguments.length?(e=Zh(i),n):e},n.path=function(i){return arguments.length?(r=Zh(i),n):r},n}function oz(t){t=`${t}`;let e=t.length;return Z2(t,e-1)&&!Z2(t,e-2)&&(t=t.slice(0,-1)),t[0]==="/"?t:`/${t}`}function Ix(t){let e=t.length;if(e<2)return"";for(;--e>1&&!Z2(t,e););return t.slice(0,e)}function Z2(t,e){if(t[e]==="/"){let r=0;for(;e>0&&t[--e]==="\\";)++r;if((r&1)===0)return!0}return!1}function lz(t,e){return t.parent===e.parent?1:2}function Q2(t){var e=t.children;return e?e[0]:t.t}function J2(t){var e=t.children;return e?e[e.length-1]:t.t}function cz(t,e,r){var n=r/(e.i-t.i);e.c-=n,e.s+=r,t.c+=n,e.z+=r,e.m+=r}function uz(t){for(var e=0,r=0,n=t.children,i=n.length,a;--i>=0;)a=n[i],a.z+=e,a.m+=e,e+=a.s+(r+=a.c)}function hz(t,e,r){return t.a.parent===e.parent?t.a:r}function tf(t,e){this._=t,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=e}tf.prototype=Object.create(Ms.prototype);function fz(t){for(var e=new tf(t,0),r,n=[e],i,a,s,o;r=n.pop();)if(a=r._.children)for(r.children=new Array(o=a.length),s=o-1;s>=0;--s)n.push(i=r.children[s]=new tf(a[s],s)),i.parent=r;return(e.parent=new tf(null,0)).children=[e],e}function dz(){var t=lz,e=1,r=1,n=null;function i(u){var h=fz(u);if(h.eachAfter(a),h.parent.m=-h.z,h.eachBefore(s),n)u.eachBefore(l);else{var d=u,f=u,p=u;u.eachBefore(function(x){x.xf.x&&(f=x),x.depth>p.depth&&(p=x)});var m=d===f?1:t(d,f)/2,_=m-d.x,y=e/(f.x+m+_),b=r/(p.depth||1);u.eachBefore(function(x){x.x=(x.x+_)*y,x.y=x.depth*b})}return u}function a(u){var h=u.children,d=u.parent.children,f=u.i?d[u.i-1]:null;if(h){uz(u);var p=(h[0].z+h[h.length-1].z)/2;f?(u.z=f.z+t(u._,f._),u.m=u.z-p):u.z=p}else f&&(u.z=f.z+t(u._,f._));u.parent.A=o(u,f,u.parent.A||d[0])}function s(u){u._.x=u.z+u.parent.m,u.m+=u.parent.m}function o(u,h,d){if(h){for(var f=u,p=u,m=h,_=f.parent.children[0],y=f.m,b=p.m,x=m.m,k=_.m,T;m=J2(m),f=Q2(f),m&&f;)_=Q2(_),p=J2(p),p.a=u,T=m.z+x-f.z-y+t(m._,f._),T>0&&(cz(hz(m,u,d),u,T),y+=T,b+=T),x+=m.m,y+=f.m,k+=_.m,b+=p.m;m&&!J2(p)&&(p.t=m,p.m+=x-b),f&&!Q2(_)&&(_.t=f,_.m+=y-k,d=u)}return d}function l(u){u.x*=e,u.y=u.depth*r}return i.separation=function(u){return arguments.length?(t=u,i):t},i.size=function(u){return arguments.length?(n=!1,e=+u[0],r=+u[1],i):n?null:[e,r]},i.nodeSize=function(u){return arguments.length?(n=!0,e=+u[0],r=+u[1],i):n?[e,r]:null},i}function ef(t,e,r,n,i){for(var a=t.children,s,o=-1,l=a.length,u=t.value&&(i-r)/t.value;++ox&&(x=u),M=y*y*C,k=Math.max(x/M,M/b),k>T){y-=u;break}T=k}s.push(l={value:y,dice:p1?n:1)},r}(Nx);function pz(){var t=Dx,e=!1,r=1,n=1,i=[0],a=Ls,s=Ls,o=Ls,l=Ls,u=Ls;function h(f){return f.x0=f.y0=0,f.x1=r,f.y1=n,f.eachBefore(d),i=[0],e&&f.eachBefore(Lx),f}function d(f){var p=i[f.depth],m=f.x0+p,_=f.y0+p,y=f.x1-p,b=f.y1-p;y=f-1){var x=a[d];x.x0=m,x.y0=_,x.x1=y,x.y1=b;return}for(var k=u[d],T=p/2+k,C=d+1,M=f-1;C>>1;u[S]b-_){var L=p?(m*A+y*R)/p:y;h(d,C,R,m,_,L,b),h(C,f,A,L,_,y,b)}else{var v=p?(_*A+b*R)/p:b;h(d,C,R,m,_,y,v),h(C,f,A,m,v,y,b)}}}function yz(t,e,r,n,i){(t.depth&1?ef:hc)(t,e,r,n,i)}const mz=function t(e){function r(n,i,a,s,o){if((l=n._squarify)&&l.ratio===e)for(var l,u,h,d,f=-1,p,m=l.length,_=n.value;++f1?n:1)},r}(Nx);function bz(t){for(var e=-1,r=t.length,n,i=t[r-1],a=0;++e1&&vz(t[r[n-2]],t[r[n-1]],t[i])<=0;)--n;r[n++]=i}return r.slice(0,n)}function kz(t){if((r=t.length)<3)return null;var e,r,n=new Array(r),i=new Array(r);for(e=0;e=0;--e)u.push(t[n[a[e]][2]]);for(e=+o;ea!=o>a&&i<(s-l)*(a-u)/(o-u)+l&&(h=!h),s=l,o=u;return h}function Tz(t){for(var e=-1,r=t.length,n=t[r-1],i,a,s=n[0],o=n[1],l=0;++e1);return n+i*o*Math.sqrt(-2*Math.log(s)/s)}}return r.source=t,r}(Ir),Sz=function t(e){var r=tp.source(e);function n(){var i=r.apply(this,arguments);return function(){return Math.exp(i())}}return n.source=t,n}(Ir),Fx=function t(e){function r(n){return(n=+n)<=0?()=>0:function(){for(var i=0,a=n;a>1;--a)i+=e();return i+a*e()}}return r.source=t,r}(Ir),Az=function t(e){var r=Fx.source(e);function n(i){if((i=+i)==0)return e;var a=r(i);return function(){return a()/i}}return n.source=t,n}(Ir),Mz=function t(e){function r(n){return function(){return-Math.log1p(-e())/n}}return r.source=t,r}(Ir),Lz=function t(e){function r(n){if((n=+n)<0)throw new RangeError("invalid alpha");return n=1/-n,function(){return Math.pow(1-e(),n)}}return r.source=t,r}(Ir),Rz=function t(e){function r(n){if((n=+n)<0||n>1)throw new RangeError("invalid p");return function(){return Math.floor(e()+n)}}return r.source=t,r}(Ir),Px=function t(e){function r(n){if((n=+n)<0||n>1)throw new RangeError("invalid p");return n===0?()=>1/0:n===1?()=>1:(n=Math.log1p(-n),function(){return 1+Math.floor(Math.log1p(-e())/n)})}return r.source=t,r}(Ir),ep=function t(e){var r=tp.source(e)();function n(i,a){if((i=+i)<0)throw new RangeError("invalid k");if(i===0)return()=>0;if(a=a==null?1:+a,i===1)return()=>-Math.log1p(-e())*a;var s=(i<1?i+1:i)-1/3,o=1/(3*Math.sqrt(s)),l=i<1?()=>Math.pow(e(),1/i):()=>1;return function(){do{do var u=r(),h=1+o*u;while(h<=0);h*=h*h;var d=1-e()}while(d>=1-.0331*u*u*u*u&&Math.log(d)>=.5*u*u+s*(1-h+Math.log(h)));return s*h*l()*a}}return n.source=t,n}(Ir),qx=function t(e){var r=ep.source(e);function n(i,a){var s=r(i),o=r(a);return function(){var l=s();return l===0?0:l/(l+o())}}return n.source=t,n}(Ir),Vx=function t(e){var r=Px.source(e),n=qx.source(e);function i(a,s){return a=+a,(s=+s)>=1?()=>a:s<=0?()=>0:function(){for(var o=0,l=a,u=s;l*u>16&&l*(1-u)>16;){var h=Math.floor((l+1)*u),d=n(h,l-h+1)();d<=u?(o+=h,l-=h,u=(u-d)/(1-d)):(l=h-1,u/=d)}for(var f=u<.5,p=f?u:1-u,m=r(p),_=m(),y=0;_<=l;++y)_+=m();return o+(f?y:l-y)}}return i.source=t,i}(Ir),Iz=function t(e){function r(n,i,a){var s;return(n=+n)==0?s=o=>-Math.log(o):(n=1/n,s=o=>Math.pow(o,n)),i=i==null?0:+i,a=a==null?1:+a,function(){return i+a*s(-Math.log1p(-e()))}}return r.source=t,r}(Ir),Nz=function t(e){function r(n,i){return n=n==null?0:+n,i=i==null?1:+i,function(){return n+i*Math.tan(Math.PI*e())}}return r.source=t,r}(Ir),Bz=function t(e){function r(n,i){return n=n==null?0:+n,i=i==null?1:+i,function(){var a=e();return n+i*Math.log(a/(1-a))}}return r.source=t,r}(Ir),Dz=function t(e){var r=ep.source(e),n=Vx.source(e);function i(a){return function(){for(var s=0,o=a;o>16;){var l=Math.floor(.875*o),u=r(l)();if(u>o)return s+n(l-1,o/u)();s+=l,o-=u}for(var h=-Math.log1p(-e()),d=0;h<=o;++d)h-=Math.log1p(-e());return s+d}}return i.source=t,i}(Ir),Oz=1664525,Fz=1013904223,zx=1/4294967296;function Pz(t=Math.random()){let e=(0<=t&&t<1?t/zx:Math.abs(t))|0;return()=>(e=Oz*e+Fz|0,zx*(e>>>0))}function On(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t);break}return this}function ta(t,e){switch(arguments.length){case 0:break;case 1:{typeof t=="function"?this.interpolator(t):this.range(t);break}default:{this.domain(t),typeof e=="function"?this.interpolator(e):this.range(e);break}}return this}const rp=Symbol("implicit");function rf(){var t=new kl,e=[],r=[],n=rp;function i(a){let s=t.get(a);if(s===void 0){if(n!==rp)return n;t.set(a,s=e.push(a)-1)}return r[s%r.length]}return i.domain=function(a){if(!arguments.length)return e.slice();e=[],t=new kl;for(const s of a)t.has(s)||t.set(s,e.push(s)-1);return i},i.range=function(a){return arguments.length?(r=Array.from(a),i):r.slice()},i.unknown=function(a){return arguments.length?(n=a,i):n},i.copy=function(){return rf(e,r).unknown(n)},On.apply(i,arguments),i}function np(){var t=rf().unknown(void 0),e=t.domain,r=t.range,n=0,i=1,a,s,o=!1,l=0,u=0,h=.5;delete t.unknown;function d(){var f=e().length,p=ie&&(r=t,t=e,e=r),function(n){return Math.max(t,Math.min(e,n))}}function Yz(t,e,r){var n=t[0],i=t[1],a=e[0],s=e[1];return i2?Uz:Yz,l=u=null,d}function d(f){return f==null||isNaN(f=+f)?a:(l||(l=o(t.map(n),e,r)))(n(s(f)))}return d.invert=function(f){return s(i((u||(u=o(e,t.map(n),Bn)))(f)))},d.domain=function(f){return arguments.length?(t=Array.from(f,nf),h()):t.slice()},d.range=function(f){return arguments.length?(e=Array.from(f),h()):e.slice()},d.rangeRound=function(f){return e=Array.from(f),r=Gu,h()},d.clamp=function(f){return arguments.length?(s=f?!0:an,h()):s!==an},d.interpolate=function(f){return arguments.length?(r=f,h()):r},d.unknown=function(f){return arguments.length?(a=f,d):a},function(f,p){return n=f,i=p,h()}}function ap(){return af()(an,an)}function Wx(t,e,r,n){var i=wl(t,e,r),a;switch(n=Co(n==null?",f":n),n.type){case"s":{var s=Math.max(Math.abs(t),Math.abs(e));return n.precision==null&&!isNaN(a=e6(i,s))&&(n.precision=a),Jd(n,s)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(a=r6(i,Math.max(Math.abs(t),Math.abs(e))))&&(n.precision=a-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(a=t6(i))&&(n.precision=a-(n.type==="%")*2);break}}return gh(n)}function Oa(t){var e=t.domain;return t.ticks=function(r){var n=e();return hs(n[0],n[n.length-1],r==null?10:r)},t.tickFormat=function(r,n){var i=e();return Wx(i[0],i[i.length-1],r==null?10:r,n)},t.nice=function(r){r==null&&(r=10);var n=e(),i=0,a=n.length-1,s=n[i],o=n[a],l,u,h=10;for(o0;){if(u=oo(s,o,r),u===l)return n[i]=s,n[a]=o,e(n);if(u>0)s=Math.floor(s/u)*u,o=Math.ceil(o/u)*u;else if(u<0)s=Math.ceil(s*u)/u,o=Math.floor(o*u)/u;else break;l=u}return t},t}function sp(){var t=ap();return t.copy=function(){return fc(t,sp())},On.apply(t,arguments),Oa(t)}function Hx(t){var e;function r(n){return n==null||isNaN(n=+n)?e:n}return r.invert=r,r.domain=r.range=function(n){return arguments.length?(t=Array.from(n,nf),r):t.slice()},r.unknown=function(n){return arguments.length?(e=n,r):e},r.copy=function(){return Hx(t).unknown(e)},t=arguments.length?Array.from(t,nf):[0,1],Oa(r)}function Gx(t,e){t=t.slice();var r=0,n=t.length-1,i=t[r],a=t[n],s;return aMath.pow(t,e)}function $z(t){return t===Math.E?Math.log:t===10&&Math.log10||t===2&&Math.log2||(t=Math.log(t),e=>Math.log(e)/t)}function Xx(t){return(e,r)=>-t(-e,r)}function op(t){const e=t(jx,$x),r=e.domain;let n=10,i,a;function s(){return i=$z(n),a=jz(n),r()[0]<0?(i=Xx(i),a=Xx(a),t(Wz,Hz)):t(jx,$x),e}return e.base=function(o){return arguments.length?(n=+o,s()):n},e.domain=function(o){return arguments.length?(r(o),s()):r()},e.ticks=o=>{const l=r();let u=l[0],h=l[l.length-1];const d=h0){for(;f<=p;++f)for(m=1;mh)break;b.push(_)}}else for(;f<=p;++f)for(m=n-1;m>=1;--m)if(_=f>0?m/a(-f):m*a(f),!(_h)break;b.push(_)}b.length*2{if(o==null&&(o=10),l==null&&(l=n===10?"s":","),typeof l!="function"&&(!(n%1)&&(l=Co(l)).precision==null&&(l.trim=!0),l=gh(l)),o===1/0)return l;const u=Math.max(1,n*o/e.ticks().length);return h=>{let d=h/a(Math.round(i(h)));return d*nr(Gx(r(),{floor:o=>a(Math.floor(i(o))),ceil:o=>a(Math.ceil(i(o)))})),e}function Kx(){const t=op(af()).domain([1,10]);return t.copy=()=>fc(t,Kx()).base(t.base()),On.apply(t,arguments),t}function Zx(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function Qx(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function lp(t){var e=1,r=t(Zx(e),Qx(e));return r.constant=function(n){return arguments.length?t(Zx(e=+n),Qx(e)):e},Oa(r)}function Jx(){var t=lp(af());return t.copy=function(){return fc(t,Jx()).constant(t.constant())},On.apply(t,arguments)}function t8(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function Xz(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function Kz(t){return t<0?-t*t:t*t}function cp(t){var e=t(an,an),r=1;function n(){return r===1?t(an,an):r===.5?t(Xz,Kz):t(t8(r),t8(1/r))}return e.exponent=function(i){return arguments.length?(r=+i,n()):r},Oa(e)}function up(){var t=cp(af());return t.copy=function(){return fc(t,up()).exponent(t.exponent())},On.apply(t,arguments),t}function Zz(){return up.apply(null,arguments).exponent(.5)}function e8(t){return Math.sign(t)*t*t}function Qz(t){return Math.sign(t)*Math.sqrt(Math.abs(t))}function r8(){var t=ap(),e=[0,1],r=!1,n;function i(a){var s=Qz(t(a));return isNaN(s)?n:r?Math.round(s):s}return i.invert=function(a){return t.invert(e8(a))},i.domain=function(a){return arguments.length?(t.domain(a),i):t.domain()},i.range=function(a){return arguments.length?(t.range((e=Array.from(a,nf)).map(e8)),i):e.slice()},i.rangeRound=function(a){return i.range(a).round(!0)},i.round=function(a){return arguments.length?(r=!!a,i):r},i.clamp=function(a){return arguments.length?(t.clamp(a),i):t.clamp()},i.unknown=function(a){return arguments.length?(n=a,i):n},i.copy=function(){return r8(t.domain(),e).round(r).clamp(t.clamp()).unknown(n)},On.apply(i,arguments),Oa(i)}function n8(){var t=[],e=[],r=[],n;function i(){var s=0,o=Math.max(1,e.length);for(r=new Array(o-1);++s0?r[o-1]:t[0],o=r?[n[r-1],e]:[n[u-1],n[u]]},s.unknown=function(l){return arguments.length&&(a=l),s},s.thresholds=function(){return n.slice()},s.copy=function(){return i8().domain([t,e]).range(i).unknown(a)},On.apply(Oa(s),arguments)}function a8(){var t=[.5],e=[0,1],r,n=1;function i(a){return a!=null&&a<=a?e[cs(t,a,0,n)]:r}return i.domain=function(a){return arguments.length?(t=Array.from(a),n=Math.min(t.length,e.length-1),i):t.slice()},i.range=function(a){return arguments.length?(e=Array.from(a),n=Math.min(t.length,e.length-1),i):e.slice()},i.invertExtent=function(a){var s=e.indexOf(a);return[t[s-1],t[s]]},i.unknown=function(a){return arguments.length?(r=a,i):r},i.copy=function(){return a8().domain(t).range(e).unknown(r)},On.apply(i,arguments)}var hp=new Date,fp=new Date;function xr(t,e,r,n){function i(a){return t(a=arguments.length===0?new Date:new Date(+a)),a}return i.floor=function(a){return t(a=new Date(+a)),a},i.ceil=function(a){return t(a=new Date(a-1)),e(a,1),t(a),a},i.round=function(a){var s=i(a),o=i.ceil(a);return a-s0))return l;do l.push(u=new Date(+a)),e(a,o),t(a);while(u=s)for(;t(s),!a(s);)s.setTime(s-1)},function(s,o){if(s>=s)if(o<0)for(;++o<=0;)for(;e(s,-1),!a(s););else for(;--o>=0;)for(;e(s,1),!a(s););})},r&&(i.count=function(a,s){return hp.setTime(+a),fp.setTime(+s),t(hp),t(fp),Math.floor(r(hp,fp))},i.every=function(a){return a=Math.floor(a),!isFinite(a)||!(a>0)?null:a>1?i.filter(n?function(s){return n(s)%a===0}:function(s){return i.count(0,s)%a===0}):i}),i}var sf=xr(function(){},function(t,e){t.setTime(+t+e)},function(t,e){return e-t});sf.every=function(t){return t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?xr(function(e){e.setTime(Math.floor(e/t)*t)},function(e,r){e.setTime(+e+r*t)},function(e,r){return(r-e)/t}):sf};const dp=sf;var s8=sf.range;const ea=1e3,Fn=ea*60,ra=Fn*60,Rs=ra*24,pp=Rs*7,o8=Rs*30,gp=Rs*365;var l8=xr(function(t){t.setTime(t-t.getMilliseconds())},function(t,e){t.setTime(+t+e*ea)},function(t,e){return(e-t)/ea},function(t){return t.getUTCSeconds()});const Fa=l8;var c8=l8.range,u8=xr(function(t){t.setTime(t-t.getMilliseconds()-t.getSeconds()*ea)},function(t,e){t.setTime(+t+e*Fn)},function(t,e){return(e-t)/Fn},function(t){return t.getMinutes()});const yp=u8;var Jz=u8.range,h8=xr(function(t){t.setTime(t-t.getMilliseconds()-t.getSeconds()*ea-t.getMinutes()*Fn)},function(t,e){t.setTime(+t+e*ra)},function(t,e){return(e-t)/ra},function(t){return t.getHours()});const mp=h8;var tY=h8.range,f8=xr(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*Fn)/Rs,t=>t.getDate()-1);const dc=f8;var eY=f8.range;function Is(t){return xr(function(e){e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},function(e,r){e.setDate(e.getDate()+r*7)},function(e,r){return(r-e-(r.getTimezoneOffset()-e.getTimezoneOffset())*Fn)/pp})}var Do=Is(0),pc=Is(1),d8=Is(2),p8=Is(3),Ns=Is(4),g8=Is(5),y8=Is(6),m8=Do.range,rY=pc.range,nY=d8.range,iY=p8.range,aY=Ns.range,sY=g8.range,oY=y8.range,b8=xr(function(t){t.setDate(1),t.setHours(0,0,0,0)},function(t,e){t.setMonth(t.getMonth()+e)},function(t,e){return e.getMonth()-t.getMonth()+(e.getFullYear()-t.getFullYear())*12},function(t){return t.getMonth()});const bp=b8;var lY=b8.range,_p=xr(function(t){t.setMonth(0,1),t.setHours(0,0,0,0)},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t,e){return e.getFullYear()-t.getFullYear()},function(t){return t.getFullYear()});_p.every=function(t){return!isFinite(t=Math.floor(t))||!(t>0)?null:xr(function(e){e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},function(e,r){e.setFullYear(e.getFullYear()+r*t)})};const Pa=_p;var cY=_p.range,_8=xr(function(t){t.setUTCSeconds(0,0)},function(t,e){t.setTime(+t+e*Fn)},function(t,e){return(e-t)/Fn},function(t){return t.getUTCMinutes()});const vp=_8;var uY=_8.range,v8=xr(function(t){t.setUTCMinutes(0,0,0)},function(t,e){t.setTime(+t+e*ra)},function(t,e){return(e-t)/ra},function(t){return t.getUTCHours()});const xp=v8;var hY=v8.range,x8=xr(function(t){t.setUTCHours(0,0,0,0)},function(t,e){t.setUTCDate(t.getUTCDate()+e)},function(t,e){return(e-t)/Rs},function(t){return t.getUTCDate()-1});const gc=x8;var fY=x8.range;function Bs(t){return xr(function(e){e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},function(e,r){e.setUTCDate(e.getUTCDate()+r*7)},function(e,r){return(r-e)/pp})}var Oo=Bs(0),yc=Bs(1),k8=Bs(2),w8=Bs(3),Ds=Bs(4),T8=Bs(5),E8=Bs(6),C8=Oo.range,dY=yc.range,pY=k8.range,gY=w8.range,yY=Ds.range,mY=T8.range,bY=E8.range,S8=xr(function(t){t.setUTCDate(1),t.setUTCHours(0,0,0,0)},function(t,e){t.setUTCMonth(t.getUTCMonth()+e)},function(t,e){return e.getUTCMonth()-t.getUTCMonth()+(e.getUTCFullYear()-t.getUTCFullYear())*12},function(t){return t.getUTCMonth()});const kp=S8;var _Y=S8.range,wp=xr(function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},function(t,e){t.setUTCFullYear(t.getUTCFullYear()+e)},function(t,e){return e.getUTCFullYear()-t.getUTCFullYear()},function(t){return t.getUTCFullYear()});wp.every=function(t){return!isFinite(t=Math.floor(t))||!(t>0)?null:xr(function(e){e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},function(e,r){e.setUTCFullYear(e.getUTCFullYear()+r*t)})};const qa=wp;var vY=wp.range;function A8(t,e,r,n,i,a){const s=[[Fa,1,ea],[Fa,5,5*ea],[Fa,15,15*ea],[Fa,30,30*ea],[a,1,Fn],[a,5,5*Fn],[a,15,15*Fn],[a,30,30*Fn],[i,1,ra],[i,3,3*ra],[i,6,6*ra],[i,12,12*ra],[n,1,Rs],[n,2,2*Rs],[r,1,pp],[e,1,o8],[e,3,3*o8],[t,1,gp]];function o(u,h,d){const f=hy).right(s,f);if(p===s.length)return t.every(wl(u/gp,h/gp,d));if(p===0)return dp.every(Math.max(wl(u,h,d),1));const[m,_]=s[f/s[p-1][2]53)return null;"w"in U||(U.w=1),"Z"in U?(j=Ep(mc(U.y,0,1)),P=j.getUTCDay(),j=P>4||P===0?yc.ceil(j):yc(j),j=gc.offset(j,(U.V-1)*7),U.y=j.getUTCFullYear(),U.m=j.getUTCMonth(),U.d=j.getUTCDate()+(U.w+6)%7):(j=Tp(mc(U.y,0,1)),P=j.getDay(),j=P>4||P===0?pc.ceil(j):pc(j),j=dc.offset(j,(U.V-1)*7),U.y=j.getFullYear(),U.m=j.getMonth(),U.d=j.getDate()+(U.w+6)%7)}else("W"in U||"U"in U)&&("w"in U||(U.w="u"in U?U.u%7:"W"in U?1:0),P="Z"in U?Ep(mc(U.y,0,1)).getUTCDay():Tp(mc(U.y,0,1)).getDay(),U.m=0,U.d="W"in U?(U.w+6)%7+U.W*7-(P+5)%7:U.w+U.U*7-(P+6)%7);return"Z"in U?(U.H+=U.Z/100|0,U.M+=U.Z%100,Ep(U)):Tp(U)}}function R(V,Q,q,U){for(var F=0,j=Q.length,P=q.length,et,at;F=P)return-1;if(et=Q.charCodeAt(F++),et===37){if(et=Q.charAt(F++),at=C[et in B8?Q.charAt(F++):et],!at||(U=at(V,q,U))<0)return-1}else if(et!=q.charCodeAt(U++))return-1}return U}function A(V,Q,q){var U=u.exec(Q.slice(q));return U?(V.p=h.get(U[0].toLowerCase()),q+U[0].length):-1}function L(V,Q,q){var U=p.exec(Q.slice(q));return U?(V.w=m.get(U[0].toLowerCase()),q+U[0].length):-1}function v(V,Q,q){var U=d.exec(Q.slice(q));return U?(V.w=f.get(U[0].toLowerCase()),q+U[0].length):-1}function B(V,Q,q){var U=b.exec(Q.slice(q));return U?(V.m=x.get(U[0].toLowerCase()),q+U[0].length):-1}function w(V,Q,q){var U=_.exec(Q.slice(q));return U?(V.m=y.get(U[0].toLowerCase()),q+U[0].length):-1}function D(V,Q,q){return R(V,e,Q,q)}function N(V,Q,q){return R(V,r,Q,q)}function z(V,Q,q){return R(V,n,Q,q)}function X(V){return s[V.getDay()]}function ct(V){return a[V.getDay()]}function J(V){return l[V.getMonth()]}function Y(V){return o[V.getMonth()]}function $(V){return i[+(V.getHours()>=12)]}function lt(V){return 1+~~(V.getMonth()/3)}function ut(V){return s[V.getUTCDay()]}function W(V){return a[V.getUTCDay()]}function tt(V){return l[V.getUTCMonth()]}function K(V){return o[V.getUTCMonth()]}function it(V){return i[+(V.getUTCHours()>=12)]}function Z(V){return 1+~~(V.getUTCMonth()/3)}return{format:function(V){var Q=M(V+="",k);return Q.toString=function(){return V},Q},parse:function(V){var Q=S(V+="",!1);return Q.toString=function(){return V},Q},utcFormat:function(V){var Q=M(V+="",T);return Q.toString=function(){return V},Q},utcParse:function(V){var Q=S(V+="",!0);return Q.toString=function(){return V},Q}}}var B8={"-":"",_:" ",0:"0"},Ar=/^\s*\d+/,xY=/^%/,kY=/[\\^$*+?|[\]().{}]/g;function Oe(t,e,r){var n=t<0?"-":"",i=(n?-t:t)+"",a=i.length;return n+(a[e.toLowerCase(),r]))}function TY(t,e,r){var n=Ar.exec(e.slice(r,r+1));return n?(t.w=+n[0],r+n[0].length):-1}function EY(t,e,r){var n=Ar.exec(e.slice(r,r+1));return n?(t.u=+n[0],r+n[0].length):-1}function CY(t,e,r){var n=Ar.exec(e.slice(r,r+2));return n?(t.U=+n[0],r+n[0].length):-1}function SY(t,e,r){var n=Ar.exec(e.slice(r,r+2));return n?(t.V=+n[0],r+n[0].length):-1}function AY(t,e,r){var n=Ar.exec(e.slice(r,r+2));return n?(t.W=+n[0],r+n[0].length):-1}function D8(t,e,r){var n=Ar.exec(e.slice(r,r+4));return n?(t.y=+n[0],r+n[0].length):-1}function O8(t,e,r){var n=Ar.exec(e.slice(r,r+2));return n?(t.y=+n[0]+(+n[0]>68?1900:2e3),r+n[0].length):-1}function MY(t,e,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(r,r+6));return n?(t.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function LY(t,e,r){var n=Ar.exec(e.slice(r,r+1));return n?(t.q=n[0]*3-3,r+n[0].length):-1}function RY(t,e,r){var n=Ar.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function F8(t,e,r){var n=Ar.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function IY(t,e,r){var n=Ar.exec(e.slice(r,r+3));return n?(t.m=0,t.d=+n[0],r+n[0].length):-1}function P8(t,e,r){var n=Ar.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function NY(t,e,r){var n=Ar.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function BY(t,e,r){var n=Ar.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function DY(t,e,r){var n=Ar.exec(e.slice(r,r+3));return n?(t.L=+n[0],r+n[0].length):-1}function OY(t,e,r){var n=Ar.exec(e.slice(r,r+6));return n?(t.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function FY(t,e,r){var n=xY.exec(e.slice(r,r+1));return n?r+n[0].length:-1}function PY(t,e,r){var n=Ar.exec(e.slice(r));return n?(t.Q=+n[0],r+n[0].length):-1}function qY(t,e,r){var n=Ar.exec(e.slice(r));return n?(t.s=+n[0],r+n[0].length):-1}function q8(t,e){return Oe(t.getDate(),e,2)}function VY(t,e){return Oe(t.getHours(),e,2)}function zY(t,e){return Oe(t.getHours()%12||12,e,2)}function YY(t,e){return Oe(1+dc.count(Pa(t),t),e,3)}function V8(t,e){return Oe(t.getMilliseconds(),e,3)}function UY(t,e){return V8(t,e)+"000"}function WY(t,e){return Oe(t.getMonth()+1,e,2)}function HY(t,e){return Oe(t.getMinutes(),e,2)}function GY(t,e){return Oe(t.getSeconds(),e,2)}function jY(t){var e=t.getDay();return e===0?7:e}function $Y(t,e){return Oe(Do.count(Pa(t)-1,t),e,2)}function z8(t){var e=t.getDay();return e>=4||e===0?Ns(t):Ns.ceil(t)}function XY(t,e){return t=z8(t),Oe(Ns.count(Pa(t),t)+(Pa(t).getDay()===4),e,2)}function KY(t){return t.getDay()}function ZY(t,e){return Oe(pc.count(Pa(t)-1,t),e,2)}function QY(t,e){return Oe(t.getFullYear()%100,e,2)}function JY(t,e){return t=z8(t),Oe(t.getFullYear()%100,e,2)}function tU(t,e){return Oe(t.getFullYear()%1e4,e,4)}function eU(t,e){var r=t.getDay();return t=r>=4||r===0?Ns(t):Ns.ceil(t),Oe(t.getFullYear()%1e4,e,4)}function rU(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+Oe(e/60|0,"0",2)+Oe(e%60,"0",2)}function Y8(t,e){return Oe(t.getUTCDate(),e,2)}function nU(t,e){return Oe(t.getUTCHours(),e,2)}function iU(t,e){return Oe(t.getUTCHours()%12||12,e,2)}function aU(t,e){return Oe(1+gc.count(qa(t),t),e,3)}function U8(t,e){return Oe(t.getUTCMilliseconds(),e,3)}function sU(t,e){return U8(t,e)+"000"}function oU(t,e){return Oe(t.getUTCMonth()+1,e,2)}function lU(t,e){return Oe(t.getUTCMinutes(),e,2)}function cU(t,e){return Oe(t.getUTCSeconds(),e,2)}function uU(t){var e=t.getUTCDay();return e===0?7:e}function hU(t,e){return Oe(Oo.count(qa(t)-1,t),e,2)}function W8(t){var e=t.getUTCDay();return e>=4||e===0?Ds(t):Ds.ceil(t)}function fU(t,e){return t=W8(t),Oe(Ds.count(qa(t),t)+(qa(t).getUTCDay()===4),e,2)}function dU(t){return t.getUTCDay()}function pU(t,e){return Oe(yc.count(qa(t)-1,t),e,2)}function gU(t,e){return Oe(t.getUTCFullYear()%100,e,2)}function yU(t,e){return t=W8(t),Oe(t.getUTCFullYear()%100,e,2)}function mU(t,e){return Oe(t.getUTCFullYear()%1e4,e,4)}function bU(t,e){var r=t.getUTCDay();return t=r>=4||r===0?Ds(t):Ds.ceil(t),Oe(t.getUTCFullYear()%1e4,e,4)}function _U(){return"+0000"}function H8(){return"%"}function G8(t){return+t}function j8(t){return Math.floor(+t/1e3)}var Fo,vc,$8,of,Cp;X8({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function X8(t){return Fo=N8(t),vc=Fo.format,$8=Fo.parse,of=Fo.utcFormat,Cp=Fo.utcParse,Fo}var K8="%Y-%m-%dT%H:%M:%S.%LZ";function vU(t){return t.toISOString()}var xU=Date.prototype.toISOString?vU:of(K8);const kU=xU;function wU(t){var e=new Date(t);return isNaN(e)?null:e}var TU=+new Date("2000-01-01T00:00:00.000Z")?wU:Cp(K8);const EU=TU;function CU(t){return new Date(t)}function SU(t){return t instanceof Date?+t:+new Date(+t)}function Sp(t,e,r,n,i,a,s,o,l,u){var h=ap(),d=h.invert,f=h.domain,p=u(".%L"),m=u(":%S"),_=u("%I:%M"),y=u("%I %p"),b=u("%a %d"),x=u("%b %d"),k=u("%B"),T=u("%Y");function C(M){return(l(M)e(i/(t.length-1)))},r.quantiles=function(n){return Array.from({length:n+1},(i,a)=>Cl(t,a/n))},r.copy=function(){return e7(e).domain(t)},ta.apply(r,arguments)}function cf(){var t=0,e=.5,r=1,n=1,i,a,s,o,l,u=an,h,d=!1,f;function p(_){return isNaN(_=+_)?f:(_=.5+((_=+h(_))-a)*(n*_O5(t[t.length-1]);var a7=new Array(3).concat("d8b365f5f5f55ab4ac","a6611adfc27d80cdc1018571","a6611adfc27df5f5f580cdc1018571","8c510ad8b365f6e8c3c7eae55ab4ac01665e","8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e","8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e","8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e","5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30","5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(Ee);const zU=We(a7);var s7=new Array(3).concat("af8dc3f7f7f77fbf7b","7b3294c2a5cfa6dba0008837","7b3294c2a5cff7f7f7a6dba0008837","762a83af8dc3e7d4e8d9f0d37fbf7b1b7837","762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837","762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837","762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837","40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b","40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(Ee);const YU=We(s7);var o7=new Array(3).concat("e9a3c9f7f7f7a1d76a","d01c8bf1b6dab8e1864dac26","d01c8bf1b6daf7f7f7b8e1864dac26","c51b7de9a3c9fde0efe6f5d0a1d76a4d9221","c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221","c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221","c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221","8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419","8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(Ee);const UU=We(o7);var l7=new Array(3).concat("998ec3f7f7f7f1a340","5e3c99b2abd2fdb863e66101","5e3c99b2abd2f7f7f7fdb863e66101","542788998ec3d8daebfee0b6f1a340b35806","542788998ec3d8daebf7f7f7fee0b6f1a340b35806","5427888073acb2abd2d8daebfee0b6fdb863e08214b35806","5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806","2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08","2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(Ee);const WU=We(l7);var c7=new Array(3).concat("ef8a62f7f7f767a9cf","ca0020f4a58292c5de0571b0","ca0020f4a582f7f7f792c5de0571b0","b2182bef8a62fddbc7d1e5f067a9cf2166ac","b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac","b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac","b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac","67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061","67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(Ee);const HU=We(c7);var u7=new Array(3).concat("ef8a62ffffff999999","ca0020f4a582bababa404040","ca0020f4a582ffffffbababa404040","b2182bef8a62fddbc7e0e0e09999994d4d4d","b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d","b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d","b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d","67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a","67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(Ee);const GU=We(u7);var h7=new Array(3).concat("fc8d59ffffbf91bfdb","d7191cfdae61abd9e92c7bb6","d7191cfdae61ffffbfabd9e92c7bb6","d73027fc8d59fee090e0f3f891bfdb4575b4","d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4","d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4","d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4","a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695","a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(Ee);const jU=We(h7);var f7=new Array(3).concat("fc8d59ffffbf91cf60","d7191cfdae61a6d96a1a9641","d7191cfdae61ffffbfa6d96a1a9641","d73027fc8d59fee08bd9ef8b91cf601a9850","d73027fc8d59fee08bffffbfd9ef8b91cf601a9850","d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850","d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850","a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837","a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(Ee);const $U=We(f7);var d7=new Array(3).concat("fc8d59ffffbf99d594","d7191cfdae61abdda42b83ba","d7191cfdae61ffffbfabdda42b83ba","d53e4ffc8d59fee08be6f59899d5943288bd","d53e4ffc8d59fee08bffffbfe6f59899d5943288bd","d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd","d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd","9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2","9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(Ee);const XU=We(d7);var p7=new Array(3).concat("e5f5f999d8c92ca25f","edf8fbb2e2e266c2a4238b45","edf8fbb2e2e266c2a42ca25f006d2c","edf8fbccece699d8c966c2a42ca25f006d2c","edf8fbccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(Ee);const KU=We(p7);var g7=new Array(3).concat("e0ecf49ebcda8856a7","edf8fbb3cde38c96c688419d","edf8fbb3cde38c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(Ee);const ZU=We(g7);var y7=new Array(3).concat("e0f3dba8ddb543a2ca","f0f9e8bae4bc7bccc42b8cbe","f0f9e8bae4bc7bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(Ee);const QU=We(y7);var m7=new Array(3).concat("fee8c8fdbb84e34a33","fef0d9fdcc8afc8d59d7301f","fef0d9fdcc8afc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(Ee);const JU=We(m7);var b7=new Array(3).concat("ece2f0a6bddb1c9099","f6eff7bdc9e167a9cf02818a","f6eff7bdc9e167a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(Ee);const tW=We(b7);var _7=new Array(3).concat("ece7f2a6bddb2b8cbe","f1eef6bdc9e174a9cf0570b0","f1eef6bdc9e174a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(Ee);const eW=We(_7);var v7=new Array(3).concat("e7e1efc994c7dd1c77","f1eef6d7b5d8df65b0ce1256","f1eef6d7b5d8df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(Ee);const rW=We(v7);var x7=new Array(3).concat("fde0ddfa9fb5c51b8a","feebe2fbb4b9f768a1ae017e","feebe2fbb4b9f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(Ee);const nW=We(x7);var k7=new Array(3).concat("edf8b17fcdbb2c7fb8","ffffcca1dab441b6c4225ea8","ffffcca1dab441b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(Ee);const iW=We(k7);var w7=new Array(3).concat("f7fcb9addd8e31a354","ffffccc2e69978c679238443","ffffccc2e69978c67931a354006837","ffffccd9f0a3addd8e78c67931a354006837","ffffccd9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(Ee);const aW=We(w7);var T7=new Array(3).concat("fff7bcfec44fd95f0e","ffffd4fed98efe9929cc4c02","ffffd4fed98efe9929d95f0e993404","ffffd4fee391fec44ffe9929d95f0e993404","ffffd4fee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(Ee);const sW=We(T7);var E7=new Array(3).concat("ffeda0feb24cf03b20","ffffb2fecc5cfd8d3ce31a1c","ffffb2fecc5cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(Ee);const oW=We(E7);var C7=new Array(3).concat("deebf79ecae13182bd","eff3ffbdd7e76baed62171b5","eff3ffbdd7e76baed63182bd08519c","eff3ffc6dbef9ecae16baed63182bd08519c","eff3ffc6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(Ee);const lW=We(C7);var S7=new Array(3).concat("e5f5e0a1d99b31a354","edf8e9bae4b374c476238b45","edf8e9bae4b374c47631a354006d2c","edf8e9c7e9c0a1d99b74c47631a354006d2c","edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(Ee);const cW=We(S7);var A7=new Array(3).concat("f0f0f0bdbdbd636363","f7f7f7cccccc969696525252","f7f7f7cccccc969696636363252525","f7f7f7d9d9d9bdbdbd969696636363252525","f7f7f7d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(Ee);const uW=We(A7);var M7=new Array(3).concat("efedf5bcbddc756bb1","f2f0f7cbc9e29e9ac86a51a3","f2f0f7cbc9e29e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(Ee);const hW=We(M7);var L7=new Array(3).concat("fee0d2fc9272de2d26","fee5d9fcae91fb6a4acb181d","fee5d9fcae91fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(Ee);const fW=We(L7);var R7=new Array(3).concat("fee6cefdae6be6550d","feeddefdbe85fd8d3cd94701","feeddefdbe85fd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(Ee);const dW=We(R7);function pW(t){return t=Math.max(0,Math.min(1,t)),"rgb("+Math.max(0,Math.min(255,Math.round(-4.54-t*(35.34-t*(2381.73-t*(6402.7-t*(7024.72-t*2710.57)))))))+", "+Math.max(0,Math.min(255,Math.round(32.49+t*(170.73+t*(52.82-t*(131.46-t*(176.58-t*67.37)))))))+", "+Math.max(0,Math.min(255,Math.round(81.24+t*(442.36-t*(2482.43-t*(6167.24-t*(6614.94-t*2475.67)))))))+")"}const gW=$u(Qn(300,.5,0),Qn(-240,.5,1));var yW=$u(Qn(-100,.75,.35),Qn(80,1.5,.8)),mW=$u(Qn(260,.75,.35),Qn(80,1.5,.8)),uf=Qn();function bW(t){(t<0||t>1)&&(t-=Math.floor(t));var e=Math.abs(t-.5);return uf.h=360*t-100,uf.s=1.5-1.5*e,uf.l=.8-.9*e,uf+""}var hf=po(),_W=Math.PI/3,vW=Math.PI*2/3;function xW(t){var e;return t=(.5-t)*Math.PI,hf.r=255*(e=Math.sin(t))*e,hf.g=255*(e=Math.sin(t+_W))*e,hf.b=255*(e=Math.sin(t+vW))*e,hf+""}function kW(t){return t=Math.max(0,Math.min(1,t)),"rgb("+Math.max(0,Math.min(255,Math.round(34.61+t*(1172.33-t*(10793.56-t*(33300.12-t*(38394.49-t*14825.05)))))))+", "+Math.max(0,Math.min(255,Math.round(23.31+t*(557.33+t*(1225.33-t*(3574.96-t*(1073.77+t*707.56)))))))+", "+Math.max(0,Math.min(255,Math.round(27.2+t*(3211.1-t*(15327.97-t*(27814-t*(22569.18-t*6838.66)))))))+")"}function ff(t){var e=t.length;return function(r){return t[Math.max(0,Math.min(e-1,Math.floor(r*e)))]}}const wW=ff(Ee("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725"));var TW=ff(Ee("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),EW=ff(Ee("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),CW=ff(Ee("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));function xe(t){return function(){return t}}const I7=Math.abs,qr=Math.atan2,na=Math.cos,SW=Math.max,Po=Math.min,gn=Math.sin,Ge=Math.sqrt,Vr=1e-12,za=Math.PI,df=za/2,Ya=2*za;function AW(t){return t>1?0:t<-1?za:Math.acos(t)}function N7(t){return t>=1?df:t<=-1?-df:Math.asin(t)}function MW(t){return t.innerRadius}function LW(t){return t.outerRadius}function RW(t){return t.startAngle}function IW(t){return t.endAngle}function NW(t){return t&&t.padAngle}function BW(t,e,r,n,i,a,s,o){var l=r-t,u=n-e,h=s-i,d=o-a,f=d*l-h*u;if(!(f*fD*D+N*N&&(R=L,A=v),{cx:R,cy:A,x01:-h,y01:-d,x11:R*(i/C-1),y11:A*(i/C-1)}}function gf(){var t=MW,e=LW,r=xe(0),n=null,i=RW,a=IW,s=NW,o=null;function l(){var u,h,d=+t.apply(this,arguments),f=+e.apply(this,arguments),p=i.apply(this,arguments)-df,m=a.apply(this,arguments)-df,_=I7(m-p),y=m>p;if(o||(o=u=Ra()),fVr))o.moveTo(0,0);else if(_>Ya-Vr)o.moveTo(f*na(p),f*gn(p)),o.arc(0,0,f,p,m,!y),d>Vr&&(o.moveTo(d*na(m),d*gn(m)),o.arc(0,0,d,m,p,y));else{var b=p,x=m,k=p,T=m,C=_,M=_,S=s.apply(this,arguments)/2,R=S>Vr&&(n?+n.apply(this,arguments):Ge(d*d+f*f)),A=Po(I7(f-d)/2,+r.apply(this,arguments)),L=A,v=A,B,w;if(R>Vr){var D=N7(R/d*gn(S)),N=N7(R/f*gn(S));(C-=D*2)>Vr?(D*=y?1:-1,k+=D,T-=D):(C=0,k=T=(p+m)/2),(M-=N*2)>Vr?(N*=y?1:-1,b+=N,x-=N):(M=0,b=x=(p+m)/2)}var z=f*na(b),X=f*gn(b),ct=d*na(T),J=d*gn(T);if(A>Vr){var Y=f*na(x),$=f*gn(x),lt=d*na(k),ut=d*gn(k),W;if(_Vr?v>Vr?(B=pf(lt,ut,z,X,f,v,y),w=pf(Y,$,ct,J,f,v,y),o.moveTo(B.cx+B.x01,B.cy+B.y01),vVr)||!(C>Vr)?o.lineTo(ct,J):L>Vr?(B=pf(ct,J,Y,$,d,-L,y),w=pf(z,X,lt,ut,d,-L,y),o.lineTo(B.cx+B.x01,B.cy+B.y01),L=f;--p)o.point(x[p],k[p]);o.lineEnd(),o.areaEnd()}y&&(x[d]=+t(_,d,h),k[d]=+e(_,d,h),o.point(n?+n(_,d,h):x[d],r?+r(_,d,h):k[d]))}if(b)return o=null,b+""||null}function u(){return Ua().defined(i).curve(s).context(a)}return l.x=function(h){return arguments.length?(t=typeof h=="function"?h:xe(+h),n=null,l):t},l.x0=function(h){return arguments.length?(t=typeof h=="function"?h:xe(+h),l):t},l.x1=function(h){return arguments.length?(n=h==null?null:typeof h=="function"?h:xe(+h),l):n},l.y=function(h){return arguments.length?(e=typeof h=="function"?h:xe(+h),r=null,l):e},l.y0=function(h){return arguments.length?(e=typeof h=="function"?h:xe(+h),l):e},l.y1=function(h){return arguments.length?(r=h==null?null:typeof h=="function"?h:xe(+h),l):r},l.lineX0=l.lineY0=function(){return u().x(t).y(e)},l.lineY1=function(){return u().x(t).y(r)},l.lineX1=function(){return u().x(n).y(e)},l.defined=function(h){return arguments.length?(i=typeof h=="function"?h:xe(!!h),l):i},l.curve=function(h){return arguments.length?(s=h,a!=null&&(o=s(a)),l):s},l.context=function(h){return arguments.length?(h==null?a=o=null:o=s(a=h),l):a},l}function OW(t,e){return et?1:e>=t?0:NaN}function FW(t){return t}function O7(){var t=FW,e=OW,r=null,n=xe(0),i=xe(Ya),a=xe(0);function s(o){var l,u=(o=yf(o)).length,h,d,f=0,p=new Array(u),m=new Array(u),_=+n.apply(this,arguments),y=Math.min(Ya,Math.max(-Ya,i.apply(this,arguments)-_)),b,x=Math.min(Math.abs(y)/u,a.apply(this,arguments)),k=x*(y<0?-1:1),T;for(l=0;l0&&(f+=T);for(e!=null?p.sort(function(C,M){return e(m[C],m[M])}):r!=null&&p.sort(function(C,M){return r(o[C],o[M])}),l=0,d=f?(y-u*k)/f:0;l0?T*d:0)+k,m[h]={data:o[h],index:l,value:T,startAngle:_,endAngle:b,padAngle:x};return m}return s.value=function(o){return arguments.length?(t=typeof o=="function"?o:xe(+o),s):t},s.sortValues=function(o){return arguments.length?(e=o,r=null,s):e},s.sort=function(o){return arguments.length?(r=o,e=null,s):r},s.startAngle=function(o){return arguments.length?(n=typeof o=="function"?o:xe(+o),s):n},s.endAngle=function(o){return arguments.length?(i=typeof o=="function"?o:xe(+o),s):i},s.padAngle=function(o){return arguments.length?(a=typeof o=="function"?o:xe(+o),s):a},s}var F7=Ip(yn);function P7(t){this._curve=t}P7.prototype={areaStart:function(){this._curve.areaStart()},areaEnd:function(){this._curve.areaEnd()},lineStart:function(){this._curve.lineStart()},lineEnd:function(){this._curve.lineEnd()},point:function(t,e){this._curve.point(e*Math.sin(t),e*-Math.cos(t))}};function Ip(t){function e(r){return new P7(t(r))}return e._curve=t,e}function xc(t){var e=t.curve;return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t.curve=function(r){return arguments.length?e(Ip(r)):e()._curve},t}function q7(){return xc(Ua().curve(F7))}function V7(){var t=D7().curve(F7),e=t.curve,r=t.lineX0,n=t.lineX1,i=t.lineY0,a=t.lineY1;return t.angle=t.x,delete t.x,t.startAngle=t.x0,delete t.x0,t.endAngle=t.x1,delete t.x1,t.radius=t.y,delete t.y,t.innerRadius=t.y0,delete t.y0,t.outerRadius=t.y1,delete t.y1,t.lineStartAngle=function(){return xc(r())},delete t.lineX0,t.lineEndAngle=function(){return xc(n())},delete t.lineX1,t.lineInnerRadius=function(){return xc(i())},delete t.lineY0,t.lineOuterRadius=function(){return xc(a())},delete t.lineY1,t.curve=function(s){return arguments.length?e(Ip(s)):e()._curve},t}function kc(t,e){return[(e=+e)*Math.cos(t-=Math.PI/2),e*Math.sin(t)]}class z7{constructor(e,r){this._context=e,this._x=r}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(e,r){switch(e=+e,r=+r,this._point){case 0:{this._point=1,this._line?this._context.lineTo(e,r):this._context.moveTo(e,r);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,r,e,r):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+r)/2,e,this._y0,e,r);break}}this._x0=e,this._y0=r}}class PW{constructor(e){this._context=e}lineStart(){this._point=0}lineEnd(){}point(e,r){if(e=+e,r=+r,this._point++===0)this._x0=e,this._y0=r;else{const n=kc(this._x0,this._y0),i=kc(this._x0,this._y0=(this._y0+r)/2),a=kc(e,this._y0),s=kc(e,r);this._context.moveTo(...n),this._context.bezierCurveTo(...i,...a,...s)}}}function Y7(t){return new z7(t,!0)}function U7(t){return new z7(t,!1)}function qW(t){return new PW(t)}function VW(t){return t.source}function zW(t){return t.target}function mf(t){let e=VW,r=zW,n=Lp,i=Rp,a=null,s=null;function o(){let l;const u=DW.call(arguments),h=e.apply(this,u),d=r.apply(this,u);if(a==null&&(s=t(l=Ra())),s.lineStart(),u[0]=h,s.point(+n.apply(this,u),+i.apply(this,u)),u[0]=d,s.point(+n.apply(this,u),+i.apply(this,u)),s.lineEnd(),l)return s=null,l+""||null}return o.source=function(l){return arguments.length?(e=l,o):e},o.target=function(l){return arguments.length?(r=l,o):r},o.x=function(l){return arguments.length?(n=typeof l=="function"?l:xe(+l),o):n},o.y=function(l){return arguments.length?(i=typeof l=="function"?l:xe(+l),o):i},o.context=function(l){return arguments.length?(l==null?a=s=null:s=t(a=l),o):a},o}function YW(){return mf(Y7)}function UW(){return mf(U7)}function WW(){const t=mf(qW);return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t}const HW=Ge(3),W7={draw(t,e){const r=Ge(e+Po(e/28,.75))*.59436,n=r/2,i=n*HW;t.moveTo(0,r),t.lineTo(0,-r),t.moveTo(-i,-n),t.lineTo(i,n),t.moveTo(-i,n),t.lineTo(i,-n)}},bf={draw(t,e){const r=Ge(e/za);t.moveTo(r,0),t.arc(0,0,r,0,Ya)}},H7={draw(t,e){const r=Ge(e/5)/2;t.moveTo(-3*r,-r),t.lineTo(-r,-r),t.lineTo(-r,-3*r),t.lineTo(r,-3*r),t.lineTo(r,-r),t.lineTo(3*r,-r),t.lineTo(3*r,r),t.lineTo(r,r),t.lineTo(r,3*r),t.lineTo(-r,3*r),t.lineTo(-r,r),t.lineTo(-3*r,r),t.closePath()}},G7=Ge(1/3),GW=G7*2,j7={draw(t,e){const r=Ge(e/GW),n=r*G7;t.moveTo(0,-r),t.lineTo(n,0),t.lineTo(0,r),t.lineTo(-n,0),t.closePath()}},$7={draw(t,e){const r=Ge(e)*.62625;t.moveTo(0,-r),t.lineTo(r,0),t.lineTo(0,r),t.lineTo(-r,0),t.closePath()}},X7={draw(t,e){const r=Ge(e-Po(e/7,2))*.87559;t.moveTo(-r,0),t.lineTo(r,0),t.moveTo(0,r),t.lineTo(0,-r)}},K7={draw(t,e){const r=Ge(e),n=-r/2;t.rect(n,n,r,r)}},Z7={draw(t,e){const r=Ge(e)*.4431;t.moveTo(r,r),t.lineTo(r,-r),t.lineTo(-r,-r),t.lineTo(-r,r),t.closePath()}},jW=.8908130915292852,Q7=gn(za/10)/gn(7*za/10),$W=gn(Ya/10)*Q7,XW=-na(Ya/10)*Q7,J7={draw(t,e){const r=Ge(e*jW),n=$W*r,i=XW*r;t.moveTo(0,-r),t.lineTo(n,i);for(let a=1;a<5;++a){const s=Ya*a/5,o=na(s),l=gn(s);t.lineTo(l*r,-o*r),t.lineTo(o*n-l*i,l*n+o*i)}t.closePath()}},Np=Ge(3),tk={draw(t,e){const r=-Ge(e/(Np*3));t.moveTo(0,r*2),t.lineTo(-Np*r,-r),t.lineTo(Np*r,-r),t.closePath()}},KW=Ge(3),ek={draw(t,e){const r=Ge(e)*.6824,n=r/2,i=r*KW/2;t.moveTo(0,-r),t.lineTo(i,n),t.lineTo(-i,n),t.closePath()}},Pn=-.5,qn=Ge(3)/2,Bp=1/Ge(12),ZW=(Bp/2+1)*3,rk={draw(t,e){const r=Ge(e/ZW),n=r/2,i=r*Bp,a=n,s=r*Bp+r,o=-a,l=s;t.moveTo(n,i),t.lineTo(a,s),t.lineTo(o,l),t.lineTo(Pn*n-qn*i,qn*n+Pn*i),t.lineTo(Pn*a-qn*s,qn*a+Pn*s),t.lineTo(Pn*o-qn*l,qn*o+Pn*l),t.lineTo(Pn*n+qn*i,Pn*i-qn*n),t.lineTo(Pn*a+qn*s,Pn*s-qn*a),t.lineTo(Pn*o+qn*l,Pn*l-qn*o),t.closePath()}},nk={draw(t,e){const r=Ge(e-Po(e/6,1.7))*.6189;t.moveTo(-r,-r),t.lineTo(r,r),t.moveTo(-r,r),t.lineTo(r,-r)}},ik=[bf,H7,j7,K7,J7,tk,rk],QW=[bf,X7,nk,ek,W7,Z7,$7];function JW(t,e){let r=null;t=typeof t=="function"?t:xe(t||bf),e=typeof e=="function"?e:xe(e===void 0?64:+e);function n(){let i;if(r||(r=i=Ra()),t.apply(this,arguments).draw(r,+e.apply(this,arguments)),i)return r=null,i+""||null}return n.type=function(i){return arguments.length?(t=typeof i=="function"?i:xe(i),n):t},n.size=function(i){return arguments.length?(e=typeof i=="function"?i:xe(+i),n):e},n.context=function(i){return arguments.length?(r=i==null?null:i,n):r},n}function Wa(){}function _f(t,e,r){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+r)/6)}function vf(t){this._context=t}vf.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:_f(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:_f(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function Os(t){return new vf(t)}function ak(t){this._context=t}ak.prototype={areaStart:Wa,areaEnd:Wa,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:_f(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function sk(t){return new ak(t)}function ok(t){this._context=t}ok.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+t)/6,n=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:_f(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function lk(t){return new ok(t)}function ck(t,e){this._basis=new vf(t),this._beta=e}ck.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,e=this._y,r=t.length-1;if(r>0)for(var n=t[0],i=e[0],a=t[r]-n,s=e[r]-i,o=-1,l;++o<=r;)l=o/r,this._basis.point(this._beta*t[o]+(1-this._beta)*(n+l*a),this._beta*e[o]+(1-this._beta)*(i+l*s));this._x=this._y=null,this._basis.lineEnd()},point:function(t,e){this._x.push(+t),this._y.push(+e)}};const tH=function t(e){function r(n){return e===1?new vf(n):new ck(n,e)}return r.beta=function(n){return t(+n)},r}(.85);function xf(t,e,r){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-e),t._y2+t._k*(t._y1-r),t._x2,t._y2)}function Dp(t,e){this._context=t,this._k=(1-e)/6}Dp.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:xf(this,this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2,this._x1=t,this._y1=e;break;case 2:this._point=3;default:xf(this,t,e);break}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const eH=function t(e){function r(n){return new Dp(n,e)}return r.tension=function(n){return t(+n)},r}(0);function Op(t,e){this._context=t,this._k=(1-e)/6}Op.prototype={areaStart:Wa,areaEnd:Wa,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:xf(this,t,e);break}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const rH=function t(e){function r(n){return new Op(n,e)}return r.tension=function(n){return t(+n)},r}(0);function Fp(t,e){this._context=t,this._k=(1-e)/6}Fp.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:xf(this,t,e);break}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const nH=function t(e){function r(n){return new Fp(n,e)}return r.tension=function(n){return t(+n)},r}(0);function Pp(t,e,r){var n=t._x1,i=t._y1,a=t._x2,s=t._y2;if(t._l01_a>Vr){var o=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,l=3*t._l01_a*(t._l01_a+t._l12_a);n=(n*o-t._x0*t._l12_2a+t._x2*t._l01_2a)/l,i=(i*o-t._y0*t._l12_2a+t._y2*t._l01_2a)/l}if(t._l23_a>Vr){var u=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,h=3*t._l23_a*(t._l23_a+t._l12_a);a=(a*u+t._x1*t._l23_2a-e*t._l12_2a)/h,s=(s*u+t._y1*t._l23_2a-r*t._l12_2a)/h}t._context.bezierCurveTo(n,i,a,s,t._x2,t._y2)}function uk(t,e){this._context=t,this._alpha=e}uk.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var r=this._x2-t,n=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3;default:Pp(this,t,e);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const iH=function t(e){function r(n){return e?new uk(n,e):new Dp(n,0)}return r.alpha=function(n){return t(+n)},r}(.5);function hk(t,e){this._context=t,this._alpha=e}hk.prototype={areaStart:Wa,areaEnd:Wa,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(t,e){if(t=+t,e=+e,this._point){var r=this._x2-t,n=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:Pp(this,t,e);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const aH=function t(e){function r(n){return e?new hk(n,e):new Op(n,0)}return r.alpha=function(n){return t(+n)},r}(.5);function fk(t,e){this._context=t,this._alpha=e}fk.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var r=this._x2-t,n=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Pp(this,t,e);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const sH=function t(e){function r(n){return e?new fk(n,e):new Fp(n,0)}return r.alpha=function(n){return t(+n)},r}(.5);function dk(t){this._context=t}dk.prototype={areaStart:Wa,areaEnd:Wa,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,e){t=+t,e=+e,this._point?this._context.lineTo(t,e):(this._point=1,this._context.moveTo(t,e))}};function pk(t){return new dk(t)}function gk(t){return t<0?-1:1}function yk(t,e,r){var n=t._x1-t._x0,i=e-t._x1,a=(t._y1-t._y0)/(n||i<0&&-0),s=(r-t._y1)/(i||n<0&&-0),o=(a*i+s*n)/(n+i);return(gk(a)+gk(s))*Math.min(Math.abs(a),Math.abs(s),.5*Math.abs(o))||0}function mk(t,e){var r=t._x1-t._x0;return r?(3*(t._y1-t._y0)/r-e)/2:e}function qp(t,e,r){var n=t._x0,i=t._y0,a=t._x1,s=t._y1,o=(a-n)/3;t._context.bezierCurveTo(n+o,i+o*e,a-o,s-o*r,a,s)}function kf(t){this._context=t}kf.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:qp(this,this._t0,mk(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var r=NaN;if(t=+t,e=+e,!(t===this._x1&&e===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,qp(this,mk(this,r=yk(this,t,e)),r);break;default:qp(this,this._t0,r=yk(this,t,e));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=r}}};function bk(t){this._context=new _k(t)}(bk.prototype=Object.create(kf.prototype)).point=function(t,e){kf.prototype.point.call(this,e,t)};function _k(t){this._context=t}_k.prototype={moveTo:function(t,e){this._context.moveTo(e,t)},closePath:function(){this._context.closePath()},lineTo:function(t,e){this._context.lineTo(e,t)},bezierCurveTo:function(t,e,r,n,i,a){this._context.bezierCurveTo(e,t,n,r,a,i)}};function vk(t){return new kf(t)}function xk(t){return new bk(t)}function kk(t){this._context=t}kk.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,e=this._y,r=t.length;if(r)if(this._line?this._context.lineTo(t[0],e[0]):this._context.moveTo(t[0],e[0]),r===2)this._context.lineTo(t[1],e[1]);else for(var n=wk(t),i=wk(e),a=0,s=1;s=0;--e)i[e]=(s[e]-i[e+1])/a[e];for(a[r-1]=(t[r]+i[r-1])/2,e=0;e=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var r=this._x*(1-this._t)+t*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,e)}break}}this._x=t,this._y=e}};function Ek(t){return new wf(t,.5)}function Ck(t){return new wf(t,0)}function Sk(t){return new wf(t,1)}function qo(t,e){if((s=t.length)>1)for(var r=1,n,i,a=t[e[0]],s,o=a.length;r=0;)r[e]=e;return r}function oH(t,e){return t[e]}function lH(t){const e=[];return e.key=t,e}function cH(){var t=xe([]),e=Vo,r=qo,n=oH;function i(a){var s=Array.from(t.apply(this,arguments),lH),o,l=s.length,u=-1,h;for(const d of a)for(o=0,++u;o0){for(var r,n,i=0,a=t[0].length,s;i0)for(var r,n=0,i,a,s,o,l,u=t[e[0]].length;n0?(i[0]=s,i[1]=s+=a):a<0?(i[1]=o,i[0]=o+=a):(i[0]=0,i[1]=a)}function fH(t,e){if((i=t.length)>0){for(var r=0,n=t[e[0]],i,a=n.length;r0)||!((a=(i=t[e[0]]).length)>0))){for(var r=0,n=1,i,a,s;na&&(a=i,r=e);return r}function Mk(t){var e=t.map(Lk);return Vo(t).sort(function(r,n){return e[r]-e[n]})}function Lk(t){for(var e=0,r=-1,n=t.length,i;++r()=>t;function bH(t,{sourceEvent:e,target:r,transform:n,dispatch:i}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},transform:{value:n,enumerable:!0,configurable:!0},_:{value:i}})}function Ri(t,e,r){this.k=t,this.x=e,this.y=r}Ri.prototype={constructor:Ri,scale:function(t){return t===1?this:new Ri(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new Ri(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Ef=new Ri(1,0,0);Rk.prototype=Ri.prototype;function Rk(t){for(;!t.__zoom;)if(!(t=t.parentNode))return Ef;return t.__zoom}function Vp(t){t.stopImmediatePropagation()}function wc(t){t.preventDefault(),t.stopImmediatePropagation()}function _H(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function vH(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t,t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]):[[0,0],[t.clientWidth,t.clientHeight]]}function Ik(){return this.__zoom||Ef}function xH(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function kH(){return navigator.maxTouchPoints||"ontouchstart"in this}function wH(t,e,r){var n=t.invertX(e[0][0])-r[0][0],i=t.invertX(e[1][0])-r[1][0],a=t.invertY(e[0][1])-r[0][1],s=t.invertY(e[1][1])-r[1][1];return t.translate(i>n?(n+i)/2:Math.min(0,n)||Math.max(0,i),s>a?(a+s)/2:Math.min(0,a)||Math.max(0,s))}function TH(){var t=_H,e=vH,r=wH,n=xH,i=kH,a=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],o=250,l=j5,u=fs("start","zoom","end"),h,d,f,p=500,m=150,_=0,y=10;function b(D){D.property("__zoom",Ik).on("wheel.zoom",R,{passive:!1}).on("mousedown.zoom",A).on("dblclick.zoom",L).filter(i).on("touchstart.zoom",v).on("touchmove.zoom",B).on("touchend.zoom touchcancel.zoom",w).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}b.transform=function(D,N,z,X){var ct=D.selection?D.selection():D;ct.property("__zoom",Ik),D!==ct?C(D,N,z,X):ct.interrupt().each(function(){M(this,arguments).event(X).start().zoom(null,typeof N=="function"?N.apply(this,arguments):N).end()})},b.scaleBy=function(D,N,z,X){b.scaleTo(D,function(){var ct=this.__zoom.k,J=typeof N=="function"?N.apply(this,arguments):N;return ct*J},z,X)},b.scaleTo=function(D,N,z,X){b.transform(D,function(){var ct=e.apply(this,arguments),J=this.__zoom,Y=z==null?T(ct):typeof z=="function"?z.apply(this,arguments):z,$=J.invert(Y),lt=typeof N=="function"?N.apply(this,arguments):N;return r(k(x(J,lt),Y,$),ct,s)},z,X)},b.translateBy=function(D,N,z,X){b.transform(D,function(){return r(this.__zoom.translate(typeof N=="function"?N.apply(this,arguments):N,typeof z=="function"?z.apply(this,arguments):z),e.apply(this,arguments),s)},null,X)},b.translateTo=function(D,N,z,X,ct){b.transform(D,function(){var J=e.apply(this,arguments),Y=this.__zoom,$=X==null?T(J):typeof X=="function"?X.apply(this,arguments):X;return r(Ef.translate($[0],$[1]).scale(Y.k).translate(typeof N=="function"?-N.apply(this,arguments):-N,typeof z=="function"?-z.apply(this,arguments):-z),J,s)},X,ct)};function x(D,N){return N=Math.max(a[0],Math.min(a[1],N)),N===D.k?D:new Ri(N,D.x,D.y)}function k(D,N,z){var X=N[0]-z[0]*D.k,ct=N[1]-z[1]*D.k;return X===D.x&&ct===D.y?D:new Ri(D.k,X,ct)}function T(D){return[(+D[0][0]+ +D[1][0])/2,(+D[0][1]+ +D[1][1])/2]}function C(D,N,z,X){D.on("start.zoom",function(){M(this,arguments).event(X).start()}).on("interrupt.zoom end.zoom",function(){M(this,arguments).event(X).end()}).tween("zoom",function(){var ct=this,J=arguments,Y=M(ct,J).event(X),$=e.apply(ct,J),lt=z==null?T($):typeof z=="function"?z.apply(ct,J):z,ut=Math.max($[1][0]-$[0][0],$[1][1]-$[0][1]),W=ct.__zoom,tt=typeof N=="function"?N.apply(ct,J):N,K=l(W.invert(lt).concat(ut/W.k),tt.invert(lt).concat(ut/tt.k));return function(it){if(it===1)it=tt;else{var Z=K(it),V=ut/Z[2];it=new Ri(V,lt[0]-Z[0]*V,lt[1]-Z[1]*V)}Y.zoom(null,it)}})}function M(D,N,z){return!z&&D.__zooming||new S(D,N)}function S(D,N){this.that=D,this.args=N,this.active=0,this.sourceEvent=null,this.extent=e.apply(D,N),this.taps=0}S.prototype={event:function(D){return D&&(this.sourceEvent=D),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(D,N){return this.mouse&&D!=="mouse"&&(this.mouse[1]=N.invert(this.mouse[0])),this.touch0&&D!=="touch"&&(this.touch0[1]=N.invert(this.touch0[0])),this.touch1&&D!=="touch"&&(this.touch1[1]=N.invert(this.touch1[0])),this.that.__zoom=N,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(D){var N=St(this.that).datum();u.call(D,this.that,new bH(D,{sourceEvent:this.sourceEvent,target:b,type:D,transform:this.that.__zoom,dispatch:u}),N)}};function R(D,...N){if(!t.apply(this,arguments))return;var z=M(this,N).event(D),X=this.__zoom,ct=Math.max(a[0],Math.min(a[1],X.k*Math.pow(2,n.apply(this,arguments)))),J=Tn(D);if(z.wheel)(z.mouse[0][0]!==J[0]||z.mouse[0][1]!==J[1])&&(z.mouse[1]=X.invert(z.mouse[0]=J)),clearTimeout(z.wheel);else{if(X.k===ct)return;z.mouse=[J,X.invert(J)],vs(this),z.start()}wc(D),z.wheel=setTimeout(Y,m),z.zoom("mouse",r(k(x(X,ct),z.mouse[0],z.mouse[1]),z.extent,s));function Y(){z.wheel=null,z.end()}}function A(D,...N){if(f||!t.apply(this,arguments))return;var z=D.currentTarget,X=M(this,N,!0).event(D),ct=St(D.view).on("mousemove.zoom",lt,!0).on("mouseup.zoom",ut,!0),J=Tn(D,z),Y=D.clientX,$=D.clientY;Nu(D.view),Vp(D),X.mouse=[J,this.__zoom.invert(J)],vs(this),X.start();function lt(W){if(wc(W),!X.moved){var tt=W.clientX-Y,K=W.clientY-$;X.moved=tt*tt+K*K>_}X.event(W).zoom("mouse",r(k(X.that.__zoom,X.mouse[0]=Tn(W,z),X.mouse[1]),X.extent,s))}function ut(W){ct.on("mousemove.zoom mouseup.zoom",null),Bu(W.view,X.moved),wc(W),X.event(W).end()}}function L(D,...N){if(!!t.apply(this,arguments)){var z=this.__zoom,X=Tn(D.changedTouches?D.changedTouches[0]:D,this),ct=z.invert(X),J=z.k*(D.shiftKey?.5:2),Y=r(k(x(z,J),X,ct),e.apply(this,N),s);wc(D),o>0?St(this).transition().duration(o).call(C,Y,X,D):St(this).call(b.transform,Y,X,D)}}function v(D,...N){if(!!t.apply(this,arguments)){var z=D.touches,X=z.length,ct=M(this,N,D.changedTouches.length===X).event(D),J,Y,$,lt;for(Vp(D),Y=0;Y"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Cf(t,e,r){return CH()?Cf=Reflect.construct:Cf=function(i,a,s){var o=[null];o.push.apply(o,a);var l=Function.bind.apply(i,o),u=new l;return s&&zp(u,s.prototype),u},Cf.apply(null,arguments)}function ni(t){return SH(t)||AH(t)||MH(t)||LH()}function SH(t){if(Array.isArray(t))return Yp(t)}function AH(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function MH(t,e){if(!!t){if(typeof t=="string")return Yp(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Yp(t,e)}}function Yp(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r1?r-1:0),i=1;i/gm),HH=Ii(/^data-[\-\w.\u00B7-\uFFFF]/),GH=Ii(/^aria-[\-\w]+$/),jH=Ii(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),$H=Ii(/^(?:\w+script|data):/i),XH=Ii(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),KH=Ii(/^html$/i),ZH=function(){return typeof window>"u"?null:window},QH=function(e,r){if(Ha(e)!=="object"||typeof e.createPolicy!="function")return null;var n=null,i="data-tt-policy-suffix";r.currentScript&&r.currentScript.hasAttribute(i)&&(n=r.currentScript.getAttribute(i));var a="dompurify"+(n?"#"+n:"");try{return e.createPolicy(a,{createHTML:function(o){return o},createScriptURL:function(o){return o}})}catch{return console.warn("TrustedTypes policy "+a+" could not be created."),null}};function Vk(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ZH(),e=function(st){return Vk(st)};if(e.version="2.4.0",e.removed=[],!t||!t.document||t.document.nodeType!==9)return e.isSupported=!1,e;var r=t.document,n=t.document,i=t.DocumentFragment,a=t.HTMLTemplateElement,s=t.Node,o=t.Element,l=t.NodeFilter,u=t.NamedNodeMap,h=u===void 0?t.NamedNodeMap||t.MozNamedAttrMap:u,d=t.HTMLFormElement,f=t.DOMParser,p=t.trustedTypes,m=o.prototype,_=Mf(m,"cloneNode"),y=Mf(m,"nextSibling"),b=Mf(m,"childNodes"),x=Mf(m,"parentNode");if(typeof a=="function"){var k=n.createElement("template");k.content&&k.content.ownerDocument&&(n=k.content.ownerDocument)}var T=QH(p,r),C=T?T.createHTML(""):"",M=n,S=M.implementation,R=M.createNodeIterator,A=M.createDocumentFragment,L=M.getElementsByTagName,v=r.importNode,B={};try{B=Fs(n).documentMode?n.documentMode:{}}catch{}var w={};e.isSupported=typeof x=="function"&&S&&typeof S.createHTMLDocument<"u"&&B!==9;var D=UH,N=WH,z=HH,X=GH,ct=$H,J=XH,Y=jH,$=null,lt=Me({},[].concat(ni(Ok),ni(Hp),ni(Gp),ni(jp),ni(Fk))),ut=null,W=Me({},[].concat(ni(Pk),ni($p),ni(qk),ni(Lf))),tt=Object.seal(Object.create(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),K=null,it=null,Z=!0,V=!0,Q=!1,q=!1,U=!1,F=!1,j=!1,P=!1,et=!1,at=!1,It=!0,Lt=!1,Rt="user-content-",Ct=!0,pt=!1,mt={},vt=null,Tt=Me({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),ft=null,le=Me({},["audio","video","img","source","image","track"]),Dt=null,Gt=Me({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),$t="http://www.w3.org/1998/Math/MathML",Qt="http://www.w3.org/2000/svg",we="http://www.w3.org/1999/xhtml",jt=we,Ft=!1,zt,wt=["application/xhtml+xml","text/html"],bt="text/html",Et,kt=null,Ut=n.createElement("form"),gt=function(st){return st instanceof RegExp||st instanceof Function},he=function(st){kt&&kt===st||((!st||Ha(st)!=="object")&&(st={}),st=Fs(st),zt=wt.indexOf(st.PARSER_MEDIA_TYPE)===-1?zt=bt:zt=st.PARSER_MEDIA_TYPE,Et=zt==="application/xhtml+xml"?function(At){return At}:Af,$="ALLOWED_TAGS"in st?Me({},st.ALLOWED_TAGS,Et):lt,ut="ALLOWED_ATTR"in st?Me({},st.ALLOWED_ATTR,Et):W,Dt="ADD_URI_SAFE_ATTR"in st?Me(Fs(Gt),st.ADD_URI_SAFE_ATTR,Et):Gt,ft="ADD_DATA_URI_TAGS"in st?Me(Fs(le),st.ADD_DATA_URI_TAGS,Et):le,vt="FORBID_CONTENTS"in st?Me({},st.FORBID_CONTENTS,Et):Tt,K="FORBID_TAGS"in st?Me({},st.FORBID_TAGS,Et):{},it="FORBID_ATTR"in st?Me({},st.FORBID_ATTR,Et):{},mt="USE_PROFILES"in st?st.USE_PROFILES:!1,Z=st.ALLOW_ARIA_ATTR!==!1,V=st.ALLOW_DATA_ATTR!==!1,Q=st.ALLOW_UNKNOWN_PROTOCOLS||!1,q=st.SAFE_FOR_TEMPLATES||!1,U=st.WHOLE_DOCUMENT||!1,P=st.RETURN_DOM||!1,et=st.RETURN_DOM_FRAGMENT||!1,at=st.RETURN_TRUSTED_TYPE||!1,j=st.FORCE_BODY||!1,It=st.SANITIZE_DOM!==!1,Lt=st.SANITIZE_NAMED_PROPS||!1,Ct=st.KEEP_CONTENT!==!1,pt=st.IN_PLACE||!1,Y=st.ALLOWED_URI_REGEXP||Y,jt=st.NAMESPACE||we,st.CUSTOM_ELEMENT_HANDLING&>(st.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(tt.tagNameCheck=st.CUSTOM_ELEMENT_HANDLING.tagNameCheck),st.CUSTOM_ELEMENT_HANDLING&>(st.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(tt.attributeNameCheck=st.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),st.CUSTOM_ELEMENT_HANDLING&&typeof st.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(tt.allowCustomizedBuiltInElements=st.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),q&&(V=!1),et&&(P=!0),mt&&($=Me({},ni(Fk)),ut=[],mt.html===!0&&(Me($,Ok),Me(ut,Pk)),mt.svg===!0&&(Me($,Hp),Me(ut,$p),Me(ut,Lf)),mt.svgFilters===!0&&(Me($,Gp),Me(ut,$p),Me(ut,Lf)),mt.mathMl===!0&&(Me($,jp),Me(ut,qk),Me(ut,Lf))),st.ADD_TAGS&&($===lt&&($=Fs($)),Me($,st.ADD_TAGS,Et)),st.ADD_ATTR&&(ut===W&&(ut=Fs(ut)),Me(ut,st.ADD_ATTR,Et)),st.ADD_URI_SAFE_ATTR&&Me(Dt,st.ADD_URI_SAFE_ATTR,Et),st.FORBID_CONTENTS&&(vt===Tt&&(vt=Fs(vt)),Me(vt,st.FORBID_CONTENTS,Et)),Ct&&($["#text"]=!0),U&&Me($,["html","head","body"]),$.table&&(Me($,["tbody"]),delete K.tbody),sn&&sn(st),kt=st)},yt=Me({},["mi","mo","mn","ms","mtext"]),ne=Me({},["foreignobject","desc","title","annotation-xml"]),ve=Me({},["title","style","font","a","script"]),ye=Me({},Hp);Me(ye,Gp),Me(ye,zH);var be=Me({},jp);Me(be,YH);var Te=function(st){var At=x(st);(!At||!At.tagName)&&(At={namespaceURI:we,tagName:"template"});var Nt=Af(st.tagName),Jt=Af(At.tagName);return st.namespaceURI===Qt?At.namespaceURI===we?Nt==="svg":At.namespaceURI===$t?Nt==="svg"&&(Jt==="annotation-xml"||yt[Jt]):Boolean(ye[Nt]):st.namespaceURI===$t?At.namespaceURI===we?Nt==="math":At.namespaceURI===Qt?Nt==="math"&&ne[Jt]:Boolean(be[Nt]):st.namespaceURI===we?At.namespaceURI===Qt&&!ne[Jt]||At.namespaceURI===$t&&!yt[Jt]?!1:!be[Nt]&&(ve[Nt]||!ye[Nt]):!1},Wt=function(st){Tc(e.removed,{element:st});try{st.parentNode.removeChild(st)}catch{try{st.outerHTML=C}catch{st.remove()}}},se=function(st,At){try{Tc(e.removed,{attribute:At.getAttributeNode(st),from:At})}catch{Tc(e.removed,{attribute:null,from:At})}if(At.removeAttribute(st),st==="is"&&!ut[st])if(P||et)try{Wt(At)}catch{}else try{At.setAttribute(st,"")}catch{}},me=function(st){var At,Nt;if(j)st=""+st;else{var Jt=FH(st,/^[\r\n\t ]+/);Nt=Jt&&Jt[0]}zt==="application/xhtml+xml"&&(st=''+st+"");var ze=T?T.createHTML(st):st;if(jt===we)try{At=new f().parseFromString(ze,zt)}catch{}if(!At||!At.documentElement){At=S.createDocument(jt,"template",null);try{At.documentElement.innerHTML=Ft?"":ze}catch{}}var Pe=At.body||At.documentElement;return st&&Nt&&Pe.insertBefore(n.createTextNode(Nt),Pe.childNodes[0]||null),jt===we?L.call(At,U?"html":"body")[0]:U?At.documentElement:Pe},ue=function(st){return R.call(st.ownerDocument||st,st,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT,null,!1)},_a=function(st){return st instanceof d&&(typeof st.nodeName!="string"||typeof st.textContent!="string"||typeof st.removeChild!="function"||!(st.attributes instanceof h)||typeof st.removeAttribute!="function"||typeof st.setAttribute!="function"||typeof st.namespaceURI!="string"||typeof st.insertBefore!="function")},Hr=function(st){return Ha(s)==="object"?st instanceof s:st&&Ha(st)==="object"&&typeof st.nodeType=="number"&&typeof st.nodeName=="string"},Ie=function(st,At,Nt){!w[st]||OH(w[st],function(Jt){Jt.call(e,At,Nt,kt)})},oe=function(st){var At;if(Ie("beforeSanitizeElements",st,null),_a(st)||on(/[\u0080-\uFFFF]/,st.nodeName))return Wt(st),!0;var Nt=Et(st.nodeName);if(Ie("uponSanitizeElement",st,{tagName:Nt,allowedTags:$}),st.hasChildNodes()&&!Hr(st.firstElementChild)&&(!Hr(st.content)||!Hr(st.content.firstElementChild))&&on(/<[/\w]/g,st.innerHTML)&&on(/<[/\w]/g,st.textContent)||Nt==="select"&&on(/