text: (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var util=require("../util");var record_1=require("@quenk/noni/lib/data/record");var future_1=require("@quenk/noni/lib/control/monad/future");var string_1=require("@quenk/noni/lib/data/string");var request_1=require("../request");exports.defaultOptions={ttl:0,tags:{},context:{}};var Agent=function(){function Agent(host,headers,cookies,options,transport,plugins){this.host=host;this.headers=headers;this.cookies=cookies;this.options=options;this.transport=transport;this.plugins=plugins}Agent.prototype.setTransport=function(transport,plugins){if(plugins===void 0){plugins=[]}var _a=this,host=_a.host,headers=_a.headers,cookies=_a.cookies,options=_a.options;return new Agent(host,headers,cookies,options,transport,plugins)};Agent.prototype.head=function(path,params,headers){if(params===void 0){params={}}if(headers===void 0){headers={}}return this.send(new request_1.Head(path,params,headers))};Agent.prototype.get=function(path,params,headers){if(params===void 0){params={}}if(headers===void 0){headers={}}return this.send(new request_1.Get(path,params,headers))};Agent.prototype.post=function(path,body,headers){if(headers===void 0){headers={}}return this.send(new request_1.Post(path,body,headers))};Agent.prototype.put=function(path,body,headers){if(headers===void 0){headers={}}return this.send(new request_1.Put(path,body,headers))};Agent.prototype.patch=function(path,body,headers){if(headers===void 0){headers={}}return this.send(new request_1.Patch(path,body,headers))};Agent.prototype.delete=function(path,body,headers){return this.send(new request_1.Delete(path,body,headers))};Agent.prototype.send=function(req){var _a=this,host=_a.host,cookies=_a.cookies,headers=_a.headers,transport=_a.transport,plugins=_a.plugins;var options=record_1.rmerge3(exports.defaultOptions,this.options,req.options);var port=options.port;var method=req.method,params=req.params,body=req.body;var tags=options.tags,context=options.context,ttl=options.ttl;var path=util.urlFromString(string_1.interpolate(req.path,context),params);var ctx={host:host,port:port,method:method,path:path,body:body,headers:headers,cookies:cookies,options:{ttl:ttl,tags:tags,context:context}};var ft=plugins.reduce(function(f,p){return f.chain(function(c){return p.beforeRequest(c)})},future_1.pure(ctx));return ft.chain(function(ctx){return transport.send(ctx)}).chain(function(r){return plugins.reduce(function(f,p){return f.chain(function(res){return p.afterResponse(res)})},future_1.pure(r))})};return Agent}();exports.Agent=Agent},{"../request":9,"../util":13,"@quenk/noni/lib/control/monad/future":20,"@quenk/noni/lib/data/record":26,"@quenk/noni/lib/data/string":28}],2:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var error_1=require("@quenk/noni/lib/control/error");var JSONParser=function(){function JSONParser(prefix){if(prefix===void 0){prefix=/^\)\]\}',?\n/}this.prefix=prefix;this.responseType="";this.accepts="application/json"}JSONParser.prototype.apply=function(body){var _this=this;return error_1.attempt(function(){if(body==null||body.trim()=="")return{};return JSON.parse(body.replace(_this.prefix,""))})};return JSONParser}();exports.JSONParser=JSONParser},{"@quenk/noni/lib/control/error":19}],3:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var util=require("../../util");var error_1=require("@quenk/noni/lib/control/error");var JSONTransform=function(){function JSONTransform(){this.type="application/json;charset=utf-8"}JSONTransform.prototype.apply=function(body){return error_1.attempt(function(){return util.isObject(body)&&!util.isFile(body)&&!util.isBlob(body)&&!util.isFormData(body)?JSON.stringify(body):""+body})};return JSONTransform}();exports.JSONTransform=JSONTransform},{"../../util":13,"@quenk/noni/lib/control/error":19}],4:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var future_1=require("@quenk/noni/lib/control/monad/future");var header_1=require("../../header");var response_1=require("../../response");var method_1=require("../../request/method");var headers_1=require("../../headers");var XHRTransport=function(){function XHRTransport(responseType,transform,parser){if(responseType===void 0){responseType=""}this.responseType=responseType;this.transform=transform;this.parser=parser}XHRTransport.prototype.send=function(ctx){var _this=this;var _a=this,parser=_a.parser,transform=_a.transform;var host=ctx.host,port=ctx.port,path=ctx.path,method=ctx.method,body=ctx.body,headers=ctx.headers,options=ctx.options,cookies=ctx.cookies;var xhr=new XMLHttpRequest;var portNumer=port&&port!==80&&port!==443?":"+port:"";var url=""+host+portNumer+(path[0]==="/"?"":"/")+path;return new future_1.Run(function(s){var transBody=undefined;if(body!=null){var exceptBody=transform.apply(body);if(exceptBody.isLeft()){s.onError(new Error(exceptBody.takeLeft().message));return function(){}}else{transBody=exceptBody.takeRight()}}xhr.open(method,url,true);xhr.onload=function(){cookies.update(document.cookie);var exceptRes=parser.apply(xhr.response);if(exceptRes.isLeft()){s.onError(new Error(exceptRes.takeLeft().message))}else{var r=response_1.createResponse(xhr.status,exceptRes.takeRight(),header_1.fromString(xhr.getAllResponseHeaders()),options);s.onSuccess(r)}};xhr.timeout=options.ttl;xhr.responseType=_this.responseType;xhr.onerror=function(){return s.onError(new Error("TransportError"))};xhr.onabort=function(){return s.onError(new Error("AbortError"))};Object.keys(headers).forEach(function(k){xhr.setRequestHeader(k,headers[k])});if(method===method_1.Method.Get||method===method_1.Method.Head)xhr.setRequestHeader(headers_1.ACCEPTS,parser.accepts);else if(transform.type!=="multipart/form-data")xhr.setRequestHeader(headers_1.CONTENT_TYPE,transform.type);xhr.send(transBody);return function(){return xhr.abort()}})};return XHRTransport}();exports.XHRTransport=XHRTransport},{"../../header":7,"../../headers":8,"../../request/method":10,"../../response":11,"@quenk/noni/lib/control/monad/future":20}],5:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var memory_1=require("./cookie/container/memory");var json_1=require("./agent/transform/json");var json_2=require("./agent/parser/json");var xhr_1=require("./agent/transport/xhr");var request_1=require("./request");var agent_1=require("./agent");var HTTP="http://";var HTTPS="https://";exports.splitUrl=function(url){var split=url.split(HTTP).join("").split(HTTPS).join("").split("/");if(split.length===1||split.length===2&&split[1]==="")return[split[0],"/"];return[split[0],"/"+split.slice(1).join("/")]};exports.createAgent=function(host,port){if(host===void 0){host=getHost()}if(port===void 0){port=getPort()}return new agent_1.Agent(host,{},new memory_1.MemoryContainer,{ttl:0,tags:{},context:{},port:port},new xhr_1.XHRTransport("",new json_1.JSONTransform,new json_2.JSONParser),[])};var getHost=function(){return window.location.protocol+"//"+window.location.hostname};var getPort=function(){var port=window.location.port;return Number(port===""||port==null?80:port)};exports.get=function(url,params,headers){if(params===void 0){params={}}if(headers===void 0){headers={}}var _a=exports.splitUrl(url),host=_a[0],path=_a[1];return exports.createAgent(host).send(new request_1.Get(path,params,headers))}},{"./agent":1,"./agent/parser/json":2,"./agent/transform/json":3,"./agent/transport/xhr":4,"./cookie/container/memory":6,"./request":9}],6:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var _defaults={expires:365,domain:"",path:"/",secure:true,httpOnly:false};var MemoryContainer=function(){function MemoryContainer(cookies,defaults){if(cookies===void 0){cookies=""}if(defaults===void 0){defaults=_defaults}this.cookies=cookies;this.defaults=defaults}MemoryContainer.prototype.set=function(name,value,opts){if(opts===void 0){opts={}}var defaults=this.defaults;var expires=opts.expires||defaults.expires;var domain=opts.domain||defaults.domain;var path=opts.path!==undefined?opts.path:defaults.path!==undefined?defaults.path:"/";var secure=opts.secure!==undefined?opts.secure:defaults.secure;var httpOnly=opts.httpOnly!==undefined?opts.httpOnly:defaults.httpOnly;var expDate=new Date((new Date).getTime()+expires*864e5);this.cookies=name.replace(/[^+#$&^`|]/g,encodeURIComponent).replace("(","%28").replace(")","%29")+"="+value.replace(/[^+#$&/:<-\[\]-}]/g,encodeURIComponent)+(expDate.getTime()>=0?";expires="+expDate.toUTCString():"")+(domain?";domain="+domain:"")+(path?";path="+path:"")+(secure?";secure":"")+(httpOnly?";httponly":"");return this};MemoryContainer.prototype.update=function(cookies){this.cookies=cookies;return this};MemoryContainer.prototype.get=function(name){return this.getCookie(name)};MemoryContainer.prototype.getCookie=function(name){var cookies=this.cookies.split(";");for(var i=0;i<cookies.length;i++){var cookie=cookies[i];var cookieLength=cookie.length;var separatorIndex=cookie.indexOf("=");separatorIndex=separatorIndex<0?cookieLength:separatorIndex;if(decodeURIComponent(cookie.substring(0,separatorIndex).replace(/^\s+|\s+$/g,""))===name){return decodeURIComponent(cookie.substring(separatorIndex+1,cookieLength))}}return""};MemoryContainer.prototype.getAll=function(){var _this=this;var o={};this.cookies.replace(/((?:^|\s*;)[^\=]+)(?=;|$)|^\s*|\s*(?:\=[^;]*)?(?:\1|$)/g,"").split(/\s*(?:\=[^;]*)?;\s*/).forEach(function(k){o[k]=_this.getCookie(k)});return o};MemoryContainer.prototype.getString=function(){return this.cookies};return MemoryContainer}();exports.MemoryContainer=MemoryContainer},{}],7:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.fromString=function(headers){if(!headers)return{};var result={};headers.trim().split("\n").forEach(function(row){var index=row.indexOf(":");var key=row.slice(0,index).toLowerCase().trim();var value=row.slice(index+1).trim();if(typeof result[key]==="undefined"){result[key]=value}else if(Array.isArray(result[key])){result[key].push(value)}else{result[key]=[result[key],value]}});return result};exports.set=function(xhr){var args=[];for(var _i=1;_i<arguments.length;_i++){args[_i-1]=arguments[_i]}var i=args.length;if(args.length>0)while(i--)if(i!==0)Object.keys(args[i]).forEach(function(k){if(args[i][k]!=null)xhr.setRequestHeader(k,args[i][k])})}},{}],8:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.CONTENT_TYPE="Content-Type";exports.ACCEPTS="Accept"},{}],9:[function(require,module,exports){"use strict";var __extends=this&&this.__extends||function(){var extendStatics=function(d,b){extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(b.hasOwnProperty(p))d[p]=b[p]};return extendStatics(d,b)};return function(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}();Object.defineProperty(exports,"__esModule",{value:true});var method_1=require("./method");var Head=function(){function Head(path,params,headers,options){if(headers===void 0){headers={}}if(options===void 0){options={ttl:0,tags:{},context:{}}}this.path=path;this.params=params;this.headers=headers;this.options=options;this.method=method_1.Method.Head}return Head}();exports.Head=Head;var Get=function(_super){__extends(Get,_super);function Get(){var _this=_super!==null&&_super.apply(this,arguments)||this;_this.method=method_1.Method.Get;return _this}return Get}(Head);exports.Get=Get;var Post=function(){function Post(path,body,headers,options){if(headers===void 0){headers={}}if(options===void 0){options={ttl:0,tags:{},context:{}}}this.path=path;this.body=body;this.headers=headers;this.options=options;this.method=method_1.Method.Post}return Post}();exports.Post=Post;var Put=function(_super){__extends(Put,_super);function Put(){var _this=_super!==null&&_super.apply(this,arguments)||this;_this.method=method_1.Method.Put;return _this}return Put}(Post);exports.Put=Put;var Patch=function(_super){__extends(Patch,_super);function Patch(){var _this=_super!==null&&_super.apply(this,arguments)||this;_this.method=method_1.Method.Patch;return _this}return Patch}(Post);exports.Patch=Patch;var Delete=function(_super){__extends(Delete,_super);function Delete(){var _this=_super!==null&&_super.apply(this,arguments)||this;_this.method=method_1.Method.Delete;return _this}return Delete}(Post);exports.Delete=Delete},{"./method":10}],10:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var Method;(function(Method){Method["Head"]="HEAD";Method["Get"]="GET";Method["Put"]="PUT";Method["Post"]="POST";Method["Delete"]="DELETE";Method["Patch"]="PATCH"})(Method=exports.Method||(exports.Method={}))},{}],11:[function(require,module,exports){"use strict";var __extends=this&&this.__extends||function(){var extendStatics=function(d,b){extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(b.hasOwnProperty(p))d[p]=b[p]};return extendStatics(d,b)};return function(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}();Object.defineProperty(exports,"__esModule",{value:true});var status=require("./status");var GenericResponse=function(){function GenericResponse(code,body,headers,options){this.code=code;this.body=body;this.headers=headers;this.options=options}return GenericResponse}();exports.GenericResponse=GenericResponse;var Success=function(_super){__extends(Success,_super);function Success(){return _super!==null&&_super.apply(this,arguments)||this}return Success}(GenericResponse);exports.Success=Success;var Ok=function(_super){__extends(Ok,_super);function Ok(body,headers,options){var _this=_super.call(this,status.OK,body,headers,options)||this;_this.body=body;_this.headers=headers;_this.options=options;return _this}return Ok}(Success);exports.Ok=Ok;var Accepted=function(_super){__extends(Accepted,_super);function Accepted(body,headers,options){var _this=_super.call(this,status.ACCEPTED,body,headers,options)||this;_this.body=body;_this.headers=headers;_this.options=options;return _this}return Accepted}(Success);exports.Accepted=Accepted;var NoContent=function(_super){__extends(NoContent,_super);function NoContent(body,headers,options){var _this=_super.call(this,status.NO_CONTENT,body,headers,options)||this;_this.body=body;_this.headers=headers;_this.options=options;return _this}return NoContent}(Success);exports.NoContent=NoContent;var Created=function(_super){__extends(Created,_super);function Created(body,headers,options){var _this=_super.call(this,status.CREATED,body,headers,options)||this;_this.body=body;_this.headers=headers;_this.options=options;return _this}return Created}(Success);exports.Created=Created;var ClientError=function(_super){__extends(ClientError,_super);function ClientError(){return _super!==null&&_super.apply(this,arguments)||this}return ClientError}(GenericResponse);exports.ClientError=ClientError;var BadRequest=function(_super){__extends(BadRequest,_super);function BadRequest(body,headers,options){var _this=_super.call(this,status.BAD_REQUEST,body,headers,options)||this;_this.body=body;_this.headers=headers;_this.options=options;return _this}return BadRequest}(ClientError);exports.BadRequest=BadRequest;var Unauthorized=function(_super){__extends(Unauthorized,_super);function Unauthorized(body,headers,options){var _this=_super.call(this,status.UNAUTHORIZED,body,headers,options)||this;_this.body=body;_this.headers=headers;_this.options=options;return _this}return Unauthorized}(ClientError);exports.Unauthorized=Unauthorized;var Forbidden=function(_super){__extends(Forbidden,_super);function Forbidden(body,headers,options){var _this=_super.call(this,status.FORBIDDEN,body,headers,options)||this;_this.body=body;_this.headers=headers;_this.options=options;return _this}return Forbidden}(ClientError);exports.Forbidden=Forbidden;var NotFound=function(_super){__extends(NotFound,_super);function NotFound(body,headers,options){var _this=_super.call(this,status.NOT_FOUND,body,headers,options)||this;_this.body=body;_this.headers=headers;_this.options=options;return _this}return NotFound}(ClientError);exports.NotFound=NotFound;var Conflict=function(_super){__extends(Conflict,_super);function Conflict(body,headers,options){var _this=_super.call(this,status.CONFLICT,body,headers,options)||this;_this.body=body;_this.headers=headers;_this.options=options;return _this}return Conflict}(ClientError);exports.Conflict=Conflict;var ServerError=function(_super){__extends(ServerError,_super);function ServerError(){return _super!==null&&_super.apply(this,arguments)||this}return ServerError}(GenericResponse);exports.ServerError=ServerError;var InternalServerError=function(_super){__extends(InternalServerError,_super);function InternalServerError(body,headers,options){var _this=_super.call(this,status.INTERNAL_SERVER_ERROR,body,headers,options)||this;_this.body=body;_this.headers=headers;_this.options=options;_this.status=status.INTERNAL_SERVER_ERROR;return _this}return InternalServerError}(ServerError);exports.InternalServerError=InternalServerError;exports.createResponse=function(code,body,headers,options){switch(code){case status.OK:return new Ok(body,headers,options);case status.ACCEPTED:return new Accepted(body,headers,options);case status.NO_CONTENT:return new NoContent(body,headers,options);case status.CREATED:return new Created(body,headers,options);case status.BAD_REQUEST:return new BadRequest(body,headers,options);case status.BAD_REQUEST:return new BadRequest(body,headers,options);case status.UNAUTHORIZED:return new Unauthorized(body,headers,options);case status.FORBIDDEN:return new Forbidden(body,headers,options);case status.NOT_FOUND:return new NotFound(body,headers,options);case status.CONFLICT:return new Conflict(body,headers,options);case status.INTERNAL_SERVER_ERROR:return new InternalServerError(body,headers,options);default:if(code>=400&&code<=499)return new ClientError(code,body,headers,options);else if(code>=500)return new ServerError(code,body,headers,options);else return new GenericResponse(code,body,headers,options)}}},{"./status":12}],12:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.CONTINUE=100;exports.SWITCHING_PROTOCOLS=101;exports.PROCESSING=102;exports.OK=200;exports.CREATED=201;exports.ACCEPTED=202;exports.NON_AUTHORITATIV_INFO=203;exports.NO_CONTENT=204;exports.RESET_CONTENT=205;exports.PARTIAL_CONTENT=206;exports.MULTI_STATUS=207;exports.ALREADY_REPORTED=208;exports.IM_USED=226;exports.MULTIPLE_CHOICES=300;exports.MOVED_PERMANENTLY=301;exports.FOUND=302;exports.SEE_OTHER=303;exports.NOT_MODIFIED=304;exports.USE_PROXY=305;exports.TEMPORARY_REDIRECT=307;exports.PERMANENT_REDIRECT=308;exports.BAD_REQUEST=400;exports.UNAUTHORIZED=401;exports.PAYMENT_REQUIRED=402;exports.FORBIDDEN=403;exports.NOT_FOUND=404;exports.METHOD_NOT_ALLOWED=405;exports.NOT_ACCEPTABLE=406;exports.PROXY_AUTH_REQUIRED=407;exports.REQUEST_TIMEOUT=408;exports.CONFLICT=409;exports.GONE=410;exports.LENGTH_REQUIRED=411;exports.PRECONDITION_FAILED=412;exports.REQUEST_ENTITY_TOO_LARGE=413;exports.REQUEST_URI_TOO_LONG=414;exports.UNSUPPORTED_MEDIA_TYPE=415;exports.REQUESTED_RANGE_NOT_SATISFIABLE=416;exports.EXPECTATION_FAILED=417;exports.TEAPOT=418;exports.UNPROCESSABLE_ENTITY=422;exports.LOCKED=423;exports.FAILED_DEPENDENCY=424;exports.UPGRADE_REQUIRED=426;exports.PRECONDITION_REQUIRED=428;exports.TOO_MANY_REQUESTS=429;exports.REQUEST_HEADER_FIELDS_TOO_LARGE=431;exports.UNAVAILABLE_FOR_LEGAL_RREASONS=451;exports.INTERNAL_SERVER_ERROR=500;exports.NOT_IMPLEMENTED=501;exports.BAD_GATEWAY=502;exports.SERVICE_UNAVAILABLE=503;exports.GATEWAY_TIMEOUT=504;exports.HTTP_VERSION_NOT_SUPPORTED=505;exports.VARIANT_ALSO_NEGOTIATES=506;exports.INSUFFICIENT_STORAGE=507;exports.LOOP_DETECTED=508;exports.NOT_EXTENDED=510;exports.NETWORK_AUTHENTICATION_REQUIRED=511},{}],13:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var qs=require("qs");exports.isObject=function(obj){return typeof obj==="object"};exports.isFile=function(obj){return toString.call(obj)==="[object File]"};exports.isFormData=function(obj){return toString.call(obj)==="[object FormData]"};exports.isBlob=function(obj){return toString.call(obj)==="[object Blob]"};exports.urlFromString=function(url,params){if(params===void 0){params={}}return url+"?"+qs.stringify(params)}},{qs:15}],14:[function(require,module,exports){"use strict";var replace=String.prototype.replace;var percentTwenties=/%20/g;var util=require("./utils");var Format={RFC1738:"RFC1738",RFC3986:"RFC3986"};module.exports=util.assign({default:Format.RFC3986,formatters:{RFC1738:function(value){return replace.call(value,percentTwenties,"+")},RFC3986:function(value){return String(value)}}},Format)},{"./utils":18}],15:[function(require,module,exports){"use strict";var stringify=require("./stringify");var parse=require("./parse");var formats=require("./formats");module.exports={formats:formats,parse:parse,stringify:stringify}},{"./formats":14,"./parse":16,"./stringify":17}],16:[function(require,module,exports){"use strict";var utils=require("./utils");var has=Object.prototype.hasOwnProperty;var isArray=Array.isArray;var defaults={allowDots:false,allowPrototypes:false,arrayLimit:20,charset:"utf-8",charsetSentinel:false,comma:false,decoder:utils.decode,delimiter:"&",depth:5,ignoreQueryPrefix:false,interpretNumericEntities:false,parameterLimit:1e3,parseArrays:true,plainObjects:false,strictNullHandling:false};var interpretNumericEntities=function(str){return str.replace(/&#(\d+);/g,function($0,numberStr){return String.fromCharCode(parseInt(numberStr,10))})};var parseArrayValue=function(val,options){if(val&&typeof val==="string"&&options.comma&&val.indexOf(",")>-1){return val.split(",")}return val};var isoSentinel="utf8=%26%2310003%3B";var charsetSentinel="utf8=%E2%9C%93";var parseValues=function parseQueryStringValues(str,options){var obj={};var cleanStr=options.ignoreQueryPrefix?str.replace(/^\?/,""):str;var limit=options.parameterLimit===Infinity?undefined:options.parameterLimit;var parts=cleanStr.split(options.delimiter,limit);var skipIndex=-1;var i;var charset=options.charset;if(options.charsetSentinel){for(i=0;i<parts.length;++i){if(parts[i].indexOf("utf8=")===0){if(parts[i]===charsetSentinel){charset="utf-8"}else if(parts[i]===isoSentinel){charset="iso-8859-1"}skipIndex=i;i=parts.length}}}for(i=0;i<parts.length;++i){if(i===skipIndex){continue}var part=parts[i];var bracketEqualsPos=part.indexOf("]=");var pos=bracketEqualsPos===-1?part.indexOf("="):bracketEqualsPos+1;var key,val;if(pos===-1){key=options.decoder(part,defaults.decoder,charset,"key");val=options.strictNullHandling?null:""}else{key=options.decoder(part.slice(0,pos),defaults.decoder,charset,"key");val=utils.maybeMap(parseArrayValue(part.slice(pos+1),options),function(encodedVal){return options.decoder(encodedVal,defaults.decoder,charset,"value")})}if(val&&options.interpretNumericEntities&&charset==="iso-8859-1"){val=interpretNumericEntities(val)}if(part.indexOf("[]=")>-1){val=isArray(val)?[val]:val}if(has.call(obj,key)){obj[key]=utils.combine(obj[key],val)}else{obj[key]=val}}return obj};var parseObject=function(chain,val,options,valuesParsed){var leaf=valuesParsed?val:parseArrayValue(val,options);for(var i=chain.length-1;i>=0;--i){var obj;var root=chain[i];if(root==="[]"&&options.parseArrays){obj=[].concat(leaf)}else{obj=options.plainObjects?Object.create(null):{};var cleanRoot=root.charAt(0)==="["&&root.charAt(root.length-1)==="]"?root.slice(1,-1):root;var index=parseInt(cleanRoot,10);if(!options.parseArrays&&cleanRoot===""){obj={0:leaf}}else if(!isNaN(index)&&root!==cleanRoot&&String(index)===cleanRoot&&index>=0&&(options.parseArrays&&index<=options.arrayLimit)){obj=[];obj[index]=leaf}else{obj[cleanRoot]=leaf}}leaf=obj}return leaf};var parseKeys=function parseQueryStringKeys(givenKey,val,options,valuesParsed){if(!givenKey){return}var key=options.allowDots?givenKey.replace(/\.([^.[]+)/g,"[$1]"):givenKey;var brackets=/(\[[^[\]]*])/;var child=/(\[[^[\]]*])/g;var segment=options.depth>0&&brackets.exec(key);var parent=segment?key.slice(0,segment.index):key;var keys=[];if(parent){if(!options.plainObjects&&has.call(Object.prototype,parent)){if(!options.allowPrototypes){return}}keys.push(parent)}var i=0;while(options.depth>0&&(segment=child.exec(key))!==null&&i<options.depth){i+=1;if(!options.plainObjects&&has.call(Object.prototype,segment[1].slice(1,-1))){if(!options.allowPrototypes){return}}keys.push(segment[1])}if(segment){keys.push("["+key.slice(segment.index)+"]")}return parseObject(keys,val,options,valuesParsed)};var normalizeParseOptions=function normalizeParseOptions(opts){if(!opts){return defaults}if(opts.decoder!==null&&opts.decoder!==undefined&&typeof opts.decoder!=="function"){throw new TypeError("Decoder has to be a function.")}if(typeof opts.charset!=="undefined"&&opts.charset!=="utf-8"&&opts.charset!=="iso-8859-1"){throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined")}var charset=typeof opts.charset==="undefined"?defaults.charset:opts.charset;return{allowDots:typeof opts.allowDots==="undefined"?defaults.allowDots:!!opts.allowDots,allowPrototypes:typeof opts.allowPrototypes==="boolean"?opts.allowPrototypes:defaults.allowPrototypes,arrayLimit:typeof opts.arrayLimit==="number"?opts.arrayLimit:defaults.arrayLimit,charset:charset,charsetSentinel:typeof opts.charsetSentinel==="boolean"?opts.charsetSentinel:defaults.charsetSentinel,comma:typeof opts.comma==="boolean"?opts.comma:defaults.comma,decoder:typeof opts.decoder==="function"?opts.decoder:defaults.decoder,delimiter:typeof opts.delimiter==="string"||utils.isRegExp(opts.delimiter)?opts.delimiter:defaults.delimiter,depth:typeof opts.depth==="number"||opts.depth===false?+opts.depth:defaults.depth,ignoreQueryPrefix:opts.ignoreQueryPrefix===true,interpretNumericEntities:typeof opts.interpretNumericEntities==="boolean"?opts.interpretNumericEntities:defaults.interpretNumericEntities,parameterLimit:typeof opts.parameterLimit==="number"?opts.parameterLimit:defaults.parameterLimit,parseArrays:opts.parseArrays!==false,plainObjects:typeof opts.plainObjects==="boolean"?opts.plainObjects:defaults.plainObjects,strictNullHandling:typeof opts.strictNullHandling==="boolean"?opts.strictNullHandling:defaults.strictNullHandling}};module.exports=function(str,opts){var options=normalizeParseOptions(opts);if(str===""||str===null||typeof str==="undefined"){return options.plainObjects?Object.create(null):{}}var tempObj=typeof str==="string"?parseValues(str,options):str;var obj=options.plainObjects?Object.create(null):{};var keys=Object.keys(tempObj);for(var i=0;i<keys.length;++i){var key=keys[i];var newObj=parseKeys(key,tempObj[key],options,typeof str==="string");obj=utils.merge(obj,newObj,options)}return utils.compact(obj)}},{"./utils":18}],17:[function(require,module,exports){"use strict";var utils=require("./utils");var formats=require("./formats");var has=Object.prototype.hasOwnProperty;var arrayPrefixGenerators={brackets:function brackets(prefix){return prefix+"[]"},comma:"comma",indices:function indices(prefix,key){return prefix+"["+key+"]"},repeat:function repeat(prefix){return prefix}};var isArray=Array.isArray;var push=Array.prototype.push;var pushToArray=function(arr,valueOrArray){push.apply(arr,isArray(valueOrArray)?valueOrArray:[valueOrArray])};var toISO=Date.prototype.toISOString;var defaultFormat=formats["default"];var defaults={addQueryPrefix:false,allowDots:false,charset:"utf-8",charsetSentinel:false,delimiter:"&",encode:true,encoder:utils.encode,encodeValuesOnly:false,format:defaultFormat,formatter:formats.formatters[defaultFormat],indices:false,serializeDate:function serializeDate(date){return toISO.call(date)},skipNulls:false,strictNullHandling:false};var isNonNullishPrimitive=function isNonNullishPrimitive(v){return typeof v==="string"||typeof v==="number"||typeof v==="boolean"||typeof v==="symbol"||typeof v==="bigint"};var stringify=function stringify(object,prefix,generateArrayPrefix,strictNullHandling,skipNulls,encoder,filter,sort,allowDots,serializeDate,formatter,encodeValuesOnly,charset){var obj=object;if(typeof filter==="function"){obj=filter(prefix,obj)}else if(obj instanceof Date){obj=serializeDate(obj)}else if(generateArrayPrefix==="comma"&&isArray(obj)){obj=utils.maybeMap(obj,function(value){if(value instanceof Date){return serializeDate(value)}return value}).join(",")}if(obj===null){if(strictNullHandling){return encoder&&!encodeValuesOnly?encoder(prefix,defaults.encoder,charset,"key"):prefix}obj=""}if(isNonNullishPrimitive(obj)||utils.isBuffer(obj)){if(encoder){var keyValue=encodeValuesOnly?prefix:encoder(prefix,defaults.encoder,charset,"key");return[formatter(keyValue)+"="+formatter(encoder(obj,defaults.encoder,charset,"value"))]}return[formatter(prefix)+"="+formatter(String(obj))]}var values=[];if(typeof obj==="undefined"){return values}var objKeys;if(isArray(filter)){objKeys=filter}else{var keys=Object.keys(obj);objKeys=sort?keys.sort(sort):keys}for(var i=0;i<objKeys.length;++i){var key=objKeys[i];var value=obj[key];if(skipNulls&&value===null){continue}var keyPrefix=isArray(obj)?typeof generateArrayPrefix==="function"?generateArrayPrefix(prefix,key):prefix:prefix+(allowDots?"."+key:"["+key+"]");pushToArray(values,stringify(value,keyPrefix,generateArrayPrefix,strictNullHandling,skipNulls,encoder,filter,sort,allowDots,serializeDate,formatter,encodeValuesOnly,charset))}return values};var normalizeStringifyOptions=function normalizeStringifyOptions(opts){if(!opts){return defaults}if(opts.encoder!==null&&opts.encoder!==undefined&&typeof opts.encoder!=="function"){throw new TypeError("Encoder has to be a function.")}var charset=opts.charset||defaults.charset;if(typeof opts.charset!=="undefined"&&opts.charset!=="utf-8"&&opts.charset!=="iso-8859-1"){throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined")}var format=formats["default"];if(typeof opts.format!=="undefined"){if(!has.call(formats.formatters,opts.format)){throw new TypeError("Unknown format option provided.")}format=opts.format}var formatter=formats.formatters[format];var filter=defaults.filter;if(typeof opts.filter==="function"||isArray(opts.filter)){filter=opts.filter}return{addQueryPrefix:typeof opts.addQueryPrefix==="boolean"?opts.addQueryPrefix:defaults.addQueryPrefix,allowDots:typeof opts.allowDots==="undefined"?defaults.allowDots:!!opts.allowDots,charset:charset,charsetSentinel:typeof opts.charsetSentinel==="boolean"?opts.charsetSentinel:defaults.charsetSentinel,delimiter:typeof opts.delimiter==="undefined"?defaults.delimiter:opts.delimiter,encode:typeof opts.encode==="boolean"?opts.encode:defaults.encode,encoder:typeof opts.encoder==="function"?opts.encoder:defaults.encoder,encodeValuesOnly:typeof opts.encodeValuesOnly==="boolean"?opts.encodeValuesOnly:defaults.encodeValuesOnly,filter:filter,formatter:formatter,serializeDate:typeof opts.serializeDate==="function"?opts.serializeDate:defaults.serializeDate,skipNulls:typeof opts.skipNulls==="boolean"?opts.skipNulls:defaults.skipNulls,sort:typeof opts.sort==="function"?opts.sort:null,strictNullHandling:typeof opts.strictNullHandling==="boolean"?opts.strictNullHandling:defaults.strictNullHandling}};module.exports=function(object,opts){var obj=object;var options=normalizeStringifyOptions(opts);var objKeys;var filter;if(typeof options.filter==="function"){filter=options.filter;obj=filter("",obj)}else if(isArray(options.filter)){filter=options.filter;objKeys=filter}var keys=[];if(typeof obj!=="object"||obj===null){return""}var arrayFormat;if(opts&&opts.arrayFormat in arrayPrefixGenerators){arrayFormat=opts.arrayFormat}else if(opts&&"indices"in opts){arrayFormat=opts.indices?"indices":"repeat"}else{arrayFormat="indices"}var generateArrayPrefix=arrayPrefixGenerators[arrayFormat];if(!objKeys){objKeys=Object.keys(obj)}if(options.sort){objKeys.sort(options.sort)}for(var i=0;i<objKeys.length;++i){var key=objKeys[i];if(options.skipNulls&&obj[key]===null){continue}pushToArray(keys,stringify(obj[key],key,generateArrayPrefix,options.strictNullHandling,options.skipNulls,options.encode?options.encoder:null,options.filter,options.sort,options.allowDots,options.serializeDate,options.formatter,options.encodeValuesOnly,options.charset))}var joined=keys.join(options.delimiter);var prefix=options.addQueryPrefix===true?"?":"";if(options.charsetSentinel){if(options.charset==="iso-8859-1"){prefix+="utf8=%26%2310003%3B&"}else{prefix+="utf8=%E2%9C%93&"}}return joined.length>0?prefix+joined:""}},{"./formats":14,"./utils":18}],18:[function(require,module,exports){"use strict";var has=Object.prototype.hasOwnProperty;var isArray=Array.isArray;var hexTable=function(){var array=[];for(var i=0;i<256;++i){array.push("%"+((i<16?"0":"")+i.toString(16)).toUpperCase())}return array}();var compactQueue=function compactQueue(queue){while(queue.length>1){var item=queue.pop();var obj=item.obj[item.prop];if(isArray(obj)){var compacted=[];for(var j=0;j<obj.length;++j){if(typeof obj[j]!=="undefined"){compacted.push(obj[j])}}item.obj[item.prop]=compacted}}};var arrayToObject=function arrayToObject(source,options){var obj=options&&options.plainObjects?Object.create(null):{};for(var i=0;i<source.length;++i){if(typeof source[i]!=="undefined"){obj[i]=source[i]}}return obj};var merge=function merge(target,source,options){if(!source){return target}if(typeof source!=="object"){if(isArray(target)){target.push(source)}else if(target&&typeof target==="object"){if(options&&(options.plainObjects||options.allowPrototypes)||!has.call(Object.prototype,source)){target[source]=true}}else{return[target,source]}return target}if(!target||typeof target!=="object"){return[target].concat(source)}var mergeTarget=target;if(isArray(target)&&!isArray(source)){mergeTarget=arrayToObject(target,options)}if(isArray(target)&&isArray(source)){source.forEach(function(item,i){if(has.call(target,i)){var targetItem=target[i];if(targetItem&&typeof targetItem==="object"&&item&&typeof item==="object"){target[i]=merge(targetItem,item,options)}else{target.push(item)}}else{target[i]=item}});return target}return Object.keys(source).reduce(function(acc,key){var value=source[key];if(has.call(acc,key)){acc[key]=merge(acc[key],value,options)}else{acc[key]=value}return acc},mergeTarget)};var assign=function assignSingleSource(target,source){return Object.keys(source).reduce(function(acc,key){acc[key]=source[key];return acc},target)};var decode=function(str,decoder,charset){var strWithoutPlus=str.replace(/\+/g," ");if(charset==="iso-8859-1"){return strWithoutPlus.replace(/%[0-9a-f]{2}/gi,unescape)}try{return decodeURIComponent(strWithoutPlus)}catch(e){return strWithoutPlus}};var encode=function encode(str,defaultEncoder,charset){if(str.length===0){return str}var string=str;if(typeof str==="symbol"){string=Symbol.prototype.toString.call(str)}else if(typeof str!=="string"){string=String(str)}if(charset==="iso-8859-1"){return escape(string).replace(/%u[0-9a-f]{4}/gi,function($0){return"%26%23"+parseInt($0.slice(2),16)+"%3B"})}var out="";for(var i=0;i<string.length;++i){var c=string.charCodeAt(i);if(c===45||c===46||c===95||c===126||c>=48&&c<=57||c>=65&&c<=90||c>=97&&c<=122){out+=string.charAt(i);continue}if(c<128){out=out+hexTable[c];continue}if(c<2048){out=out+(hexTable[192|c>>6]+hexTable[128|c&63]);continue}if(c<55296||c>=57344){out=out+(hexTable[224|c>>12]+hexTable[128|c>>6&63]+hexTable[128|c&63]);continue}i+=1;c=65536+((c&1023)<<10|string.charCodeAt(i)&1023);out+=hexTable[240|c>>18]+hexTable[128|c>>12&63]+hexTable[128|c>>6&63]+hexTable[128|c&63]}return out};var compact=function compact(value){var queue=[{obj:{o:value},prop:"o"}];var refs=[];for(var i=0;i<queue.length;++i){var item=queue[i];var obj=item.obj[item.prop];var keys=Object.keys(obj);for(var j=0;j<keys.length;++j){var key=keys[j];var val=obj[key];if(typeof val==="object"&&val!==null&&refs.indexOf(val)===-1){queue.push({obj:obj,prop:key});refs.push(val)}}}compactQueue(queue);return value};var isRegExp=function isRegExp(obj){return Object.prototype.toString.call(obj)==="[object RegExp]"};var isBuffer=function isBuffer(obj){if(!obj||typeof obj!=="object"){return false}return!!(obj.constructor&&obj.constructor.isBuffer&&obj.constructor.isBuffer(obj))};var combine=function combine(a,b){return[].concat(a,b)};var maybeMap=function maybeMap(val,fn){if(isArray(val)){var mapped=[];for(var i=0;i<val.length;i+=1){mapped.push(fn(val[i]))}return mapped}return fn(val)};module.exports={arrayToObject:arrayToObject,assign:assign,combine:combine,compact:compact,decode:decode,encode:encode,isBuffer:isBuffer,isRegExp:isRegExp,maybeMap:maybeMap,merge:merge}},{}],19:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var either_1=require("../data/either");exports.convert=function(e){return e instanceof Error?e:new Error(e.message)};exports.raise=function(e){if(e instanceof Error){throw e}else{throw new Error(e.message)}};exports.attempt=function(f){try{return either_1.right(f())}catch(e){return either_1.left(e)}}},{"../data/either":23}],20:[function(require,module,exports){"use strict";var __extends=this&&this.__extends||function(){var extendStatics=function(d,b){extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(b.hasOwnProperty(p))d[p]=b[p]};return extendStatics(d,b)};return function(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}();Object.defineProperty(exports,"__esModule",{value:true});var timer_1=require("../timer");var function_1=require("../../data/function");var error_1=require("../error");var Future=function(){function Future(){}Future.prototype.of=function(a){return new Pure(a)};Future.prototype.map=function(f){return new Bind(this,function(value){return new Pure(f(value))})};Future.prototype.ap=function(ft){return new Bind(this,function(value){return ft.map(function(f){return f(value)})})};Future.prototype.chain=function(f){return new Bind(this,f)};Future.prototype.catch=function(f){return new Catch(this,f)};Future.prototype.finally=function(f){return new Finally(this,f)};Future.prototype.fork=function(onError,onSuccess){return new Compute(undefined,onError,onSuccess,[this]).run()};Future.prototype.__trap=function(_,__){return false};return Future}();exports.Future=Future;var Pure=function(_super){__extends(Pure,_super);function Pure(value){var _this=_super.call(this)||this;_this.value=value;return _this}Pure.prototype.map=function(f){return new Pure(f(this.value))};Pure.prototype.ap=function(ft){var _this=this;return ft.map(function(f){return f(_this.value)})};Pure.prototype.__exec=function(c){c.value=this.value;timer_1.tick(function(){return c.run()});return false};return Pure}(Future);exports.Pure=Pure;var Bind=function(_super){__extends(Bind,_super);function Bind(future,func){var _this=_super.call(this)||this;_this.future=future;_this.func=func;return _this}Bind.prototype.__exec=function(c){c.stack.push(new Step(this.func));c.stack.push(this.future);return true};return Bind}(Future);exports.Bind=Bind;var Step=function(_super){__extends(Step,_super);function Step(value){var _this=_super.call(this)||this;_this.value=value;return _this}Step.prototype.__exec=function(c){c.stack.push(this.value(c.value));return true};return Step}(Future);exports.Step=Step;var Catch=function(_super){__extends(Catch,_super);function Catch(future,func){var _this=_super.call(this)||this;_this.future=future;_this.func=func;return _this}Catch.prototype.__exec=function(c){c.stack.push(new Trap(this.func));c.stack.push(this.future);return true};return Catch}(Future);exports.Catch=Catch;var Finally=function(_super){__extends(Finally,_super);function Finally(future,func){var _this=_super.call(this)||this;_this.future=future;_this.func=func;return _this}Finally.prototype.__exec=function(c){c.stack.push(new Trap(this.func));c.stack.push(new Step(this.func));c.stack.push(this.future);return true};return Finally}(Future);exports.Finally=Finally;var Trap=function(_super){__extends(Trap,_super);function Trap(func){var _this=_super.call(this)||this;_this.func=func;return _this}Trap.prototype.__exec=function(_){return true};Trap.prototype.__trap=function(e,c){c.stack.push(this.func(e));return true};return Trap}(Future);exports.Trap=Trap;var Raise=function(_super){__extends(Raise,_super);function Raise(value){var _this=_super.call(this)||this;_this.value=value;return _this}Raise.prototype.map=function(_){return new Raise(this.value)};Raise.prototype.ap=function(_){return new Raise(this.value)};Raise.prototype.chain=function(_){return new Raise(this.value)};Raise.prototype.__exec=function(c){var finished=false;var e=error_1.convert(this.value);while(!finished){if(c.stack.length===0){c.exitError(e);return false}else{finished=c.stack.pop().__trap(e,c)}}return finished};return Raise}(Future);exports.Raise=Raise;var Run=function(_super){__extends(Run,_super);function Run(value){var _this=_super.call(this)||this;_this.value=value;return _this}Run.prototype.__exec=function(c){c.running=true;c.canceller=this.value(c);return false};return Run}(Future);exports.Run=Run;var Compute=function(){function Compute(value,exitError,exitSuccess,stack){this.value=value;this.exitError=exitError;this.exitSuccess=exitSuccess;this.stack=stack;this.canceller=function_1.noop;this.running=false}Compute.prototype.onError=function(e){if(this.running===false)return;this.stack.push(new Raise(e));this.running=false;this.run()};Compute.prototype.onSuccess=function(value){if(this.running===false)return;this.value=value;this.running=false;this.run()};Compute.prototype.abort=function(){this.stack=[];this.exitError=function_1.noop;this.exitSuccess=function_1.noop;this.running=false;this.canceller();this.canceller=function_1.noop};Compute.prototype.run=function(){while(this.stack.length>0){var next=this.stack.pop();if(next==null||typeof next.__exec!=="function"){try{throw new Error('Invalid Compute stack member: "'+next+'"!')}catch(e){this.onError(e);return this}}if(!next.__exec(this))return this}this.running=false;this.exitSuccess(this.value);return this};return Compute}();exports.Compute=Compute;exports.pure=function(a){return new Pure(a)};exports.raise=function(e){return new Raise(e)};exports.attempt=function(f){return new Run(function(s){timer_1.tick(function(){try{s.onSuccess(f())}catch(e){s.onError(e)}});return function_1.noop})};exports.delay=function(f,n){if(n===void 0){n=0}return new Run(function(s){setTimeout(function(){try{s.onSuccess(f())}catch(e){s.onError(e)}},n);return function_1.noop})};exports.wait=function(n){return new Run(function(s){setTimeout(function(){s.onSuccess(undefined)},n);return function_1.noop})};exports.fromAbortable=function(abort){return function(f){return new Run(function(s){f(function(err,a){return err!=null?s.onError(err):s.onSuccess(a)});return abort})}};exports.fromCallback=function(f){return exports.fromAbortable(function_1.noop)(f)};var Tag=function(){function Tag(index,value){this.index=index;this.value=value}return Tag}();exports.batch=function(list){return exports.sequential(list.map(function(w){return exports.parallel(w)}))};exports.parallel=function(list){return new Run(function(s){var done=[];var failed=false;var comps=[];var reconcile=function(){return done.sort(indexCmp).map(function(t){return t.value})};var indexCmp=function(a,b){return a.index-b.index};var onErr=function(e){abortAll();s.onError(e)};var onSucc=function(t){if(!failed){done.push(t);if(done.length===list.length)s.onSuccess(reconcile())}};var abortAll=function(){comps.map(function(c){return c.abort()});failed=true};comps.push.apply(comps,list.map(function(f,i){return f.map(function(value){return new Tag(i,value)}).fork(onErr,onSucc)}));if(comps.length===0)s.onSuccess([]);return function(){return abortAll()}})};exports.sequential=function(list){return new Run(function(s){var i=0;var r=[];var onErr=function(e){return s.onError(e)};var onSuccess=function(a){r.push(a);next()};var abort;var next=function(){if(i<list.length)abort=list[i].fork(onErr,onSuccess);else s.onSuccess(r);i++};next();return function(){if(abort)abort.abort()}})};exports.reduce=function(list,init,f){return new Run(function(s){var i=0;var onErr=function(e){return s.onError(e)};var onSuccess=function(a){init=f(init,a,i);next(init)};var abort;var next=function(value){if(i<list.length)abort=list[i].fork(onErr,onSuccess);else s.onSuccess(value);i++};next(init);return function(){if(abort)abort.abort()}})};exports.race=function(list){return new Run(function(s){var comps=[];var finished=false;var abortAll=function(){finished=true;comps.map(function(c){return c.abort()})};var onErr=function(e){abortAll();s.onError(e)};var onSucc=function(t){if(!finished){finished=true;comps.map(function(c,i){return i!==t.index?c.abort():undefined});s.onSuccess(t.value)}};comps.push.apply(comps,list.map(function(f,i){return f.map(function(value){return new Tag(i,value)}).fork(onErr,onSucc)}));if(comps.length===0)s.onError(new Error("race(): Cannot race an empty list!"));return function(){return abortAll()}})};exports.toPromise=function(ft){return new Promise(function(yes,no){return ft.fork(no,yes)})};exports.fromExcept=function(e){return e.fold(function(e){return exports.raise(e)},function(a){return exports.pure(a)})};exports.liftP=function(f){return new Run(function(s){f().then(function(a){return s.onSuccess(a)}).catch(function(e){return s.onError(e)});return function_1.noop})}},{"../../data/function":24,"../error":19,"../timer":21}],21:[function(require,module,exports){(function(process){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.tick=function(f){return typeof window=="undefined"?setTimeout(f,0):process.nextTick(f)};exports.debounce=function(f,delay){var id=-1;return function(a){if(id===-1){id=setTimeout(function(){return f(a)},delay)}else{clearTimeout(id);id=setTimeout(function(){return f(a)},delay)}}};exports.throttle=function(f,duration){var wait=false;return function(a){if(wait===false){f(a);wait=true;setTimeout(function(){return wait=false},duration)}}}}).call(this,require("_process"))},{_process:67}],22:[function(require,module,exports){"use strict";var __spreadArrays=this&&this.__spreadArrays||function(){for(var s=0,i=0,il=arguments.length;i<il;i++)s+=arguments[i].length;for(var r=Array(s),k=0,i=0;i<il;i++)for(var a=arguments[i],j=0,jl=a.length;j<jl;j++,k++)r[k]=a[j];return r};Object.defineProperty(exports,"__esModule",{value:true});var record_1=require("../record");var math_1=require("../../math");exports.head=function(list){return list[0]};exports.tail=function(list){return list[list.length-1]};exports.empty=function(list){return list.length===0};exports.contains=function(list,a){return list.indexOf(a)>-1};exports.map=function(list){return function(f){return list.map(f)}};exports.flatMap=function(list,f){return list.reduce(function(p,c,i){return p.concat(f(c,i,list))},[])};exports.concat=function(list,a){return __spreadArrays(list,[a])};exports.partition=function(list,f){return exports.empty(list)?[[],[]]:list.reduce(function(_a,c,i){var yes=_a[0],no=_a[1];return f(c,i,list)?[exports.concat(yes,c),no]:[yes,exports.concat(no,c)]},[[],[]])};exports.group=function(list,f){return list.reduce(function(p,c,i){var _a;var g=f(c,i,list);return record_1.merge(p,(_a={},_a[g]=Array.isArray(p[g])?exports.concat(p[g],c):[c],_a))},{})};exports.distribute=function(list,size){var r=list.reduce(function(p,c,i){return math_1.isMultipleOf(size,i+1)?[exports.concat(p[0],exports.concat(p[1],c)),[]]:[p[0],exports.concat(p[1],c)]},[[],[]]);return r[1].length===0?r[0]:exports.concat(r[0],r[1])};exports.dedupe=function(list){return list.filter(function(e,i,l){return l.indexOf(e)===i})};exports.remove=function(list,target){var idx=list.indexOf(target);if(idx===-1){return list.slice()}else{var a=list.slice();a.splice(idx,1);return a}};exports.removeAt=function(list,idx){if(list.length>idx&&idx>-1){var a=list.slice();a.splice(idx,1);return a}else{return list.slice()}};exports.make=function(size,f){var a=new Array(size);for(var i=0;i<size;i++)a[i]=f(i);return a};exports.combine=function(list){return list.reduce(function(p,c){return p.concat(c)},[])};exports.compact=function(list){return list.filter(function(v){return v!=null})}},{"../../math":30,"../record":26}],23:[function(require,module,exports){"use strict";var __extends=this&&this.__extends||function(){var extendStatics=function(d,b){extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(b.hasOwnProperty(p))d[p]=b[p]};return extendStatics(d,b)};return function(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}();Object.defineProperty(exports,"__esModule",{value:true});var maybe_1=require("./maybe");var Either=function(){function Either(){}Either.prototype.of=function(value){return new Right(value)};return Either}();exports.Either=Either;var Left=function(_super){__extends(Left,_super);function Left(value){var _this=_super.call(this)||this;_this.value=value;return _this}Left.prototype.map=function(_){return new Left(this.value)};Left.prototype.lmap=function(f){return new Left(f(this.value))};Left.prototype.bimap=function(f,_){return new Left(f(this.value))};Left.prototype.alt=function(a){return a};Left.prototype.chain=function(_){return new Left(this.value)};Left.prototype.ap=function(_){return new Left(this.value)};Left.prototype.extend=function(_){return new Left(this.value)};Left.prototype.fold=function(f,_){return f(this.value)};Left.prototype.eq=function(m){return m instanceof Left&&m.value===this.value};Left.prototype.orElse=function(f){return f(this.value)};Left.prototype.orRight=function(f){return new Right(f(this.value))};Left.prototype.isLeft=function(){return true};Left.prototype.isRight=function(){return false};Left.prototype.takeLeft=function(){return this.value};Left.prototype.takeRight=function(){throw new TypeError("Not right!")};Left.prototype.toMaybe=function(){return maybe_1.nothing()};return Left}(Either);exports.Left=Left;var Right=function(_super){__extends(Right,_super);function Right(value){var _this=_super.call(this)||this;_this.value=value;return _this}Right.prototype.map=function(f){return new Right(f(this.value))};Right.prototype.lmap=function(_){return new Right(this.value)};Right.prototype.bimap=function(_,g){return new Right(g(this.value))};Right.prototype.alt=function(_){return this};Right.prototype.chain=function(f){return f(this.value)};Right.prototype.ap=function(e){var _this=this;return e.map(function(f){return f(_this.value)})};Right.prototype.extend=function(f){return new Right(f(this))};Right.prototype.eq=function(m){return m instanceof Right&&m.value===this.value};Right.prototype.fold=function(_,g){return g(this.value)};Right.prototype.orElse=function(_){return this};Right.prototype.orRight=function(_){return this};Right.prototype.isLeft=function(){return false};Right.prototype.isRight=function(){return true};Right.prototype.takeLeft=function(){throw new TypeError("Not left!")};Right.prototype.takeRight=function(){return this.value};Right.prototype.toMaybe=function(){return maybe_1.just(this.value)};return Right}(Either);exports.Right=Right;exports.left=function(a){return new Left(a)};exports.right=function(b){return new Right(b)};exports.fromBoolean=function(b){return b?exports.right(true):exports.left(false)};exports.either=function(f){return function(g){return function(e){return e instanceof Right?g(e.takeRight()):f(e.takeLeft())}}}},{"./maybe":25}],24:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.compose=function(f,g){return function(a){return g(f(a))}};exports.compose3=function(f,g,h){return function(a){return h(g(f(a)))}};exports.compose4=function(f,g,h,i){return function(a){return i(h(g(f(a))))}};exports.compose5=function(f,g,h,i,j){return function(a){return j(i(h(g(f(a)))))}};exports.cons=function(a){return function(_){return a}};exports.flip=function(f){return function(b){return function(a){return f(a)(b)}}};exports.identity=function(a){return a};exports.id=exports.identity;exports.curry=function(f){return function(a){return function(b){return f(a,b)}}};exports.curry3=function(f){return function(a){return function(b){return function(c){return f(a,b,c)}}}};exports.curry4=function(f){return function(a){return function(b){return function(c){return function(d){return f(a,b,c,d)}}}}};exports.curry5=function(f){return function(a){return function(b){return function(c){return function(d){return function(e){return f(a,b,c,d,e)}}}}}};exports.noop=function(){}},{}],25:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var Nothing=function(){function Nothing(){}Nothing.prototype.map=function(_){return new Nothing};Nothing.prototype.ap=function(_){return new Nothing};Nothing.prototype.of=function(a){return new Just(a)};Nothing.prototype.chain=function(_){return new Nothing};Nothing.prototype.alt=function(a){return a};Nothing.prototype.empty=function(){return new Nothing};Nothing.prototype.extend=function(_){return new Nothing};Nothing.prototype.eq=function(m){return m instanceof Nothing};Nothing.prototype.orJust=function(f){return new Just(f())};Nothing.prototype.orElse=function(f){return f()};Nothing.prototype.isNothing=function(){return true};Nothing.prototype.isJust=function(){return false};Nothing.prototype.get=function(){throw new TypeError("Cannot get a value from Nothing!")};return Nothing}();exports.Nothing=Nothing;var Just=function(){function Just(value){this.value=value}Just.prototype.map=function(f){return new Just(f(this.value))};Just.prototype.ap=function(mb){var _this=this;return mb.map(function(f){return f(_this.value)})};Just.prototype.of=function(a){return new Just(a)};Just.prototype.chain=function(f){return f(this.value)};Just.prototype.alt=function(_){return this};Just.prototype.empty=function(){return new Nothing};Just.prototype.extend=function(f){return new Just(f(this))};Just.prototype.eq=function(m){return m instanceof Just&&m.value===this.value};Just.prototype.orJust=function(_){return this};Just.prototype.orElse=function(_){return this};Just.prototype.isNothing=function(){return false};Just.prototype.isJust=function(){return true};Just.prototype.get=function(){return this.value};return Just}();exports.Just=Just;exports.of=function(a){return new Just(a)};exports.nothing=function(){return new Nothing};exports.just=function(a){return new Just(a)};exports.fromNullable=function(a){return a==null?new Nothing:new Just(a)};exports.fromArray=function(a){return a.length===0?new Nothing:new Just(a)};exports.fromObject=function(o){return Object.keys(o).length===0?new Nothing:new Just(o)};exports.fromString=function(s){return s===""?new Nothing:new Just(s)};exports.fromBoolean=function(b){return b===false?new Nothing:new Just(b)};exports.fromNumber=function(n){return n===0?new Nothing:new Just(n)};exports.fromNaN=function(n){return isNaN(n)?new Nothing:new Just(n)}},{}],26:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var array_1=require("../array");var type_1=require("../type");function assign(target){var _varArgs=[];for(var _i=1;_i<arguments.length;_i++){_varArgs[_i-1]=arguments[_i]}if(target==null)throw new TypeError("Cannot convert undefined or null to object");var to=Object(target);for(var index=1;index<arguments.length;index++){var nextSource=arguments[index];if(nextSource!=null){for(var nextKey in nextSource){if(Object.prototype.hasOwnProperty.call(nextSource,nextKey))to[nextKey]=nextSource[nextKey]}}}return to}exports.assign=assign;exports.isRecord=function(value){return typeof value==="object"&&value!=null&&!Array.isArray(value)&&!(value instanceof Date)&&!(value instanceof RegExp)};exports.keys=function(value){return Object.keys(value)};exports.map=function(o,f){return exports.keys(o).reduce(function(p,k){var _a;return exports.merge(p,(_a={},_a[k]=f(o[k],k,o),_a))},{})};exports.mapTo=function(o,f){return exports.keys(o).map(function(k){return f(o[k],k,o)})};exports.reduce=function(o,accum,f){return exports.keys(o).reduce(function(p,k){return f(p,o[k],k)},accum)};exports.filter=function(o,f){return exports.keys(o).reduce(function(p,k){var _a;return f(o[k],k,o)?exports.merge(p,(_a={},_a[k]=o[k],_a)):p},{})};exports.merge=function(left,right){return assign({},left,right)};exports.merge3=function(a,b,c){return assign({},a,b,c)};exports.merge4=function(a,b,c,d){return assign({},a,b,c,d)};exports.merge5=function(a,b,c,d,e){return assign({},a,b,c,d,e)};exports.rmerge=function(left,right){return exports.reduce(right,left,deepMerge)};exports.rmerge3=function(r,s,t){return[s,t].reduce(function(p,c){return exports.reduce(c,p,deepMerge)},r)};exports.rmerge4=function(r,s,t,u){return[s,t,u].reduce(function(p,c){return exports.reduce(c,p,deepMerge)},r)};exports.rmerge5=function(r,s,t,u,v){return[s,t,u,v].reduce(function(p,c){return exports.reduce(c,p,deepMerge)},r)};var deepMerge=function(pre,curr,key){var _a,_b;return exports.isRecord(curr)?exports.merge(pre,(_a={},_a[key]=exports.isRecord(pre[key])?exports.rmerge(pre[key],curr):curr,_a)):exports.merge(pre,(_b={},_b[key]=curr,_b))};exports.exclude=function(o,keys){var list=Array.isArray(keys)?keys:[keys];return exports.reduce(o,{},function(p,c,k){var _a;return list.indexOf(k)>-1?p:exports.merge(p,(_a={},_a[k]=c,_a))})};exports.partition=function(r,f){return exports.reduce(r,[{},{}],function(_a,c,k){var _b,_c;var yes=_a[0],no=_a[1];return f(c,k,r)?[exports.merge(yes,(_b={},_b[k]=c,_b)),no]:[yes,exports.merge(no,(_c={},_c[k]=c,_c))]})};exports.group=function(r,f){return exports.reduce(r,{},function(p,c,k){var _a,_b,_c;var g=f(c,k,r);return exports.merge(p,(_a={},_a[g]=exports.isRecord(p[g])?exports.merge(p[g],(_b={},_b[k]=c,_b)):(_c={},_c[k]=c,_c),_a))})};exports.values=function(r){return exports.reduce(r,[],function(p,c){return array_1.concat(p,c)})};exports.contains=function(r,key){return Object.hasOwnProperty.call(r,key)};exports.clone=function(r){return exports.reduce(r,{},function(p,c,k){p[k]=_clone(c);return p})};var _clone=function(a){if(type_1.isArray(a))return a.map(_clone);else if(exports.isRecord(a))return exports.clone(a);else return a};exports.count=function(r){return exports.keys(r).length};exports.empty=function(r){return exports.count(r)===0};exports.some=function(o,f){return exports.keys(o).some(function(k){return f(o[k],k,o)})};exports.every=function(o,f){return exports.keys(o).every(function(k){return f(o[k],k,o)})}},{"../array":22,"../type":29}],27:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var maybe_1=require("../maybe");var _1=require("./");var TOKEN_DOT=".";var TOKEN_BRACKET_LEFT="[";var TOKEN_BRACKET_RIGHT="]";var TOKEN_ESCAPE="\\";exports.tokenize=function(str){var i=0;var buf="";var curr="";var next="";var tokens=[];while(i<str.length){curr=str[i];next=str[i+1];if(curr===TOKEN_ESCAPE){buf=""+buf+next;i++}else if(curr===TOKEN_DOT){if(buf!=="")tokens.push(buf);buf=""}else if(curr===TOKEN_BRACKET_LEFT&&next===TOKEN_BRACKET_RIGHT){i++}else if(curr===TOKEN_BRACKET_LEFT){var bracketBuf="";var firstDot=-1;var firstDotBuf="";i++;while(true){curr=str[i];next=str[i+1];if(curr===TOKEN_BRACKET_RIGHT&&next===TOKEN_BRACKET_RIGHT){bracketBuf=""+bracketBuf+TOKEN_BRACKET_RIGHT;i++}else if(curr===TOKEN_BRACKET_RIGHT){if(buf!=="")tokens.push(buf);tokens.push(bracketBuf);buf="";break}else if(curr==null){if(firstDot!==-1){i=firstDot;tokens.push(""+buf+TOKEN_BRACKET_LEFT+firstDotBuf);buf="";break}else{buf=""+buf+TOKEN_BRACKET_LEFT+bracketBuf;break}}if(curr===TOKEN_DOT&&firstDot===-1){firstDot=i;firstDotBuf=bracketBuf}bracketBuf=""+bracketBuf+curr;i++}}else{buf=""+buf+curr}i++}if(buf.length>0)tokens.push(buf);return tokens};exports.unsafeGet=function(path,src){if(src==null)return undefined;var toks=exports.tokenize(path);var head=src[toks.shift()];return toks.reduce(function(p,c){return p==null?p:p[c]},head)};exports.get=function(path,src){return maybe_1.fromNullable(exports.unsafeGet(path,src))};exports.getDefault=function(path,src,def){return exports.get(path,src).orJust(function(){return def}).get()};exports.getString=function(path,src){return exports.get(path,src).map(function(v){return String(v)}).orJust(function(){return""}).get()};exports.set=function(p,v,r){var toks=exports.tokenize(p);return _set(r,v,toks)};var _set=function(r,value,toks){var o;if(toks.length===0)return value;o=_1.isRecord(r)?_1.clone(r):{};o[toks[0]]=_set(o[toks[0]],value,toks.slice(1));return o};exports.escape=function(p){var i=0;var buf="";var curr="";while(i<p.length){curr=p[i];if(curr===TOKEN_ESCAPE||curr===TOKEN_DOT)buf=""+buf+TOKEN_ESCAPE+curr;else buf=""+buf+curr;i++}return buf};exports.unescape=function(p){var i=0;var curr="";var next="";var buf="";while(i<p.length){curr=p[i];next=p[i+1];if(curr===TOKEN_ESCAPE){buf=""+buf+next;i++}else{buf=""+buf+curr}i++}return buf};exports.escapeRecord=function(r){return _1.reduce(r,{},function(p,c,k){if(typeof c==="object")p[exports.escape(k)]=exports.escapeRecord(c);else p[exports.escape(k)]=c;return p})};exports.unescapeRecord=function(r){return _1.reduce(r,{},function(p,c,k){if(_1.isRecord(c))p[exports.unescape(k)]=exports.unescapeRecord(c);else p[exports.unescape(k)]=c;return p})};exports.flatten=function(r){return flatImpl("")({})(r)};var flatImpl=function(pfix){return function(prev){return function(r){return _1.reduce(r,prev,function(p,c,k){var _a;return _1.isRecord(c)?flatImpl(prefix(pfix,k))(p)(c):_1.merge(p,(_a={},_a[prefix(pfix,k)]=c,_a))})}}};var prefix=function(pfix,key){return pfix===""?exports.escape(key):pfix+"."+exports.escape(key)};exports.unflatten=function(r){return _1.reduce(r,{},function(p,c,k){return exports.set(k,c,p)})};exports.intersect=function(a,b){return _1.reduce(a,{},function(p,c,k){if(b.hasOwnProperty(k))p[k]=c;return p})};exports.difference=function(a,b){return _1.reduce(a,{},function(p,c,k){if(!b.hasOwnProperty(k))p[k]=c;return p})};exports.map=function(a,f){return _1.reduce(a,{},function(p,c,k){p[f(k)]=c;return p})};exports.project=function(spec,rec){return _1.reduce(spec,{},function(p,c,k){return c===true?exports.set(k,exports.unsafeGet(k,rec),p):p})}},{"../maybe":25,"./":26}],28:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var path_1=require("./record/path");var record_1=require("./record");exports.startsWith=function(str,search,pos){if(pos===void 0){pos=0}return str.substr(!pos||pos<0?0:+pos,search.length)===search};exports.endsWith=function(str,search,this_len){if(this_len===void 0){this_len=str.length}return this_len===undefined||this_len>str.length?this_len=str.length:str.substring(this_len-search.length,this_len)===search};exports.contains=function(str,match){return str.indexOf(match)>-1};exports.camelCase=function(str){return[str[0].toUpperCase()].concat(str.split(str[0]).slice(1).join(str[0])).join("").replace(/(\-|_|\s)+(.)?/g,function(_,__,c){return c?c.toUpperCase():""})};exports.capitalize=function(str){return""+str[0].toUpperCase()+str.slice(1)};exports.uncapitalize=function(str){return""+str[0].toLowerCase()+str.slice(1)};var interpolateDefaults={start:"{",end:"}",regex:"([\\w$.-]+)",leaveMissing:true,applyFunctions:false};exports.interpolate=function(str,data,opts){if(opts===void 0){opts={}}var options=record_1.assign({},interpolateDefaults,opts);var reg=new RegExp(""+options.start+options.regex+options.end,"g");return str.replace(reg,function(_,k){return path_1.get(k,data).map(function(v){if(typeof v==="function")return v(k);else return""+v}).orJust(function(){if(opts.leaveMissing)return k;else return""}).get()})};exports.propercase=function(str){return str.trim().toLowerCase().split(" ").map(function(tok){return tok.length>0?""+tok[0].toUpperCase()+tok.slice(1):tok}).join(" ")}},{"./record":26,"./record/path":27}],29:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var prims=["string","number","boolean"];var Any=function(){function Any(){}return Any}();exports.Any=Any;exports.isObject=function(value){return typeof value==="object"&&!exports.isArray(value)};exports.isArray=Array.isArray;exports.isString=function(value){return typeof value==="string"};exports.isNumber=function(value){return typeof value==="number"&&!isNaN(value)};exports.isBoolean=function(value){return typeof value==="boolean"};exports.isFunction=function(value){return typeof value==="function"};exports.isPrim=function(value){return!(exports.isObject(value)||exports.isArray(value)||exports.isFunction(value))};exports.is=function(expected){return function(value){return typeof value===expected}};exports.test=function(value,t){if(prims.indexOf(typeof t)>-1&&value===t)return true;else if(typeof t==="function"&&(t===String&&typeof value==="string"||t===Number&&typeof value==="number"||t===Boolean&&typeof value==="boolean"||t===Array&&Array.isArray(value)||t===Any||value instanceof t))return true;else if(t instanceof RegExp&&(typeof value==="string"&&t.test(value)))return true;else if(typeof t==="object"&&typeof value==="object")return Object.keys(t).every(function(k){return Object.hasOwnProperty.call(value,k)?exports.test(value[k],t[k]):false});return false};exports.show=function(value){if(typeof value==="object"){if(Array.isArray(value))return"["+value.map(exports.show)+"];";else if(value.constructor!==Object)return value.constructor.name||value.constructor;else return JSON.stringify(value)}else{return""+value}};exports.toString=function(val){return val==null?"":String(val)}},{}],30:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.isMultipleOf=function(x,y){return y%x===0};exports.round=function(x,n){if(n===void 0){n=0}var exp=Math.pow(10,n);var sign=x>=0?1:-1;var offset=n>0?1/Math.pow(10,n+1):0;return sign*(Math.round(Math.abs(x)*exp+offset)/exp)}},{}],31:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var property_seek_1=require("property-seek");var defaults={start:"{",end:"}",regex:"([\\w$.-]+)",leaveMissing:true,applyFunctions:false};var maybe=function(v,k,opts){return typeof v==="function"?opts.applyFunctions?v(k):v:v!=null?v:opts.leaveMissing?""+opts.start+k+opts.end:v};exports.polate=function(str,data,opts){if(opts===void 0){opts={}}var options=Object.assign({},defaults,opts);return str.replace(new RegExp(""+options.start+options.regex+options.end,"g"),function(_,k){return maybe(property_seek_1.default(k,data),k,options)})};exports.default=exports.polate},{"property-seek":68}],32:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.log=exports.caseOf=exports.match=exports.isin=exports.exists=exports.every=exports.and=exports.or=exports.reject=exports.discard=exports.identity=exports.optional=exports.notNull=exports.neq=exports.eq=exports.whenFalse=exports.whenTrue=exports.when=exports.constant=void 0;var either_1=require("@quenk/noni/lib/data/either");var type_1=require("@quenk/noni/lib/data/type");var result_1=require("./result");var failure_1=require("./result/failure");exports.constant=function(b){return function(_){return result_1.succeed(b)}};exports.when=function(test,applied,otherwise){return function(value){return test(value)===true?applied(value):otherwise(value)}};exports.whenTrue=function(condition,applied,otherwise){return function(value){return condition===true?applied(value):otherwise(value)}};exports.whenFalse=function(condition,applied,otherwise){return function(value){return condition===false?applied(value):otherwise(value)}};exports.eq=function(target){return function(value){return target===value?result_1.succeed(target):result_1.fail("eq",value,{target:target})}};exports.neq=function(target){return function(value){return target===value?result_1.fail("neq",value,{target:target}):result_1.succeed(target)}};exports.notNull=function(value){return value==null||typeof value==="string"&&value===""?result_1.fail("notNull",value):result_1.succeed(value)};exports.optional=function(p){return function(value){return value==null||typeof value==="string"&&value===""?result_1.succeed(value):p(value)}};exports.identity=function(value){return result_1.succeed(value)};exports.discard=function(_){return result_1.succeed(undefined)};exports.reject=function(reason){return function(value){return result_1.fail(reason,value)}};exports.or=function(left,right){return function(value){return left(value).orElse(function(f){return right(value).lmap(function(f2){return new failure_1.DualFailure(value,f,f2)})})}};exports.and=function(l,r){return function(value){var result=l(value);if(result instanceof either_1.Left){return either_1.left(result.takeLeft())}else{var result2=r(result.takeRight());if(result2 instanceof either_1.Left)return either_1.left(failure_1.ModifiedFailure.create(value,result2.takeLeft()));else return either_1.right(result2.takeRight())}}};exports.every=function(p){var list=[];for(var _i=1;_i<arguments.length;_i++){list[_i-1]=arguments[_i]}return function(value){var r=p(value);if(r instanceof either_1.Left)return r;var r2=list.reduce(function(p,c){return p.chain(c)},either_1.right(r.takeRight()));if(r2 instanceof either_1.Left)return either_1.left(failure_1.ModifiedFailure.create(value,r2.takeLeft()));return either_1.right(r2.takeRight())}};exports.exists=function(list){return function(value){return list.indexOf(value)<0?result_1.fail("exists",value,{value:value,list:list}):result_1.succeed(value)}};exports.isin=function(list){return function(value){return list.indexOf(value)>-1?result_1.succeed(value):result_1.fail("isin",value)}};exports.match=function(p){var list=[];for(var _i=1;_i<arguments.length;_i++){list[_i-1]=arguments[_i]}return function(value){return list.reduce(function(e,f){return e instanceof either_1.Right?e:e.orElse(function(r){return r.message==="caseOf"?f(value):e})},p(value))}};exports.caseOf=function(t,p){return function(value){return type_1.test(value,t)?p(value):result_1.fail("caseOf",value,{type:t})}};exports.log=function(value){return console.log(value),result_1.succeed(value)}},{"./result":36,"./result/failure":34,"@quenk/noni/lib/data/either":23,"@quenk/noni/lib/data/type":29}],33:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.map=exports.union=exports.intersect=exports.disjoint=exports.restrict=exports.isRecord=void 0;var record_1=require("@quenk/noni/lib/data/record");var record_2=require("@quenk/noni/lib/data/record");var record_3=require("./result/failure/record");var result_1=require("./result");exports.isRecord=function(value){return record_1.isRecord(value)?result_1.succeed(value):result_1.fail("isRecord",value)};exports.restrict=function(tests){return function(value){var add2Reports=function(r,p,k){return p(value[k]).fold(onFailure(k,r),onSuccess(k,r))};var result=record_1.reduce(tests,reports(),add2Reports);return review(result,value)}};exports.disjoint=function(tests){return function(value){var add2Reports=function(r,v,k){return tests.hasOwnProperty(k)?tests[k](v).fold(onFailure(k,r),onSuccess(k,r)):onSuccess(k,r)(v)};var result=record_1.reduce(value,reports(),add2Reports);return review(result,value)}};exports.intersect=function(tests){return function(value){var add2Reports=function(r,v,k){return tests.hasOwnProperty(k)?tests[k](v).fold(onFailure(k,r),onSuccess(k,r)):onSuccess(k,r)(null)};var result=record_1.reduce(value,reports(),add2Reports);return review(result,value)}};exports.union=function(tests){return function(value){var ks=record_2.keys(tests).concat(record_2.keys(value));var add2Reports=function(r,k){return tests.hasOwnProperty(k)?tests[k](value[k]).fold(onFailure(k,r),onSuccess(k,r)):onSuccess(k,r)(value[k])};var results=ks.reduce(add2Reports,reports());return review(results,value)}};exports.map=function(condition){return function(value){var add2Reports=function(r,v,k){return condition(v).fold(onFailure(k,r),onSuccess(k,r))};var result=record_1.reduce(value,reports(),add2Reports);return review(result,value)}};var reports=function(){return{failures:{},values:{}}};var review=function(reports,value){return!record_1.empty(reports.failures)?record_3.fail(reports.failures,value,{value:value}):result_1.succeed(reports.values)};var onFailure=function(key,_a){var failures=_a.failures,values=_a.values;return function(f){var _a;return{values:values,failures:record_1.merge(failures,(_a={},_a[key]=f,_a))}}};var onSuccess=function(key,_a){var failures=_a.failures,values=_a.values;return function(v){var _a;return v==null?{failures:failures,values:values}:{failures:failures,values:record_1.merge(values,(_a={},_a[key]=v,_a))}}}},{"./result":36,"./result/failure/record":35,"@quenk/noni/lib/data/record":26}],34:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.DualFailure=exports.ModifiedFailure=exports.PrimFailure=void 0;var polate_1=require("@quenk/polate");var record_1=require("@quenk/noni/lib/data/record");var PrimFailure=function(){function PrimFailure(message,value,context){if(context===void 0){context={}}this.message=message;this.value=value;this.context=context}PrimFailure.create=function(message,value,ctx){if(ctx===void 0){ctx={}}return new PrimFailure(message,value,ctx)};PrimFailure.prototype.explain=function(templates,ctx){if(templates===void 0){templates={}}if(ctx===void 0){ctx={}}var context=record_1.merge(this.context,ctx);var key=context.$key;var $value=this.value;var split=templates[this.message.split(".")[0]];var str=this.message;var combined=typeof context["$key"]==="string"?context.$key+"."+this.message:this.message;if(templates[combined]){str=templates[combined]}else if(templates[key]){str=templates[key]}else if(templates[split]){str=templates[split]}else if(templates[this.message]){str=templates[this.message]}return polate_1.polate(str,record_1.merge(context,{$value:$value}))};PrimFailure.prototype.toError=function(templates,context){if(templates===void 0){templates={}}if(context===void 0){context={}}return new Error(this.explain(templates,context))};return PrimFailure}();exports.PrimFailure=PrimFailure;var ModifiedFailure=function(){function ModifiedFailure(value,previous){this.value=value;this.previous=previous}Object.defineProperty(ModifiedFailure.prototype,"message",{get:function(){return this.previous.message},enumerable:false,configurable:true});Object.defineProperty(ModifiedFailure.prototype,"context",{get:function(){return this.previous.context},enumerable:false,configurable:true});ModifiedFailure.create=function(value,previous){return new ModifiedFailure(value,previous)};ModifiedFailure.prototype.explain=function(templates,ctx){if(templates===void 0){templates={}}if(ctx===void 0){ctx={}}return this.previous.explain(templates,record_1.merge(ctx,{value:this.value}))};ModifiedFailure.prototype.toError=function(templates,context){if(templates===void 0){templates={}}if(context===void 0){context={}}var e=this.explain(templates,context);return new Error(typeof e==="object"?JSON.stringify(e):e)};return ModifiedFailure}();exports.ModifiedFailure=ModifiedFailure;var DualFailure=function(){function DualFailure(value,left,right){this.value=value;this.left=left;this.right=right}Object.defineProperty(DualFailure.prototype,"message",{get:function(){return this.left.message+" | "+this.right.message},enumerable:false,configurable:true});Object.defineProperty(DualFailure.prototype,"context",{get:function(){return{left:this.left.context,right:this.right.context}},enumerable:false,configurable:true});DualFailure.prototype.explain=function(templates,ctx){if(templates===void 0){templates={}}if(ctx===void 0){ctx={}}var _ctx=record_1.merge(ctx,{value:this.value});return{left:this.left.explain(templates,_ctx),right:this.right.explain(templates,_ctx)}};DualFailure.prototype.toError=function(templates,context){if(templates===void 0){templates={}}if(context===void 0){context={}}var e=this.explain(templates,context);return new Error(typeof e==="object"?JSON.stringify(e):e)};return DualFailure}();exports.DualFailure=DualFailure},{"@quenk/noni/lib/data/record":26,"@quenk/polate":31}],35:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.fail=exports.RecordFailure=void 0;var record_1=require("@quenk/noni/lib/data/record");var either_1=require("@quenk/noni/lib/data/either");var RecordFailure=function(){function RecordFailure(failures,value,contexts){if(contexts===void 0){contexts={}}this.failures=failures;this.value=value;this.contexts=contexts;this.message="object"}Object.defineProperty(RecordFailure.prototype,"context",{get:function(){return this.contexts},enumerable:false,configurable:true});RecordFailure.create=function(errs,val,ctxs){if(ctxs===void 0){ctxs={}}return new RecordFailure(errs,val,ctxs)};RecordFailure.prototype.explain=function(templates,c){if(templates===void 0){templates={}}if(c===void 0){c={}}return record_1.reduce(this.failures,{},function(o,f,$key){var _a;return record_1.merge(o,(_a={},_a[$key]=f.explain(templates,record_1.merge(c,{$key:$key})),_a))})};RecordFailure.prototype.toError=function(templates,context){if(templates===void 0){templates={}}if(context===void 0){context={}}var e=this.explain(templates,context);return new Error(typeof e==="object"?JSON.stringify(e):e)};return RecordFailure}();exports.RecordFailure=RecordFailure;exports.fail=function(failures,value,ctx){if(ctx===void 0){ctx={}}return either_1.left(RecordFailure.create(failures,value,ctx))}},{"@quenk/noni/lib/data/either":23,"@quenk/noni/lib/data/record":26}],36:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.succeed=exports.fail=void 0;var either_1=require("@quenk/noni/lib/data/either");var failure_1=require("./failure");exports.fail=function(msg,value,ctx){if(ctx===void 0){ctx={}}return either_1.left(failure_1.PrimFailure.create(msg,value,ctx))};exports.succeed=function(b){return either_1.right(b)}},{"./failure":34,"@quenk/noni/lib/data/either":23}],37:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.toString=exports.isString=exports.notEmpty=exports.split=exports.trim=exports.lower=exports.lowercase=exports.upper=exports.uppercase=exports.range=exports.minLength=exports.maxLength=exports.matches=void 0;var result_1=require("./result");exports.matches=function(pattern){return function(value){return!pattern.test(value)?result_1.fail("matches",value,{pattern:pattern.toString()}):result_1.succeed(value)}};exports.maxLength=function(target){return function(value){return value.length>target?result_1.fail("maxLength",value,{target:target,value:value}):result_1.succeed(value)}};exports.minLength=function(target){return function(value){return value.length<target?result_1.fail("minLength",value,{target:target,value:value}):result_1.succeed(value)}};exports.range=function(min,max){return function(value){return value.length<min?result_1.fail("range.min",value,{min:min,max:max,value:value}):value.length>max?result_1.fail("range.max",value,{min:min,max:max,value:value}):result_1.succeed(value)}};exports.uppercase=function(value){return result_1.succeed(value.toUpperCase())};exports.upper=exports.uppercase;exports.lowercase=function(value){return result_1.succeed(value.toLowerCase())};exports.lower=exports.lowercase;exports.trim=function(value){return result_1.succeed(value.trim())};exports.split=function(token){return function(value){return result_1.succeed(value.split(token))}};exports.notEmpty=function(value){return value===""?result_1.fail("notEmpty",value):result_1.succeed(value)};exports.isString=function(a){return typeof a==="string"?result_1.succeed(a):result_1.fail("isString",a)};exports.toString=function(a){return result_1.succeed(String(a))}},{"./result":36}],38:[function(require,module,exports){"use strict";var __extends=this&&this.__extends||function(){var extendStatics=function(d,b){extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(b.hasOwnProperty(p))d[p]=b[p]};return extendStatics(d,b)};return function(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}();Object.defineProperty(exports,"__esModule",{value:true});var wml=require("@quenk/wml");var views=require("./wml/link");var util_1=require("../../util");var active_1=require("../state/active");exports.LINK="ww-link";var LinkClickedEvent=function(){function LinkClickedEvent(name,href){this.name=name;this.href=href}return LinkClickedEvent}();exports.LinkClickedEvent=LinkClickedEvent;var Link=function(_super){__extends(Link,_super);function Link(){var _this=_super!==null&&_super.apply(this,arguments)||this;_this.view=new views.Main(_this);_this.name=_this.attrs.ww&&_this.attrs.ww.name?_this.attrs.ww.name:"";_this.title=_this.attrs.ww&&_this.attrs.ww.title?_this.attrs.ww.title:"";_this.href=_this.attrs.ww&&_this.attrs.ww.href?_this.attrs.ww.href:"";_this.values={a:{id:_this.attrs.ww&&_this.attrs.ww.id?_this.attrs.ww.id:"",disabled:_this.attrs.ww&&_this.attrs.ww.disabled?_this.attrs.ww.disabled:null,className:util_1.concat(exports.LINK,_this.attrs.ww&&_this.attrs.ww.className?_this.attrs.ww.className:"",_this.attrs.ww&&_this.attrs.ww.active?active_1.ACTIVE:""),title:_this.attrs.ww&&_this.attrs.ww.title?_this.attrs.ww.title:null,name:_this.attrs.ww&&_this.attrs.ww.name?_this.attrs.ww.name:null,href:_this.attrs.ww&&_this.attrs.ww.href?_this.attrs.ww.href:"#",active:_this.attrs.ww&&_this.attrs.ww.active?_this.attrs.ww.active:false,content:_this.attrs.ww&&_this.attrs.ww.text?[document.createTextNode(_this.attrs.ww.text)]:_this.children,clicked:function(e){if(_this.attrs.ww){var _a=_this.attrs.ww,name_1=_a.name,href=_a.href,onClick=_a.onClick;if(!href)e.preventDefault();if(onClick)onClick(new LinkClickedEvent(name_1,href))}}}};return _this}Link.prototype.activate=function(){var m=util_1.getById(this.view,this.values.a.id);if(m.isJust()){var e=m.get();e.classList.remove(active_1.ACTIVE);e.classList.add(active_1.ACTIVE)}return this};Link.prototype.deactivate=function(){var m=util_1.getById(this.view,this.values.a.id);if(m.isJust())m.get().classList.remove(active_1.ACTIVE);return this};return Link}(wml.Component);exports.Link=Link},{"../../util":64,"../state/active":42,"./wml/link":39,"@quenk/wml":66}],39:[function(require,module,exports){"use strict";var __spreadArrays=this&&this.__spreadArrays||function(){for(var s=0,i=0,il=arguments.length;i<il;i++)s+=arguments[i].length;for(var r=Array(s),k=0,i=0;i<il;i++)for(var a=arguments[i],j=0,jl=a.length;j<jl;j++,k++)r[k]=a[j];return r};Object.defineProperty(exports,"__esModule",{value:true});var __document=require("@quenk/wml/lib/dom");var maybe_1=require("@quenk/noni/lib/data/maybe");var __if=function(__expr,__conseq,__alt){return __expr?__conseq():__alt?__alt():[]};var __forIn=function(list,f,alt){var ret=[];for(var i=0;i<list.length;i++)ret=ret.concat(f(list[i],i,list));return ret.length===0?alt():ret};var __forOf=function(o,f,alt){var ret=[];for(var key in o)if(o.hasOwnProperty(key))ret=ret.concat(f(o[key],key,o));return ret.length===0?alt():ret};var Main=function(){function Main(__context){this.ids={};this.groups={};this.views=[];this.widgets=[];this.tree=__document.createElement("div");this.template=function(__this){return __this.node("a",{id:__context.values.a.id,class:__context.values.a.className,href:__context.values.a.href,title:__context.values.a.title,disabled:__context.values.a.disabled,onclick:__context.values.a.clicked},__spreadArrays(__context.values.a.content))}}Main.prototype.registerView=function(v){this.views.push(v);return v};Main.prototype.register=function(e,attrs){var attrsMap=attrs;if(attrsMap.wml){var _a=attrsMap.wml,id=_a.id,group=_a.group;if(id!=null){if(this.ids.hasOwnProperty(id))throw new Error("Duplicate id '"+id+"' detected!");this.ids[id]=e}if(group!=null){this.groups[group]=this.groups[group]||[];this.groups[group].push(e)}}return e};Main.prototype.node=function(tag,attrs,children){var e=__document.createElement(tag);Object.keys(attrs).forEach(function(key){var value=attrs[key];if(typeof value==="function"){e[key]=value}else if(typeof value==="string"){if(value!=="")e.setAttribute(key,value)}else if(typeof value==="boolean"){e.setAttribute(key,"")}});children.forEach(function(c){switch(typeof c){case"string":case"number":case"boolean":var tn=__document.createTextNode(""+c);e.appendChild(tn);case"object":e.appendChild(c);break;default:throw new TypeError("Can not adopt child "+c+" of type "+typeof c)}});this.register(e,attrs);return e};Main.prototype.widget=function(w,attrs){this.register(w,attrs);this.widgets.push(w);return w.render()};Main.prototype.findById=function(id){var mW=maybe_1.fromNullable(this.ids[id]);return this.views.reduce(function(p,c){return p.isJust()?p:c.findById(id)},mW)};Main.prototype.findByGroup=function(name){var mGroup=maybe_1.fromArray(this.groups.hasOwnProperty(name)?this.groups[name]:[]);return this.views.reduce(function(p,c){return p.isJust()?p:c.findByGroup(name)},mGroup)};Main.prototype.invalidate=function(){var tree=this.tree;var parent=tree.parentNode;if(tree==null)return console.warn("invalidate(): "+"Missing DOM tree!");if(tree.parentNode==null)throw new Error("invalidate(): cannot invalidate this view, it has no parent node!");parent.replaceChild(this.render(),tree)};Main.prototype.render=function(){this.ids={};this.widgets.forEach(function(w){return w.removed()});this.widgets=[];this.views=[];this.tree=this.template(this);this.ids["root"]=this.ids["root"]?this.ids["root"]:this.tree;this.widgets.forEach(function(w){return w.rendered()});return this.tree};return Main}();exports.Main=Main},{"@quenk/noni/lib/data/maybe":25,"@quenk/wml/lib/dom":65}],40:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.VERTICAL="-vertical";exports.PUSHABLE="-pushable";exports.POSITIONED="-positioned";exports.BLOCK="-block";exports.CLEARFIX="-clearfix";exports.JUSTIFIED="-justified";exports.LEFT="-left";exports.RIGHT="-right";exports.HORIZONTAL="-horizontal";exports.MIDDLE="-middle";exports.BOTTOM="-bottom";exports.getBlockClassName=function(attrs){return attrs.ww&&attrs.ww.block===true?exports.BLOCK:""}},{}],41:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.EXTRA_SMALL="-extra-small";exports.SMALL="-small";exports.MEDIUM="-medium";exports.LARGE="-large";exports.EXTRA_LARGE="-extra-large";var Size;(function(Size){Size["ExtraSmall"]="extra-small";Size["Small"]="small";Size["Medium"]="medium";Size["Large"]="large";Size["ExtraLarge"]="extra-large"})(Size=exports.Size||(exports.Size={}));exports.getSizeClassName=function(s){if(s===Size.ExtraSmall)return exports.EXTRA_SMALL;else if(s===Size.Small)return exports.SMALL;else if(s===Size.Medium)return exports.MEDIUM;else if(s===Size.Large)return exports.LARGE;else if(s===Size.ExtraLarge)return exports.EXTRA_LARGE;return""}},{}],42:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var util_1=require("../../util");exports.ACTIVE="-active";exports.activate=function(view,id){return util_1.getById(view,id).map(function(e){e.classList.remove(exports.ACTIVE);e.classList.add(exports.ACTIVE)})};exports.deactivate=function(view,id){return util_1.getById(view,id).map(function(e){return e.classList.remove(exports.ACTIVE)})};exports.isActive=function(view,id){return util_1.getById(view,id).map(function(e){return e.classList.contains(exports.ACTIVE)}).orJust(function(){return false}).get()}},{"../../util":64}],43:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.DEFAULT="-default";exports.PRIMARY="-primary";exports.SUCCESS="-success";exports.INFO="-info";exports.WARNING="-warning";exports.ERROR="-error";exports.OUTLINE="-outline";var Style;(function(Style){Style["Default"]="default";Style["Primary"]="primary";Style["Success"]="success";Style["Info"]="info";Style["Warning"]="warning";Style["Error"]="error"})(Style=exports.Style||(exports.Style={}));exports.styles=[Style.Default,Style.Success,Style.Info,Style.Warning,Style.Error];exports.getStyleClassName=function(s){switch(s){case Style.Default:return exports.DEFAULT;case Style.Primary:return exports.PRIMARY;case Style.Success:return exports.SUCCESS;case Style.Info:return exports.INFO;case Style.Warning:return exports.WARNING;case Style.Error:return exports.ERROR}return exports.DEFAULT}},{}],44:[function(require,module,exports){"use strict";var __extends=this&&this.__extends||function(){var extendStatics=function(d,b){extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(b.hasOwnProperty(p))d[p]=b[p]};return extendStatics(d,b)};return function(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}();Object.defineProperty(exports,"__esModule",{value:true});var views=require("./wml/button");var toolbar_1=require("../toolbar");var active_1=require("../../content/state/active");var orientation_1=require("../../content/orientation");var style_1=require("../../content/style");exports.Style=style_1.Style;var size_1=require("../../content/size");var util_1=require("../../util");var __1=require("../../");var __2=require("../");exports.BUTTON="ww-button";var ButtonClickedEvent=function(_super){__extends(ButtonClickedEvent,_super);function ButtonClickedEvent(){return _super!==null&&_super.apply(this,arguments)||this}return ButtonClickedEvent}(__2.Event);exports.ButtonClickedEvent=ButtonClickedEvent;var Button=function(_super){__extends(Button,_super);function Button(){var _this=_super!==null&&_super.apply(this,arguments)||this;_this.view=_this.attrs.ww&&_this.attrs.ww.anchor?new views.AnchorView(_this):new views.ButtonView(_this);_this.values={button:{wml:{id:"button"},id:__1.getId(_this.attrs),className:util_1.concat(exports.BUTTON,__1.getClassName(_this.attrs),toolbar_1.TOOLBAR_COMPAT,_this.attrs.ww&&_this.attrs.ww.style?style_1.getStyleClassName(_this.attrs.ww.style):style_1.DEFAULT,_this.attrs.ww&&_this.attrs.ww.size?size_1.getSizeClassName(_this.attrs.ww.size):"",_this.attrs.ww&&_this.attrs.ww.outline?style_1.OUTLINE:"",_this.attrs.ww&&_this.attrs.ww.block?orientation_1.BLOCK:"",_this.attrs.ww&&_this.attrs.ww.active?active_1.ACTIVE:""),type:_this.attrs.ww&&_this.attrs.ww.type?_this.attrs.ww.type:"button",name:_this.attrs.ww&&_this.attrs.ww.name?_this.attrs.ww.name:"",disabled:_this.attrs.ww&&_this.attrs.ww.disabled?true:null,anchor:_this.attrs.ww&&_this.attrs.ww.anchor?_this.attrs.ww.anchor:false,onclick:function(e){e.preventDefault();_this.attrs.ww&&_this.attrs.ww.onClick&&_this.attrs.ww.onClick(new ButtonClickedEvent(_this.attrs.ww&&_this.attrs.ww.name?_this.attrs.ww.name:"",_this.attrs.ww.value))},content:function(){return _this.attrs.ww&&_this.attrs.ww.text?[__1.text(_this.attrs.ww.text)]:_this.children}}};return _this}Button.prototype.disable=function(){util_1.getById(this.view,this.values.button.wml.id).map(function(b){return b.setAttribute("disabled","disabled")})};Button.prototype.enable=function(){util_1.getById(this.view,this.values.button.wml.id).map(function(b){return b.removeAttribute("disabled")})};Button.prototype.toggle=function(){var _this=this;util_1.getById(this.view,this.values.button.wml.id).map(function(b){return b.hasAttribute("disabled")?_this.enable():_this.disable()})};return Button}(__2.AbstractControl);exports.Button=Button},{"../":51,"../../":60,"../../content/orientation":40,"../../content/size":41,"../../content/state/active":42,"../../content/style":43,"../../util":64,"../toolbar":58,"./wml/button":45}],45:[function(require,module,exports){"use strict";var __spreadArrays=this&&this.__spreadArrays||function(){for(var s=0,i=0,il=arguments.length;i<il;i++)s+=arguments[i].length;for(var r=Array(s),k=0,i=0;i<il;i++)for(var a=arguments[i],j=0,jl=a.length;j<jl;j++,k++)r[k]=a[j];return r};Object.defineProperty(exports,"__esModule",{value:true});var __document=require("@quenk/wml/lib/dom");var maybe_1=require("@quenk/noni/lib/data/maybe");var __if=function(__expr,__conseq,__alt){return __expr?__conseq():__alt?__alt():[]};var __forIn=function(list,f,alt){var ret=[];for(var i=0;i<list.length;i++)ret=ret.concat(f(list[i],i,list));return ret.length===0?alt():ret};var __forOf=function(o,f,alt){var ret=[];for(var key in o)if(o.hasOwnProperty(key))ret=ret.concat(f(o[key],key,o));return ret.length===0?alt():ret};var ButtonView=function(){function ButtonView(__context){this.ids={};this.groups={};this.views=[];this.widgets=[];this.tree=__document.createElement("div");this.template=function(__this){return __this.node("button",{wml:{id:__context.values.button.wml.id},id:__context.values.button.id,type:__context.values.button.type,name:__context.values.button.name,disabled:__context.values.button.disabled,class:__context.values.button.className,onclick:__context.values.button.onclick},__spreadArrays(__context.values.button.content()))}}ButtonView.prototype.registerView=function(v){this.views.push(v);return v};ButtonView.prototype.register=function(e,attrs){var attrsMap=attrs;if(attrsMap.wml){var _a=attrsMap.wml,id=_a.id,group=_a.group;if(id!=null){if(this.ids.hasOwnProperty(id))throw new Error("Duplicate id '"+id+"' detected!");this.ids[id]=e}if(group!=null){this.groups[group]=this.groups[group]||[];this.groups[group].push(e)}}return e};ButtonView.prototype.node=function(tag,attrs,children){var e=__document.createElement(tag);Object.keys(attrs).forEach(function(key){var value=attrs[key];if(typeof value==="function"){e[key]=value}else if(typeof value==="string"){if(value!=="")e.setAttribute(key,value)}else if(typeof value==="boolean"){e.setAttribute(key,"")}});children.forEach(function(c){switch(typeof c){case"string":case"number":case"boolean":var tn=__document.createTextNode(""+c);e.appendChild(tn);case"object":e.appendChild(c);break;default:throw new TypeError("Can not adopt child "+c+" of type "+typeof c)}});this.register(e,attrs);return e};ButtonView.prototype.widget=function(w,attrs){this.register(w,attrs);this.widgets.push(w);return w.render()};ButtonView.prototype.findById=function(id){var mW=maybe_1.fromNullable(this.ids[id]);return this.views.reduce(function(p,c){return p.isJust()?p:c.findById(id)},mW)};ButtonView.prototype.findByGroup=function(name){var mGroup=maybe_1.fromArray(this.groups.hasOwnProperty(name)?this.groups[name]:[]);return this.views.reduce(function(p,c){return p.isJust()?p:c.findByGroup(name)},mGroup)};ButtonView.prototype.invalidate=function(){var tree=this.tree;var parent=tree.parentNode;if(tree==null)return console.warn("invalidate(): "+"Missing DOM tree!");if(tree.parentNode==null)throw new Error("invalidate(): cannot invalidate this view, it has no parent node!");parent.replaceChild(this.render(),tree)};ButtonView.prototype.render=function(){this.ids={};this.widgets.forEach(function(w){return w.removed()});this.widgets=[];this.views=[];this.tree=this.template(this);this.ids["root"]=this.ids["root"]?this.ids["root"]:this.tree;this.widgets.forEach(function(w){return w.rendered()});return this.tree};return ButtonView}();exports.ButtonView=ButtonView;var AnchorView=function(){function AnchorView(__context){this.ids={};this.groups={};this.views=[];this.widgets=[];this.tree=__document.createElement("div");this.template=function(__this){return __this.node("a",{wml:{id:__context.values.button.wml.id},id:__context.values.button.id,type:__context.values.button.type,href:"#",name:__context.values.button.name,disabled:__context.values.button.disabled,class:__context.values.button.className,onclick:__context.values.button.onclick},__spreadArrays(__context.values.button.content()))}}AnchorView.prototype.registerView=function(v){this.views.push(v);return v};AnchorView.prototype.register=function(e,attrs){var attrsMap=attrs;if(attrsMap.wml){var _a=attrsMap.wml,id=_a.id,group=_a.group;if(id!=null){if(this.ids.hasOwnProperty(id))throw new Error("Duplicate id '"+id+"' detected!");this.ids[id]=e}if(group!=null){this.groups[group]=this.groups[group]||[];this.groups[group].push(e)}}return e};AnchorView.prototype.node=function(tag,attrs,children){var e=__document.createElement(tag);Object.keys(attrs).forEach(function(key){var value=attrs[key];if(typeof value==="function"){e[key]=value}else if(typeof value==="string"){if(value!=="")e.setAttribute(key,value)}else if(typeof value==="boolean"){e.setAttribute(key,"")}});children.forEach(function(c){switch(typeof c){case"string":case"number":case"boolean":var tn=__document.createTextNode(""+c);e.appendChild(tn);case"object":e.appendChild(c);break;default:throw new TypeError("Can not adopt child "+c+" of type "+typeof c)}});this.register(e,attrs);return e};AnchorView.prototype.widget=function(w,attrs){this.register(w,attrs);this.widgets.push(w);return w.render()};AnchorView.prototype.findById=function(id){var mW=maybe_1.fromNullable(this.ids[id]);return this.views.reduce(function(p,c){return p.isJust()?p:c.findById(id)},mW)};AnchorView.prototype.findByGroup=function(name){var mGroup=maybe_1.fromArray(this.groups.hasOwnProperty(name)?this.groups[name]:[]);return this.views.reduce(function(p,c){return p.isJust()?p:c.findByGroup(name)},mGroup)};AnchorView.prototype.invalidate=function(){var tree=this.tree;var parent=tree.parentNode;if(tree==null)return console.warn("invalidate(): "+"Missing DOM tree!");if(tree.parentNode==null)throw new Error("invalidate(): cannot invalidate this view, it has no parent node!");parent.replaceChild(this.render(),tree)};AnchorView.prototype.render=function(){this.ids={};this.widgets.forEach(function(w){return w.removed()});this.widgets=[];this.views=[];this.tree=this.template(this);this.ids["root"]=this.ids["root"]?this.ids["root"]:this.tree;this.widgets.forEach(function(w){return w.rendered()});return this.tree};return AnchorView}();exports.AnchorView=AnchorView},{"@quenk/noni/lib/data/maybe":25,"@quenk/wml/lib/dom":65}],46:[function(require,module,exports){"use strict";var __extends=this&&this.__extends||function(){var extendStatics=function(d,b){extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(b.hasOwnProperty(p))d[p]=b[p]};return extendStatics(d,b)};return function(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}();Object.defineProperty(exports,"__esModule",{value:true});var style=require("../content/style");var util_1=require("../util");var control_1=require("../control");var ValidationState;(function(ValidationState){ValidationState["Neutral"]="neutral";ValidationState["Error"]="error";ValidationState["Success"]="success";ValidationState["Warning"]="warning"})(ValidationState=exports.ValidationState||(exports.ValidationState={}));var AbstractFeedbackControl=function(_super){__extends(AbstractFeedbackControl,_super);function AbstractFeedbackControl(){return _super!==null&&_super.apply(this,arguments)||this}AbstractFeedbackControl.prototype.setMessage=function(msg){exports.setMessage(this.view,this.values.messages.wml.id,msg);return this};AbstractFeedbackControl.prototype.removeMessage=function(){exports.removeMessage(this.view,this.values.messages.wml.id);return this};AbstractFeedbackControl.prototype.setValidationState=function(state){exports.setValidationState(this.view,this.values.control.wml.id,state);return this};AbstractFeedbackControl.prototype.removeValidationState=function(){exports.removeValidationState(this.view,this.values.control.wml.id);return this};AbstractFeedbackControl.prototype.getValidationState=function(){return exports.getValidationState(this.view,this.values.control.wml.id)};return AbstractFeedbackControl}(control_1.AbstractControl);exports.AbstractFeedbackControl=AbstractFeedbackControl;exports.setMessage=function(view,id,msg){return util_1.getById(view,id).map(function(messages){var node=document.createTextNode(msg);while(messages.lastChild)messages.removeChild(messages.lastChild);messages.appendChild(node)})};exports.removeMessage=function(view,id){return util_1.getById(view,id).map(function(messages){while(messages.lastChild)messages.removeChild(messages.lastChild)})};exports.setValidationState=function(view,id,state){exports.removeValidationState(view,id);if(state!==ValidationState.Neutral)util_1.getById(view,id).map(function(e){return e.classList.add(exports.validationState2ClassName(state))})};exports.removeValidationState=function(view,id){util_1.getById(view,id).map(function(h){h.classList.remove(style.SUCCESS);h.classList.remove(style.ERROR);h.classList.remove(style.WARNING)})};exports.getValidationState=function(view,id){return util_1.getById(view,id).map(function(h){if(h.classList.contains(style.SUCCESS))return ValidationState.Success;else if(h.classList.contains(style.WARNING))return ValidationState.Warning;else if(h.classList.contains(style.ERROR))return ValidationState.Error;else return ValidationState.Neutral}).get()};exports.getValidityClassName=function(attrs){if(attrs.ww){if(attrs.ww.error&&attrs.ww.error!="")return style.ERROR;if(attrs.ww.warning&&attrs.ww.warning!="")return style.WARNING;if(attrs.ww.success&&attrs.ww.success!="")return style.SUCCESS}return""};exports.getMessage=function(attrs){if(attrs.ww){if(attrs.ww.error&&attrs.ww.error!="")return attrs.ww.error;if(attrs.ww.warning&&attrs.ww.warning!="")return attrs.ww.warning;if(attrs.ww.success&&attrs.ww.success!="")return attrs.ww.success;if(attrs.ww.message&&attrs.ww.message!="")return attrs.ww.message}return""};exports.validationState2ClassName=function(state){if(state===ValidationState.Success)return style.SUCCESS;else if(state===ValidationState.Warning)return style.WARNING;else if(state===ValidationState.Error)return style.ERROR;else return""}},{"../content/style":43,"../control":51,"../util":64}],47:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var util_1=require("../util");var FocusGainedEvent=function(){function FocusGainedEvent(name){this.name=name}return FocusGainedEvent}();exports.FocusGainedEvent=FocusGainedEvent;var FocusLostEvent=function(){function FocusLostEvent(name){this.name=name}return FocusLostEvent}();exports.FocusLostEvent=FocusLostEvent;exports.focus=function(view,id){util_1.getById(view,id).map(function(e){return e.focus()})}},{"../util":64}],48:[function(require,module,exports){"use strict";var __extends=this&&this.__extends||function(){var extendStatics=function(d,b){extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(b.hasOwnProperty(p))d[p]=b[p]};return extendStatics(d,b)};return function(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}();Object.defineProperty(exports,"__esModule",{value:true});var util_1=require("../util");var feedback_1=require("./feedback");var AbstractFormControl=function(_super){__extends(AbstractFormControl,_super);function AbstractFormControl(){return _super!==null&&_super.apply(this,arguments)||this}return AbstractFormControl}(feedback_1.AbstractFeedbackControl);exports.AbstractFormControl=AbstractFormControl;exports.getLabel=function(attrs){return attrs.ww&&attrs.ww.label?attrs.ww.label:""};exports.setMessage=function(view,id,msg){util_1.getById(view,id).map(function(h){h.setMessage(msg)})};exports.removeMessage=function(view,id){util_1.getById(view,id).map(function(h){h.removeMessage()})}},{"../util":64,"./feedback":46}],49:[function(require,module,exports){"use strict";var __extends=this&&this.__extends||function(){var extendStatics=function(d,b){extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(b.hasOwnProperty(p))d[p]=b[p]};return extendStatics(d,b)};return function(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}();Object.defineProperty(exports,"__esModule",{value:true});var wml_1=require("@quenk/wml");var util_1=require("../../util");var feedback_1=require("../feedback");var __1=require("../../");var help_1=require("./wml/help");exports.HELP="ww-help";var Help=function(_super){__extends(Help,_super);function Help(){var _this=_super!==null&&_super.apply(this,arguments)||this;_this.view=new help_1.Main(_this);_this.values={help:{wml:{id:"help"},id:_this.attrs.ww&&_this.attrs.ww.id?_this.attrs.ww.id:"",className:util_1.concat(exports.HELP,__1.getClassName(_this.attrs)),text:_this.attrs.ww&&_this.attrs.ww.text?[document.createTextNode(_this.attrs.ww.text)]:_this.children}};return _this}Help.prototype.setMessage=function(msg){feedback_1.setMessage(this.view,this.values.help.wml.id,msg);return this};Help.prototype.removeMessage=function(){feedback_1.removeMessage(this.view,this.values.help.wml.id);return this};return Help}(wml_1.Component);exports.Help=Help},{"../../":60,"../../util":64,"../feedback":46,"./wml/help":50,"@quenk/wml":66}],50:[function(require,module,exports){"use strict";var __spreadArrays=this&&this.__spreadArrays||function(){for(var s=0,i=0,il=arguments.length;i<il;i++)s+=arguments[i].length;for(var r=Array(s),k=0,i=0;i<il;i++)for(var a=arguments[i],j=0,jl=a.length;j<jl;j++,k++)r[k]=a[j];return r};Object.defineProperty(exports,"__esModule",{value:true});var __document=require("@quenk/wml/lib/dom");var maybe_1=require("@quenk/noni/lib/data/maybe");var __if=function(__expr,__conseq,__alt){return __expr?__conseq():__alt?__alt():[]};var __forIn=function(list,f,alt){var ret=[];for(var i=0;i<list.length;i++)ret=ret.concat(f(list[i],i,list));return ret.length===0?alt():ret};var __forOf=function(o,f,alt){var ret=[];for(var key in o)if(o.hasOwnProperty(key))ret=ret.concat(f(o[key],key,o));return ret.length===0?alt():ret};var Main=function(){function Main(__context){this.ids={};this.groups={};this.views=[];this.widgets=[];this.tree=__document.createElement("div");this.template=function(__this){return __this.node("span",{wml:{id:__context.values.help.wml.id},id:__context.values.help.id,class:__context.values.help.className},__spreadArrays(__context.values.help.text))}}Main.prototype.registerView=function(v){this.views.push(v);return v};Main.prototype.register=function(e,attrs){var attrsMap=attrs;if(attrsMap.wml){var _a=attrsMap.wml,id=_a.id,group=_a.group;if(id!=null){if(this.ids.hasOwnProperty(id))throw new Error("Duplicate id '"+id+"' detected!");this.ids[id]=e}if(group!=null){this.groups[group]=this.groups[group]||[];this.groups[group].push(e)}}return e};Main.prototype.node=function(tag,attrs,children){var e=__document.createElement(tag);Object.keys(attrs).forEach(function(key){var value=attrs[key];if(typeof value==="function"){e[key]=value}else if(typeof value==="string"){if(value!=="")e.setAttribute(key,value)}else if(typeof value==="boolean"){e.setAttribute(key,"")}});children.forEach(function(c){switch(typeof c){case"string":case"number":case"boolean":var tn=__document.createTextNode(""+c);e.appendChild(tn);case"object":e.appendChild(c);break;default:throw new TypeError("Can not adopt child "+c+" of type "+typeof c)}});this.register(e,attrs);return e};Main.prototype.widget=function(w,attrs){this.register(w,attrs);this.widgets.push(w);return w.render()};Main.prototype.findById=function(id){var mW=maybe_1.fromNullable(this.ids[id]);return this.views.reduce(function(p,c){return p.isJust()?p:c.findById(id)},mW)};Main.prototype.findByGroup=function(name){var mGroup=maybe_1.fromArray(this.groups.hasOwnProperty(name)?this.groups[name]:[]);return this.views.reduce(function(p,c){return p.isJust()?p:c.findByGroup(name)},mGroup)};Main.prototype.invalidate=function(){var tree=this.tree;var parent=tree.parentNode;if(tree==null)return console.warn("invalidate(): "+"Missing DOM tree!");if(tree.parentNode==null)throw new Error("invalidate(): cannot invalidate this view, it has no parent node!");parent.replaceChild(this.render(),tree)};Main.prototype.render=function(){this.ids={};this.widgets.forEach(function(w){return w.removed()});this.widgets=[];this.views=[];this.tree=this.template(this);this.ids["root"]=this.ids["root"]?this.ids["root"]:this.tree;this.widgets.forEach(function(w){return w.rendered()});return this.tree};return Main}();exports.Main=Main},{"@quenk/noni/lib/data/maybe":25,"@quenk/wml/lib/dom":65}],51:[function(require,module,exports){"use strict";var __extends=this&&this.__extends||function(){var extendStatics=function(d,b){extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(b.hasOwnProperty(p))d[p]=b[p]};return extendStatics(d,b)};return function(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}();Object.defineProperty(exports,"__esModule",{value:true});var wml_1=require("@quenk/wml");var maybe_1=require("@quenk/noni/lib/data/maybe");var Event=function(){function Event(name,value){this.name=name;this.value=value}return Event}();exports.Event=Event;var AbstractControl=function(_super){__extends(AbstractControl,_super);function AbstractControl(){return _super!==null&&_super.apply(this,arguments)||this}return AbstractControl}(wml_1.Component);exports.AbstractControl=AbstractControl;exports.getName=function(attrs){return attrs.ww&&attrs.ww.name?attrs.ww.name:""};exports.getDisabled=function(attrs){return attrs.ww&&attrs.ww.disabled?attrs.ww.disabled:undefined};exports.getValue=function(attrs){return attrs.ww&&attrs.ww.value?maybe_1.just(attrs.ww.value):maybe_1.nothing()}},{"@quenk/noni/lib/data/maybe":25,"@quenk/wml":66}],52:[function(require,module,exports){"use strict";var __extends=this&&this.__extends||function(){var extendStatics=function(d,b){extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(b.hasOwnProperty(p))d[p]=b[p]};return extendStatics(d,b)};return function(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}();Object.defineProperty(exports,"__esModule",{value:true});var wml_1=require("@quenk/wml");var util_1=require("../../util");var __1=require("../../");var label_1=require("./wml/label");exports.LABEL="ww-label";var Label=function(_super){__extends(Label,_super);function Label(){var _this=_super!==null&&_super.apply(this,arguments)||this;_this.view=new label_1.Main(_this);_this.values={label:{className:util_1.concat(exports.LABEL,__1.getClassName(_this.attrs)),for:_this.attrs.ww&&_this.attrs.ww.for?_this.attrs.ww.for:"",text:_this.attrs.ww&&_this.attrs.ww.text?[document.createTextNode(_this.attrs.ww.text)]:_this.children}};return _this}return Label}(wml_1.Component);exports.Label=Label},{"../../":60,"../../util":64,"./wml/label":53,"@quenk/wml":66}],53:[function(require,module,exports){"use strict";var __spreadArrays=this&&this.__spreadArrays||function(){for(var s=0,i=0,il=arguments.length;i<il;i++)s+=arguments[i].length;for(var r=Array(s),k=0,i=0;i<il;i++)for(var a=arguments[i],j=0,jl=a.length;j<jl;j++,k++)r[k]=a[j];return r};Object.defineProperty(exports,"__esModule",{value:true});var __document=require("@quenk/wml/lib/dom");var maybe_1=require("@quenk/noni/lib/data/maybe");var __if=function(__expr,__conseq,__alt){return __expr?__conseq():__alt?__alt():[]};var __forIn=function(list,f,alt){var ret=[];for(var i=0;i<list.length;i++)ret=ret.concat(f(list[i],i,list));return ret.length===0?alt():ret};var __forOf=function(o,f,alt){var ret=[];for(var key in o)if(o.hasOwnProperty(key))ret=ret.concat(f(o[key],key,o));return ret.length===0?alt():ret};var Main=function(){function Main(__context){this.ids={};this.groups={};this.views=[];this.widgets=[];this.tree=__document.createElement("div");this.template=function(__this){return __this.node("label",{for:__context.values.label.for,class:__context.values.label.className},__spreadArrays(__context.values.label.text))}}Main.prototype.registerView=function(v){this.views.push(v);return v};Main.prototype.register=function(e,attrs){var attrsMap=attrs;if(attrsMap.wml){var _a=attrsMap.wml,id=_a.id,group=_a.group;if(id!=null){if(this.ids.hasOwnProperty(id))throw new Error("Duplicate id '"+id+"' detected!");this.ids[id]=e}if(group!=null){this.groups[group]=this.groups[group]||[];this.groups[group].push(e)}}return e};Main.prototype.node=function(tag,attrs,children){var e=__document.createElement(tag);Object.keys(attrs).forEach(function(key){var value=attrs[key];if(typeof value==="function"){e[key]=value}else if(typeof value==="string"){if(value!=="")e.setAttribute(key,value)}else if(typeof value==="boolean"){e.setAttribute(key,"")}});children.forEach(function(c){switch(typeof c){case"string":case"number":case"boolean":var tn=__document.createTextNode(""+c);e.appendChild(tn);case"object":e.appendChild(c);break;default:throw new TypeError("Can not adopt child "+c+" of type "+typeof c)}});this.register(e,attrs);return e};Main.prototype.widget=function(w,attrs){this.register(w,attrs);this.widgets.push(w);return w.render()};Main.prototype.findById=function(id){var mW=maybe_1.fromNullable(this.ids[id]);return this.views.reduce(function(p,c){return p.isJust()?p:c.findById(id)},mW)};Main.prototype.findByGroup=function(name){var mGroup=maybe_1.fromArray(this.groups.hasOwnProperty(name)?this.groups[name]:[]);return this.views.reduce(function(p,c){return p.isJust()?p:c.findByGroup(name)},mGroup)};Main.prototype.invalidate=function(){var tree=this.tree;var parent=tree.parentNode;if(tree==null)return console.warn("invalidate(): "+"Missing DOM tree!");if(tree.parentNode==null)throw new Error("invalidate(): cannot invalidate this view, it has no parent node!");parent.replaceChild(this.render(),tree)};Main.prototype.render=function(){this.ids={};this.widgets.forEach(function(w){return w.removed()});this.widgets=[];this.views=[];this.tree=this.template(this);this.ids["root"]=this.ids["root"]?this.ids["root"]:this.tree;this.widgets.forEach(function(w){return w.rendered()});return this.tree};return Main}();exports.Main=Main},{"@quenk/noni/lib/data/maybe":25,"@quenk/wml/lib/dom":65}],54:[function(require,module,exports){"use strict";var __extends=this&&this.__extends||function(){var extendStatics=function(d,b){extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(b.hasOwnProperty(p))d[p]=b[p]};return extendStatics(d,b)};return function(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}();Object.defineProperty(exports,"__esModule",{value:true});var views=require("./wml/text-field");var util_1=require("../../util");var feedback_1=require("../feedback");var form_1=require("../form");var text_input_1=require("../text-input");exports.TextChangedEvent=text_input_1.TextChangedEvent;var __1=require("../../");var __2=require("../");exports.TEXT_FIELD="ww-text-field";var TextField=function(_super){__extends(TextField,_super);function TextField(){var _this=_super!==null&&_super.apply(this,arguments)||this;_this.view=new views.Main(_this);_this.values={root:{wml:{id:"root"},className:util_1.concat(exports.TEXT_FIELD,__1.getClassName(_this.attrs),feedback_1.getValidityClassName(_this.attrs))},messages:{wml:{id:"message"},text:feedback_1.getMessage(_this.attrs)},label:{id:__2.getName(_this.attrs),text:form_1.getLabel(_this.attrs)},control:{wml:{id:"root"},id:__1.getId(_this.attrs),name:__2.getName(_this.attrs),type:_this.attrs.ww&&_this.attrs.ww.type?_this.attrs.ww.type:"text",min:_this.attrs.ww&&_this.attrs.ww.min?_this.attrs.ww.min:undefined,max:_this.attrs.ww&&_this.attrs.ww.max?_this.attrs.ww.max:undefined,focus:_this.attrs.ww&&_this.attrs.ww.focus?_this.attrs.ww.focus:undefined,placeholder:_this.attrs.ww&&_this.attrs.ww.placeholder?_this.attrs.ww.placeholder:"",match:_this.attrs.ww&&_this.attrs.ww.match?_this.attrs.ww.match:undefined,length:_this.attrs.ww&&_this.attrs.ww.length?_this.attrs.ww.length:undefined,value:_this.attrs.ww&&_this.attrs.ww.value?_this.attrs.ww.value:"",disabled:_this.attrs.ww&&_this.attrs.ww.disabled?true:undefined,readOnly:_this.attrs.ww&&_this.attrs.ww.readOnly?true:undefined,rows:_this.attrs.ww&&_this.attrs.ww.rows?_this.attrs.ww.rows:1,oninput:_this.attrs.ww&&_this.attrs.ww.onChange?oninput(_this):function(){},onChange:_this.attrs.ww&&_this.attrs.ww.onChange?_this.attrs.ww.onChange:function(){}}};return _this}TextField.prototype.setMessage=function(msg){getHelp(this).map(function(h){return h.setMessage(msg)});return this};TextField.prototype.removeMessage=function(){getHelp(this).map(function(h){return h.removeMessage()});return this};return TextField}(form_1.AbstractFormControl);exports.TextField=TextField;var getHelp=function(t){return util_1.getById(t.view,t.values.messages.wml.id)};var oninput=function(f){return function(e){if(f.attrs.ww&&f.attrs.ww&&f.attrs.ww.onChange)f.attrs.ww.onChange(new text_input_1.TextChangedEvent(f.attrs.ww&&f.attrs.ww.name?f.attrs.ww.name:"",e.target.value))}}},{"../":51,"../../":60,"../../util":64,"../feedback":46,"../form":48,"../text-input":56,"./wml/text-field":55}],55:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var __document=require("@quenk/wml/lib/dom");var maybe_1=require("@quenk/noni/lib/data/maybe");var label_1=require("../../label");var help_1=require("../../help");var text_input_1=require("../../text-input");var __if=function(__expr,__conseq,__alt){return __expr?__conseq():__alt?__alt():[]};var __forIn=function(list,f,alt){var ret=[];for(var i=0;i<list.length;i++)ret=ret.concat(f(list[i],i,list));return ret.length===0?alt():ret};var __forOf=function(o,f,alt){var ret=[];for(var key in o)if(o.hasOwnProperty(key))ret=ret.concat(f(o[key],key,o));return ret.length===0?alt():ret};var Main=function(){function Main(__context){this.ids={};this.groups={};this.views=[];this.widgets=[];this.tree=__document.createElement("div");this.template=function(__this){return __this.node("div",{wml:{id:__context.values.root.wml.id},class:__context.values.root.className},[__this.widget(new label_1.Label({ww:{for:__context.values.control.id,text:__context.values.label.text}},[]),{ww:{for:__context.values.control.id,text:__context.values.label.text}}),__this.widget(new text_input_1.TextInput({ww:{id:__context.values.control.id,name:__context.values.control.name,focus:__context.values.control.focus,placeholder:__context.values.control.placeholder,onChange:__context.values.control.onChange,block:true,type:__context.values.control.type,min:__context.values.control.min,max:__context.values.control.max,match:__context.values.control.match,length:__context.values.control.length,value:__context.values.control.value,rows:__context.values.control.rows,disabled:__context.values.control.disabled,readOnly:__context.values.control.readOnly}},[]),{ww:{id:__context.values.control.id,name:__context.values.control.name,focus:__context.values.control.focus,placeholder:__context.values.control.placeholder,onChange:__context.values.control.onChange,block:true,type:__context.values.control.type,min:__context.values.control.min,max:__context.values.control.max,match:__context.values.control.match,length:__context.values.control.length,value:__context.values.control.value,rows:__context.values.control.rows,disabled:__context.values.control.disabled,readOnly:__context.values.control.readOnly}}),__this.widget(new help_1.Help({wml:{id:__context.values.messages.wml.id},ww:{text:__context.values.messages.text}},[]),{wml:{id:__context.values.messages.wml.id},ww:{text:__context.values.messages.text}})])}}Main.prototype.registerView=function(v){this.views.push(v);return v};Main.prototype.register=function(e,attrs){var attrsMap=attrs;if(attrsMap.wml){var _a=attrsMap.wml,id=_a.id,group=_a.group;if(id!=null){if(this.ids.hasOwnProperty(id))throw new Error("Duplicate id '"+id+"' detected!");this.ids[id]=e}if(group!=null){this.groups[group]=this.groups[group]||[];this.groups[group].push(e)}}return e};Main.prototype.node=function(tag,attrs,children){var e=__document.createElement(tag);Object.keys(attrs).forEach(function(key){var value=attrs[key];if(typeof value==="function"){e[key]=value}else if(typeof value==="string"){if(value!=="")e.setAttribute(key,value)}else if(typeof value==="boolean"){e.setAttribute(key,"")}});children.forEach(function(c){switch(typeof c){case"string":case"number":case"boolean":var tn=__document.createTextNode(""+c);e.appendChild(tn);case"object":e.appendChild(c);break;default:throw new TypeError("Can not adopt child "+c+" of type "+typeof c)}});this.register(e,attrs);return e};Main.prototype.widget=function(w,attrs){this.register(w,attrs);this.widgets.push(w);return w.render()};Main.prototype.findById=function(id){var mW=maybe_1.fromNullable(this.ids[id]);return this.views.reduce(function(p,c){return p.isJust()?p:c.findById(id)},mW)};Main.prototype.findByGroup=function(name){var mGroup=maybe_1.fromArray(this.groups.hasOwnProperty(name)?this.groups[name]:[]);return this.views.reduce(function(p,c){return p.isJust()?p:c.findByGroup(name)},mGroup)};Main.prototype.invalidate=function(){var tree=this.tree;var parent=tree.parentNode;if(tree==null)return console.warn("invalidate(): "+"Missing DOM tree!");if(tree.parentNode==null)throw new Error("invalidate(): cannot invalidate this view, it has no parent node!");parent.replaceChild(this.render(),tree)};Main.prototype.render=function(){this.ids={};this.widgets.forEach(function(w){return w.removed()});this.widgets=[];this.views=[];this.tree=this.template(this);this.ids["root"]=this.ids["root"]?this.ids["root"]:this.tree;this.widgets.forEach(function(w){return w.rendered()});return this.tree};return Main}();exports.Main=Main},{"../../help":49,"../../label":52,"../../text-input":56,"@quenk/noni/lib/data/maybe":25,"@quenk/wml/lib/dom":65}],56:[function(require,module,exports){"use strict";var __extends=this&&this.__extends||function(){var extendStatics=function(d,b){extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(b.hasOwnProperty(p))d[p]=b[p]};return extendStatics(d,b)};return function(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}();Object.defineProperty(exports,"__esModule",{value:true});var views=require("./wml/text-input");var timer_1=require("@quenk/noni/lib/control/timer");var util_1=require("../../util");var orientation_1=require("../../content/orientation");var size_1=require("../../content/size");var focus_1=require("../focus");var __1=require("../../");var __2=require("../");exports.TEXT_INPUT="ww-text-input";var TextChangedEvent=function(_super){__extends(TextChangedEvent,_super);function TextChangedEvent(){return _super!==null&&_super.apply(this,arguments)||this}return TextChangedEvent}(__2.Event);exports.TextChangedEvent=TextChangedEvent;var TextInput=function(_super){__extends(TextInput,_super);function TextInput(){var _this=_super!==null&&_super.apply(this,arguments)||this;_this.view=_this.attrs.ww&&_this.attrs.ww.rows&&_this.attrs.ww.rows>1?new views.Textarea(_this):new views.Input(_this);_this.values={control:{wml:{id:"root"}},id:__1.getId(_this.attrs),className:util_1.concat(exports.TEXT_INPUT,__1.getClassName(_this.attrs),_this.attrs.ww&&_this.attrs.ww.size?size_1.getSizeClassName(_this.attrs.ww.size):"",_this.attrs.ww&&_this.attrs.ww.block?orientation_1.BLOCK:""),name:__2.getName(_this.attrs),type:_this.attrs.ww&&_this.attrs.ww.type?_this.attrs.ww.type:"text",min:_this.attrs.ww&&_this.attrs.ww.min?String(_this.attrs.ww.min):null,max:_this.attrs.ww&&_this.attrs.ww.max?String(_this.attrs.ww.max):null,match:new RegExp(_this.attrs.ww&&_this.attrs.ww.match?_this.attrs.ww.match:"."),length:_this.attrs.ww&&_this.attrs.ww.length?_this.attrs.ww.length:Infinity,placeholder:_this.attrs.ww&&_this.attrs.ww.placeholder?_this.attrs.ww.placeholder:"",value:_this.attrs.ww&&_this.attrs.ww.value?_this.attrs.ww.value:"",rows:String(_this.attrs.ww&&_this.attrs.ww.rows?_this.attrs.ww.rows:1),disabled:_this.attrs.ww&&_this.attrs.ww.disabled===true?true:null,readOnly:_this.attrs.ww&&_this.attrs.ww.readOnly===true?true:null,onkeydown:function(e){if(e.key.length===1){var value=e.target.value||"";if(!_this.values.match.test(e.key)||value.length>_this.values.length)e.preventDefault()}},oninput:dispatchInput(_this),autofocus:_this.attrs.ww&&_this.attrs.ww.focus?true:undefined,onfocus:function(){if(_this.attrs.ww&&_this.attrs.ww.onFocusGained)_this.attrs.ww.onFocusGained(new focus_1.FocusGainedEvent(__2.getName(_this.attrs)))},onblur:function(){if(_this.attrs.ww&&_this.attrs.ww.onFocusLost)_this.attrs.ww.onFocusLost(new focus_1.FocusLostEvent(__2.getName(_this.attrs)))}};return _this}TextInput.prototype.rendered=function(){if(this.values.autofocus===true)this.focus()};TextInput.prototype.focus=function(){var _this=this;return timer_1.tick(function(){return focus_1.focus(_this.view,_this.values.control.wml.id)})};return TextInput}(__2.AbstractControl);exports.TextInput=TextInput;var dispatchInput=function(i){return function(e){if(i.attrs.ww&&i.attrs.ww.onChange)i.attrs.ww.onChange(new TextChangedEvent(i.attrs&&i.attrs.ww.name?i.attrs.ww.name:"",e.target.value))}}},{"../":51,"../../":60,"../../content/orientation":40,"../../content/size":41,"../../util":64,"../focus":47,"./wml/text-input":57,"@quenk/noni/lib/control/timer":21}],57:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var __document=require("@quenk/wml/lib/dom");var maybe_1=require("@quenk/noni/lib/data/maybe");var __if=function(__expr,__conseq,__alt){return __expr?__conseq():__alt?__alt():[]};var __forIn=function(list,f,alt){var ret=[];for(var i=0;i<list.length;i++)ret=ret.concat(f(list[i],i,list));return ret.length===0?alt():ret};var __forOf=function(o,f,alt){var ret=[];for(var key in o)if(o.hasOwnProperty(key))ret=ret.concat(f(o[key],key,o));return ret.length===0?alt():ret};var Textarea=function(){function Textarea(__context){this.ids={};this.groups={};this.views=[];this.widgets=[];this.tree=__document.createElement("div");this.template=function(__this){return __this.node("textarea",{wml:{id:__context.values.control.wml.id},id:__context.values.id,name:__context.values.name,placeholder:__context.values.placeholder,oninput:__context.values.oninput,value:__context.values.value,disabled:__context.values.disabled,readonly:__context.values.readOnly,rows:__context.values.rows,class:__context.values.className},[document.createTextNode(__context.values.value)])}}Textarea.prototype.registerView=function(v){this.views.push(v);return v};Textarea.prototype.register=function(e,attrs){var attrsMap=attrs;if(attrsMap.wml){var _a=attrsMap.wml,id=_a.id,group=_a.group;if(id!=null){if(this.ids.hasOwnProperty(id))throw new Error("Duplicate id '"+id+"' detected!");this.ids[id]=e}if(group!=null){this.groups[group]=this.groups[group]||[];this.groups[group].push(e)}}return e};Textarea.prototype.node=function(tag,attrs,children){var e=__document.createElement(tag);Object.keys(attrs).forEach(function(key){var value=attrs[key];if(typeof value==="function"){e[key]=value}else if(typeof value==="string"){if(value!=="")e.setAttribute(key,value)}else if(typeof value==="boolean"){e.setAttribute(key,"")}});children.forEach(function(c){switch(typeof c){case"string":case"number":case"boolean":var tn=__document.createTextNode(""+c);e.appendChild(tn);case"object":e.appendChild(c);break;default:throw new TypeError("Can not adopt child "+c+" of type "+typeof c)}});this.register(e,attrs);return e};Textarea.prototype.widget=function(w,attrs){this.register(w,attrs);this.widgets.push(w);return w.render()};Textarea.prototype.findById=function(id){var mW=maybe_1.fromNullable(this.ids[id]);return this.views.reduce(function(p,c){return p.isJust()?p:c.findById(id)},mW)};Textarea.prototype.findByGroup=function(name){var mGroup=maybe_1.fromArray(this.groups.hasOwnProperty(name)?this.groups[name]:[]);return this.views.reduce(function(p,c){return p.isJust()?p:c.findByGroup(name)},mGroup)};Textarea.prototype.invalidate=function(){var tree=this.tree;var parent=tree.parentNode;if(tree==null)return console.warn("invalidate(): "+"Missing DOM tree!");if(tree.parentNode==null)throw new Error("invalidate(): cannot invalidate this view, it has no parent node!");parent.replaceChild(this.render(),tree)};Textarea.prototype.render=function(){this.ids={};this.widgets.forEach(function(w){return w.removed()});this.widgets=[];this.views=[];this.tree=this.template(this);this.ids["root"]=this.ids["root"]?this.ids["root"]:this.tree;this.widgets.forEach(function(w){return w.rendered()});return this.tree};return Textarea}();exports.Textarea=Textarea;var Input=function(){function Input(__context){this.ids={};this.groups={};this.views=[];this.widgets=[];this.tree=__document.createElement("div");this.template=function(__this){return __this.node("input",{wml:{id:__context.values.control.wml.id},id:__context.values.id,name:__context.values.name,type:__context.values.type,min:__context.values.min,max:__context.values.max,placeholder:__context.values.placeholder,oninput:__context.values.oninput,onkeydown:__context.values.onkeydown,autofocus:__context.values.autofocus,value:__context.values.value,disabled:__context.values.disabled,readonly:__context.values.readOnly,class:__context.values.className},[])}}Input.prototype.registerView=function(v){this.views.push(v);return v};Input.prototype.register=function(e,attrs){var attrsMap=attrs;if(attrsMap.wml){var _a=attrsMap.wml,id=_a.id,group=_a.group;if(id!=null){if(this.ids.hasOwnProperty(id))throw new Error("Duplicate id '"+id+"' detected!");this.ids[id]=e}if(group!=null){this.groups[group]=this.groups[group]||[];this.groups[group].push(e)}}return e};Input.prototype.node=function(tag,attrs,children){var e=__document.createElement(tag);Object.keys(attrs).forEach(function(key){var value=attrs[key];if(typeof value==="function"){e[key]=value}else if(typeof value==="string"){if(value!=="")e.setAttribute(key,value)}else if(typeof value==="boolean"){e.setAttribute(key,"")}});children.forEach(function(c){switch(typeof c){case"string":case"number":case"boolean":var tn=__document.createTextNode(""+c);e.appendChild(tn);case"object":e.appendChild(c);break;default:throw new TypeError("Can not adopt child "+c+" of type "+typeof c)}});this.register(e,attrs);return e};Input.prototype.widget=function(w,attrs){this.register(w,attrs);this.widgets.push(w);return w.render()};Input.prototype.findById=function(id){var mW=maybe_1.fromNullable(this.ids[id]);return this.views.reduce(function(p,c){return p.isJust()?p:c.findById(id)},mW)};Input.prototype.findByGroup=function(name){var mGroup=maybe_1.fromArray(this.groups.hasOwnProperty(name)?this.groups[name]:[]);return this.views.reduce(function(p,c){return p.isJust()?p:c.findByGroup(name)},mGroup)};Input.prototype.invalidate=function(){var tree=this.tree;var parent=tree.parentNode;if(tree==null)return console.warn("invalidate(): "+"Missing DOM tree!");if(tree.parentNode==null)throw new Error("invalidate(): cannot invalidate this view, it has no parent node!");parent.replaceChild(this.render(),tree)};Input.prototype.render=function(){this.ids={};this.widgets.forEach(function(w){return w.removed()});this.widgets=[];this.views=[];this.tree=this.template(this);this.ids["root"]=this.ids["root"]?this.ids["root"]:this.tree;this.widgets.forEach(function(w){return w.rendered()});return this.tree};return Input}();exports.Input=Input},{"@quenk/noni/lib/data/maybe":25,"@quenk/wml/lib/dom":65}],58:[function(require,module,exports){"use strict";var __extends=this&&this.__extends||function(){var extendStatics=function(d,b){extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(b.hasOwnProperty(p))d[p]=b[p]};return extendStatics(d,b)};return function(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}();Object.defineProperty(exports,"__esModule",{value:true});var views=require("./wml/toolbar");var wml_1=require("@quenk/wml");var util_1=require("../../util");var __1=require("../../");exports.TOOLBAR="ww-toolbar";exports.TOOLBAR_COMPAT="-toolbar-compat";var Toolbar=function(_super){__extends(Toolbar,_super);function Toolbar(){var _this=_super!==null&&_super.apply(this,arguments)||this;_this.view=new views.Main(_this);_this.values={root:{id:__1.getId(_this.attrs),className:util_1.concat(exports.TOOLBAR,__1.getClassName(_this.attrs))}};return _this}return Toolbar}(wml_1.Component);exports.Toolbar=Toolbar},{"../../":60,"../../util":64,"./wml/toolbar":59,"@quenk/wml":66}],59:[function(require,module,exports){"use strict";var __spreadArrays=this&&this.__spreadArrays||function(){for(var s=0,i=0,il=arguments.length;i<il;i++)s+=arguments[i].length;for(var r=Array(s),k=0,i=0;i<il;i++)for(var a=arguments[i],j=0,jl=a.length;j<jl;j++,k++)r[k]=a[j];return r};Object.defineProperty(exports,"__esModule",{value:true});var __document=require("@quenk/wml/lib/dom");var maybe_1=require("@quenk/noni/lib/data/maybe");var __if=function(__expr,__conseq,__alt){return __expr?__conseq():__alt?__alt():[]};var __forIn=function(list,f,alt){var ret=[];for(var i=0;i<list.length;i++)ret=ret.concat(f(list[i],i,list));return ret.length===0?alt():ret};var __forOf=function(o,f,alt){var ret=[];for(var key in o)if(o.hasOwnProperty(key))ret=ret.concat(f(o[key],key,o));return ret.length===0?alt():ret};var Main=function(){function Main(__context){this.ids={};this.groups={};this.views=[];this.widgets=[];this.tree=__document.createElement("div");this.template=function(__this){return __this.node("div",{id:__context.values.root.id,class:__context.values.root.className},__spreadArrays(__context.children))}}Main.prototype.registerView=function(v){this.views.push(v);return v};Main.prototype.register=function(e,attrs){var attrsMap=attrs;if(attrsMap.wml){var _a=attrsMap.wml,id=_a.id,group=_a.group;if(id!=null){if(this.ids.hasOwnProperty(id))throw new Error("Duplicate id '"+id+"' detected!");this.ids[id]=e}if(group!=null){this.groups[group]=this.groups[group]||[];this.groups[group].push(e)}}return e};Main.prototype.node=function(tag,attrs,children){var e=__document.createElement(tag);Object.keys(attrs).forEach(function(key){var value=attrs[key];if(typeof value==="function"){e[key]=value}else if(typeof value==="string"){if(value!=="")e.setAttribute(key,value)}else if(typeof value==="boolean"){e.setAttribute(key,"")}});children.forEach(function(c){switch(typeof c){case"string":case"number":case"boolean":var tn=__document.createTextNode(""+c);e.appendChild(tn);case"object":e.appendChild(c);break;default:throw new TypeError("Can not adopt child "+c+" of type "+typeof c)}});this.register(e,attrs);return e};Main.prototype.widget=function(w,attrs){this.register(w,attrs);this.widgets.push(w);return w.render()};Main.prototype.findById=function(id){var mW=maybe_1.fromNullable(this.ids[id]);return this.views.reduce(function(p,c){return p.isJust()?p:c.findById(id)},mW)};Main.prototype.findByGroup=function(name){var mGroup=maybe_1.fromArray(this.groups.hasOwnProperty(name)?this.groups[name]:[]);return this.views.reduce(function(p,c){return p.isJust()?p:c.findByGroup(name)},mGroup)};Main.prototype.invalidate=function(){var tree=this.tree;var parent=tree.parentNode;if(tree==null)return console.warn("invalidate(): "+"Missing DOM tree!");if(tree.parentNode==null)throw new Error("invalidate(): cannot invalidate this view, it has no parent node!");parent.replaceChild(this.render(),tree)};Main.prototype.render=function(){this.ids={};this.widgets.forEach(function(w){return w.removed()});this.widgets=[];this.views=[];this.tree=this.template(this);this.ids["root"]=this.ids["root"]?this.ids["root"]:this.tree;this.widgets.forEach(function(w){return w.rendered()});return this.tree};return Main}();exports.Main=Main},{"@quenk/noni/lib/data/maybe":25,"@quenk/wml/lib/dom":65}],60:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.getId=function(attrs){return attrs.ww&&attrs.ww.id?attrs.ww.id:""};exports.getClassName=function(attrs){return attrs.ww&&attrs.ww.className?attrs.ww.className:""};exports.text=function(str){return document.createTextNode(String(str==null?"":str))}},{}],61:[function(require,module,exports){"use strict";var __extends=this&&this.__extends||function(){var extendStatics=function(d,b){extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(b.hasOwnProperty(p))d[p]=b[p]};return extendStatics(d,b)};return function(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}();Object.defineProperty(exports,"__esModule",{value:true});var views=require("./wml/grid");var util_1=require("../../util");var __1=require("../");exports.GRID_LAYOUT="ww-grid-layout";exports.GRID_LAYOUT_ROW="ww-grid-layout__row";exports.GRID_LAYOUT_COLUMN="ww-grid-layout__column";var GridLayout=function(_super){__extends(GridLayout,_super);function GridLayout(){var _this=_super!==null&&_super.apply(this,arguments)||this;_this.view=new views.GridLayout(_this);_this.values={content:{id:_this.attrs.ww&&_this.attrs.ww.id,wml:{id:"root"},className:function(){var c=_this.attrs.ww&&_this.attrs.ww.className?_this.attrs.ww.className:"";return util_1.concat(exports.GRID_LAYOUT,__1.LAYOUT,c)}}};return _this}return GridLayout}(__1.AbstractLayout);exports.GridLayout=GridLayout;var Row=function(_super){__extends(Row,_super);function Row(){var _this=_super!==null&&_super.apply(this,arguments)||this;_this.view=new views.Row(_this);_this.values={content:{id:_this.attrs.ww&&_this.attrs.ww.id,wml:{id:"row"},className:function(){var c=_this.attrs.ww&&_this.attrs.ww.className?_this.attrs.ww.className:"";return util_1.concat(exports.GRID_LAYOUT_ROW,c)}}};return _this}return Row}(__1.AbstractLayout);exports.Row=Row;var Column=function(_super){__extends(Column,_super);function Column(){var _this=_super!==null&&_super.apply(this,arguments)||this;_this.view=new views.Column(_this);_this.values={content:{id:_this.attrs.ww&&_this.attrs.ww.id,wml:{id:"column"},className:function(){if(_this.attrs.ww!=null){return util_1.concat(exports.GRID_LAYOUT_COLUMN,_this.attrs.ww.span?"-span"+_this.attrs.ww.span:"-span12",_this.attrs.ww.offset?"-offset"+_this.attrs.ww.offset:"",_this.attrs.ww.className)}else{return util_1.concat(exports.GRID_LAYOUT_COLUMN,"-span12")}}}};return _this}return Column}(__1.AbstractLayout);exports.Column=Column},{"../":63,"../../util":64,"./wml/grid":62}],62:[function(require,module,exports){"use strict";var __spreadArrays=this&&this.__spreadArrays||function(){for(var s=0,i=0,il=arguments.length;i<il;i++)s+=arguments[i].length;for(var r=Array(s),k=0,i=0;i<il;i++)for(var a=arguments[i],j=0,jl=a.length;j<jl;j++,k++)r[k]=a[j];return r};Object.defineProperty(exports,"__esModule",{value:true});var __document=require("@quenk/wml/lib/dom");var maybe_1=require("@quenk/noni/lib/data/maybe");var __if=function(__expr,__conseq,__alt){return __expr?__conseq():__alt?__alt():[]};var __forIn=function(list,f,alt){var ret=[];for(var i=0;i<list.length;i++)ret=ret.concat(f(list[i],i,list));return ret.length===0?alt():ret};var __forOf=function(o,f,alt){var ret=[];for(var key in o)if(o.hasOwnProperty(key))ret=ret.concat(f(o[key],key,o));return ret.length===0?alt():ret};var GridLayout=function(){function GridLayout(__context){this.ids={};this.groups={};this.views=[];this.widgets=[];this.tree=__document.createElement("div");this.template=function(__this){return __this.node("div",{wml:{id:__context.values.content.wml.id},id:__context.values.content.id,class:__context.values.content.className()},__spreadArrays(__context.children))}}GridLayout.prototype.registerView=function(v){this.views.push(v);return v};GridLayout.prototype.register=function(e,attrs){var attrsMap=attrs;if(attrsMap.wml){var _a=attrsMap.wml,id=_a.id,group=_a.group;if(id!=null){if(this.ids.hasOwnProperty(id))throw new Error("Duplicate id '"+id+"' detected!");this.ids[id]=e}if(group!=null){this.groups[group]=this.groups[group]||[];this.groups[group].push(e)}}return e};GridLayout.prototype.node=function(tag,attrs,children){var e=__document.createElement(tag);Object.keys(attrs).forEach(function(key){var value=attrs[key];if(typeof value==="function"){e[key]=value}else if(typeof value==="string"){if(value!=="")e.setAttribute(key,value)}else if(typeof value==="boolean"){e.setAttribute(key,"")}});children.forEach(function(c){switch(typeof c){case"string":case"number":case"boolean":var tn=__document.createTextNode(""+c);e.appendChild(tn);case"object":e.appendChild(c);break;default:throw new TypeError("Can not adopt child "+c+" of type "+typeof c)}});this.register(e,attrs);return e};GridLayout.prototype.widget=function(w,attrs){this.register(w,attrs);this.widgets.push(w);return w.render()};GridLayout.prototype.findById=function(id){var mW=maybe_1.fromNullable(this.ids[id]);return this.views.reduce(function(p,c){return p.isJust()?p:c.findById(id)},mW)};GridLayout.prototype.findByGroup=function(name){var mGroup=maybe_1.fromArray(this.groups.hasOwnProperty(name)?this.groups[name]:[]);return this.views.reduce(function(p,c){return p.isJust()?p:c.findByGroup(name)},mGroup)};GridLayout.prototype.invalidate=function(){var tree=this.tree;var parent=tree.parentNode;if(tree==null)return console.warn("invalidate(): "+"Missing DOM tree!");if(tree.parentNode==null)throw new Error("invalidate(): cannot invalidate this view, it has no parent node!");parent.replaceChild(this.render(),tree)};GridLayout.prototype.render=function(){this.ids={};this.widgets.forEach(function(w){return w.removed()});this.widgets=[];this.views=[];this.tree=this.template(this);this.ids["root"]=this.ids["root"]?this.ids["root"]:this.tree;this.widgets.forEach(function(w){return w.rendered()});return this.tree};return GridLayout}();exports.GridLayout=GridLayout;var Row=function(){function Row(__context){this.ids={};this.groups={};this.views=[];this.widgets=[];this.tree=__document.createElement("div");this.template=function(__this){return __this.node("div",{wml:{id:__context.values.content.wml.id},id:__context.values.content.id,class:__context.values.content.className()},__spreadArrays(__context.children))}}Row.prototype.registerView=function(v){this.views.push(v);return v};Row.prototype.register=function(e,attrs){var attrsMap=attrs;if(attrsMap.wml){var _a=attrsMap.wml,id=_a.id,group=_a.group;if(id!=null){if(this.ids.hasOwnProperty(id))throw new Error("Duplicate id '"+id+"' detected!");this.ids[id]=e}if(group!=null){this.groups[group]=this.groups[group]||[];this.groups[group].push(e)}}return e};Row.prototype.node=function(tag,attrs,children){var e=__document.createElement(tag);Object.keys(attrs).forEach(function(key){var value=attrs[key];if(typeof value==="function"){e[key]=value}else if(typeof value==="string"){if(value!=="")e.setAttribute(key,value)}else if(typeof value==="boolean"){e.setAttribute(key,"")}});children.forEach(function(c){switch(typeof c){case"string":case"number":case"boolean":var tn=__document.createTextNode(""+c);e.appendChild(tn);case"object":e.appendChild(c);break;default:throw new TypeError("Can not adopt child "+c+" of type "+typeof c)}});this.register(e,attrs);return e};Row.prototype.widget=function(w,attrs){this.register(w,attrs);this.widgets.push(w);return w.render()};Row.prototype.findById=function(id){var mW=maybe_1.fromNullable(this.ids[id]);return this.views.reduce(function(p,c){return p.isJust()?p:c.findById(id)},mW)};Row.prototype.findByGroup=function(name){var mGroup=maybe_1.fromArray(this.groups.hasOwnProperty(name)?this.groups[name]:[]);return this.views.reduce(function(p,c){return p.isJust()?p:c.findByGroup(name)},mGroup)};Row.prototype.invalidate=function(){var tree=this.tree;var parent=tree.parentNode;if(tree==null)return console.warn("invalidate(): "+"Missing DOM tree!");if(tree.parentNode==null)throw new Error("invalidate(): cannot invalidate this view, it has no parent node!");parent.replaceChild(this.render(),tree)};Row.prototype.render=function(){this.ids={};this.widgets.forEach(function(w){return w.removed()});this.widgets=[];this.views=[];this.tree=this.template(this);this.ids["root"]=this.ids["root"]?this.ids["root"]:this.tree;this.widgets.forEach(function(w){return w.rendered()});return this.tree};return Row}();exports.Row=Row;var Column=function(){function Column(__context){this.ids={};this.groups={};this.views=[];this.widgets=[];this.tree=__document.createElement("div");this.template=function(__this){return __this.node("div",{wml:{id:__context.values.content.wml.id},id:__context.values.content.id,class:__context.values.content.className()},__spreadArrays(__context.children))}}Column.prototype.registerView=function(v){this.views.push(v);return v};Column.prototype.register=function(e,attrs){var attrsMap=attrs;if(attrsMap.wml){var _a=attrsMap.wml,id=_a.id,group=_a.group;if(id!=null){if(this.ids.hasOwnProperty(id))throw new Error("Duplicate id '"+id+"' detected!");this.ids[id]=e}if(group!=null){this.groups[group]=this.groups[group]||[];this.groups[group].push(e)}}return e};Column.prototype.node=function(tag,attrs,children){var e=__document.createElement(tag);Object.keys(attrs).forEach(function(key){var value=attrs[key];if(typeof value==="function"){e[key]=value}else if(typeof value==="string"){if(value!=="")e.setAttribute(key,value)}else if(typeof value==="boolean"){e.setAttribute(key,"")}});children.forEach(function(c){switch(typeof c){case"string":case"number":case"boolean":var tn=__document.createTextNode(""+c);e.appendChild(tn);case"object":e.appendChild(c);break;default:throw new TypeError("Can not adopt child "+c+" of type "+typeof c)}});this.register(e,attrs);return e};Column.prototype.widget=function(w,attrs){this.register(w,attrs);this.widgets.push(w);return w.render()};Column.prototype.findById=function(id){var mW=maybe_1.fromNullable(this.ids[id]);return this.views.reduce(function(p,c){return p.isJust()?p:c.findById(id)},mW)};Column.prototype.findByGroup=function(name){var mGroup=maybe_1.fromArray(this.groups.hasOwnProperty(name)?this.groups[name]:[]);return this.views.reduce(function(p,c){return p.isJust()?p:c.findByGroup(name)},mGroup)};Column.prototype.invalidate=function(){var tree=this.tree;var parent=tree.parentNode;if(tree==null)return console.warn("invalidate(): "+"Missing DOM tree!");if(tree.parentNode==null)throw new Error("invalidate(): cannot invalidate this view, it has no parent node!");parent.replaceChild(this.render(),tree)};Column.prototype.render=function(){this.ids={};this.widgets.forEach(function(w){return w.removed()});this.widgets=[];this.views=[];this.tree=this.template(this);this.ids["root"]=this.ids["root"]?this.ids["root"]:this.tree;this.widgets.forEach(function(w){return w.rendered()});return this.tree};return Column}();exports.Column=Column},{"@quenk/noni/lib/data/maybe":25,"@quenk/wml/lib/dom":65}],63:[function(require,module,exports){"use strict";var __extends=this&&this.__extends||function(){var extendStatics=function(d,b){extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(b.hasOwnProperty(p))d[p]=b[p]};return extendStatics(d,b)};return function(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}();Object.defineProperty(exports,"__esModule",{value:true});var wml_1=require("@quenk/wml");var util_1=require("../util");exports.LAYOUT="-layout";var AbstractLayout=function(_super){__extends(AbstractLayout,_super);function AbstractLayout(){return _super!==null&&_super.apply(this,arguments)||this}AbstractLayout.prototype.setContent=function(c){exports.doSetContent(this.view,this.values.content.wml.id,c);return this};AbstractLayout.prototype.removeContent=function(){exports.doRemoveContent(this.view,this.values.content.wml.id);return this};return AbstractLayout}(wml_1.Component);exports.AbstractLayout=AbstractLayout;exports.doSetContent=function(view,id,content){var maybeRoot=view.findById(id);if(maybeRoot.isNothing())return util_1.warnMissing(view,id);var n=maybeRoot.get();while(n.firstChild)n.removeChild(n.firstChild);for(var i=0;i<content.length;i++)n.appendChild(content[i])};exports.doRemoveContent=function(view,id){var maybeNode=view.findById(id);if(maybeNode.isNothing())return util_1.warnMissing(view,id);var n=maybeNode.get();while(n.firstChild)n.removeChild(n.firstChild)}},{"../util":64,"@quenk/wml":66}],64:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.getById=function(view,id){var m=view.findById(id);if(m.isNothing()){exports.warnMissing(view,id)}return m};exports.warnMissing=function(view,id){console.warn("The view ",view,' does not have an id "'+id+'"!')};exports.combine=function(str,joiner){if(joiner===void 0){joiner=" "}return str.filter(function(s){return s!=null||s!=""}).join(joiner)};exports.concat=function(){var str=[];for(var _i=0;_i<arguments.length;_i++){str[_i]=arguments[_i]}return str.filter(function(s){return s==null||s==""?false:true}).map(function(s){return s.trim()}).join(" ")};exports.noop=function(){};exports.replaceContent=function(r,node){while(node.lastChild)node.removeChild(node.lastChild);node.appendChild(r.render())};exports.debounce=function(f,delay){var timer=-1;return delay===0?f:function(a){if(timer===-1){timer=window.setTimeout(function(){return f(a)},delay)}else{clearTimeout(timer);timer=window.setTimeout(function(){return f(a)},delay)}}}},{}],65:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var ATTRS_ESC_REGEX=/[><&\u2028\u2029]/g;var HTML_ESC_REGEX=/["'&<>]/;var ATTR_ESC_MAP={"&":"\\u0026",">":"\\u003e","<":"\\u003c",'"':"\\u0022","\u2028":"\\u2028","\u2029":"\\u2029"};var HTML_ENT_MAP={'"':"&quot;","&":"&amp;","'":"&#x27;","<":"&lt;",">":"&gt;"};var voidElements=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"];var SSRText=function(){function SSRText(value){this.value=value}SSRText.prototype.renderToString=function(){return escapeHTML(this.value)};return SSRText}();exports.SSRText=SSRText;var SSRElement=function(){function SSRElement(name){this.name=name;this.attrs=[];this.children=[]}SSRElement.prototype.setAttribute=function(key,value){var newKey=escapeAttrValue(key);this.attrs.push(value===""?newKey:newKey+'="'+escapeAttrValue(value)+'"')};SSRElement.prototype.appendChild=function(node){this.children.push(node)};SSRElement.prototype.renderToString=function(){var name=this.name;var childs=this.children.map(function(c){return c.renderToString()}).join("");var attrs=this.attrs.join(" ");var open="<"+name+" "+attrs+">";return voidElements.indexOf(name)>-1?open:"<"+open+">"+childs+"</"+name+">"};return SSRElement}();exports.SSRElement=SSRElement;var isBrowser=window!=null&&document!=null;var escapeAttrValue=function(value){return value.replace(ATTRS_ESC_REGEX,function(hit){return ATTR_ESC_MAP[hit]})};var escapeHTML=function(value){return value.replace(HTML_ESC_REGEX,function(hit){return HTML_ENT_MAP[hit]})};exports.createTextNode=function(txt){return isBrowser?document.createTextNode(txt):new SSRText(txt)};exports.createElement=function(name){return isBrowser?document.createElement(name):new SSRElement(name)}},{}],66:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var Component=function(){function Component(attrs,children){this.attrs=attrs;this.children=children}Component.prototype.rendered=function(){};Component.prototype.removed=function(){};Component.prototype.render=function(){return this.view.render()};return Component}();exports.Component=Component;exports.renderAsNode=function(r){return r.render()}},{}],67:[function(require,module,exports){var process=module.exports={};var cachedSetTimeout;var cachedClearTimeout;function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}(function(){try{if(typeof setTimeout==="function"){cachedSetTimeout=setTimeout}else{cachedSetTimeout=defaultSetTimout}}catch(e){cachedSetTimeout=defaultSetTimout}try{if(typeof clearTimeout==="function"){cachedClearTimeout=clearTimeout}else{cachedClearTimeout=defaultClearTimeout}}catch(e){cachedClearTimeout=defaultClearTimeout}})();function runTimeout(fun){if(cachedSetTimeout===setTimeout){return setTimeout(fun,0)}if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout){cachedSetTimeout=setTimeout;return setTimeout(fun,0)}try{return cachedSetTimeout(fun,0)}catch(e){try{return cachedSetTimeout.call(null,fun,0)}catch(e){return cachedSetTimeout.call(this,fun,0)}}}function runClearTimeout(marker){if(cachedClearTimeout===clearTimeout){return clearTimeout(marker)}if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout){cachedClearTimeout=clearTimeout;return clearTimeout(marker)}try{return cachedClearTimeout(marker)}catch(e){try{return cachedClearTimeout.call(null,marker)}catch(e){return cachedClearTimeout.call(this,marker)}}}var queue=[];var draining=false;var currentQueue;var queueIndex=-1;function cleanUpNextTick(){if(!draining||!currentQueue){return}draining=false;if(currentQueue.length){queue=currentQueue.concat(queue)}else{queueIndex=-1}if(queue.length){drainQueue()}}function drainQueue(){if(draining){return}var timeout=runTimeout(cleanUpNextTick);draining=true;var len=queue.length;while(len){currentQueue=queue;queue=[];while(++queueIndex<len){if(currentQueue){currentQueue[queueIndex].run()}}queueIndex=-1;len=queue.length}currentQueue=null;draining=false;runClearTimeout(timeout)}process.nextTick=function(fun){var args=new Array(arguments.length-1);if(arguments.length>1){for(var i=1;i<arguments.length;i++){args[i-1]=arguments[i]}}queue.push(new Item(fun,args));if(queue.length===1&&!draining){runTimeout(drainQueue)}};function Item(fun,array){this.fun=fun;this.array=array}Item.prototype.run=function(){this.fun.apply(null,this.array)};process.title="browser";process.browser=true;process.env={};process.argv=[];process.version="";process.versions={};function noop(){}process.on=noop;process.addListener=noop;process.once=noop;process.off=noop;process.removeListener=noop;process.removeAllListeners=noop;process.emit=noop;process.prependListener=noop;process.prependOnceListener=noop;process.listeners=function(name){return[]};process.binding=function(name){throw new Error("process.binding is not supported")};process.cwd=function(){return"/"};process.chdir=function(dir){throw new Error("process.chdir is not supported")};process.umask=function(){return 0}},{}],68:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var ESCAPED_SUBS="@xR25$e!#fda8f623";function preserve_escaped(value){return value.split("..").join(ESCAPED_SUBS)}function unpreserve_escaped(value){return value.split(ESCAPED_SUBS).join(".")}function boundary_to_dot(value){return value.split("][").join(".").split("[").join(".")}function strip_braces(value){return value.split("[").join(".").split("]").join("")}function escape_dots(value){var val=value.split("'");return val.length<3?val.join("'"):val.map(function(seg){if(seg.length<3)return seg;if(seg[0]==="."||seg[seg.length-1]===".")return seg;return seg.split(".").join("&&")}).join("")}function unescape_dots(value){return unpreserve_escaped(value.split("&&").join("."))}function partify(value){if(!value)return;return escape_dots(strip_braces(boundary_to_dot(preserve_escaped(""+value)))).split(".")}function canClone(o){return typeof o.__CLONE__==="function"}function clone(o){if(typeof o!=="object"||o===null)return o;if(Array.isArray(o))return o.map(clone);return canClone(o)?o.__CLONE__(clone):o.constructor!==Object?o:Object.keys(o).reduce(function(pre,k){pre[k]=typeof o[k]==="object"?clone(o[k]):o[k];return pre},{})}function get(path,o){var parts=partify(path);var first;if(typeof o==="object"){if(parts.length===1)return o[unescape_dots(parts[0])];if(parts.length===0)return;first=o[parts.shift()];return typeof o==="object"&&o!==null?parts.reduce(function(target,prop){if(target==null)return target;return target[unescape_dots(prop)]},first):null}else{throw new TypeError("get(): expects an object got "+typeof o)}}exports.get=get;function set(path,value,obj){var parts=partify(path);if(typeof obj!=="object"||obj==null){return clone(obj)}else{return _set(obj,value,parts)}}exports.set=set;function _set(obj,value,parts){var o;var k;if(parts.length===0)return value;o=typeof obj!=="object"||obj===null?{}:clone(obj);k=unescape_dots(parts[0]);o[k]=_set(o[k],value,parts.slice(1));return o}function default_1(k,v,o){if(o==null)return get(k,v);else return set(k,v,o)}exports.default=default_1},{}],69:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.escape=exports.PostFormApp=void 0;var timer_1=require("@quenk/noni/lib/control/timer");var future_1=require("@quenk/noni/lib/control/monad/future");var util_1=require("@quenk/wml-widgets/lib/util");var feedback_1=require("@quenk/wml-widgets/lib/control/feedback");var browser_1=require("@quenk/jhr/lib/browser");var post_1=require("@board/validation/lib/post");var app_1=require("./views/app");var preview_1=require("./views/preview");var finish_1=require("./views/finish");var CHANGE_EVENT_DURATION=250;var messages={notNull:"{name} is required.",minLength:"{name} must be at least {target} characters.",maxLength:"{name} must not be more than {target} characters.",isString:"{name} is invalid.",isNumber:"{name} is invalid."};var escapeMap={"&":"&amp;",'"':"&quot;","'":"&#39;","<":"&lt;",">":"&gt;"};var agent=browser_1.createAgent();var PostFormApp=function(){function PostFormApp(node){var _this=this;this.node=node;this.view=new app_1.PostFormAppView(this);this.previewView=new preview_1.PreviewView(this);this.finishView=new finish_1.FinishView(this);this.values={post:{data:{},errors:{},onChange:timer_1.debounce(function(e){var name=e.name,value=e.value;if(post_1.schema.hasOwnProperty(name)){_this.values.post.data[name]=value;var eResult=post_1.schema[name](value);if(eResult.isLeft()){var msg=eResult.takeLeft().explain(messages,{name:name});_this.setControlErrorMessage(e.name,msg)}else{_this.values.post.data[e.name]=eResult.takeRight();_this.setControlOk(e.name)}_this.validatePost()}},CHANGE_EVENT_DURATION)},buttons:{preview:{id:"preview",click:function(){return _this.showPreview()}},post:{click:function(){return _this.showPost()}},send:{id:"send",click:function(){return _this.send()}}}}}PostFormApp.create=function(node){return new PostFormApp(node)};PostFormApp.prototype.setControlErrorMessage=function(id,msg){var mCtl=util_1.getById(this.view,id);if(mCtl.isJust()){var ctl=mCtl.get();ctl.setMessage(msg);ctl.setValidationState(feedback_1.ValidationState.Error)}};PostFormApp.prototype.setControlOk=function(id){var mCtl=util_1.getById(this.view,id);if(mCtl.isJust()){var ctl=mCtl.get();ctl.setMessage("");ctl.setValidationState(feedback_1.ValidationState.Success)}};PostFormApp.prototype.validatePost=function(){var state=post_1.validate(this.values.post.data).isRight();var mbtn=util_1.getById(this.view,this.values.buttons.preview.id);if(mbtn.isJust()){var btn=mbtn.get();if(state)btn.enable();else btn.disable()}};PostFormApp.prototype.showPreview=function(){this.render(this.previewView)};PostFormApp.prototype.showPost=function(){this.render(this.view);this.validatePost()};PostFormApp.prototype.showFinished=function(){this.render(this.finishView)};PostFormApp.prototype.send=function(){var _this=this;var mButton=util_1.getById(this.previewView,this.values.buttons.send.id);if(mButton.isJust())mButton.get().disable();agent.post("/post",this.values.post.data).chain(function(r){if(r.code===401){_this.values.post.errors=r.body.errors;_this.view.invalidate()}else if(r.code===201){_this.showFinished()}else{return future_1.raise(new Error("Status: "+r.code))}return future_1.pure(undefined)}).catch(function(e){alert("An error occured while sending your request!");_this.view.invalidate();return future_1.raise(e)}).fork(console.error,function(){})};PostFormApp.prototype.run=function(){this.render(this.view)};PostFormApp.prototype.render=function(view){while(this.node.firstChild!=null)this.node.removeChild(this.node.firstChild);this.node.appendChild(view.render());window.scroll(0,0)};return PostFormApp}();exports.PostFormApp=PostFormApp;exports.escape=function(str){return str.replace(/[&"'<>]/g,function(t){return escapeMap[t]})};PostFormApp.create(document.getElementById("main")).run()},{"./views/app":70,"./views/finish":71,"./views/preview":72,"@board/validation/lib/post":73,"@quenk/jhr/lib/browser":5,"@quenk/noni/lib/control/monad/future":20,"@quenk/noni/lib/control/timer":21,"@quenk/wml-widgets/lib/control/feedback":46,"@quenk/wml-widgets/lib/util":64}],70:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.PostFormAppView=void 0;var __document=require("@quenk/wml/lib/dom");var maybe_1=require("@quenk/noni/lib/data/maybe");var text_field_1=require("@quenk/wml-widgets/lib/control/text-field");var grid_1=require("@quenk/wml-widgets/lib/layout/grid");var button_1=require("@quenk/wml-widgets/lib/control/button");var link_1=require("@quenk/wml-widgets/lib/content/link");var __if=function(__expr,__conseq,__alt){return __expr?__conseq():__alt?__alt():[]};var __forIn=function(list,f,alt){var ret=[];for(var i=0;i<list.length;i++)ret=ret.concat(f(list[i],i,list));return ret.length===0?alt():ret};var __forOf=function(o,f,alt){var ret=[];for(var key in o)if(o.hasOwnProperty(key))ret=ret.concat(f(o[key],key,o));return ret.length===0?alt():ret};var PostFormAppView=function(){function PostFormAppView(__context){this.ids={};this.groups={};this.views=[];this.widgets=[];this.tree=__document.createElement("div");this.template=function(__this){return __this.node("form",{},[__this.widget(new grid_1.GridLayout({},[__this.widget(new grid_1.Row({},[__this.widget(new grid_1.Column({ww:{span:10,offset:1}},[__this.widget(new grid_1.Row({},[__this.widget(new grid_1.Column({},[__this.node("div",{class:"back-link-container"},[__this.widget(new link_1.Link({ww:{className:"back-link",text:"← Back to Listings",href:"/"}},[]),{ww:{className:"back-link",text:"← Back to Listings",href:"/"}})])]),{})]),{}),__this.widget(new grid_1.Row({},[__this.widget(new grid_1.Column({ww:{span:6}},[__this.widget(new text_field_1.TextField({wml:{id:"company"},ww:{name:"company",label:"Company*",value:__context.values.post.data.company,onChange:__context.values.post.onChange}},[]),{wml:{id:"company"},ww:{name:"company",label:"Company*",value:__context.values.post.data.company,onChange:__context.values.post.onChange}})]),{ww:{span:6}}),__this.widget(new grid_1.Column({ww:{span:6}},[__this.widget(new text_field_1.TextField({wml:{id:"company_email"},ww:{name:"company_email",label:"Email*",value:__context.values.post.data.company_email,onChange:__context.values.post.onChange}},[]),{wml:{id:"company_email"},ww:{name:"company_email",label:"Email*",value:__context.values.post.data.company_email,onChange:__context.values.post.onChange}})]),{ww:{span:6}})]),{}),__this.widget(new grid_1.Row({},[__this.widget(new grid_1.Column({ww:{span:6}},[__this.widget(new text_field_1.TextField({wml:{id:"company_logo"},ww:{name:"company_logo",label:"Logo URL",placeholder:"(Image should be 640x640)",value:__context.values.post.data.company_logo,onChange:__context.values.post.onChange}},[]),{wml:{id:"company_logo"},ww:{name:"company_logo",label:"Logo URL",placeholder:"(Image should be 640x640)",value:__context.values.post.data.company_logo,onChange:__context.values.post.onChange}})]),{ww:{span:6}}),__this.widget(new grid_1.Column({ww:{span:6}},[__this.widget(new text_field_1.TextField({wml:{id:"apply_url"},ww:{name:"apply_url",label:"Apply Link",value:__context.values.post.data.apply_url,onChange:__context.values.post.onChange}},[]),{wml:{id:"apply_url"},ww:{name:"apply_url",label:"Apply Link",value:__context.values.post.data.apply_url,onChange:__context.values.post.onChange}})]),{ww:{span:6}})]),{}),__this.widget(new grid_1.Row({},[__this.widget(new grid_1.Column({},[__this.widget(new text_field_1.TextField({wml:{id:"title"},ww:{name:"title",label:"Job Title*",placeholder:"Software Engineer With Finance Background Needed",value:__context.values.post.data.title,onChange:__context.values.post.onChange}},[]),{wml:{id:"title"},ww:{name:"title",label:"Job Title*",placeholder:"Software Engineer With Finance Background Needed",value:__context.values.post.data.title,onChange:__context.values.post.onChange}})]),{})]),{}),__this.widget(new grid_1.Row({},[__this.widget(new grid_1.Column({},[__this.widget(new text_field_1.TextField({wml:{id:"description"},ww:{name:"description",placeholder:"Job Decription",rows:12,value:__context.values.post.data.description,onChange:__context.values.post.onChange}},[]),{wml:{id:"description"},ww:{name:"description",placeholder:"Job Decription",rows:12,value:__context.values.post.data.description,onChange:__context.values.post.onChange}})]),{})]),{})]),{ww:{span:10,offset:1}})]),{}),__this.widget(new grid_1.Row({},[__this.widget(new grid_1.Column({},[__this.node("div",{class:"preview-button-container"},[__this.widget(new button_1.Button({wml:{id:__context.values.buttons.preview.id},ww:{disabled:true,className:"preview-button -primary -large",text:"Preview",onClick:__context.values.buttons.preview.click}},[]),{wml:{id:__context.values.buttons.preview.id},ww:{disabled:true,className:"preview-button -primary -large",text:"Preview",onClick:__context.values.buttons.preview.click}})]),__this.node("p",{class:"required-note"},[__this.node("b",{},[__document.createTextNode("* indicates a field is required.")])])]),{})]),{})]),{})])}}PostFormAppView.prototype.registerView=function(v){this.views.push(v);return v};PostFormAppView.prototype.register=function(e,attrs){var attrsMap=attrs;if(attrsMap.wml){var _a=attrsMap.wml,id=_a.id,group=_a.group;if(id!=null){if(this.ids.hasOwnProperty(id))throw new Error("Duplicate id '"+id+"' detected!");this.ids[id]=e}if(group!=null){this.groups[group]=this.groups[group]||[];this.groups[group].push(e)}}return e};PostFormAppView.prototype.node=function(tag,attrs,children){var e=__document.createElement(tag);Object.keys(attrs).forEach(function(key){var value=attrs[key];if(typeof value==="function"){e[key]=value}else if(typeof value==="string"){if(value!=="")e.setAttribute(key,value)}else if(typeof value==="boolean"){e.setAttribute(key,"")}});children.forEach(function(c){switch(typeof c){case"string":case"number":case"boolean":var tn=__document.createTextNode(""+c);e.appendChild(tn);case"object":e.appendChild(c);break;default:throw new TypeError("Can not adopt child "+c+" of type "+typeof c)}});this.register(e,attrs);return e};PostFormAppView.prototype.widget=function(w,attrs){this.register(w,attrs);this.widgets.push(w);return w.render()};PostFormAppView.prototype.findById=function(id){var mW=maybe_1.fromNullable(this.ids[id]);return this.views.reduce(function(p,c){return p.isJust()?p:c.findById(id)},mW)};PostFormAppView.prototype.findByGroup=function(name){var mGroup=maybe_1.fromArray(this.groups.hasOwnProperty(name)?this.groups[name]:[]);return this.views.reduce(function(p,c){return p.isJust()?p:c.findByGroup(name)},mGroup)};PostFormAppView.prototype.invalidate=function(){var tree=this.tree;var parent=tree.parentNode;if(tree==null)return console.warn("invalidate(): "+"Missing DOM tree!");if(tree.parentNode==null)throw new Error("invalidate(): cannot invalidate this view, it has no parent node!");parent.replaceChild(this.render(),tree)};PostFormAppView.prototype.render=function(){this.ids={};this.widgets.forEach(function(w){return w.removed()});this.widgets=[];this.views=[];this.tree=this.template(this);this.ids["root"]=this.ids["root"]?this.ids["root"]:this.tree;this.widgets.forEach(function(w){return w.rendered()});return this.tree};return PostFormAppView}();exports.PostFormAppView=PostFormAppView},{"@quenk/noni/lib/data/maybe":25,"@quenk/wml-widgets/lib/content/link":38,"@quenk/wml-widgets/lib/control/button":44,"@quenk/wml-widgets/lib/control/text-field":54,"@quenk/wml-widgets/lib/layout/grid":61,"@quenk/wml/lib/dom":65}],71:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.FinishView=void 0;var __document=require("@quenk/wml/lib/dom");var maybe_1=require("@quenk/noni/lib/data/maybe");var link_1=require("@quenk/wml-widgets/lib/content/link");var grid_1=require("@quenk/wml-widgets/lib/layout/grid");var __if=function(__expr,__conseq,__alt){return __expr?__conseq():__alt?__alt():[]};var __forIn=function(list,f,alt){var ret=[];for(var i=0;i<list.length;i++)ret=ret.concat(f(list[i],i,list));return ret.length===0?alt():ret};var __forOf=function(o,f,alt){var ret=[];for(var key in o)if(o.hasOwnProperty(key))ret=ret.concat(f(o[key],key,o));return ret.length===0?alt():ret};var FinishView=function(){function FinishView(__context){this.ids={};this.groups={};this.views=[];this.widgets=[];this.tree=__document.createElement("div");this.template=function(__this){return __this.widget(new grid_1.GridLayout({},[__this.widget(new grid_1.Row({},[__this.widget(new grid_1.Column({ww:{span:8,offset:2}},[__this.widget(new grid_1.Row({},[__this.widget(new grid_1.Column({},[__this.node("h1",{class:"post-title"},[__document.createTextNode("Success !")])]),{})]),{}),__this.widget(new grid_1.Row({},[__this.widget(new grid_1.Column({},[__this.node("p",{},[__document.createTextNode("\n            Your job posting has been saved and is waiting approval.\n            Approval usually takes up to 48 hours so check back later to see\n            it in the listings.\n\n            It we need any more information we will contact you via the email\n            you supplied.\n          ")]),__this.node("p",{},[__document.createTextNode("Thanks for choosing Caribbean Developers!")])]),{})]),{}),__this.widget(new grid_1.Row({},[__this.widget(new grid_1.Column({},[__this.node("div",{class:"action-container"},[__this.widget(new link_1.Link({ww:{text:"See Current Listings",className:"current-listings-link",href:"/"}},[]),{ww:{text:"See Current Listings",className:"current-listings-link",href:"/"}})])]),{})]),{})]),{ww:{span:8,offset:2}})]),{})]),{})}}FinishView.prototype.registerView=function(v){this.views.push(v);return v};FinishView.prototype.register=function(e,attrs){var attrsMap=attrs;if(attrsMap.wml){var _a=attrsMap.wml,id=_a.id,group=_a.group;if(id!=null){if(this.ids.hasOwnProperty(id))throw new Error("Duplicate id '"+id+"' detected!");this.ids[id]=e}if(group!=null){this.groups[group]=this.groups[group]||[];this.groups[group].push(e)}}return e};FinishView.prototype.node=function(tag,attrs,children){var e=__document.createElement(tag);Object.keys(attrs).forEach(function(key){var value=attrs[key];if(typeof value==="function"){e[key]=value}else if(typeof value==="string"){if(value!=="")e.setAttribute(key,value)}else if(typeof value==="boolean"){e.setAttribute(key,"")}});children.forEach(function(c){switch(typeof c){case"string":case"number":case"boolean":var tn=__document.createTextNode(""+c);e.appendChild(tn);case"object":e.appendChild(c);break;default:throw new TypeError("Can not adopt child "+c+" of type "+typeof c)}});this.register(e,attrs);return e};FinishView.prototype.widget=function(w,attrs){this.register(w,attrs);this.widgets.push(w);return w.render()};FinishView.prototype.findById=function(id){var mW=maybe_1.fromNullable(this.ids[id]);return this.views.reduce(function(p,c){return p.isJust()?p:c.findById(id)},mW)};FinishView.prototype.findByGroup=function(name){var mGroup=maybe_1.fromArray(this.groups.hasOwnProperty(name)?this.groups[name]:[]);return this.views.reduce(function(p,c){return p.isJust()?p:c.findByGroup(name)},mGroup)};FinishView.prototype.invalidate=function(){var tree=this.tree;var parent=tree.parentNode;if(tree==null)return console.warn("invalidate(): "+"Missing DOM tree!");if(tree.parentNode==null)throw new Error("invalidate(): cannot invalidate this view, it has no parent node!");parent.replaceChild(this.render(),tree)};FinishView.prototype.render=function(){this.ids={};this.widgets.forEach(function(w){return w.removed()});this.widgets=[];this.views=[];this.tree=this.template(this);this.ids["root"]=this.ids["root"]?this.ids["root"]:this.tree;this.widgets.forEach(function(w){return w.rendered()});return this.tree};return FinishView}();exports.FinishView=FinishView},{"@quenk/noni/lib/data/maybe":25,"@quenk/wml-widgets/lib/content/link":38,"@quenk/wml-widgets/lib/layout/grid":61,"@quenk/wml/lib/dom":65}],72:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.PreviewView=void 0;var __document=require("@quenk/wml/lib/dom");var maybe_1=require("@quenk/noni/lib/data/maybe");var wml_widgets_1=require("@quenk/wml-widgets");var button_1=require("@quenk/wml-widgets/lib/control/button");var link_1=require("@quenk/wml-widgets/lib/content/link");var grid_1=require("@quenk/wml-widgets/lib/layout/grid");var __if=function(__expr,__conseq,__alt){return __expr?__conseq():__alt?__alt():[]};var __forIn=function(list,f,alt){var ret=[];for(var i=0;i<list.length;i++)ret=ret.concat(f(list[i],i,list));return ret.length===0?alt():ret};var __forOf=function(o,f,alt){var ret=[];for(var key in o)if(o.hasOwnProperty(key))ret=ret.concat(f(o[key],key,o));return ret.length===0?alt():ret};var PreviewView=function(){function PreviewView(__context){this.ids={};this.groups={};this.views=[];this.widgets=[];this.tree=__document.createElement("div");this.template=function(__this){return __this.widget(new grid_1.GridLayout({},[__this.widget(new grid_1.Row({},[__this.widget(new grid_1.Column({ww:{span:8,offset:2}},[__this.widget(new grid_1.Row({},[__this.widget(new grid_1.Column({},[__this.node("h1",{class:"post-title"},[wml_widgets_1.text(__context.values.post.data.title)])]),{})]),{}),__this.widget(new grid_1.Row({},[__this.widget(new grid_1.Column({},[__this.node("dl",{class:"ww-description-list ww-property-list -horizontal"},[])]),{})]),{}),__this.widget(new grid_1.Row({},[__this.widget(new grid_1.Column({},[__this.node("h3",{},[__document.createTextNode("Job Description")]),__this.node("p",{},[wml_widgets_1.text(__context.values.post.data.description)])]),{})]),{}),__this.widget(new grid_1.Row({},[__this.widget(new grid_1.Column({},[__this.node("div",{class:"action-container"},[__this.widget(new link_1.Link({ww:{text:"Back",onClick:__context.values.buttons.post.click}},[]),{ww:{text:"Back",onClick:__context.values.buttons.post.click}}),__this.widget(new button_1.Button({wml:{id:__context.values.buttons.send.id},ww:{className:"send-button -primary -large",text:"Post",onClick:__context.values.buttons.send.click}},[]),{wml:{id:__context.values.buttons.send.id},ww:{className:"send-button -primary -large",text:"Post",onClick:__context.values.buttons.send.click}})])]),{})]),{})]),{ww:{span:8,offset:2}})]),{})]),{})}}PreviewView.prototype.registerView=function(v){this.views.push(v);return v};PreviewView.prototype.register=function(e,attrs){var attrsMap=attrs;if(attrsMap.wml){var _a=attrsMap.wml,id=_a.id,group=_a.group;if(id!=null){if(this.ids.hasOwnProperty(id))throw new Error("Duplicate id '"+id+"' detected!");this.ids[id]=e}if(group!=null){this.groups[group]=this.groups[group]||[];this.groups[group].push(e)}}return e};PreviewView.prototype.node=function(tag,attrs,children){var e=__document.createElement(tag);Object.keys(attrs).forEach(function(key){var value=attrs[key];if(typeof value==="function"){e[key]=value}else if(typeof value==="string"){if(value!=="")e.setAttribute(key,value)}else if(typeof value==="boolean"){e.setAttribute(key,"")}});children.forEach(function(c){switch(typeof c){case"string":case"number":case"boolean":var tn=__document.createTextNode(""+c);e.appendChild(tn);case"object":e.appendChild(c);break;default:throw new TypeError("Can not adopt child "+c+" of type "+typeof c)}});this.register(e,attrs);return e};PreviewView.prototype.widget=function(w,attrs){this.register(w,attrs);this.widgets.push(w);return w.render()};PreviewView.prototype.findById=function(id){var mW=maybe_1.fromNullable(this.ids[id]);return this.views.reduce(function(p,c){return p.isJust()?p:c.findById(id)},mW)};PreviewView.prototype.findByGroup=function(name){var mGroup=maybe_1.fromArray(this.groups.hasOwnProperty(name)?this.groups[name]:[]);return this.views.reduce(function(p,c){return p.isJust()?p:c.findByGroup(name)},mGroup)};PreviewView.prototype.invalidate=function(){var tree=this.tree;var parent=tree.parentNode;if(tree==null)return console.warn("invalidate(): "+"Missing DOM tree!");if(tree.parentNode==null)throw new Error("invalidate(): cannot invalidate this view, it has no parent node!");parent.replaceChild(this.render(),tree)};PreviewView.prototype.render=function(){this.ids={};this.widgets.forEach(function(w){return w.removed()});this.widgets=[];this.views=[];this.tree=this.template(this);this.ids["root"]=this.ids["root"]?this.ids["root"]:this.tree;this.widgets.forEach(function(w){return w.rendered()});return this.tree};return PreviewView}();exports.PreviewView=PreviewView},{"@quenk/noni/lib/data/maybe":25,"@quenk/wml-widgets":60,"@quenk/wml-widgets/lib/content/link":38,"@quenk/wml-widgets/lib/control/button":44,"@quenk/wml-widgets/lib/layout/grid":61,"@quenk/wml/lib/dom":65}],73:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.validate=exports.schema=void 0;var preconditions_1=require("@quenk/preconditions");var record_1=require("@quenk/preconditions/lib/record");var string_1=require("@quenk/preconditions/lib/string");exports.schema={title:preconditions_1.and(preconditions_1.notNull,preconditions_1.every(string_1.isString,string_1.trim,string_1.minLength(3),string_1.maxLength(140))),description:preconditions_1.and(preconditions_1.notNull,preconditions_1.every(string_1.isString,string_1.trim,string_1.minLength(1),string_1.maxLength(8e3))),company:preconditions_1.and(preconditions_1.notNull,preconditions_1.every(string_1.isString,string_1.trim,string_1.minLength(3),string_1.maxLength(80))),company_email:preconditions_1.and(preconditions_1.notNull,preconditions_1.every(string_1.isString,string_1.trim,string_1.minLength(3),string_1.maxLength(80))),company_logo:preconditions_1.optional(preconditions_1.every(string_1.isString,string_1.trim,string_1.minLength(3),string_1.maxLength(3e3))),apply_url:preconditions_1.optional(preconditions_1.every(string_1.isString,string_1.trim,string_1.minLength(3),string_1.maxLength(3e3)))};exports.validate=preconditions_1.and(record_1.isRecord,record_1.restrict(exports.schema))},{"@quenk/preconditions":32,"@quenk/preconditions/lib/record":33,"@quenk/preconditions/lib/string":37}]},{},[69]);
  