Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Difference From:
[5d405be33e] Getting this ready for later benchmarking (user: yumaikas tags: trunk, date: 2017-01-01 10:23:54)
To:
[ee6ad01f10] Added some needed words to dicts (user: yumaikas tags: trunk, date: 2017-12-10 22:40:15)
Added CONTRIBUTING.md.
1 +This repository is a mirror of [pisc.junglecoder.com](https://pisc.junglecoder.com), so if you'd like to get the best view of the project, that's where you should be able to find it. 2 +I recommend opening an issue, or emailing me based on my profile before opening a PR. 3 + 4 +Right now I'm focusing on more tests, some basic performance improvements, and building up to a high quality IRC/Slack/Discord chat-bot frame work, hopefully one that can trade punches with Hubot. Contributions that focus in theses areas are more than welcome. 5 +
Deleted Fibionacci.pisc.
1 - 2 -/* 3 -Even Fibonacci numbers under 4 million 4 -*/ 5 - 6 -"std_lib.pisc" import 7 - 8 -: triplicate ( a -- a a a ) dup dup ; 9 -: max_fib ( -- const ) 4000000 ; 10 - 11 -/* TODO: This isn't working? 12 -: nth_fib ( a -- b ) 13 - :n 14 - 15 - $n 0 = [ 0 ] when 16 - $n 1 = [ 1 ] when 17 - $n 1 > [ 18 - $n [ 1 - nth_fib ] [ 2 - nth_fib ] bi + 19 - ] when 20 -; 21 -*/ 22 - 23 -: loop_fib ( n -- fib sum ) 24 - :n 25 - 0 triplicate :sum :fib :a 26 - 1 :b 27 - $n [ 28 - $a $b + :fib 29 - $b :a 30 - $fib :b 31 - $fib even? [ $fib $sum + :sum ] when 32 - ] times 33 - $fib 34 - $sum 35 -; 36 - 37 -: nth_fib ( n -- b ) 38 - :n 39 - 0 1 $n nth_fib_do 40 -; 41 - 42 -/* This is the tail-recursive version of fibionacci */ 43 -: nth_fib_do ( a b n -- q ) 44 - :n :b :a 45 - $n 0 > 46 - [ $b $a $b + $n 1 - nth_fib_do ] 47 - [ $a ] 48 - if 49 -;
Deleted FizzBuzz.pisc.
1 -/* 2 - Implementing fizzbuzz in PISC 3 -*/ 4 - 5 - 6 -/* Old version, very verbose 7 -: divisible? ( a b -- bool ) mod zero? ; 8 -: out-f ( a -- f ) print f ; 9 -get-locals 10 -0 :num 11 - 12 -100 [ 13 - t :unprinted 14 - $num inc :num 15 - $num 15 divisible? [ "FizzBuzz" out-f :unprinted ] when 16 - $num 5 divisible? $unprinted and [ "Buzz" out-f :unprinted ] when 17 - $num 3 divisible? $unprinted and [ "Fizz" out-f :unprinted ] when 18 - $unprinted [ $num print ] when 19 - ] times 20 -drop-locals 21 -*/ 22 - 23 -"std_lib.pisc" import 24 - 25 -: inc ( a -- a` ) 1 + ; 26 - 27 -get-locals 28 -0 !num /* Store 0 into num variable */ 29 -100 [ 30 - $num inc dup :num 31 - [ 3 divisor? [ "Buzz" ] [ "" ] if ] 32 - [ 5 divisor? [ "Fizz" ] [ "" ] if ] bi 33 - concat dup len 0 = [ drop $num ] when print 34 -] times 35 -drop-locals
Changes to ImageSchema.sql.
1 --- This is the schemda for a PISC image 1 +-- TODO: I don't think I'm going to use this, at least for the known future 2 +-- TODO: BoltDB seems like a better fit for now. 2 3 4 +-- This was the schemda for a PISC image 3 5 4 6 Create Table vocabulary ( 5 7 vocab_id INTEGER PRIMARY KEY, 6 8 vocab_name text NOT NULL, 7 9 -- TODO: figure out dependency tracking 8 10 ); 9 11 ................................................................................ 24 26 word_documentation TEXT NULL, 25 27 FOREIGN KEY(word_id) REFERENCES vocabulary(word_id) 26 28 ); 27 29 28 30 Create Table kv_store ( 29 31 ); 30 32 31 -------------------------------------------------- 32 -Search: /\*([^*]+)\*/ : ([\w-]+) (\( [^)]+\)) [^;]+; 33 -Replace: :DOC \2 \3 \1 ;
Changes to README.md.
1 1 # PISC 2 2 Position Independent Source Code. A small, stack-based, concatenative language. 3 3 4 4 ## About 5 5 6 -This is currently a small side project to see how far a small stack-based scripting language can go in spare time. Inspired by Factor (80%), Forth (5%) and Python (5%) and Tcl (5%) (not 100% inspired yet.) 7 -Plans are currently for an interperated language that uses a "arrays and hashtables" approach to data stucturing. 6 +PISC's source and documentation are hosted at [https://pisc.junglecoder.com/ ](https://pisc.junglecoder.com). 7 +A quick starter can be found at [PISC in Y Minutes](https://pisc.junglecoder.com/home/apps/fossil/PISC.fossil/wiki?name=PISC+in+Y+Minutes) 8 + 9 +## Building 10 + 11 +PISC requires go 1.9+ to build. Installation instructions [here](https://golang.org/doc/install) 12 + 13 +Once go is installed, you'll (currently) need to run `git clone https://github.com/yumaikas/PISC-mirror "$GOPATH/src/pisc"` 14 +Running `cd $GOPATH/src/pisc && go get -u && go build -o pisc` will fetch depenencies and get you a PISC executable. You can launch a REPL with `pisc -i` and play with it there. 15 + 16 +## Playground 8 17 9 -## TODO: 18 +PISC has a playground at https://pisc.junglecoder.com/playground/ 10 19 11 -If you can understand what is going on, please submit a pull request to add something that I'm missing. I'm not trying to compete with [factor](http://factorcode.org) or [forth](http://www.forth.com/forth/) for performance/features, but I trying out their style of programming to see how it goes. Ports of this interpretor to the language of your choice are welcome as well. 12 - 13 -With that in mind, things that I will be adding (or accepting PRs for) as [time](http://www.catb.org/jargon/html/C/copious-free-time.html) allows: 20 +## Flags 14 21 15 - - More tests for different combinators (if, loop, while) 16 - - A standard library build from a minimal core (this is a lot of the things below) 17 - - Stack shuffling combinators (see the ones in factor): 18 - -- drop ( x -- ) 19 - -- 2drop ( x y -- ) 20 - -- 3drop ( x y z -- ) 21 - -- nip ( x y -- y ) 22 - -- 2nip ( x y z -- z ) 23 - -- dup ( x -- x x ) 24 - -- 2dup ( x y -- x y x y ) 25 - -- 3dup ( x y z -- x y z ) 26 - -- 2over ( x y z -- x y z x y ) 27 - -- pick ( x y z -- x y z x ) 28 - -- swap ( x y -- y x ) 29 - - Add a way for modules to be added without a lot of major modifications in the core loop of the interp. 30 - - Math words. A lot is needed here, and in double/int versions ( >, <, =, -, +, div, mod ) 31 - - String manipulation words (concat, >upper, >lower, int>string, double>string, etc) 32 - - Array and map manipulating words (ways to define them, literals, member access, so on.) 33 - - A basic compliation step for reducing cache misses in the core loop (transforming words into constant lookup codes, so that word lookup isn't proportional to the number of words in the core loop) 34 - - STDIN/STDOUT words. 35 - - Regex facilties. 36 - - File i/o words 37 - - A plan for multiprocessing. (I want to pull from TCL on this one if I can) 38 - - Combinators for quotations, like bi and tri. 39 - - A plan for a module system. 40 - - Syscalls 41 - - shellout words. 42 - - struct words (when this thing allows for partial compilation or some such thing.) 43 - - Bindings to awesome libraries (SDL, Tk, ImageMagick) 22 +Running `pisc help` will dump out current information about avaiable flags 44 23 45 - 46 -.pisc is the file extension for these files.
Deleted SumsOf3And5.pisc.
1 -/* 2 -Sums below 1000 of 3 and 5 3 -*/ 4 - 5 -"std_lib.pisc" import 6 - 7 -: inc ( a -- b ) 1 + ; 8 - 9 -get-locals 10 -0 :n 11 - /* Maybe we can keep this on the stack? */ 12 -0 1000 [ /* Sum and loop count */ 13 - dup inc :n 14 - [ 5 divisor? ] [ 3 divisor? ] bi or [ $n + ] when 15 -] times 16 -print 17 -drop-locals
Deleted bathroom_stall.pisc.
1 -/* 2 -Solving this code golf problem http://codegolf.stackexchange.com/questions/89241/be-respectful-in-the-restroom 3 -*/ 4 - 5 - 6 -: respect ( stalls -- respectfulPostion ) 7 - 8 - <vector> :distances 9 - <vector> :full 10 - <vector> :empty 11 - 0 :i 12 - >string 13 - [ 14 - dup "1" str-eq [ [ $i vec-append ] $:full ] when 15 - "0" str-eq [ [ $i vec-append ] $:empty ] when 16 - [ 1 + ] $:i 17 - ] each-char 18 - 0 :i 19 - $empty [ :eElem 20 - 0 dup :dist :i 21 - $full [ :fElem 22 - [ $fElem $eElem - abs + ] $:dist 23 - [ 1 + ] $:i 24 - ] vec-each 25 - $dist $i 0.0 + / $eElem 2vector [ swap vec-append ] $:distances 26 - ] vec-each 27 - 0 :maxDist 28 - 0 :maxPos 29 - 30 - $distances dup print [ /* Pop the elements into vars */ 31 - dup []0 :dist []1 :pos 32 - $maxDist $dist < [ $pos :maxPos $dist :maxDist ] when 33 - ] vec-each 34 - $maxPos 35 - ;
Added bindata.go.
1 +// Code generated by go-bindata. 2 +// sources: 3 +// stdlib/bools.pisc 4 +// stdlib/debug.pisc 5 +// stdlib/dicts.pisc 6 +// stdlib/io.pisc 7 +// stdlib/locals.pisc 8 +// stdlib/loops.pisc 9 +// stdlib/math.pisc 10 +// stdlib/random.pisc 11 +// stdlib/shell.pisc 12 +// stdlib/std_lib.pisc 13 +// stdlib/strings.pisc 14 +// stdlib/symbols.pisc 15 +// stdlib/vectors.pisc 16 +// stdlib/with.pisc 17 +// DO NOT EDIT! 18 + 19 +package pisc 20 + 21 +import ( 22 + "bytes" 23 + "compress/gzip" 24 + "fmt" 25 + "io" 26 + "io/ioutil" 27 + "os" 28 + "path/filepath" 29 + "strings" 30 + "time" 31 +) 32 + 33 +func bindataRead(data []byte, name string) ([]byte, error) { 34 + gz, err := gzip.NewReader(bytes.NewBuffer(data)) 35 + if err != nil { 36 + return nil, fmt.Errorf("Read %q: %v", name, err) 37 + } 38 + 39 + var buf bytes.Buffer 40 + _, err = io.Copy(&buf, gz) 41 + clErr := gz.Close() 42 + 43 + if err != nil { 44 + return nil, fmt.Errorf("Read %q: %v", name, err) 45 + } 46 + if clErr != nil { 47 + return nil, err 48 + } 49 + 50 + return buf.Bytes(), nil 51 +} 52 + 53 +type asset struct { 54 + bytes []byte 55 + info os.FileInfo 56 +} 57 + 58 +type bindataFileInfo struct { 59 + name string 60 + size int64 61 + mode os.FileMode 62 + modTime time.Time 63 +} 64 + 65 +func (fi bindataFileInfo) Name() string { 66 + return fi.name 67 +} 68 +func (fi bindataFileInfo) Size() int64 { 69 + return fi.size 70 +} 71 +func (fi bindataFileInfo) Mode() os.FileMode { 72 + return fi.mode 73 +} 74 +func (fi bindataFileInfo) ModTime() time.Time { 75 + return fi.modTime 76 +} 77 +func (fi bindataFileInfo) IsDir() bool { 78 + return false 79 +} 80 +func (fi bindataFileInfo) Sys() interface{} { 81 + return nil 82 +} 83 + 84 +var _stdlibBoolsPisc = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xd2\xd7\xe2\x4a\xca\xcf\xcf\x29\xd6\x2b\xc8\x2c\x4e\xe6\xd2\xd2\xe7\xe2\x52\x56\xf0\x54\x48\x2f\x4d\x2d\x2e\x56\x28\xc9\xc8\x2c\x56\xc8\x2c\x56\x48\xcd\x2d\x28\xa9\x54\xc8\xcb\x2f\xb7\xe7\xe2\x02\x04\x00\x00\xff\xff\xcb\x3e\x17\xc6\x30\x00\x00\x00") 85 + 86 +func stdlibBoolsPiscBytes() ([]byte, error) { 87 + return bindataRead( 88 + _stdlibBoolsPisc, 89 + "stdlib/bools.pisc", 90 + ) 91 +} 92 + 93 +func stdlibBoolsPisc() (*asset, error) { 94 + bytes, err := stdlibBoolsPiscBytes() 95 + if err != nil { 96 + return nil, err 97 + } 98 + 99 + info := bindataFileInfo{name: "stdlib/bools.pisc", size: 48, mode: os.FileMode(436), modTime: time.Unix(1511943077, 0)} 100 + a := &asset{bytes: bytes, info: info} 101 + return a, nil 102 +} 103 + 104 +var _stdlibDebugPisc = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x6c\xcc\xb1\x0a\xc2\x30\x10\xc6\xf1\xbd\x4f\xf1\xd1\x49\x87\xbc\x40\x8b\x2e\xba\x3b\x38\x8a\x43\xb8\x9e\x26\x10\x72\xe1\x2e\x1a\x7d\x7b\x91\x2a\x74\xe8\xf6\xc1\x9f\xef\xd7\x0d\xc7\xd3\x01\x16\xa4\xb9\xa2\x7c\x8b\x2f\xd7\x44\x27\xc3\x06\xce\x61\x8b\x73\x90\x66\x68\x21\x52\xc0\xdc\x31\x77\xaf\x0c\x7a\xa8\x72\xae\xe9\x8d\x24\x7e\xe2\x09\x63\xb7\xe0\x92\x90\x4f\xab\xd0\xaf\x7c\x89\x98\xff\x0a\x8c\xa4\x30\xc6\x6e\x58\xbb\x5f\x00\x79\xb2\x62\x6f\x55\x63\xbe\xa3\xc7\x0e\x3d\xac\xf9\x02\xab\xea\x48\x32\xf9\xba\x9c\x39\x16\x14\x8d\xb9\xe2\x0a\xf6\x14\x66\x0f\x23\x3e\x01\x00\x00\xff\xff\xd4\x33\x23\xc6\xf1\x00\x00\x00") 105 + 106 +func stdlibDebugPiscBytes() ([]byte, error) { 107 + return bindataRead( 108 + _stdlibDebugPisc, 109 + "stdlib/debug.pisc", 110 + ) 111 +} 112 + 113 +func stdlibDebugPisc() (*asset, error) { 114 + bytes, err := stdlibDebugPiscBytes() 115 + if err != nil { 116 + return nil, err 117 + } 118 + 119 + info := bindataFileInfo{name: "stdlib/debug.pisc", size: 241, mode: os.FileMode(436), modTime: time.Unix(1500942096, 0)} 120 + a := &asset{bytes: bytes, info: info} 121 + return a, nil 122 +} 123 + 124 +var _stdlibDictsPisc = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x8c\x94\xcd\x6e\xdb\x3a\x10\x85\xf7\x7a\x8a\x03\x43\x17\xb8\x16\x4a\x69\x2f\x1b\xf1\xa6\xed\xba\x68\x97\x86\x17\x8c\x34\xb2\x88\xc8\xa4\x4a\x8e\x1c\xf8\xed\x0b\x52\x3f\x96\x65\xa5\x69\x36\x49\x86\x67\x66\xbe\x39\x1c\x31\x4b\xf0\x55\x15\xac\x8c\x96\x56\x91\x83\xd4\x25\xb8\x26\x65\xd1\xb1\x6a\x14\xfb\x58\x92\x45\x51\x8e\x52\x15\x2c\x54\x25\xe8\xd2\xf2\x4d\x38\x96\xc5\x1b\xfe\x47\x9a\x42\x88\x70\x76\xc0\x16\x21\xda\x2b\x0e\x38\x62\xef\xe3\x2f\x38\xe1\xbd\x26\x8d\xdd\xac\x88\x36\x2c\xfc\xdf\x0f\x15\xb0\x45\xd9\xb5\xe0\x5b\x4b\xa6\xc2\x66\xe2\xba\x6d\xe0\xd8\x0a\x4d\xbf\xd7\x8b\x92\x76\x9d\xa5\x50\xaf\xd7\x3f\x55\x5d\x41\x7f\x22\xf1\x95\xce\xc4\xc2\x58\x51\x52\x25\xbb\xc6\xc3\x85\x93\x37\xba\x61\x0c\x09\x81\xab\x6c\x3a\xc2\x16\xf9\x18\xcb\xbd\x20\xf7\xd2\x08\xc3\x4f\x1c\x12\xe3\x90\xe9\x1b\xd5\xd2\x89\x37\x0a\xa6\x2c\x8f\xce\xc4\x38\xf9\xf0\x50\xed\x04\x55\x45\xbb\x28\xca\x12\x7c\x27\x2e\x6a\x54\xd6\x5c\x30\x1b\x2e\xc9\x22\xe4\x3f\x7e\x7e\x83\x78\x99\x13\xf6\x64\xe3\xb4\xbe\xea\x6e\xd2\xad\x09\x07\x6f\x8e\xc1\xf3\xbc\xc4\x09\xa5\x6a\xef\xc9\x71\x89\x1e\xe2\x17\xb1\xdf\x88\x90\x5a\x19\x0b\x89\xb3\xba\x92\xee\x89\xb4\xf1\x44\xc1\x91\x2f\x78\xed\x18\x0d\xc9\x2b\x05\xfd\x8c\xd8\xe8\x10\xe9\x8d\x9f\xf0\xf7\x7b\x31\x62\x79\x9e\x01\x6d\x7e\x65\x6d\xe7\xea\x69\x8a\x55\xf5\x20\x74\x61\xda\x69\xdc\x78\x31\xee\x36\x5c\x6c\x63\x8a\x61\xec\xa5\x3b\x4b\xfd\x83\x35\xbd\x2f\x2b\x05\xdc\xbb\x6c\xef\x5d\xf7\x22\xbe\xf3\x59\x2d\x2f\xb4\xda\xd9\xcd\x3a\xef\xff\x31\x67\xb0\x61\xc8\x8a\x3f\x30\x22\xec\xde\xc6\x9f\xd6\xd2\xe1\x95\xfc\x15\x51\x6b\xa9\x90\x4c\x65\x8a\xce\x11\xe2\xab\xb4\x1e\xd4\xff\x52\xda\x31\xc9\x72\x03\xb2\xd6\x58\x64\x49\x18\xf6\xde\x39\x4c\x37\x21\x27\xd9\x44\x1d\xff\xf5\xde\x46\x8a\xcf\x31\x3e\xe4\x38\x3e\x18\x3f\xac\xe5\x67\x6c\x7e\x53\xc3\xaa\x4a\x0d\xd2\x6c\x6f\x60\x03\xb6\x1d\x85\x9d\x25\x59\xd4\xe8\xb4\x2a\x4c\x49\x28\x6a\x69\x65\xc1\xe4\x7b\x83\x6b\xe5\xfc\xeb\xa2\xf4\x79\xf6\x61\xfd\x37\x0c\x78\x78\xda\x88\xe7\xb7\xa6\x07\x3c\xf6\x0f\xc0\xf4\x5f\xff\x95\x07\x50\x5e\xf0\x9e\x02\x8e\xf0\x18\x83\x6c\xb6\xba\x87\xb5\x55\x3c\x8c\x7b\x3e\x3d\x23\x53\x46\xba\xd0\xa7\xe9\xfc\x05\x28\x64\xd3\x60\x17\xfd\x09\x00\x00\xff\xff\x7e\x91\x17\xc6\xe5\x05\x00\x00") 125 + 126 +func stdlibDictsPiscBytes() ([]byte, error) { 127 + return bindataRead( 128 + _stdlibDictsPisc, 129 + "stdlib/dicts.pisc", 130 + ) 131 +} 132 + 133 +func stdlibDictsPisc() (*asset, error) { 134 + bytes, err := stdlibDictsPiscBytes() 135 + if err != nil { 136 + return nil, err 137 + } 138 + 139 + info := bindataFileInfo{name: "stdlib/dicts.pisc", size: 1509, mode: os.FileMode(436), modTime: time.Unix(1512944015, 0)} 140 + a := &asset{bytes: bytes, info: info} 141 + return a, nil 142 +} 143 + 144 +var _stdlibIoPisc = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x8c\x54\x41\x6f\xf3\x36\x0c\x3d\xd7\xbf\xe2\x01\x19\x90\xe6\x43\x9c\xef\x3a\xb4\xc0\x86\x21\x6d\x80\x5e\x96\x61\xeb\xb0\x4b\x81\x55\xb6\xe9\x58\x83\x22\x79\x12\xd5\xc0\xff\x7e\x20\x6d\x27\x59\xbb\x0e\xdf\x4d\x96\xc8\xf7\x1e\xc9\x47\x7f\xfd\x82\xe7\x8e\xf0\xb4\x87\xb3\x55\x34\xd1\x52\x42\x68\xf1\xcb\xd3\x6f\x5b\x7c\xf9\x5a\x14\xfa\x6e\x13\x9a\x50\xc3\x26\xbf\x64\xb4\x21\xc2\x20\xf5\x54\xdb\xd6\xd6\x38\x85\xd8\x48\xe4\xdd\xc3\x7e\x2b\x30\xb7\x28\x4b\xac\x50\x2c\xf0\x2b\x99\x86\x62\x2a\x8a\x6d\x8e\x91\x3c\xbb\x61\x3d\xe2\x76\x26\x21\x92\x69\xac\x3f\xc0\xf8\x06\xa7\x68\x59\xce\xa1\xfa\x8b\x6a\x4e\xe0\xce\x30\x4c\x24\x54\x21\xfb\x06\x1c\x90\x7d\x43\xd1\x0d\x12\x74\x08\xa8\x4c\xa2\x06\x55\x6e\x6d\x98\x73\x36\x78\x34\x75\xa7\xa8\x14\x95\x80\x3b\x42\x1b\x9c\x0b\x27\xc9\x6a\xb3\xaf\xd9\x06\x9f\xe0\x82\x69\xa8\x81\xf5\x1c\x60\x39\xa1\xb1\xfa\x60\xe2\x00\xf2\x2c\xf5\xdf\x15\xc5\x62\xa1\x50\x65\x35\x30\x8d\x15\xe9\x69\x55\x48\x4d\x09\x66\xfc\x6c\x63\x38\x2a\xcf\x44\x6b\x12\x8c\x17\xe4\x35\x12\xb1\x96\x74\x79\x4d\x78\xdc\xef\xa4\x16\x8e\x99\x60\x5b\x7d\x22\xdf\x48\xb7\x55\xab\x75\x04\xab\x8d\xa9\x3b\x6a\x2e\x1a\x62\xf6\x93\x06\x3d\x5d\x34\xfc\xfe\xbc\x2b\xbf\x1f\x2f\xdf\x29\xb9\x24\x3b\x3b\x27\x27\x8e\x57\xb9\x7a\xff\x2e\x6b\x0d\x8e\xf6\x78\x14\xd9\xcb\x97\xb8\xd4\xd1\x2c\x5f\xfc\x12\xa1\x3d\xab\x55\x64\x29\x44\x31\x1f\xf7\xbb\x1f\x15\x94\x73\xf4\xe9\x7f\x2b\x93\x91\x54\x44\x7e\xae\x6f\x8d\xd6\xb8\x44\x08\xdc\x51\x3c\xd9\x44\x45\x71\x5f\x8c\x26\x0a\x3d\xf9\x52\x92\xca\xa9\xaf\xb7\xe8\x0d\x77\x42\x38\x5a\x0a\x2b\xec\x04\x73\x6e\x6c\x67\xde\x08\x06\xaf\xb5\x0b\x89\x5e\x75\x8c\xc3\x68\xa2\xda\x78\x54\x84\xda\x38\x47\x6a\x24\x0d\x51\x55\x57\x96\x9a\x04\xfa\xc6\x11\x3e\x8a\x10\x77\xfe\x4b\xc4\x74\xb1\xc2\x1f\x7a\x48\x6a\xd5\x64\x8f\xbd\xa3\x28\xb4\x7e\x16\xb6\xc6\xe8\xc3\x41\x75\x04\xef\x86\x31\x57\xbb\x9f\x10\xa2\x0c\xc5\xfa\x43\xc2\x7d\x71\x33\xd2\xea\x7b\x39\x5e\xe3\x56\x87\xa6\xeb\xa4\x54\xfa\x29\x0e\xea\x08\x86\x59\xfb\x38\xab\x99\x75\x8f\x00\xd3\xd8\xbf\x39\x7d\x0d\xd3\xf7\xe4\x75\x23\x5f\xfc\x1c\x24\x33\x9c\x71\xa5\x15\xd2\x80\x1f\xce\xda\xe4\xe6\x67\x73\xa4\xc9\x5c\xdb\xe0\x99\x3c\x27\xac\x80\x9f\x90\xd9\x3a\xcb\xc3\x79\xef\xf4\xaf\x31\xef\x7c\x3a\x1a\xe7\x34\x3f\x8d\x7b\x38\xb5\x61\x83\x87\x00\x1f\x18\x59\x8c\xe1\xe1\x4c\x3c\xd0\x14\x77\x16\xd2\x47\xfb\xf6\x67\x9f\x39\x5d\xd7\x77\x75\x6b\xd3\xfb\xf1\xea\x1f\x2a\xcb\x2f\x43\x44\xf4\xd1\x7a\x5d\xcd\x37\xe3\xf2\x0c\x8c\x93\xe5\xae\x0c\x99\xfb\xcc\xf3\xa4\xff\xce\x81\x05\x7d\xb3\xc1\xaa\xb8\xb9\x93\xcf\xe2\xe6\x83\x2d\x9a\xdc\xe3\x3b\x0d\x15\x08\x6c\xd4\x60\x62\xe5\x05\x9e\xf7\x0f\xfb\x62\x81\x09\x7c\x6c\xb0\x70\xe0\x4c\x68\xfd\x27\x7c\xf8\x0f\xc2\x69\x19\x3e\x21\xfc\x27\x00\x00\xff\xff\xb2\x42\xc8\x50\xc8\x05\x00\x00") 145 + 146 +func stdlibIoPiscBytes() ([]byte, error) { 147 + return bindataRead( 148 + _stdlibIoPisc, 149 + "stdlib/io.pisc", 150 + ) 151 +} 152 + 153 +func stdlibIoPisc() (*asset, error) { 154 + bytes, err := stdlibIoPiscBytes() 155 + if err != nil { 156 + return nil, err 157 + } 158 + 159 + info := bindataFileInfo{name: "stdlib/io.pisc", size: 1480, mode: os.FileMode(436), modTime: time.Unix(1491353691, 0)} 160 + a := &asset{bytes: bytes, info: info} 161 + return a, nil 162 +} 163 + 164 +var _stdlibLocalsPisc = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x6c\x92\x4f\x8b\xdb\x30\x10\xc5\xef\xfe\x14\x0f\xb2\x87\x75\x16\x27\x77\x07\x0a\x25\x0d\x65\xa1\xb4\x61\x73\x0c\xa1\x0c\xf2\x38\x11\x49\x24\x57\x1a\x67\xfb\xf1\x8b\xfe\x38\xeb\xac\x7b\xd0\x41\xcc\x9b\xdf\xbc\xf9\xb3\x9c\xe3\x87\x55\x74\xf1\xd0\x06\xdb\xd7\xdd\x1a\xf3\x65\x51\xd4\xdf\x7e\xad\xe1\x59\xaa\x4b\x88\xe1\x19\x37\xba\xc0\xd0\x95\x51\x55\x28\xb1\x63\x49\x3f\xb1\x31\x82\x55\x4e\x39\x8e\x52\x06\x79\x10\x94\xf8\xce\x02\x39\x71\xf8\xf5\x0c\xf2\xde\x2a\x4d\xc2\x0d\xde\xb5\x9c\x40\x48\x59\x29\x3a\xc5\x79\x3c\xa7\xca\xdb\xde\x07\xb5\x17\x52\x67\xb4\x2e\x94\x68\xad\x43\x16\x59\x23\x36\x56\xc9\xff\x24\x1b\x68\x8d\xb3\xdd\x67\x9c\xed\x40\x99\x63\xdb\x3b\xa6\x6d\xa7\x94\x3b\x86\x49\x9d\xee\x4d\xfe\xe9\xad\x60\x8f\x33\x6e\xa8\xb0\x58\xe0\x10\xb8\x29\x6f\xb1\x40\x09\xbc\xf5\x06\x14\x65\x24\xda\x9a\xe8\x36\x10\x72\xc3\xda\xc4\x4a\xaa\x77\x8e\x8d\x3c\xf4\xb5\xdb\x6c\xea\x98\xf8\xa5\xd1\x4a\x62\xfd\xe5\x1c\x6b\xdb\x69\x6e\xd0\x3a\x7b\x45\x4b\x4a\xac\x0b\x0b\xab\xa1\x4e\x64\x8e\x3c\x38\xba\x91\xfb\x99\xc7\x1f\x6d\xf8\x77\xea\xb0\xc7\x7e\xb4\xa0\x03\xce\xcc\x1d\x0e\x68\x74\x17\xdf\xc7\xba\x57\x28\x8a\x19\xbe\x8a\xf0\xb5\x13\x6d\x8e\x61\xcd\x99\x9f\x17\x55\xd4\xdb\xb7\x0d\x9e\xea\xff\xd4\x2b\x07\x69\xf2\x1b\x8f\x0b\x5b\xc7\xad\xfe\xcb\x3e\x78\x9d\xe1\xd5\x28\xc7\xd7\xd0\x2f\x99\x06\x0d\xe7\x5f\x81\x48\xad\xaa\xd1\xf1\x94\x31\x9c\x7c\x55\x37\x72\x58\x65\xd5\xcb\xcb\x83\x4a\x9b\x4f\xaa\x62\x16\x4f\x2e\x14\xf0\x2c\xd9\x75\x4a\x7d\x9a\x1c\xe7\xc7\x54\x06\x7c\x3d\xb9\xf9\xd1\x78\x8a\x2c\xfa\x1d\x54\x71\x39\x8f\xb8\xa6\xef\x46\xc8\x38\xfb\xa0\xaa\x82\x91\xd5\xbf\x00\x00\x00\xff\xff\xaa\x09\x9f\x67\x71\x03\x00\x00") 165 + 166 +func stdlibLocalsPiscBytes() ([]byte, error) { 167 + return bindataRead( 168 + _stdlibLocalsPisc, 169 + "stdlib/locals.pisc", 170 + ) 171 +} 172 + 173 +func stdlibLocalsPisc() (*asset, error) { 174 + bytes, err := stdlibLocalsPiscBytes() 175 + if err != nil { 176 + return nil, err 177 + } 178 + 179 + info := bindataFileInfo{name: "stdlib/locals.pisc", size: 881, mode: os.FileMode(436), modTime: time.Unix(1504845781, 0)} 180 + a := &asset{bytes: bytes, info: info} 181 + return a, nil 182 +} 183 + 184 +var _stdlibLoopsPisc = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x7c\xcb\x31\x0a\x02\x31\x10\x46\xe1\x7e\x4e\xf1\x97\xeb\xc2\x66\x7b\x53\xaa\x9d\xe0\x15\x46\xe2\x80\x81\x98\x44\x67\xa2\x1e\x5f\x42\xac\xb7\x7d\x7c\x6f\x9d\xe9\x5c\x4a\x55\x57\xa3\x06\x9a\x57\xa2\xfd\xf1\x72\x80\xc5\x87\x28\x26\x64\x3c\x5b\x31\x2c\x0b\x9c\xc3\x0e\xa7\xaf\x84\x66\x02\xee\x95\x91\xff\xce\x8f\xe9\x73\x8f\x49\x30\xa1\xbe\xe4\xb6\xf9\x0d\xc8\xdd\x31\x92\x5c\xdf\xa2\x60\x63\xf8\x5f\x00\x00\x00\xff\xff\x8a\xf6\x37\x23\x8e\x00\x00\x00") 185 + 186 +func stdlibLoopsPiscBytes() ([]byte, error) { 187 + return bindataRead( 188 + _stdlibLoopsPisc, 189 + "stdlib/loops.pisc", 190 + ) 191 +} 192 + 193 +func stdlibLoopsPisc() (*asset, error) { 194 + bytes, err := stdlibLoopsPiscBytes() 195 + if err != nil { 196 + return nil, err 197 + } 198 + 199 + info := bindataFileInfo{name: "stdlib/loops.pisc", size: 142, mode: os.FileMode(436), modTime: time.Unix(1491353691, 0)} 200 + a := &asset{bytes: bytes, info: info} 201 + return a, nil 202 +} 203 + 204 +var _stdlibMathPisc = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x8c\x95\x4f\x6f\xe3\x36\x10\xc5\xef\xfa\x14\xef\xb8\x71\x23\x24\xca\xd1\x71\x1c\x74\xbd\xdd\xb6\xc0\xa2\x3e\x24\xb7\x20\x80\x29\x69\x24\x33\x95\x48\xed\x90\x8a\xed\x7e\xfa\x82\xb4\x6c\x51\xf2\x1f\xec\xcd\x30\x7f\xef\x0d\xf9\x38\x43\x4d\xbf\x2d\x17\x98\xe7\xba\x4d\x2b\xc2\x17\x6c\x11\xc7\xc8\x71\x83\x85\x26\xce\x08\x02\xaa\xad\x53\x62\x58\x0d\x81\x0e\x7b\x8c\xbc\x4a\x64\xda\x1c\x24\x3b\xdc\xe0\x77\xce\x90\x69\x23\x15\xe1\x11\x3d\xb2\x0e\x99\xbf\x76\x0d\x71\xaa\x2b\x99\x41\x9c\xc1\x8d\x54\x63\xc7\x13\xe0\x9a\xdf\x10\xb6\xe2\xc4\xcd\x0a\x55\x92\xb2\x03\xe6\x9a\xa1\xe7\x7b\x3c\x4b\xd9\x86\xf4\xa2\x4d\x09\xac\x75\x40\x90\xac\x06\x04\xc9\x4a\xaa\x12\xba\xe8\xf3\x6b\x98\x32\x69\xa4\x56\x87\x70\x8f\xe2\x61\xa0\x8b\x61\x3a\x57\xb2\x1c\xe5\x48\x5c\x84\xe0\x1f\xcc\x9a\x51\xb4\x2a\xb3\xae\x68\x40\x65\xc3\x72\x75\x53\x51\x4d\xca\x0a\xde\x81\x2e\x88\xb6\xcd\xc0\x7a\xdb\x68\x45\xca\x4a\x31\xa6\x1e\x42\xec\x75\xa3\x61\xd7\x84\x46\x6f\x88\x5d\x16\xab\xed\x2a\x84\xeb\x24\xa4\x57\xae\x48\x82\x78\x75\x8b\x5a\xf3\x21\x2f\x42\xa1\x19\xa6\x16\x55\xd5\xe5\x66\x70\xf4\x28\x2a\xad\x39\xf4\xf8\xee\xff\xf8\xa5\xd4\x4b\x51\xd7\x22\xd4\xfe\xe9\xff\x38\x1e\xfd\x75\xf9\x6d\x79\x84\x3f\xee\x43\xf2\xe3\x1e\x5f\xc9\x18\xaa\x4e\x83\xfa\x18\x1c\xe9\xbb\x64\x63\xf1\xaf\x54\xf9\x45\x41\xa5\xcb\x50\xf1\x8f\xb0\x2d\x8b\x0a\x3f\x74\x29\x58\xda\x75\x8d\x47\xf4\x64\x32\xd8\xc6\x0f\x5d\x22\x15\x86\x90\xdc\x87\x76\xc9\xe0\xaa\x56\x5b\x24\xf8\xcd\x97\x59\xdd\x22\x6d\xed\x3e\x5c\x91\x65\x2d\x0b\x4b\xd8\x48\xbb\xee\xe2\xfd\x14\x55\x4b\x26\xb4\x7a\x38\x5b\xee\x21\x44\xd2\x10\xf9\x2a\x95\x6f\xa2\xae\x3d\xdc\x45\x6c\x8f\xf0\x68\xca\x5f\x5c\xeb\x9e\xc4\x71\x65\xd2\xcd\x79\xc1\xcf\xe1\x6c\xbe\xfc\x6c\x05\x77\xd3\x79\x02\x8f\x9e\x86\xd7\xee\x59\x38\xc7\x5d\xda\x85\xbd\xa8\xe1\x56\x0d\x06\xeb\x6f\x65\xa9\x24\xde\xc7\xea\xa3\xb8\x85\x30\xc1\x7b\xda\x09\x77\x83\x4b\x5d\x72\x4e\x1c\xff\x47\xac\x4f\x5a\x46\x17\x7e\x9a\x0c\x65\x5a\xe5\xfb\xae\x3a\x7a\x24\xa7\x1e\x5a\xd1\x2f\x5a\xdc\x4d\x22\xd7\xed\x53\xb8\x2e\x70\xeb\x76\xa3\x21\xb8\x44\x2d\xec\xfa\x28\x36\xd1\xe4\x2e\x9a\xa2\xf6\xd7\x28\x90\xba\x6a\xbe\x71\x88\x71\x83\x87\xbc\x6d\x30\xc7\x1b\x94\x6c\xf0\x8e\x37\xe4\xac\xdd\x0f\x59\xb8\x0f\x07\x6a\xb1\xed\x55\x95\xe0\xd2\x8b\xd0\xcb\x3a\xfc\xa0\xf7\xb2\xe8\x6e\x82\x17\x5d\x93\x6b\x3b\x99\xed\x77\xe3\xf7\x40\x9f\xa4\x9e\xf1\x05\xca\xb9\x3d\xbb\xea\xa8\x75\x0e\x97\xda\xb3\x2f\x97\xcb\x4f\x69\x34\xef\x99\xfa\x40\x85\x4c\x34\xc5\x53\xbf\x23\xb7\x1a\xf7\x6b\x77\x13\xcc\x20\x0d\x44\xc5\x24\xf2\x1d\x72\x2a\xa4\xa2\x7c\x5f\x7c\x3e\xd2\xcd\xa0\xdc\x97\x20\x9a\x62\x36\x5a\xf1\x87\x9b\xe1\x0d\x4f\x78\x47\x2e\x1b\x68\xf6\xdc\x7c\x64\xf0\xd4\x39\x44\x53\x88\xd4\xf8\xc5\x38\x86\xc0\x0d\x9c\xc1\xbd\xb7\x88\x13\x4c\xf0\x8e\xcd\x9a\x5c\xcb\xfd\x1f\x00\x00\xff\xff\x5a\xd8\x7d\x5b\xc0\x07\x00\x00") 205 + 206 +func stdlibMathPiscBytes() ([]byte, error) { 207 + return bindataRead( 208 + _stdlibMathPisc, 209 + "stdlib/math.pisc", 210 + ) 211 +} 212 + 213 +func stdlibMathPisc() (*asset, error) { 214 + bytes, err := stdlibMathPiscBytes() 215 + if err != nil { 216 + return nil, err 217 + } 218 + 219 + info := bindataFileInfo{name: "stdlib/math.pisc", size: 1984, mode: os.FileMode(436), modTime: time.Unix(1500942096, 0)} 220 + a := &asset{bytes: bytes, info: info} 221 + return a, nil 222 +} 223 + 224 +var _stdlibRandomPisc = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x14\xca\xc1\x09\x80\x30\x0c\x40\xd1\x55\xfe\x51\x0f\x59\x40\xa7\x09\x49\xc0\x42\x9b\x16\xad\xba\xbe\x78\x7f\x1b\x76\xf4\x62\xc1\xc2\x13\x86\x08\x51\xa3\xb1\xe2\xf7\xa0\x46\x72\x6a\xba\x94\x9c\x5c\xaf\x0e\x5a\xf7\xdf\x89\x4e\xf6\x2f\x00\x00\xff\xff\x3c\x4d\xec\x7d\x3b\x00\x00\x00") 225 + 226 +func stdlibRandomPiscBytes() ([]byte, error) { 227 + return bindataRead( 228 + _stdlibRandomPisc, 229 + "stdlib/random.pisc", 230 + ) 231 +} 232 + 233 +func stdlibRandomPisc() (*asset, error) { 234 + bytes, err := stdlibRandomPiscBytes() 235 + if err != nil { 236 + return nil, err 237 + } 238 + 239 + info := bindataFileInfo{name: "stdlib/random.pisc", size: 59, mode: os.FileMode(436), modTime: time.Unix(1491353691, 0)} 240 + a := &asset{bytes: bytes, info: info} 241 + return a, nil 242 +} 243 + 244 +var _stdlibShellPisc = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x6c\x54\xcb\x6e\xdb\x3a\x10\x5d\x8b\x5f\x71\xc0\x78\xe1\x2c\x68\x38\x5b\x45\xd7\xc0\x7d\x24\xb7\xd9\xa4\x05\xd2\x9d\x23\x14\x8c\x38\x8e\x88\xd0\x24\x2b\x52\x36\xfa\xf7\xc5\x50\x7e\xb6\x5d\xd8\x20\xcf\xbc\xcf\x19\x4a\xd4\x70\x09\x73\x28\x85\x5b\x38\x9b\xb2\xda\x58\x47\x09\x6b\xc4\xc1\xfa\x8c\x16\x3b\xea\x14\xe9\xae\xc7\xbd\x10\x35\xac\x57\xc6\x0e\x98\x83\xff\xbf\x8f\x21\x73\xe4\x62\x81\x5b\x88\x2a\xee\x0d\xea\x38\xd0\x4e\x54\x6b\x74\x06\x2d\x8c\x8d\xe8\xb4\x73\xa2\x9a\x31\x8e\xce\x88\x92\x25\xf5\xe4\x9c\xda\x06\x33\x3a\xc2\xfc\x94\xe7\x56\x54\xcd\x8e\xba\x1c\x86\x15\xea\xa8\x73\xdf\xdb\x94\x39\xd9\xec\x78\x01\xd7\xe0\x8e\x74\x8c\xe4\xcd\xd9\x0b\x2d\xea\x38\xa6\xde\x5c\xbb\xb3\x6b\x0c\xf1\x4d\x77\x1f\x48\x7b\x1d\x7f\x09\x08\xd1\x08\x51\x35\xc6\x76\x79\x05\x33\x46\xd4\xa9\x07\x67\xb8\x60\xa2\x45\xd3\x28\x97\x18\x15\x55\x75\x45\x91\xa8\xaa\x8a\xa3\xd4\x6a\x1b\x0c\x41\x1a\x89\x94\x07\xd5\x05\x9f\xb5\xf5\x97\x24\xae\x61\x86\x10\xd1\xc2\x6e\x38\xea\x82\x55\x51\x1d\x0a\x98\x52\xb8\xcc\x00\xb9\x58\xc8\x89\xc1\xa6\x51\x63\x3c\x1b\x8e\x58\x57\xe6\xe4\xfe\x4f\x10\xcf\xc8\xe0\x3b\x65\xc5\x5d\xe8\xac\x78\xd6\x83\xbf\x2e\x3c\xca\x57\x7f\x6c\x71\x2c\x7d\x35\x8d\xda\x77\xae\x98\xbe\xfc\xfd\xf5\x93\x04\xf9\x9d\x7a\xa7\x83\x89\x21\xb6\x5d\x81\xe4\x8b\xbe\x6b\xa8\xd9\x9f\xa7\x6e\x27\x3f\x9b\x78\x53\x4a\xea\x17\x96\x1b\xcb\xc5\x9d\x9c\x4c\xdb\x60\xbc\xde\xd2\xb4\x0b\x7a\xff\xa1\xac\xb7\x19\x73\x84\x98\x6d\xf0\xe9\xb8\x52\xa2\xba\xc1\xbf\x03\xe9\x6c\xfd\x3b\x72\x4f\x48\x59\x67\xc2\x9b\x4e\xb6\x4b\xd8\x84\x01\xda\x97\xf0\x94\x7f\x38\xe2\x4a\x2d\xea\x7f\x1e\xfe\x7f\x7a\x3e\x9c\x1f\x9e\xff\x13\x95\x7c\xcd\x12\xf5\xd3\xe3\x0b\xf8\xec\x25\xea\xcf\x8f\x2f\xa2\x92\x12\xf5\x52\x54\x19\xb5\x27\x32\x49\xa5\xe8\x6c\xbe\xdc\x3f\x67\xfd\x31\xe7\x40\x89\xb2\xda\x84\x41\x1d\xc1\xda\x5a\xcc\xf8\xc7\x00\x1c\x79\xac\xfe\xc2\x1a\x52\x16\xad\x27\x94\xed\x65\x55\xf3\xa4\x7b\x3b\xe5\x54\x93\x14\xb3\x8b\xb2\x1c\xb2\xc4\x8c\x7b\x64\x26\x27\xac\x38\xa3\xc5\xbe\x27\xcf\xb1\xe4\xd3\x38\xd0\xb1\x4f\x16\xe5\x7c\x3f\x54\x5c\x9e\xeb\xd5\x77\xbf\xf9\x30\x7a\xda\xf6\x32\x44\xe1\x6a\x92\xe4\x44\x1b\x93\x36\x41\xcc\x1e\x3f\xfa\x1b\x8c\x89\x90\x7b\x9b\x90\x03\x12\xe5\x49\x8b\xa2\xa9\x4e\xe5\xb2\xb7\xb9\x4f\x5d\x88\x24\x6a\x76\x56\x93\xf1\xf0\x55\xb9\x7a\xec\xf2\x1b\xfb\x4a\x4e\xa3\x5c\xe8\xb4\xc3\xfd\xcf\x00\x00\x00\xff\xff\x46\xbd\x3e\x73\x83\x04\x00\x00") 245 + 246 +func stdlibShellPiscBytes() ([]byte, error) { 247 + return bindataRead( 248 + _stdlibShellPisc, 249 + "stdlib/shell.pisc", 250 + ) 251 +} 252 + 253 +func stdlibShellPisc() (*asset, error) { 254 + bytes, err := stdlibShellPiscBytes() 255 + if err != nil { 256 + return nil, err 257 + } 258 + 259 + info := bindataFileInfo{name: "stdlib/shell.pisc", size: 1155, mode: os.FileMode(436), modTime: time.Unix(1504845781, 0)} 260 + a := &asset{bytes: bytes, info: info} 261 + return a, nil 262 +} 263 + 264 +var _stdlibStd_libPisc = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x8c\x54\xc1\x6e\xe3\x36\x10\xbd\xfb\x2b\x1e\xb6\x87\x46\x41\x6c\x77\xb3\x37\x1b\xa8\x51\x6c\x2e\x0b\xb4\x48\x8b\x04\xe8\xc1\x35\x1a\x5a\x1e\x45\x84\x69\x52\x25\x47\x56\xfc\xf7\xc5\x0c\x25\x59\x8b\xe4\xb0\x87\xdd\xc8\xe4\xbc\xf7\xe6\x0d\x67\x66\x79\x8b\xdf\x50\x51\x87\x32\x44\x42\x17\xe2\x21\xa1\x0a\x11\x7f\x7e\x7b\xfa\x0a\x7a\xa3\xb2\x65\x1b\xfc\x02\xb7\xcb\xd9\x6c\x85\x26\x5a\xcf\xce\xe3\x06\x06\xf3\x39\x50\xe0\xd7\xc4\xd1\xfa\x57\xb9\x39\xff\xdb\xb4\x9c\xf0\xe9\x1f\xff\x69\xf2\x73\x3d\xe2\x06\xd4\x47\xa0\xf5\x6c\x36\x5b\xde\xe2\xb9\x26\x54\xc1\xb9\xd0\xc9\x75\x69\x9c\x4b\x30\x91\xc0\x35\xa1\x6c\x63\x24\xcf\x48\x6c\xca\xe3\x3c\xd5\x6d\x55\xb9\x9e\xe4\x64\xd9\x9e\x29\x69\x92\xb3\xd5\xc3\xe3\x57\x38\x92\x24\x1d\x79\xb3\x77\x24\xa2\x8e\xfc\x2b\xd7\x28\x80\xdf\xc9\xc3\x26\xa5\x7c\x0d\x38\x50\x65\x3d\x1d\xd4\x39\xb8\x36\x2c\x27\x14\xd3\x00\x28\x6b\x2a\x8f\x22\xc3\x61\x80\xf0\xa5\x21\xa4\x4b\x62\x3a\x41\x13\x57\x45\x7b\x6a\x42\x14\x8f\x95\x75\xd4\x18\xae\x45\x75\xb1\x40\x81\x97\x7c\xf5\x32\x3a\x60\x73\xa4\x04\xa3\x91\x90\xd0\x3b\x18\x7f\x80\x61\xa6\x53\xc3\x49\xa4\x72\xe5\xb3\x71\x0d\x33\x9c\xb3\x8b\xe4\x8c\x98\xbd\x82\x17\x9a\xc3\x4f\x78\x7e\x7c\x78\x5c\xe1\x8f\x70\xce\xa8\xc4\x86\x4f\xe4\x85\x4e\x70\x7d\x7a\x5c\x53\xa2\xde\x8b\x8d\x88\x94\x1a\x2a\x95\xef\x14\x0e\xad\xa3\xa4\xcf\xf0\x24\x25\x46\x2e\xb1\xd4\xe2\x76\x99\x3d\x1e\xda\x66\x78\x44\x03\x83\x02\x0f\x6d\xe3\x6c\x69\x98\x72\x3d\x39\x34\x08\xd5\x20\x5f\x1e\xb1\x9e\xad\xde\x83\x7e\x41\x63\xcb\xe3\x5c\xce\xd7\x7d\xf1\xee\x7f\x84\x99\xbb\x00\x72\x94\x4d\xbd\x93\x19\x29\xf6\x99\x64\xaf\xff\x0a\xdc\x63\x8b\xcf\x57\xc5\x1d\xd8\x9e\x28\x8d\xca\xa9\x33\x13\xd8\x5e\xb5\x9f\x3a\xd3\xfc\xa8\xec\x47\xf8\x41\x2e\x86\xec\x10\xfa\x35\x76\xff\xe0\x9f\x9c\x32\x78\xfb\x1d\xc1\x15\xde\xdf\xdf\x8f\xe8\x7d\xc6\x8b\x23\x3d\xbb\x7a\x59\xe1\xcb\x24\xaa\xcc\x71\x5f\x3e\x8a\x0b\x67\x8a\xb8\xc1\x1b\x2e\x12\x24\x7f\xde\x26\x92\x93\x27\x39\xf4\x69\xfd\xd7\x06\xce\x15\x2d\xf0\xdc\x37\xae\x9c\x19\xd9\x0b\xb9\x6f\x71\x36\xae\xa5\xdc\xc4\x3a\xcd\x52\x22\x3d\xc3\x5e\xea\x14\xfc\xa4\x68\xa6\x62\x8a\x3a\xda\x3a\x55\x35\x4d\xd8\xb4\x58\x47\x22\x51\x5e\x2c\x0c\xde\xf4\x6e\x85\x6d\xff\x6b\xae\x23\xb5\xc7\x0e\xfd\x87\xe4\xae\x8e\xb6\xca\x88\x9d\xa6\x2d\x3e\xf7\x76\xcc\xfe\xb3\xfe\x7f\x9f\x31\x32\x90\xdb\xac\x91\x83\x15\xb7\xd6\xb6\xff\x56\xe9\xd4\xe8\x53\x8f\x3d\x6f\x2b\xdc\x60\x03\x8e\x2d\xfd\x25\xa5\xa8\x8c\x4b\xf9\x6b\x3e\x97\xf9\x69\x1d\xa3\x90\xa8\x8d\x6e\x95\xbb\x4c\x28\xe1\x2a\x7b\x87\xc0\x35\xc5\xce\x26\xca\x37\x23\x7e\x81\x87\x7e\xf7\x98\x84\x97\x8d\xde\xbe\x68\xee\x13\xc9\x1c\xde\x4b\xa1\xc0\x66\xc8\x77\x79\x8b\xbf\x6b\xf2\x93\x84\x65\x6b\x77\x72\x74\x09\x2d\x0e\xc1\xff\xcc\xf0\x24\xec\xce\x49\xdb\xda\x4a\x2d\xe5\x90\x91\x7e\x24\xde\x62\x77\x25\x97\xae\xec\xfb\xc9\xe7\x5e\x7a\xd7\x49\x92\xa6\xd7\xe5\x71\x9d\xdb\x42\x67\x3d\xef\x7a\x8d\x28\x1d\x99\x38\xcf\xef\x7e\x33\x10\xe5\xfd\x2d\x9b\xee\xb2\x81\x0f\x8c\xdd\x95\xbd\xab\x65\xab\xad\x67\xff\x07\x00\x00\xff\xff\x8d\xf7\x0d\x9f\x96\x06\x00\x00") 265 + 266 +func stdlibStd_libPiscBytes() ([]byte, error) { 267 + return bindataRead( 268 + _stdlibStd_libPisc, 269 + "stdlib/std_lib.pisc", 270 + ) 271 +} 272 + 273 +func stdlibStd_libPisc() (*asset, error) { 274 + bytes, err := stdlibStd_libPiscBytes() 275 + if err != nil { 276 + return nil, err 277 + } 278 + 279 + info := bindataFileInfo{name: "stdlib/std_lib.pisc", size: 1686, mode: os.FileMode(436), modTime: time.Unix(1511844549, 0)} 280 + a := &asset{bytes: bytes, info: info} 281 + return a, nil 282 +} 283 + 284 +var _stdlibStringsPisc = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x8c\x53\x3d\x6f\xdb\x30\x10\x9d\xa3\x5f\xf1\x1a\x64\x88\x92\x32\xe9\xec\x00\x36\x82\xb4\x43\x26\x0f\xee\x66\x18\x10\x4d\x9d\x23\xa6\x12\x29\x93\x27\xbb\xfe\xf7\xc5\x51\x1f\x56\x3b\x75\xd3\x1d\xdf\xbd\xf7\xee\x43\xcf\x0f\xc8\x36\x1c\xac\xfb\x88\x4f\xad\x8d\x26\x1b\x22\x54\xda\x95\xb5\x7c\x9c\x7d\x28\x23\xb4\x2b\x11\x3b\x53\x65\x0f\xcf\x59\xb6\xf8\xbe\x7e\x43\xe4\xa0\x8c\x77\x46\x33\xee\xa1\xb1\x87\x52\x30\xc8\xf1\x96\x72\xe4\x34\x13\xb8\x22\xb0\x6f\xc1\x67\x2f\x78\x51\x81\x77\x29\x1d\x59\x9b\x5f\x78\xe9\xb9\x96\xfd\x63\x22\x52\x4a\xa0\x3d\xd1\x89\x02\x43\xbb\xcb\x80\x3e\xe9\xba\x23\x58\xc7\x1e\x7a\xe0\x1b\x19\x22\x87\xa5\x75\x62\x45\x8a\x95\x12\xd4\x17\xe4\x78\x65\xa6\xa6\x65\xb0\x87\x19\xf9\xc6\x52\xa1\x71\x02\xa4\x0f\x0a\x33\x22\xf5\xe9\xad\xc3\x3d\x4e\x64\x10\xa9\xbd\x3a\xfa\xd9\x05\x07\x2d\x79\xf6\xe1\x1f\x1f\xfb\x0b\x8a\xa1\x8d\x22\x4d\xab\x8b\x92\x96\x7a\xeb\xb0\x27\x3e\x13\x39\xe8\xba\x4e\xdd\x53\x4d\x0d\x39\x8e\xf0\x07\x14\x27\x32\xc5\x5c\x3e\xb6\xb5\x1d\x3b\x19\xf4\xc5\x4a\x8e\x4d\x7a\x98\x24\x07\x03\x83\x9d\x5e\xaf\x88\xd4\x16\xd0\x11\x1a\x25\xd9\xda\x36\xc4\x7f\xf7\x26\xd3\xb8\xac\xae\x73\x5a\x21\xc7\x7b\x04\x57\x36\x8e\xbc\x03\x64\x5e\x74\x5c\x5d\x97\x2c\x15\xaf\xe1\x3f\x96\x4b\xc7\x4e\xd7\x73\x9e\x65\xe8\x1c\xa9\x40\xba\xa4\x70\x75\xe0\xf7\x9f\xb2\xed\x40\x72\x31\x1a\x73\xcc\x21\xf8\x66\xea\xf7\x2b\x22\xf5\xaa\xc5\xf6\x7d\xbd\x2b\x50\x7a\x13\x71\xf0\x01\x8d\x0f\x72\x16\x07\x3f\x6a\x91\x36\x95\x32\x95\x1e\x55\x8e\x9d\x67\x91\x7a\x7a\x42\x8e\x1f\xbf\xc9\x74\x4c\x28\x24\x5b\x24\x02\xc1\x43\xf0\xda\x30\x85\x7b\xb1\x90\xcb\xda\x8a\xc8\x41\x56\x93\x2d\x86\x73\xef\xa6\x13\x4b\xec\x4a\xc1\x75\xcd\xda\x98\x2e\x44\xe4\x58\x58\xe7\x28\x64\x37\xdf\xb0\xb0\xd9\xcd\x16\x77\x29\x9e\x26\xb8\xc5\xe3\xa3\xc5\x0e\xe7\x8a\x1c\x76\x33\x93\xd9\xcd\x9d\xcd\x46\x15\x99\xb4\x8c\x44\x6e\x38\x6e\x24\xce\xc1\x97\x96\xfc\x01\xb7\xfd\xbf\x79\x3b\x31\x4e\xce\x5c\xbf\x21\xf9\x4c\xe3\x52\x69\x53\x92\xcc\x27\xb0\xf3\x8c\x17\xfc\x09\x00\x00\xff\xff\x74\xb0\x4a\xc5\xf1\x03\x00\x00") 285 + 286 +func stdlibStringsPiscBytes() ([]byte, error) { 287 + return bindataRead( 288 + _stdlibStringsPisc, 289 + "stdlib/strings.pisc", 290 + ) 291 +} 292 + 293 +func stdlibStringsPisc() (*asset, error) { 294 + bytes, err := stdlibStringsPiscBytes() 295 + if err != nil { 296 + return nil, err 297 + } 298 + 299 + info := bindataFileInfo{name: "stdlib/strings.pisc", size: 1009, mode: os.FileMode(436), modTime: time.Unix(1500942096, 0)} 300 + a := &asset{bytes: bytes, info: info} 301 + return a, nil 302 +} 303 + 304 +var _stdlibSymbolsPisc = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x6c\xce\xb1\x0e\x82\x30\x10\xc6\xf1\xbd\x4f\xf1\x1f\x81\x04\xd9\xc5\x48\x0c\xee\x0e\x3e\xc1\xa1\x97\x48\x82\x45\x68\x1b\xe3\xdb\x9b\x4a\x43\x18\x1c\xdb\xfb\x7e\xf7\x5d\x55\x98\xeb\xe7\xd9\x8d\x83\xdb\xbd\x7a\x77\x33\x45\x65\xf6\xe7\x4b\xcb\xc1\xfd\x7e\x8f\x64\x94\x25\x39\xed\xac\xe2\x15\x21\xd8\x7e\x0a\xca\x32\xa6\x5e\xd2\xf1\x55\x5a\x9d\xc8\x10\x3a\x22\x69\xc8\x39\xcd\x8a\x7f\xa8\x53\xfc\x7b\x4c\xc4\x61\x47\x8f\x4e\x41\x06\xa8\xcd\xc6\xaf\x7c\xa3\x05\xb1\x77\xba\x94\x4f\x1b\x9a\x58\xfb\xdf\xac\x87\xc4\x92\xda\x7c\x03\x00\x00\xff\xff\x27\x8e\xbf\xf1\xde\x00\x00\x00") 305 + 306 +func stdlibSymbolsPiscBytes() ([]byte, error) { 307 + return bindataRead( 308 + _stdlibSymbolsPisc, 309 + "stdlib/symbols.pisc", 310 + ) 311 +} 312 + 313 +func stdlibSymbolsPisc() (*asset, error) { 314 + bytes, err := stdlibSymbolsPiscBytes() 315 + if err != nil { 316 + return nil, err 317 + } 318 + 319 + info := bindataFileInfo{name: "stdlib/symbols.pisc", size: 222, mode: os.FileMode(436), modTime: time.Unix(1491353691, 0)} 320 + a := &asset{bytes: bytes, info: info} 321 + return a, nil 322 +} 323 + 324 +var _stdlibVectorsPisc = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x8c\x55\x4d\x8b\xe3\x46\x10\x3d\xab\x7f\xc5\x83\x35\x64\xec\x89\x67\xd6\x9a\xdd\x1c\xe4\x10\x08\x31\x84\x9c\x02\x1b\xd8\x8b\x30\x6c\x8f\x55\x8e\x9b\x48\xdd\x4a\x77\x4b\xf6\xfc\xfb\x50\xa5\x4f\xaf\x9d\x4d\x4e\x33\x5d\xf5\xaa\x5e\xd7\xab\xd7\xf2\xf3\x0a\x9f\xe9\x10\x9d\x0f\xd0\xb6\x40\x3c\x91\xf1\x68\xa2\x29\x4d\x34\x14\xb0\x7a\x56\x2a\xdb\xfd\xfe\x0b\x5a\x3a\xac\x03\xc5\xb5\x8e\x78\xe0\x03\x5a\x5d\xc2\x14\x17\xac\xd7\xa0\x92\x2a\x2c\xf1\x07\x45\xce\x44\xe7\xa1\xa3\xe4\xa2\x63\x58\x43\xd8\x4e\x4d\xc6\x06\xd7\xc5\xbf\x52\x94\x7f\xc9\x46\xa9\xb6\x05\x5d\x86\xb2\x1f\xbb\xae\x3f\xe1\x81\x0b\x7a\x8a\x25\x7e\xb3\x26\x42\xc3\xd2\x79\x88\xcd\x68\x48\x1f\x4e\x3d\xd1\xdf\x8d\x8b\x5c\xf8\xf4\x84\x25\x3e\x35\x16\x5f\x38\xf2\x05\x47\xe7\x21\xb0\x81\xd7\x58\x9e\x7f\x6a\xa6\x32\xa4\xfd\xe1\x01\x1a\xaf\x3d\x3b\x96\xd3\x8d\x52\xe4\x08\x67\x5d\x0b\x67\xed\xa9\x26\x5b\x60\x8f\x68\x2a\x0a\x5d\x87\x4d\x18\x06\x9e\x86\x7d\x3f\x28\xb1\x65\x0a\x5b\xdc\x00\x36\x73\xc0\x8b\xbf\x05\xa4\x73\xc0\x87\x78\xba\x01\xbc\xcc\x01\x1f\xef\x00\x3e\xcc\x01\x3f\xdc\x01\x7c\x9c\x00\xef\xb0\x73\xf6\xbb\x08\x5d\x14\xa8\x9c\x27\x9c\xc8\x13\x1a\x5b\x52\x08\x2c\x99\x27\x98\x00\x8d\x55\x4b\xfe\x6d\x85\x3f\x9d\x2b\xe0\x49\x07\x67\x7b\xf7\xb0\xcc\x29\x33\x6c\xd0\xa6\xe3\x42\xda\x17\x2c\xf1\x73\x5d\x97\xec\x34\x2d\x61\x1d\x8d\xb3\xec\x9b\xf9\x62\xce\x26\x10\x6a\x6d\x3c\x6f\xa8\xdd\x88\x51\xdb\xf4\x7b\x86\x79\x0a\x4d\x29\x9b\x6b\x5f\x64\x92\x3b\x4c\xf9\xb0\x3b\xfd\x8a\x7d\x47\xaa\x92\x4c\x52\x59\x9b\x22\x6b\x37\x2a\x79\x8f\xcc\x4c\x5b\x7d\x97\xb9\x26\xaa\x64\xd1\xa6\x28\xc9\x62\xd1\x6e\xe4\x6f\x65\x2c\x72\x95\x24\x7c\x5e\x98\x41\x1e\x09\xa4\x53\x40\x25\x89\xf4\x96\x53\xcd\x86\x50\x49\x92\x63\x83\x47\xec\xb1\xc8\x8c\x4a\xe6\xfe\x60\x75\x42\x5d\xea\x99\x49\x4c\xa4\x2a\x60\x89\x5d\x53\xd5\x62\xc8\x83\xb3\x91\x6c\x0c\x70\xc7\xb9\x41\x9d\x8d\x4e\xce\x21\xea\xc3\x5f\x32\xfd\xbd\x4e\x4f\xe2\xfb\x9c\x47\x1f\xde\xc5\x76\xf6\xa8\x3d\xb5\xe4\x03\x4d\x45\x7d\xa0\x33\xfa\xa7\xee\xc0\xeb\x99\xde\xd8\xff\xa8\x53\x49\xd1\xd4\xc8\xf8\xc0\xca\x65\xfc\x2c\x58\x63\x25\x4a\xac\x45\x09\x51\x66\xc1\x99\x14\xcf\xa2\x4f\xde\x89\x49\x87\x99\xbc\xd9\x65\x8c\x31\x74\x88\xbe\x8d\xd1\xb7\x01\xdc\x7f\x9e\x98\x74\x4c\x5e\xa6\xaa\xeb\xf4\x7a\xdd\x2d\xe6\xf1\x71\x5a\x88\x92\x22\x25\xcf\x96\x2b\x8e\xa6\x8c\xe4\xbf\xfa\x8a\x74\x41\x2a\x3e\xf7\x73\x8e\xa6\xc9\x2c\x9d\xa5\xb7\x58\x8b\x07\x55\x49\x02\x96\xa1\x77\xe1\xa2\x03\x4c\xdf\x8b\xce\x1d\x43\x21\xf6\xc8\x51\x78\x57\x63\x0f\x73\x04\xdf\x6a\x58\x98\x4a\xfa\xda\xe9\x6e\x95\xae\xbf\xba\x58\xc5\xed\xba\x6b\x29\x8c\xfe\xa6\x43\xa7\x3b\x3a\x41\x78\x19\x39\x14\x6e\x64\x16\xf8\x18\x97\x2b\x5e\xcb\xca\x37\x53\x09\x44\x30\x8c\x8a\x61\x94\xec\x79\x85\xd1\x53\x8c\x3d\x7a\x67\x67\x56\xec\x67\x5c\x62\xc7\x13\xb2\x6b\x3b\xc0\xb5\xa5\xb7\xfc\x83\x93\xfd\x67\x0f\xf9\xd8\x0e\x69\x91\xec\xce\x05\x5e\xf9\x51\x7c\x83\x5f\xf2\xdf\xa4\xff\x97\x0e\x3d\xbb\x64\x7b\xf2\x7f\x02\x00\x00\xff\xff\xd5\x00\x21\x41\x46\x07\x00\x00") 325 + 326 +func stdlibVectorsPiscBytes() ([]byte, error) { 327 + return bindataRead( 328 + _stdlibVectorsPisc, 329 + "stdlib/vectors.pisc", 330 + ) 331 +} 332 + 333 +func stdlibVectorsPisc() (*asset, error) { 334 + bytes, err := stdlibVectorsPiscBytes() 335 + if err != nil { 336 + return nil, err 337 + } 338 + 339 + info := bindataFileInfo{name: "stdlib/vectors.pisc", size: 1862, mode: os.FileMode(436), modTime: time.Unix(1512805598, 0)} 340 + a := &asset{bytes: bytes, info: info} 341 + return a, nil 342 +} 343 + 344 +var _stdlibWithPisc = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x6c\x90\xcd\x4e\xc3\x30\x10\x84\xcf\xf1\x53\x8c\x4a\x0f\x25\xc2\xcd\x3d\x45\x08\x09\x71\xe0\x82\x10\x57\x84\xd0\xc6\x31\xb1\x8b\x1b\x87\x78\x5b\xbf\x3e\x5a\x97\x22\xfe\x8e\xab\xf1\x7c\x33\xe3\xa6\x46\xf6\xec\xa8\x0b\x16\xb1\xdb\x5a\xc3\x09\x75\xa3\x54\xfb\xf0\x78\x8b\x6b\xac\x90\xe3\xdc\xdf\xd3\xce\x42\x6b\xac\xd7\x38\xc7\xe2\x45\x0c\x0b\x0c\x96\x75\x88\x86\x02\x52\xa6\x09\xbd\x37\xac\x07\xcb\x30\x14\x02\x36\x4a\xb5\x05\x8c\x95\x60\xf1\xbe\x8f\xfc\x45\x68\xcb\xd5\xc6\x6e\xab\xaa\x4b\xf1\x5d\xa1\xcd\x07\x9a\x55\xb5\x2c\xca\x29\x41\x0e\xed\x28\xe9\x03\xcd\x78\xc2\x3f\xa2\x74\x10\xb1\xd8\xf1\x8c\xec\xec\xa8\xaa\xa6\xc6\xdd\x2b\xd8\xf9\x74\xcc\x75\x94\x50\x5c\x48\x96\x2f\x40\xd3\x64\xc7\x1e\x9e\xc1\x11\x84\xc4\x64\xde\x64\xf3\xaf\xf4\xe5\xa9\xb7\x4e\xc7\x14\x55\x9d\xe1\x46\xc6\x95\x67\xfb\xe4\xc7\xe1\x13\xbb\xb3\x4c\xdf\xfa\xcb\x0f\xfc\xa1\x95\x86\x3f\x70\x1b\xf5\x11\x00\x00\xff\xff\x81\x99\x2d\xf3\x7d\x01\x00\x00") 345 + 346 +func stdlibWithPiscBytes() ([]byte, error) { 347 + return bindataRead( 348 + _stdlibWithPisc, 349 + "stdlib/with.pisc", 350 + ) 351 +} 352 + 353 +func stdlibWithPisc() (*asset, error) { 354 + bytes, err := stdlibWithPiscBytes() 355 + if err != nil { 356 + return nil, err 357 + } 358 + 359 + info := bindataFileInfo{name: "stdlib/with.pisc", size: 381, mode: os.FileMode(436), modTime: time.Unix(1491353691, 0)} 360 + a := &asset{bytes: bytes, info: info} 361 + return a, nil 362 +} 363 + 364 +// Asset loads and returns the asset for the given name. 365 +// It returns an error if the asset could not be found or 366 +// could not be loaded. 367 +func Asset(name string) ([]byte, error) { 368 + cannonicalName := strings.Replace(name, "\\", "/", -1) 369 + if f, ok := _bindata[cannonicalName]; ok { 370 + a, err := f() 371 + if err != nil { 372 + return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err) 373 + } 374 + return a.bytes, nil 375 + } 376 + return nil, fmt.Errorf("Asset %s not found", name) 377 +} 378 + 379 +// MustAsset is like Asset but panics when Asset would return an error. 380 +// It simplifies safe initialization of global variables. 381 +func MustAsset(name string) []byte { 382 + a, err := Asset(name) 383 + if err != nil { 384 + panic("asset: Asset(" + name + "): " + err.Error()) 385 + } 386 + 387 + return a 388 +} 389 + 390 +// AssetInfo loads and returns the asset info for the given name. 391 +// It returns an error if the asset could not be found or 392 +// could not be loaded. 393 +func AssetInfo(name string) (os.FileInfo, error) { 394 + cannonicalName := strings.Replace(name, "\\", "/", -1) 395 + if f, ok := _bindata[cannonicalName]; ok { 396 + a, err := f() 397 + if err != nil { 398 + return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err) 399 + } 400 + return a.info, nil 401 + } 402 + return nil, fmt.Errorf("AssetInfo %s not found", name) 403 +} 404 + 405 +// AssetNames returns the names of the assets. 406 +func AssetNames() []string { 407 + names := make([]string, 0, len(_bindata)) 408 + for name := range _bindata { 409 + names = append(names, name) 410 + } 411 + return names 412 +} 413 + 414 +// _bindata is a table, holding each asset generator, mapped to its name. 415 +var _bindata = map[string]func() (*asset, error){ 416 + "stdlib/bools.pisc": stdlibBoolsPisc, 417 + "stdlib/debug.pisc": stdlibDebugPisc, 418 + "stdlib/dicts.pisc": stdlibDictsPisc, 419 + "stdlib/io.pisc": stdlibIoPisc, 420 + "stdlib/locals.pisc": stdlibLocalsPisc, 421 + "stdlib/loops.pisc": stdlibLoopsPisc, 422 + "stdlib/math.pisc": stdlibMathPisc, 423 + "stdlib/random.pisc": stdlibRandomPisc, 424 + "stdlib/shell.pisc": stdlibShellPisc, 425 + "stdlib/std_lib.pisc": stdlibStd_libPisc, 426 + "stdlib/strings.pisc": stdlibStringsPisc, 427 + "stdlib/symbols.pisc": stdlibSymbolsPisc, 428 + "stdlib/vectors.pisc": stdlibVectorsPisc, 429 + "stdlib/with.pisc": stdlibWithPisc, 430 +} 431 + 432 +// AssetDir returns the file names below a certain 433 +// directory embedded in the file by go-bindata. 434 +// For example if you run go-bindata on data/... and data contains the 435 +// following hierarchy: 436 +// data/ 437 +// foo.txt 438 +// img/ 439 +// a.png 440 +// b.png 441 +// then AssetDir("data") would return []string{"foo.txt", "img"} 442 +// AssetDir("data/img") would return []string{"a.png", "b.png"} 443 +// AssetDir("foo.txt") and AssetDir("notexist") would return an error 444 +// AssetDir("") will return []string{"data"}. 445 +func AssetDir(name string) ([]string, error) { 446 + node := _bintree 447 + if len(name) != 0 { 448 + cannonicalName := strings.Replace(name, "\\", "/", -1) 449 + pathList := strings.Split(cannonicalName, "/") 450 + for _, p := range pathList { 451 + node = node.Children[p] 452 + if node == nil { 453 + return nil, fmt.Errorf("Asset %s not found", name) 454 + } 455 + } 456 + } 457 + if node.Func != nil { 458 + return nil, fmt.Errorf("Asset %s not found", name) 459 + } 460 + rv := make([]string, 0, len(node.Children)) 461 + for childName := range node.Children { 462 + rv = append(rv, childName) 463 + } 464 + return rv, nil 465 +} 466 + 467 +type bintree struct { 468 + Func func() (*asset, error) 469 + Children map[string]*bintree 470 +} 471 +var _bintree = &bintree{nil, map[string]*bintree{ 472 + "stdlib": &bintree{nil, map[string]*bintree{ 473 + "bools.pisc": &bintree{stdlibBoolsPisc, map[string]*bintree{}}, 474 + "debug.pisc": &bintree{stdlibDebugPisc, map[string]*bintree{}}, 475 + "dicts.pisc": &bintree{stdlibDictsPisc, map[string]*bintree{}}, 476 + "io.pisc": &bintree{stdlibIoPisc, map[string]*bintree{}}, 477 + "locals.pisc": &bintree{stdlibLocalsPisc, map[string]*bintree{}}, 478 + "loops.pisc": &bintree{stdlibLoopsPisc, map[string]*bintree{}}, 479 + "math.pisc": &bintree{stdlibMathPisc, map[string]*bintree{}}, 480 + "random.pisc": &bintree{stdlibRandomPisc, map[string]*bintree{}}, 481 + "shell.pisc": &bintree{stdlibShellPisc, map[string]*bintree{}}, 482 + "std_lib.pisc": &bintree{stdlibStd_libPisc, map[string]*bintree{}}, 483 + "strings.pisc": &bintree{stdlibStringsPisc, map[string]*bintree{}}, 484 + "symbols.pisc": &bintree{stdlibSymbolsPisc, map[string]*bintree{}}, 485 + "vectors.pisc": &bintree{stdlibVectorsPisc, map[string]*bintree{}}, 486 + "with.pisc": &bintree{stdlibWithPisc, map[string]*bintree{}}, 487 + }}, 488 +}} 489 + 490 +// RestoreAsset restores an asset under the given directory 491 +func RestoreAsset(dir, name string) error { 492 + data, err := Asset(name) 493 + if err != nil { 494 + return err 495 + } 496 + info, err := AssetInfo(name) 497 + if err != nil { 498 + return err 499 + } 500 + err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755)) 501 + if err != nil { 502 + return err 503 + } 504 + err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode()) 505 + if err != nil { 506 + return err 507 + } 508 + err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime()) 509 + if err != nil { 510 + return err 511 + } 512 + return nil 513 +} 514 + 515 +// RestoreAssets restores an asset under the given directory recursively 516 +func RestoreAssets(dir, name string) error { 517 + children, err := AssetDir(name) 518 + // File 519 + if err != nil { 520 + return RestoreAsset(dir, name) 521 + } 522 + // Dir 523 + for _, child := range children { 524 + err = RestoreAssets(dir, filepath.Join(name, child)) 525 + if err != nil { 526 + return err 527 + } 528 + } 529 + return nil 530 +} 531 + 532 +func _filePath(dir, name string) string { 533 + cannonicalName := strings.Replace(name, "\\", "/", -1) 534 + return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...) 535 +} 536 +
Changes to boolean.go.
1 -package main 1 +package pisc 2 + 3 +var ModBoolCore = Module{ 4 + Author: "Andrew Owen", 5 + Name: "BoolCore", 6 + License: "MIT", 7 + DocString: "The 3 basic boolean operation, and/or and not", 8 + Load: loadBoolCore, 9 +} 10 + 11 +func _and(m *Machine) error { 12 + a := m.PopValue().(Boolean) 13 + b := m.PopValue().(Boolean) 14 + m.PushValue(Boolean(a && b)) 15 + return nil 16 +} 17 + 18 +func _or(m *Machine) error { 19 + a := m.PopValue().(Boolean) 20 + b := m.PopValue().(Boolean) 21 + m.PushValue(Boolean(a || b)) 22 + return nil 23 +} 2 24 3 -func (m *machine) loadBooleanWords() error { 4 - m.predefinedWords["and"] = NilWord(func(m *machine) { 5 - a := m.popValue().(Boolean) 6 - b := m.popValue().(Boolean) 7 - m.pushValue(Boolean(a && b)) 8 - }) 9 - m.predefinedWords["or"] = NilWord(func(m *machine) { 10 - a := m.popValue().(Boolean) 11 - b := m.popValue().(Boolean) 12 - m.pushValue(Boolean(a || b)) 13 - }) 14 - m.predefinedWords["not"] = NilWord(func(m *machine) { 15 - a := m.popValue().(Boolean) 16 - m.pushValue(Boolean(!a)) 17 - }) 25 +func _not(m *Machine) error { 26 + a := m.PopValue().(Boolean) 27 + m.PushValue(Boolean(!a)) 18 28 return nil 19 29 } 30 + 31 +func loadBoolCore(m *Machine) error { 32 + m.AppendToHelpTopic("Bools", "PISC boolean expressions are generally not short-circuited without using quotations") 33 + m.AddGoWordWithStack("and", "( a b -- a&b )", "Boolean And", _and) 34 + m.AddGoWordWithStack("or", "( a b -- a||b )", "Boolean OR", _or) 35 + m.AddGoWordWithStack("not", "( a -- not-a )", "Boolean NOT", _not) 36 + 37 + return m.ImportPISCAsset("stdlib/bools.pisc") 38 +}
Deleted bools.pisc.
1 -/* 2 -bools.pisc 3 -*/ 4 - 5 -:DOC and ( x y -- ? ) Boolean and ; 6 -:DOC or ( x y -- ? ) Boolean or ; 7 -:DOC not ( x -- !x ) Boolean not ;
Added build.
1 +#! /bin/bash 2 + 3 +set -uo pipefail 4 +export PISCDIR="$(pwd)" 5 + 6 +function older_than() { 7 + local target="$1" 8 + shift 9 + if [ ! -e "$target" ] 10 + then 11 + echo "updating $target" >&2 12 + return 0 # success 13 + fi 14 + local f 15 + for f in "$@" 16 + do 17 + if [ "$f" -nt "$target" ] 18 + then 19 + echo "updating $target" >&2 20 + return 0 # success 21 + fi 22 + done 23 + return 1 # failure 24 +} 25 + 26 +cd "$PISCDIR" 27 + 28 +function generate { 29 + echo "Generating..." >&2 30 + older_than bindata.go stdlib/*.pisc && { 31 + # TODO: Put in a go get command for go-bindata 32 + echo "Generating bindata" >&2 33 + go-bindata -pkg pisc stdlib/... 34 + } 35 +} 36 + 37 +function webbuild { 38 + older_than ./cmd/playground/playground.js *.go stdlib/*.pisc && { 39 + cd "./cmd/playground" 40 + # TODO: Put in a go get command for gopherjs 41 + gopherjs build -m 42 + cd ../.. 43 + } 44 +} 45 + 46 +function upload { 47 + generate 48 + webbuild 49 + cd ./cmd/playground 50 + # Note: This command won't work w/o a password for the scp 51 + scp *.css *.js *.html yumaikas@junglecoder.com:/var/www/pisc-static/playground 52 + cd ../.. 53 +} 54 + 55 +function interpinstall { 56 + generate 57 + cd "./cmd/pisc" 58 + go get 59 + echo "Installing new PISC interpreter" 60 + go install 61 + cd "../.." 62 +} 63 + 64 +function testpisc { 65 + interpinstall 66 + pisc -f tests/all.pisc 67 +} 68 + 69 +case "$1" in 70 +"generate") 71 + generate 72 + ;; 73 +"install") 74 + interpinstall 75 + ;; 76 +"web") 77 + webbuild 78 + ;; 79 +"upload") 80 + upload 81 + ;; 82 +"test") 83 + testpisc 84 + ;; 85 +esac 86 + 87 +cat <<EONOTE 88 +TODO: Definitely consider switching fmt.Println to pass through priv_puts in as *many* places as make sense. 89 +TODO: Consider using crit-bit trees for dictionaries 90 +TODO: Now that something close to a save-game has been implemented for final-frontier, start implementing the initial states and such 91 +TODO: Implement an interactive tutorial in the 'in Y minutes' style. 92 +TODO: consider packing the scripts under scripts/ for general use, possibly with a switch for unpacking them 93 +EONOTE 94 + 95 +exit 0
Added cmd/FinalFrontier/bindata.go.
1 +// Code generated by go-bindata. 2 +// sources: 3 +// scripts/backstory.txt 4 +// scripts/gamesave.pisc 5 +// scripts/intro.pisc 6 +// scripts/lib.pisc 7 +// scripts/main.pisc 8 +// scripts/map.pisc 9 +// scripts/markets.pisc 10 +// scripts/saving.pisc 11 +// scripts/ships.pisc 12 +// scripts/term_posix.pisc 13 +// scripts/term_win.pisc 14 +// DO NOT EDIT! 15 + 16 +package main 17 + 18 +import ( 19 + "bytes" 20 + "compress/gzip" 21 + "fmt" 22 + "io" 23 + "io/ioutil" 24 + "os" 25 + "path/filepath" 26 + "strings" 27 + "time" 28 +) 29 + 30 +func bindataRead(data []byte, name string) ([]byte, error) { 31 + gz, err := gzip.NewReader(bytes.NewBuffer(data)) 32 + if err != nil { 33 + return nil, fmt.Errorf("Read %q: %v", name, err) 34 + } 35 + 36 + var buf bytes.Buffer 37 + _, err = io.Copy(&buf, gz) 38 + clErr := gz.Close() 39 + 40 + if err != nil { 41 + return nil, fmt.Errorf("Read %q: %v", name, err) 42 + } 43 + if clErr != nil { 44 + return nil, err 45 + } 46 + 47 + return buf.Bytes(), nil 48 +} 49 + 50 +type asset struct { 51 + bytes []byte 52 + info os.FileInfo 53 +} 54 + 55 +type bindataFileInfo struct { 56 + name string 57 + size int64 58 + mode os.FileMode 59 + modTime time.Time 60 +} 61 + 62 +func (fi bindataFileInfo) Name() string { 63 + return fi.name 64 +} 65 +func (fi bindataFileInfo) Size() int64 { 66 + return fi.size 67 +} 68 +func (fi bindataFileInfo) Mode() os.FileMode { 69 + return fi.mode 70 +} 71 +func (fi bindataFileInfo) ModTime() time.Time { 72 + return fi.modTime 73 +} 74 +func (fi bindataFileInfo) IsDir() bool { 75 + return false 76 +} 77 +func (fi bindataFileInfo) Sys() interface{} { 78 + return nil 79 +} 80 + 81 +var _scriptsBackstoryTxt = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x5c\x92\x51\x6e\xdc\x30\x0c\x44\xaf\x32\x07\xd8\x2c\xd0\x8f\x1e\x21\x1f\xfd\x28\x10\xa0\xb9\x00\x2d\x8f\x2d\x62\x65\x49\x15\xe9\x75\x7c\xfb\x42\xca\x6e\x1b\xf4\xd3\x30\xc5\x79\x9c\x99\xd7\x8f\x9a\x4a\x63\x33\x48\x23\x78\x67\x46\x2e\x07\x36\xa9\x55\xf3\x8a\xb2\x3b\x3c\x12\x77\x69\x5a\x76\x43\x92\x4c\x43\x59\x60\x49\xab\x55\x09\xbc\xe2\x67\x31\x47\x65\xa9\x89\x30\x72\x83\x17\x4c\x44\x28\xd9\x99\xbd\x7f\x99\xcb\x89\x92\xc7\xa6\xda\x57\x78\x5f\xe1\x91\xda\x30\x69\xf3\x78\x81\x18\xa6\xe2\x11\xb6\x4f\x63\x2d\x24\xcf\xff\x44\x06\x9c\x37\x4a\x88\x6c\x9d\xa3\x26\x09\xb4\x2b\xde\xb4\x89\xd3\x2e\x58\x1a\x75\x8d\xce\x66\x97\xcf\xa7\xdb\xbe\xae\x69\xdc\x95\xf4\x46\xdc\x95\x58\x4a\xc3\x22\xee\x34\xbf\xe0\xf7\xae\xe1\x46\x73\x4c\x7b\xb8\x5d\xf1\x36\xb0\xa4\x9d\x58\x12\xe9\x86\xad\x98\xa7\x13\xb5\x15\x67\xf0\x07\x6c\x2c\x5b\x57\x7d\x8f\x6c\xc4\x6e\x9c\x1f\xb7\x0a\xec\x34\xe7\xf6\x72\xa8\x11\xdc\xaa\xb6\xce\x5c\xf6\x3c\xe3\x57\x49\x17\x4c\xbb\x23\x95\x55\xcd\x35\x18\x36\xb9\xd1\x20\x58\x25\xc9\xc7\xf9\x72\xe8\x4c\x94\x4c\x64\x4a\x7b\xd1\xad\x16\x33\x9d\x12\xaf\x78\xed\x79\xe8\x32\x06\x83\x6b\x40\xdb\x13\x71\x88\xe1\x39\x73\x19\xa6\x52\x5a\x3a\xbf\xd8\xa5\xd9\x5c\x26\x4d\xea\x4a\x83\xd5\x46\x99\x9f\x11\x2d\xd2\x86\x43\x43\xd5\x63\x2b\xfb\x1a\x7b\xcc\x8f\x34\xdf\xa3\x1a\x16\x09\xbe\xb7\x7e\x5e\x24\xac\x04\xa5\x9f\x48\x5c\x1c\x13\xa3\xe6\xf9\x8a\x1f\x3d\xd8\x72\xc3\xcc\x20\x33\x6d\x78\x2b\x5f\x08\xe6\xa6\x77\x3e\xdc\xe9\x2c\x89\x60\xee\x52\x63\x72\x2b\xbd\x6c\x1f\x95\x4d\x37\x66\x97\xd4\xcd\x1c\x4b\xfb\x6d\x25\xa7\x13\x87\x7a\x1c\xf2\xb2\xf6\x22\x76\xe2\x99\xe2\xf1\xb3\x39\xc5\x88\x23\x96\x3e\x95\x69\xf6\x24\xfd\x2b\xbf\xb4\x71\x41\x7f\xe9\x51\xfc\xbf\xbf\x41\xb6\x27\x9b\x84\xc0\xea\x9c\x7b\x01\x05\x1b\x25\x8f\x7a\x7b\x93\x3b\xd3\x48\x1a\x49\xcc\xf1\xed\x3b\x4e\x4a\x33\x44\xb9\x13\x16\xcb\x91\x71\x94\x3c\x8f\x36\x7a\xd4\xbc\xda\xf5\x4f\x00\x00\x00\xff\xff\x94\x12\x47\x4d\x4c\x03\x00\x00") 82 + 83 +func scriptsBackstoryTxtBytes() ([]byte, error) { 84 + return bindataRead( 85 + _scriptsBackstoryTxt, 86 + "scripts/backstory.txt", 87 + ) 88 +} 89 + 90 +func scriptsBackstoryTxt() (*asset, error) { 91 + bytes, err := scriptsBackstoryTxtBytes() 92 + if err != nil { 93 + return nil, err 94 + } 95 + 96 + info := bindataFileInfo{name: "scripts/backstory.txt", size: 844, mode: os.FileMode(436), modTime: time.Unix(1504845781, 0)} 97 + a := &asset{bytes: bytes, info: info} 98 + return a, nil 99 +} 100 + 101 +var _scriptsGamesavePisc = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x01\x00\x00\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00") 102 + 103 +func scriptsGamesavePiscBytes() ([]byte, error) { 104 + return bindataRead( 105 + _scriptsGamesavePisc, 106 + "scripts/gamesave.pisc", 107 + ) 108 +} 109 + 110 +func scriptsGamesavePisc() (*asset, error) { 111 + bytes, err := scriptsGamesavePiscBytes() 112 + if err != nil { 113 + return nil, err 114 + } 115 + 116 + info := bindataFileInfo{name: "scripts/gamesave.pisc", size: 0, mode: os.FileMode(436), modTime: time.Unix(1504845781, 0)} 117 + a := &asset{bytes: bytes, info: info} 118 + return a, nil 119 +} 120 + 121 +var _scriptsIntroPisc = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x74\x53\x4f\x6b\xeb\x46\x10\x3f\x5b\xa0\xef\xf0\xc3\x04\x92\x80\xec\xfa\xd2\x8b\x7b\x08\xa5\x10\x28\xf4\x96\x40\x09\xc6\x87\xb1\x34\xd2\x0e\x5e\xcf\xaa\xbb\x23\x29\xfa\xf6\x65\xa5\x98\x17\x1e\x3c\x74\xd2\xce\xec\xfc\xfe\xcd\x96\xc5\x11\xa2\x16\x03\x9e\xd0\xd1\x8d\xb1\xdb\x41\xf9\xd3\xf0\x5c\x16\xc7\x7c\x50\x16\x7f\xfd\xf3\x56\x16\x65\xb1\x7d\xeb\xa9\xe6\x0a\xe6\x18\xaf\xa2\xe4\xf1\x1a\x83\x9a\x70\xcc\xd5\x77\xc7\x48\x46\x31\xc1\xd1\xc8\xb8\x70\x7d\x0d\xca\x0d\xe6\x30\x54\xe0\x91\x15\x93\x63\xcd\xbf\x98\x38\x32\x2e\x83\x81\x30\x31\xa3\x76\xe2\x9b\x7d\x59\xfc\x6d\x8f\x09\x84\x28\xe9\x3a\xc3\x4b\xcb\x15\x52\x46\x6c\x29\x8a\x76\x15\x26\x47\x86\x49\xcc\xa1\x97\x48\xc6\xa9\x42\xba\x0d\x5d\xe7\x39\xa6\x0a\xa4\x0d\x7a\x4f\xca\x46\x71\x46\x1f\xbc\xd4\x5c\x16\xa2\x20\xd4\x41\x93\x91\x1a\x92\xc5\xa5\xbf\x82\x06\x83\x05\xdc\x58\x4d\x82\x82\x92\x71\x94\xd0\xa4\x0a\x4a\xa3\x74\xb4\x9c\x36\xd2\xb6\x52\x0f\xde\xe6\x75\x7c\x16\x3e\x98\x65\xbd\x63\x90\x06\xa1\x5d\x09\xee\xf1\x11\x86\xc7\x91\xd1\x47\xee\x29\x72\x83\x36\x44\x98\x93\x84\x86\xe6\xa5\x1a\x11\x99\x1a\xd1\x0e\x26\x37\xc6\x44\x09\x0d\x37\x52\x93\x71\x93\x89\xd4\x8e\xa2\xa5\xb2\xc8\x30\xc9\x49\x8f\xd0\x73\x5c\x58\x54\xd9\xb2\x98\x81\x22\xaf\x97\x2d\xc0\x22\x89\xe6\x69\xa2\x48\x72\x1b\x3c\x59\xb8\x9b\xb0\xb6\xd3\x28\xda\xa5\xb2\x58\xc2\xa0\x5b\x18\xf4\x0b\xe9\xe1\xf7\xc3\xe1\xb0\xc7\xbf\xe2\xfd\x12\x06\x7f\xf6\x3e\xe4\xd1\xf7\xfc\x5e\xf0\xf4\xf1\x9b\x3e\x97\xc5\x16\x7d\x14\x35\xaf\x39\xde\x03\x8e\x57\x9c\xf0\x70\x85\xa4\xdd\xac\x2f\x8b\x83\x67\x9c\xd0\xb1\x5d\x79\xce\xd5\x33\x26\x27\x9e\x73\xf7\xda\xa6\x2f\x38\xa1\x2c\x36\xdb\x77\x17\x86\xce\x55\xe8\x39\x3a\xea\xd3\x0f\x2c\x64\x51\xd9\x2c\xd2\x60\x8e\xe3\x22\x70\x8f\x3f\x5b\xe3\x08\xf2\x7e\x59\xb6\x19\x53\xd0\x47\xc3\x85\xd1\x85\x2c\x9a\x74\x9e\x1c\x47\xfe\x46\x70\x33\x91\xd8\x8e\x75\x09\x67\xb3\x39\x65\xff\xb2\x41\xbb\x1b\xeb\x80\x33\xca\xe2\xbc\xec\xdf\x9d\xda\x9c\xa9\x9d\xd0\x4b\x7d\xdd\x2d\x7e\x9f\x71\x6f\xf8\x23\x0b\x38\x7e\x2b\xfd\xfc\x2e\xb2\xa4\xe5\x49\x6c\xb6\x4b\xf0\xf1\xce\xcb\x02\x94\xb9\x01\xad\x11\x5e\xb8\xcd\xc6\x66\x93\x6b\xd2\x9c\xd9\xc8\x1e\xe6\x62\x36\x63\xdd\x9c\x0a\x2e\x4c\x3c\x72\xdc\xe3\x97\x62\x4e\xf8\x6f\x10\xdb\x2d\x1c\xce\x5f\xf4\xd6\xef\xff\x00\x00\x00\xff\xff\x8f\x37\x15\x2f\xbb\x03\x00\x00") 122 + 123 +func scriptsIntroPiscBytes() ([]byte, error) { 124 + return bindataRead( 125 + _scriptsIntroPisc, 126 + "scripts/intro.pisc", 127 + ) 128 +} 129 + 130 +func scriptsIntroPisc() (*asset, error) { 131 + bytes, err := scriptsIntroPiscBytes() 132 + if err != nil { 133 + return nil, err 134 + } 135 + 136 + info := bindataFileInfo{name: "scripts/intro.pisc", size: 955, mode: os.FileMode(436), modTime: time.Unix(1504845781, 0)} 137 + a := &asset{bytes: bytes, info: info} 138 + return a, nil 139 +} 140 + 141 +var _scriptsLibPisc = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x7c\x91\xcd\x6a\xdc\x30\x14\x85\xd7\x16\xe8\x1d\x0e\xc3\x2c\x52\xc2\x2d\xe9\xd6\x75\x33\x9b\x6e\xb2\x69\x0a\x59\xa4\xe0\x0c\x65\x22\xdd\xda\xaa\x23\xc9\x95\x64\x9c\xbc\x7d\x91\x35\x3f\x86\x40\x76\x96\xce\xa7\xef\xea\xc8\x89\x83\x25\xeb\x35\x63\xf3\x78\xf7\xe3\xfb\xfd\xe3\xc3\x06\xfc\x0f\x2d\xa4\x00\x80\x4d\x54\xc1\x8c\x29\x3e\x3d\x65\xf0\xf7\x6c\xdc\xe7\xd1\x44\xb5\x41\x77\xb0\x4c\x25\x94\x62\x8f\xb9\x67\x27\x85\x14\x2b\xdd\xcf\xfb\x87\xbb\x5f\x1f\xc9\x46\x1f\xcd\xeb\xc7\xba\x1a\xf3\xc1\x24\x62\x97\x38\xe0\x0a\x44\xf8\x04\x29\xaa\x16\x1d\xa7\x81\xdf\x60\x62\xc9\x76\xd8\xa3\x45\x3e\x67\x5e\x58\x8a\xaf\xe5\x6c\x33\x8d\xa4\xfd\xec\xc8\xb2\x9b\x6e\x71\x05\x37\x59\xf2\x63\x8a\x59\xe4\x9f\xff\x16\x59\xed\x26\x2b\x45\x75\x83\xda\x92\xd1\xaf\x52\x54\x09\xb5\xea\xbd\x8f\xc6\x75\xcb\x30\x29\xaa\xea\x38\xb0\x1e\xf2\x62\x3b\xac\x26\xb7\xf8\x73\xe1\x51\xee\x8e\x0b\x75\x08\xc1\xcf\x3b\xb4\x79\xe7\x6c\xd1\x26\x2c\xeb\xad\x36\x21\x43\xd3\x98\x3d\x44\xcb\x0d\x70\xea\xbf\x02\x72\x8d\x8c\x5c\x5f\xbf\x47\xca\xce\xd6\x4d\x16\xd6\xeb\x4b\x8d\x73\x74\x83\x06\x6d\x01\xbe\x80\x8e\xc0\x4a\x71\xfe\xda\xe7\x22\xac\x72\xc7\x46\x1b\x95\x6e\xcb\x63\x6f\x57\xed\x9a\x86\xb4\x77\xbc\x2b\xc1\xc9\xd4\x34\xa4\x7a\x1f\xd9\x1d\x47\xb7\x58\x3c\x25\x19\x83\x57\x34\xf0\xdb\xfa\xc8\x37\xb4\x78\x3e\xa8\x81\xe6\xde\x24\x3e\xbd\xda\x82\xf7\xa6\xeb\x5f\x4c\xd7\xa7\xe5\x3f\xfe\x0f\x00\x00\xff\xff\x55\xdb\xba\xd7\xa0\x02\x00\x00") 142 + 143 +func scriptsLibPiscBytes() ([]byte, error) { 144 + return bindataRead( 145 + _scriptsLibPisc, 146 + "scripts/lib.pisc", 147 + ) 148 +} 149 + 150 +func scriptsLibPisc() (*asset, error) { 151 + bytes, err := scriptsLibPiscBytes() 152 + if err != nil { 153 + return nil, err 154 + } 155 + 156 + info := bindataFileInfo{name: "scripts/lib.pisc", size: 672, mode: os.FileMode(436), modTime: time.Unix(1506682674, 0)} 157 + a := &asset{bytes: bytes, info: info} 158 + return a, nil 159 +} 160 + 161 +var _scriptsMainPisc = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x8c\x93\x4f\x6f\xea\x38\x14\xc5\xd7\x89\x94\xef\x70\x94\x61\xf1\xde\x13\xa1\xf3\x6f\x95\x57\x75\x34\xa2\x74\xa6\x12\x05\x69\xda\xae\x28\x0b\xc7\xb9\x24\x16\x8e\x9d\xb1\x0d\x14\x55\xfd\xee\x23\x3b\xa1\xd0\x99\x8a\xe9\x06\x9c\xeb\xdf\x3d\xbe\xf7\xfa\xf8\x07\x3c\xd4\xc2\x42\x58\xac\x84\x62\x12\x2b\xa3\x95\x13\x64\x86\x60\xa8\x58\x43\x10\xca\xb6\xc2\x50\xc9\x51\xec\x61\x5b\xc6\x69\x08\x67\x58\x49\x3b\xa1\x4a\x3b\x04\x53\x25\x18\xa4\x70\x4e\x12\x0a\xe1\xa0\x57\x90\x4c\x51\x56\x30\x4b\x25\xb8\x6e\x0a\xe6\x92\xf8\xe2\x5b\x12\xdf\x5e\x4f\x7e\xbf\xcf\x71\xc7\xf6\x05\xf9\xe3\x4a\x58\xdd\x10\x76\x6c\x0f\xa7\x21\x94\xa3\xca\x30\x47\x90\x5a\x55\x70\xa2\x21\x7f\xd0\x96\xa4\xdf\xd2\x70\x35\x81\x6f\xa4\xdb\x18\xf2\x67\x84\x52\x56\xcc\x90\xb1\x49\xfc\xed\x22\x89\x93\x38\xb5\xdc\x88\xd6\xd9\xa7\x27\x29\x8a\x51\x2b\x2c\x4f\x43\x0f\x59\x17\x3f\x05\x1a\x66\xd6\xe4\xec\x79\x48\x28\x67\xf4\x79\xc4\xb2\xad\x50\xd5\x47\x4c\x12\xe7\xd0\x2d\x29\xa1\xaa\xac\x21\xb5\xc1\x97\x6e\x9e\x59\x06\x45\xcf\x0e\x5f\x93\x38\xca\x7d\x24\x89\xa3\x5f\x71\xb9\x69\xb3\x52\xef\x54\x40\xaf\x90\x37\x49\x1c\x0d\x1a\x64\x57\xb5\xa8\x6a\x29\xaa\xda\x21\xbf\x9b\xcc\x1e\x93\x18\xd1\x02\x05\xe3\xeb\xac\x90\x8c\xaf\xb1\x44\x3e\xfe\x73\x7e\x3b\x9e\xf8\x9d\x6e\x85\xd6\x08\x15\x2a\xf0\xec\xa0\xc1\xa8\xd4\x8a\x7e\xc3\x32\x04\x92\x38\x8a\xc6\xd3\x7b\xff\x37\x9b\x4d\xfd\xdf\xe0\xc5\xff\x46\x7c\xcf\x14\xd2\x9b\xe0\x82\x9b\xde\x05\x29\x7a\x26\x32\x54\x22\x2c\x52\x20\xc5\x8f\xf0\xc5\x20\x9d\xd1\x0e\x7f\xb0\x86\x52\xf4\x47\x1f\xf0\x40\xfd\xd4\x53\x53\xcd\xca\x33\xd8\xcf\x3d\x36\x6f\x9d\xd0\xca\x7e\x0c\xfd\xd2\x43\x7f\x91\xdb\x18\xe5\xfd\x62\x88\x49\x48\xb1\xfa\xaf\xea\xae\x16\x8e\x90\x3e\xb6\x17\xd7\x7a\x17\x58\x5e\x6b\x6d\x69\x88\x89\x72\x64\x42\x40\xab\x95\x30\x0d\x52\x74\x39\xaf\xc7\xa1\x45\x7e\xf0\xa3\xd6\x68\x9e\xad\x69\x9f\xc4\xd1\x12\xbb\x5a\x48\x7f\x4f\x2f\x61\x04\x58\x20\x38\x03\xcb\xc3\xa7\xd4\xac\xcc\xc2\xed\x2e\xfb\x88\xee\x7a\x79\xfb\xa6\x67\xe1\x8e\xc4\x6b\xb8\x15\x5e\x6b\x4b\x2a\x13\xe5\x33\xb6\xc4\x33\xe6\x90\xc4\xdf\x3b\xe3\x1c\x05\x8f\xae\xc1\x57\x04\xbf\x60\x3c\xbd\xc7\xe0\x05\xe9\xc3\xfc\x7a\x9e\xe3\xb6\x69\x25\x35\xa4\x5c\x67\x3f\x9f\x69\x7d\x57\xe8\x5b\x92\x0a\x0b\xa4\x48\x31\xc2\x12\xdf\xbd\xb8\x65\x5b\xfa\xb7\xf8\xa7\xb4\x7d\xe2\xff\x68\x1f\xfa\xfe\xf2\x59\xd1\x43\xc6\x79\xd9\xe3\xf8\x4e\x4b\x3e\x36\xf2\xf7\xe6\xb0\xdf\x0f\xb0\x61\x42\xf5\x45\x24\x31\x00\x5c\x96\x82\xbb\xab\xf7\x2f\x32\xe7\x1b\x63\x32\xeb\x98\xa3\x77\x50\xff\x2c\x7d\x64\x01\x87\x25\x16\x18\x04\xf1\xc1\x31\x01\x9c\x49\x79\xaa\x80\x37\x9b\xf8\xbc\x8a\x5c\x30\x8f\x5f\x9f\xbc\xd6\x43\x7b\x7e\x22\xdd\xe6\x5b\xe5\xfd\xdd\xfb\xc2\x93\xf8\x9f\x00\x00\x00\xff\xff\x1f\xb5\xba\x12\x96\x05\x00\x00") 162 + 163 +func scriptsMainPiscBytes() ([]byte, error) { 164 + return bindataRead( 165 + _scriptsMainPisc, 166 + "scripts/main.pisc", 167 + ) 168 +} 169 + 170 +func scriptsMainPisc() (*asset, error) { 171 + bytes, err := scriptsMainPiscBytes() 172 + if err != nil { 173 + return nil, err 174 + } 175 + 176 + info := bindataFileInfo{name: "scripts/main.pisc", size: 1430, mode: os.FileMode(436), modTime: time.Unix(1506683028, 0)} 177 + a := &asset{bytes: bytes, info: info} 178 + return a, nil 179 +} 180 + 181 +var _scriptsMapPisc = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x6c\x90\x5f\x8b\x13\x31\x14\xc5\x9f\x33\x90\xef\x70\xa8\x03\xae\x8b\xb1\xfa\x9a\x95\xfa\x50\x16\x14\xd6\x0a\xca\xe2\x43\xe9\x43\x9a\x5c\x9b\xb0\xf9\x33\x24\xa9\xb3\x20\x7e\x77\x49\xa6\xe2\x22\xfb\x30\x19\x72\xcf\xb9\xe7\xde\xfc\xd6\xd7\x7c\xe0\xc3\x57\x8a\x86\x32\x14\x4e\xca\xab\xea\x34\x82\x9a\xf0\x23\xa7\x00\x4b\x99\x9a\xe3\x7a\xdd\x4e\x89\x52\x55\x16\x4d\xbd\xc2\x49\x05\x82\x10\x88\xf4\x58\xf1\x0a\x7c\x60\x7c\xb8\x69\xae\xee\xb3\x69\x16\x73\xca\xde\xe0\x0a\x93\x57\x91\xea\x33\x0d\xb2\x97\xe4\xa2\xb7\x46\x36\x5e\xbc\x62\x63\xa8\xe8\xec\xa6\xea\x52\xc4\x94\x5d\xac\x3e\xfe\xe7\xf0\x49\xab\x26\x17\x98\xf3\xd4\xbf\x3d\xc4\x26\xb6\xc8\x03\x7e\x92\xee\x7b\x4a\x9f\x74\xe9\x82\x4e\x21\xa8\x68\x9e\x6a\xda\x26\xa7\xa9\xb4\xd4\x6e\xf3\x14\xf1\x0e\x02\xef\xcf\x93\x30\x69\x8e\x22\x50\x3c\x6f\x20\xc3\x32\x39\x40\x6c\xac\x3b\x59\xef\x4e\xb6\x42\x7e\xbe\xdd\xdd\xf3\x01\x6c\x8f\xa3\xd2\x0f\xe2\xe8\x95\x7e\xc0\x01\x72\xfb\xf1\xcb\xa7\xed\xed\x42\x82\xed\x31\x06\xbc\x31\x29\xd2\x07\x1c\xf8\xc0\x5e\xe0\x3b\xbd\xcc\x84\x4c\xe2\x78\x76\xde\xb8\x78\x42\xb5\x84\x36\x09\xa4\xb4\x45\x75\x81\x30\xbb\x6a\xa1\x90\xa9\x54\xd4\x84\xd1\xf5\x28\x3e\x30\xb6\xbd\xfb\xd6\x7f\x7d\xc8\x3f\x32\x8c\xbd\x85\x6c\x2e\x36\xfe\x6a\xe7\x13\x4e\x9d\xc8\x6e\x77\xd7\xcb\x99\xcc\x22\x5f\xb8\x48\xdf\xaf\x6c\x74\x68\xef\xc1\x0a\x58\x61\xf4\xb8\xe4\xff\x6d\x5b\xa0\xb5\xfd\xfa\x75\xb6\xae\x12\x56\xf7\xd3\xba\x61\x6a\x1b\x16\xf2\xa4\xeb\x6b\x50\xac\x94\x5b\x41\xdb\x94\x0a\xad\xb0\x04\xfc\xe6\x03\x3b\x60\xb6\xce\xd3\xc2\xf2\x82\xbe\xd3\xd1\x36\x15\x8a\xc2\x99\xc7\x3e\x45\x55\x3e\xdc\xe0\x4f\x00\x00\x00\xff\xff\xb8\x77\xfd\xe3\x9a\x02\x00\x00") 182 + 183 +func scriptsMapPiscBytes() ([]byte, error) { 184 + return bindataRead( 185 + _scriptsMapPisc, 186 + "scripts/map.pisc", 187 + ) 188 +} 189 + 190 +func scriptsMapPisc() (*asset, error) { 191 + bytes, err := scriptsMapPiscBytes() 192 + if err != nil { 193 + return nil, err 194 + } 195 + 196 + info := bindataFileInfo{name: "scripts/map.pisc", size: 666, mode: os.FileMode(436), modTime: time.Unix(1504845781, 0)} 197 + a := &asset{bytes: bytes, info: info} 198 + return a, nil 199 +} 200 + 201 +var _scriptsMarketsPisc = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x8c\x92\x31\x6f\xdb\x4e\x0c\xc5\xf7\x03\xee\x3b\x10\xf0\x92\x04\x7f\xc3\x7b\xfe\x43\x01\x2b\x71\x9a\xc1\x68\x50\x17\xcd\x4c\x9f\x18\x1d\x91\xd3\x51\xe0\xf1\xec\xfa\xdb\x17\x27\xbb\x70\x81\x74\xc8\xc2\x41\xd4\xfb\xbd\x27\x3e\x2d\xc0\x3b\xef\x56\x77\x6d\xbe\x46\x34\xe0\x02\x16\x09\x28\x48\x96\xf1\x04\x83\x70\x1e\xc0\x04\xf6\x04\x89\xdf\x09\x38\x83\x45\x2e\x30\xe0\x48\x5f\x9a\x6a\xb1\x80\x35\x16\x0e\xf0\x24\xd2\x97\x99\x83\x46\xea\xdd\x46\xa4\xf7\x6e\x53\x29\x79\xf7\x4d\x69\xb5\x0b\x8a\xd3\x45\xf1\x80\x86\xd0\xe1\x54\x6a\xa2\x59\xf3\xa2\x32\x28\x8e\xc5\xbb\x9f\xdc\x93\x14\xef\x9e\x70\x6c\xab\x2d\x4e\x65\xd5\x45\x54\x2b\x17\xed\x57\xc2\xc3\xe9\xea\xf6\x5d\xf6\xd2\x76\xdb\x9a\xd9\x58\x72\xf1\x6e\x5d\x39\xf5\xcb\x4e\xc9\xc8\xbb\xc7\x7c\x60\x95\x65\x89\x4c\xa9\xe7\x3c\x5c\x28\x1b\xc5\x81\x13\x5d\x39\x3b\x49\xa8\xf0\x82\x99\x52\xf1\xae\x93\x71\xaa\x46\x0a\x5d\xe4\xa9\x78\xf7\x20\xa1\x8e\x94\x9b\xd1\x2e\xd4\x34\x59\xd5\x73\xf0\xbb\x55\x9b\xf7\x50\xa2\x1c\x97\x23\xea\x3b\x19\xdc\xc0\x72\x09\xb7\xf0\xff\x9f\xd3\xbe\x8a\xa6\x1e\x50\x43\x24\x3b\x4d\x67\x5d\x27\x49\xf2\xe9\xde\xbb\xc7\x5f\x93\xa8\x15\xd8\xcf\x47\x1c\x5a\x9c\xff\xe0\xc8\x16\x01\x41\x31\xf7\x32\x42\x88\x98\x03\x81\xbc\x01\xcd\x2f\xb7\x4a\x24\x13\x88\x45\x52\x68\xc8\xb6\x6b\x52\x40\x03\x84\x24\x47\x98\x94\x03\x35\xa3\xad\x64\x2c\xc6\x01\x7e\x50\x88\x59\x82\x62\x68\xb6\xcf\xe3\x3f\x6c\xe9\x92\xa5\x6f\xf5\x84\x4b\x3d\x8d\x7d\x40\x65\xa9\x05\xfe\x8a\xaf\x93\x28\x1a\x17\x83\xe7\xdc\xd7\x62\x9f\x23\xc7\xb9\xbc\xf9\xe1\xfc\xe7\x75\x4a\x67\xc8\x06\xf7\xca\x9f\x84\x7c\xe8\x6e\x4d\x55\x9b\xb4\x7d\xe6\x96\x4c\x3f\x60\xe8\x40\x7a\xb2\xc8\x79\xb8\x52\x26\x39\x92\xae\x38\xbf\xa5\x4a\xed\xbc\x37\x91\xe2\xed\xb9\xd2\xdf\x01\x00\x00\xff\xff\x8c\x0c\x77\x50\x16\x03\x00\x00") 202 + 203 +func scriptsMarketsPiscBytes() ([]byte, error) { 204 + return bindataRead( 205 + _scriptsMarketsPisc, 206 + "scripts/markets.pisc", 207 + ) 208 +} 209 + 210 +func scriptsMarketsPisc() (*asset, error) { 211 + bytes, err := scriptsMarketsPiscBytes() 212 + if err != nil { 213 + return nil, err 214 + } 215 + 216 + info := bindataFileInfo{name: "scripts/markets.pisc", size: 790, mode: os.FileMode(436), modTime: time.Unix(1504845781, 0)} 217 + a := &asset{bytes: bytes, info: info} 218 + return a, nil 219 +} 220 + 221 +var _scriptsSavingPisc = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x94\x56\x41\x6f\xdb\x38\x13\x3d\x4b\x80\xfe\xc3\x2b\xab\x83\xdd\xef\x53\xb2\x7b\x95\x83\x2c\x92\xa6\x28\x7a\x0a\xb0\xeb\xec\xc5\xf6\x81\x96\xc7\x31\x61\x45\x54\x48\xca\xae\x11\xe4\xbf\x2f\x86\xa4\x6d\xb9\x4d\x5c\x14\x08\x2c\x92\xc3\x37\x9c\x79\xf3\x86\xcc\xe5\x27\x64\x69\x96\x2e\xbb\xa6\xc2\x40\xe1\x5b\xe3\xe8\x91\xcc\x10\xe3\x5d\x4b\x83\x21\xac\x33\xaa\x79\xc4\x4b\x96\x26\x86\x5c\x67\x1a\x88\xb8\x45\x64\xe9\xeb\x11\xb9\xc0\x9d\xee\xe6\x35\x9d\x03\x86\x1d\xa7\x38\x89\x1b\x63\xe4\xee\x1c\xec\x5f\xaa\x9c\xfe\xf1\x38\x55\x39\xdc\xa9\xca\x9d\x3d\x4f\x55\x4e\xe9\x46\x9a\xdd\x29\x78\x8e\x5b\xad\x6b\x92\xcd\x39\x70\xdc\x72\x8a\xb4\xf8\xc7\xef\x3c\x07\x0c\x3b\xf6\xb8\x4f\x97\xfc\x5b\xc2\x92\x51\xb2\x2e\x9e\x64\xdb\x32\x60\x80\xa2\xc0\x7e\x32\xcc\xd2\xe4\x8a\x33\xba\xce\xd2\x24\x99\x60\x6b\x94\xa3\xc2\xa7\x38\xc3\xd5\x55\x71\xcc\xa3\x6f\xdf\x50\x15\xcc\x81\x9f\xbe\x49\x35\x11\x19\x4b\x75\xe2\xd6\x17\x21\x3a\xf6\xe3\xbe\x35\xe6\xe3\xad\x21\x91\xbe\x75\xae\x75\x1d\x6c\x91\x9d\x2c\x4d\x4a\x57\x38\xe9\xbd\x64\x69\x32\x41\xb9\x41\x96\x26\x40\x1e\x97\x91\x6f\xe0\x76\x2d\xe9\x25\x38\xa1\x62\x25\x6d\xb1\xa6\xdd\x5f\xc1\xed\x7b\xbb\x1e\xc9\x61\x16\xb7\xbc\x40\x30\xd9\x10\xbd\x4d\x02\x95\x6c\x1a\xed\x30\x27\x58\xb9\xa1\xc5\x85\xc0\x2b\xc8\x18\x6d\x3c\x0e\x50\xcb\x2c\x4d\x66\xc8\xd2\x51\xe4\x5f\x6e\x38\x3b\xe9\x08\x03\xb4\xd2\xad\x10\x26\x45\x11\x07\x43\x94\x61\x50\xb2\x35\x4b\x93\x3c\x4c\xe3\x89\x25\x7f\xb3\x34\x59\xa2\xb4\x5d\x55\x91\xb5\x3e\xdd\xdc\xbb\xd2\x2d\x35\xc5\x52\xd5\x54\x78\x9e\x0c\xca\xfb\x87\x31\x87\x2f\x4a\x5c\x60\xe0\x73\xc2\x46\xd6\x1d\x61\x4d\x3b\x3e\xd3\xaf\x0c\x43\xb2\x6d\x67\x57\x18\x09\xe4\xf7\x0f\x63\x5c\x04\xa6\x6b\xd5\xf8\xba\x04\x59\x30\xa5\x49\xe2\xed\x57\x57\x45\xf4\x9d\xfc\xc1\x13\x27\xe7\x3e\xd1\xf2\x91\x5c\xa1\x3b\xd7\x76\xce\x07\x46\xcf\x58\x74\x2d\xf2\x18\x2c\xb4\x39\x04\x8e\x19\x4a\x7a\xe6\xda\xe5\xce\x13\xdb\xeb\x13\xd0\x73\x83\x09\x8e\xce\x10\x69\x38\xd1\xe4\x76\x45\x3d\x78\xec\xcf\x5f\x40\x83\x5c\xf7\xc8\x23\x87\xc9\x04\x62\xda\x04\x9e\x24\x53\x33\xc4\xc2\xe8\x16\x23\xfc\xcc\x48\x5f\x13\x9f\x83\x00\xbc\x31\x72\xab\x97\xbe\x5a\x25\x23\x7d\x68\x7d\x49\x78\x41\x04\x87\x55\xad\x2d\x45\x65\x7c\xc4\xdf\xd4\xd6\xb2\x62\x7d\x6d\x95\x5b\x61\x2a\xa0\x1a\xb8\x15\xc5\xde\xfe\x3f\x9c\xc6\x9a\xa8\x85\x72\x58\x1a\xfd\x84\xb9\x21\xb9\xe6\x2e\xe9\x5a\x56\xd6\x73\xa7\xb9\x71\xe4\x92\x95\x65\x9d\x09\x92\x32\x18\x42\x4c\xa7\x82\x7f\xf8\x63\x9d\x29\xcc\xfe\xa4\xa9\x08\xeb\xe2\x74\x7d\xc4\xee\xb6\x46\xb6\x85\xf7\x69\x7f\xf6\xc7\x80\xad\x6c\x3d\xaa\xd2\x4d\x25\x5d\x5c\x3c\xce\xa3\xde\x7b\xf5\x1a\xa0\x72\xdf\x83\xe2\x3c\xbd\xdc\xb4\xad\x54\xc6\x7a\x85\x94\x6c\x2c\xae\x99\x98\xa8\xda\x8f\xf8\xd6\x54\x86\xa4\x25\x4f\x83\x93\xf3\x42\x35\x0b\x6a\x58\x58\xb9\x77\xd5\xb5\x28\xae\x9d\x9c\xe3\x4f\xfc\x0f\x5e\x83\xfe\x0d\x49\x7e\xb8\xe4\xca\x85\xb2\xad\x74\xd5\x2a\xb4\x4a\xaf\x98\x87\x6b\xa6\xec\x49\x56\x4c\x9d\x40\x1e\xc2\x61\x97\x91\x1a\x92\x0e\x51\x50\x33\x94\xe3\x9b\x5b\x7f\x94\x98\x36\x02\x07\xf0\xf8\xe6\x16\x22\xf4\xca\x71\x95\xc3\x0d\x79\x4e\x50\xae\x11\xc7\xc5\x75\xbe\x46\xb9\x61\x21\xe5\x1b\xec\x23\x44\xe9\x03\xf3\x3d\x7b\xf4\x0c\xef\x97\xc3\x3a\x9c\x14\x18\xc8\x37\x51\x78\x1e\x80\x13\xfb\xba\xaf\x88\x7e\x35\x8f\x7b\x04\x2e\x0e\x47\xf8\xee\xf5\xf7\x00\xc9\x6a\xc5\x77\xe3\x5b\x34\x17\x07\x9a\x47\x59\x9a\x1c\x0b\xcc\x5d\x15\xea\xcb\x23\x2e\x2f\x57\x97\x6a\x7a\x7a\xaf\xba\x67\x2a\xf8\x5b\x35\x38\x57\xec\x73\x0a\xfa\x95\x10\xb8\xb6\x2f\x7d\x76\xf2\x90\xcd\x04\x25\xbd\xc1\xb6\xaf\x06\xf1\xdf\xa1\x94\x95\xac\xeb\x40\xeb\x86\x2a\xcf\x2a\xfb\xc4\x6b\x0f\x77\x9e\x5f\xf4\x5b\x88\xdf\xd2\xc0\x30\x8f\x7c\x03\x5d\xc7\xa8\x7d\x2b\x06\x72\x4f\xd3\x19\x1d\xe1\x71\x25\x78\x88\xdd\x3c\x7c\x4f\x21\xef\x3b\x44\xaf\xa7\xc3\x03\x1e\xbb\x3a\x4c\x8a\x02\x18\xe2\xb7\x02\xf3\x6f\x79\x70\xe2\x87\xc1\xc5\x24\x28\x86\x15\xd9\x62\x02\xe1\x04\x66\xfc\x5d\xf2\x57\x2d\xf7\xd2\x78\xd3\x73\xb8\x4e\xef\xbe\xdc\x3e\x7c\xcd\xd2\xcb\x4f\x59\x2a\x74\xe7\x2e\xdc\x77\x27\xa0\x9e\x5a\x6d\x1c\xca\x05\xef\x39\x2e\xe7\x8b\xde\xbb\xec\x4d\xe3\xfb\xbb\xfb\x12\x37\x8b\x05\x1c\x59\x67\x3f\x7c\x10\x68\x8d\x6a\x5c\xdd\x1c\x8c\x9f\x75\x63\xd5\x82\x0c\xec\x56\xb9\x6a\xc5\x87\x73\xfb\x58\xbe\xa7\x3b\x4b\xa8\x8c\x72\x73\xe5\xe0\x0c\x91\xed\xc1\xf9\x3f\xb1\x8f\xf8\xfa\x70\xfb\xe5\x2e\x4b\xff\x0b\x00\x00\xff\xff\x80\xeb\xb1\x62\xf6\x0a\x00\x00") 222 + 223 +func scriptsSavingPiscBytes() ([]byte, error) { 224 + return bindataRead( 225 + _scriptsSavingPisc, 226 + "scripts/saving.pisc", 227 + ) 228 +} 229 + 230 +func scriptsSavingPisc() (*asset, error) { 231 + bytes, err := scriptsSavingPiscBytes() 232 + if err != nil { 233 + return nil, err 234 + } 235 + 236 + info := bindataFileInfo{name: "scripts/saving.pisc", size: 2806, mode: os.FileMode(436), modTime: time.Unix(1506683130, 0)} 237 + a := &asset{bytes: bytes, info: info} 238 + return a, nil 239 +} 240 + 241 +var _scriptsShipsPisc = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x94\x56\x4d\x6f\xdc\x36\x10\x3d\x5b\x80\xfe\xc3\x03\x12\xa0\xb6\xb1\x6b\xc7\x75\x4f\xea\x22\x45\xea\x24\x68\x80\xe4\xd2\x04\xc8\xa1\xe8\x61\x24\x8e\x24\x76\x25\x52\xe5\x50\xbb\x56\x8b\xfe\xf7\x62\x48\x6d\xec\x24\x6d\x81\xc2\x30\x56\x22\xe7\xe3\x71\xe6\xcd\xa3\x9e\xe0\x63\x4f\x11\x56\x10\x7b\xc6\xe8\x0d\x0f\x68\x7d\x80\xf4\x76\x12\x74\xde\xba\x0e\xd1\xa3\xe6\x1f\xca\xa2\x2c\x9e\xe0\x2d\x39\x46\x5c\x26\x16\x34\xe4\x50\x33\x6e\xe0\xdb\xe4\xfc\x1d\x46\xfa\xcd\x87\xbc\x9b\xad\x9f\x61\x8b\x1f\x49\x6c\x53\xe1\x8e\x1c\x1a\x0a\x61\x41\xad\x0b\xfa\xdc\x79\xb5\xb9\xc1\x16\x2f\x29\xd2\x63\x13\x43\x91\x34\xec\x81\x82\xf5\xb3\x60\x6f\x9d\x91\x8d\xa2\x0c\x64\x2c\x45\xeb\x9d\x22\xe4\xc1\xb0\xb9\xc2\x0b\x34\xbe\xd9\x4f\x36\xa2\x27\xc1\x4d\xf6\x96\xc1\x47\xd4\x0b\x0c\xb7\x34\x0f\x51\x33\x7d\x8b\x2d\x7e\x62\x3a\x2c\xff\x82\x66\x03\x1f\xd0\x33\x1d\x2c\x07\x74\xde\x1b\x81\xba\xdd\x62\x8b\xd7\x81\x3a\x3b\x70\x85\x37\x82\x7a\xb6\x43\xc4\xd1\xc6\x1e\xd2\xfb\x66\x0f\xaa\xc5\x87\x5a\x14\x54\xf4\xa0\x61\xf0\x47\xc4\x40\x4e\x26\x1f\xa2\x1e\xa3\xcd\xde\x39\xa6\x56\xa6\xc2\x6e\x20\xc7\xcf\x71\x0e\xb1\x7f\xe4\x82\x62\xbb\x85\x2e\xe2\x02\x65\x71\x56\xa5\xa5\x4a\x77\xcb\xe2\xec\x4f\x3c\x4d\x76\xbf\xa0\xc5\xaf\x88\x76\x64\xc1\x5f\xa8\xd6\x1a\x9e\xed\x8c\x6d\xe2\xf3\xb2\x38\x3b\x7b\x9a\x96\xb0\xdb\x6d\x4f\x7b\x67\x4f\x53\xa4\xdd\x6e\xab\xbf\x65\xf1\xfd\x9a\x5f\x1b\xac\xf9\x1d\x8d\x9c\xf2\x8a\x02\xd0\xd5\x15\x40\x5e\xab\x74\xff\xf3\x14\x79\x63\xb7\xdb\xa6\x87\xb4\x94\x82\xec\x76\xdb\x6c\x9c\x52\x5c\x5f\x96\xc5\x2b\x6a\xfa\x1c\xd2\x9e\xca\xe6\xe7\x54\x91\xd5\xf5\xc1\x40\x3b\x47\x30\xc1\x3b\xc6\xe0\xc9\xa8\x5d\xe3\x5d\x0c\x7e\x18\xd8\x68\x23\x95\x62\x77\xb9\xcf\x65\xf1\x26\x53\xee\xd4\x77\x2b\x30\x2c\x31\xf8\x85\xcd\x06\x8b\x9f\xd1\x29\x22\x2b\xf0\x07\x0e\x57\x28\x8b\x77\x5e\xe2\x4a\x6a\xe3\xdd\x37\x11\x31\x2c\xda\xad\xd5\x0d\xf4\xc0\x21\x7f\xe4\x03\x87\x0d\xca\x62\x0a\xdc\x72\x08\xeb\x0c\x0c\x4c\x07\x4e\xc1\x7b\x1e\xa6\x81\x45\x94\x2f\x0d\x4d\x71\x0e\x69\xfd\x4a\xcf\xfd\x3e\xe5\xd0\xd9\xe8\xd5\xfc\xe6\xfe\x56\x7d\x6f\xef\x6f\x9e\xc1\x3a\x18\x3b\xb2\x53\xfa\xca\x06\xe4\x0c\x5a\x9b\x8e\x97\xc8\x64\x6c\xdb\x72\x60\x17\x21\xdc\xa9\x59\xa2\xca\xdb\x54\x6d\x8d\xd7\x78\x3d\x92\xc3\x6d\xe2\x8c\x80\x04\x47\x1e\x86\x0d\xde\x8f\xa4\x3f\xef\xd8\xd8\x31\x45\x7d\x4b\xa1\xe3\x04\x26\x07\x5a\x07\xf6\xfc\x12\xd6\x19\xdb\x50\x64\x8c\xe4\x0c\x45\x1f\x96\x53\xb2\x8b\x0a\x29\x9d\x6d\x79\x2b\xf3\xa4\xd4\xbd\x5e\xcb\x7d\xa9\xb5\x78\xe5\x3a\xeb\x58\x2e\x37\x65\xf1\x7a\xe6\x01\x1f\xc8\xed\x2f\xcb\x22\xf3\x6d\xf2\xa6\x2c\xee\x02\x1f\xf1\xfb\x4c\x21\x72\xc0\xf9\x0d\x1a\x7d\x1f\x79\xac\x39\x60\xe2\x00\xe1\x46\x4f\x7e\x51\x16\xb9\xcd\x93\x37\x6a\xb6\xbe\x7c\x66\x50\x16\x1f\x7a\x0e\x0c\xd2\xff\x41\x34\x81\x88\xad\x07\x86\xf3\x6e\x2b\x51\xc1\x07\xf3\xa9\x4e\x55\x42\xee\x5d\x87\x40\xae\x63\x08\x3b\xf1\x41\x70\x0e\xbe\x8f\x41\x5b\x3b\xd6\x14\x11\xfc\xec\x0c\x2e\xca\xe2\x4e\x89\x45\xb5\x96\x2a\x81\x40\x4b\x01\x35\x47\x05\xde\xf4\xe4\x1a\x56\x8e\x4e\x24\xa2\xad\x27\x07\xeb\x64\xca\xe0\xd4\x5d\x5b\x0c\x69\xc8\x39\x3d\x68\x9a\x77\x49\xbc\x88\x1e\xc2\xda\x23\x7d\x48\x46\x2b\xc0\x8b\xb2\xf8\xe0\x8f\x98\xa8\xd9\x53\xc7\x5f\xfa\xf4\x34\x0f\x99\x9b\xd7\x31\x90\x1d\x38\x08\x28\x81\xbd\x78\xd4\x44\xc9\x84\x3a\x50\x58\x14\xd5\xc0\x07\x1e\x44\x71\x52\x18\x7d\xa8\xca\x62\xf0\xc7\x2c\x6c\x35\xa3\x0e\x4c\x4d\x9f\x07\x87\xdc\x02\x8a\xb1\xd9\x97\xc5\xc8\xc6\xce\x63\x85\x8f\x76\x18\x12\xe9\x52\x29\x41\x18\xad\xb3\xe3\x3c\x6a\xb8\x1b\xc8\xdc\x34\x2c\xd2\xce\x83\xfa\x51\xb3\xbf\x2a\x8b\x3e\xeb\xe6\x7f\x39\xde\x7e\xed\x28\x69\x24\x5e\x6a\x87\xe5\x11\x7f\xb3\xe6\x26\x52\xa6\xd6\xbd\x48\xc6\x15\xde\xf7\xde\x47\x81\xc4\xb9\x6d\xcb\xe2\x25\xb7\xec\x1a\xae\x90\x1e\x8c\x80\x3a\xb2\x4e\xe2\x1a\x3b\x13\x47\x36\xe0\x2c\x22\x3e\x6a\xef\x42\xc7\x82\x79\x52\x64\xdc\xd1\xb6\x66\x1a\xcb\xe2\x8d\x77\x95\x5a\x84\x28\x5b\x15\x96\xec\xa9\xa3\x72\xed\x3f\xd1\x2e\x4d\xdb\x0b\x73\xd0\xf6\x9b\xd5\xa4\xc2\xcf\x64\x0d\x07\xdd\xca\x4f\x27\x5f\xe3\x41\xe9\x7a\xe2\xb8\xe4\x0b\xd0\xba\x4e\x36\x30\x3c\xb1\x33\xda\x20\xef\x70\xec\x6d\xd3\x67\x71\xf7\xed\x89\x0c\x2a\x5c\x8b\xce\x9f\x32\x41\xbb\xaf\x7a\x76\x52\xb4\x45\x5f\xf1\xd9\x10\xae\xba\xb4\xc9\xdb\x91\xf6\x9c\x44\x2d\xe9\x9f\x92\x46\x87\x33\x27\x5a\x59\x65\x63\xbe\xb1\x21\x03\x1d\xd8\xe8\xcb\xe2\xe7\x20\xe9\x5e\x7f\xb8\x97\x56\x8e\x2e\x14\xf2\x9d\xf4\x18\x00\x81\xd3\xb8\xeb\x78\xa4\xc4\xf0\xd3\xe4\xd3\x34\x24\x5e\x1f\x95\x06\x29\x83\x3f\x6a\xb1\xfc\xd1\x7d\x1d\x22\xc9\x44\x24\xb7\xdf\x28\xb2\x14\xa5\xd5\x25\xeb\x10\xf5\x9b\x43\xb7\xd2\x87\x87\x42\x52\xe5\xfb\x04\x35\x27\x71\x7c\x1f\x11\xe7\xf0\x0f\xa1\xb3\xea\xd4\xb4\x64\x70\xf9\xf5\x14\xb7\xa6\xe5\x21\x2c\xfd\xaf\xb0\x81\x8f\xdb\x55\xc1\xd6\xc8\x8f\x34\xec\x14\xff\x24\x71\x56\xc0\x36\xf6\x1c\xa0\x32\x98\x6e\x01\xa3\x37\xc2\x3e\x69\xfa\x17\x54\xb0\x6d\xbe\x39\x74\x84\x65\xa2\x26\xb5\x3e\x7f\x81\xc4\x9e\x47\xf5\x73\x3e\xa6\x71\xf9\xfa\xef\xef\x00\x00\x00\xff\xff\x2f\xdf\x8e\xdf\xa5\x09\x00\x00") 242 + 243 +func scriptsShipsPiscBytes() ([]byte, error) { 244 + return bindataRead( 245 + _scriptsShipsPisc, 246 + "scripts/ships.pisc", 247 + ) 248 +} 249 + 250 +func scriptsShipsPisc() (*asset, error) { 251 + bytes, err := scriptsShipsPiscBytes() 252 + if err != nil { 253 + return nil, err 254 + } 255 + 256 + info := bindataFileInfo{name: "scripts/ships.pisc", size: 2469, mode: os.FileMode(436), modTime: time.Unix(1504845781, 0)} 257 + a := &asset{bytes: bytes, info: info} 258 + return a, nil 259 +} 260 + 261 +var _scriptsTerm_posixPisc = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x7c\x94\x41\x8f\xda\x30\x10\x85\xef\xf9\x15\x4f\xde\x3d\x90\x43\xa4\x0d\x78\xa1\x0d\x42\x7b\x40\xad\xaa\x0a\x71\xd9\x23\xcb\x21\x98\x81\x8d\x08\x31\x72\x4c\x51\x54\xf5\xbf\x57\xb6\xe9\x3a\xae\x61\x25\x24\x3c\xf3\x3e\x8f\x67\xde\x48\x29\x20\x64\x2d\x55\x26\xe4\x96\x30\x80\xfd\xcb\xb2\x6b\x92\x5a\x81\x14\x85\x4d\x3e\xfe\xc6\xb7\xd7\x39\xd8\x8a\xe1\xd1\x26\xd8\x91\xe1\x0f\xa6\x49\xf2\x80\x79\x4d\xa5\x42\x2b\x14\x51\x83\xb2\xd9\xe2\x28\x7f\x11\xc4\x59\xb5\x52\x41\x4b\x68\x79\xca\x6a\xda\xe9\xa4\xc0\x7c\xf1\x8a\x81\x79\x21\xf5\x15\x87\x3f\xd9\xf5\x34\xfd\x61\x6a\x9e\x54\xd5\x68\x4c\x93\x02\xcb\x85\x83\x97\x0b\xa4\x60\x6f\xea\xad\x61\x2e\x1f\x08\xcb\x85\xf9\xd9\x4e\xbe\x4b\x45\x99\x6d\xbe\x4d\x0a\x6c\xea\x52\x1c\x1c\x48\xad\xc8\x5c\x98\x82\x8d\x9e\x58\x7f\x6c\x53\x51\xd1\xd6\x83\x26\x30\x58\x1e\x61\x7b\x3b\xe2\x07\xe8\x42\x83\x0e\x23\xb4\xa3\xba\x96\x17\xcf\x5e\x63\x03\x8f\x22\x78\x53\x9f\xa9\xdf\xe8\x99\x2c\xc8\x23\xf0\x58\xee\xa9\xd1\xa5\x67\xff\x25\x0c\xfe\x1c\xe1\xa2\x2b\x7b\xed\xda\xc8\x80\xe3\x08\xbc\xbc\x57\xba\xd7\x81\x0b\x0d\x3a\xf9\x0f\x4d\x1e\xb0\x29\xc5\xa1\x67\xb2\x89\xee\x39\xcd\x63\xa7\x2d\x7f\xcb\x6e\x1e\xdb\x6d\xd9\x7b\x9e\xf3\xd8\x73\xcb\xdf\x37\x9e\xdf\x30\xde\x75\x7f\xcb\x7d\x1e\xbb\x6f\xe9\xcf\x56\xc0\xe3\x15\x38\xb7\x6e\xee\x81\xc7\x7b\xb0\xf4\xbd\x65\xf0\x68\x19\x05\xaa\x36\xa3\x46\x93\x7a\xc1\x00\x07\x73\xe3\x05\x29\xf2\x11\x66\xb6\x5c\xd5\x66\xa5\x52\xf2\x12\xa8\xc3\x09\x66\x58\x61\x4f\xfa\x40\x1d\xbe\xe6\x98\x61\x8d\x15\x76\x58\xa3\xda\x7d\x54\x3d\x9f\x82\x4b\xe3\x67\x5f\x72\x2b\x2f\x4d\x28\x8e\xbd\xa8\xaa\xfd\xbb\x0e\xd5\x89\x57\xcd\x67\x20\x14\xbf\x58\xd1\xa9\x5d\x38\xc5\x30\xf7\x17\xc3\x07\xf3\xfc\xc9\x4b\x5d\xa8\x61\x75\x2d\xb5\x76\xa7\xc6\x9c\x36\x15\xa4\xc2\x34\xf9\x1b\x00\x00\xff\xff\x61\x7b\xb6\x42\xf0\x04\x00\x00") 262 + 263 +func scriptsTerm_posixPiscBytes() ([]byte, error) { 264 + return bindataRead( 265 + _scriptsTerm_posixPisc, 266 + "scripts/term_posix.pisc", 267 + ) 268 +} 269 + 270 +func scriptsTerm_posixPisc() (*asset, error) { 271 + bytes, err := scriptsTerm_posixPiscBytes() 272 + if err != nil { 273 + return nil, err 274 + } 275 + 276 + info := bindataFileInfo{name: "scripts/term_posix.pisc", size: 1264, mode: os.FileMode(436), modTime: time.Unix(1506682689, 0)} 277 + a := &asset{bytes: bytes, info: info} 278 + return a, nil 279 +} 280 + 281 +var _scriptsTerm_winPisc = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x7c\x93\x41\x8b\xdb\x30\x10\x85\xef\xfe\x15\x0f\xed\x1e\xe2\x83\x61\xed\x68\x9b\xe2\xa5\xec\x21\xb4\x94\x12\x72\xd9\xe3\x6e\x0f\x8e\x32\x4d\x4c\x1c\x2b\xc8\x4a\x43\x28\xfd\xef\x65\xa4\xb4\xb2\xaa\x64\x21\x10\xcd\xbc\x4f\x33\xa3\x37\xb8\x86\xd2\x9d\x36\x85\xd2\x6b\xc2\x04\xee\xaf\x28\x2e\x49\x1a\x14\x72\xd4\x2e\x79\xff\x0b\x9f\x5f\xe6\x10\xaf\x02\xf7\x2e\x21\xf6\x02\xbf\xf1\x94\x65\x77\x98\x77\xd4\x18\x0c\xca\x10\xf5\x68\xfa\x35\xf6\xfa\x27\x41\x1d\xcd\xa0\x0d\xac\x86\xd5\x87\xa2\xa3\x1f\x36\xab\x31\x5f\xbc\x60\xc2\x1d\xf2\x50\xb1\xfa\x26\x2e\xa7\xaf\x5c\xf2\x60\xda\xde\xe2\x29\xab\xb1\x5c\x78\x76\xb9\x40\x0e\xf1\x66\xde\x7a\xe1\xf3\x91\xb0\x5c\xf0\xcf\x0d\xf2\x45\x1b\x2a\xdc\xec\x43\x56\x63\xd5\x35\x6a\xe7\x41\x1a\x54\xe1\xc3\x1c\x62\xfa\x20\xc6\xaf\xe6\x8a\x86\xd6\x01\xe4\x80\xb1\x32\xc1\x36\xee\x85\xff\x40\x1f\x32\x5a\x25\xe8\x99\xba\x4e\x9f\x02\x7b\x89\x19\x9e\x26\xf0\xaa\x3b\xd2\x78\xd0\x23\x39\x50\x26\xe0\xbe\xd9\x50\x6f\x9b\xc0\xfe\x4d\x30\xfe\x98\xe0\xea\xdc\x8c\xc6\x75\x11\x83\x1f\x12\xf0\xb4\x6d\xed\x68\x02\x1f\x32\x3a\xfb\x0f\xcd\xee\xb0\x6a\xd4\x6e\x64\x32\x47\xb7\x9c\x96\xa9\xd3\x8e\xbf\x66\xb7\x4c\xed\x76\xec\x2d\xcf\x65\xea\xb9\xe3\x6f\x1b\x2f\xaf\x18\xef\xa7\xbf\xe6\xbe\x4c\xdd\x77\xf4\x7b\x2b\x90\xe9\x0a\xbc\x5b\x57\xf7\x20\xd3\x3d\x38\xfa\xd6\x32\x64\xb2\x8c\x1a\xed\x50\x50\x6f\xc9\x3c\x63\x82\x1d\xdf\x78\x46\x8e\x72\x8a\x4f\xae\x5c\x3b\x14\x8d\x31\xfa\x14\xa9\x55\x25\x9d\xec\xf5\xe3\x21\x12\x67\x55\xb8\xba\xd6\xa7\x3e\x12\x3f\x3e\x04\xd1\xb4\x9b\xad\x8d\xaf\xce\x82\xca\x5f\x7b\x2c\x3e\x8e\x7a\x9e\xe3\x69\xab\x32\x5c\x8c\x1b\x96\xe5\xa8\xe3\x39\xd6\xf0\x7a\x29\xf5\xdd\x9f\x7a\x3e\xad\x5a\x68\xc3\x7d\xfe\x04\x00\x00\xff\xff\x86\xb3\x64\xa9\xd8\x04\x00\x00") 282 + 283 +func scriptsTerm_winPiscBytes() ([]byte, error) { 284 + return bindataRead( 285 + _scriptsTerm_winPisc, 286 + "scripts/term_win.pisc", 287 + ) 288 +} 289 + 290 +func scriptsTerm_winPisc() (*asset, error) { 291 + bytes, err := scriptsTerm_winPiscBytes() 292 + if err != nil { 293 + return nil, err 294 + } 295 + 296 + info := bindataFileInfo{name: "scripts/term_win.pisc", size: 1240, mode: os.FileMode(436), modTime: time.Unix(1506682723, 0)} 297 + a := &asset{bytes: bytes, info: info} 298 + return a, nil 299 +} 300 + 301 +// Asset loads and returns the asset for the given name. 302 +// It returns an error if the asset could not be found or 303 +// could not be loaded. 304 +func Asset(name string) ([]byte, error) { 305 + cannonicalName := strings.Replace(name, "\\", "/", -1) 306 + if f, ok := _bindata[cannonicalName]; ok { 307 + a, err := f() 308 + if err != nil { 309 + return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err) 310 + } 311 + return a.bytes, nil 312 + } 313 + return nil, fmt.Errorf("Asset %s not found", name) 314 +} 315 + 316 +// MustAsset is like Asset but panics when Asset would return an error. 317 +// It simplifies safe initialization of global variables. 318 +func MustAsset(name string) []byte { 319 + a, err := Asset(name) 320 + if err != nil { 321 + panic("asset: Asset(" + name + "): " + err.Error()) 322 + } 323 + 324 + return a 325 +} 326 + 327 +// AssetInfo loads and returns the asset info for the given name. 328 +// It returns an error if the asset could not be found or 329 +// could not be loaded. 330 +func AssetInfo(name string) (os.FileInfo, error) { 331 + cannonicalName := strings.Replace(name, "\\", "/", -1) 332 + if f, ok := _bindata[cannonicalName]; ok { 333 + a, err := f() 334 + if err != nil { 335 + return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err) 336 + } 337 + return a.info, nil 338 + } 339 + return nil, fmt.Errorf("AssetInfo %s not found", name) 340 +} 341 + 342 +// AssetNames returns the names of the assets. 343 +func AssetNames() []string { 344 + names := make([]string, 0, len(_bindata)) 345 + for name := range _bindata { 346 + names = append(names, name) 347 + } 348 + return names 349 +} 350 + 351 +// _bindata is a table, holding each asset generator, mapped to its name. 352 +var _bindata = map[string]func() (*asset, error){ 353 + "scripts/backstory.txt": scriptsBackstoryTxt, 354 + "scripts/gamesave.pisc": scriptsGamesavePisc, 355 + "scripts/intro.pisc": scriptsIntroPisc, 356 + "scripts/lib.pisc": scriptsLibPisc, 357 + "scripts/main.pisc": scriptsMainPisc, 358 + "scripts/map.pisc": scriptsMapPisc, 359 + "scripts/markets.pisc": scriptsMarketsPisc, 360 + "scripts/saving.pisc": scriptsSavingPisc, 361 + "scripts/ships.pisc": scriptsShipsPisc, 362 + "scripts/term_posix.pisc": scriptsTerm_posixPisc, 363 + "scripts/term_win.pisc": scriptsTerm_winPisc, 364 +} 365 + 366 +// AssetDir returns the file names below a certain 367 +// directory embedded in the file by go-bindata. 368 +// For example if you run go-bindata on data/... and data contains the 369 +// following hierarchy: 370 +// data/ 371 +// foo.txt 372 +// img/ 373 +// a.png 374 +// b.png 375 +// then AssetDir("data") would return []string{"foo.txt", "img"} 376 +// AssetDir("data/img") would return []string{"a.png", "b.png"} 377 +// AssetDir("foo.txt") and AssetDir("notexist") would return an error 378 +// AssetDir("") will return []string{"data"}. 379 +func AssetDir(name string) ([]string, error) { 380 + node := _bintree 381 + if len(name) != 0 { 382 + cannonicalName := strings.Replace(name, "\\", "/", -1) 383 + pathList := strings.Split(cannonicalName, "/") 384 + for _, p := range pathList { 385 + node = node.Children[p] 386 + if node == nil { 387 + return nil, fmt.Errorf("Asset %s not found", name) 388 + } 389 + } 390 + } 391 + if node.Func != nil { 392 + return nil, fmt.Errorf("Asset %s not found", name) 393 + } 394 + rv := make([]string, 0, len(node.Children)) 395 + for childName := range node.Children { 396 + rv = append(rv, childName) 397 + } 398 + return rv, nil 399 +} 400 + 401 +type bintree struct { 402 + Func func() (*asset, error) 403 + Children map[string]*bintree 404 +} 405 +var _bintree = &bintree{nil, map[string]*bintree{ 406 + "scripts": &bintree{nil, map[string]*bintree{ 407 + "backstory.txt": &bintree{scriptsBackstoryTxt, map[string]*bintree{}}, 408 + "gamesave.pisc": &bintree{scriptsGamesavePisc, map[string]*bintree{}}, 409 + "intro.pisc": &bintree{scriptsIntroPisc, map[string]*bintree{}}, 410 + "lib.pisc": &bintree{scriptsLibPisc, map[string]*bintree{}}, 411 + "main.pisc": &bintree{scriptsMainPisc, map[string]*bintree{}}, 412 + "map.pisc": &bintree{scriptsMapPisc, map[string]*bintree{}}, 413 + "markets.pisc": &bintree{scriptsMarketsPisc, map[string]*bintree{}}, 414 + "saving.pisc": &bintree{scriptsSavingPisc, map[string]*bintree{}}, 415 + "ships.pisc": &bintree{scriptsShipsPisc, map[string]*bintree{}}, 416 + "term_posix.pisc": &bintree{scriptsTerm_posixPisc, map[string]*bintree{}}, 417 + "term_win.pisc": &bintree{scriptsTerm_winPisc, map[string]*bintree{}}, 418 + }}, 419 +}} 420 + 421 +// RestoreAsset restores an asset under the given directory 422 +func RestoreAsset(dir, name string) error { 423 + data, err := Asset(name) 424 + if err != nil { 425 + return err 426 + } 427 + info, err := AssetInfo(name) 428 + if err != nil { 429 + return err 430 + } 431 + err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755)) 432 + if err != nil { 433 + return err 434 + } 435 + err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode()) 436 + if err != nil { 437 + return err 438 + } 439 + err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime()) 440 + if err != nil { 441 + return err 442 + } 443 + return nil 444 +} 445 + 446 +// RestoreAssets restores an asset under the given directory recursively 447 +func RestoreAssets(dir, name string) error { 448 + children, err := AssetDir(name) 449 + // File 450 + if err != nil { 451 + return RestoreAsset(dir, name) 452 + } 453 + // Dir 454 + for _, child := range children { 455 + err = RestoreAssets(dir, filepath.Join(name, child)) 456 + if err != nil { 457 + return err 458 + } 459 + } 460 + return nil 461 +} 462 + 463 +func _filePath(dir, name string) string { 464 + cannonicalName := strings.Replace(name, "\\", "/", -1) 465 + return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...) 466 +} 467 +
Added cmd/FinalFrontier/build.sh.
1 +#! /bin/bash 2 +function older_than() { 3 + local target="$1" 4 + shift 5 + if [ ! -e "$target" ] 6 + then 7 + echo "updating $target" >&2 8 + return 0 # success 9 + fi 10 + local f 11 + for f in "$@" 12 + do 13 + if [ "$f" -nt "$target" ] 14 + then 15 + echo "updating $target" >&2 16 + return 0 # success 17 + fi 18 + done 19 + return 1 # failure 20 +} 21 + 22 +# For now, force re-packing of bindata 23 +rm bindata.go 24 + 25 +older_than bindata.go strings/*.pisc && { 26 + echo "Packing scripts" 27 + go-bindata -pkg main -o bindata.go scripts/... 28 +} 29 + 30 +case "$1" in 31 + build) 32 + older_than game.exe *.go && { 33 + go build -o game.exe 34 + } 35 + ;; 36 + run) 37 + older_than game.exe main.go finalFrontier.go && { 38 + rm game.exe 39 + go build -o game.exe 40 + } 41 + ./game.exe 42 + ;; 43 +esac 44 + 45 + 46 + 47 + 48 +
Added cmd/FinalFrontier/finalFrontier.go.
1 +package main 2 + 3 +import ( 4 + "os" 5 + "pisc" 6 +) 7 + 8 +func loadGameScript(m *pisc.Machine) error { 9 + assetKey := m.PopValue().String() 10 + data, err := Asset(string(assetKey)) 11 + if err != nil { 12 + return err 13 + } 14 + err = m.ExecuteString(string(data), pisc.CodePosition{Source: "file:" + string(assetKey)}) 15 + if err != nil { 16 + return err 17 + } 18 + return nil 19 +} 20 + 21 +func getTermMode(m *pisc.Machine) error { 22 + m.PushValue(pisc.String(mode)) 23 + return nil 24 +} 25 + 26 +func exit(m *pisc.Machine) error { 27 + de_init_term() 28 + os.Exit(0) 29 + return nil 30 +} 31 + 32 +var ModFinalFrontier = pisc.Module{ 33 + Author: "Andrew Owen", 34 + Name: "ConsoleIO", 35 + License: "MIT", 36 + DocString: "Provides basic OS-interaction words", 37 + Load: loadFinalFrontier, 38 +} 39 + 40 +func loadFinalFrontier(m *pisc.Machine) error { 41 + init_term() 42 + m.AddGoWord("term-mode", "( -- mode )", getTermMode) 43 + m.AddGoWord("getkey", "( -- keyval )", getch) 44 + m.AddGoWord("game-script", "( filename -- ? ) ", loadGameScript) 45 + m.AddGoWord("quit-game", "( -- )", exit) 46 + os_overload(m) 47 + return nil 48 +}
Added cmd/FinalFrontier/init_posix.go.
1 +// +build !windows 2 + 3 +package main 4 + 5 +import ( 6 + "fmt" 7 + "github.com/pkg/term" 8 + "pisc" 9 +) 10 + 11 +var mode = "POSIX" 12 + 13 +var pty *term.Term 14 +var buf = make([]byte, 1) 15 + 16 +func init_term() error { 17 + var err error 18 + pty, err = term.Open("/dev/tty", term.RawMode) 19 + if err != nil { 20 + return err 21 + } 22 + return nil 23 +} 24 + 25 +func de_init_term() error { 26 + return pty.Restore() 27 +} 28 + 29 +func os_overload(m *pisc.Machine) error { 30 + return nil 31 +} 32 + 33 +func getch(m *pisc.Machine) error { 34 + num, err := pty.Read(buf) 35 + 36 + if err != nil { 37 + return err 38 + } 39 + if num != 1 { 40 + return fmt.Errorf("Didn't read at least 1 byte from the pty!") 41 + } 42 + 43 + m.PushValue(pisc.Integer(int(buf[0]))) 44 + return nil 45 +}
Added cmd/FinalFrontier/init_windows.go.
1 +// +build windows 2 + 3 +package main 4 + 5 +import ( 6 + "pisc" 7 + "github.com/mattn/go-colorable" 8 + "io" 9 + "fmt" 10 +) 11 + 12 +//#include <conio.h> 13 +import "C" 14 + 15 +var mode = "WINDOWS" 16 +var writer io.Writer 17 + 18 +func init_term() error { 19 + writer = colorable.NewColorableStdout() 20 + return nil 21 + // stub, so that compilation doesn't fail 22 +} 23 + 24 +func de_init_term() error { 25 + return nil 26 +} 27 + 28 +func printWithAnsiColor(m *pisc.Machine) error { 29 + str := m.PopValue().(pisc.String) 30 + _, err := fmt.Fprint(writer, str) 31 + return err 32 +} 33 + 34 +func os_overload(m *pisc.Machine) error { 35 + // Overwritting priv_puts to handle ANSI color codes on windows 36 + m.AddGoWord("priv_puts", "( str -- )", printWithAnsiColor) 37 + return nil 38 +} 39 + 40 + 41 +func getch(m *pisc.Machine) error { 42 + char := C.getch() 43 + m.PushValue(pisc.Integer(char)) 44 + return nil 45 +}
Added cmd/FinalFrontier/main.go.
1 +package main 2 + 3 +import ( 4 + "fmt" 5 + "pisc" 6 +) 7 + 8 +func main() { 9 + m := &pisc.Machine{ 10 + Values: make([]pisc.StackEntry, 0), 11 + DefinedWords: make(map[string]*pisc.CodeQuotation), 12 + DefinedStackComments: make(map[string]string), 13 + PredefinedWords: make(map[string]pisc.GoWord), 14 + PrefixWords: make(map[string]*pisc.CodeQuotation), 15 + HelpDocs: make(map[string]string), 16 + } 17 + 18 + m.LoadModules(append( 19 + pisc.StandardModules, 20 + pisc.ModDebugCore, 21 + pisc.ModIOCore, 22 + ModFinalFrontier)...) 23 + err := m.ExecuteString(`"scripts/main.pisc" game-script`, pisc.CodePosition{Source: "main.go"}) 24 + if err != nil { 25 + fmt.Println(err.Error()) 26 + } 27 +}
Added cmd/FinalFrontier/scripts/backstory.txt.
1 +Explorers are even now mapping out the various lanes of slipspace. Most people seem to be content to stay on the planet of their birth, as both subspace and slipspace are treacherous places. Pirates, freighters, and smugglers alike vie for fattest, quickest buck. Planetary fleets mostly protect their homes. There used to be a system-wise empire around Sol, but logistics makes a galaxy-wide one near-impossible. Even if galactic rule was possible, the early slipspace instabilities spread people far and wide throughout space. This factured the society left behind. It took decades for a slipspace drive to be stable enough for more experimental use. It was only with the aging and death of those who witnessed the slipspace fracturing that the slipspace came to be accepted as a means of travel. The last 15 years have shown wondrous things.
Added cmd/FinalFrontier/scripts/gamesave.pisc.
Added cmd/FinalFrontier/scripts/intro.pisc.
1 + 2 +: intro ( game -- next ) 3 +:game 4 +CLS 5 + 6 +"Space, the Final Frontier 7 + 8 +The stars have beckoned you, even when you were but a wee child. 9 +It's a risky life, spacefaring, what with pirates, smugglers, and planetary police 10 +in a constant struggle, not to mention asteriods, navigation difficulty, and the utter 11 +void of space. You've prepared for this day. Your reading time was dedicated to charts 12 +and ship operation, your spare time to training in simulators, and your savings 13 +have amounted to $5000. Will you explore the stars? (Y/n) 14 +" println 15 + 16 +0 :k [ $k is-yn? not ] [ getkey :k ] while 17 + 18 +$k is-n? [ 19 + "Though, perhaps the stars are for another time. After all, they won't be going anywhere" println 20 + wait-enter 21 + [ opening-menu ] 22 +] when 23 +$k is-y? [ [ pick-ship ] ] when 24 +; 25 + 26 +: pick-ship ( game -- next ) 27 + CLS 28 + " You're going to need a ship before you can travel through space, however. " println 29 + wait-enter 30 + [ quit-game ] 31 +; 32 + 33 + 34 + 35 +
Added cmd/FinalFrontier/scripts/lib.pisc.
1 +term-mode "WINDOWS" eq [ 2 + "scripts\\term_win.pisc" game-script 3 +] when 4 + 5 +term-mode "POSIX" eq [ 6 + "scripts\\term_posix.pisc" game-script 7 +] when 8 + 9 +: wait-enter ( -- ) 10 + [ getkey is-enter? ] [ ] while 11 +; 12 + 13 +: <up-down-menu> ( num-opts -- obj ) 14 + :num 15 + 0 :m-idx 16 + t :choosing 17 + [ 18 + getkey :k 19 + $k is-enter? [ f :choosing ] when 20 + $k is-arrow? [ 21 + getkey :dir 22 + $dir is-up? [ --m-idx ] when 23 + $dir is-down? [ ++m-idx ] when 24 + $m-idx $num mod :m-idx 25 + $m-idx 0 < [ $num 1 - :m-idx ] when 26 + ] when 27 + ] :check 28 + <dict> 29 + [ $choosing ] <<-done? 30 + [ $m-idx ] <<-chosen-idx 31 + [ check ] <<-proc-key 32 + [ $m-idx = [ back-white ] when ] <<-highlight 33 +;
Added cmd/FinalFrontier/scripts/main.pisc.
1 +# This is final frontier, a game inspiredc by space, tradewinds, and a little bit of lane-based combat 2 +/* 3 +IDEAS: Maybe find some way to integrate long time travel into the culture of spacefarers 4 +*/ 5 + 6 +"scripts\\lib.pisc" game-script 7 +"scripts\\markets.pisc" game-script 8 +"scripts\\intro.pisc" game-script 9 +"scripts\\saving.pisc" game-script 10 + 11 +: opening-menu ( game -- next ) 12 + :game 13 + 4 <up-down-menu> :m 14 + $m ->highlight :MENU 15 + [ back-black ] :CHOICE 16 + CHOICE print 17 + 18 + [ $m .done? ] 19 + [ 20 + CLS 21 + NNL 22 + ${ 23 + cyan "Final Frontier" NNL 24 + red 25 + " " 0 MENU "New Game" CHOICE NNL 26 + " " 1 MENU "Load Game" CHOICE NNL 27 + " " 2 MENU "Options" CHOICE NNL 28 + " " 3 MENU "Return to real life" CHOICE NNL 29 + white "Up/Down to choose, Enter to confirm " NL 30 + } print 31 + 32 + $m .proc-key 33 + ] while 34 + { 35 + [ intro ] 36 + [ load-game ] 37 + [ options ] 38 + [ exit-game ] 39 + } $m .chosen-idx vec-at 40 +; 41 + 42 +: load-game ( game -- ) :game CLS ${ "TODO: Implement game-loads" NL } println [ " " drop ] ; 43 +: save-game ( game -- ) :game CLS ${ "TODO: Implement game-saves" NL } println [ " " drop ] ; 44 +: options ( -- ) :game CLS ${ "TODO: Implement game options" NL } println [ " " drop ] ; 45 +: exit-game ( game -- ) save-game quit-game ; 46 + 47 +: main ( -- ) 48 + <dict> opening-menu :curr-state 49 + <dict> :game 50 + [ t ] [ $game $curr-state call :curr-state ] while 51 + getkey 52 + back-black println CLS 53 + quit-game 54 +; 55 + 56 +main
Added cmd/FinalFrontier/scripts/map.pisc.
1 +/* 2 + 3 +Render a galatic map from here 4 + 5 +*/ 6 + 7 +: star-map ( game -- next ) 8 + 9 +; 10 + 11 + 12 +: show-world ( planet game -- next ) 13 + :game :planet 14 + 15 + $planet ->description println 16 + 17 + $planet ->locations dup dup [ ->name ] vec-map :locs [ ->command ] vec-map :choices 18 + $locs len 1 - <up-down-menu> :m 19 + 20 + $m ->highlight :MENU 21 + [ back-black ] :CHOICE 22 + 23 + 24 + [ $m .done? ] 25 + # We're re-building the menu each time with a rest to $i 26 + [ 27 + CLS 28 + CHOICE println 29 + 0 :i 30 + ${ 31 + $planet ->name NNL 32 + red 33 + $locs [ :l 34 + $i MENU " " $l CHOICE NNL 35 + ] vec-each 36 + white "Up/down to select, enter to choose" NL 37 + } 38 + ] while 39 + 40 + $choices $m .chosen-idx vec-at 41 +;
Added cmd/FinalFrontier/scripts/markets.pisc.
1 +# 2 + 3 +/* 4 + 5 +What is the economy going to be like in this game? 6 + 7 +## Basic Goods 8 + 9 +Water 10 +Food 11 +Fuel 12 +Ore/Scrap 13 + 14 +## Data Capsules 15 + 16 +Programs 17 +Videos 18 +Games 19 +Maps/Charts 20 + 21 +## Heavy Goods 22 + 23 +Robots 24 +Munitions 25 +Build-Crete 26 +Enviro-shielding 27 + 28 +## Fragile Goods 29 + 30 +Solar Panels 31 +Computer Chips 32 +Documents 33 +Sculptures 34 + 35 +*/ 36 + 37 +: show-market ( -- ) ; 38 + 39 +/* 40 +World archetypes 41 + 42 +Colony: 43 +Exports basic goods, with a random chance of exporting one other type of good at a low price 44 + 45 +Monastic Technocracy: 46 +Imports basic goods, exports data capsules of various types 47 + 48 +Corporatist Industocracy: 49 +Imports basic goods, exports heavy goods 50 + 51 +Creatist Fabritocracy: 52 +Imports basic goods, exports Fragile Goods 53 + 54 +Beurocratic Metrocracy: 55 +Imports everything, exports power/influence (heh) 56 + 57 +*/
Added cmd/FinalFrontier/scripts/saving.pisc.
1 +/* 2 + 3 +func (i Integer) Type() string { 4 + return "Integer" 5 +} 6 + 7 +func (d Double) Type() string { 8 + return "Double" 9 +} 10 + 11 +func (a Array) Type() string { 12 + return "Vector" 13 +} 14 + 15 +func (dict Dict) Type() string { 16 + return "Dictionary" 17 +} 18 + 19 +func (b Boolean) Type() string { 20 + return "Boolean" 21 +} 22 + 23 +func (s String) Type() string { 24 + return "String" 25 +} 26 + 27 +*/ 28 + 29 +: serial-mapping ( -- mapping ) 30 + <dict> 31 + [ write-dict ] <<-Dictionary 32 + [ write-vec ] <<-Vector 33 + [ write-int ] <<-Integer 34 + [ write-double ] <<-Double 35 + [ write-string ] <<-String 36 + [ write-bool ] <<-Boolean 37 + :t-table 38 + 39 + [ :v 40 + $t-table $v typeof dict-has-key? 41 + [ $t-table $v typeof dict-get ] 42 + [ ${ "Type " $v typeof " cannot be saved." } error ] 43 + if 44 + ] 45 +; 46 + 47 +: save-state ( path state -- state ) :state :path 48 + $state typeof :type 49 + f :success 50 + [ $path open-file-writer :OUT 51 + ": . ( dict value key -- dict ) dict-push ;" $OUT .write-line 52 + <dict> 53 + $OUT <<-OUT 54 + 0 <<-tab 55 + ] :get-output 56 + [ eq dup $success or :success ] :eqn 57 + $type "Dictionary" eqn [ get-output $state write-dict ] when 58 + $type "Vector" eqn [ get-output $state write-vec ] when 59 + $success not 60 + [ ${ "Cannot write value of type: " $type } error ] 61 + when 62 + $OUT .close 63 +; 64 + 65 +# Replace " with \" in the string, to keep it from breaking up 66 +: quote-safe ( str -- str ) "\\" "\\\\" str-replace "\"" "\\\"" str-replace ; 67 +: wrap-quotes ( str -- str ) "\"" swap str-concat "\"" str-concat ; 68 + 69 +: write-dict ( ctx dict -- ) 70 + :pairs dup :ctx ->OUT :OUT 71 + # Increase the tab-indent 72 + $ctx dup ->tab 1 + <-tab 73 + 74 + serial-mapping :dispatch 75 + [ $OUT .write-string ] :output 76 + [ "\t" $ctx ->tab str-repeat output ] :TAB 77 + 78 + "\n" output 79 + TAB "<dict>" output 80 + 81 + $pairs [ :k $pairs ->$k :v 82 + $v dispatch :write 83 + "\n" output TAB "\t" output 84 + $ctx $v write 85 + " " output 86 + $k quote-safe wrap-quotes output 87 + " ." output 88 + ] dict-each-key 89 + $ctx dup ->tab 1 - <-tab 90 +; 91 + 92 +: write-vec ( ctx vec -- ) 93 + :elems dup :ctx ->OUT :OUT 94 + $ctx dup ->tab 1 + <-tab 95 + [ "\t" $ctx ->tab str-repeat output ] :TAB 96 + serial-mapping :dispatch 97 + # Increase the tab-indent 98 + [ $OUT .write-string ] :output 99 + 100 + "{" output 101 + $elems [ :e 102 + " " output 103 + $ctx $e $e dispatch call 104 + ] vec-each 105 + " }" output 106 + $ctx dup ->tab 1 - <-tab 107 +; 108 + 109 + 110 +: write-int ( ctx int -- ) >string swap ->OUT .write-string ; 111 +: write-string ( ctx str -- ) quote-safe wrap-quotes swap ->OUT .write-string ; 112 +: write-double ( ctx double -- ) >string swap ->OUT .write-string ; 113 +: write-bool ( ctx bool -- ) [ :ctx ] dip [ "t" ] [ "f" ] if $ctx ->OUT .write-string ; 114 + 115 + 116 +# DEBUG 117 +/* 118 +"out.txt" import :d 119 + 120 +"out.txt" $d save-state 121 + 122 +"TODO: Add tests!!" println 123 +"TODO: Consider switching dicts to use critbit trees" println 124 +*/ 125 +# GUBED
Added cmd/FinalFrontier/scripts/ships.pisc.
1 +# What is the model for ships going to be? 2 + 3 +# Lane types can be 1 of the 4 major types 4 + 5 +# 0 - Basic: Can carry basic cargo 6 +# 1 - Data: Can carry data of various kinds, is radiation shielded. A cockpit has 1 data slot by default 7 +# 2 - Heavy: Can carry basic cargo, or heavier goods 8 +# 3 - Fragile: Is built with shock absorbsion to allow transport of fragile goods 9 + 10 +: <lane> ( size type -- lane ) 11 + :type :size 12 + { $size [ f ] times } :cargo 13 + <dict> 14 + $cargo <<-cargo 15 + $type <<-type 16 +; 17 + 18 +: <ship> ( name lanes -- ship ) 19 + :lanes :name 20 + <dict> 21 + $lanes <<-lanes 22 + $name <<-name 23 +; 24 + 25 +/* 26 +Each ship is built out of lanes 27 +Each ship has a drone loadout controlled by the Cockpit 28 +If the cockpit is destroyed, you game is over. 29 +Most ships don't try to destroy a cockpit however, 30 +preferring to leave you helpless or capture you. 31 + 32 +Ships can have 1x3 to 3x10 in dimentions, and filled with different segments 33 + 34 +Lanes can come in 3 sizes as well, Small, Medim and Large 35 + 36 +Segment types (* indicate mandatory segment): 37 + 38 +Life-support/Cockpit*, 39 +Engines*, 40 +Fuel Tank* 41 +cargo pod 42 +Crew quarter (1 crew member per section) 43 +drone pod (1 drone per section) 44 + 45 +There are also possible non-standard segments: 46 + 47 +Long range sensors ( extra combat round ) 48 +Contraband pod ( far better chance of passing an inspection ) 49 +Ship scanner (allows you to see into ship segments) 50 +Tow package (allows you to haul ships/trailers around) 51 + 52 +Segments have varying levels of armor: 53 +low: Can be breached by any attck 54 +medium: Will withstand a minimum of 1 successful attack. 55 +heavy: Will withstand a minimum of 3 successful attacks. 56 + 57 +Drones come in 3 basic types: 58 + 59 +Attack: Shoots stuff 60 +Defence: Defends against attack drones, each shot charges up a mega-beam 61 +Ion: shorts-out drones and/or sections 62 + 63 +Advanced drones: Raider 64 + 65 +Raider drones do a variety of things, depending on which type of segment they manage to hit 66 + 67 +If they hit Life-support/cockpit, they take over the ship, 68 +which allows it to be slaved to yours for transport to shipyards 69 + 70 +If they hit a engine pod, the opposing ship will be slowed down 71 + 72 +If they hit a Fuel tank, all the fuel in that tank is transfered to your ship next turn 73 + 74 +If they hit a cargo bay, the cargo in that bay is transfared to your ship next turn 75 + 76 +If they hit a crew-quarter, the crew member in that quarter is either 77 +captured or killed, depending on if you have space to carry them or not. 78 + 79 + 80 + 81 + 82 + 83 + 84 + 85 + 86 + 87 +
Added cmd/FinalFrontier/scripts/term_posix.pisc.
1 +: color-code ( code -- color-esc ) :code ${ ESC "[" $code "m" } ; 2 + 3 +# Clear screen and move cursor to top-left 4 +: CLS ( -- ) ${ ESC "[2J" ESC "[;H" } print ; 5 +: NL ( -- NL ) "\r\n" ; 6 +: NNL ( -- NL ) NL NL ; 7 + 8 +# Fore-colors 9 +: black ( -- esc-black ) "30" color-code ; 10 +: red ( -- esc-red ) "31" color-code ; 11 +: green ( -- esc-green ) "32" color-code ; 12 +: yellow ( -- esc-yellow ) "33" color-code ; 13 +: blue ( -- esc-blue ) "34" color-code ; 14 +: magenta ( -- esc-magenta ) "35" color-code ; 15 +: cyan ( -- esc-cyan ) "36" color-code ; 16 +: white ( -- esc-white ) "37" color-code ; 17 + 18 +# back-colors 19 +: back-black ( -- esc-black ) "40" color-code ; 20 +: back-red ( -- esc-red ) "41" color-code ; 21 +: back-green ( -- esc-green ) "42" color-code ; 22 +: back-yellow ( -- esc-yellow ) "43" color-code ; 23 +: back-blue ( -- esc-blue ) "44" color-code ; 24 +: back-magenta ( -- esc-magenta ) "45" color-code ; 25 +: back-cyan ( -- esc-cyan ) "46" color-code ; 26 +: back-white ( -- esc-white ) "47" color-code ; 27 + 28 +: is-enter? ( k -- ? ) 13 = ; 29 +: is-arrow? ( k -- ? ) 27 = [ getkey 91 = ] [ f ] if ; 30 + 31 +: is-up? ( k -- ? ) 65 = ; 32 +: is-down? ( k -- ? ) 66 = ; 33 +: is-right? ( k -- ? ) 67 = ; 34 +: is-left? ( k -- ? ) 68 = ; 35 + 36 +: is-y? ( k -- ? ) 121 = ; 37 +: is-n? ( k -- ? ) 110 = ; 38 +: is-yn? ( k -- ? ) [ is-y? ] [ is-n? ] bi or ;
Added cmd/FinalFrontier/scripts/term_win.pisc.
1 +: color-code ( code -- color-esc ) :code ${ ESC "[" $code "m" } ; 2 + 3 +# Clear screen and move cursor to top-left 4 +: CLS ( -- ) ${ ESC "[2J" ESC "[H" } print ; 5 +: NL ( -- NL ) "\r\n" ; 6 +: NNL ( -- NL ) NL NL ; 7 + 8 +# Fore-colors 9 +: black ( -- esc-black ) "30" color-code ; 10 +: red ( -- esc-red ) "31" color-code ; 11 +: green ( -- esc-green ) "32" color-code ; 12 +: yellow ( -- esc-yellow ) "33" color-code ; 13 +: blue ( -- esc-blue ) "34" color-code ; 14 +: magenta ( -- esc-magenta ) "35" color-code ; 15 +: cyan ( -- esc-cyan ) "36" color-code ; 16 +: white ( -- esc-white ) "37" color-code ; 17 + 18 +# back-colors 19 +: back-black ( -- esc-black ) "40" color-code ; 20 +: back-red ( -- esc-red ) "41" color-code ; 21 +: back-green ( -- esc-green ) "42" color-code ; 22 +: back-yellow ( -- esc-yellow ) "43" color-code ; 23 +: back-blue ( -- esc-blue ) "44" color-code ; 24 +: back-magenta ( -- esc-magenta ) "45" color-code ; 25 +: back-cyan ( -- esc-cyan ) "46" color-code ; 26 +: back-white ( -- esc-white ) "47" color-code ; 27 + 28 +: is-enter? ( k -- ? ) 13 = ; 29 +: is-arrow? ( k -- ? ) 224 = ; 30 + 31 +: is-up? ( k -- ? ) 72 = ; 32 +: is-down? ( k -- ? ) 80 = ; 33 +: is-right? ( k -- ? ) 77 = ; 34 +: is-left? ( k -- ? ) 75 = ; 35 + 36 +: is-y? ( k -- ? ) 121 = ; 37 +: is-n? ( k -- ? ) 110 = ; 38 +: is-yn? ( k -- ? ) [ is-y? ] [ is-n? ] bi or ; 39 +
Added cmd/build/build.go.
1 +package main 2 + 3 +import "pisc" 4 + 5 +var ModBuildCore = pisc.Module{ 6 + Author: "Andrew Owen", 7 + Name: "BuildKit", 8 + License: "MIT", 9 + DocString: `commands for running pisc Buildscripts`, 10 + Load: loadBuildWords, 11 +} 12 + 13 +func loadBuildWords(m *pisc.Machine) error { 14 + return nil 15 +}
Added cmd/build/main.go.
1 +package main 2 + 3 +import ( 4 + "pisc" 5 + "pisc/libs/shell" 6 +) 7 + 8 +func main() { 9 + m := &pisc.Machine{ 10 + Values: make([]pisc.StackEntry, 0), 11 + DefinedWords: make(map[string]*pisc.CodeQuotation), 12 + DefinedStackComments: make(map[string]string), 13 + PredefinedWords: make(map[string]pisc.GoWord), 14 + PrefixWords: make(map[string]*pisc.CodeQuotation), 15 + HelpDocs: make(map[string]string), 16 + } 17 + m.LoadModules(append(pisc.StandardModules, shell.ModShellUtils)...) 18 +}
Added cmd/pisc-web-ide/main.go.
1 +package main 2 + 3 +import ( 4 + "fmt" 5 + "github.com/pressly/chi" 6 + "github.com/pressly/chi/middleware" 7 + "log" 8 + "net/http" 9 +) 10 + 11 +// To try out: https://github.com/pressly/chi 12 + 13 +func main() { 14 + // Simple static webserver: 15 + r := chi.NewRouter() 16 + r.Use(middleware.Logger) 17 + r.Use(middleware.Recoverer) 18 + 19 + r.FileServer("/", http.Dir("./webroot")) 20 + r.Get("/test", func(w http.ResponseWriter, r *http.Request) { 21 + fmt.Fprintln(w, "Testing now!") 22 + }) 23 + 24 + r.Get("/test/:id/arrp/:foo", func(w http.ResponseWriter, r *http.Request) { 25 + // FIXME: Not safe!! 26 + fmt.Fprintln(w, chi.URLParam(r, "id")) 27 + fmt.Fprintln(w, chi.URLParam(r, "foo")) 28 + }) 29 + r.Get("/test/a", func(w http.ResponseWriter, r *http.Request) { 30 + // FIXME: Not safe!! 31 + fmt.Fprintln(w, "foo") 32 + }) 33 + 34 + log.Fatal(http.ListenAndServe(":8080", r)) 35 +}
Added cmd/pisc-web-ide/webroot/index.html.
1 +<html> 2 + <body> 3 + 4 + <p>Hello PISC web-ide!</p> 5 + 6 + <script src="/static/js/reqwest-2.0.5/reqwest.js" type="text/javascript" charset="utf-8" async defer></script> 7 + <script src="/static/js/vue-js/vue.js" type="text/javascript" charset="utf-8"></script> 8 + <script></script> 9 + </body> 10 +</html>
Added cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/Makefile.
1 +.PHONY: boosh test 2 + 3 +boosh: 4 + @node -e "var json = require('./build');json.JSHINT_OPTS=JSON.parse(require('fs').readFileSync('./.jshintrc'));require('fs').writeFileSync('./build.json', JSON.stringify(json, null, 2))" 5 + @node_modules/smoosh/bin/smoosh make build.json 6 + 7 +test: 8 + npm test 9 + 10 +bump: boosh 11 + npm version patch 12 + node make/bump 13 + 14 +publish: 15 + npm publish 16 + git push origin master --tags
Added cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/README.md.
1 +# It's AJAX 2 + 3 +All over again. Includes support for xmlHttpRequest, JSONP, CORS, and CommonJS Promises A. 4 + 5 +It is also isomorphic allowing you to `require('reqwest')` in `Node.js` through the peer dependency [xhr2](https://github.com/pwnall/node-xhr2), albeit the original intent of this library is for the browser. For a more thorough solution for Node.js, see [mikeal/request](https://github.com/request/request). 6 + 7 +## API 8 + 9 +``` js 10 +reqwest('path/to/html', function (resp) { 11 + qwery('#content').html(resp) 12 +}) 13 + 14 +reqwest({ 15 + url: 'path/to/html' 16 + , method: 'post' 17 + , data: { foo: 'bar', baz: 100 } 18 + , success: function (resp) { 19 + qwery('#content').html(resp) 20 + } 21 +}) 22 + 23 +reqwest({ 24 + url: 'path/to/html' 25 + , method: 'get' 26 + , data: [ { name: 'foo', value: 'bar' }, { name: 'baz', value: 100 } ] 27 + , success: function (resp) { 28 + qwery('#content').html(resp) 29 + } 30 +}) 31 + 32 +reqwest({ 33 + url: 'path/to/json' 34 + , type: 'json' 35 + , method: 'post' 36 + , error: function (err) { } 37 + , success: function (resp) { 38 + qwery('#content').html(resp.content) 39 + } 40 +}) 41 + 42 +reqwest({ 43 + url: 'path/to/json' 44 + , type: 'json' 45 + , method: 'post' 46 + , contentType: 'application/json' 47 + , headers: { 48 + 'X-My-Custom-Header': 'SomethingImportant' 49 + } 50 + , error: function (err) { } 51 + , success: function (resp) { 52 + qwery('#content').html(resp.content) 53 + } 54 +}) 55 + 56 +// Uses XMLHttpRequest2 credentialled requests (cookies, HTTP basic auth) if supported 57 +reqwest({ 58 + url: 'path/to/json' 59 + , type: 'json' 60 + , method: 'post' 61 + , contentType: 'application/json' 62 + , crossOrigin: true 63 + , withCredentials: true 64 + , error: function (err) { } 65 + , success: function (resp) { 66 + qwery('#content').html(resp.content) 67 + } 68 +}) 69 + 70 +reqwest({ 71 + url: 'path/to/data.jsonp?callback=?' 72 + , type: 'jsonp' 73 + , success: function (resp) { 74 + qwery('#content').html(resp.content) 75 + } 76 +}) 77 + 78 +reqwest({ 79 + url: 'path/to/data.jsonp?foo=bar' 80 + , type: 'jsonp' 81 + , jsonpCallback: 'foo' 82 + , jsonpCallbackName: 'bar' 83 + , success: function (resp) { 84 + qwery('#content').html(resp.content) 85 + } 86 +}) 87 + 88 +reqwest({ 89 + url: 'path/to/data.jsonp?foo=bar' 90 + , type: 'jsonp' 91 + , jsonpCallback: 'foo' 92 + , success: function (resp) { 93 + qwery('#content').html(resp.content) 94 + } 95 + , complete: function (resp) { 96 + qwery('#hide-this').hide() 97 + } 98 +}) 99 +``` 100 + 101 +## Promises 102 + 103 +``` js 104 +reqwest({ 105 + url: 'path/to/data.jsonp?foo=bar' 106 + , type: 'jsonp' 107 + , jsonpCallback: 'foo' 108 +}) 109 + .then(function (resp) { 110 + qwery('#content').html(resp.content) 111 + }, function (err, msg) { 112 + qwery('#errors').html(msg) 113 + }) 114 + .always(function (resp) { 115 + qwery('#hide-this').hide() 116 + }) 117 +``` 118 + 119 +``` js 120 +reqwest({ 121 + url: 'path/to/data.jsonp?foo=bar' 122 + , type: 'jsonp' 123 + , jsonpCallback: 'foo' 124 +}) 125 + .then(function (resp) { 126 + qwery('#content').html(resp.content) 127 + }) 128 + .fail(function (err, msg) { 129 + qwery('#errors').html(msg) 130 + }) 131 + .always(function (resp) { 132 + qwery('#hide-this').hide() 133 + }) 134 +``` 135 + 136 +``` js 137 +var r = reqwest({ 138 + url: 'path/to/data.jsonp?foo=bar' 139 + , type: 'jsonp' 140 + , jsonpCallback: 'foo' 141 + , success: function () { 142 + setTimeout(function () { 143 + r 144 + .then(function (resp) { 145 + qwery('#content').html(resp.content) 146 + }, function (err) { }) 147 + .always(function (resp) { 148 + qwery('#hide-this').hide() 149 + }) 150 + }, 15) 151 + } 152 +}) 153 +``` 154 + 155 +## Options 156 + 157 + * `url` a fully qualified uri 158 + * `method` http method (default: `GET`) 159 + * `headers` http headers (default: `{}`) 160 + * `data` entity body for `PATCH`, `POST` and `PUT` requests. Must be a query `String` or `JSON` object 161 + * `type` a string enum. `html`, `xml`, `json`, or `jsonp`. Default is inferred by resource extension. Eg: `.json` will set `type` to `json`. `.xml` to `xml` etc. 162 + * `contentType` sets the `Content-Type` of the request. Eg: `application/json` 163 + * `crossOrigin` for cross-origin requests for browsers that support this feature. 164 + * `success` A function called when the request successfully completes 165 + * `error` A function called when the request fails. 166 + * `complete` A function called whether the request is a success or failure. Always called when complete. 167 + * `jsonpCallback` Specify the callback function name for a `JSONP` request. This value will be used instead of the random (but recommended) name automatically generated by reqwest. 168 + 169 +## Security 170 + 171 +If you are *still* requiring support for IE6/IE7, consider including [JSON3](https://bestiejs.github.io/json3/) in your project. Or simply do the following 172 + 173 +``` html 174 +<script> 175 +(function () { 176 + if (!window.JSON) { 177 + document.write('<scr' + 'ipt src="http://cdnjs.cloudflare.com/ajax/libs/json3/3.3.2/json3.min.js"><\/scr' + 'ipt>') 178 + } 179 +}()); 180 +</script> 181 +``` 182 + 183 + 184 +## Contributing 185 + 186 +``` sh 187 +$ git clone git://github.com/ded/reqwest.git reqwest 188 +$ cd !$ 189 +$ npm install 190 +``` 191 + 192 +Please keep your local edits to `src/reqwest.js`. 193 +The base `./reqwest.js` and `./reqwest.min.js` will be built upon releases. 194 + 195 +## Running Tests 196 + 197 +``` sh 198 +make test 199 +``` 200 + 201 +## Browser support 202 + 203 + * IE6+ 204 + * Chrome 1+ 205 + * Safari 3+ 206 + * Firefox 1+ 207 + * Opera 208 + 209 +## Ender Support 210 +Reqwest can be used as an [Ender](http://enderjs.com) module. Add it to your existing build as such: 211 + 212 + $ ender add reqwest 213 + 214 +Use it as such: 215 + 216 +``` js 217 +$.ajax({ ... }) 218 +``` 219 + 220 +Serialize things: 221 + 222 +``` js 223 +$(form).serialize() // returns query string -> x=y&... 224 +$(form).serialize({type:'array'}) // returns array name/value pairs -> [ { name: x, value: y}, ... ] 225 +$(form).serialize({type:'map'}) // returns an object representation -> { x: y, ... } 226 +$(form).serializeArray() 227 +$.toQueryString({ 228 + foo: 'bar' 229 + , baz: 'thunk' 230 +}) // returns query string -> foo=bar&baz=thunk 231 +``` 232 + 233 +Or, get a bit fancy: 234 + 235 +``` js 236 +$('#myform input[name=myradios]').serialize({type:'map'})['myradios'] // get the selected value 237 +$('input[type=text],#specialthing').serialize() // turn any arbitrary set of form elements into a query string 238 +``` 239 + 240 +## ajaxSetup 241 +Use the `request.ajaxSetup` to predefine a data filter on all requests. See the example below that demonstrates JSON hijacking prevention: 242 + 243 +``` js 244 +$.ajaxSetup({ 245 + dataFilter: function (response, type) { 246 + if (type == 'json') return response.substring('])}while(1);</x>'.length) 247 + else return response 248 + } 249 +}) 250 +``` 251 + 252 +## RequireJs and Jam 253 +Reqwest can also be used with RequireJs and can be installed via jam 254 + 255 +``` 256 +jam install reqwest 257 +``` 258 + 259 +```js 260 +define(function(require){ 261 + var reqwest = require('reqwest') 262 +}); 263 +``` 264 + 265 +## spm 266 +Reqwest can also be installed via spm [![](http://spmjs.io/badge/reqwest)](http://spmjs.io/package/reqwest) 267 + 268 +``` 269 +spm install reqwest 270 +``` 271 + 272 +## jQuery and Zepto Compatibility 273 +There are some differences between the *Reqwest way* and the 274 +*jQuery/Zepto way*. 275 + 276 +### method ### 277 +jQuery/Zepto use `type` to specify the request method while Reqwest uses 278 +`method` and reserves `type` for the response data type. 279 + 280 +### dataType ### 281 +When using jQuery/Zepto you use the `dataType` option to specify the type 282 +of data to expect from the server, Reqwest uses `type`. jQuery also can 283 +also take a space-separated list of data types to specify the request, 284 +response and response-conversion types but Reqwest uses the `type` 285 +parameter to infer the response type and leaves conversion up to you. 286 + 287 +### JSONP ### 288 +Reqwest also takes optional `jsonpCallback` and `jsonpCallbackName` 289 +options to specify the callback query-string key and the callback function 290 +name respectively while jQuery uses `jsonp` and `jsonpCallback` for 291 +these same options. 292 + 293 + 294 +But fear not! If you must work the jQuery/Zepto way then Reqwest has 295 +a wrapper that will remap these options for you: 296 + 297 +```js 298 +reqwest.compat({ 299 + url: 'path/to/data.jsonp?foo=bar' 300 + , dataType: 'jsonp' 301 + , jsonp: 'foo' 302 + , jsonpCallback: 'bar' 303 + , success: function (resp) { 304 + qwery('#content').html(resp.content) 305 + } 306 +}) 307 + 308 +// or from Ender: 309 + 310 +$.ajax.compat({ 311 + ... 312 +}) 313 +``` 314 + 315 +If you want to install jQuery/Zepto compatibility mode as the default 316 +then simply place this snippet at the top of your code: 317 + 318 +```js 319 +$.ajax.compat && $.ender({ ajax: $.ajax.compat }); 320 +``` 321 + 322 + 323 +**Happy Ajaxing!**
Added cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/build.json.
1 +{ 2 + "YO": "This file is built by the Makefile, your edits may not be saved on build", 3 + "JAVASCRIPT": { 4 + "DIST_DIR": "./", 5 + "reqwest": [ 6 + "src/copyright.js", 7 + "src/reqwest.js" 8 + ] 9 + }, 10 + "JSHINT_OPTS": { 11 + "predef": [ 12 + "define", 13 + "ActiveXObject", 14 + "XDomainRequest" 15 + ], 16 + "bitwise": true, 17 + "camelcase": false, 18 + "curly": false, 19 + "eqeqeq": false, 20 + "forin": false, 21 + "immed": false, 22 + "latedef": false, 23 + "newcap": true, 24 + "noarg": true, 25 + "noempty": true, 26 + "nonew": true, 27 + "plusplus": false, 28 + "quotmark": true, 29 + "regexp": false, 30 + "undef": true, 31 + "unused": true, 32 + "strict": false, 33 + "trailing": true, 34 + "maxlen": 120, 35 + "asi": true, 36 + "boss": true, 37 + "debug": true, 38 + "eqnull": true, 39 + "esnext": true, 40 + "evil": true, 41 + "expr": true, 42 + "funcscope": false, 43 + "globalstrict": false, 44 + "iterator": false, 45 + "lastsemic": true, 46 + "laxbreak": true, 47 + "laxcomma": true, 48 + "loopfunc": true, 49 + "multistr": false, 50 + "onecase": false, 51 + "proto": false, 52 + "regexdash": false, 53 + "scripturl": true, 54 + "smarttabs": false, 55 + "shadow": false, 56 + "sub": true, 57 + "supernew": false, 58 + "validthis": true, 59 + "browser": true, 60 + "couch": false, 61 + "devel": false, 62 + "dojo": false, 63 + "mootools": false, 64 + "node": true, 65 + "nonstandard": true, 66 + "prototypejs": false, 67 + "rhino": false, 68 + "worker": true, 69 + "wsh": false, 70 + "nomen": false, 71 + "onevar": false, 72 + "passfail": false 73 + } 74 +}
Added cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/make/bump.js.
1 +var fs = require('fs') 2 + , version = require('../package.json').version; 3 + 4 +['./reqwest.js', './reqwest.min.js'].forEach(function (file) { 5 + var data = fs.readFileSync(file, 'utf8') 6 + data = data.replace(/^\/\*\!/, '/*! version: ' + version) 7 + fs.writeFileSync(file, data) 8 +})
Added cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/make/tests.js.
1 +var exec = require('child_process').exec 2 + , fs = require('fs') 3 + , Connect = require('connect') 4 + , dispatch = require('dispatch') 5 + , mime = require('mime') 6 + , DelayedStream = require('delayed-stream') 7 + 8 + , getMime = function(ext) { 9 + return mime.lookup(ext == 'jsonp' ? 'js' : ext) 10 + } 11 + 12 +var routes = { 13 + '/': function (req, res) { 14 + res.write(fs.readFileSync('./tests/tests.html', 'utf8')) 15 + res.end() 16 + }, 17 + '/tests/timeout$': function (req, res) { 18 + var delayed = DelayedStream.create(req) 19 + setTimeout(function() { 20 + res.writeHead(200, { 21 + 'Expires': 0 22 + , 'Cache-Control': 'max-age=0, no-cache, no-store' 23 + }) 24 + req.query.callback && res.write(req.query.callback + '(') 25 + res.write(JSON.stringify({ method: req.method, query: req.query, headers: req.headers })) 26 + req.query.callback && res.write(');') 27 + delayed.pipe(res) 28 + }, 2000) 29 + }, 30 + '/tests/204': function(req, res) { 31 + res.writeHead(204); 32 + res.end(); 33 + }, 34 + '(([\\w\\-\\/\\.]+)\\.(css|js|json|jsonp|html|xml)$)': function (req, res, next, uri, file, ext) { 35 + res.writeHead(200, { 36 + 'Expires': 0 37 + , 'Cache-Control': 'max-age=0, no-cache, no-store' 38 + , 'Content-Type': getMime(ext) 39 + }) 40 + if (req.query.echo !== undefined) { 41 + ext == 'jsonp' && res.write((req.query.callback || req.query.testCallback || 'echoCallback') + '(') 42 + res.write(JSON.stringify({ method: req.method, query: req.query, headers: req.headers })) 43 + ext == 'jsonp' && res.write(');') 44 + } else { 45 + res.write(fs.readFileSync('./' + file + '.' + ext)) 46 + } 47 + res.end() 48 + } 49 +} 50 + 51 +Connect.createServer(Connect.query(), dispatch(routes)).listen(1234) 52 + 53 +var otherOriginRoutes = { 54 + '/get-value': function (req, res) { 55 + res.writeHead(200, { 56 + 'Access-Control-Allow-Origin': req.headers.origin, 57 + 'Content-Type': 'text/plain' 58 + }) 59 + res.end('hello') 60 + }, 61 + '/set-cookie': function (req, res) { 62 + res.writeHead(200, { 63 + 'Access-Control-Allow-Origin': req.headers.origin, 64 + 'Access-Control-Allow-Credentials': 'true', 65 + 'Content-Type': 'text/plain', 66 + 'Set-Cookie': 'cookie=hello' 67 + }) 68 + res.end('Set a cookie!') 69 + }, 70 + '/get-cookie-value': function (req, res) { 71 + var cookies = {} 72 + , value 73 + 74 + req.headers.cookie && req.headers.cookie.split(';').forEach(function( cookie ) { 75 + var parts = cookie.split('=') 76 + cookies[ parts[ 0 ].trim() ] = ( parts[ 1 ] || '' ).trim() 77 + }) 78 + value = cookies.cookie 79 + 80 + res.writeHead(200, { 81 + 'Access-Control-Allow-Origin': req.headers.origin, 82 + 'Access-Control-Allow-Credentials': 'true', 83 + 'Content-Type': 'text/plain' 84 + }) 85 + res.end(value) 86 + } 87 +} 88 + 89 +Connect.createServer(Connect.query(), dispatch(otherOriginRoutes)).listen(5678)
Added cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/package.json.
1 +{ 2 + "name": "reqwest", 3 + "description": "A wrapper for asynchronous http requests", 4 + "keywords": [ 5 + "ender", 6 + "ajax", 7 + "xhr", 8 + "connection", 9 + "web 2.0", 10 + "async", 11 + "sync" 12 + ], 13 + "version": "2.0.5", 14 + "homepage": "https://github.com/ded/reqwest", 15 + "author": "Dustin Diaz <dustin@dustindiaz.com> (http://dustindiaz.com)", 16 + "repository": { 17 + "type": "git", 18 + "url": "https://github.com/ded/reqwest.git" 19 + }, 20 + "main": "./reqwest.js", 21 + "ender": "./src/ender.js", 22 + "browser": { 23 + "xhr2": false 24 + }, 25 + "devDependencies": { 26 + "connect": "1.8.x", 27 + "mime": "1.x.x", 28 + "sink-test": ">=0.1.2", 29 + "dispatch": "0.x.x", 30 + "valentine": ">=1.4.7", 31 + "smoosh": "0.4.0", 32 + "delayed-stream": "0.0.5", 33 + "bump": "0.2.3" 34 + }, 35 + "scripts": { 36 + "boosh": "smoosh make ./build.json", 37 + "test": "node ./test.js" 38 + }, 39 + "license": "MIT", 40 + "spm": { 41 + "main": "reqwest.js", 42 + "ignore": [ 43 + "vendor", 44 + "test", 45 + "make" 46 + ] 47 + } 48 +}
Added cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/phantom.js.
1 +var page = require('webpage').create() 2 +page.open('http://localhost:1234', function() { 3 + 4 + function f() { 5 + setTimeout(function () { 6 + var clsName = page.evaluate(function() { 7 + var el = document.getElementById('tests') 8 + return el.className 9 + }) 10 + if (!clsName.match(/sink-done/)) f() 11 + else { 12 + var count = 0 13 + var fail = page.evaluate(function () { 14 + var t = '' 15 + var els = document.querySelectorAll('ol#tests .fail .fail') 16 + for (var i = 0; i < els.length; i++) { 17 + t += els[i].textContent + '\n' 18 + } 19 + return {text: t, count: els.length} 20 + }) 21 + var pass = !!clsName.match(/sink-pass/) 22 + if (pass) console.log('All tests have passed!') 23 + else { 24 + console.log(fail.count + ' test(s) failed') 25 + console.log(fail.text.trim()) 26 + } 27 + 28 + phantom.exit(pass ? 0 : 1) 29 + } 30 + }, 10) 31 + } 32 + f() 33 +})
Added cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/reqwest.js.
1 +/*! 2 + * Reqwest! A general purpose XHR connection manager 3 + * license MIT (c) Dustin Diaz 2015 4 + * https://github.com/ded/reqwest 5 + */ 6 + 7 +!function (name, context, definition) { 8 + if (typeof module != 'undefined' && module.exports) module.exports = definition() 9 + else if (typeof define == 'function' && define.amd) define(definition) 10 + else context[name] = definition() 11 +}('reqwest', this, function () { 12 + 13 + var context = this 14 + 15 + if ('window' in context) { 16 + var doc = document 17 + , byTag = 'getElementsByTagName' 18 + , head = doc[byTag]('head')[0] 19 + } else { 20 + var XHR2 21 + try { 22 + XHR2 = require('xhr2') 23 + } catch (ex) { 24 + throw new Error('Peer dependency `xhr2` required! Please npm install xhr2') 25 + } 26 + } 27 + 28 + 29 + var httpsRe = /^http/ 30 + , protocolRe = /(^\w+):\/\// 31 + , twoHundo = /^(20\d|1223)$/ //http://stackoverflow.com/questions/10046972/msie-returns-status-code-of-1223-for-ajax-request 32 + , readyState = 'readyState' 33 + , contentType = 'Content-Type' 34 + , requestedWith = 'X-Requested-With' 35 + , uniqid = 0 36 + , callbackPrefix = 'reqwest_' + (+new Date()) 37 + , lastValue // data stored by the most recent JSONP callback 38 + , xmlHttpRequest = 'XMLHttpRequest' 39 + , xDomainRequest = 'XDomainRequest' 40 + , noop = function () {} 41 + 42 + , isArray = typeof Array.isArray == 'function' 43 + ? Array.isArray 44 + : function (a) { 45 + return a instanceof Array 46 + } 47 + 48 + , defaultHeaders = { 49 + 'contentType': 'application/x-www-form-urlencoded' 50 + , 'requestedWith': xmlHttpRequest 51 + , 'accept': { 52 + '*': 'text/javascript, text/html, application/xml, text/xml, */*' 53 + , 'xml': 'application/xml, text/xml' 54 + , 'html': 'text/html' 55 + , 'text': 'text/plain' 56 + , 'json': 'application/json, text/javascript' 57 + , 'js': 'application/javascript, text/javascript' 58 + } 59 + } 60 + 61 + , xhr = function(o) { 62 + // is it x-domain 63 + if (o['crossOrigin'] === true) { 64 + var xhr = context[xmlHttpRequest] ? new XMLHttpRequest() : null 65 + if (xhr && 'withCredentials' in xhr) { 66 + return xhr 67 + } else if (context[xDomainRequest]) { 68 + return new XDomainRequest() 69 + } else { 70 + throw new Error('Browser does not support cross-origin requests') 71 + } 72 + } else if (context[xmlHttpRequest]) { 73 + return new XMLHttpRequest() 74 + } else if (XHR2) { 75 + return new XHR2() 76 + } else { 77 + return new ActiveXObject('Microsoft.XMLHTTP') 78 + } 79 + } 80 + , globalSetupOptions = { 81 + dataFilter: function (data) { 82 + return data 83 + } 84 + } 85 + 86 + function succeed(r) { 87 + var protocol = protocolRe.exec(r.url) 88 + protocol = (protocol && protocol[1]) || context.location.protocol 89 + return httpsRe.test(protocol) ? twoHundo.test(r.request.status) : !!r.request.response 90 + } 91 + 92 + function handleReadyState(r, success, error) { 93 + return function () { 94 + // use _aborted to mitigate against IE err c00c023f 95 + // (can't read props on aborted request objects) 96 + if (r._aborted) return error(r.request) 97 + if (r._timedOut) return error(r.request, 'Request is aborted: timeout') 98 + if (r.request && r.request[readyState] == 4) { 99 + r.request.onreadystatechange = noop 100 + if (succeed(r)) success(r.request) 101 + else 102 + error(r.request) 103 + } 104 + } 105 + } 106 + 107 + function setHeaders(http, o) { 108 + var headers = o['headers'] || {} 109 + , h 110 + 111 + headers['Accept'] = headers['Accept'] 112 + || defaultHeaders['accept'][o['type']] 113 + || defaultHeaders['accept']['*'] 114 + 115 + var isAFormData = typeof FormData !== 'undefined' && (o['data'] instanceof FormData); 116 + // breaks cross-origin requests with legacy browsers 117 + if (!o['crossOrigin'] && !headers[requestedWith]) headers[requestedWith] = defaultHeaders['requestedWith'] 118 + if (!headers[contentType] && !isAFormData) headers[contentType] = o['contentType'] || defaultHeaders['contentType'] 119 + for (h in headers) 120 + headers.hasOwnProperty(h) && 'setRequestHeader' in http && http.setRequestHeader(h, headers[h]) 121 + } 122 + 123 + function setCredentials(http, o) { 124 + if (typeof o['withCredentials'] !== 'undefined' && typeof http.withCredentials !== 'undefined') { 125 + http.withCredentials = !!o['withCredentials'] 126 + } 127 + } 128 + 129 + function generalCallback(data) { 130 + lastValue = data 131 + } 132 + 133 + function urlappend (url, s) { 134 + return url + (/\?/.test(url) ? '&' : '?') + s 135 + } 136 + 137 + function handleJsonp(o, fn, err, url) { 138 + var reqId = uniqid++ 139 + , cbkey = o['jsonpCallback'] || 'callback' // the 'callback' key 140 + , cbval = o['jsonpCallbackName'] || reqwest.getcallbackPrefix(reqId) 141 + , cbreg = new RegExp('((^|\\?|&)' + cbkey + ')=([^&]+)') 142 + , match = url.match(cbreg) 143 + , script = doc.createElement('script') 144 + , loaded = 0 145 + , isIE10 = navigator.userAgent.indexOf('MSIE 10.0') !== -1 146 + 147 + if (match) { 148 + if (match[3] === '?') { 149 + url = url.replace(cbreg, '$1=' + cbval) // wildcard callback func name 150 + } else { 151 + cbval = match[3] // provided callback func name 152 + } 153 + } else { 154 + url = urlappend(url, cbkey + '=' + cbval) // no callback details, add 'em 155 + } 156 + 157 + context[cbval] = generalCallback 158 + 159 + script.type = 'text/javascript' 160 + script.src = url 161 + script.async = true 162 + if (typeof script.onreadystatechange !== 'undefined' && !isIE10) { 163 + // need this for IE due to out-of-order onreadystatechange(), binding script 164 + // execution to an event listener gives us control over when the script 165 + // is executed. See http://jaubourg.net/2010/07/loading-script-as-onclick-handler-of.html 166 + script.htmlFor = script.id = '_reqwest_' + reqId 167 + } 168 + 169 + script.onload = script.onreadystatechange = function () { 170 + if ((script[readyState] && script[readyState] !== 'complete' && script[readyState] !== 'loaded') || loaded) { 171 + return false 172 + } 173 + script.onload = script.onreadystatechange = null 174 + script.onclick && script.onclick() 175 + // Call the user callback with the last value stored and clean up values and scripts. 176 + fn(lastValue) 177 + lastValue = undefined 178 + head.removeChild(script) 179 + loaded = 1 180 + } 181 + 182 + // Add the script to the DOM head 183 + head.appendChild(script) 184 + 185 + // Enable JSONP timeout 186 + return { 187 + abort: function () { 188 + script.onload = script.onreadystatechange = null 189 + err({}, 'Request is aborted: timeout', {}) 190 + lastValue = undefined 191 + head.removeChild(script) 192 + loaded = 1 193 + } 194 + } 195 + } 196 + 197 + function getRequest(fn, err) { 198 + var o = this.o 199 + , method = (o['method'] || 'GET').toUpperCase() 200 + , url = typeof o === 'string' ? o : o['url'] 201 + // convert non-string objects to query-string form unless o['processData'] is false 202 + , data = (o['processData'] !== false && o['data'] && typeof o['data'] !== 'string') 203 + ? reqwest.toQueryString(o['data']) 204 + : (o['data'] || null) 205 + , http 206 + , sendWait = false 207 + 208 + // if we're working on a GET request and we have data then we should append 209 + // query string to end of URL and not post data 210 + if ((o['type'] == 'jsonp' || method == 'GET') && data) { 211 + url = urlappend(url, data) 212 + data = null 213 + } 214 + 215 + if (o['type'] == 'jsonp') return handleJsonp(o, fn, err, url) 216 + 217 + // get the xhr from the factory if passed 218 + // if the factory returns null, fall-back to ours 219 + http = (o.xhr && o.xhr(o)) || xhr(o) 220 + 221 + http.open(method, url, o['async'] === false ? false : true) 222 + setHeaders(http, o) 223 + setCredentials(http, o) 224 + if (context[xDomainRequest] && http instanceof context[xDomainRequest]) { 225 + http.onload = fn 226 + http.onerror = err 227 + // NOTE: see 228 + // http://social.msdn.microsoft.com/Forums/en-US/iewebdevelopment/thread/30ef3add-767c-4436-b8a9-f1ca19b4812e 229 + http.onprogress = function() {} 230 + sendWait = true 231 + } else { 232 + http.onreadystatechange = handleReadyState(this, fn, err) 233 + } 234 + o['before'] && o['before'](http) 235 + if (sendWait) { 236 + setTimeout(function () { 237 + http.send(data) 238 + }, 200) 239 + } else { 240 + http.send(data) 241 + } 242 + return http 243 + } 244 + 245 + function Reqwest(o, fn) { 246 + this.o = o 247 + this.fn = fn 248 + 249 + init.apply(this, arguments) 250 + } 251 + 252 + function setType(header) { 253 + // json, javascript, text/plain, text/html, xml 254 + if (header === null) return undefined; //In case of no content-type. 255 + if (header.match('json')) return 'json' 256 + if (header.match('javascript')) return 'js' 257 + if (header.match('text')) return 'html' 258 + if (header.match('xml')) return 'xml' 259 + } 260 + 261 + function init(o, fn) { 262 + 263 + this.url = typeof o == 'string' ? o : o['url'] 264 + this.timeout = null 265 + 266 + // whether request has been fulfilled for purpose 267 + // of tracking the Promises 268 + this._fulfilled = false 269 + // success handlers 270 + this._successHandler = function(){} 271 + this._fulfillmentHandlers = [] 272 + // error handlers 273 + this._errorHandlers = [] 274 + // complete (both success and fail) handlers 275 + this._completeHandlers = [] 276 + this._erred = false 277 + this._responseArgs = {} 278 + 279 + var self = this 280 + 281 + fn = fn || function () {} 282 + 283 + if (o['timeout']) { 284 + this.timeout = setTimeout(function () { 285 + timedOut() 286 + }, o['timeout']) 287 + } 288 + 289 + if (o['success']) { 290 + this._successHandler = function () { 291 + o['success'].apply(o, arguments) 292 + } 293 + } 294 + 295 + if (o['error']) { 296 + this._errorHandlers.push(function () { 297 + o['error'].apply(o, arguments) 298 + }) 299 + } 300 + 301 + if (o['complete']) { 302 + this._completeHandlers.push(function () { 303 + o['complete'].apply(o, arguments) 304 + }) 305 + } 306 + 307 + function complete (resp) { 308 + o['timeout'] && clearTimeout(self.timeout) 309 + self.timeout = null 310 + while (self._completeHandlers.length > 0) { 311 + self._completeHandlers.shift()(resp) 312 + } 313 + } 314 + 315 + function success (resp) { 316 + var type = o['type'] || resp && setType(resp.getResponseHeader('Content-Type')) // resp can be undefined in IE 317 + resp = (type !== 'jsonp') ? self.request : resp 318 + // use global data filter on response text 319 + var filteredResponse = globalSetupOptions.dataFilter(resp.responseText, type) 320 + , r = filteredResponse 321 + try { 322 + resp.responseText = r 323 + } catch (e) { 324 + // can't assign this in IE<=8, just ignore 325 + } 326 + if (r) { 327 + switch (type) { 328 + case 'json': 329 + try { 330 + resp = context.JSON ? context.JSON.parse(r) : eval('(' + r + ')') 331 + } catch (err) { 332 + return error(resp, 'Could not parse JSON in response', err) 333 + } 334 + break 335 + case 'js': 336 + resp = eval(r) 337 + break 338 + case 'html': 339 + resp = r 340 + break 341 + case 'xml': 342 + resp = resp.responseXML 343 + && resp.responseXML.parseError // IE trololo 344 + && resp.responseXML.parseError.errorCode 345 + && resp.responseXML.parseError.reason 346 + ? null 347 + : resp.responseXML 348 + break 349 + } 350 + } 351 + 352 + self._responseArgs.resp = resp 353 + self._fulfilled = true 354 + fn(resp) 355 + self._successHandler(resp) 356 + while (self._fulfillmentHandlers.length > 0) { 357 + resp = self._fulfillmentHandlers.shift()(resp) 358 + } 359 + 360 + complete(resp) 361 + } 362 + 363 + function timedOut() { 364 + self._timedOut = true 365 + self.request.abort() 366 + } 367 + 368 + function error(resp, msg, t) { 369 + resp = self.request 370 + self._responseArgs.resp = resp 371 + self._responseArgs.msg = msg 372 + self._responseArgs.t = t 373 + self._erred = true 374 + while (self._errorHandlers.length > 0) { 375 + self._errorHandlers.shift()(resp, msg, t) 376 + } 377 + complete(resp) 378 + } 379 + 380 + this.request = getRequest.call(this, success, error) 381 + } 382 + 383 + Reqwest.prototype = { 384 + abort: function () { 385 + this._aborted = true 386 + this.request.abort() 387 + } 388 + 389 + , retry: function () { 390 + init.call(this, this.o, this.fn) 391 + } 392 + 393 + /** 394 + * Small deviation from the Promises A CommonJs specification 395 + * http://wiki.commonjs.org/wiki/Promises/A 396 + */ 397 + 398 + /** 399 + * `then` will execute upon successful requests 400 + */ 401 + , then: function (success, fail) { 402 + success = success || function () {} 403 + fail = fail || function () {} 404 + if (this._fulfilled) { 405 + this._responseArgs.resp = success(this._responseArgs.resp) 406 + } else if (this._erred) { 407 + fail(this._responseArgs.resp, this._responseArgs.msg, this._responseArgs.t) 408 + } else { 409 + this._fulfillmentHandlers.push(success) 410 + this._errorHandlers.push(fail) 411 + } 412 + return this 413 + } 414 + 415 + /** 416 + * `always` will execute whether the request succeeds or fails 417 + */ 418 + , always: function (fn) { 419 + if (this._fulfilled || this._erred) { 420 + fn(this._responseArgs.resp) 421 + } else { 422 + this._completeHandlers.push(fn) 423 + } 424 + return this 425 + } 426 + 427 + /** 428 + * `fail` will execute when the request fails 429 + */ 430 + , fail: function (fn) { 431 + if (this._erred) { 432 + fn(this._responseArgs.resp, this._responseArgs.msg, this._responseArgs.t) 433 + } else { 434 + this._errorHandlers.push(fn) 435 + } 436 + return this 437 + } 438 + , 'catch': function (fn) { 439 + return this.fail(fn) 440 + } 441 + } 442 + 443 + function reqwest(o, fn) { 444 + return new Reqwest(o, fn) 445 + } 446 + 447 + // normalize newline variants according to spec -> CRLF 448 + function normalize(s) { 449 + return s ? s.replace(/\r?\n/g, '\r\n') : '' 450 + } 451 + 452 + function serial(el, cb) { 453 + var n = el.name 454 + , t = el.tagName.toLowerCase() 455 + , optCb = function (o) { 456 + // IE gives value="" even where there is no value attribute 457 + // 'specified' ref: http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-862529273 458 + if (o && !o['disabled']) 459 + cb(n, normalize(o['attributes']['value'] && o['attributes']['value']['specified'] ? o['value'] : o['text'])) 460 + } 461 + , ch, ra, val, i 462 + 463 + // don't serialize elements that are disabled or without a name 464 + if (el.disabled || !n) return 465 + 466 + switch (t) { 467 + case 'input': 468 + if (!/reset|button|image|file/i.test(el.type)) { 469 + ch = /checkbox/i.test(el.type) 470 + ra = /radio/i.test(el.type) 471 + val = el.value 472 + // WebKit gives us "" instead of "on" if a checkbox has no value, so correct it here 473 + ;(!(ch || ra) || el.checked) && cb(n, normalize(ch && val === '' ? 'on' : val)) 474 + } 475 + break 476 + case 'textarea': 477 + cb(n, normalize(el.value)) 478 + break 479 + case 'select': 480 + if (el.type.toLowerCase() === 'select-one') { 481 + optCb(el.selectedIndex >= 0 ? el.options[el.selectedIndex] : null) 482 + } else { 483 + for (i = 0; el.length && i < el.length; i++) { 484 + el.options[i].selected && optCb(el.options[i]) 485 + } 486 + } 487 + break 488 + } 489 + } 490 + 491 + // collect up all form elements found from the passed argument elements all 492 + // the way down to child elements; pass a '<form>' or form fields. 493 + // called with 'this'=callback to use for serial() on each element 494 + function eachFormElement() { 495 + var cb = this 496 + , e, i 497 + , serializeSubtags = function (e, tags) { 498 + var i, j, fa 499 + for (i = 0; i < tags.length; i++) { 500 + fa = e[byTag](tags[i]) 501 + for (j = 0; j < fa.length; j++) serial(fa[j], cb) 502 + } 503 + } 504 + 505 + for (i = 0; i < arguments.length; i++) { 506 + e = arguments[i] 507 + if (/input|select|textarea/i.test(e.tagName)) serial(e, cb) 508 + serializeSubtags(e, [ 'input', 'select', 'textarea' ]) 509 + } 510 + } 511 + 512 + // standard query string style serialization 513 + function serializeQueryString() { 514 + return reqwest.toQueryString(reqwest.serializeArray.apply(null, arguments)) 515 + } 516 + 517 + // { 'name': 'value', ... } style serialization 518 + function serializeHash() { 519 + var hash = {} 520 + eachFormElement.apply(function (name, value) { 521 + if (name in hash) { 522 + hash[name] && !isArray(hash[name]) && (hash[name] = [hash[name]]) 523 + hash[name].push(value) 524 + } else hash[name] = value 525 + }, arguments) 526 + return hash 527 + } 528 + 529 + // [ { name: 'name', value: 'value' }, ... ] style serialization 530 + reqwest.serializeArray = function () { 531 + var arr = [] 532 + eachFormElement.apply(function (name, value) { 533 + arr.push({name: name, value: value}) 534 + }, arguments) 535 + return arr 536 + } 537 + 538 + reqwest.serialize = function () { 539 + if (arguments.length === 0) return '' 540 + var opt, fn 541 + , args = Array.prototype.slice.call(arguments, 0) 542 + 543 + opt = args.pop() 544 + opt && opt.nodeType && args.push(opt) && (opt = null) 545 + opt && (opt = opt.type) 546 + 547 + if (opt == 'map') fn = serializeHash 548 + else if (opt == 'array') fn = reqwest.serializeArray 549 + else fn = serializeQueryString 550 + 551 + return fn.apply(null, args) 552 + } 553 + 554 + reqwest.toQueryString = function (o, trad) { 555 + var prefix, i 556 + , traditional = trad || false 557 + , s = [] 558 + , enc = encodeURIComponent 559 + , add = function (key, value) { 560 + // If value is a function, invoke it and return its value 561 + value = ('function' === typeof value) ? value() : (value == null ? '' : value) 562 + s[s.length] = enc(key) + '=' + enc(value) 563 + } 564 + // If an array was passed in, assume that it is an array of form elements. 565 + if (isArray(o)) { 566 + for (i = 0; o && i < o.length; i++) add(o[i]['name'], o[i]['value']) 567 + } else { 568 + // If traditional, encode the "old" way (the way 1.3.2 or older 569 + // did it), otherwise encode params recursively. 570 + for (prefix in o) { 571 + if (o.hasOwnProperty(prefix)) buildParams(prefix, o[prefix], traditional, add) 572 + } 573 + } 574 + 575 + // spaces should be + according to spec 576 + return s.join('&').replace(/%20/g, '+') 577 + } 578 + 579 + function buildParams(prefix, obj, traditional, add) { 580 + var name, i, v 581 + , rbracket = /\[\]$/ 582 + 583 + if (isArray(obj)) { 584 + // Serialize array item. 585 + for (i = 0; obj && i < obj.length; i++) { 586 + v = obj[i] 587 + if (traditional || rbracket.test(prefix)) { 588 + // Treat each array item as a scalar. 589 + add(prefix, v) 590 + } else { 591 + buildParams(prefix + '[' + (typeof v === 'object' ? i : '') + ']', v, traditional, add) 592 + } 593 + } 594 + } else if (obj && obj.toString() === '[object Object]') { 595 + // Serialize object item. 596 + for (name in obj) { 597 + buildParams(prefix + '[' + name + ']', obj[name], traditional, add) 598 + } 599 + 600 + } else { 601 + // Serialize scalar item. 602 + add(prefix, obj) 603 + } 604 + } 605 + 606 + reqwest.getcallbackPrefix = function () { 607 + return callbackPrefix 608 + } 609 + 610 + // jQuery and Zepto compatibility, differences can be remapped here so you can call 611 + // .ajax.compat(options, callback) 612 + reqwest.compat = function (o, fn) { 613 + if (o) { 614 + o['type'] && (o['method'] = o['type']) && delete o['type'] 615 + o['dataType'] && (o['type'] = o['dataType']) 616 + o['jsonpCallback'] && (o['jsonpCallbackName'] = o['jsonpCallback']) && delete o['jsonpCallback'] 617 + o['jsonp'] && (o['jsonpCallback'] = o['jsonp']) 618 + } 619 + return new Reqwest(o, fn) 620 + } 621 + 622 + reqwest.ajaxSetup = function (options) { 623 + options = options || {} 624 + for (var k in options) { 625 + globalSetupOptions[k] = options[k] 626 + } 627 + } 628 + 629 + return reqwest 630 +});
Added cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/reqwest.min.js.
cannot compute difference between binary files
Added cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/src/copyright.js.
1 +/*! 2 + * Reqwest! A general purpose XHR connection manager 3 + * license MIT (c) Dustin Diaz 2015 4 + * https://github.com/ded/reqwest 5 + */
Added cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/src/ender.js.
1 +!function ($) { 2 + var r = require('reqwest') 3 + , integrate = function (method) { 4 + return function () { 5 + var args = Array.prototype.slice.call(arguments, 0) 6 + , i = (this && this.length) || 0 7 + while (i--) args.unshift(this[i]) 8 + return r[method].apply(null, args) 9 + } 10 + } 11 + , s = integrate('serialize') 12 + , sa = integrate('serializeArray') 13 + 14 + $.ender({ 15 + ajax: r 16 + , serialize: r.serialize 17 + , serializeArray: r.serializeArray 18 + , toQueryString: r.toQueryString 19 + , ajaxSetup: r.ajaxSetup 20 + }) 21 + 22 + $.ender({ 23 + serialize: s 24 + , serializeArray: sa 25 + }, true) 26 +}(ender);
Added cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/src/reqwest.js.
1 +!function (name, context, definition) { 2 + if (typeof module != 'undefined' && module.exports) module.exports = definition() 3 + else if (typeof define == 'function' && define.amd) define(definition) 4 + else context[name] = definition() 5 +}('reqwest', this, function () { 6 + 7 + var context = this 8 + 9 + if ('window' in context) { 10 + var doc = document 11 + , byTag = 'getElementsByTagName' 12 + , head = doc[byTag]('head')[0] 13 + } else { 14 + var XHR2 15 + try { 16 + XHR2 = require('xhr2') 17 + } catch (ex) { 18 + throw new Error('Peer dependency `xhr2` required! Please npm install xhr2') 19 + } 20 + } 21 + 22 + 23 + var httpsRe = /^http/ 24 + , protocolRe = /(^\w+):\/\// 25 + , twoHundo = /^(20\d|1223)$/ //http://stackoverflow.com/questions/10046972/msie-returns-status-code-of-1223-for-ajax-request 26 + , readyState = 'readyState' 27 + , contentType = 'Content-Type' 28 + , requestedWith = 'X-Requested-With' 29 + , uniqid = 0 30 + , callbackPrefix = 'reqwest_' + (+new Date()) 31 + , lastValue // data stored by the most recent JSONP callback 32 + , xmlHttpRequest = 'XMLHttpRequest' 33 + , xDomainRequest = 'XDomainRequest' 34 + , noop = function () {} 35 + 36 + , isArray = typeof Array.isArray == 'function' 37 + ? Array.isArray 38 + : function (a) { 39 + return a instanceof Array 40 + } 41 + 42 + , defaultHeaders = { 43 + 'contentType': 'application/x-www-form-urlencoded' 44 + , 'requestedWith': xmlHttpRequest 45 + , 'accept': { 46 + '*': 'text/javascript, text/html, application/xml, text/xml, */*' 47 + , 'xml': 'application/xml, text/xml' 48 + , 'html': 'text/html' 49 + , 'text': 'text/plain' 50 + , 'json': 'application/json, text/javascript' 51 + , 'js': 'application/javascript, text/javascript' 52 + } 53 + } 54 + 55 + , xhr = function(o) { 56 + // is it x-domain 57 + if (o['crossOrigin'] === true) { 58 + var xhr = context[xmlHttpRequest] ? new XMLHttpRequest() : null 59 + if (xhr && 'withCredentials' in xhr) { 60 + return xhr 61 + } else if (context[xDomainRequest]) { 62 + return new XDomainRequest() 63 + } else { 64 + throw new Error('Browser does not support cross-origin requests') 65 + } 66 + } else if (context[xmlHttpRequest]) { 67 + return new XMLHttpRequest() 68 + } else if (XHR2) { 69 + return new XHR2() 70 + } else { 71 + return new ActiveXObject('Microsoft.XMLHTTP') 72 + } 73 + } 74 + , globalSetupOptions = { 75 + dataFilter: function (data) { 76 + return data 77 + } 78 + } 79 + 80 + function succeed(r) { 81 + var protocol = protocolRe.exec(r.url) 82 + protocol = (protocol && protocol[1]) || context.location.protocol 83 + return httpsRe.test(protocol) ? twoHundo.test(r.request.status) : !!r.request.response 84 + } 85 + 86 + function handleReadyState(r, success, error) { 87 + return function () { 88 + // use _aborted to mitigate against IE err c00c023f 89 + // (can't read props on aborted request objects) 90 + if (r._aborted) return error(r.request) 91 + if (r._timedOut) return error(r.request, 'Request is aborted: timeout') 92 + if (r.request && r.request[readyState] == 4) { 93 + r.request.onreadystatechange = noop 94 + if (succeed(r)) success(r.request) 95 + else 96 + error(r.request) 97 + } 98 + } 99 + } 100 + 101 + function setHeaders(http, o) { 102 + var headers = o['headers'] || {} 103 + , h 104 + 105 + headers['Accept'] = headers['Accept'] 106 + || defaultHeaders['accept'][o['type']] 107 + || defaultHeaders['accept']['*'] 108 + 109 + var isAFormData = typeof FormData !== 'undefined' && (o['data'] instanceof FormData); 110 + // breaks cross-origin requests with legacy browsers 111 + if (!o['crossOrigin'] && !headers[requestedWith]) headers[requestedWith] = defaultHeaders['requestedWith'] 112 + if (!headers[contentType] && !isAFormData) headers[contentType] = o['contentType'] || defaultHeaders['contentType'] 113 + for (h in headers) 114 + headers.hasOwnProperty(h) && 'setRequestHeader' in http && http.setRequestHeader(h, headers[h]) 115 + } 116 + 117 + function setCredentials(http, o) { 118 + if (typeof o['withCredentials'] !== 'undefined' && typeof http.withCredentials !== 'undefined') { 119 + http.withCredentials = !!o['withCredentials'] 120 + } 121 + } 122 + 123 + function generalCallback(data) { 124 + lastValue = data 125 + } 126 + 127 + function urlappend (url, s) { 128 + return url + (/\?/.test(url) ? '&' : '?') + s 129 + } 130 + 131 + function handleJsonp(o, fn, err, url) { 132 + var reqId = uniqid++ 133 + , cbkey = o['jsonpCallback'] || 'callback' // the 'callback' key 134 + , cbval = o['jsonpCallbackName'] || reqwest.getcallbackPrefix(reqId) 135 + , cbreg = new RegExp('((^|\\?|&)' + cbkey + ')=([^&]+)') 136 + , match = url.match(cbreg) 137 + , script = doc.createElement('script') 138 + , loaded = 0 139 + , isIE10 = navigator.userAgent.indexOf('MSIE 10.0') !== -1 140 + 141 + if (match) { 142 + if (match[3] === '?') { 143 + url = url.replace(cbreg, '$1=' + cbval) // wildcard callback func name 144 + } else { 145 + cbval = match[3] // provided callback func name 146 + } 147 + } else { 148 + url = urlappend(url, cbkey + '=' + cbval) // no callback details, add 'em 149 + } 150 + 151 + context[cbval] = generalCallback 152 + 153 + script.type = 'text/javascript' 154 + script.src = url 155 + script.async = true 156 + if (typeof script.onreadystatechange !== 'undefined' && !isIE10) { 157 + // need this for IE due to out-of-order onreadystatechange(), binding script 158 + // execution to an event listener gives us control over when the script 159 + // is executed. See http://jaubourg.net/2010/07/loading-script-as-onclick-handler-of.html 160 + script.htmlFor = script.id = '_reqwest_' + reqId 161 + } 162 + 163 + script.onload = script.onreadystatechange = function () { 164 + if ((script[readyState] && script[readyState] !== 'complete' && script[readyState] !== 'loaded') || loaded) { 165 + return false 166 + } 167 + script.onload = script.onreadystatechange = null 168 + script.onclick && script.onclick() 169 + // Call the user callback with the last value stored and clean up values and scripts. 170 + fn(lastValue) 171 + lastValue = undefined 172 + head.removeChild(script) 173 + loaded = 1 174 + } 175 + 176 + // Add the script to the DOM head 177 + head.appendChild(script) 178 + 179 + // Enable JSONP timeout 180 + return { 181 + abort: function () { 182 + script.onload = script.onreadystatechange = null 183 + err({}, 'Request is aborted: timeout', {}) 184 + lastValue = undefined 185 + head.removeChild(script) 186 + loaded = 1 187 + } 188 + } 189 + } 190 + 191 + function getRequest(fn, err) { 192 + var o = this.o 193 + , method = (o['method'] || 'GET').toUpperCase() 194 + , url = typeof o === 'string' ? o : o['url'] 195 + // convert non-string objects to query-string form unless o['processData'] is false 196 + , data = (o['processData'] !== false && o['data'] && typeof o['data'] !== 'string') 197 + ? reqwest.toQueryString(o['data']) 198 + : (o['data'] || null) 199 + , http 200 + , sendWait = false 201 + 202 + // if we're working on a GET request and we have data then we should append 203 + // query string to end of URL and not post data 204 + if ((o['type'] == 'jsonp' || method == 'GET') && data) { 205 + url = urlappend(url, data) 206 + data = null 207 + } 208 + 209 + if (o['type'] == 'jsonp') return handleJsonp(o, fn, err, url) 210 + 211 + // get the xhr from the factory if passed 212 + // if the factory returns null, fall-back to ours 213 + http = (o.xhr && o.xhr(o)) || xhr(o) 214 + 215 + http.open(method, url, o['async'] === false ? false : true) 216 + setHeaders(http, o) 217 + setCredentials(http, o) 218 + if (context[xDomainRequest] && http instanceof context[xDomainRequest]) { 219 + http.onload = fn 220 + http.onerror = err 221 + // NOTE: see 222 + // http://social.msdn.microsoft.com/Forums/en-US/iewebdevelopment/thread/30ef3add-767c-4436-b8a9-f1ca19b4812e 223 + http.onprogress = function() {} 224 + sendWait = true 225 + } else { 226 + http.onreadystatechange = handleReadyState(this, fn, err) 227 + } 228 + o['before'] && o['before'](http) 229 + if (sendWait) { 230 + setTimeout(function () { 231 + http.send(data) 232 + }, 200) 233 + } else { 234 + http.send(data) 235 + } 236 + return http 237 + } 238 + 239 + function Reqwest(o, fn) { 240 + this.o = o 241 + this.fn = fn 242 + 243 + init.apply(this, arguments) 244 + } 245 + 246 + function setType(header) { 247 + // json, javascript, text/plain, text/html, xml 248 + if (header === null) return undefined; //In case of no content-type. 249 + if (header.match('json')) return 'json' 250 + if (header.match('javascript')) return 'js' 251 + if (header.match('text')) return 'html' 252 + if (header.match('xml')) return 'xml' 253 + } 254 + 255 + function init(o, fn) { 256 + 257 + this.url = typeof o == 'string' ? o : o['url'] 258 + this.timeout = null 259 + 260 + // whether request has been fulfilled for purpose 261 + // of tracking the Promises 262 + this._fulfilled = false 263 + // success handlers 264 + this._successHandler = function(){} 265 + this._fulfillmentHandlers = [] 266 + // error handlers 267 + this._errorHandlers = [] 268 + // complete (both success and fail) handlers 269 + this._completeHandlers = [] 270 + this._erred = false 271 + this._responseArgs = {} 272 + 273 + var self = this 274 + 275 + fn = fn || function () {} 276 + 277 + if (o['timeout']) { 278 + this.timeout = setTimeout(function () { 279 + timedOut() 280 + }, o['timeout']) 281 + } 282 + 283 + if (o['success']) { 284 + this._successHandler = function () { 285 + o['success'].apply(o, arguments) 286 + } 287 + } 288 + 289 + if (o['error']) { 290 + this._errorHandlers.push(function () { 291 + o['error'].apply(o, arguments) 292 + }) 293 + } 294 + 295 + if (o['complete']) { 296 + this._completeHandlers.push(function () { 297 + o['complete'].apply(o, arguments) 298 + }) 299 + } 300 + 301 + function complete (resp) { 302 + o['timeout'] && clearTimeout(self.timeout) 303 + self.timeout = null 304 + while (self._completeHandlers.length > 0) { 305 + self._completeHandlers.shift()(resp) 306 + } 307 + } 308 + 309 + function success (resp) { 310 + var type = o['type'] || resp && setType(resp.getResponseHeader('Content-Type')) // resp can be undefined in IE 311 + resp = (type !== 'jsonp') ? self.request : resp 312 + // use global data filter on response text 313 + var filteredResponse = globalSetupOptions.dataFilter(resp.responseText, type) 314 + , r = filteredResponse 315 + try { 316 + resp.responseText = r 317 + } catch (e) { 318 + // can't assign this in IE<=8, just ignore 319 + } 320 + if (r) { 321 + switch (type) { 322 + case 'json': 323 + try { 324 + resp = context.JSON ? context.JSON.parse(r) : eval('(' + r + ')') 325 + } catch (err) { 326 + return error(resp, 'Could not parse JSON in response', err) 327 + } 328 + break 329 + case 'js': 330 + resp = eval(r) 331 + break 332 + case 'html': 333 + resp = r 334 + break 335 + case 'xml': 336 + resp = resp.responseXML 337 + && resp.responseXML.parseError // IE trololo 338 + && resp.responseXML.parseError.errorCode 339 + && resp.responseXML.parseError.reason 340 + ? null 341 + : resp.responseXML 342 + break 343 + } 344 + } 345 + 346 + self._responseArgs.resp = resp 347 + self._fulfilled = true 348 + fn(resp) 349 + self._successHandler(resp) 350 + while (self._fulfillmentHandlers.length > 0) { 351 + resp = self._fulfillmentHandlers.shift()(resp) 352 + } 353 + 354 + complete(resp) 355 + } 356 + 357 + function timedOut() { 358 + self._timedOut = true 359 + self.request.abort() 360 + } 361 + 362 + function error(resp, msg, t) { 363 + resp = self.request 364 + self._responseArgs.resp = resp 365 + self._responseArgs.msg = msg 366 + self._responseArgs.t = t 367 + self._erred = true 368 + while (self._errorHandlers.length > 0) { 369 + self._errorHandlers.shift()(resp, msg, t) 370 + } 371 + complete(resp) 372 + } 373 + 374 + this.request = getRequest.call(this, success, error) 375 + } 376 + 377 + Reqwest.prototype = { 378 + abort: function () { 379 + this._aborted = true 380 + this.request.abort() 381 + } 382 + 383 + , retry: function () { 384 + init.call(this, this.o, this.fn) 385 + } 386 + 387 + /** 388 + * Small deviation from the Promises A CommonJs specification 389 + * http://wiki.commonjs.org/wiki/Promises/A 390 + */ 391 + 392 + /** 393 + * `then` will execute upon successful requests 394 + */ 395 + , then: function (success, fail) { 396 + success = success || function () {} 397 + fail = fail || function () {} 398 + if (this._fulfilled) { 399 + this._responseArgs.resp = success(this._responseArgs.resp) 400 + } else if (this._erred) { 401 + fail(this._responseArgs.resp, this._responseArgs.msg, this._responseArgs.t) 402 + } else { 403 + this._fulfillmentHandlers.push(success) 404 + this._errorHandlers.push(fail) 405 + } 406 + return this 407 + } 408 + 409 + /** 410 + * `always` will execute whether the request succeeds or fails 411 + */ 412 + , always: function (fn) { 413 + if (this._fulfilled || this._erred) { 414 + fn(this._responseArgs.resp) 415 + } else { 416 + this._completeHandlers.push(fn) 417 + } 418 + return this 419 + } 420 + 421 + /** 422 + * `fail` will execute when the request fails 423 + */ 424 + , fail: function (fn) { 425 + if (this._erred) { 426 + fn(this._responseArgs.resp, this._responseArgs.msg, this._responseArgs.t) 427 + } else { 428 + this._errorHandlers.push(fn) 429 + } 430 + return this 431 + } 432 + , 'catch': function (fn) { 433 + return this.fail(fn) 434 + } 435 + } 436 + 437 + function reqwest(o, fn) { 438 + return new Reqwest(o, fn) 439 + } 440 + 441 + // normalize newline variants according to spec -> CRLF 442 + function normalize(s) { 443 + return s ? s.replace(/\r?\n/g, '\r\n') : '' 444 + } 445 + 446 + function serial(el, cb) { 447 + var n = el.name 448 + , t = el.tagName.toLowerCase() 449 + , optCb = function (o) { 450 + // IE gives value="" even where there is no value attribute 451 + // 'specified' ref: http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-862529273 452 + if (o && !o['disabled']) 453 + cb(n, normalize(o['attributes']['value'] && o['attributes']['value']['specified'] ? o['value'] : o['text'])) 454 + } 455 + , ch, ra, val, i 456 + 457 + // don't serialize elements that are disabled or without a name 458 + if (el.disabled || !n) return 459 + 460 + switch (t) { 461 + case 'input': 462 + if (!/reset|button|image|file/i.test(el.type)) { 463 + ch = /checkbox/i.test(el.type) 464 + ra = /radio/i.test(el.type) 465 + val = el.value 466 + // WebKit gives us "" instead of "on" if a checkbox has no value, so correct it here 467 + ;(!(ch || ra) || el.checked) && cb(n, normalize(ch && val === '' ? 'on' : val)) 468 + } 469 + break 470 + case 'textarea': 471 + cb(n, normalize(el.value)) 472 + break 473 + case 'select': 474 + if (el.type.toLowerCase() === 'select-one') { 475 + optCb(el.selectedIndex >= 0 ? el.options[el.selectedIndex] : null) 476 + } else { 477 + for (i = 0; el.length && i < el.length; i++) { 478 + el.options[i].selected && optCb(el.options[i]) 479 + } 480 + } 481 + break 482 + } 483 + } 484 + 485 + // collect up all form elements found from the passed argument elements all 486 + // the way down to child elements; pass a '<form>' or form fields. 487 + // called with 'this'=callback to use for serial() on each element 488 + function eachFormElement() { 489 + var cb = this 490 + , e, i 491 + , serializeSubtags = function (e, tags) { 492 + var i, j, fa 493 + for (i = 0; i < tags.length; i++) { 494 + fa = e[byTag](tags[i]) 495 + for (j = 0; j < fa.length; j++) serial(fa[j], cb) 496 + } 497 + } 498 + 499 + for (i = 0; i < arguments.length; i++) { 500 + e = arguments[i] 501 + if (/input|select|textarea/i.test(e.tagName)) serial(e, cb) 502 + serializeSubtags(e, [ 'input', 'select', 'textarea' ]) 503 + } 504 + } 505 + 506 + // standard query string style serialization 507 + function serializeQueryString() { 508 + return reqwest.toQueryString(reqwest.serializeArray.apply(null, arguments)) 509 + } 510 + 511 + // { 'name': 'value', ... } style serialization 512 + function serializeHash() { 513 + var hash = {} 514 + eachFormElement.apply(function (name, value) { 515 + if (name in hash) { 516 + hash[name] && !isArray(hash[name]) && (hash[name] = [hash[name]]) 517 + hash[name].push(value) 518 + } else hash[name] = value 519 + }, arguments) 520 + return hash 521 + } 522 + 523 + // [ { name: 'name', value: 'value' }, ... ] style serialization 524 + reqwest.serializeArray = function () { 525 + var arr = [] 526 + eachFormElement.apply(function (name, value) { 527 + arr.push({name: name, value: value}) 528 + }, arguments) 529 + return arr 530 + } 531 + 532 + reqwest.serialize = function () { 533 + if (arguments.length === 0) return '' 534 + var opt, fn 535 + , args = Array.prototype.slice.call(arguments, 0) 536 + 537 + opt = args.pop() 538 + opt && opt.nodeType && args.push(opt) && (opt = null) 539 + opt && (opt = opt.type) 540 + 541 + if (opt == 'map') fn = serializeHash 542 + else if (opt == 'array') fn = reqwest.serializeArray 543 + else fn = serializeQueryString 544 + 545 + return fn.apply(null, args) 546 + } 547 + 548 + reqwest.toQueryString = function (o, trad) { 549 + var prefix, i 550 + , traditional = trad || false 551 + , s = [] 552 + , enc = encodeURIComponent 553 + , add = function (key, value) { 554 + // If value is a function, invoke it and return its value 555 + value = ('function' === typeof value) ? value() : (value == null ? '' : value) 556 + s[s.length] = enc(key) + '=' + enc(value) 557 + } 558 + // If an array was passed in, assume that it is an array of form elements. 559 + if (isArray(o)) { 560 + for (i = 0; o && i < o.length; i++) add(o[i]['name'], o[i]['value']) 561 + } else { 562 + // If traditional, encode the "old" way (the way 1.3.2 or older 563 + // did it), otherwise encode params recursively. 564 + for (prefix in o) { 565 + if (o.hasOwnProperty(prefix)) buildParams(prefix, o[prefix], traditional, add) 566 + } 567 + } 568 + 569 + // spaces should be + according to spec 570 + return s.join('&').replace(/%20/g, '+') 571 + } 572 + 573 + function buildParams(prefix, obj, traditional, add) { 574 + var name, i, v 575 + , rbracket = /\[\]$/ 576 + 577 + if (isArray(obj)) { 578 + // Serialize array item. 579 + for (i = 0; obj && i < obj.length; i++) { 580 + v = obj[i] 581 + if (traditional || rbracket.test(prefix)) { 582 + // Treat each array item as a scalar. 583 + add(prefix, v) 584 + } else { 585 + buildParams(prefix + '[' + (typeof v === 'object' ? i : '') + ']', v, traditional, add) 586 + } 587 + } 588 + } else if (obj && obj.toString() === '[object Object]') { 589 + // Serialize object item. 590 + for (name in obj) { 591 + buildParams(prefix + '[' + name + ']', obj[name], traditional, add) 592 + } 593 + 594 + } else { 595 + // Serialize scalar item. 596 + add(prefix, obj) 597 + } 598 + } 599 + 600 + reqwest.getcallbackPrefix = function () { 601 + return callbackPrefix 602 + } 603 + 604 + // jQuery and Zepto compatibility, differences can be remapped here so you can call 605 + // .ajax.compat(options, callback) 606 + reqwest.compat = function (o, fn) { 607 + if (o) { 608 + o['type'] && (o['method'] = o['type']) && delete o['type'] 609 + o['dataType'] && (o['type'] = o['dataType']) 610 + o['jsonpCallback'] && (o['jsonpCallbackName'] = o['jsonpCallback']) && delete o['jsonpCallback'] 611 + o['jsonp'] && (o['jsonpCallback'] = o['jsonp']) 612 + } 613 + return new Reqwest(o, fn) 614 + } 615 + 616 + reqwest.ajaxSetup = function (options) { 617 + options = options || {} 618 + for (var k in options) { 619 + globalSetupOptions[k] = options[k] 620 + } 621 + } 622 + 623 + return reqwest 624 +});
Added cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/test.js.
1 +var spawn = require('child_process').spawn 2 + , server = spawn('node', ['make/tests.js']) 3 + , phantom = spawn('./vendor/phantomjs', ['./phantom.js']) 4 + 5 + 6 +phantom.stdout.on('data', function (data) { 7 + console.log('stdout: ' + data); 8 +}) 9 + 10 +phantom.on('exit', function (code, signal) { 11 + var outcome = code == 0 ? 'passed' : 'failed' 12 + console.log('Reqwest tests have %s', outcome, code) 13 + server.kill('SIGHUP') 14 + process.exit(code) 15 +})
Added cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/ender.js.
1 +/*! 2 + * Ender: open module JavaScript framework (client-lib) 3 + * copyright Dustin Diaz & Jacob Thornton 2011-2012 (@ded @fat) 4 + * http://ender.no.de 5 + * License MIT 6 + */ 7 +(function (context) { 8 + 9 + // a global object for node.js module compatiblity 10 + // ============================================ 11 + 12 + context['global'] = context 13 + 14 + // Implements simple module system 15 + // losely based on CommonJS Modules spec v1.1.1 16 + // ============================================ 17 + 18 + var modules = {} 19 + , old = context['$'] 20 + , oldRequire = context['require'] 21 + , oldProvide = context['provide'] 22 + 23 + function require (identifier) { 24 + // modules can be required from ender's build system, or found on the window 25 + var module = modules['$' + identifier] || window[identifier] 26 + if (!module) throw new Error("Ender Error: Requested module '" + identifier + "' has not been defined.") 27 + return module 28 + } 29 + 30 + function provide (name, what) { 31 + return (modules['$' + name] = what) 32 + } 33 + 34 + context['provide'] = provide 35 + context['require'] = require 36 + 37 + function aug(o, o2) { 38 + for (var k in o2) k != 'noConflict' && k != '_VERSION' && (o[k] = o2[k]) 39 + return o 40 + } 41 + 42 + /** 43 + * main Ender return object 44 + * @constructor 45 + * @param {Array|Node|string} s a CSS selector or DOM node(s) 46 + * @param {Array.|Node} r a root node(s) 47 + */ 48 + function Ender(s, r) { 49 + var elements 50 + , i 51 + 52 + this.selector = s 53 + // string || node || nodelist || window 54 + if (typeof s == 'undefined') { 55 + elements = [] 56 + this.selector = '' 57 + } else if (typeof s == 'string' || s.nodeName || (s.length && 'item' in s) || s == window) { 58 + elements = ender._select(s, r) 59 + } else { 60 + elements = isFinite(s.length) ? s : [s] 61 + } 62 + this.length = elements.length 63 + for (i = this.length; i--;) this[i] = elements[i] 64 + } 65 + 66 + /** 67 + * @param {function(el, i, inst)} fn 68 + * @param {Object} opt_scope 69 + * @returns {Ender} 70 + */ 71 + Ender.prototype['forEach'] = function (fn, opt_scope) { 72 + var i, l 73 + // opt out of native forEach so we can intentionally call our own scope 74 + // defaulting to the current item and be able to return self 75 + for (i = 0, l = this.length; i < l; ++i) i in this && fn.call(opt_scope || this[i], this[i], i, this) 76 + // return self for chaining 77 + return this 78 + } 79 + 80 + Ender.prototype.$ = ender // handy reference to self 81 + 82 + 83 + function ender(s, r) { 84 + return new Ender(s, r) 85 + } 86 + 87 + ender['_VERSION'] = '0.4.3-dev' 88 + 89 + ender.fn = Ender.prototype // for easy compat to jQuery plugins 90 + 91 + ender.ender = function (o, chain) { 92 + aug(chain ? Ender.prototype : ender, o) 93 + } 94 + 95 + ender._select = function (s, r) { 96 + if (typeof s == 'string') return (r || document).querySelectorAll(s) 97 + if (s.nodeName) return [s] 98 + return s 99 + } 100 + 101 + 102 + // use callback to receive Ender's require & provide 103 + ender.noConflict = function (callback) { 104 + context['$'] = old 105 + if (callback) { 106 + context['provide'] = oldProvide 107 + context['require'] = oldRequire 108 + callback(require, provide, this) 109 + } 110 + return this 111 + } 112 + 113 + if (typeof module !== 'undefined' && module.exports) module.exports = ender 114 + // use subscript notation as extern for Closure compilation 115 + context['ender'] = context['$'] = context['ender'] || ender 116 + 117 +}(this));
Added cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/badfixtures.xml.
1 +><><>Not a valid xml document<><><
Added cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/fixtures.html.
1 +<p>boosh</p>
Added cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/fixtures.js.
1 +window.boosh = 'boosh';
Added cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/fixtures.json.
1 +{ "boosh": "boosh" }
Added cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/fixtures.xml.
1 +<root><boosh>boosh</boosh></root>
Added cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/fixtures_jsonp.jsonp.
1 +reqwest_0({ "boosh": "boosh" });
Added cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/fixtures_jsonp2.jsonp.
1 +bar({ "boosh": "boosh" });
Added cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/fixtures_jsonp3.jsonp.
1 +reqwest_2({ "boosh": "boosh" });
Added cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/fixtures_jsonp_multi.jsonp.
1 +reqwest_0({ "a": "a" });
Added cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/fixtures_jsonp_multi_b.jsonp.
1 +reqwest_0({ "b": "b" });
Added cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/fixtures_jsonp_multi_c.jsonp.
1 +reqwest_0({ "c": "c" });
Added cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/fixtures_with_prefix.json.
1 +])}while(1);</x>{ "boosh": "boosh" }
Added cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/fixtures/invalidJSON.json.
1 +this is not valid JSON!, there: are ~!_+ punctuation 2 + 3 +marks 4 + 5 +all, over, the:place ^ 2
Added cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/tests.html.
1 +<!DOCTYPE HTML> 2 +<html lang="en-us"> 3 + <head> 4 + <title>Reqwest tests</title> 5 + <meta http-equiv="Content-type" content="text/html; charset=utf-8"> 6 + <link rel="stylesheet" href="/node_modules/sink-test/src/sink.css" type="text/css"> 7 + <script src="/node_modules/valentine/valentine.js"></script> 8 + <script src="/node_modules/sink-test/src/sink.js"></script> 9 + <script src="/tests/ender.js"></script> 10 + <script src="/src/reqwest.js"></script> 11 + <script src="/src/ender.js"></script> 12 + <style type="text/css"> 13 + #fixtures { 14 + position: absolute; 15 + top: -9999em; 16 + } 17 + </style> 18 + </head> 19 + <body> 20 + <h1>Reqwest Tests</h1> 21 + <div id="fixtures"> 22 + <form action="/foo" method="post"> 23 + <input type="submit" value="Continue"> 24 + <input type="text" name="foo" value="bar"> 25 + <input type="hidden" name="bar" value="baz"> 26 + <input type="checkbox" name="wha" checked value="1"> 27 + <input type="checkbox" name="wha" value="2"> 28 + <input type="checkbox" name="wha" checked value="3"> 29 + <input type="radio" name="who" value="one"> 30 + <input type="radio" name="who" checked value="tawoo"> 31 + <input type="radio" name="who" value="three"> 32 + <input type="text" name="$escapable name$" value="escapeme" /> 33 + <select name="choices"> 34 + <option>one</option> 35 + <option selected>two</option> 36 + <option>tres</option> 37 + </select> 38 + <textarea name="opinions">world peace is not real</textarea> 39 + </form> 40 + <form action="/baa" method="get"> 41 + <textarea name="T3" rows="2" cols="15">? 42 +A B 43 +Z</textarea> 44 + <input type="hidden" name="H1" value="x" /> <!-- 0 --> 45 + <input type="hidden" name="H2" /> <!-- 1 --> 46 + <input type="password" name="PWD1" value="xyz" /> <!-- 2 --> 47 + <input type="password" name="PWD2" /> <!-- 3 --> 48 + <input type="text" name="T1" /> <!-- 4 --> 49 + <input type="text" name="T2" value="YES" readonly="readonly" /> <!-- 5 --> 50 + <input type="checkbox" name="C1" value="1" /> <!-- 6 --> 51 + <input type="checkbox" name="C2" /> <!-- 7 --> 52 + <input type="radio" name="R1" value="1" /> <!-- 8 --> 53 + <input type="radio" name="R1" value="" /> <!-- 9 --> 54 + <input type="text" name="My Name" value="me" /> <!-- 10 --> 55 + <input type="reset" name="rst" value="NO" /> <!-- 11 --> 56 + <input type="file" name="file" /> <!-- 12 --> 57 + <input type="submit" name="sub" value="NO" /> <!-- 13 --> 58 + <select name="S1"></select> <!-- 0 --> 59 + <select name="S2"> <!-- 1 --> 60 + <option value="abc">ABC</option> 61 + <option value="def">DEF</option> 62 + <option value="ghi">GHI</option> 63 + <option value="jkl">JKL</option> 64 + <option value="mno">MNO</option> 65 + <option value="pqr">PQR</option> 66 + <option value="disco stu">DISCO STU!</option> 67 + <option value="vwx">VWX</option> 68 + <option value="yz">YZ</option> 69 + <option value="">no no no!</option> 70 + </select> 71 + <select name="S3"> <!-- 2 --> 72 + <option>ABC</option> 73 + <option>DEF</option> 74 + <option>GHI</option> 75 + <option>JKL</option> 76 + <option>MNO</option> 77 + <option>PQR</option> 78 + <option>DISCO STU!</option> 79 + <option>VWX</option> 80 + <option>YZ</option> 81 + </select> 82 + <select name="S4" multiple="multiple" size="3"> <!-- 3 --> 83 + <option value="1">One</option> 84 + <option value="2">Two</option> 85 + <option value="3">Three</option> 86 + <option value="4">Four</option> 87 + <option value="5">Five</option> 88 + <option value="6">Six</option> 89 + <option>Seven</option> 90 + <option>Eight</option> 91 + <option>Disco Stu!</option> 92 + </select> 93 + <input type="text" name="D1" value="NO" disabled="disabled" /> <!-- 14 --> 94 + <input type="checkbox" name="D2" value="NO" checked="checked" disabled="disabled" /> <!-- 15 --> 95 + <input type="radio" name="D3" value="NO" checked="checked" disabled="disabled" /> <!-- 16 --> 96 + <select name="D4" disabled="disabled"><option selected="selected" value="NO">NO</option></select> <!-- 4 --> 97 + <select name="D5"><option selected="selected" value="NO" disabled="disabled">NO</option></select> <!-- 5 --> 98 + <select name="D4" disabled="disabled "multiple="multiple" size="3"><option selected="selected" value="NO">NO</option></select> <!-- 6 --> 99 + <select name="D5" multiple="multiple" size="3"><option selected="selected" value="NO" disabled="disabled">NO</option></select> <!-- 7 --> 100 + </form> 101 + </div> 102 + <ol id="tests"></ol> 103 + <script src="/tests/tests.js"></script> 104 + </body> 105 +</html>
Added cmd/pisc-web-ide/webroot/static/js/reqwest-2.0.5/tests/tests.js.
1 +/*jshint maxlen:80*/ 2 +/*global reqwest:true, sink:true, start:true, ender:true, v:true, boosh:true*/ 3 + 4 +(function (ajax) { 5 + var BIND_ARGS = 'bind' 6 + , PASS_ARGS = 'pass' 7 + , FakeXHR = (function () { 8 + function FakeXHR () { 9 + this.args = {} 10 + FakeXHR.last = this 11 + } 12 + FakeXHR.setup = function () { 13 + FakeXHR.oldxhr = window['XMLHttpRequest'] 14 + FakeXHR.oldaxo = window['ActiveXObject'] 15 + window['XMLHttpRequest'] = FakeXHR 16 + window['ActiveXObject'] = FakeXHR 17 + FakeXHR.last = null 18 + } 19 + FakeXHR.restore = function () { 20 + window['XMLHttpRequest'] = FakeXHR.oldxhr 21 + window['ActiveXObject'] = FakeXHR.oldaxo 22 + } 23 + FakeXHR.prototype.methodCallCount = function (name) { 24 + return this.args[name] ? this.args[name].length : 0 25 + } 26 + FakeXHR.prototype.methodCallArgs = function (name, i, j) { 27 + var a = this.args[name] 28 + && this.args[name].length > i ? this.args[name][i] : null 29 + if (arguments.length > 2) return a && a.length > j ? a[j] : null 30 + return a 31 + } 32 + v.each(['open', 'send', 'setRequestHeader' ], function (f) { 33 + FakeXHR.prototype[f] = function () { 34 + if (!this.args[f]) this.args[f] = [] 35 + this.args[f].push(arguments) 36 + } 37 + }) 38 + return FakeXHR 39 + }()) 40 + 41 + sink('Setup', function (test, ok, before, after) { 42 + before(function () { 43 + ajax.ajaxSetup({ 44 + dataFilter: function (resp, type) { 45 + // example filter to prevent json hijacking 46 + return resp.substring('])}while(1);</x>'.length) 47 + } 48 + }) 49 + }) 50 + after(function () { 51 + ajax.ajaxSetup({ 52 + // reset to original data filter 53 + dataFilter: function (resp, type) { 54 + return resp 55 + } 56 + }) 57 + }) 58 + test('dataFilter', function (complete) { 59 + ajax({ 60 + url: '/tests/fixtures/fixtures_with_prefix.json' 61 + , type: 'json' 62 + , success: function (resp) { 63 + ok(resp, 'received response') 64 + ok( 65 + resp && resp.boosh == 'boosh' 66 + , 'correctly evaluated response as JSON' 67 + ) 68 + complete() 69 + } 70 + }) 71 + }) 72 + }) 73 + 74 + sink('Mime Types', function (test, ok) { 75 + test('JSON', function (complete) { 76 + ajax({ 77 + url: '/tests/fixtures/fixtures.json' 78 + , type: 'json' 79 + , success: function (resp) { 80 + ok(resp, 'received response') 81 + ok( 82 + resp && resp.boosh == 'boosh' 83 + , 'correctly evaluated response as JSON' 84 + ) 85 + complete() 86 + } 87 + }) 88 + }) 89 + 90 + test('JSONP', function (complete) { 91 + // stub callback prefix 92 + reqwest.getcallbackPrefix = function (id) { 93 + return 'reqwest_' + id 94 + } 95 + ajax({ 96 + url: '/tests/fixtures/fixtures_jsonp.jsonp?callback=?' 97 + , type: 'jsonp' 98 + , success: function (resp) { 99 + ok(resp, 'received response for unique generated callback') 100 + ok( 101 + resp && resp.boosh == 'boosh' 102 + , 'correctly evaled response for unique generated cb as JSONP' 103 + ) 104 + complete() 105 + } 106 + }) 107 + }) 108 + 109 + test('JS', function (complete) { 110 + ajax({ 111 + url: '/tests/fixtures/fixtures.js' 112 + , type: 'js' 113 + , success: function () { 114 + ok( 115 + typeof boosh !== 'undefined' && boosh == 'boosh' 116 + , 'evaluated response as JavaScript' 117 + ) 118 + complete() 119 + } 120 + }) 121 + }) 122 + 123 + test('HTML', function (complete) { 124 + ajax({ 125 + url: '/tests/fixtures/fixtures.html' 126 + , type: 'html' 127 + , success: function (resp) { 128 + ok(resp == '<p>boosh</p>', 'evaluated response as HTML') 129 + complete() 130 + } 131 + }) 132 + }) 133 + 134 + test('XML', function (complete) { 135 + ajax({ 136 + url: '/tests/fixtures/fixtures.xml' 137 + , type: 'xml' 138 + , success: function (resp) { 139 + ok(resp 140 + && resp.documentElement 141 + && resp.documentElement.nodeName == 'root' 142 + , 'XML Response root is <root>' 143 + ) 144 + ok(resp 145 + && resp.documentElement 146 + && resp.documentElement.hasChildNodes 147 + && resp.documentElement.firstChild.nodeName == 'boosh' 148 + && resp.documentElement.firstChild.firstChild.nodeValue 149 + == 'boosh' 150 + , 'Correct XML response' 151 + ) 152 + complete() 153 + } 154 + , error: function (err) { 155 + ok(false, err.responseText) 156 + complete() 157 + } 158 + }) 159 + }) 160 + 161 + test('XML (404)', function (complete) { 162 + ajax({ 163 + url:'/tests/fixtures/badfixtures.xml' 164 + , type:'xml' 165 + , success: function (resp) { 166 + if (resp == null) { 167 + ok(true, 'XML response is null') 168 + complete() 169 + } else { 170 + ok(resp 171 + && resp.documentElement 172 + && resp.documentElement.firstChild 173 + && (/error/i).test(resp.documentElement.firstChild.nodeValue) 174 + , 'XML response reports parsing error' 175 + ) 176 + complete() 177 + } 178 + } 179 + , error: function () { 180 + ok(true, 'No XML response (error())') 181 + complete() 182 + } 183 + }) 184 + }) 185 + }) 186 + 187 + sink('JSONP', function (test, ok) { 188 + test('Named callback in query string', function (complete) { 189 + ajax({ 190 + url: '/tests/fixtures/fixtures_jsonp2.jsonp?foo=bar' 191 + , type: 'jsonp' 192 + , jsonpCallback: 'foo' 193 + , success: function (resp) { 194 + ok(resp, 'received response for custom callback') 195 + ok( 196 + resp && resp.boosh == 'boosh' 197 + , 'correctly evaluated response as JSONP with custom callback' 198 + ) 199 + complete() 200 + } 201 + }) 202 + }) 203 + 204 + test('Unnamed callback in query string', function (complete) { 205 + ajax({ 206 + url: '/tests/fixtures/fixtures_jsonp3.jsonp?foo=?' 207 + , type: 'jsonp' 208 + , jsonpCallback: 'foo' 209 + , success: function (resp) { 210 + ok(resp, 'received response for custom wildcard callback') 211 + ok( 212 + resp && resp.boosh == 'boosh' 213 + , 'correctly evaled response as JSONP with custom wildcard cb' 214 + ) 215 + complete() 216 + } 217 + }) 218 + }) 219 + 220 + test('No callback, no query string', function (complete) { 221 + ajax({ 222 + url: '/tests/fixtures/fixtures_jsonp3.jsonp' 223 + , type: 'jsonp' 224 + , jsonpCallback: 'foo' 225 + , success: function (resp) { 226 + ok(resp, 'received response for custom wildcard callback') 227 + ok( 228 + resp && resp.boosh == 'boosh' 229 + , 'correctly evaled response as JSONP with custom cb not in url' 230 + ) 231 + complete() 232 + } 233 + }) 234 + }) 235 + 236 + test('No callback in existing query string', function (complete) { 237 + ajax({ 238 + url: '/tests/none.jsonp?echo&somevar=some+long+str+here' 239 + , type: 'jsonp' 240 + , jsonpCallbackName: 'yohoho' 241 + , success: function (resp) { 242 + ok(resp && resp.query, 'received response from echo callback') 243 + ok( 244 + resp && resp.query && resp.query.somevar == 'some long str here' 245 + , 'correctly evaluated response as JSONP with echo callback' 246 + ) 247 + complete() 248 + } 249 + }) 250 + }) 251 + 252 + test('Append data to existing query string', function (complete) { 253 + ajax({ 254 + url: '/tests/none.jsonp?echo' // should append &somevar... 255 + , type: 'jsonp' 256 + , data: { somevar: 'some long str here', anothervar: 'yo ho ho!' } 257 + , success: function (resp) { 258 + ok(resp && resp.query, 'received response from echo callback') 259 + ok( 260 + resp && resp.query && resp.query.somevar == 'some long str here' 261 + , 'correctly sent and received data object from JSONP echo (1)' 262 + ) 263 + ok( 264 + resp && resp.query && resp.query.anothervar == 'yo ho ho!' 265 + , 'correctly sent and received data object from JSONP echo (2)' 266 + ) 267 + complete() 268 + } 269 + }) 270 + }) 271 + 272 + test('Generate complete query string from data', function (complete) { 273 + ajax({ 274 + url: '/tests/none.jsonp' // should append ?echo...etc. 275 + , type: 'jsonp' 276 + , data: [ 277 + { name: 'somevar', value: 'some long str here' } 278 + , { name: 'anothervar', value: 'yo ho ho!' } 279 + , { name: 'echo', value: true } 280 + ] 281 + , success: function (resp) { 282 + ok(resp && resp.query, 'received response from echo callback') 283 + ok( 284 + resp && resp.query && resp.query.somevar == 'some long str here' 285 + , 'correctly sent and received data array from JSONP echo (1)' 286 + ) 287 + ok( 288 + resp && resp.query && resp.query.anothervar == 'yo ho ho!' 289 + , 'correctly sent and received data array from JSONP echo (2)' 290 + ) 291 + complete() 292 + } 293 + }) 294 + }) 295 + 296 + test('Append data to query string and insert callback name' 297 + , function (complete) { 298 + 299 + ajax({ 300 + // should append data and match callback correctly 301 + url: '/tests/none.jsonp?callback=?' 302 + , type: 'jsonp' 303 + , jsonpCallbackName: 'reqwest_foo' 304 + , data: { foo: 'bar', boo: 'baz', echo: true } 305 + , success: function (resp) { 306 + ok(resp && resp.query, 'received response from echo callback') 307 + ok( 308 + resp && resp.query && resp.query.callback == 'reqwest_foo' 309 + , 'correctly matched callback in URL' 310 + ) 311 + complete() 312 + } 313 + }) 314 + }) 315 + }) 316 + 317 + sink('Callbacks', function (test, ok) { 318 + 319 + test('sync version', function (done) { 320 + var r = ajax({ 321 + method: 'get' 322 + , url: '/tests/fixtures/fixtures.json' 323 + , type: 'json' 324 + , async: false 325 + }) 326 + var request = r.request, 327 + responseText = request.response !== undefined ? request.response : request.responseText 328 + ok(eval('(' + responseText + ')').boosh == 'boosh', 'can make sync calls') 329 + done() 330 + }) 331 + 332 + test('no callbacks', function (complete) { 333 + var pass = true 334 + try { 335 + ajax('/tests/fixtures/fixtures.js') 336 + } catch (ex) { 337 + pass = false 338 + } finally { 339 + ok(pass, 'successfully doesnt fail without callback') 340 + complete() 341 + } 342 + }) 343 + 344 + test('complete is called', function (complete) { 345 + ajax({ 346 + url: '/tests/fixtures/fixtures.js' 347 + , complete: function () { 348 + ok(true, 'called complete') 349 + complete() 350 + } 351 + }) 352 + }) 353 + 354 + test('invalid JSON sets error on resp object', function (complete) { 355 + ajax({ 356 + url: '/tests/fixtures/invalidJSON.json' 357 + , type: 'json' 358 + , success: function () { 359 + ok(false, 'success callback fired') 360 + complete() 361 + } 362 + , error: function (resp, msg) { 363 + ok( 364 + msg == 'Could not parse JSON in response' 365 + , 'error callback fired' 366 + ) 367 + complete() 368 + } 369 + }) 370 + }) 371 + 372 + test('multiple parallel named JSONP callbacks', 8, function () { 373 + ajax({ 374 + url: '/tests/fixtures/fixtures_jsonp_multi.jsonp?callback=reqwest_0' 375 + , type: 'jsonp' 376 + , success: function (resp) { 377 + ok(resp, 'received response from call #1') 378 + ok( 379 + resp && resp.a == 'a' 380 + , 'evaluated response from call #1 as JSONP' 381 + ) 382 + } 383 + }) 384 + ajax({ 385 + url: '/tests/fixtures/fixtures_jsonp_multi_b.jsonp?callback=reqwest_0' 386 + , type: 'jsonp' 387 + , success: function (resp) { 388 + ok(resp, 'received response from call #2') 389 + ok( 390 + resp && resp.b == 'b' 391 + , 'evaluated response from call #2 as JSONP' 392 + ) 393 + } 394 + }) 395 + ajax({ 396 + url: '/tests/fixtures/fixtures_jsonp_multi_c.jsonp?callback=reqwest_0' 397 + , type: 'jsonp' 398 + , success: function (resp) { 399 + ok(resp, 'received response from call #2') 400 + ok( 401 + resp && resp.c == 'c' 402 + , 'evaluated response from call #3 as JSONP' 403 + ) 404 + } 405 + }) 406 + ajax({ 407 + url: '/tests/fixtures/fixtures_jsonp_multi.jsonp?callback=reqwest_0' 408 + , type: 'jsonp' 409 + , success: function (resp) { 410 + ok(resp, 'received response from call #2') 411 + ok( 412 + resp && resp.a == 'a' 413 + , 'evaluated response from call #4 as JSONP' 414 + ) 415 + } 416 + }) 417 + }) 418 + 419 + test('JSONP also supports success promises', function (complete) { 420 + ajax({ 421 + url: '/tests/none.jsonp?echo' 422 + , type: 'jsonp' 423 + , success: function (resp) { 424 + ok(resp, 'received response in constructor success callback') 425 + } 426 + }) 427 + .then(function (resp) { 428 + ok(resp, 'received response in promise success callback') 429 + return resp; 430 + }) 431 + .then(function (resp) { 432 + ok(resp, 'received response in second promise success callback') 433 + complete() 434 + }) 435 + }) 436 + 437 + test('JSONP also supports error promises', function (complete) { 438 + ajax({ 439 + url: '/tests/timeout/' 440 + , type: 'jsonp' 441 + , error: function (err) { 442 + ok(err, 'received error response in constructor error callback') 443 + } 444 + }) 445 + .fail(function (err) { 446 + ok(err, 'received error response in promise error callback') 447 + }) 448 + .fail(function (err) { 449 + ok(err, 'received error response in second promise error callback') 450 + complete() 451 + }) 452 + .abort() 453 + }) 454 + 455 + }) 456 + 457 + if (window.XMLHttpRequest 458 + && ('withCredentials' in new window.XMLHttpRequest())) { 459 + 460 + sink('Cross-origin Resource Sharing', function (test, ok) { 461 + test('make request to another origin', 1, function () { 462 + ajax({ 463 + url: 'http://' + window.location.hostname + ':5678/get-value' 464 + , type: 'text' 465 + , method: 'get' 466 + , crossOrigin: true 467 + , complete: function (resp) { 468 + ok(resp.responseText === 'hello', 'request made successfully') 469 + } 470 + }) 471 + }) 472 + 473 + test('set cookie on other origin', 2, function () { 474 + ajax({ 475 + url: 'http://' + window.location.hostname + ':5678/set-cookie' 476 + , type: 'text' 477 + , method: 'get' 478 + , crossOrigin: true 479 + , withCredentials: true 480 + , before: function (http) { 481 + ok( 482 + http.withCredentials === true 483 + , 'has set withCredentials on connection object' 484 + ) 485 + } 486 + , complete: function (resp) { 487 + ok(resp.status === 200, 'cookie set successfully') 488 + } 489 + }) 490 + }) 491 + 492 + test('get cookie from other origin', 1, function () { 493 + ajax({ 494 + url: 'http://' 495 + + window.location.hostname 496 + + ':5678/get-cookie-value' 497 + , type: 'text' 498 + , method: 'get' 499 + , crossOrigin: true 500 + , withCredentials: true 501 + , complete: function (resp) { 502 + ok( 503 + resp.responseText == 'hello' 504 + , 'cookie value retrieved successfully' 505 + ) 506 + } 507 + }) 508 + }) 509 + 510 + }) 511 + } 512 + 513 + sink('Connection Object', function (test, ok) { 514 + 515 + test('use xhr factory provided in the options', function (complete) { 516 + var reqwest 517 + , xhr 518 + 519 + if (typeof XMLHttpRequest !== 'undefined') { 520 + xhr = new XMLHttpRequest() 521 + } else if (typeof ActiveXObject !== 'undefined') { 522 + xhr = new ActiveXObject('Microsoft.XMLHTTP') 523 + } else { 524 + ok(false, 'browser not supported') 525 + } 526 + 527 + reqwest = ajax({ 528 + url: '/tests/fixtures/fixtures.html', 529 + xhr: function () { 530 + return xhr 531 + } 532 + }) 533 + 534 + ok(reqwest.request === xhr, 'uses factory') 535 + complete() 536 + }) 537 + 538 + test('fallbacks to own xhr factory if falsy is returned', function (complete) { 539 + var reqwest 540 + 541 + FakeXHR.setup() 542 + try { 543 + reqwest = ajax({ 544 + url: '/tests/fixtures/fixtures.html', 545 + xhr: function () { 546 + return null 547 + } 548 + }) 549 + 550 + ok(reqwest.request instanceof FakeXHR, 'fallbacks correctly') 551 + complete() 552 + } finally { 553 + FakeXHR.restore() 554 + } 555 + }) 556 + 557 + test('setRequestHeaders', function (complete) { 558 + ajax({ 559 + url: '/tests/fixtures/fixtures.html' 560 + , data: 'foo=bar&baz=thunk' 561 + , method: 'post' 562 + , headers: { 563 + 'Accept': 'application/x-foo' 564 + } 565 + , success: function () { 566 + ok(true, 'can post headers') 567 + complete() 568 + } 569 + }) 570 + }) 571 + 572 + test('can inspect http before send', function (complete) { 573 + var connection = ajax({ 574 + url: '/tests/fixtures/fixtures.js' 575 + , method: 'post' 576 + , type: 'js' 577 + , before: function (http) { 578 + ok(http.readyState == 1, 'received http connection object') 579 + } 580 + , success: function () { 581 + // Microsoft.XMLHTTP appears not to run this async in IE6&7, it 582 + // processes the request and triggers success() before ajax() even 583 + // returns. Perhaps a better solution would be to defer the calls 584 + // within handleReadyState() 585 + setTimeout(function () { 586 + ok( 587 + connection.request.readyState == 4 588 + , 'success callback has readyState of 4' 589 + ) 590 + complete() 591 + }, 0) 592 + } 593 + }) 594 + }) 595 + 596 + test('ajax() encodes array `data`', function (complete) { 597 + FakeXHR.setup() 598 + try { 599 + ajax({ 600 + url: '/tests/fixtures/fixtures.html' 601 + , method: 'post' 602 + , data: [ 603 + { name: 'foo', value: 'bar' } 604 + , { name: 'baz', value: 'thunk' } 605 + ] 606 + }) 607 + ok(FakeXHR.last.methodCallCount('send') == 1, 'send called') 608 + ok( 609 + FakeXHR.last.methodCallArgs('send', 0).length == 1 610 + , 'send called with 1 arg' 611 + ) 612 + ok( 613 + FakeXHR.last.methodCallArgs('send', 0, 0) == 'foo=bar&baz=thunk' 614 + , 'send called with encoded array' 615 + ) 616 + complete() 617 + } finally { 618 + FakeXHR.restore() 619 + } 620 + }) 621 + 622 + test('ajax() encodes hash `data`', function (complete) { 623 + FakeXHR.setup() 624 + try { 625 + ajax({ 626 + url: '/tests/fixtures/fixtures.html' 627 + , method: 'post' 628 + , data: { bar: 'foo', thunk: 'baz' } 629 + }) 630 + ok(FakeXHR.last.methodCallCount('send') == 1, 'send called') 631 + ok( 632 + FakeXHR.last.methodCallArgs('send', 0).length == 1 633 + , 'send called with 1 arg' 634 + ) 635 + ok( 636 + FakeXHR.last.methodCallArgs('send', 0, 0) == 'bar=foo&thunk=baz' 637 + , 'send called with encoded array' 638 + ) 639 + complete() 640 + } finally { 641 + FakeXHR.restore() 642 + } 643 + }) 644 + 645 + test('ajax() obeys `processData`', function (complete) { 646 + FakeXHR.setup() 647 + try { 648 + var d = { bar: 'foo', thunk: 'baz' } 649 + ajax({ 650 + url: '/tests/fixtures/fixtures.html' 651 + , processData: false 652 + , method: 'post' 653 + , data: d 654 + }) 655 + ok(FakeXHR.last.methodCallCount('send') == 1, 'send called') 656 + ok( 657 + FakeXHR.last.methodCallArgs('send', 0).length == 1 658 + , 'send called with 1 arg' 659 + ) 660 + ok( 661 + FakeXHR.last.methodCallArgs('send', 0, 0) === d 662 + , 'send called with exact `data` object' 663 + ) 664 + complete() 665 + } finally { 666 + FakeXHR.restore() 667 + } 668 + }) 669 + 670 + function testXhrGetUrlAdjustment(url, data, expectedUrl, complete) { 671 + FakeXHR.setup() 672 + try { 673 + ajax({ url: url, data: data }) 674 + ok(FakeXHR.last.methodCallCount('open') == 1, 'open called') 675 + ok( 676 + FakeXHR.last.methodCallArgs('open', 0).length == 3 677 + , 'open called with 3 args' 678 + ) 679 + ok( 680 + FakeXHR.last.methodCallArgs('open', 0, 0) == 'GET' 681 + , 'first arg of open() is "GET"' 682 + ) 683 + ok(FakeXHR.last.methodCallArgs('open', 0, 1) == expectedUrl 684 + , 'second arg of open() is URL with query string') 685 + ok( 686 + FakeXHR.last.methodCallArgs('open', 0, 2) === true 687 + , 'third arg of open() is `true`' 688 + ) 689 + ok(FakeXHR.last.methodCallCount('send') == 1, 'send called') 690 + ok( 691 + FakeXHR.last.methodCallArgs('send', 0).length == 1 692 + , 'send called with 1 arg' 693 + ) 694 + ok( 695 + FakeXHR.last.methodCallArgs('send', 0, 0) === null 696 + , 'send called with null' 697 + ) 698 + complete() 699 + } finally { 700 + FakeXHR.restore() 701 + } 702 + } 703 + 704 + test('ajax() appends GET URL with ?`data`', function (complete) { 705 + testXhrGetUrlAdjustment( 706 + '/tests/fixtures/fixtures.html' 707 + , 'bar=foo&thunk=baz' 708 + , '/tests/fixtures/fixtures.html?bar=foo&thunk=baz' 709 + , complete 710 + ) 711 + }) 712 + 713 + test('ajax() appends GET URL with ?`data` (serialized object)' 714 + , function (complete) { 715 + 716 + testXhrGetUrlAdjustment( 717 + '/tests/fixtures/fixtures.html' 718 + , { bar: 'foo', thunk: 'baz' } 719 + , '/tests/fixtures/fixtures.html?bar=foo&thunk=baz' 720 + , complete 721 + ) 722 + }) 723 + 724 + test('ajax() appends GET URL with &`data` (serialized array)' 725 + , function (complete) { 726 + 727 + testXhrGetUrlAdjustment( 728 + '/tests/fixtures/fixtures.html?x=y' 729 + , [ { name: 'bar', value: 'foo'}, {name: 'thunk', value: 'baz' } ] 730 + , '/tests/fixtures/fixtures.html?x=y&bar=foo&thunk=baz' 731 + , complete 732 + ) 733 + }) 734 + }) 735 + 736 + sink('Standard vs compat mode', function (test, ok) { 737 + function methodMatch(resp, method) { 738 + return resp && resp.method === method 739 + } 740 + function headerMatch(resp, key, expected) { 741 + return resp && resp.headers && resp.headers[key] === expected 742 + } 743 + function queryMatch(resp, key, expected) { 744 + return resp && resp.query && resp.query[key] === expected 745 + } 746 + 747 + test('standard mode default', function (complete) { 748 + ajax({ 749 + url: '/tests/none.json?echo' 750 + , success: function (resp) { 751 + ok(methodMatch(resp, 'GET'), 'correct request method (GET)') 752 + ok( 753 + headerMatch( 754 + resp 755 + , 'content-type' 756 + , 'application/x-www-form-urlencoded' 757 + ) 758 + , 'correct Content-Type request header' 759 + ) 760 + ok( 761 + headerMatch(resp, 'x-requested-with', 'XMLHttpRequest') 762 + , 'correct X-Requested-With header' 763 + ) 764 + ok( 765 + headerMatch( 766 + resp 767 + , 'accept' 768 + , 'text/javascript, text/html, application/xml, text/xml, */*' 769 + ) 770 + , 'correct Accept header' 771 + ) 772 + complete() 773 + } 774 + }) 775 + }) 776 + 777 + test('standard mode custom content-type', function (complete) { 778 + ajax({ 779 + url: '/tests/none.json?echo' 780 + , contentType: 'yapplication/foobar' 781 + , success: function (resp) { 782 + ok(methodMatch(resp, 'GET'), 'correct request method (GET)') 783 + ok( 784 + headerMatch(resp, 'content-type', 'yapplication/foobar') 785 + , 'correct Content-Type request header' 786 + ) 787 + ok( 788 + headerMatch(resp, 'x-requested-with', 'XMLHttpRequest') 789 + , 'correct X-Requested-With header' 790 + ) 791 + ok( 792 + headerMatch( 793 + resp 794 + , 'accept' 795 + , 'text/javascript, text/html, application/xml, text/xml, */*' 796 + ) 797 + , 'correct Accept header' 798 + ) 799 + complete() 800 + } 801 + }) 802 + }) 803 + 804 + test('standard mode on no content-type', function (complete) { 805 + ajax({ 806 + url: '/tests/204' 807 + , success: function (resp) { 808 + ok(true, 'Nothing blew up.') 809 + } 810 + }) 811 + }) 812 + 813 + test('compat mode "dataType=json" headers', function (complete) { 814 + ajax.compat({ 815 + url: '/tests/none.json?echo' 816 + , dataType: 'json' // should map to 'type' 817 + , success: function (resp) { 818 + ok(methodMatch(resp, 'GET'), 'correct request method (GET)') 819 + ok( 820 + headerMatch( 821 + resp 822 + , 'content-type' 823 + , 'application/x-www-form-urlencoded' 824 + ) 825 + , 'correct Content-Type request header' 826 + ) 827 + ok( 828 + headerMatch(resp, 'x-requested-with', 'XMLHttpRequest') 829 + , 'correct X-Requested-With header' 830 + ) 831 + ok( 832 + headerMatch(resp, 'accept', 'application/json, text/javascript') 833 + , 'correct Accept header' 834 + ) 835 + complete() 836 + } 837 + }) 838 + }) 839 + 840 + test('compat mode "dataType=json" with "type=post" headers' 841 + , function (complete) { 842 + ajax.compat({ 843 + url: '/tests/none.json?echo' 844 + , type: 'post' 845 + , dataType: 'json' // should map to 'type' 846 + , success: function (resp) { 847 + ok(methodMatch(resp, 'POST'), 'correct request method (POST)') 848 + ok( 849 + headerMatch( 850 + resp 851 + , 'content-type' 852 + , 'application/x-www-form-urlencoded' 853 + ) 854 + , 'correct Content-Type request header' 855 + ) 856 + ok( 857 + headerMatch(resp, 'x-requested-with', 'XMLHttpRequest') 858 + , 'correct X-Requested-With header' 859 + ) 860 + ok( 861 + headerMatch(resp, 'accept', 'application/json, text/javascript') 862 + , 'correct Accept header' 863 + ) 864 + complete() 865 + } 866 + }) 867 + }) 868 + 869 + test('compat mode "dataType=json" headers (with additional headers)' 870 + , function (complete) { 871 + 872 + ajax.compat({ 873 + url: '/tests/none.json?echo' 874 + , dataType: 'json' // should map to 'type' 875 + // verify that these are left intact and nothing screwy 876 + // happens with headers 877 + , headers: { one: 1, two: 2 } 878 + , success: function (resp) { 879 + ok( 880 + headerMatch( 881 + resp 882 + , 'content-type' 883 + , 'application/x-www-form-urlencoded' 884 + ) 885 + , 'correct Content-Type request header' 886 + ) 887 + ok( 888 + headerMatch(resp, 'x-requested-with', 'XMLHttpRequest') 889 + , 'correct X-Requested-With header' 890 + ) 891 + ok( 892 + headerMatch(resp, 'accept', 'application/json, text/javascript') 893 + , 'correct Accept header' 894 + ) 895 + ok( 896 + headerMatch(resp, 'one', '1') && headerMatch(resp, 'two', '2') 897 + , 'left additional headers intact' 898 + ) 899 + complete() 900 + } 901 + }) 902 + }) 903 + 904 + test('compat mode "dataType=jsonp" query string', function (complete) { 905 + ajax.compat({ 906 + url: '/tests/none.jsonp?echo' 907 + , dataType: 'jsonp' 908 + , jsonp: 'testCallback' // should map to jsonpCallback 909 + , jsonpCallback: 'foobar' // should map to jsonpCallbackName 910 + , success: function (resp) { 911 + ok( 912 + queryMatch(resp, 'echo', '') 913 + , 'correct Content-Type request header' 914 + ) 915 + ok( 916 + queryMatch(resp, 'testCallback', 'foobar') 917 + , 'correct X-Requested-With header' 918 + ) 919 + complete() 920 + } 921 + }) 922 + }) 923 + }) 924 + 925 + /***************** SERIALIZER TESTS ***********************/ 926 + 927 + // define some helpers for the serializer tests that are used often and 928 + // shared with the ender integration tests 929 + 930 + function createSerializeHelper(ok) { 931 + var forms = document.forms 932 + , foo = forms[0].getElementsByTagName('input')[1] 933 + , bar = forms[0].getElementsByTagName('input')[2] 934 + , choices = forms[0].getElementsByTagName('select')[0] 935 + , BIND_ARGS = 'bind' 936 + , PASS_ARGS = 'pass' 937 + 938 + function reset() { 939 + forms[1].reset() 940 + } 941 + 942 + function formElements(formIndex, tagName, elementIndex) { 943 + return forms[formIndex].getElementsByTagName(tagName)[elementIndex] 944 + } 945 + 946 + function isArray(a) { 947 + return Object.prototype.toString.call(a) == '[object Array]' 948 + } 949 + 950 + function sameValue(value, expected) { 951 + if (expected == null) { 952 + return value === null 953 + } else if (isArray(expected)) { 954 + if (value.length !== expected.length) return false 955 + for (var i = 0; i < expected.length; i++) { 956 + if (value[i] != expected[i]) return false 957 + } 958 + return true 959 + } else return value == expected 960 + } 961 + 962 + function testInput(input, name, value, str) { 963 + var sa = ajax.serialize(input, { type: 'array' }) 964 + , sh = ajax.serialize(input, { type: 'map' }) 965 + , av, i 966 + 967 + if (value != null) { 968 + av = isArray(value) ? value : [ value ] 969 + 970 + ok( 971 + sa.length == av.length 972 + , 'serialize(' + str + ', {type:\'array\'}) returns array ' 973 + + '[{name,value}]' 974 + ) 975 + 976 + for (i = 0; i < av.length; i++) { 977 + ok( 978 + name == sa[i].name 979 + , 'serialize(' + str + ', {type:\'array\'})[' + i + '].name' 980 + ) 981 + ok( 982 + av[i] == sa[i].value 983 + , 'serialize(' + str + ', {type:\'array\'})[' + i + '].value' 984 + ) 985 + } 986 + 987 + ok(sameValue(sh[name], value), 'serialize(' + str + ', {type:\'map\'})') 988 + } else { 989 + // the cases where an element shouldn't show up at all, checkbox not 990 + // checked for example 991 + ok(sa.length === 0, 'serialize(' + str + ', {type:\'array\'}) is []') 992 + ok( 993 + v.keys(sh).length === 0 994 + , 'serialize(' + str + ', {type:\'map\'}) is {}' 995 + ) 996 + } 997 + } 998 + 999 + function testFormSerialize(method, type) { 1000 + var expected = 1001 + 'foo=bar&bar=baz&wha=1&wha=3&who=tawoo&%24escapable+name' 1002 + + '%24=escapeme&choices=two&opinions=world+peace+is+not+real' 1003 + 1004 + ok(method, 'serialize() bound to context') 1005 + ok( 1006 + (method ? method(forms[0]) : null) == expected 1007 + , 'serialized form (' + type + ')' 1008 + ) 1009 + } 1010 + 1011 + function executeMultiArgumentMethod(method, argType, options) { 1012 + var els = [ foo, bar, choices ] 1013 + , ths = argType === BIND_ARGS ? ender(els) : null 1014 + , args = argType === PASS_ARGS ? els : [] 1015 + 1016 + if (!!options) args.push(options) 1017 + 1018 + return method.apply(ths, args) 1019 + } 1020 + 1021 + function testMultiArgumentSerialize(method, type, argType) { 1022 + ok(method, 'serialize() bound in context') 1023 + var result = method ? executeMultiArgumentMethod(method, argType) : null 1024 + ok( 1025 + result == 'foo=bar&bar=baz&choices=two' 1026 + , 'serialized all 3 arguments together' 1027 + ) 1028 + } 1029 + 1030 + function verifyFormSerializeArray(result, type) { 1031 + var expected = [ 1032 + { name: 'foo', value: 'bar' } 1033 + , { name: 'bar', value: 'baz' } 1034 + , { name: 'wha', value: 1 } 1035 + , { name: 'wha', value: 3 } 1036 + , { name: 'who', value: 'tawoo' } 1037 + , { name: '$escapable name$', value: 'escapeme' } 1038 + , { name: 'choices', value: 'two' } 1039 + , { name: 'opinions', value: 'world peace is not real' } 1040 + ] 1041 + , i 1042 + 1043 + for (i = 0; i < expected.length; i++) { 1044 + ok(v.some(result, function (v) { 1045 + return v.name == expected[i].name && v.value == expected[i].value 1046 + }), 'serialized ' + expected[i].name + ' (' + type + ')') 1047 + } 1048 + } 1049 + 1050 + function testFormSerializeArray(method, type) { 1051 + ok(method, 'serialize(..., {type:\'array\'}) bound to context') 1052 + 1053 + var result = method ? method(forms[0], { type: 'array' }) : [] 1054 + if (!result) result = [] 1055 + 1056 + verifyFormSerializeArray(result, type) 1057 + } 1058 + 1059 + function testMultiArgumentSerializeArray(method, type, argType) { 1060 + ok(method, 'serialize(..., {type:\'array\'}) bound to context') 1061 + var result = method 1062 + ? executeMultiArgumentMethod(method, argType, { type: 'array' }) 1063 + : [] 1064 + 1065 + if (!result) result = [] 1066 + 1067 + ok(result.length == 3, 'serialized as array of 3') 1068 + ok( 1069 + result.length == 3 1070 + && result[0].name == 'foo' 1071 + && result[0].value == 'bar' 1072 + , 'serialized first element (' + type + ')' 1073 + ) 1074 + ok( 1075 + result.length == 3 1076 + && result[1].name == 'bar' 1077 + && result[1].value == 'baz' 1078 + , 'serialized second element (' + type + ')' 1079 + ) 1080 + ok( 1081 + result.length == 3 1082 + && result[2].name == 'choices' 1083 + && result[2].value == 'two' 1084 + , 'serialized third element (' + type + ')' 1085 + ) 1086 + } 1087 + 1088 + function testFormSerializeHash(method, type) { 1089 + var expected = { 1090 + foo: 'bar' 1091 + , bar: 'baz' 1092 + , wha: [ '1', '3' ] 1093 + , who: 'tawoo' 1094 + , '$escapable name$': 'escapeme' 1095 + , choices: 'two' 1096 + , opinions: 'world peace is not real' 1097 + } 1098 + , result 1099 + 1100 + ok(method, 'serialize({type:\'map\'}) bound to context') 1101 + 1102 + result = method ? method(forms[0], { type: 'map' }) : {} 1103 + if (!result) result = {} 1104 + 1105 + ok( 1106 + v.keys(expected).length === v.keys(result).length 1107 + , 'same number of keys (' + type + ')' 1108 + ) 1109 + 1110 + v.each(v.keys(expected), function (k) { 1111 + ok( 1112 + sameValue(expected[k], result[k]) 1113 + , 'same value for ' + k + ' (' + type + ')' 1114 + ) 1115 + }) 1116 + } 1117 + 1118 + function testMultiArgumentSerializeHash(method, type, argType) { 1119 + ok(method, 'serialize({type:\'map\'}) bound to context') 1120 + var result = method 1121 + ? executeMultiArgumentMethod(method, argType, { type: 'map' }) 1122 + : {} 1123 + if (!result) result = {} 1124 + ok(result.foo == 'bar', 'serialized first element (' + type + ')') 1125 + ok(result.bar == 'baz', 'serialized second element (' + type + ')') 1126 + ok(result.choices == 'two', 'serialized third element (' + type + ')') 1127 + } 1128 + 1129 + return { 1130 + reset: reset 1131 + , formElements: formElements 1132 + , testInput: testInput 1133 + , testFormSerialize: testFormSerialize 1134 + , testMultiArgumentSerialize: testMultiArgumentSerialize 1135 + , testFormSerializeArray: testFormSerializeArray 1136 + , verifyFormSerializeArray: verifyFormSerializeArray 1137 + , testMultiArgumentSerializeArray: testMultiArgumentSerializeArray 1138 + , testFormSerializeHash: testFormSerializeHash 1139 + , testMultiArgumentSerializeHash: testMultiArgumentSerializeHash 1140 + } 1141 + } 1142 + 1143 + sink('Serializing', function (test, ok) { 1144 + 1145 + /* 1146 + * Serialize forms according to spec. 1147 + * * reqwest.serialize(ele[, ele...]) returns a query string style 1148 + * serialization 1149 + * * reqwest.serialize(ele[, ele...], {type:'array'}) returns a 1150 + * [ { name: 'name', value: 'value'}, ... ] style serialization, 1151 + * compatible with jQuery.serializeArray() 1152 + * * reqwest.serialize(ele[, ele...], {type:\'map\'}) returns a 1153 + * { 'name': 'value', ... } style serialization, compatible with 1154 + * Prototype Form.serializeElements({hash:true}) 1155 + * Some tests based on spec notes here: 1156 + * http://malsup.com/jquery/form/comp/test.html 1157 + */ 1158 + 1159 + var sHelper = createSerializeHelper(ok) 1160 + sHelper.reset() 1161 + 1162 + test('correctly serialize textarea', function (complete) { 1163 + var textarea = sHelper.formElements(1, 'textarea', 0) 1164 + , sa 1165 + 1166 + // the texarea has 2 different newline styles, should come out as 1167 + // normalized CRLF as per forms spec 1168 + ok( 1169 + 'T3=%3F%0D%0AA+B%0D%0AZ' == ajax.serialize(textarea) 1170 + , 'serialize(textarea)' 1171 + ) 1172 + sa = ajax.serialize(textarea, { type: 'array' }) 1173 + ok(sa.length == 1, 'serialize(textarea, {type:\'array\'}) returns array') 1174 + sa = sa[0] 1175 + ok('T3' == sa.name, 'serialize(textarea, {type:\'array\'}).name') 1176 + ok( 1177 + '?\r\nA B\r\nZ' == sa.value 1178 + , 'serialize(textarea, {type:\'array\'}).value' 1179 + ) 1180 + ok( 1181 + '?\r\nA B\r\nZ' == ajax.serialize(textarea, { type: 'map' }).T3 1182 + , 'serialize(textarea, {type:\'map\'})' 1183 + ) 1184 + complete() 1185 + }) 1186 + 1187 + test('correctly serialize input[type=hidden]', function (complete) { 1188 + sHelper.testInput( 1189 + sHelper.formElements(1, 'input', 0) 1190 + , 'H1' 1191 + , 'x' 1192 + , 'hidden' 1193 + ) 1194 + sHelper.testInput( 1195 + sHelper.formElements(1, 'input', 1) 1196 + , 'H2' 1197 + , '' 1198 + , 'hidden[no value]' 1199 + ) 1200 + complete() 1201 + }) 1202 + 1203 + test('correctly serialize input[type=password]', function (complete) { 1204 + sHelper.testInput( 1205 + sHelper.formElements(1, 'input', 2) 1206 + , 'PWD1' 1207 + , 'xyz' 1208 + , 'password' 1209 + ) 1210 + sHelper.testInput( 1211 + sHelper.formElements(1, 'input', 3) 1212 + , 'PWD2' 1213 + , '' 1214 + , 'password[no value]' 1215 + ) 1216 + complete() 1217 + }) 1218 + 1219 + test('correctly serialize input[type=text]', function (complete) { 1220 + sHelper.testInput( 1221 + sHelper.formElements(1, 'input', 4) 1222 + , 'T1' 1223 + , '' 1224 + , 'text[no value]' 1225 + ) 1226 + sHelper.testInput( 1227 + sHelper.formElements(1, 'input', 5) 1228 + , 'T2' 1229 + , 'YES' 1230 + , 'text[readonly]' 1231 + ) 1232 + sHelper.testInput( 1233 + sHelper.formElements(1, 'input', 10) 1234 + , 'My Name' 1235 + , 'me' 1236 + , 'text[space name]' 1237 + ) 1238 + complete() 1239 + }) 1240 + 1241 + test('correctly serialize input[type=checkbox]', function (complete) { 1242 + var cb1 = sHelper.formElements(1, 'input', 6) 1243 + , cb2 = sHelper.formElements(1, 'input', 7) 1244 + sHelper.testInput(cb1, 'C1', null, 'checkbox[not checked]') 1245 + cb1.checked = true 1246 + sHelper.testInput(cb1, 'C1', '1', 'checkbox[checked]') 1247 + // special case here, checkbox with no value='' should give you 'on' 1248 + // for cb.value 1249 + sHelper.testInput(cb2, 'C2', null, 'checkbox[no value, not checked]') 1250 + cb2.checked = true 1251 + sHelper.testInput(cb2, 'C2', 'on', 'checkbox[no value, checked]') 1252 + complete() 1253 + }) 1254 + 1255 + test('correctly serialize input[type=radio]', function (complete) { 1256 + var r1 = sHelper.formElements(1, 'input', 8) 1257 + , r2 = sHelper.formElements(1, 'input', 9) 1258 + sHelper.testInput(r1, 'R1', null, 'radio[not checked]') 1259 + r1.checked = true 1260 + sHelper.testInput(r1, 'R1', '1', 'radio[not checked]') 1261 + sHelper.testInput(r2, 'R1', null, 'radio[no value, not checked]') 1262 + r2.checked = true 1263 + sHelper.testInput(r2, 'R1', '', 'radio[no value, checked]') 1264 + complete() 1265 + }) 1266 + 1267 + test('correctly serialize input[type=reset]', function (complete) { 1268 + sHelper.testInput( 1269 + sHelper.formElements(1, 'input', 11) 1270 + , 'rst' 1271 + , null 1272 + , 'reset' 1273 + ) 1274 + complete() 1275 + }) 1276 + 1277 + test('correctly serialize input[type=file]', function (complete) { 1278 + sHelper.testInput( 1279 + sHelper.formElements(1, 'input', 12) 1280 + , 'file' 1281 + , null 1282 + , 'file' 1283 + ) 1284 + complete() 1285 + }) 1286 + 1287 + test('correctly serialize input[type=submit]', function (complete) { 1288 + // we're only supposed to serialize a submit button if it was clicked to 1289 + // perform this serialization: 1290 + // http://www.w3.org/TR/html401/interact/forms.html#h-17.13.2 1291 + // but we'll pretend to be oblivious to this part of the spec... 1292 + sHelper.testInput( 1293 + sHelper.formElements(1, 'input', 13) 1294 + , 'sub' 1295 + , 'NO' 1296 + , 'submit' 1297 + ) 1298 + complete() 1299 + }) 1300 + 1301 + test('correctly serialize select with no options', function (complete) { 1302 + var select = sHelper.formElements(1, 'select', 0) 1303 + sHelper.testInput(select, 'S1', null, 'select, no options') 1304 + complete() 1305 + }) 1306 + 1307 + test('correctly serialize select with values', function (complete) { 1308 + var select = sHelper.formElements(1, 'select', 1) 1309 + sHelper.testInput(select, 'S2', 'abc', 'select option 1 (default)') 1310 + select.selectedIndex = 1 1311 + sHelper.testInput(select, 'S2', 'def', 'select option 2') 1312 + select.selectedIndex = 6 1313 + sHelper.testInput(select, 'S2', 'disco stu', 'select option 7') 1314 + // a special case where we have <option value=''>X</option>, should 1315 + // return '' rather than X which will happen if you just do a simple 1316 + // `value=(option.value||option.text)` 1317 + select.selectedIndex = 9 1318 + sHelper.testInput( 1319 + select 1320 + , 'S2' 1321 + , '' 1322 + , 'select option 9, value="" should yield ""' 1323 + ) 1324 + select.selectedIndex = -1 1325 + sHelper.testInput(select, 'S2', null, 'select, unselected') 1326 + complete() 1327 + }) 1328 + 1329 + test('correctly serialize select without explicit values' 1330 + , function (complete) { 1331 + 1332 + var select = sHelper.formElements(1, 'select', 2) 1333 + sHelper.testInput(select, 'S3', 'ABC', 'select option 1 (default)') 1334 + select.selectedIndex = 1 1335 + sHelper.testInput(select, 'S3', 'DEF', 'select option 2') 1336 + select.selectedIndex = 6 1337 + sHelper.testInput(select, 'S3', 'DISCO STU!', 'select option 7') 1338 + select.selectedIndex = -1 1339 + sHelper.testInput(select, 'S3', null, 'select, unselected') 1340 + complete() 1341 + }) 1342 + 1343 + test('correctly serialize select multiple', function (complete) { 1344 + var select = sHelper.formElements(1, 'select', 3) 1345 + sHelper.testInput(select, 'S4', null, 'select, unselected (default)') 1346 + select.options[1].selected = true 1347 + sHelper.testInput(select, 'S4', '2', 'select option 2') 1348 + select.options[3].selected = true 1349 + sHelper.testInput(select, 'S4', [ '2', '4' ], 'select options 2 & 4') 1350 + select.options[8].selected = true 1351 + sHelper.testInput( 1352 + select 1353 + , 'S4' 1354 + , [ '2', '4', 'Disco Stu!' ] 1355 + , 'select option 2 & 4 & 9' 1356 + ) 1357 + select.options[3].selected = false 1358 + sHelper.testInput( 1359 + select 1360 + , 'S4' 1361 + , [ '2', 'Disco Stu!' ] 1362 + , 'select option 2 & 9' 1363 + ) 1364 + select.options[1].selected = false 1365 + select.options[8].selected = false 1366 + sHelper.testInput(select, 'S4', null, 'select, all unselected') 1367 + complete() 1368 + }) 1369 + 1370 + test('correctly serialize options', function (complete) { 1371 + var option = sHelper.formElements(1, 'select', 1).options[6] 1372 + sHelper.testInput( 1373 + option 1374 + , '-' 1375 + , null 1376 + , 'just option (with value), shouldn\'t serialize' 1377 + ) 1378 + 1379 + option = sHelper.formElements(1, 'select', 2).options[6] 1380 + sHelper.testInput( 1381 + option 1382 + , '-' 1383 + , null 1384 + , 'option (without value), shouldn\'t serialize' 1385 + ) 1386 + 1387 + complete() 1388 + }) 1389 + 1390 + test('correctly serialize disabled', function (complete) { 1391 + var input = sHelper.formElements(1, 'input', 14) 1392 + , select 1393 + 1394 + sHelper.testInput(input, 'D1', null, 'disabled text input') 1395 + input = sHelper.formElements(1, 'input', 15) 1396 + sHelper.testInput(input, 'D2', null, 'disabled checkbox') 1397 + input = sHelper.formElements(1, 'input', 16) 1398 + sHelper.testInput(input, 'D3', null, 'disabled radio') 1399 + 1400 + select = sHelper.formElements(1, 'select', 4) 1401 + sHelper.testInput(select, 'D4', null, 'disabled select') 1402 + select = sHelper.formElements(1, 'select', 3) 1403 + sHelper.testInput(select, 'D5', null, 'disabled select option') 1404 + select = sHelper.formElements(1, 'select', 6) 1405 + sHelper.testInput(select, 'D6', null, 'disabled multi select') 1406 + select = sHelper.formElements(1, 'select', 7) 1407 + sHelper.testInput(select, 'D7', null, 'disabled multi select option') 1408 + complete() 1409 + }) 1410 + 1411 + test('serialize(form)', function (complete) { 1412 + sHelper.testFormSerialize(ajax.serialize, 'direct') 1413 + complete() 1414 + }) 1415 + 1416 + test('serialize(form, {type:\'array\'})', function (complete) { 1417 + sHelper.testFormSerializeArray(ajax.serialize, 'direct') 1418 + complete() 1419 + }) 1420 + 1421 + test('serialize(form, {type:\'map\'})', function (complete) { 1422 + sHelper.testFormSerializeHash(ajax.serialize, 'direct') 1423 + complete() 1424 + }) 1425 + 1426 + // mainly for Ender integration, so you can do this: 1427 + // $('input[name=T2],input[name=who],input[name=wha]').serialize() 1428 + test('serialize(element, element, element...)', function (complete) { 1429 + sHelper.testMultiArgumentSerialize(ajax.serialize, 'direct', PASS_ARGS) 1430 + complete() 1431 + }) 1432 + 1433 + // mainly for Ender integration, so you can do this: 1434 + // $('input[name=T2],input[name=who],input[name=wha]') 1435 + // .serialize({type:'array'}) 1436 + test('serialize(element, element, element..., {type:\'array\'})' 1437 + , function (complete) { 1438 + sHelper.testMultiArgumentSerializeArray( 1439 + ajax.serialize 1440 + , 'direct' 1441 + , PASS_ARGS 1442 + ) 1443 + complete() 1444 + }) 1445 + 1446 + // mainly for Ender integration, so you can do this: 1447 + // $('input[name=T2],input[name=who],input[name=wha]') 1448 + // .serialize({type:'map'}) 1449 + test('serialize(element, element, element...)', function (complete) { 1450 + sHelper.testMultiArgumentSerializeHash( 1451 + ajax.serialize 1452 + , 'direct' 1453 + , PASS_ARGS 1454 + ) 1455 + complete() 1456 + }) 1457 + 1458 + test('toQueryString([{ name: x, value: y }, ... ]) name/value array' 1459 + , function (complete) { 1460 + 1461 + var arr = [ 1462 + { name: 'foo', value: 'bar' } 1463 + , { name: 'baz', value: '' } 1464 + , { name: 'x', value: -20 } 1465 + , { name: 'x', value: 20 } 1466 + ] 1467 + 1468 + ok(ajax.toQueryString(arr) == 'foo=bar&baz=&x=-20&x=20', 'simple') 1469 + 1470 + arr = [ 1471 + { name: 'dotted.name.intact', value: '$@%' } 1472 + , { name: '$ $', value: 20 } 1473 + , { name: 'leave britney alone', value: 'waa haa haa' } 1474 + ] 1475 + 1476 + ok( 1477 + ajax.toQueryString(arr) == 1478 + 'dotted.name.intact=%24%40%25&%24+%24=20' 1479 + + '&leave+britney+alone=waa+haa+haa' 1480 + , 'escaping required' 1481 + ) 1482 + 1483 + complete() 1484 + }) 1485 + 1486 + test('toQueryString({name: value,...} complex object', function (complete) { 1487 + var obj = { 'foo': 'bar', 'baz': '', 'x': -20 } 1488 + 1489 + ok(ajax.toQueryString(obj) == 'foo=bar&baz=&x=-20', 'simple') 1490 + 1491 + obj = { 1492 + 'dotted.name.intact': '$@%' 1493 + , '$ $': 20 1494 + , 'leave britney alone': 'waa haa haa' 1495 + } 1496 + ok( 1497 + ajax.toQueryString(obj) == 1498 + 'dotted.name.intact=%24%40%25&%24+%24=20' 1499 + + '&leave+britney+alone=waa+haa+haa' 1500 + , 'escaping required' 1501 + ) 1502 + 1503 + complete() 1504 + }) 1505 + 1506 + test('toQueryString({name: [ value1, value2 ...],...} object with arrays', function (complete) { 1507 + var obj = { 'foo': 'bar', 'baz': [ '', '', 'boo!' ], 'x': [ -20, 2.2, 20 ] } 1508 + ok(ajax.toQueryString(obj, true) == "foo=bar&baz=&baz=&baz=boo!&x=-20&x=2.2&x=20", "object with arrays") 1509 + ok(ajax.toQueryString(obj) == "foo=bar&baz%5B%5D=&baz%5B%5D=&baz%5B%5D=boo!&x%5B%5D=-20&x%5B%5D=2.2&x%5B%5D=20") 1510 + complete() 1511 + }) 1512 + 1513 + test('toQueryString({name: { nestedName: value },...} object with objects', function(complete) { 1514 + var obj = { 'foo': { 'bar': 'baz' }, 'x': [ { 'bar': 'baz' }, { 'boo': 'hiss' } ] } 1515 + ok(ajax.toQueryString(obj) == "foo%5Bbar%5D=baz&x%5B0%5D%5Bbar%5D=baz&x%5B1%5D%5Bboo%5D=hiss", "object with objects") 1516 + complete() 1517 + }) 1518 + 1519 + }) 1520 + 1521 + sink('Ender Integration', function (test, ok) { 1522 + var sHelper = createSerializeHelper(ok) 1523 + sHelper.reset() 1524 + 1525 + test('$.ajax alias for reqwest, not bound to boosh', 1, function () { 1526 + ok(ender.ajax === ajax, '$.ajax is reqwest') 1527 + }) 1528 + 1529 + // sHelper.test that you can do $.serialize(form) 1530 + test('$.serialize(form)', function (complete) { 1531 + sHelper.testFormSerialize(ender.serialize, 'ender') 1532 + complete() 1533 + }) 1534 + 1535 + // sHelper.test that you can do $.serialize(form) 1536 + test('$.serialize(form, {type:\'array\'})', function (complete) { 1537 + sHelper.testFormSerializeArray(ender.serialize, 'ender') 1538 + complete() 1539 + }) 1540 + 1541 + // sHelper.test that you can do $.serialize(form) 1542 + test('$.serialize(form, {type:\'map\'})', function (complete) { 1543 + sHelper.testFormSerializeHash(ender.serialize, 'ender') 1544 + complete() 1545 + }) 1546 + 1547 + // sHelper.test that you can do $.serializeObject(form) 1548 + test('$.serializeArray(...) alias for serialize(..., {type:\'map\'}' 1549 + , function (complete) { 1550 + sHelper.verifyFormSerializeArray( 1551 + ender.serializeArray(document.forms[0]) 1552 + , 'ender' 1553 + ) 1554 + complete() 1555 + }) 1556 + 1557 + test('$.serialize(element, element, element...)', function (complete) { 1558 + sHelper.testMultiArgumentSerialize(ender.serialize, 'ender', PASS_ARGS) 1559 + complete() 1560 + }) 1561 + 1562 + test('$.serialize(element, element, element..., {type:\'array\'})' 1563 + , function (complete) { 1564 + sHelper.testMultiArgumentSerializeArray( 1565 + ender.serialize 1566 + , 'ender' 1567 + , PASS_ARGS 1568 + ) 1569 + complete() 1570 + }) 1571 + 1572 + test('$.serialize(element, element, element..., {type:\'map\'})' 1573 + , function (complete) { 1574 + sHelper.testMultiArgumentSerializeHash( 1575 + ender.serialize 1576 + , 'ender' 1577 + , PASS_ARGS 1578 + ) 1579 + complete() 1580 + }) 1581 + 1582 + test('$(element, element, element...).serialize()', function (complete) { 1583 + sHelper.testMultiArgumentSerialize(ender.fn.serialize, 'ender', BIND_ARGS) 1584 + complete() 1585 + }) 1586 + 1587 + test('$(element, element, element...).serialize({type:\'array\'})' 1588 + , function (complete) { 1589 + sHelper.testMultiArgumentSerializeArray( 1590 + ender.fn.serialize 1591 + , 'ender' 1592 + , BIND_ARGS 1593 + ) 1594 + complete() 1595 + }) 1596 + 1597 + test('$(element, element, element...).serialize({type:\'map\'})' 1598 + , function (complete) { 1599 + sHelper.testMultiArgumentSerializeHash( 1600 + ender.fn.serialize 1601 + , 'ender' 1602 + , BIND_ARGS 1603 + ) 1604 + complete() 1605 + }) 1606 + 1607 + test('$.toQueryString alias for reqwest.toQueryString, not bound to boosh' 1608 + , function (complete) { 1609 + ok( 1610 + ender.toQueryString === ajax.toQueryString 1611 + , '$.toQueryString is reqwest.toQueryString' 1612 + ) 1613 + complete() 1614 + }) 1615 + }) 1616 + 1617 + 1618 + /** 1619 + * Promise tests for `then` `fail` and `always` 1620 + */ 1621 + sink('Promises', function (test, ok) { 1622 + 1623 + test('always callback is called', function (complete) { 1624 + ajax({ 1625 + url: '/tests/fixtures/fixtures.js' 1626 + }) 1627 + .always(function () { 1628 + ok(true, 'called complete') 1629 + complete() 1630 + }) 1631 + }) 1632 + 1633 + test('success and error handlers are called', 3, function () { 1634 + ajax({ 1635 + url: '/tests/fixtures/invalidJSON.json' 1636 + , type: 'json' 1637 + }) 1638 + .then( 1639 + function () { 1640 + ok(false, 'success callback fired') 1641 + } 1642 + , function (resp, msg) { 1643 + ok( 1644 + msg == 'Could not parse JSON in response' 1645 + , 'error callback fired' 1646 + ) 1647 + } 1648 + ) 1649 + 1650 + ajax({ 1651 + url: '/tests/fixtures/invalidJSON.json' 1652 + , type: 'json' 1653 + }) 1654 + .fail(function (resp, msg) { 1655 + ok(msg == 'Could not parse JSON in response', 'fail callback fired') 1656 + }) 1657 + 1658 + ajax({ 1659 + url: '/tests/fixtures/fixtures.json' 1660 + , type: 'json' 1661 + }) 1662 + .then( 1663 + function () { 1664 + ok(true, 'success callback fired') 1665 + } 1666 + , function () { 1667 + ok(false, 'error callback fired') 1668 + } 1669 + ) 1670 + }) 1671 + 1672 + test('then is chainable', 2, function () { 1673 + ajax({ 1674 + url: '/tests/fixtures/fixtures.json' 1675 + , type: 'json' 1676 + }) 1677 + .then( 1678 + function (resp) { 1679 + ok(true, 'first success callback fired') 1680 + return 'new value'; 1681 + } 1682 + ) 1683 + .then( 1684 + function (resp) { 1685 + ok(resp === 'new value', 'second success callback fired') 1686 + } 1687 + ) 1688 + }) 1689 + 1690 + test('success does not chain with then', 2, function () { 1691 + ajax({ 1692 + url: '/tests/fixtures/fixtures.json' 1693 + , type: 'json' 1694 + , success: function() { 1695 + ok(true, 'success callback fired') 1696 + return 'some independent value'; 1697 + } 1698 + }) 1699 + .then( 1700 + function (resp) { 1701 + ok( 1702 + resp && resp !== 'some independent value' 1703 + , 'then callback fired' 1704 + ) 1705 + } 1706 + ) 1707 + }) 1708 + 1709 + test('then & always handlers can be added after a response is received' 1710 + , 2 1711 + , function () { 1712 + 1713 + var a = ajax({ 1714 + url: '/tests/fixtures/fixtures.json' 1715 + , type: 'json' 1716 + }) 1717 + .always(function () { 1718 + setTimeout(function () { 1719 + a.then( 1720 + function () { 1721 + ok(true, 'success callback called') 1722 + } 1723 + , function () { 1724 + ok(false, 'error callback called') 1725 + } 1726 + ).always(function () { 1727 + ok(true, 'complete callback called') 1728 + }) 1729 + }, 1) 1730 + }) 1731 + }) 1732 + 1733 + test('then is chainable after a response is received' 1734 + , 2 1735 + , function () { 1736 + 1737 + var a = ajax({ 1738 + url: '/tests/fixtures/fixtures.json' 1739 + , type: 'json' 1740 + }) 1741 + .always(function () { 1742 + setTimeout(function () { 1743 + a.then(function () { 1744 + ok(true, 'first success callback called') 1745 + return 'new value'; 1746 + }).then(function (resp) { 1747 + ok(resp === 'new value', 'second success callback called') 1748 + }) 1749 + }, 1) 1750 + }) 1751 + }) 1752 + 1753 + test('failure handlers can be added after a response is received' 1754 + , function (complete) { 1755 + 1756 + var a = ajax({ 1757 + url: '/tests/fixtures/invalidJSON.json' 1758 + , type: 'json' 1759 + }) 1760 + .always(function () { 1761 + setTimeout(function () { 1762 + a 1763 + .fail(function () { 1764 + ok(true, 'fail callback called') 1765 + complete() 1766 + }) 1767 + }, 1) 1768 + }) 1769 + }) 1770 + 1771 + test('.then success and fail are optional parameters', 1, function () { 1772 + try { 1773 + ajax({ 1774 + url: '/tests/fixtures/invalidJSON.json' 1775 + , type: 'json' 1776 + }) 1777 + .then() 1778 + } catch (ex) { 1779 + ok(false, '.then() parameters should be optional') 1780 + } finally { 1781 + ok(true, 'passed .then() optional parameters') 1782 + } 1783 + }) 1784 + 1785 + }) 1786 + 1787 + 1788 + 1789 + sink('Timeout', function (test, ok) { 1790 + test('xmlHttpRequest', function (complete) { 1791 + var ts = +new Date() 1792 + ajax({ 1793 + url: '/tests/timeout' 1794 + , type: 'json' 1795 + , timeout: 250 1796 + , error: function (err, msg) { 1797 + ok(err, 'received error response') 1798 + try { 1799 + ok(err && err.status === 0, 'correctly caught timeout') 1800 + ok(msg && msg === 'Request is aborted: timeout', 'timeout message received') 1801 + } catch (e) { 1802 + ok(true, 'IE is a troll') 1803 + } 1804 + var tt = Math.abs(+new Date() - ts) 1805 + ok( 1806 + tt > 200 && tt < 300 1807 + , 'timeout close enough to 250 (' + tt + ')' 1808 + ) 1809 + complete() 1810 + } 1811 + }) 1812 + }) 1813 + 1814 + test('jsonpRequest', function (complete) { 1815 + var ts = +new Date() 1816 + ajax({ 1817 + url: '/tests/timeout' 1818 + , type: 'jsonp' 1819 + , timeout: 250 1820 + , error: function (err) { 1821 + ok(err, 'received error response') 1822 + var tt = Math.abs(+new Date() - ts) 1823 + ok( 1824 + tt > 200 && tt < 300 1825 + , 'timeout close enough to 250 (' + tt + ')' 1826 + ) 1827 + complete() 1828 + } 1829 + }) 1830 + }) 1831 + }) 1832 + 1833 + start() 1834 + 1835 +}(reqwest))
Added cmd/pisc-web-ide/webroot/static/js/vue-js/vue.js.
1 +/*! 2 + * Vue.js v2.2.0 3 + * (c) 2014-2017 Evan You 4 + * Released under the MIT License. 5 + */ 6 +(function (global, factory) { 7 + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : 8 + typeof define === 'function' && define.amd ? define(factory) : 9 + (global.Vue = factory()); 10 +}(this, (function () { 'use strict'; 11 + 12 +/* */ 13 + 14 +/** 15 + * Convert a value to a string that is actually rendered. 16 + */ 17 +function _toString (val) { 18 + return val == null 19 + ? '' 20 + : typeof val === 'object' 21 + ? JSON.stringify(val, null, 2) 22 + : String(val) 23 +} 24 + 25 +/** 26 + * Convert a input value to a number for persistence. 27 + * If the conversion fails, return original string. 28 + */ 29 +function toNumber (val) { 30 + var n = parseFloat(val); 31 + return isNaN(n) ? val : n 32 +} 33 + 34 +/** 35 + * Make a map and return a function for checking if a key 36 + * is in that map. 37 + */ 38 +function makeMap ( 39 + str, 40 + expectsLowerCase 41 +) { 42 + var map = Object.create(null); 43 + var list = str.split(','); 44 + for (var i = 0; i < list.length; i++) { 45 + map[list[i]] = true; 46 + } 47 + return expectsLowerCase 48 + ? function (val) { return map[val.toLowerCase()]; } 49 + : function (val) { return map[val]; } 50 +} 51 + 52 +/** 53 + * Check if a tag is a built-in tag. 54 + */ 55 +var isBuiltInTag = makeMap('slot,component', true); 56 + 57 +/** 58 + * Remove an item from an array 59 + */ 60 +function remove (arr, item) { 61 + if (arr.length) { 62 + var index = arr.indexOf(item); 63 + if (index > -1) { 64 + return arr.splice(index, 1) 65 + } 66 + } 67 +} 68 + 69 +/** 70 + * Check whether the object has the property. 71 + */ 72 +var hasOwnProperty = Object.prototype.hasOwnProperty; 73 +function hasOwn (obj, key) { 74 + return hasOwnProperty.call(obj, key) 75 +} 76 + 77 +/** 78 + * Check if value is primitive 79 + */ 80 +function isPrimitive (value) { 81 + return typeof value === 'string' || typeof value === 'number' 82 +} 83 + 84 +/** 85 + * Create a cached version of a pure function. 86 + */ 87 +function cached (fn) { 88 + var cache = Object.create(null); 89 + return (function cachedFn (str) { 90 + var hit = cache[str]; 91 + return hit || (cache[str] = fn(str)) 92 + }) 93 +} 94 + 95 +/** 96 + * Camelize a hyphen-delimited string. 97 + */ 98 +var camelizeRE = /-(\w)/g; 99 +var camelize = cached(function (str) { 100 + return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; }) 101 +}); 102 + 103 +/** 104 + * Capitalize a string. 105 + */ 106 +var capitalize = cached(function (str) { 107 + return str.charAt(0).toUpperCase() + str.slice(1) 108 +}); 109 + 110 +/** 111 + * Hyphenate a camelCase string. 112 + */ 113 +var hyphenateRE = /([^-])([A-Z])/g; 114 +var hyphenate = cached(function (str) { 115 + return str 116 + .replace(hyphenateRE, '$1-$2') 117 + .replace(hyphenateRE, '$1-$2') 118 + .toLowerCase() 119 +}); 120 + 121 +/** 122 + * Simple bind, faster than native 123 + */ 124 +function bind (fn, ctx) { 125 + function boundFn (a) { 126 + var l = arguments.length; 127 + return l 128 + ? l > 1 129 + ? fn.apply(ctx, arguments) 130 + : fn.call(ctx, a) 131 + : fn.call(ctx) 132 + } 133 + // record original fn length 134 + boundFn._length = fn.length; 135 + return boundFn 136 +} 137 + 138 +/** 139 + * Convert an Array-like object to a real Array. 140 + */ 141 +function toArray (list, start) { 142 + start = start || 0; 143 + var i = list.length - start; 144 + var ret = new Array(i); 145 + while (i--) { 146 + ret[i] = list[i + start]; 147 + } 148 + return ret 149 +} 150 + 151 +/** 152 + * Mix properties into target object. 153 + */ 154 +function extend (to, _from) { 155 + for (var key in _from) { 156 + to[key] = _from[key]; 157 + } 158 + return to 159 +} 160 + 161 +/** 162 + * Quick object check - this is primarily used to tell 163 + * Objects from primitive values when we know the value 164 + * is a JSON-compliant type. 165 + */ 166 +function isObject (obj) { 167 + return obj !== null && typeof obj === 'object' 168 +} 169 + 170 +/** 171 + * Strict object type check. Only returns true 172 + * for plain JavaScript objects. 173 + */ 174 +var toString = Object.prototype.toString; 175 +var OBJECT_STRING = '[object Object]'; 176 +function isPlainObject (obj) { 177 + return toString.call(obj) === OBJECT_STRING 178 +} 179 + 180 +/** 181 + * Merge an Array of Objects into a single Object. 182 + */ 183 +function toObject (arr) { 184 + var res = {}; 185 + for (var i = 0; i < arr.length; i++) { 186 + if (arr[i]) { 187 + extend(res, arr[i]); 188 + } 189 + } 190 + return res 191 +} 192 + 193 +/** 194 + * Perform no operation. 195 + */ 196 +function noop () {} 197 + 198 +/** 199 + * Always return false. 200 + */ 201 +var no = function () { return false; }; 202 + 203 +/** 204 + * Return same value 205 + */ 206 +var identity = function (_) { return _; }; 207 + 208 +/** 209 + * Generate a static keys string from compiler modules. 210 + */ 211 +function genStaticKeys (modules) { 212 + return modules.reduce(function (keys, m) { 213 + return keys.concat(m.staticKeys || []) 214 + }, []).join(',') 215 +} 216 + 217 +/** 218 + * Check if two values are loosely equal - that is, 219 + * if they are plain objects, do they have the same shape? 220 + */ 221 +function looseEqual (a, b) { 222 + var isObjectA = isObject(a); 223 + var isObjectB = isObject(b); 224 + if (isObjectA && isObjectB) { 225 + return JSON.stringify(a) === JSON.stringify(b) 226 + } else if (!isObjectA && !isObjectB) { 227 + return String(a) === String(b) 228 + } else { 229 + return false 230 + } 231 +} 232 + 233 +function looseIndexOf (arr, val) { 234 + for (var i = 0; i < arr.length; i++) { 235 + if (looseEqual(arr[i], val)) { return i } 236 + } 237 + return -1 238 +} 239 + 240 +/** 241 + * Ensure a function is called only once. 242 + */ 243 +function once (fn) { 244 + var called = false; 245 + return function () { 246 + if (!called) { 247 + called = true; 248 + fn(); 249 + } 250 + } 251 +} 252 + 253 +/* */ 254 + 255 +var config = { 256 + /** 257 + * Option merge strategies (used in core/util/options) 258 + */ 259 + optionMergeStrategies: Object.create(null), 260 + 261 + /** 262 + * Whether to suppress warnings. 263 + */ 264 + silent: false, 265 + 266 + /** 267 + * Show production mode tip message on boot? 268 + */ 269 + productionTip: "development" !== 'production', 270 + 271 + /** 272 + * Whether to enable devtools 273 + */ 274 + devtools: "development" !== 'production', 275 + 276 + /** 277 + * Whether to record perf 278 + */ 279 + performance: "development" !== 'production', 280 + 281 + /** 282 + * Error handler for watcher errors 283 + */ 284 + errorHandler: null, 285 + 286 + /** 287 + * Ignore certain custom elements 288 + */ 289 + ignoredElements: [], 290 + 291 + /** 292 + * Custom user key aliases for v-on 293 + */ 294 + keyCodes: Object.create(null), 295 + 296 + /** 297 + * Check if a tag is reserved so that it cannot be registered as a 298 + * component. This is platform-dependent and may be overwritten. 299 + */ 300 + isReservedTag: no, 301 + 302 + /** 303 + * Check if a tag is an unknown element. 304 + * Platform-dependent. 305 + */ 306 + isUnknownElement: no, 307 + 308 + /** 309 + * Get the namespace of an element 310 + */ 311 + getTagNamespace: noop, 312 + 313 + /** 314 + * Parse the real tag name for the specific platform. 315 + */ 316 + parsePlatformTagName: identity, 317 + 318 + /** 319 + * Check if an attribute must be bound using property, e.g. value 320 + * Platform-dependent. 321 + */ 322 + mustUseProp: no, 323 + 324 + /** 325 + * List of asset types that a component can own. 326 + */ 327 + _assetTypes: [ 328 + 'component', 329 + 'directive', 330 + 'filter' 331 + ], 332 + 333 + /** 334 + * List of lifecycle hooks. 335 + */ 336 + _lifecycleHooks: [ 337 + 'beforeCreate', 338 + 'created', 339 + 'beforeMount', 340 + 'mounted', 341 + 'beforeUpdate', 342 + 'updated', 343 + 'beforeDestroy', 344 + 'destroyed', 345 + 'activated', 346 + 'deactivated' 347 + ], 348 + 349 + /** 350 + * Max circular updates allowed in a scheduler flush cycle. 351 + */ 352 + _maxUpdateCount: 100 353 +}; 354 + 355 +/* */ 356 +/* globals MutationObserver */ 357 + 358 +// can we use __proto__? 359 +var hasProto = '__proto__' in {}; 360 + 361 +// Browser environment sniffing 362 +var inBrowser = typeof window !== 'undefined'; 363 +var UA = inBrowser && window.navigator.userAgent.toLowerCase(); 364 +var isIE = UA && /msie|trident/.test(UA); 365 +var isIE9 = UA && UA.indexOf('msie 9.0') > 0; 366 +var isEdge = UA && UA.indexOf('edge/') > 0; 367 +var isAndroid = UA && UA.indexOf('android') > 0; 368 +var isIOS = UA && /iphone|ipad|ipod|ios/.test(UA); 369 +var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge; 370 + 371 +// this needs to be lazy-evaled because vue may be required before 372 +// vue-server-renderer can set VUE_ENV 373 +var _isServer; 374 +var isServerRendering = function () { 375 + if (_isServer === undefined) { 376 + /* istanbul ignore if */ 377 + if (!inBrowser && typeof global !== 'undefined') { 378 + // detect presence of vue-server-renderer and avoid 379 + // Webpack shimming the process 380 + _isServer = global['process'].env.VUE_ENV === 'server'; 381 + } else { 382 + _isServer = false; 383 + } 384 + } 385 + return _isServer 386 +}; 387 + 388 +// detect devtools 389 +var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__; 390 + 391 +/* istanbul ignore next */ 392 +function isNative (Ctor) { 393 + return /native code/.test(Ctor.toString()) 394 +} 395 + 396 +var hasSymbol = 397 + typeof Symbol !== 'undefined' && isNative(Symbol) && 398 + typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys); 399 + 400 +/** 401 + * Defer a task to execute it asynchronously. 402 + */ 403 +var nextTick = (function () { 404 + var callbacks = []; 405 + var pending = false; 406 + var timerFunc; 407 + 408 + function nextTickHandler () { 409 + pending = false; 410 + var copies = callbacks.slice(0); 411 + callbacks.length = 0; 412 + for (var i = 0; i < copies.length; i++) { 413 + copies[i](); 414 + } 415 + } 416 + 417 + // the nextTick behavior leverages the microtask queue, which can be accessed 418 + // via either native Promise.then or MutationObserver. 419 + // MutationObserver has wider support, however it is seriously bugged in 420 + // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It 421 + // completely stops working after triggering a few times... so, if native 422 + // Promise is available, we will use it: 423 + /* istanbul ignore if */ 424 + if (typeof Promise !== 'undefined' && isNative(Promise)) { 425 + var p = Promise.resolve(); 426 + var logError = function (err) { console.error(err); }; 427 + timerFunc = function () { 428 + p.then(nextTickHandler).catch(logError); 429 + // in problematic UIWebViews, Promise.then doesn't completely break, but 430 + // it can get stuck in a weird state where callbacks are pushed into the 431 + // microtask queue but the queue isn't being flushed, until the browser 432 + // needs to do some other work, e.g. handle a timer. Therefore we can 433 + // "force" the microtask queue to be flushed by adding an empty timer. 434 + if (isIOS) { setTimeout(noop); } 435 + }; 436 + } else if (typeof MutationObserver !== 'undefined' && ( 437 + isNative(MutationObserver) || 438 + // PhantomJS and iOS 7.x 439 + MutationObserver.toString() === '[object MutationObserverConstructor]' 440 + )) { 441 + // use MutationObserver where native Promise is not available, 442 + // e.g. PhantomJS IE11, iOS7, Android 4.4 443 + var counter = 1; 444 + var observer = new MutationObserver(nextTickHandler); 445 + var textNode = document.createTextNode(String(counter)); 446 + observer.observe(textNode, { 447 + characterData: true 448 + }); 449 + timerFunc = function () { 450 + counter = (counter + 1) % 2; 451 + textNode.data = String(counter); 452 + }; 453 + } else { 454 + // fallback to setTimeout 455 + /* istanbul ignore next */ 456 + timerFunc = function () { 457 + setTimeout(nextTickHandler, 0); 458 + }; 459 + } 460 + 461 + return function queueNextTick (cb, ctx) { 462 + var _resolve; 463 + callbacks.push(function () { 464 + if (cb) { cb.call(ctx); } 465 + if (_resolve) { _resolve(ctx); } 466 + }); 467 + if (!pending) { 468 + pending = true; 469 + timerFunc(); 470 + } 471 + if (!cb && typeof Promise !== 'undefined') { 472 + return new Promise(function (resolve) { 473 + _resolve = resolve; 474 + }) 475 + } 476 + } 477 +})(); 478 + 479 +var _Set; 480 +/* istanbul ignore if */ 481 +if (typeof Set !== 'undefined' && isNative(Set)) { 482 + // use native Set when available. 483 + _Set = Set; 484 +} else { 485 + // a non-standard Set polyfill that only works with primitive keys. 486 + _Set = (function () { 487 + function Set () { 488 + this.set = Object.create(null); 489 + } 490 + Set.prototype.has = function has (key) { 491 + return this.set[key] === true 492 + }; 493 + Set.prototype.add = function add (key) { 494 + this.set[key] = true; 495 + }; 496 + Set.prototype.clear = function clear () { 497 + this.set = Object.create(null); 498 + }; 499 + 500 + return Set; 501 + }()); 502 +} 503 + 504 +var perf; 505 + 506 +{ 507 + perf = inBrowser && window.performance; 508 + if (perf && (!perf.mark || !perf.measure)) { 509 + perf = undefined; 510 + } 511 +} 512 + 513 +/* */ 514 + 515 +var emptyObject = Object.freeze({}); 516 + 517 +/** 518 + * Check if a string starts with $ or _ 519 + */ 520 +function isReserved (str) { 521 + var c = (str + '').charCodeAt(0); 522 + return c === 0x24 || c === 0x5F 523 +} 524 + 525 +/** 526 + * Define a property. 527 + */ 528 +function def (obj, key, val, enumerable) { 529 + Object.defineProperty(obj, key, { 530 + value: val, 531 + enumerable: !!enumerable, 532 + writable: true, 533 + configurable: true 534 + }); 535 +} 536 + 537 +/** 538 + * Parse simple path. 539 + */ 540 +var bailRE = /[^\w.$]/; 541 +function parsePath (path) { 542 + if (bailRE.test(path)) { 543 + return 544 + } else { 545 + var segments = path.split('.'); 546 + return function (obj) { 547 + for (var i = 0; i < segments.length; i++) { 548 + if (!obj) { return } 549 + obj = obj[segments[i]]; 550 + } 551 + return obj 552 + } 553 + } 554 +} 555 + 556 +var warn = noop; 557 +var tip = noop; 558 +var formatComponentName; 559 + 560 +{ 561 + var hasConsole = typeof console !== 'undefined'; 562 + var classifyRE = /(?:^|[-_])(\w)/g; 563 + var classify = function (str) { return str 564 + .replace(classifyRE, function (c) { return c.toUpperCase(); }) 565 + .replace(/[-_]/g, ''); }; 566 + 567 + warn = function (msg, vm) { 568 + if (hasConsole && (!config.silent)) { 569 + console.error("[Vue warn]: " + msg + " " + ( 570 + vm ? formatLocation(formatComponentName(vm)) : '' 571 + )); 572 + } 573 + }; 574 + 575 + tip = function (msg, vm) { 576 + if (hasConsole && (!config.silent)) { 577 + console.warn("[Vue tip]: " + msg + " " + ( 578 + vm ? formatLocation(formatComponentName(vm)) : '' 579 + )); 580 + } 581 + }; 582 + 583 + formatComponentName = function (vm, includeFile) { 584 + if (vm.$root === vm) { 585 + return '<Root>' 586 + } 587 + var name = vm._isVue 588 + ? vm.$options.name || vm.$options._componentTag 589 + : vm.name; 590 + 591 + var file = vm._isVue && vm.$options.__file; 592 + if (!name && file) { 593 + var match = file.match(/([^/\\]+)\.vue$/); 594 + name = match && match[1]; 595 + } 596 + 597 + return ( 598 + (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") + 599 + (file && includeFile !== false ? (" at " + file) : '') 600 + ) 601 + }; 602 + 603 + var formatLocation = function (str) { 604 + if (str === "<Anonymous>") { 605 + str += " - use the \"name\" option for better debugging messages."; 606 + } 607 + return ("\n(found in " + str + ")") 608 + }; 609 +} 610 + 611 +/* */ 612 + 613 + 614 +var uid$1 = 0; 615 + 616 +/** 617 + * A dep is an observable that can have multiple 618 + * directives subscribing to it. 619 + */ 620 +var Dep = function Dep () { 621 + this.id = uid$1++; 622 + this.subs = []; 623 +}; 624 + 625 +Dep.prototype.addSub = function addSub (sub) { 626 + this.subs.push(sub); 627 +}; 628 + 629 +Dep.prototype.removeSub = function removeSub (sub) { 630 + remove(this.subs, sub); 631 +}; 632 + 633 +Dep.prototype.depend = function depend () { 634 + if (Dep.target) { 635 + Dep.target.addDep(this); 636 + } 637 +}; 638 + 639 +Dep.prototype.notify = function notify () { 640 + // stablize the subscriber list first 641 + var subs = this.subs.slice(); 642 + for (var i = 0, l = subs.length; i < l; i++) { 643 + subs[i].update(); 644 + } 645 +}; 646 + 647 +// the current target watcher being evaluated. 648 +// this is globally unique because there could be only one 649 +// watcher being evaluated at any time. 650 +Dep.target = null; 651 +var targetStack = []; 652 + 653 +function pushTarget (_target) { 654 + if (Dep.target) { targetStack.push(Dep.target); } 655 + Dep.target = _target; 656 +} 657 + 658 +function popTarget () { 659 + Dep.target = targetStack.pop(); 660 +} 661 + 662 +/* 663 + * not type checking this file because flow doesn't play well with 664 + * dynamically accessing methods on Array prototype 665 + */ 666 + 667 +var arrayProto = Array.prototype; 668 +var arrayMethods = Object.create(arrayProto);[ 669 + 'push', 670 + 'pop', 671 + 'shift', 672 + 'unshift', 673 + 'splice', 674 + 'sort', 675 + 'reverse' 676 +] 677 +.forEach(function (method) { 678 + // cache original method 679 + var original = arrayProto[method]; 680 + def(arrayMethods, method, function mutator () { 681 + var arguments$1 = arguments; 682 + 683 + // avoid leaking arguments: 684 + // http://jsperf.com/closure-with-arguments 685 + var i = arguments.length; 686 + var args = new Array(i); 687 + while (i--) { 688 + args[i] = arguments$1[i]; 689 + } 690 + var result = original.apply(this, args); 691 + var ob = this.__ob__; 692 + var inserted; 693 + switch (method) { 694 + case 'push': 695 + inserted = args; 696 + break 697 + case 'unshift': 698 + inserted = args; 699 + break 700 + case 'splice': 701 + inserted = args.slice(2); 702 + break 703 + } 704 + if (inserted) { ob.observeArray(inserted); } 705 + // notify change 706 + ob.dep.notify(); 707 + return result 708 + }); 709 +}); 710 + 711 +/* */ 712 + 713 +var arrayKeys = Object.getOwnPropertyNames(arrayMethods); 714 + 715 +/** 716 + * By default, when a reactive property is set, the new value is 717 + * also converted to become reactive. However when passing down props, 718 + * we don't want to force conversion because the value may be a nested value 719 + * under a frozen data structure. Converting it would defeat the optimization. 720 + */ 721 +var observerState = { 722 + shouldConvert: true, 723 + isSettingProps: false 724 +}; 725 + 726 +/** 727 + * Observer class that are attached to each observed 728 + * object. Once attached, the observer converts target 729 + * object's property keys into getter/setters that 730 + * collect dependencies and dispatches updates. 731 + */ 732 +var Observer = function Observer (value) { 733 + this.value = value; 734 + this.dep = new Dep(); 735 + this.vmCount = 0; 736 + def(value, '__ob__', this); 737 + if (Array.isArray(value)) { 738 + var augment = hasProto 739 + ? protoAugment 740 + : copyAugment; 741 + augment(value, arrayMethods, arrayKeys); 742 + this.observeArray(value); 743 + } else { 744 + this.walk(value); 745 + } 746 +}; 747 + 748 +/** 749 + * Walk through each property and convert them into 750 + * getter/setters. This method should only be called when 751 + * value type is Object. 752 + */ 753 +Observer.prototype.walk = function walk (obj) { 754 + var keys = Object.keys(obj); 755 + for (var i = 0; i < keys.length; i++) { 756 + defineReactive$$1(obj, keys[i], obj[keys[i]]); 757 + } 758 +}; 759 + 760 +/** 761 + * Observe a list of Array items. 762 + */ 763 +Observer.prototype.observeArray = function observeArray (items) { 764 + for (var i = 0, l = items.length; i < l; i++) { 765 + observe(items[i]); 766 + } 767 +}; 768 + 769 +// helpers 770 + 771 +/** 772 + * Augment an target Object or Array by intercepting 773 + * the prototype chain using __proto__ 774 + */ 775 +function protoAugment (target, src) { 776 + /* eslint-disable no-proto */ 777 + target.__proto__ = src; 778 + /* eslint-enable no-proto */ 779 +} 780 + 781 +/** 782 + * Augment an target Object or Array by defining 783 + * hidden properties. 784 + */ 785 +/* istanbul ignore next */ 786 +function copyAugment (target, src, keys) { 787 + for (var i = 0, l = keys.length; i < l; i++) { 788 + var key = keys[i]; 789 + def(target, key, src[key]); 790 + } 791 +} 792 + 793 +/** 794 + * Attempt to create an observer instance for a value, 795 + * returns the new observer if successfully observed, 796 + * or the existing observer if the value already has one. 797 + */ 798 +function observe (value, asRootData) { 799 + if (!isObject(value)) { 800 + return 801 + } 802 + var ob; 803 + if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) { 804 + ob = value.__ob__; 805 + } else if ( 806 + observerState.shouldConvert && 807 + !isServerRendering() && 808 + (Array.isArray(value) || isPlainObject(value)) && 809 + Object.isExtensible(value) && 810 + !value._isVue 811 + ) { 812 + ob = new Observer(value); 813 + } 814 + if (asRootData && ob) { 815 + ob.vmCount++; 816 + } 817 + return ob 818 +} 819 + 820 +/** 821 + * Define a reactive property on an Object. 822 + */ 823 +function defineReactive$$1 ( 824 + obj, 825 + key, 826 + val, 827 + customSetter 828 +) { 829 + var dep = new Dep(); 830 + 831 + var property = Object.getOwnPropertyDescriptor(obj, key); 832 + if (property && property.configurable === false) { 833 + return 834 + } 835 + 836 + // cater for pre-defined getter/setters 837 + var getter = property && property.get; 838 + var setter = property && property.set; 839 + 840 + var childOb = observe(val); 841 + Object.defineProperty(obj, key, { 842 + enumerable: true, 843 + configurable: true, 844 + get: function reactiveGetter () { 845 + var value = getter ? getter.call(obj) : val; 846 + if (Dep.target) { 847 + dep.depend(); 848 + if (childOb) { 849 + childOb.dep.depend(); 850 + } 851 + if (Array.isArray(value)) { 852 + dependArray(value); 853 + } 854 + } 855 + return value 856 + }, 857 + set: function reactiveSetter (newVal) { 858 + var value = getter ? getter.call(obj) : val; 859 + /* eslint-disable no-self-compare */ 860 + if (newVal === value || (newVal !== newVal && value !== value)) { 861 + return 862 + } 863 + /* eslint-enable no-self-compare */ 864 + if ("development" !== 'production' && customSetter) { 865 + customSetter(); 866 + } 867 + if (setter) { 868 + setter.call(obj, newVal); 869 + } else { 870 + val = newVal; 871 + } 872 + childOb = observe(newVal); 873 + dep.notify(); 874 + } 875 + }); 876 +} 877 + 878 +/** 879 + * Set a property on an object. Adds the new property and 880 + * triggers change notification if the property doesn't 881 + * already exist. 882 + */ 883 +function set (obj, key, val) { 884 + if (Array.isArray(obj)) { 885 + obj.length = Math.max(obj.length, key); 886 + obj.splice(key, 1, val); 887 + return val 888 + } 889 + if (hasOwn(obj, key)) { 890 + obj[key] = val; 891 + return 892 + } 893 + var ob = obj.__ob__; 894 + if (obj._isVue || (ob && ob.vmCount)) { 895 + "development" !== 'production' && warn( 896 + 'Avoid adding reactive properties to a Vue instance or its root $data ' + 897 + 'at runtime - declare it upfront in the data option.' 898 + ); 899 + return 900 + } 901 + if (!ob) { 902 + obj[key] = val; 903 + return 904 + } 905 + defineReactive$$1(ob.value, key, val); 906 + ob.dep.notify(); 907 + return val 908 +} 909 + 910 +/** 911 + * Delete a property and trigger change if necessary. 912 + */ 913 +function del (obj, key) { 914 + if (Array.isArray(obj)) { 915 + obj.splice(key, 1); 916 + return 917 + } 918 + var ob = obj.__ob__; 919 + if (obj._isVue || (ob && ob.vmCount)) { 920 + "development" !== 'production' && warn( 921 + 'Avoid deleting properties on a Vue instance or its root $data ' + 922 + '- just set it to null.' 923 + ); 924 + return 925 + } 926 + if (!hasOwn(obj, key)) { 927 + return 928 + } 929 + delete obj[key]; 930 + if (!ob) { 931 + return 932 + } 933 + ob.dep.notify(); 934 +} 935 + 936 +/** 937 + * Collect dependencies on array elements when the array is touched, since 938 + * we cannot intercept array element access like property getters. 939 + */ 940 +function dependArray (value) { 941 + for (var e = (void 0), i = 0, l = value.length; i < l; i++) { 942 + e = value[i]; 943 + e && e.__ob__ && e.__ob__.dep.depend(); 944 + if (Array.isArray(e)) { 945 + dependArray(e); 946 + } 947 + } 948 +} 949 + 950 +/* */ 951 + 952 +/** 953 + * Option overwriting strategies are functions that handle 954 + * how to merge a parent option value and a child option 955 + * value into the final value. 956 + */ 957 +var strats = config.optionMergeStrategies; 958 + 959 +/** 960 + * Options with restrictions 961 + */ 962 +{ 963 + strats.el = strats.propsData = function (parent, child, vm, key) { 964 + if (!vm) { 965 + warn( 966 + "option \"" + key + "\" can only be used during instance " + 967 + 'creation with the `new` keyword.' 968 + ); 969 + } 970 + return defaultStrat(parent, child) 971 + }; 972 +} 973 + 974 +/** 975 + * Helper that recursively merges two data objects together. 976 + */ 977 +function mergeData (to, from) { 978 + if (!from) { return to } 979 + var key, toVal, fromVal; 980 + var keys = Object.keys(from); 981 + for (var i = 0; i < keys.length; i++) { 982 + key = keys[i]; 983 + toVal = to[key]; 984 + fromVal = from[key]; 985 + if (!hasOwn(to, key)) { 986 + set(to, key, fromVal); 987 + } else if (isPlainObject(toVal) && isPlainObject(fromVal)) { 988 + mergeData(toVal, fromVal); 989 + } 990 + } 991 + return to 992 +} 993 + 994 +/** 995 + * Data 996 + */ 997 +strats.data = function ( 998 + parentVal, 999 + childVal, 1000 + vm 1001 +) { 1002 + if (!vm) { 1003 + // in a Vue.extend merge, both should be functions 1004 + if (!childVal) { 1005 + return parentVal 1006 + } 1007 + if (typeof childVal !== 'function') { 1008 + "development" !== 'production' && warn( 1009 + 'The "data" option should be a function ' + 1010 + 'that returns a per-instance value in component ' + 1011 + 'definitions.', 1012 + vm 1013 + ); 1014 + return parentVal 1015 + } 1016 + if (!parentVal) { 1017 + return childVal 1018 + } 1019 + // when parentVal & childVal are both present, 1020 + // we need to return a function that returns the 1021 + // merged result of both functions... no need to 1022 + // check if parentVal is a function here because 1023 + // it has to be a function to pass previous merges. 1024 + return function mergedDataFn () { 1025 + return mergeData( 1026 + childVal.call(this), 1027 + parentVal.call(this) 1028 + ) 1029 + } 1030 + } else if (parentVal || childVal) { 1031 + return function mergedInstanceDataFn () { 1032 + // instance merge 1033 + var instanceData = typeof childVal === 'function' 1034 + ? childVal.call(vm) 1035 + : childVal; 1036 + var defaultData = typeof parentVal === 'function' 1037 + ? parentVal.call(vm) 1038 + : undefined; 1039 + if (instanceData) { 1040 + return mergeData(instanceData, defaultData) 1041 + } else { 1042 + return defaultData 1043 + } 1044 + } 1045 + } 1046 +}; 1047 + 1048 +/** 1049 + * Hooks and props are merged as arrays. 1050 + */ 1051 +function mergeHook ( 1052 + parentVal, 1053 + childVal 1054 +) { 1055 + return childVal 1056 + ? parentVal 1057 + ? parentVal.concat(childVal) 1058 + : Array.isArray(childVal) 1059 + ? childVal 1060 + : [childVal] 1061 + : parentVal 1062 +} 1063 + 1064 +config._lifecycleHooks.forEach(function (hook) { 1065 + strats[hook] = mergeHook; 1066 +}); 1067 + 1068 +/** 1069 + * Assets 1070 + * 1071 + * When a vm is present (instance creation), we need to do 1072 + * a three-way merge between constructor options, instance 1073 + * options and parent options. 1074 + */ 1075 +function mergeAssets (parentVal, childVal) { 1076 + var res = Object.create(parentVal || null); 1077 + return childVal 1078 + ? extend(res, childVal) 1079 + : res 1080 +} 1081 + 1082 +config._assetTypes.forEach(function (type) { 1083 + strats[type + 's'] = mergeAssets; 1084 +}); 1085 + 1086 +/** 1087 + * Watchers. 1088 + * 1089 + * Watchers hashes should not overwrite one 1090 + * another, so we merge them as arrays. 1091 + */ 1092 +strats.watch = function (parentVal, childVal) { 1093 + /* istanbul ignore if */ 1094 + if (!childVal) { return Object.create(parentVal || null) } 1095 + if (!parentVal) { return childVal } 1096 + var ret = {}; 1097 + extend(ret, parentVal); 1098 + for (var key in childVal) { 1099 + var parent = ret[key]; 1100 + var child = childVal[key]; 1101 + if (parent && !Array.isArray(parent)) { 1102 + parent = [parent]; 1103 + } 1104 + ret[key] = parent 1105 + ? parent.concat(child) 1106 + : [child]; 1107 + } 1108 + return ret 1109 +}; 1110 + 1111 +/** 1112 + * Other object hashes. 1113 + */ 1114 +strats.props = 1115 +strats.methods = 1116 +strats.computed = function (parentVal, childVal) { 1117 + if (!childVal) { return Object.create(parentVal || null) } 1118 + if (!parentVal) { return childVal } 1119 + var ret = Object.create(null); 1120 + extend(ret, parentVal); 1121 + extend(ret, childVal); 1122 + return ret 1123 +}; 1124 + 1125 +/** 1126 + * Default strategy. 1127 + */ 1128 +var defaultStrat = function (parentVal, childVal) { 1129 + return childVal === undefined 1130 + ? parentVal 1131 + : childVal 1132 +}; 1133 + 1134 +/** 1135 + * Validate component names 1136 + */ 1137 +function checkComponents (options) { 1138 + for (var key in options.components) { 1139 + var lower = key.toLowerCase(); 1140 + if (isBuiltInTag(lower) || config.isReservedTag(lower)) { 1141 + warn( 1142 + 'Do not use built-in or reserved HTML elements as component ' + 1143 + 'id: ' + key 1144 + ); 1145 + } 1146 + } 1147 +} 1148 + 1149 +/** 1150 + * Ensure all props option syntax are normalized into the 1151 + * Object-based format. 1152 + */ 1153 +function normalizeProps (options) { 1154 + var props = options.props; 1155 + if (!props) { return } 1156 + var res = {}; 1157 + var i, val, name; 1158 + if (Array.isArray(props)) { 1159 + i = props.length; 1160 + while (i--) { 1161 + val = props[i]; 1162 + if (typeof val === 'string') { 1163 + name = camelize(val); 1164 + res[name] = { type: null }; 1165 + } else { 1166 + warn('props must be strings when using array syntax.'); 1167 + } 1168 + } 1169 + } else if (isPlainObject(props)) { 1170 + for (var key in props) { 1171 + val = props[key]; 1172 + name = camelize(key); 1173 + res[name] = isPlainObject(val) 1174 + ? val 1175 + : { type: val }; 1176 + } 1177 + } 1178 + options.props = res; 1179 +} 1180 + 1181 +/** 1182 + * Normalize raw function directives into object format. 1183 + */ 1184 +function normalizeDirectives (options) { 1185 + var dirs = options.directives; 1186 + if (dirs) { 1187 + for (var key in dirs) { 1188 + var def = dirs[key]; 1189 + if (typeof def === 'function') { 1190 + dirs[key] = { bind: def, update: def }; 1191 + } 1192 + } 1193 + } 1194 +} 1195 + 1196 +/** 1197 + * Merge two option objects into a new one. 1198 + * Core utility used in both instantiation and inheritance. 1199 + */ 1200 +function mergeOptions ( 1201 + parent, 1202 + child, 1203 + vm 1204 +) { 1205 + { 1206 + checkComponents(child); 1207 + } 1208 + normalizeProps(child); 1209 + normalizeDirectives(child); 1210 + var extendsFrom = child.extends; 1211 + if (extendsFrom) { 1212 + parent = typeof extendsFrom === 'function' 1213 + ? mergeOptions(parent, extendsFrom.options, vm) 1214 + : mergeOptions(parent, extendsFrom, vm); 1215 + } 1216 + if (child.mixins) { 1217 + for (var i = 0, l = child.mixins.length; i < l; i++) { 1218 + var mixin = child.mixins[i]; 1219 + if (mixin.prototype instanceof Vue$3) { 1220 + mixin = mixin.options; 1221 + } 1222 + parent = mergeOptions(parent, mixin, vm); 1223 + } 1224 + } 1225 + var options = {}; 1226 + var key; 1227 + for (key in parent) { 1228 + mergeField(key); 1229 + } 1230 + for (key in child) { 1231 + if (!hasOwn(parent, key)) { 1232 + mergeField(key); 1233 + } 1234 + } 1235 + function mergeField (key) { 1236 + var strat = strats[key] || defaultStrat; 1237 + options[key] = strat(parent[key], child[key], vm, key); 1238 + } 1239 + return options 1240 +} 1241 + 1242 +/** 1243 + * Resolve an asset. 1244 + * This function is used because child instances need access 1245 + * to assets defined in its ancestor chain. 1246 + */ 1247 +function resolveAsset ( 1248 + options, 1249 + type, 1250 + id, 1251 + warnMissing 1252 +) { 1253 + /* istanbul ignore if */ 1254 + if (typeof id !== 'string') { 1255 + return 1256 + } 1257 + var assets = options[type]; 1258 + // check local registration variations first 1259 + if (hasOwn(assets, id)) { return assets[id] } 1260 + var camelizedId = camelize(id); 1261 + if (hasOwn(assets, camelizedId)) { return assets[camelizedId] } 1262 + var PascalCaseId = capitalize(camelizedId); 1263 + if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] } 1264 + // fallback to prototype chain 1265 + var res = assets[id] || assets[camelizedId] || assets[PascalCaseId]; 1266 + if ("development" !== 'production' && warnMissing && !res) { 1267 + warn( 1268 + 'Failed to resolve ' + type.slice(0, -1) + ': ' + id, 1269 + options 1270 + ); 1271 + } 1272 + return res 1273 +} 1274 + 1275 +/* */ 1276 + 1277 +function validateProp ( 1278 + key, 1279 + propOptions, 1280 + propsData, 1281 + vm 1282 +) { 1283 + var prop = propOptions[key]; 1284 + var absent = !hasOwn(propsData, key); 1285 + var value = propsData[key]; 1286 + // handle boolean props 1287 + if (isType(Boolean, prop.type)) { 1288 + if (absent && !hasOwn(prop, 'default')) { 1289 + value = false; 1290 + } else if (!isType(String, prop.type) && (value === '' || value === hyphenate(key))) { 1291 + value = true; 1292 + } 1293 + } 1294 + // check default value 1295 + if (value === undefined) { 1296 + value = getPropDefaultValue(vm, prop, key); 1297 + // since the default value is a fresh copy, 1298 + // make sure to observe it. 1299 + var prevShouldConvert = observerState.shouldConvert; 1300 + observerState.shouldConvert = true; 1301 + observe(value); 1302 + observerState.shouldConvert = prevShouldConvert; 1303 + } 1304 + { 1305 + assertProp(prop, key, value, vm, absent); 1306 + } 1307 + return value 1308 +} 1309 + 1310 +/** 1311 + * Get the default value of a prop. 1312 + */ 1313 +function getPropDefaultValue (vm, prop, key) { 1314 + // no default, return undefined 1315 + if (!hasOwn(prop, 'default')) { 1316 + return undefined 1317 + } 1318 + var def = prop.default; 1319 + // warn against non-factory defaults for Object & Array 1320 + if ("development" !== 'production' && isObject(def)) { 1321 + warn( 1322 + 'Invalid default value for prop "' + key + '": ' + 1323 + 'Props with type Object/Array must use a factory function ' + 1324 + 'to return the default value.', 1325 + vm 1326 + ); 1327 + } 1328 + // the raw prop value was also undefined from previous render, 1329 + // return previous default value to avoid unnecessary watcher trigger 1330 + if (vm && vm.$options.propsData && 1331 + vm.$options.propsData[key] === undefined && 1332 + vm._props[key] !== undefined) { 1333 + return vm._props[key] 1334 + } 1335 + // call factory function for non-Function types 1336 + // a value is Function if its prototype is function even across different execution context 1337 + return typeof def === 'function' && getType(prop.type) !== 'Function' 1338 + ? def.call(vm) 1339 + : def 1340 +} 1341 + 1342 +/** 1343 + * Assert whether a prop is valid. 1344 + */ 1345 +function assertProp ( 1346 + prop, 1347 + name, 1348 + value, 1349 + vm, 1350 + absent 1351 +) { 1352 + if (prop.required && absent) { 1353 + warn( 1354 + 'Missing required prop: "' + name + '"', 1355 + vm 1356 + ); 1357 + return 1358 + } 1359 + if (value == null && !prop.required) { 1360 + return 1361 + } 1362 + var type = prop.type; 1363 + var valid = !type || type === true; 1364 + var expectedTypes = []; 1365 + if (type) { 1366 + if (!Array.isArray(type)) { 1367 + type = [type]; 1368 + } 1369 + for (var i = 0; i < type.length && !valid; i++) { 1370 + var assertedType = assertType(value, type[i]); 1371 + expectedTypes.push(assertedType.expectedType || ''); 1372 + valid = assertedType.valid; 1373 + } 1374 + } 1375 + if (!valid) { 1376 + warn( 1377 + 'Invalid prop: type check failed for prop "' + name + '".' + 1378 + ' Expected ' + expectedTypes.map(capitalize).join(', ') + 1379 + ', got ' + Object.prototype.toString.call(value).slice(8, -1) + '.', 1380 + vm 1381 + ); 1382 + return 1383 + } 1384 + var validator = prop.validator; 1385 + if (validator) { 1386 + if (!validator(value)) { 1387 + warn( 1388 + 'Invalid prop: custom validator check failed for prop "' + name + '".', 1389 + vm 1390 + ); 1391 + } 1392 + } 1393 +} 1394 + 1395 +/** 1396 + * Assert the type of a value 1397 + */ 1398 +function assertType (value, type) { 1399 + var valid; 1400 + var expectedType = getType(type); 1401 + if (expectedType === 'String') { 1402 + valid = typeof value === (expectedType = 'string'); 1403 + } else if (expectedType === 'Number') { 1404 + valid = typeof value === (expectedType = 'number'); 1405 + } else if (expectedType === 'Boolean') { 1406 + valid = typeof value === (expectedType = 'boolean'); 1407 + } else if (expectedType === 'Function') { 1408 + valid = typeof value === (expectedType = 'function'); 1409 + } else if (expectedType === 'Object') { 1410 + valid = isPlainObject(value); 1411 + } else if (expectedType === 'Array') { 1412 + valid = Array.isArray(value); 1413 + } else { 1414 + valid = value instanceof type; 1415 + } 1416 + return { 1417 + valid: valid, 1418 + expectedType: expectedType 1419 + } 1420 +} 1421 + 1422 +/** 1423 + * Use function string name to check built-in types, 1424 + * because a simple equality check will fail when running 1425 + * across different vms / iframes. 1426 + */ 1427 +function getType (fn) { 1428 + var match = fn && fn.toString().match(/^\s*function (\w+)/); 1429 + return match && match[1] 1430 +} 1431 + 1432 +function isType (type, fn) { 1433 + if (!Array.isArray(fn)) { 1434 + return getType(fn) === getType(type) 1435 + } 1436 + for (var i = 0, len = fn.length; i < len; i++) { 1437 + if (getType(fn[i]) === getType(type)) { 1438 + return true 1439 + } 1440 + } 1441 + /* istanbul ignore next */ 1442 + return false 1443 +} 1444 + 1445 +function handleError (err, vm, type) { 1446 + if (config.errorHandler) { 1447 + config.errorHandler.call(null, err, vm, type); 1448 + } else { 1449 + { 1450 + warn(("Error in " + type + ":"), vm); 1451 + } 1452 + /* istanbul ignore else */ 1453 + if (inBrowser && typeof console !== 'undefined') { 1454 + console.error(err); 1455 + } else { 1456 + throw err 1457 + } 1458 + } 1459 +} 1460 + 1461 +/* not type checking this file because flow doesn't play well with Proxy */ 1462 + 1463 +var initProxy; 1464 + 1465 +{ 1466 + var allowedGlobals = makeMap( 1467 + 'Infinity,undefined,NaN,isFinite,isNaN,' + 1468 + 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' + 1469 + 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' + 1470 + 'require' // for Webpack/Browserify 1471 + ); 1472 + 1473 + var warnNonPresent = function (target, key) { 1474 + warn( 1475 + "Property or method \"" + key + "\" is not defined on the instance but " + 1476 + "referenced during render. Make sure to declare reactive data " + 1477 + "properties in the data option.", 1478 + target 1479 + ); 1480 + }; 1481 + 1482 + var hasProxy = 1483 + typeof Proxy !== 'undefined' && 1484 + Proxy.toString().match(/native code/); 1485 + 1486 + if (hasProxy) { 1487 + var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta'); 1488 + config.keyCodes = new Proxy(config.keyCodes, { 1489 + set: function set (target, key, value) { 1490 + if (isBuiltInModifier(key)) { 1491 + warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key)); 1492 + return false 1493 + } else { 1494 + target[key] = value; 1495 + return true 1496 + } 1497 + } 1498 + }); 1499 + } 1500 + 1501 + var hasHandler = { 1502 + has: function has (target, key) { 1503 + var has = key in target; 1504 + var isAllowed = allowedGlobals(key) || key.charAt(0) === '_'; 1505 + if (!has && !isAllowed) { 1506 + warnNonPresent(target, key); 1507 + } 1508 + return has || !isAllowed 1509 + } 1510 + }; 1511 + 1512 + var getHandler = { 1513 + get: function get (target, key) { 1514 + if (typeof key === 'string' && !(key in target)) { 1515 + warnNonPresent(target, key); 1516 + } 1517 + return target[key] 1518 + } 1519 + }; 1520 + 1521 + initProxy = function initProxy (vm) { 1522 + if (hasProxy) { 1523 + // determine which proxy handler to use 1524 + var options = vm.$options; 1525 + var handlers = options.render && options.render._withStripped 1526 + ? getHandler 1527 + : hasHandler; 1528 + vm._renderProxy = new Proxy(vm, handlers); 1529 + } else { 1530 + vm._renderProxy = vm; 1531 + } 1532 + }; 1533 +} 1534 + 1535 +/* */ 1536 + 1537 +var VNode = function VNode ( 1538 + tag, 1539 + data, 1540 + children, 1541 + text, 1542 + elm, 1543 + context, 1544 + componentOptions 1545 +) { 1546 + this.tag = tag; 1547 + this.data = data; 1548 + this.children = children; 1549 + this.text = text; 1550 + this.elm = elm; 1551 + this.ns = undefined; 1552 + this.context = context; 1553 + this.functionalContext = undefined; 1554 + this.key = data && data.key; 1555 + this.componentOptions = componentOptions; 1556 + this.componentInstance = undefined; 1557 + this.parent = undefined; 1558 + this.raw = false; 1559 + this.isStatic = false; 1560 + this.isRootInsert = true; 1561 + this.isComment = false; 1562 + this.isCloned = false; 1563 + this.isOnce = false; 1564 +}; 1565 + 1566 +var prototypeAccessors = { child: {} }; 1567 + 1568 +// DEPRECATED: alias for componentInstance for backwards compat. 1569 +/* istanbul ignore next */ 1570 +prototypeAccessors.child.get = function () { 1571 + return this.componentInstance 1572 +}; 1573 + 1574 +Object.defineProperties( VNode.prototype, prototypeAccessors ); 1575 + 1576 +var createEmptyVNode = function () { 1577 + var node = new VNode(); 1578 + node.text = ''; 1579 + node.isComment = true; 1580 + return node 1581 +}; 1582 + 1583 +function createTextVNode (val) { 1584 + return new VNode(undefined, undefined, undefined, String(val)) 1585 +} 1586 + 1587 +// optimized shallow clone 1588 +// used for static nodes and slot nodes because they may be reused across 1589 +// multiple renders, cloning them avoids errors when DOM manipulations rely 1590 +// on their elm reference. 1591 +function cloneVNode (vnode) { 1592 + var cloned = new VNode( 1593 + vnode.tag, 1594 + vnode.data, 1595 + vnode.children, 1596 + vnode.text, 1597 + vnode.elm, 1598 + vnode.context, 1599 + vnode.componentOptions 1600 + ); 1601 + cloned.ns = vnode.ns; 1602 + cloned.isStatic = vnode.isStatic; 1603 + cloned.key = vnode.key; 1604 + cloned.isCloned = true; 1605 + return cloned 1606 +} 1607 + 1608 +function cloneVNodes (vnodes) { 1609 + var res = new Array(vnodes.length); 1610 + for (var i = 0; i < vnodes.length; i++) { 1611 + res[i] = cloneVNode(vnodes[i]); 1612 + } 1613 + return res 1614 +} 1615 + 1616 +/* */ 1617 + 1618 +var normalizeEvent = cached(function (name) { 1619 + var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first 1620 + name = once$$1 ? name.slice(1) : name; 1621 + var capture = name.charAt(0) === '!'; 1622 + name = capture ? name.slice(1) : name; 1623 + return { 1624 + name: name, 1625 + once: once$$1, 1626 + capture: capture 1627 + } 1628 +}); 1629 + 1630 +function createFnInvoker (fns) { 1631 + function invoker () { 1632 + var arguments$1 = arguments; 1633 + 1634 + var fns = invoker.fns; 1635 + if (Array.isArray(fns)) { 1636 + for (var i = 0; i < fns.length; i++) { 1637 + fns[i].apply(null, arguments$1); 1638 + } 1639 + } else { 1640 + // return handler return value for single handlers 1641 + return fns.apply(null, arguments) 1642 + } 1643 + } 1644 + invoker.fns = fns; 1645 + return invoker 1646 +} 1647 + 1648 +function updateListeners ( 1649 + on, 1650 + oldOn, 1651 + add, 1652 + remove$$1, 1653 + vm 1654 +) { 1655 + var name, cur, old, event; 1656 + for (name in on) { 1657 + cur = on[name]; 1658 + old = oldOn[name]; 1659 + event = normalizeEvent(name); 1660 + if (!cur) { 1661 + "development" !== 'production' && warn( 1662 + "Invalid handler for event \"" + (event.name) + "\": got " + String(cur), 1663 + vm 1664 + ); 1665 + } else if (!old) { 1666 + if (!cur.fns) { 1667 + cur = on[name] = createFnInvoker(cur); 1668 + } 1669 + add(event.name, cur, event.once, event.capture); 1670 + } else if (cur !== old) { 1671 + old.fns = cur; 1672 + on[name] = old; 1673 + } 1674 + } 1675 + for (name in oldOn) { 1676 + if (!on[name]) { 1677 + event = normalizeEvent(name); 1678 + remove$$1(event.name, oldOn[name], event.capture); 1679 + } 1680 + } 1681 +} 1682 + 1683 +/* */ 1684 + 1685 +function mergeVNodeHook (def, hookKey, hook) { 1686 + var invoker; 1687 + var oldHook = def[hookKey]; 1688 + 1689 + function wrappedHook () { 1690 + hook.apply(this, arguments); 1691 + // important: remove merged hook to ensure it's called only once 1692 + // and prevent memory leak 1693 + remove(invoker.fns, wrappedHook); 1694 + } 1695 + 1696 + if (!oldHook) { 1697 + // no existing hook 1698 + invoker = createFnInvoker([wrappedHook]); 1699 + } else { 1700 + /* istanbul ignore if */ 1701 + if (oldHook.fns && oldHook.merged) { 1702 + // already a merged invoker 1703 + invoker = oldHook; 1704 + invoker.fns.push(wrappedHook); 1705 + } else { 1706 + // existing plain hook 1707 + invoker = createFnInvoker([oldHook, wrappedHook]); 1708 + } 1709 + } 1710 + 1711 + invoker.merged = true; 1712 + def[hookKey] = invoker; 1713 +} 1714 + 1715 +/* */ 1716 + 1717 +// The template compiler attempts to minimize the need for normalization by 1718 +// statically analyzing the template at compile time. 1719 +// 1720 +// For plain HTML markup, normalization can be completely skipped because the 1721 +// generated render function is guaranteed to return Array<VNode>. There are 1722 +// two cases where extra normalization is needed: 1723 + 1724 +// 1. When the children contains components - because a functional component 1725 +// may return an Array instead of a single root. In this case, just a simple 1726 +// normalization is needed - if any child is an Array, we flatten the whole 1727 +// thing with Array.prototype.concat. It is guaranteed to be only 1-level deep 1728 +// because functional components already normalize their own children. 1729 +function simpleNormalizeChildren (children) { 1730 + for (var i = 0; i < children.length; i++) { 1731 + if (Array.isArray(children[i])) { 1732 + return Array.prototype.concat.apply([], children) 1733 + } 1734 + } 1735 + return children 1736 +} 1737 + 1738 +// 2. When the children contains constrcuts that always generated nested Arrays, 1739 +// e.g. <template>, <slot>, v-for, or when the children is provided by user 1740 +// with hand-written render functions / JSX. In such cases a full normalization 1741 +// is needed to cater to all possible types of children values. 1742 +function normalizeChildren (children) { 1743 + return isPrimitive(children) 1744 + ? [createTextVNode(children)] 1745 + : Array.isArray(children) 1746 + ? normalizeArrayChildren(children) 1747 + : undefined 1748 +} 1749 + 1750 +function normalizeArrayChildren (children, nestedIndex) { 1751 + var res = []; 1752 + var i, c, last; 1753 + for (i = 0; i < children.length; i++) { 1754 + c = children[i]; 1755 + if (c == null || typeof c === 'boolean') { continue } 1756 + last = res[res.length - 1]; 1757 + // nested 1758 + if (Array.isArray(c)) { 1759 + res.push.apply(res, normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i))); 1760 + } else if (isPrimitive(c)) { 1761 + if (last && last.text) { 1762 + last.text += String(c); 1763 + } else if (c !== '') { 1764 + // convert primitive to vnode 1765 + res.push(createTextVNode(c)); 1766 + } 1767 + } else { 1768 + if (c.text && last && last.text) { 1769 + res[res.length - 1] = createTextVNode(last.text + c.text); 1770 + } else { 1771 + // default key for nested array children (likely generated by v-for) 1772 + if (c.tag && c.key == null && nestedIndex != null) { 1773 + c.key = "__vlist" + nestedIndex + "_" + i + "__"; 1774 + } 1775 + res.push(c); 1776 + } 1777 + } 1778 + } 1779 + return res 1780 +} 1781 + 1782 +/* */ 1783 + 1784 +function getFirstComponentChild (children) { 1785 + return children && children.filter(function (c) { return c && c.componentOptions; })[0] 1786 +} 1787 + 1788 +/* */ 1789 + 1790 +function initEvents (vm) { 1791 + vm._events = Object.create(null); 1792 + vm._hasHookEvent = false; 1793 + // init parent attached events 1794 + var listeners = vm.$options._parentListeners; 1795 + if (listeners) { 1796 + updateComponentListeners(vm, listeners); 1797 + } 1798 +} 1799 + 1800 +var target; 1801 + 1802 +function add (event, fn, once$$1) { 1803 + if (once$$1) { 1804 + target.$once(event, fn); 1805 + } else { 1806 + target.$on(event, fn); 1807 + } 1808 +} 1809 + 1810 +function remove$1 (event, fn) { 1811 + target.$off(event, fn); 1812 +} 1813 + 1814 +function updateComponentListeners ( 1815 + vm, 1816 + listeners, 1817 + oldListeners 1818 +) { 1819 + target = vm; 1820 + updateListeners(listeners, oldListeners || {}, add, remove$1, vm); 1821 +} 1822 + 1823 +function eventsMixin (Vue) { 1824 + var hookRE = /^hook:/; 1825 + Vue.prototype.$on = function (event, fn) { 1826 + var this$1 = this; 1827 + 1828 + var vm = this; 1829 + if (Array.isArray(event)) { 1830 + for (var i = 0, l = event.length; i < l; i++) { 1831 + this$1.$on(event[i], fn); 1832 + } 1833 + } else { 1834 + (vm._events[event] || (vm._events[event] = [])).push(fn); 1835 + // optimize hook:event cost by using a boolean flag marked at registration 1836 + // instead of a hash lookup 1837 + if (hookRE.test(event)) { 1838 + vm._hasHookEvent = true; 1839 + } 1840 + } 1841 + return vm 1842 + }; 1843 + 1844 + Vue.prototype.$once = function (event, fn) { 1845 + var vm = this; 1846 + function on () { 1847 + vm.$off(event, on); 1848 + fn.apply(vm, arguments); 1849 + } 1850 + on.fn = fn; 1851 + vm.$on(event, on); 1852 + return vm 1853 + }; 1854 + 1855 + Vue.prototype.$off = function (event, fn) { 1856 + var vm = this; 1857 + // all 1858 + if (!arguments.length) { 1859 + vm._events = Object.create(null); 1860 + return vm 1861 + } 1862 + // specific event 1863 + var cbs = vm._events[event]; 1864 + if (!cbs) { 1865 + return vm 1866 + } 1867 + if (arguments.length === 1) { 1868 + vm._events[event] = null; 1869 + return vm 1870 + } 1871 + // specific handler 1872 + var cb; 1873 + var i = cbs.length; 1874 + while (i--) { 1875 + cb = cbs[i]; 1876 + if (cb === fn || cb.fn === fn) { 1877 + cbs.splice(i, 1); 1878 + break 1879 + } 1880 + } 1881 + return vm 1882 + }; 1883 + 1884 + Vue.prototype.$emit = function (event) { 1885 + var vm = this; 1886 + var cbs = vm._events[event]; 1887 + if (cbs) { 1888 + cbs = cbs.length > 1 ? toArray(cbs) : cbs; 1889 + var args = toArray(arguments, 1); 1890 + for (var i = 0, l = cbs.length; i < l; i++) { 1891 + cbs[i].apply(vm, args); 1892 + } 1893 + } 1894 + return vm 1895 + }; 1896 +} 1897 + 1898 +/* */ 1899 + 1900 +/** 1901 + * Runtime helper for resolving raw children VNodes into a slot object. 1902 + */ 1903 +function resolveSlots ( 1904 + children, 1905 + context 1906 +) { 1907 + var slots = {}; 1908 + if (!children) { 1909 + return slots 1910 + } 1911 + var defaultSlot = []; 1912 + var name, child; 1913 + for (var i = 0, l = children.length; i < l; i++) { 1914 + child = children[i]; 1915 + // named slots should only be respected if the vnode was rendered in the 1916 + // same context. 1917 + if ((child.context === context || child.functionalContext === context) && 1918 + child.data && (name = child.data.slot)) { 1919 + var slot = (slots[name] || (slots[name] = [])); 1920 + if (child.tag === 'template') { 1921 + slot.push.apply(slot, child.children); 1922 + } else { 1923 + slot.push(child); 1924 + } 1925 + } else { 1926 + defaultSlot.push(child); 1927 + } 1928 + } 1929 + // ignore single whitespace 1930 + if (defaultSlot.length && !( 1931 + defaultSlot.length === 1 && 1932 + (defaultSlot[0].text === ' ' || defaultSlot[0].isComment) 1933 + )) { 1934 + slots.default = defaultSlot; 1935 + } 1936 + return slots 1937 +} 1938 + 1939 +function resolveScopedSlots ( 1940 + fns 1941 +) { 1942 + var res = {}; 1943 + for (var i = 0; i < fns.length; i++) { 1944 + res[fns[i][0]] = fns[i][1]; 1945 + } 1946 + return res 1947 +} 1948 + 1949 +/* */ 1950 + 1951 +var activeInstance = null; 1952 + 1953 +function initLifecycle (vm) { 1954 + var options = vm.$options; 1955 + 1956 + // locate first non-abstract parent 1957 + var parent = options.parent; 1958 + if (parent && !options.abstract) { 1959 + while (parent.$options.abstract && parent.$parent) { 1960 + parent = parent.$parent; 1961 + } 1962 + parent.$children.push(vm); 1963 + } 1964 + 1965 + vm.$parent = parent; 1966 + vm.$root = parent ? parent.$root : vm; 1967 + 1968 + vm.$children = []; 1969 + vm.$refs = {}; 1970 + 1971 + vm._watcher = null; 1972 + vm._inactive = null; 1973 + vm._directInactive = false; 1974 + vm._isMounted = false; 1975 + vm._isDestroyed = false; 1976 + vm._isBeingDestroyed = false; 1977 +} 1978 + 1979 +function lifecycleMixin (Vue) { 1980 + Vue.prototype._update = function (vnode, hydrating) { 1981 + var vm = this; 1982 + if (vm._isMounted) { 1983 + callHook(vm, 'beforeUpdate'); 1984 + } 1985 + var prevEl = vm.$el; 1986 + var prevVnode = vm._vnode; 1987 + var prevActiveInstance = activeInstance; 1988 + activeInstance = vm; 1989 + vm._vnode = vnode; 1990 + // Vue.prototype.__patch__ is injected in entry points 1991 + // based on the rendering backend used. 1992 + if (!prevVnode) { 1993 + // initial render 1994 + vm.$el = vm.__patch__( 1995 + vm.$el, vnode, hydrating, false /* removeOnly */, 1996 + vm.$options._parentElm, 1997 + vm.$options._refElm 1998 + ); 1999 + } else { 2000 + // updates 2001 + vm.$el = vm.__patch__(prevVnode, vnode); 2002 + } 2003 + activeInstance = prevActiveInstance; 2004 + // update __vue__ reference 2005 + if (prevEl) { 2006 + prevEl.__vue__ = null; 2007 + } 2008 + if (vm.$el) { 2009 + vm.$el.__vue__ = vm; 2010 + } 2011 + // if parent is an HOC, update its $el as well 2012 + if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) { 2013 + vm.$parent.$el = vm.$el; 2014 + } 2015 + // updated hook is called by the scheduler to ensure that children are 2016 + // updated in a parent's updated hook. 2017 + }; 2018 + 2019 + Vue.prototype.$forceUpdate = function () { 2020 + var vm = this; 2021 + if (vm._watcher) { 2022 + vm._watcher.update(); 2023 + } 2024 + }; 2025 + 2026 + Vue.prototype.$destroy = function () { 2027 + var vm = this; 2028 + if (vm._isBeingDestroyed) { 2029 + return 2030 + } 2031 + callHook(vm, 'beforeDestroy'); 2032 + vm._isBeingDestroyed = true; 2033 + // remove self from parent 2034 + var parent = vm.$parent; 2035 + if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) { 2036 + remove(parent.$children, vm); 2037 + } 2038 + // teardown watchers 2039 + if (vm._watcher) { 2040 + vm._watcher.teardown(); 2041 + } 2042 + var i = vm._watchers.length; 2043 + while (i--) { 2044 + vm._watchers[i].teardown(); 2045 + } 2046 + // remove reference from data ob 2047 + // frozen object may not have observer. 2048 + if (vm._data.__ob__) { 2049 + vm._data.__ob__.vmCount--; 2050 + } 2051 + // call the last hook... 2052 + vm._isDestroyed = true; 2053 + callHook(vm, 'destroyed'); 2054 + // turn off all instance listeners. 2055 + vm.$off(); 2056 + // remove __vue__ reference 2057 + if (vm.$el) { 2058 + vm.$el.__vue__ = null; 2059 + } 2060 + // invoke destroy hooks on current rendered tree 2061 + vm.__patch__(vm._vnode, null); 2062 + }; 2063 +} 2064 + 2065 +function mountComponent ( 2066 + vm, 2067 + el, 2068 + hydrating 2069 +) { 2070 + vm.$el = el; 2071 + if (!vm.$options.render) { 2072 + vm.$options.render = createEmptyVNode; 2073 + { 2074 + /* istanbul ignore if */ 2075 + if (vm.$options.template && vm.$options.template.charAt(0) !== '#') { 2076 + warn( 2077 + 'You are using the runtime-only build of Vue where the template ' + 2078 + 'option is not available. Either pre-compile the templates into ' + 2079 + 'render functions, or use the compiler-included build.', 2080 + vm 2081 + ); 2082 + } else { 2083 + warn( 2084 + 'Failed to mount component: template or render function not defined.', 2085 + vm 2086 + ); 2087 + } 2088 + } 2089 + } 2090 + callHook(vm, 'beforeMount'); 2091 + 2092 + var updateComponent; 2093 + /* istanbul ignore if */ 2094 + if ("development" !== 'production' && config.performance && perf) { 2095 + updateComponent = function () { 2096 + var name = vm._name; 2097 + var startTag = "start " + name; 2098 + var endTag = "end " + name; 2099 + perf.mark(startTag); 2100 + var vnode = vm._render(); 2101 + perf.mark(endTag); 2102 + perf.measure((name + " render"), startTag, endTag); 2103 + perf.mark(startTag); 2104 + vm._update(vnode, hydrating); 2105 + perf.mark(endTag); 2106 + perf.measure((name + " patch"), startTag, endTag); 2107 + }; 2108 + } else { 2109 + updateComponent = function () { 2110 + vm._update(vm._render(), hydrating); 2111 + }; 2112 + } 2113 + 2114 + vm._watcher = new Watcher(vm, updateComponent, noop); 2115 + hydrating = false; 2116 + 2117 + // manually mounted instance, call mounted on self 2118 + // mounted is called for render-created child components in its inserted hook 2119 + if (vm.$vnode == null) { 2120 + vm._isMounted = true; 2121 + callHook(vm, 'mounted'); 2122 + } 2123 + return vm 2124 +} 2125 + 2126 +function updateChildComponent ( 2127 + vm, 2128 + propsData, 2129 + listeners, 2130 + parentVnode, 2131 + renderChildren 2132 +) { 2133 + // determine whether component has slot children 2134 + // we need to do this before overwriting $options._renderChildren 2135 + var hasChildren = !!( 2136 + renderChildren || // has new static slots 2137 + vm.$options._renderChildren || // has old static slots 2138 + parentVnode.data.scopedSlots || // has new scoped slots 2139 + vm.$scopedSlots !== emptyObject // has old scoped slots 2140 + ); 2141 + 2142 + vm.$options._parentVnode = parentVnode; 2143 + vm.$vnode = parentVnode; // update vm's placeholder node without re-render 2144 + if (vm._vnode) { // update child tree's parent 2145 + vm._vnode.parent = parentVnode; 2146 + } 2147 + vm.$options._renderChildren = renderChildren; 2148 + 2149 + // update props 2150 + if (propsData && vm.$options.props) { 2151 + observerState.shouldConvert = false; 2152 + { 2153 + observerState.isSettingProps = true; 2154 + } 2155 + var props = vm._props; 2156 + var propKeys = vm.$options._propKeys || []; 2157 + for (var i = 0; i < propKeys.length; i++) { 2158 + var key = propKeys[i]; 2159 + props[key] = validateProp(key, vm.$options.props, propsData, vm); 2160 + } 2161 + observerState.shouldConvert = true; 2162 + { 2163 + observerState.isSettingProps = false; 2164 + } 2165 + // keep a copy of raw propsData 2166 + vm.$options.propsData = propsData; 2167 + } 2168 + // update listeners 2169 + if (listeners) { 2170 + var oldListeners = vm.$options._parentListeners; 2171 + vm.$options._parentListeners = listeners; 2172 + updateComponentListeners(vm, listeners, oldListeners); 2173 + } 2174 + // resolve slots + force update if has children 2175 + if (hasChildren) { 2176 + vm.$slots = resolveSlots(renderChildren, parentVnode.context); 2177 + vm.$forceUpdate(); 2178 + } 2179 +} 2180 + 2181 +function isInInactiveTree (vm) { 2182 + while (vm && (vm = vm.$parent)) { 2183 + if (vm._inactive) { return true } 2184 + } 2185 + return false 2186 +} 2187 + 2188 +function activateChildComponent (vm, direct) { 2189 + if (direct) { 2190 + vm._directInactive = false; 2191 + if (isInInactiveTree(vm)) { 2192 + return 2193 + } 2194 + } else if (vm._directInactive) { 2195 + return 2196 + } 2197 + if (vm._inactive || vm._inactive == null) { 2198 + vm._inactive = false; 2199 + for (var i = 0; i < vm.$children.length; i++) { 2200 + activateChildComponent(vm.$children[i]); 2201 + } 2202 + callHook(vm, 'activated'); 2203 + } 2204 +} 2205 + 2206 +function deactivateChildComponent (vm, direct) { 2207 + if (direct) { 2208 + vm._directInactive = true; 2209 + if (isInInactiveTree(vm)) { 2210 + return 2211 + } 2212 + } 2213 + if (!vm._inactive) { 2214 + vm._inactive = true; 2215 + for (var i = 0; i < vm.$children.length; i++) { 2216 + deactivateChildComponent(vm.$children[i]); 2217 + } 2218 + callHook(vm, 'deactivated'); 2219 + } 2220 +} 2221 + 2222 +function callHook (vm, hook) { 2223 + var handlers = vm.$options[hook]; 2224 + if (handlers) { 2225 + for (var i = 0, j = handlers.length; i < j; i++) { 2226 + try { 2227 + handlers[i].call(vm); 2228 + } catch (e) { 2229 + handleError(e, vm, (hook + " hook")); 2230 + } 2231 + } 2232 + } 2233 + if (vm._hasHookEvent) { 2234 + vm.$emit('hook:' + hook); 2235 + } 2236 +} 2237 + 2238 +/* */ 2239 + 2240 + 2241 +var queue = []; 2242 +var has = {}; 2243 +var circular = {}; 2244 +var waiting = false; 2245 +var flushing = false; 2246 +var index = 0; 2247 + 2248 +/** 2249 + * Reset the scheduler's state. 2250 + */ 2251 +function resetSchedulerState () { 2252 + queue.length = 0; 2253 + has = {}; 2254 + { 2255 + circular = {}; 2256 + } 2257 + waiting = flushing = false; 2258 +} 2259 + 2260 +/** 2261 + * Flush both queues and run the watchers. 2262 + */ 2263 +function flushSchedulerQueue () { 2264 + flushing = true; 2265 + var watcher, id, vm; 2266 + 2267 + // Sort queue before flush. 2268 + // This ensures that: 2269 + // 1. Components are updated from parent to child. (because parent is always 2270 + // created before the child) 2271 + // 2. A component's user watchers are run before its render watcher (because 2272 + // user watchers are created before the render watcher) 2273 + // 3. If a component is destroyed during a parent component's watcher run, 2274 + // its watchers can be skipped. 2275 + queue.sort(function (a, b) { return a.id - b.id; }); 2276 + 2277 + // do not cache length because more watchers might be pushed 2278 + // as we run existing watchers 2279 + for (index = 0; index < queue.length; index++) { 2280 + watcher = queue[index]; 2281 + id = watcher.id; 2282 + has[id] = null; 2283 + watcher.run(); 2284 + // in dev build, check and stop circular updates. 2285 + if ("development" !== 'production' && has[id] != null) { 2286 + circular[id] = (circular[id] || 0) + 1; 2287 + if (circular[id] > config._maxUpdateCount) { 2288 + warn( 2289 + 'You may have an infinite update loop ' + ( 2290 + watcher.user 2291 + ? ("in watcher with expression \"" + (watcher.expression) + "\"") 2292 + : "in a component render function." 2293 + ), 2294 + watcher.vm 2295 + ); 2296 + break 2297 + } 2298 + } 2299 + } 2300 + 2301 + // call updated hooks 2302 + index = queue.length; 2303 + while (index--) { 2304 + watcher = queue[index]; 2305 + vm = watcher.vm; 2306 + if (vm._watcher === watcher && vm._isMounted) { 2307 + callHook(vm, 'updated'); 2308 + } 2309 + } 2310 + 2311 + // devtool hook 2312 + /* istanbul ignore if */ 2313 + if (devtools && config.devtools) { 2314 + devtools.emit('flush'); 2315 + } 2316 + 2317 + resetSchedulerState(); 2318 +} 2319 + 2320 +/** 2321 + * Push a watcher into the watcher queue. 2322 + * Jobs with duplicate IDs will be skipped unless it's 2323 + * pushed when the queue is being flushed. 2324 + */ 2325 +function queueWatcher (watcher) { 2326 + var id = watcher.id; 2327 + if (has[id] == null) { 2328 + has[id] = true; 2329 + if (!flushing) { 2330 + queue.push(watcher); 2331 + } else { 2332 + // if already flushing, splice the watcher based on its id 2333 + // if already past its id, it will be run next immediately. 2334 + var i = queue.length - 1; 2335 + while (i >= 0 && queue[i].id > watcher.id) { 2336 + i--; 2337 + } 2338 + queue.splice(Math.max(i, index) + 1, 0, watcher); 2339 + } 2340 + // queue the flush 2341 + if (!waiting) { 2342 + waiting = true; 2343 + nextTick(flushSchedulerQueue); 2344 + } 2345 + } 2346 +} 2347 + 2348 +/* */ 2349 + 2350 +var uid$2 = 0; 2351 + 2352 +/** 2353 + * A watcher parses an expression, collects dependencies, 2354 + * and fires callback when the expression value changes. 2355 + * This is used for both the $watch() api and directives. 2356 + */ 2357 +var Watcher = function Watcher ( 2358 + vm, 2359 + expOrFn, 2360 + cb, 2361 + options 2362 +) { 2363 + this.vm = vm; 2364 + vm._watchers.push(this); 2365 + // options 2366 + if (options) { 2367 + this.deep = !!options.deep; 2368 + this.user = !!options.user; 2369 + this.lazy = !!options.lazy; 2370 + this.sync = !!options.sync; 2371 + } else { 2372 + this.deep = this.user = this.lazy = this.sync = false; 2373 + } 2374 + this.cb = cb; 2375 + this.id = ++uid$2; // uid for batching 2376 + this.active = true; 2377 + this.dirty = this.lazy; // for lazy watchers 2378 + this.deps = []; 2379 + this.newDeps = []; 2380 + this.depIds = new _Set(); 2381 + this.newDepIds = new _Set(); 2382 + this.expression = expOrFn.toString(); 2383 + // parse expression for getter 2384 + if (typeof expOrFn === 'function') { 2385 + this.getter = expOrFn; 2386 + } else { 2387 + this.getter = parsePath(expOrFn); 2388 + if (!this.getter) { 2389 + this.getter = function () {}; 2390 + "development" !== 'production' && warn( 2391 + "Failed watching path: \"" + expOrFn + "\" " + 2392 + 'Watcher only accepts simple dot-delimited paths. ' + 2393 + 'For full control, use a function instead.', 2394 + vm 2395 + ); 2396 + } 2397 + } 2398 + this.value = this.lazy 2399 + ? undefined 2400 + : this.get(); 2401 +}; 2402 + 2403 +/** 2404 + * Evaluate the getter, and re-collect dependencies. 2405 + */ 2406 +Watcher.prototype.get = function get () { 2407 + pushTarget(this); 2408 + var value; 2409 + var vm = this.vm; 2410 + if (this.user) { 2411 + try { 2412 + value = this.getter.call(vm, vm); 2413 + } catch (e) { 2414 + handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\"")); 2415 + } 2416 + } else { 2417 + value = this.getter.call(vm, vm); 2418 + } 2419 + // "touch" every property so they are all tracked as 2420 + // dependencies for deep watching 2421 + if (this.deep) { 2422 + traverse(value); 2423 + } 2424 + popTarget(); 2425 + this.cleanupDeps(); 2426 + return value 2427 +}; 2428 + 2429 +/** 2430 + * Add a dependency to this directive. 2431 + */ 2432 +Watcher.prototype.addDep = function addDep (dep) { 2433 + var id = dep.id; 2434 + if (!this.newDepIds.has(id)) { 2435 + this.newDepIds.add(id); 2436 + this.newDeps.push(dep); 2437 + if (!this.depIds.has(id)) { 2438 + dep.addSub(this); 2439 + } 2440 + } 2441 +}; 2442 + 2443 +/** 2444 + * Clean up for dependency collection. 2445 + */ 2446 +Watcher.prototype.cleanupDeps = function cleanupDeps () { 2447 + var this$1 = this; 2448 + 2449 + var i = this.deps.length; 2450 + while (i--) { 2451 + var dep = this$1.deps[i]; 2452 + if (!this$1.newDepIds.has(dep.id)) { 2453 + dep.removeSub(this$1); 2454 + } 2455 + } 2456 + var tmp = this.depIds; 2457 + this.depIds = this.newDepIds; 2458 + this.newDepIds = tmp; 2459 + this.newDepIds.clear(); 2460 + tmp = this.deps; 2461 + this.deps = this.newDeps; 2462 + this.newDeps = tmp; 2463 + this.newDeps.length = 0; 2464 +}; 2465 + 2466 +/** 2467 + * Subscriber interface. 2468 + * Will be called when a dependency changes. 2469 + */ 2470 +Watcher.prototype.update = function update () { 2471 + /* istanbul ignore else */ 2472 + if (this.lazy) { 2473 + this.dirty = true; 2474 + } else if (this.sync) { 2475 + this.run(); 2476 + } else { 2477 + queueWatcher(this); 2478 + } 2479 +}; 2480 + 2481 +/** 2482 + * Scheduler job interface. 2483 + * Will be called by the scheduler. 2484 + */ 2485 +Watcher.prototype.run = function run () { 2486 + if (this.active) { 2487 + var value = this.get(); 2488 + if ( 2489 + value !== this.value || 2490 + // Deep watchers and watchers on Object/Arrays should fire even 2491 + // when the value is the same, because the value may 2492 + // have mutated. 2493 + isObject(value) || 2494 + this.deep 2495 + ) { 2496 + // set new value 2497 + var oldValue = this.value; 2498 + this.value = value; 2499 + if (this.user) { 2500 + try { 2501 + this.cb.call(this.vm, value, oldValue); 2502 + } catch (e) { 2503 + handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\"")); 2504 + } 2505 + } else { 2506 + this.cb.call(this.vm, value, oldValue); 2507 + } 2508 + } 2509 + } 2510 +}; 2511 + 2512 +/** 2513 + * Evaluate the value of the watcher. 2514 + * This only gets called for lazy watchers. 2515 + */ 2516 +Watcher.prototype.evaluate = function evaluate () { 2517 + this.value = this.get(); 2518 + this.dirty = false; 2519 +}; 2520 + 2521 +/** 2522 + * Depend on all deps collected by this watcher. 2523 + */ 2524 +Watcher.prototype.depend = function depend () { 2525 + var this$1 = this; 2526 + 2527 + var i = this.deps.length; 2528 + while (i--) { 2529 + this$1.deps[i].depend(); 2530 + } 2531 +}; 2532 + 2533 +/** 2534 + * Remove self from all dependencies' subscriber list. 2535 + */ 2536 +Watcher.prototype.teardown = function teardown () { 2537 + var this$1 = this; 2538 + 2539 + if (this.active) { 2540 + // remove self from vm's watcher list 2541 + // this is a somewhat expensive operation so we skip it 2542 + // if the vm is being destroyed. 2543 + if (!this.vm._isBeingDestroyed) { 2544 + remove(this.vm._watchers, this); 2545 + } 2546 + var i = this.deps.length; 2547 + while (i--) { 2548 + this$1.deps[i].removeSub(this$1); 2549 + } 2550 + this.active = false; 2551 + } 2552 +}; 2553 + 2554 +/** 2555 + * Recursively traverse an object to evoke all converted 2556 + * getters, so that every nested property inside the object 2557 + * is collected as a "deep" dependency. 2558 + */ 2559 +var seenObjects = new _Set(); 2560 +function traverse (val) { 2561 + seenObjects.clear(); 2562 + _traverse(val, seenObjects); 2563 +} 2564 + 2565 +function _traverse (val, seen) { 2566 + var i, keys; 2567 + var isA = Array.isArray(val); 2568 + if ((!isA && !isObject(val)) || !Object.isExtensible(val)) { 2569 + return 2570 + } 2571 + if (val.__ob__) { 2572 + var depId = val.__ob__.dep.id; 2573 + if (seen.has(depId)) { 2574 + return 2575 + } 2576 + seen.add(depId); 2577 + } 2578 + if (isA) { 2579 + i = val.length; 2580 + while (i--) { _traverse(val[i], seen); } 2581 + } else { 2582 + keys = Object.keys(val); 2583 + i = keys.length; 2584 + while (i--) { _traverse(val[keys[i]], seen); } 2585 + } 2586 +} 2587 + 2588 +/* */ 2589 + 2590 +var sharedPropertyDefinition = { 2591 + enumerable: true, 2592 + configurable: true, 2593 + get: noop, 2594 + set: noop 2595 +}; 2596 + 2597 +function proxy (target, sourceKey, key) { 2598 + sharedPropertyDefinition.get = function proxyGetter () { 2599 + return this[sourceKey][key] 2600 + }; 2601 + sharedPropertyDefinition.set = function proxySetter (val) { 2602 + this[sourceKey][key] = val; 2603 + }; 2604 + Object.defineProperty(target, key, sharedPropertyDefinition); 2605 +} 2606 + 2607 +function initState (vm) { 2608 + vm._watchers = []; 2609 + var opts = vm.$options; 2610 + if (opts.props) { initProps(vm, opts.props); } 2611 + if (opts.methods) { initMethods(vm, opts.methods); } 2612 + if (opts.data) { 2613 + initData(vm); 2614 + } else { 2615 + observe(vm._data = {}, true /* asRootData */); 2616 + } 2617 + if (opts.computed) { initComputed(vm, opts.computed); } 2618 + if (opts.watch) { initWatch(vm, opts.watch); } 2619 +} 2620 + 2621 +var isReservedProp = { key: 1, ref: 1, slot: 1 }; 2622 + 2623 +function initProps (vm, propsOptions) { 2624 + var propsData = vm.$options.propsData || {}; 2625 + var props = vm._props = {}; 2626 + // cache prop keys so that future props updates can iterate using Array 2627 + // instead of dynamic object key enumeration. 2628 + var keys = vm.$options._propKeys = []; 2629 + var isRoot = !vm.$parent; 2630 + // root instance props should be converted 2631 + observerState.shouldConvert = isRoot; 2632 + var loop = function ( key ) { 2633 + keys.push(key); 2634 + var value = validateProp(key, propsOptions, propsData, vm); 2635 + /* istanbul ignore else */ 2636 + { 2637 + if (isReservedProp[key]) { 2638 + warn( 2639 + ("\"" + key + "\" is a reserved attribute and cannot be used as component prop."), 2640 + vm 2641 + ); 2642 + } 2643 + defineReactive$$1(props, key, value, function () { 2644 + if (vm.$parent && !observerState.isSettingProps) { 2645 + warn( 2646 + "Avoid mutating a prop directly since the value will be " + 2647 + "overwritten whenever the parent component re-renders. " + 2648 + "Instead, use a data or computed property based on the prop's " + 2649 + "value. Prop being mutated: \"" + key + "\"", 2650 + vm 2651 + ); 2652 + } 2653 + }); 2654 + } 2655 + // static props are already proxied on the component's prototype 2656 + // during Vue.extend(). We only need to proxy props defined at 2657 + // instantiation here. 2658 + if (!(key in vm)) { 2659 + proxy(vm, "_props", key); 2660 + } 2661 + }; 2662 + 2663 + for (var key in propsOptions) loop( key ); 2664 + observerState.shouldConvert = true; 2665 +} 2666 + 2667 +function initData (vm) { 2668 + var data = vm.$options.data; 2669 + data = vm._data = typeof data === 'function' 2670 + ? data.call(vm) 2671 + : data || {}; 2672 + if (!isPlainObject(data)) { 2673 + data = {}; 2674 + "development" !== 'production' && warn( 2675 + 'data functions should return an object:\n' + 2676 + 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function', 2677 + vm 2678 + ); 2679 + } 2680 + // proxy data on instance 2681 + var keys = Object.keys(data); 2682 + var props = vm.$options.props; 2683 + var i = keys.length; 2684 + while (i--) { 2685 + if (props && hasOwn(props, keys[i])) { 2686 + "development" !== 'production' && warn( 2687 + "The data property \"" + (keys[i]) + "\" is already declared as a prop. " + 2688 + "Use prop default value instead.", 2689 + vm 2690 + ); 2691 + } else if (!isReserved(keys[i])) { 2692 + proxy(vm, "_data", keys[i]); 2693 + } 2694 + } 2695 + // observe data 2696 + observe(data, true /* asRootData */); 2697 +} 2698 + 2699 +var computedWatcherOptions = { lazy: true }; 2700 + 2701 +function initComputed (vm, computed) { 2702 + var watchers = vm._computedWatchers = Object.create(null); 2703 + 2704 + for (var key in computed) { 2705 + var userDef = computed[key]; 2706 + var getter = typeof userDef === 'function' ? userDef : userDef.get; 2707 + // create internal watcher for the computed property. 2708 + watchers[key] = new Watcher(vm, getter, noop, computedWatcherOptions); 2709 + 2710 + // component-defined computed properties are already defined on the 2711 + // component prototype. We only need to define computed properties defined 2712 + // at instantiation here. 2713 + if (!(key in vm)) { 2714 + defineComputed(vm, key, userDef); 2715 + } 2716 + } 2717 +} 2718 + 2719 +function defineComputed (target, key, userDef) { 2720 + if (typeof userDef === 'function') { 2721 + sharedPropertyDefinition.get = createComputedGetter(key); 2722 + sharedPropertyDefinition.set = noop; 2723 + } else { 2724 + sharedPropertyDefinition.get = userDef.get 2725 + ? userDef.cache !== false 2726 + ? createComputedGetter(key) 2727 + : userDef.get 2728 + : noop; 2729 + sharedPropertyDefinition.set = userDef.set 2730 + ? userDef.set 2731 + : noop; 2732 + } 2733 + Object.defineProperty(target, key, sharedPropertyDefinition); 2734 +} 2735 + 2736 +function createComputedGetter (key) { 2737 + return function computedGetter () { 2738 + var watcher = this._computedWatchers && this._computedWatchers[key]; 2739 + if (watcher) { 2740 + if (watcher.dirty) { 2741 + watcher.evaluate(); 2742 + } 2743 + if (Dep.target) { 2744 + watcher.depend(); 2745 + } 2746 + return watcher.value 2747 + } 2748 + } 2749 +} 2750 + 2751 +function initMethods (vm, methods) { 2752 + var props = vm.$options.props; 2753 + for (var key in methods) { 2754 + vm[key] = methods[key] == null ? noop : bind(methods[key], vm); 2755 + { 2756 + if (methods[key] == null) { 2757 + warn( 2758 + "method \"" + key + "\" has an undefined value in the component definition. " + 2759 + "Did you reference the function correctly?", 2760 + vm 2761 + ); 2762 + } 2763 + if (props && hasOwn(props, key)) { 2764 + warn( 2765 + ("method \"" + key + "\" has already been defined as a prop."), 2766 + vm 2767 + ); 2768 + } 2769 + } 2770 + } 2771 +} 2772 + 2773 +function initWatch (vm, watch) { 2774 + for (var key in watch) { 2775 + var handler = watch[key]; 2776 + if (Array.isArray(handler)) { 2777 + for (var i = 0; i < handler.length; i++) { 2778 + createWatcher(vm, key, handler[i]); 2779 + } 2780 + } else { 2781 + createWatcher(vm, key, handler); 2782 + } 2783 + } 2784 +} 2785 + 2786 +function createWatcher (vm, key, handler) { 2787 + var options; 2788 + if (isPlainObject(handler)) { 2789 + options = handler; 2790 + handler = handler.handler; 2791 + } 2792 + if (typeof handler === 'string') { 2793 + handler = vm[handler]; 2794 + } 2795 + vm.$watch(key, handler, options); 2796 +} 2797 + 2798 +function stateMixin (Vue) { 2799 + // flow somehow has problems with directly declared definition object 2800 + // when using Object.defineProperty, so we have to procedurally build up 2801 + // the object here. 2802 + var dataDef = {}; 2803 + dataDef.get = function () { return this._data }; 2804 + var propsDef = {}; 2805 + propsDef.get = function () { return this._props }; 2806 + { 2807 + dataDef.set = function (newData) { 2808 + warn( 2809 + 'Avoid replacing instance root $data. ' + 2810 + 'Use nested data properties instead.', 2811 + this 2812 + ); 2813 + }; 2814 + propsDef.set = function () { 2815 + warn("$props is readonly.", this); 2816 + }; 2817 + } 2818 + Object.defineProperty(Vue.prototype, '$data', dataDef); 2819 + Object.defineProperty(Vue.prototype, '$props', propsDef); 2820 + 2821 + Vue.prototype.$set = set; 2822 + Vue.prototype.$delete = del; 2823 + 2824 + Vue.prototype.$watch = function ( 2825 + expOrFn, 2826 + cb, 2827 + options 2828 + ) { 2829 + var vm = this; 2830 + options = options || {}; 2831 + options.user = true; 2832 + var watcher = new Watcher(vm, expOrFn, cb, options); 2833 + if (options.immediate) { 2834 + cb.call(vm, watcher.value); 2835 + } 2836 + return function unwatchFn () { 2837 + watcher.teardown(); 2838 + } 2839 + }; 2840 +} 2841 + 2842 +/* */ 2843 + 2844 +var hooks = { init: init, prepatch: prepatch, insert: insert, destroy: destroy }; 2845 +var hooksToMerge = Object.keys(hooks); 2846 + 2847 +function createComponent ( 2848 + Ctor, 2849 + data, 2850 + context, 2851 + children, 2852 + tag 2853 +) { 2854 + if (!Ctor) { 2855 + return 2856 + } 2857 + 2858 + var baseCtor = context.$options._base; 2859 + if (isObject(Ctor)) { 2860 + Ctor = baseCtor.extend(Ctor); 2861 + } 2862 + 2863 + if (typeof Ctor !== 'function') { 2864 + { 2865 + warn(("Invalid Component definition: " + (String(Ctor))), context); 2866 + } 2867 + return 2868 + } 2869 + 2870 + // async component 2871 + if (!Ctor.cid) { 2872 + if (Ctor.resolved) { 2873 + Ctor = Ctor.resolved; 2874 + } else { 2875 + Ctor = resolveAsyncComponent(Ctor, baseCtor, function () { 2876 + // it's ok to queue this on every render because 2877 + // $forceUpdate is buffered by the scheduler. 2878 + context.$forceUpdate(); 2879 + }); 2880 + if (!Ctor) { 2881 + // return nothing if this is indeed an async component 2882 + // wait for the callback to trigger parent update. 2883 + return 2884 + } 2885 + } 2886 + } 2887 + 2888 + // resolve constructor options in case global mixins are applied after 2889 + // component constructor creation 2890 + resolveConstructorOptions(Ctor); 2891 + 2892 + data = data || {}; 2893 + 2894 + // transform component v-model data into props & events 2895 + if (data.model) { 2896 + transformModel(Ctor.options, data); 2897 + } 2898 + 2899 + // extract props 2900 + var propsData = extractProps(data, Ctor); 2901 + 2902 + // functional component 2903 + if (Ctor.options.functional) { 2904 + return createFunctionalComponent(Ctor, propsData, data, context, children) 2905 + } 2906 + 2907 + // extract listeners, since these needs to be treated as 2908 + // child component listeners instead of DOM listeners 2909 + var listeners = data.on; 2910 + // replace with listeners with .native modifier 2911 + data.on = data.nativeOn; 2912 + 2913 + if (Ctor.options.abstract) { 2914 + // abstract components do not keep anything 2915 + // other than props & listeners 2916 + data = {}; 2917 + } 2918 + 2919 + // merge component management hooks onto the placeholder node 2920 + mergeHooks(data); 2921 + 2922 + // return a placeholder vnode 2923 + var name = Ctor.options.name || tag; 2924 + var vnode = new VNode( 2925 + ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')), 2926 + data, undefined, undefined, undefined, context, 2927 + { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children } 2928 + ); 2929 + return vnode 2930 +} 2931 + 2932 +function createFunctionalComponent ( 2933 + Ctor, 2934 + propsData, 2935 + data, 2936 + context, 2937 + children 2938 +) { 2939 + var props = {}; 2940 + var propOptions = Ctor.options.props; 2941 + if (propOptions) { 2942 + for (var key in propOptions) { 2943 + props[key] = validateProp(key, propOptions, propsData); 2944 + } 2945 + } 2946 + // ensure the createElement function in functional components 2947 + // gets a unique context - this is necessary for correct named slot check 2948 + var _context = Object.create(context); 2949 + var h = function (a, b, c, d) { return createElement(_context, a, b, c, d, true); }; 2950 + var vnode = Ctor.options.render.call(null, h, { 2951 + props: props, 2952 + data: data, 2953 + parent: context, 2954 + children: children, 2955 + slots: function () { return resolveSlots(children, context); } 2956 + }); 2957 + if (vnode instanceof VNode) { 2958 + vnode.functionalContext = context; 2959 + if (data.slot) { 2960 + (vnode.data || (vnode.data = {})).slot = data.slot; 2961 + } 2962 + } 2963 + return vnode 2964 +} 2965 + 2966 +function createComponentInstanceForVnode ( 2967 + vnode, // we know it's MountedComponentVNode but flow doesn't 2968 + parent, // activeInstance in lifecycle state 2969 + parentElm, 2970 + refElm 2971 +) { 2972 + var vnodeComponentOptions = vnode.componentOptions; 2973 + var options = { 2974 + _isComponent: true, 2975 + parent: parent, 2976 + propsData: vnodeComponentOptions.propsData, 2977 + _componentTag: vnodeComponentOptions.tag, 2978 + _parentVnode: vnode, 2979 + _parentListeners: vnodeComponentOptions.listeners, 2980 + _renderChildren: vnodeComponentOptions.children, 2981 + _parentElm: parentElm || null, 2982 + _refElm: refElm || null 2983 + }; 2984 + // check inline-template render functions 2985 + var inlineTemplate = vnode.data.inlineTemplate; 2986 + if (inlineTemplate) { 2987 + options.render = inlineTemplate.render; 2988 + options.staticRenderFns = inlineTemplate.staticRenderFns; 2989 + } 2990 + return new vnodeComponentOptions.Ctor(options) 2991 +} 2992 + 2993 +function init ( 2994 + vnode, 2995 + hydrating, 2996 + parentElm, 2997 + refElm 2998 +) { 2999 + if (!vnode.componentInstance || vnode.componentInstance._isDestroyed) { 3000 + var child = vnode.componentInstance = createComponentInstanceForVnode( 3001 + vnode, 3002 + activeInstance, 3003 + parentElm, 3004 + refElm 3005 + ); 3006 + child.$mount(hydrating ? vnode.elm : undefined, hydrating); 3007 + } else if (vnode.data.keepAlive) { 3008 + // kept-alive components, treat as a patch 3009 + var mountedNode = vnode; // work around flow 3010 + prepatch(mountedNode, mountedNode); 3011 + } 3012 +} 3013 + 3014 +function prepatch ( 3015 + oldVnode, 3016 + vnode 3017 +) { 3018 + var options = vnode.componentOptions; 3019 + var child = vnode.componentInstance = oldVnode.componentInstance; 3020 + updateChildComponent( 3021 + child, 3022 + options.propsData, // updated props 3023 + options.listeners, // updated listeners 3024 + vnode, // new parent vnode 3025 + options.children // new children 3026 + ); 3027 +} 3028 + 3029 +function insert (vnode) { 3030 + if (!vnode.componentInstance._isMounted) { 3031 + vnode.componentInstance._isMounted = true; 3032 + callHook(vnode.componentInstance, 'mounted'); 3033 + } 3034 + if (vnode.data.keepAlive) { 3035 + activateChildComponent(vnode.componentInstance, true /* direct */); 3036 + } 3037 +} 3038 + 3039 +function destroy (vnode) { 3040 + if (!vnode.componentInstance._isDestroyed) { 3041 + if (!vnode.data.keepAlive) { 3042 + vnode.componentInstance.$destroy(); 3043 + } else { 3044 + deactivateChildComponent(vnode.componentInstance, true /* direct */); 3045 + } 3046 + } 3047 +} 3048 + 3049 +function resolveAsyncComponent ( 3050 + factory, 3051 + baseCtor, 3052 + cb 3053 +) { 3054 + if (factory.requested) { 3055 + // pool callbacks 3056 + factory.pendingCallbacks.push(cb); 3057 + } else { 3058 + factory.requested = true; 3059 + var cbs = factory.pendingCallbacks = [cb]; 3060 + var sync = true; 3061 + 3062 + var resolve = function (res) { 3063 + if (isObject(res)) { 3064 + res = baseCtor.extend(res); 3065 + } 3066 + // cache resolved 3067 + factory.resolved = res; 3068 + // invoke callbacks only if this is not a synchronous resolve 3069 + // (async resolves are shimmed as synchronous during SSR) 3070 + if (!sync) { 3071 + for (var i = 0, l = cbs.length; i < l; i++) { 3072 + cbs[i](res); 3073 + } 3074 + } 3075 + }; 3076 + 3077 + var reject = function (reason) { 3078 + "development" !== 'production' && warn( 3079 + "Failed to resolve async component: " + (String(factory)) + 3080 + (reason ? ("\nReason: " + reason) : '') 3081 + ); 3082 + }; 3083 + 3084 + var res = factory(resolve, reject); 3085 + 3086 + // handle promise 3087 + if (res && typeof res.then === 'function' && !factory.resolved) { 3088 + res.then(resolve, reject); 3089 + } 3090 + 3091 + sync = false; 3092 + // return in case resolved synchronously 3093 + return factory.resolved 3094 + } 3095 +} 3096 + 3097 +function extractProps (data, Ctor) { 3098 + // we are only extracting raw values here. 3099 + // validation and default values are handled in the child 3100 + // component itself. 3101 + var propOptions = Ctor.options.props; 3102 + if (!propOptions) { 3103 + return 3104 + } 3105 + var res = {}; 3106 + var attrs = data.attrs; 3107 + var props = data.props; 3108 + var domProps = data.domProps; 3109 + if (attrs || props || domProps) { 3110 + for (var key in propOptions) { 3111 + var altKey = hyphenate(key); 3112 + checkProp(res, props, key, altKey, true) || 3113 + checkProp(res, attrs, key, altKey) || 3114 + checkProp(res, domProps, key, altKey); 3115 + } 3116 + } 3117 + return res 3118 +} 3119 + 3120 +function checkProp ( 3121 + res, 3122 + hash, 3123 + key, 3124 + altKey, 3125 + preserve 3126 +) { 3127 + if (hash) { 3128 + if (hasOwn(hash, key)) { 3129 + res[key] = hash[key]; 3130 + if (!preserve) { 3131 + delete hash[key]; 3132 + } 3133 + return true 3134 + } else if (hasOwn(hash, altKey)) { 3135 + res[key] = hash[altKey]; 3136 + if (!preserve) { 3137 + delete hash[altKey]; 3138 + } 3139 + return true 3140 + } 3141 + } 3142 + return false 3143 +} 3144 + 3145 +function mergeHooks (data) { 3146 + if (!data.hook) { 3147 + data.hook = {}; 3148 + } 3149 + for (var i = 0; i < hooksToMerge.length; i++) { 3150 + var key = hooksToMerge[i]; 3151 + var fromParent = data.hook[key]; 3152 + var ours = hooks[key]; 3153 + data.hook[key] = fromParent ? mergeHook$1(ours, fromParent) : ours; 3154 + } 3155 +} 3156 + 3157 +function mergeHook$1 (one, two) { 3158 + return function (a, b, c, d) { 3159 + one(a, b, c, d); 3160 + two(a, b, c, d); 3161 + } 3162 +} 3163 + 3164 +// transform component v-model info (value and callback) into 3165 +// prop and event handler respectively. 3166 +function transformModel (options, data) { 3167 + var prop = (options.model && options.model.prop) || 'value'; 3168 + var event = (options.model && options.model.event) || 'input';(data.props || (data.props = {}))[prop] = data.model.value; 3169 + var on = data.on || (data.on = {}); 3170 + if (on[event]) { 3171 + on[event] = [data.model.callback].concat(on[event]); 3172 + } else { 3173 + on[event] = data.model.callback; 3174 + } 3175 +} 3176 + 3177 +/* */ 3178 + 3179 +var SIMPLE_NORMALIZE = 1; 3180 +var ALWAYS_NORMALIZE = 2; 3181 + 3182 +// wrapper function for providing a more flexible interface 3183 +// without getting yelled at by flow 3184 +function createElement ( 3185 + context, 3186 + tag, 3187 + data, 3188 + children, 3189 + normalizationType, 3190 + alwaysNormalize 3191 +) { 3192 + if (Array.isArray(data) || isPrimitive(data)) { 3193 + normalizationType = children; 3194 + children = data; 3195 + data = undefined; 3196 + } 3197 + if (alwaysNormalize) { normalizationType = ALWAYS_NORMALIZE; } 3198 + return _createElement(context, tag, data, children, normalizationType) 3199 +} 3200 + 3201 +function _createElement ( 3202 + context, 3203 + tag, 3204 + data, 3205 + children, 3206 + normalizationType 3207 +) { 3208 + if (data && data.__ob__) { 3209 + "development" !== 'production' && warn( 3210 + "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" + 3211 + 'Always create fresh vnode data objects in each render!', 3212 + context 3213 + ); 3214 + return createEmptyVNode() 3215 + } 3216 + if (!tag) { 3217 + // in case of component :is set to falsy value 3218 + return createEmptyVNode() 3219 + } 3220 + // support single function children as default scoped slot 3221 + if (Array.isArray(children) && 3222 + typeof children[0] === 'function') { 3223 + data = data || {}; 3224 + data.scopedSlots = { default: children[0] }; 3225 + children.length = 0; 3226 + } 3227 + if (normalizationType === ALWAYS_NORMALIZE) { 3228 + children = normalizeChildren(children); 3229 + } else if (normalizationType === SIMPLE_NORMALIZE) { 3230 + children = simpleNormalizeChildren(children); 3231 + } 3232 + var vnode, ns; 3233 + if (typeof tag === 'string') { 3234 + var Ctor; 3235 + ns = config.getTagNamespace(tag); 3236 + if (config.isReservedTag(tag)) { 3237 + // platform built-in elements 3238 + vnode = new VNode( 3239 + config.parsePlatformTagName(tag), data, children, 3240 + undefined, undefined, context 3241 + ); 3242 + } else if ((Ctor = resolveAsset(context.$options, 'components', tag))) { 3243 + // component 3244 + vnode = createComponent(Ctor, data, context, children, tag); 3245 + } else { 3246 + // unknown or unlisted namespaced elements 3247 + // check at runtime because it may get assigned a namespace when its 3248 + // parent normalizes children 3249 + vnode = new VNode( 3250 + tag, data, children, 3251 + undefined, undefined, context 3252 + ); 3253 + } 3254 + } else { 3255 + // direct component options / constructor 3256 + vnode = createComponent(tag, data, context, children); 3257 + } 3258 + if (vnode) { 3259 + if (ns) { applyNS(vnode, ns); } 3260 + return vnode 3261 + } else { 3262 + return createEmptyVNode() 3263 + } 3264 +} 3265 + 3266 +function applyNS (vnode, ns) { 3267 + vnode.ns = ns; 3268 + if (vnode.tag === 'foreignObject') { 3269 + // use default namespace inside foreignObject 3270 + return 3271 + } 3272 + if (vnode.children) { 3273 + for (var i = 0, l = vnode.children.length; i < l; i++) { 3274 + var child = vnode.children[i]; 3275 + if (child.tag && !child.ns) { 3276 + applyNS(child, ns); 3277 + } 3278 + } 3279 + } 3280 +} 3281 + 3282 +/* */ 3283 + 3284 +/** 3285 + * Runtime helper for rendering v-for lists. 3286 + */ 3287 +function renderList ( 3288 + val, 3289 + render 3290 +) { 3291 + var ret, i, l, keys, key; 3292 + if (Array.isArray(val) || typeof val === 'string') { 3293 + ret = new Array(val.length); 3294 + for (i = 0, l = val.length; i < l; i++) { 3295 + ret[i] = render(val[i], i); 3296 + } 3297 + } else if (typeof val === 'number') { 3298 + ret = new Array(val); 3299 + for (i = 0; i < val; i++) { 3300 + ret[i] = render(i + 1, i); 3301 + } 3302 + } else if (isObject(val)) { 3303 + keys = Object.keys(val); 3304 + ret = new Array(keys.length); 3305 + for (i = 0, l = keys.length; i < l; i++) { 3306 + key = keys[i]; 3307 + ret[i] = render(val[key], key, i); 3308 + } 3309 + } 3310 + return ret 3311 +} 3312 + 3313 +/* */ 3314 + 3315 +/** 3316 + * Runtime helper for rendering <slot> 3317 + */ 3318 +function renderSlot ( 3319 + name, 3320 + fallback, 3321 + props, 3322 + bindObject 3323 +) { 3324 + var scopedSlotFn = this.$scopedSlots[name]; 3325 + if (scopedSlotFn) { // scoped slot 3326 + props = props || {}; 3327 + if (bindObject) { 3328 + extend(props, bindObject); 3329 + } 3330 + return scopedSlotFn(props) || fallback 3331 + } else { 3332 + var slotNodes = this.$slots[name]; 3333 + // warn duplicate slot usage 3334 + if (slotNodes && "development" !== 'production') { 3335 + slotNodes._rendered && warn( 3336 + "Duplicate presence of slot \"" + name + "\" found in the same render tree " + 3337 + "- this will likely cause render errors.", 3338 + this 3339 + ); 3340 + slotNodes._rendered = true; 3341 + } 3342 + return slotNodes || fallback 3343 + } 3344 +} 3345 + 3346 +/* */ 3347 + 3348 +/** 3349 + * Runtime helper for resolving filters 3350 + */ 3351 +function resolveFilter (id) { 3352 + return resolveAsset(this.$options, 'filters', id, true) || identity 3353 +} 3354 + 3355 +/* */ 3356 + 3357 +/** 3358 + * Runtime helper for checking keyCodes from config. 3359 + */ 3360 +function checkKeyCodes ( 3361 + eventKeyCode, 3362 + key, 3363 + builtInAlias 3364 +) { 3365 + var keyCodes = config.keyCodes[key] || builtInAlias; 3366 + if (Array.isArray(keyCodes)) { 3367 + return keyCodes.indexOf(eventKeyCode) === -1 3368 + } else { 3369 + return keyCodes !== eventKeyCode 3370 + } 3371 +} 3372 + 3373 +/* */ 3374 + 3375 +/** 3376 + * Runtime helper for merging v-bind="object" into a VNode's data. 3377 + */ 3378 +function bindObjectProps ( 3379 + data, 3380 + tag, 3381 + value, 3382 + asProp 3383 +) { 3384 + if (value) { 3385 + if (!isObject(value)) { 3386 + "development" !== 'production' && warn( 3387 + 'v-bind without argument expects an Object or Array value', 3388 + this 3389 + ); 3390 + } else { 3391 + if (Array.isArray(value)) { 3392 + value = toObject(value); 3393 + } 3394 + for (var key in value) { 3395 + if (key === 'class' || key === 'style') { 3396 + data[key] = value[key]; 3397 + } else { 3398 + var type = data.attrs && data.attrs.type; 3399 + var hash = asProp || config.mustUseProp(tag, type, key) 3400 + ? data.domProps || (data.domProps = {}) 3401 + : data.attrs || (data.attrs = {}); 3402 + hash[key] = value[key]; 3403 + } 3404 + } 3405 + } 3406 + } 3407 + return data 3408 +} 3409 + 3410 +/* */ 3411 + 3412 +/** 3413 + * Runtime helper for rendering static trees. 3414 + */ 3415 +function renderStatic ( 3416 + index, 3417 + isInFor 3418 +) { 3419 + var tree = this._staticTrees[index]; 3420 + // if has already-rendered static tree and not inside v-for, 3421 + // we can reuse the same tree by doing a shallow clone. 3422 + if (tree && !isInFor) { 3423 + return Array.isArray(tree) 3424 + ? cloneVNodes(tree) 3425 + : cloneVNode(tree) 3426 + } 3427 + // otherwise, render a fresh tree. 3428 + tree = this._staticTrees[index] = 3429 + this.$options.staticRenderFns[index].call(this._renderProxy); 3430 + markStatic(tree, ("__static__" + index), false); 3431 + return tree 3432 +} 3433 + 3434 +/** 3435 + * Runtime helper for v-once. 3436 + * Effectively it means marking the node as static with a unique key. 3437 + */ 3438 +function markOnce ( 3439 + tree, 3440 + index, 3441 + key 3442 +) { 3443 + markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true); 3444 + return tree 3445 +} 3446 + 3447 +function markStatic ( 3448 + tree, 3449 + key, 3450 + isOnce 3451 +) { 3452 + if (Array.isArray(tree)) { 3453 + for (var i = 0; i < tree.length; i++) { 3454 + if (tree[i] && typeof tree[i] !== 'string') { 3455 + markStaticNode(tree[i], (key + "_" + i), isOnce); 3456 + } 3457 + } 3458 + } else { 3459 + markStaticNode(tree, key, isOnce); 3460 + } 3461 +} 3462 + 3463 +function markStaticNode (node, key, isOnce) { 3464 + node.isStatic = true; 3465 + node.key = key; 3466 + node.isOnce = isOnce; 3467 +} 3468 + 3469 +/* */ 3470 + 3471 +function initRender (vm) { 3472 + vm.$vnode = null; // the placeholder node in parent tree 3473 + vm._vnode = null; // the root of the child tree 3474 + vm._staticTrees = null; 3475 + var parentVnode = vm.$options._parentVnode; 3476 + var renderContext = parentVnode && parentVnode.context; 3477 + vm.$slots = resolveSlots(vm.$options._renderChildren, renderContext); 3478 + vm.$scopedSlots = emptyObject; 3479 + // bind the createElement fn to this instance 3480 + // so that we get proper render context inside it. 3481 + // args order: tag, data, children, normalizationType, alwaysNormalize 3482 + // internal version is used by render functions compiled from templates 3483 + vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); }; 3484 + // normalization is always applied for the public version, used in 3485 + // user-written render functions. 3486 + vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); }; 3487 +} 3488 + 3489 +function renderMixin (Vue) { 3490 + Vue.prototype.$nextTick = function (fn) { 3491 + return nextTick(fn, this) 3492 + }; 3493 + 3494 + Vue.prototype._render = function () { 3495 + var vm = this; 3496 + var ref = vm.$options; 3497 + var render = ref.render; 3498 + var staticRenderFns = ref.staticRenderFns; 3499 + var _parentVnode = ref._parentVnode; 3500 + 3501 + if (vm._isMounted) { 3502 + // clone slot nodes on re-renders 3503 + for (var key in vm.$slots) { 3504 + vm.$slots[key] = cloneVNodes(vm.$slots[key]); 3505 + } 3506 + } 3507 + 3508 + vm.$scopedSlots = (_parentVnode && _parentVnode.data.scopedSlots) || emptyObject; 3509 + 3510 + if (staticRenderFns && !vm._staticTrees) { 3511 + vm._staticTrees = []; 3512 + } 3513 + // set parent vnode. this allows render functions to have access 3514 + // to the data on the placeholder node. 3515 + vm.$vnode = _parentVnode; 3516 + // render self 3517 + var vnode; 3518 + try { 3519 + vnode = render.call(vm._renderProxy, vm.$createElement); 3520 + } catch (e) { 3521 + handleError(e, vm, "render function"); 3522 + // return error render result, 3523 + // or previous vnode to prevent render error causing blank component 3524 + /* istanbul ignore else */ 3525 + { 3526 + vnode = vm.$options.renderError 3527 + ? vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e) 3528 + : vm._vnode; 3529 + } 3530 + } 3531 + // return empty vnode in case the render function errored out 3532 + if (!(vnode instanceof VNode)) { 3533 + if ("development" !== 'production' && Array.isArray(vnode)) { 3534 + warn( 3535 + 'Multiple root nodes returned from render function. Render function ' + 3536 + 'should return a single root node.', 3537 + vm 3538 + ); 3539 + } 3540 + vnode = createEmptyVNode(); 3541 + } 3542 + // set parent 3543 + vnode.parent = _parentVnode; 3544 + return vnode 3545 + }; 3546 + 3547 + // internal render helpers. 3548 + // these are exposed on the instance prototype to reduce generated render 3549 + // code size. 3550 + Vue.prototype._o = markOnce; 3551 + Vue.prototype._n = toNumber; 3552 + Vue.prototype._s = _toString; 3553 + Vue.prototype._l = renderList; 3554 + Vue.prototype._t = renderSlot; 3555 + Vue.prototype._q = looseEqual; 3556 + Vue.prototype._i = looseIndexOf; 3557 + Vue.prototype._m = renderStatic; 3558 + Vue.prototype._f = resolveFilter; 3559 + Vue.prototype._k = checkKeyCodes; 3560 + Vue.prototype._b = bindObjectProps; 3561 + Vue.prototype._v = createTextVNode; 3562 + Vue.prototype._e = createEmptyVNode; 3563 + Vue.prototype._u = resolveScopedSlots; 3564 +} 3565 + 3566 +/* */ 3567 + 3568 +function initInjections (vm) { 3569 + var provide = vm.$options.provide; 3570 + var inject = vm.$options.inject; 3571 + if (provide) { 3572 + vm._provided = typeof provide === 'function' 3573 + ? provide.call(vm) 3574 + : provide; 3575 + } 3576 + if (inject) { 3577 + // inject is :any because flow is not smart enough to figure out cached 3578 + // isArray here 3579 + var isArray = Array.isArray(inject); 3580 + var keys = isArray 3581 + ? inject 3582 + : hasSymbol 3583 + ? Reflect.ownKeys(inject) 3584 + : Object.keys(inject); 3585 + 3586 + for (var i = 0; i < keys.length; i++) { 3587 + var key = keys[i]; 3588 + var provideKey = isArray ? key : inject[key]; 3589 + var source = vm; 3590 + while (source) { 3591 + if (source._provided && source._provided[provideKey]) { 3592 + vm[key] = source._provided[provideKey]; 3593 + break 3594 + } 3595 + source = source.$parent; 3596 + } 3597 + } 3598 + } 3599 +} 3600 + 3601 +/* */ 3602 + 3603 +var uid = 0; 3604 + 3605 +function initMixin (Vue) { 3606 + Vue.prototype._init = function (options) { 3607 + /* istanbul ignore if */ 3608 + if ("development" !== 'production' && config.performance && perf) { 3609 + perf.mark('init'); 3610 + } 3611 + 3612 + var vm = this; 3613 + // a uid 3614 + vm._uid = uid++; 3615 + // a flag to avoid this being observed 3616 + vm._isVue = true; 3617 + // merge options 3618 + if (options && options._isComponent) { 3619 + // optimize internal component instantiation 3620 + // since dynamic options merging is pretty slow, and none of the 3621 + // internal component options needs special treatment. 3622 + initInternalComponent(vm, options); 3623 + } else { 3624 + vm.$options = mergeOptions( 3625 + resolveConstructorOptions(vm.constructor), 3626 + options || {}, 3627 + vm 3628 + ); 3629 + } 3630 + /* istanbul ignore else */ 3631 + { 3632 + initProxy(vm); 3633 + } 3634 + // expose real self 3635 + vm._self = vm; 3636 + initLifecycle(vm); 3637 + initEvents(vm); 3638 + initRender(vm); 3639 + callHook(vm, 'beforeCreate'); 3640 + initState(vm); 3641 + initInjections(vm); 3642 + callHook(vm, 'created'); 3643 + 3644 + /* istanbul ignore if */ 3645 + if ("development" !== 'production' && config.performance && perf) { 3646 + vm._name = formatComponentName(vm, false); 3647 + perf.mark('init end'); 3648 + perf.measure(((vm._name) + " init"), 'init', 'init end'); 3649 + } 3650 + 3651 + if (vm.$options.el) { 3652 + vm.$mount(vm.$options.el); 3653 + } 3654 + }; 3655 +} 3656 + 3657 +function initInternalComponent (vm, options) { 3658 + var opts = vm.$options = Object.create(vm.constructor.options); 3659 + /