Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@evs-chris/raui

Package Overview
Dependencies
Maintainers
1
Versions
173
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@evs-chris/raui - npm Package Compare versions

Comparing version 0.15.2 to 0.15.3

13

es/Autocomplete.js

@@ -230,2 +230,3 @@ import Ractive from 'ractive';

var justPopped = false;
var opts = { init: false, defer: true };

@@ -255,8 +256,13 @@ var watches = [

}),
h.observe('rac.selected', scrollView) ];
h.observe('rac.selected', scrollView),
h.observe('rac.popped', function (v) {
if (v) { setTimeout(function () { return justPopped = false; }, 300); }
justPopped = true;
}) ];
h.set('rac.checkBlur', function checkBlur(node) {
if (justPopped) { return false; }
var active = document.activeElement;
if (!~formNodes.indexOf(active.nodeName) && !active.getAttribute('tabindex')) { return; }
var inputs = h.findAll('input');
var inputs = h.findAll('input').concat(h.get('rac.pop').popFindAll('input'));
if (document.activeElement && !~inputs.indexOf(document.activeElement)) { h.get('rac.key')({ which: 9 }); }

@@ -280,3 +286,4 @@ });

var drop = Object.assign({}, data('raui.autocomplete.drop'), data('raui.autocomplete.primary.drop'));
return (".rautocomplete {\n position: relative;\n display: inline-block;\n }\n \n .rac-drop {\n width: 2em;\n height: 100%;\n position: absolute;\n top: 0;\n right: 2px;\n cursor: pointer;\n }\n .rac-drop:after {\n font-family: " + (drop.font || 'sans-serif') + ";\n content: " + (drop.string || '\'\u25be\'') + ";\n position: absolute;\n top: calc(50% - 0.5em);\n height: 1em;\n line-height: 1em;\n width: 100%;\n text-align: center;\n font-weight: " + (drop.weight || 'normal') + ";\n color: " + (drop.color || primary.bc || '#ccc') + ";\n }\n \n .rac-pop {\n min-width: 100%;\n }\n \n .rac-pop > .rpop {\n padding: 0;\n }\n \n .rac-list {\n display: flex;\n flex-direction: column;\n max-height: 50vh;\n min-height: 2.125em;\n max-width: 100%;\n overflow: auto;\n }\n \n .rac-item {\n color: " + (primary.fg || '#222') + ";\n background-color: " + (primary.bg || '#fff') + ";\n padding: 0.25em;\n cursor: pointer;\n }\n \n .rac-selected {\n color: " + (primary.bg || '#fff') + ";\n background-color: " + (primary.fga || '#07e') + ";\n }\n \n .rac-hover {\n color: " + (primary.fg || '#222') + ";\n background-color: " + (primary.bc || '#ccc') + ";\n }\n \n .rac-selected.rac-hover {\n background-color: " + (primary.bc || '#ccc') + ";\n color: " + (primary.fga || '#07e') + ";\n }\n \n .rac-invalid {\n cursor: not-allowed;\n }\n \n input.rac-modal {\n width: 100%;\n box-sizing: border-box;\n }");
var boxy = data('raui.form.boxy');
return (".rautocomplete {\n position: relative;\n display: inline-block;\n }\n \n .rac-drop {\n width: 2em;\n height: 100%;\n position: absolute;\n top: 0;\n right: 2px;\n cursor: pointer;\n }\n .rac-drop:after {\n font-family: " + (drop.font || 'sans-serif') + ";\n content: " + (drop.string || '\'\u25be\'') + ";\n position: absolute;\n top: calc(50% - 0.5em);\n height: 1em;\n line-height: 1em;\n width: 100%;\n text-align: center;\n font-weight: " + (drop.weight || 'normal') + ";\n color: " + (drop.color || primary.bc || '#ccc') + ";\n }\n \n .rac-pop {\n min-width: 100%;\n }\n \n .rac-pop > .rpop {\n padding: 0;\n }\n \n .rac-list {\n display: flex;\n flex-direction: column;\n max-height: 50vh;\n min-height: 2.125em;\n max-width: 100%;\n overflow: auto;\n }\n \n .rac-item {\n color: " + (primary.fg || '#222') + ";\n background-color: " + (primary.bg || '#fff') + ";\n padding: 0.25em;\n cursor: pointer;\n }\n \n .rac-selected {\n color: " + (primary.bg || '#fff') + ";\n background-color: " + (primary.fga || '#07e') + ";\n }\n \n .rac-hover {\n color: " + (primary.fg || '#222') + ";\n background-color: " + (primary.bc || '#ccc') + ";\n }\n \n .rac-selected.rac-hover {\n background-color: " + (primary.bc || '#ccc') + ";\n color: " + (primary.fga || '#07e') + ";\n }\n \n .rac-invalid {\n cursor: not-allowed;\n }\n \n input.rac-modal {\n width: 100%;\n box-sizing: border-box;\n display: block;\n border-width: " + (boxy ? '0.0625em' : '0 0 0.0625em 0') + ";\n border-color: " + (primary.bc || '#ccc') + ";\n border-style: solid;\n box-sizing: border-box;\n background-color: " + (boxy ? primary.bg || '#fff' : 'transparent') + ";\n transition: 0.2s ease-in-out;\n transition-property: box-shadow, color;\n outline: none;\n box-shadow: none;\n width: 100%;\n margin-bottom: 0.8em;\n font-size: 1.1em;" + (boxy ? ("\n border-radius: " + (primary.radius || '0.2em') + ";") : '') + "\n font-weight: 400;\n font-family: inherit;\n }");
}).call(this, data)].join(' '); },

@@ -283,0 +290,0 @@ cssId: 'rautocomplete',

@@ -1,1 +0,1 @@

import Ractive from"ractive";import{Popover}from"./Popover";import{autofocus}from"./form";var template={v:4,t:[{t:7,e:"span",m:[{t:13,n:"class",f:"rautocomplete field-wrapper",g:1},{n:["pop"],t:70,f:{r:["@context","$1"],s:'[(_0).set("rac.pop",_1)]'}}],f:[{t:7,e:"input",m:[{t:8,r:"extra-attributes"},{n:["dblclick"],t:70,f:{r:["rac.pop","@node"],s:"[_0.show(_1)]"}},{n:["focus"],t:70,f:{r:["rac"],s:"[_0.stash()]"}},{n:["blur"],t:70,f:{r:["rac","@node"],s:"[_0.checkBlur(_1)]"}},{n:["input"],t:70,f:{r:["rac","@event"],s:"[_0.input(_1)]"}},{n:["keydown"],t:70,f:{r:["rac","@event"],s:"[_0.key(_1)]"}},{t:73,v:"t",f:"false"},{n:"value",f:[{t:2,r:"rac.display"}],t:13}]}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rac-drop",g:1},{n:["click"],t:70,f:{r:["rac.pop","@context"],s:'[_0.show((_1).find("input"))]'}}]}," ",{t:7,e:"rac-pop",m:[{t:13,n:"style",f:"padding: 0;",g:1},{t:13,n:"class",f:"rac-pop",g:1},{n:["init"],t:70,f:{r:["@context","$1"],s:'[(_0).raise("pop",{},_1)]'}},{n:"popped",t:13,f:[{t:2,r:"rac.popped"}]},{n:"where",f:"below",t:13,g:1},{n:"align",f:"end",t:13,g:1},{n:"gap",f:[{t:2,x:{r:[],s:"2"},s:1}],t:13},{n:"offsets",t:13,f:[{t:2,r:"rac.offsets"}]},{n:"fit",t:13,f:[{t:2,r:"rac.fit"}]}],f:[{t:4,f:[{t:7,e:"input",m:[{n:"class-rac-modal",t:13},{n:["input"],t:70,f:{r:["rac","@event"],s:"[_0.input(_1)]"}},{n:["keydown"],t:70,f:{r:["rac","@event"],s:"[_0.key(_1)]"}},{t:73,v:"t",f:"false"},{n:"value",f:[{t:2,r:"rac.display"}],t:13},{n:["blur"],t:70,f:{r:["rac"],s:"[_0.checkBlur()]"}},{n:"autocompletefocus",t:71}]}],n:50,r:"inModal"}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rac-list",g:1},{n:"tabindex",f:"-1",t:13,g:1}],f:[{t:55,f:[{f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rac-item rac-invalid",g:1}],f:["Loading..."]}],t:4},{t:62,f:[" ",{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rac-item",g:1},{n:"tabindex",f:"-1",t:13,g:1},{t:4,f:[{n:"class-rac-selected",t:13,f:[{t:2,x:{r:["rac.value","."],s:"_0===_1"}}]}],n:50,r:"rac.valueBound"},{n:"class-rac-hover",t:13,f:[{t:2,x:{r:["rac.selected","@index"],s:"_0===_1"}}]},{t:4,f:[{n:["click"],t:70,f:{r:["@context",".","rac"],s:'[(_0).set("rac.value",_1),_2._drawDisplay()]'}},{n:["mouseover"],t:70,f:{r:["@context","@index"],s:'[(_0).set("rac.selected",_1)]'}}],n:50,r:"rac.popped"}],f:[{t:2,x:{r:["rac","."],s:"_0._display(_1)"}}]}],n:52,r:"items"}," "],n:"items"},{t:63,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rac-item rac-invalid",g:1}],f:["Load failed."]}]}],r:"rac.list"}]}]}]}],e:{2:function(){return 2},'[(_0).set("rac.pop",_1)]':function(_0,_1){return[_0.set("rac.pop",_1)]},"[_0.show(_1)]":function(_0,_1){return[_0.show(_1)]},"[_0.stash()]":function(_0){return[_0.stash()]},"[_0.checkBlur(_1)]":function(_0,_1){return[_0.checkBlur(_1)]},"[_0.input(_1)]":function(_0,_1){return[_0.input(_1)]},"[_0.key(_1)]":function(_0,_1){return[_0.key(_1)]},'[_0.show((_1).find("input"))]':function(_0,_1){return[_0.show(_1.find("input"))]},'[(_0).raise("pop",{},_1)]':function(_0,_1){return[_0.raise("pop",{},_1)]},"[_0.checkBlur()]":function(_0){return[_0.checkBlur()]},"_0===_1":function(_0,_1){return _0===_1},'[(_0).set("rac.value",_1),_2._drawDisplay()]':function(_0,_1,_2){return[_0.set("rac.value",_1),_2._drawDisplay()]},'[(_0).set("rac.selected",_1)]':function(_0,_1){return[_0.set("rac.selected",_1)]},"_0._display(_1)":function(_0,_1){return _0._display(_1)}}};function safeGet(obj,path){return path.reduce(function(a,c){return a?a[c]:a},obj)}var formNodes=["INPUT","SELECT","TEXTAREA","BUTTON","BODY"];export var Autocomplete=Ractive.macro(function(h){var tm;var root;h.aliasLocal("rac");h.set("rac.list",[]);h.set("rac.popped",false);h.set("rac.stash",function(){h.set("rac.tempDisplay",h.get("rac.display"));h.set("rac.tempValue",h.get("rac.value"))});h.set("rac.key",function(e){var k=e.which;if(k===27){h.set("rac.popped",false);h.set("rac.display",h.get("rac.tempDisplay"));h.set("rac.value",h.get("rac.tempValue"))}else if(k===38||k===40){e.preventDefault();h.get("rac.pop").show(h.find("input"));var i=h.get("rac.selected");var list=h.get("rac.list");if(k===38){if(i<=0||i==null){h.set("rac.selected",Array.isArray(list)?list.length-1:0)}else{h.set("rac.selected",i-1)}}else{if(Array.isArray(list)){h.set("rac.selected",i<list.length-1?i+1:0)}else{h.set("rac.selected",0)}}}else if(k===10||k===13){var list$1=h.get("rac.list");if(Array.isArray(list$1)){h.set("rac.value",list$1[h.get("rac.selected")]);display()}}else if(k===9){if(h.get("rac.popped")){var list$2=h.get("rac.list");if(Array.isArray(list$2)){var v=list$2[h.get("rac.selected")];if(v==null){v=getval(v,true)}h.set("rac.value",v)}if(!h.get("rac.limit")){setTimeout(function(){return display()},140)}}else if(h.get("rac.value")==null||!~h.get("rac.selected")||h.get("rac.display")!=h.get("rac.tempDisplay")){h.set("rac.value",getval(null,true))}h.set("rac.popped",false);h.get("rac.updateDisplay")()}});h.set("rac.input",function(e){if(tm){clearTimeout(tm)}tm=setTimeout(function(){tm=null;list(e.target.value);var el=h.find("input");if(el&&document.activeElement===el){h.get("rac.pop").show(el)}},500);if(!h.attributes.lazy){h.set("rac.display",e.target.value)}});h.setTemplate(template);function list(filter){if(filter==null){filter=h.get("rac.value")==null?"":h.get("rac.display")}if(filter===h.get("rac.tempDisplay")){filter=""}var items=h.get("rac._items");if(typeof items==="function"){var res=items(filter);if(typeof res==="object"&&typeof res.then==="function"){res.then(function(v){return h.set("rac.list",v)})}else{h.set("rac.list",res)}}else if(Array.isArray(items)){var member=h.get("rac._display");var re;try{re=new RegExp(filter||"","i")}catch(e){re=new RegExp((filter||"").replace(/([\{\(\[\]\)\}\?\*\^\$])/g,"\\$1"))}h.set("rac.list",items.filter(function(i){return re.test(member(i))}))}else{h.set("rac.list",[])}}function getval(v,nofetch){var def=h.get("rac.default");v=v==null&&!nofetch?h.get("rac.value"):v;if(v==null&&def){if(typeof def==="function"){v=def(h.get("rac.display"))}else{v=def}}return v}function refresh(value,old,path){var v=h.get("rac.displayprop");if(h.get("rac.__display")!==v||h.get("rac._display")===undefined){var def=function(){return h.attributes["display-value"]?h.get("rac.display"):"(none)"};if(typeof v==="string"){var path$1=Ractive.splitKeypath(v);v=function(v){if(v==null){v=getval()}return v==null?def():safeGet(v,path$1)}}else if(Array.isArray(v)){var path$2=v;v=function(v){if(v==null){v=getval()}return v==null?def():safeGet(v,path$2)}}else if(!v){v=function(v){if(v==null){v=getval()}return v==null?def():""+v}}h.set("rac._display",v);h.set("rac.__display",h.get("rac.displayprop"));h.set("rac.display",v(h.get("rac.value")))}v=h.get("rac.member");if(h.get("rac.__member")!==v||h.get("rac._member")===undefined){if(typeof v==="string"){var path$3=Ractive.splitKeypath(v);v=function(v){return safeGet(getval(v),path$3)}}else if(Array.isArray(v)){var path$4=v;v=function(v){return safeGet(getval(v),path$4)}}else if(!v){v=function(v){return getval(v)}}h.set("rac._member",v);h.set("rac.__member",h.get("rac.member"))}v=h.get("rac.items");if(h.get("rac.__items")!==v||h.get("rac._items")===undefined){if(Array.isArray(v)){h.set("rac._items",v)}else if(typeof v==="function"){h.set("rac._items",v)}else if(typeof v==="object"&&typeof v.then==="function"){v.then(function(v){h.set("rac._items",v);list()})}else{h.set("rac._items",[])}h.set("rac.__items",h.get("rac.items"))}if(root&&path==="rac.display"&&h.get("rac.limit")&&!root.contains(document.activeElement)){display()}list()}function display(){var member=h.get("rac._display");if(typeof member==="function"){var disp=member(h.get("rac.value"));h.set("rac.display",disp);h.set("rac.tempDisplay",disp)}}h.set("rac._drawDisplay",display);function value(){if(h.get("rac._value")&&!h.get("rac.value")){return}var member=h.get("rac._member");if(typeof member==="function"){var v=member(h.get("rac.value"));h.set("rac._value",v)}h.ractive.getContext(h.find("input")).raise("selected",{},h.get("rac._value"),h.get("rac.display"))}h.set("rac.updateDisplay",function(ev){setTimeout(function(){if(root&&h.get("rac.limit")&&!root.contains(document.activeElement)){display()}},140)});function update(attrs){if(attrs.items){h.link(attrs.items,"rac.items")}if(attrs.value){h.link(attrs.value,"rac._value")}h.set("rac.valueBound",!!attrs.value);if(attrs.selected){h.link(attrs.selected,"rac.selected")}if(attrs["display-value"]){h.link(attrs["display-value"],"rac.display")}if("display"in attrs){h.set("rac.displayprop",attrs.display)}if("member"in attrs){h.set("rac.member",attrs.member)}if("offsets"in attrs){h.set("rac.offsets",attrs.offsets);h.set("rac.fit","fit"in attrs?attrs.fit:true)}else{h.set("rac.fit","fit"in attrs?attrs.fit:false)}h.set("rac.limit",attrs["limit-set"]);h.set("rac.default",attrs.default);if(h.get("rac.limit")&&h.get("input")){var el=h.get("input");if(el!==document.activeElement){display()}}refresh()}update(h.attributes);var tmScroll;function scrollView(){if(tmScroll){clearTimeout(tm)}tmScroll=setTimeout(function(){tmScroll=null;var el=h.find(".rac-hover");if(el){el.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})}},14)}var opts={init:false,defer:true};var watches=[h.observe("rac.displayprop",refresh,opts),h.observe("rac.memberprop",refresh,opts),h.observe("rac.items",refresh,opts),h.observe("rac.list",function(v){if(Array.isArray(v)){h.set("rac.selected",v.indexOf(h.get("rac.value")))}else{h.set("rac.selected",-1)}},opts),h.observe("rac.value",function(v){display();value();h.set("rac.popped",false);h.set("rac.tempValue",v)}),h.observe("rac._value",function(v){var member=h.get("rac._member");var which=h.get("rac.list").find(function(i){return member(i)===v});if(which!==h.get("rac.value")){h.set("rac.value",which)}if(!which&&v!=null&&h.get("rac.valueBound")){h.set("rac.display",v);refresh()}}),h.observe("rac.selected",scrollView)];h.set("rac.checkBlur",function checkBlur(node){var active=document.activeElement;if(!~formNodes.indexOf(active.nodeName)&&!active.getAttribute("tabindex")){return}var inputs=h.findAll("input");if(document.activeElement&&!~inputs.indexOf(document.activeElement)){h.get("rac.key")({which:9})}});function teardown(){h.unlink("rac.items");h.unlink("rac._value");h.unlink("rac.selected");h.unlink("rac.display");watches.forEach(function(w){return w.cancel()})}return{teardown:teardown,update:update,render:function render(){root=h.find("span")}}},{attributes:["items","selected","display","value","member","limit-set","fit","offsets","display-value","default"],css:function(data){return[function(data){var primary=Object.assign({},data("raui.primary"),data("raui.autocomplete"),data("raui.autocomplete.primary"));var drop=Object.assign({},data("raui.autocomplete.drop"),data("raui.autocomplete.primary.drop"));return".rautocomplete {\n position: relative;\n display: inline-block;\n }\n \n .rac-drop {\n width: 2em;\n height: 100%;\n position: absolute;\n top: 0;\n right: 2px;\n cursor: pointer;\n }\n .rac-drop:after {\n font-family: "+(drop.font||"sans-serif")+";\n content: "+(drop.string||"'▾'")+";\n position: absolute;\n top: calc(50% - 0.5em);\n height: 1em;\n line-height: 1em;\n width: 100%;\n text-align: center;\n font-weight: "+(drop.weight||"normal")+";\n color: "+(drop.color||primary.bc||"#ccc")+";\n }\n \n .rac-pop {\n min-width: 100%;\n }\n \n .rac-pop > .rpop {\n padding: 0;\n }\n \n .rac-list {\n display: flex;\n flex-direction: column;\n max-height: 50vh;\n min-height: 2.125em;\n max-width: 100%;\n overflow: auto;\n }\n \n .rac-item {\n color: "+(primary.fg||"#222")+";\n background-color: "+(primary.bg||"#fff")+";\n padding: 0.25em;\n cursor: pointer;\n }\n \n .rac-selected {\n color: "+(primary.bg||"#fff")+";\n background-color: "+(primary.fga||"#07e")+";\n }\n \n .rac-hover {\n color: "+(primary.fg||"#222")+";\n background-color: "+(primary.bc||"#ccc")+";\n }\n \n .rac-selected.rac-hover {\n background-color: "+(primary.bc||"#ccc")+";\n color: "+(primary.fga||"#07e")+";\n }\n \n .rac-invalid {\n cursor: not-allowed;\n }\n \n input.rac-modal {\n width: 100%;\n box-sizing: border-box;\n }"}.call(this,data)].join(" ")},cssId:"rautocomplete",noCssTransform:true});export function FieldType(opts){if(opts===void 0)opts={};return function(attrs,content,handle){return[{t:7,e:opts.name||"autocomplete",m:attrs,f:content}]}}export function plugin(opts){if(opts===void 0)opts={};return function(ref){var instance=ref.instance;instance.partials[opts.name||"autocomplete"]=Autocomplete;instance.components["rac-pop"]=Popover;instance.decorators["autocompletefocus"]=autofocus}}export default plugin;
import Ractive from"ractive";import{Popover}from"./Popover";import{autofocus}from"./form";var template={v:4,t:[{t:7,e:"span",m:[{t:13,n:"class",f:"rautocomplete field-wrapper",g:1},{n:["pop"],t:70,f:{r:["@context","$1"],s:'[(_0).set("rac.pop",_1)]'}}],f:[{t:7,e:"input",m:[{t:8,r:"extra-attributes"},{n:["dblclick"],t:70,f:{r:["rac.pop","@node"],s:"[_0.show(_1)]"}},{n:["focus"],t:70,f:{r:["rac"],s:"[_0.stash()]"}},{n:["blur"],t:70,f:{r:["rac","@node"],s:"[_0.checkBlur(_1)]"}},{n:["input"],t:70,f:{r:["rac","@event"],s:"[_0.input(_1)]"}},{n:["keydown"],t:70,f:{r:["rac","@event"],s:"[_0.key(_1)]"}},{t:73,v:"t",f:"false"},{n:"value",f:[{t:2,r:"rac.display"}],t:13}]}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rac-drop",g:1},{n:["click"],t:70,f:{r:["rac.pop","@context"],s:'[_0.show((_1).find("input"))]'}}]}," ",{t:7,e:"rac-pop",m:[{t:13,n:"style",f:"padding: 0;",g:1},{t:13,n:"class",f:"rac-pop",g:1},{n:["init"],t:70,f:{r:["@context","$1"],s:'[(_0).raise("pop",{},_1)]'}},{n:"popped",t:13,f:[{t:2,r:"rac.popped"}]},{n:"where",f:"below",t:13,g:1},{n:"align",f:"end",t:13,g:1},{n:"gap",f:[{t:2,x:{r:[],s:"2"},s:1}],t:13},{n:"offsets",t:13,f:[{t:2,r:"rac.offsets"}]},{n:"fit",t:13,f:[{t:2,r:"rac.fit"}]}],f:[{t:4,f:[{t:7,e:"input",m:[{n:"class-rac-modal",t:13},{n:["input"],t:70,f:{r:["rac","@event"],s:"[_0.input(_1)]"}},{n:["keydown"],t:70,f:{r:["rac","@event"],s:"[_0.key(_1)]"}},{t:73,v:"t",f:"false"},{n:"value",f:[{t:2,r:"rac.display"}],t:13},{n:["blur"],t:70,f:{r:["rac"],s:"[_0.checkBlur()]"}},{n:"autocompletefocus",t:71}]}],n:50,r:"inModal"}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rac-list",g:1},{n:"tabindex",f:"-1",t:13,g:1}],f:[{t:55,f:[{f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rac-item rac-invalid",g:1}],f:["Loading..."]}],t:4},{t:62,f:[" ",{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rac-item",g:1},{n:"tabindex",f:"-1",t:13,g:1},{t:4,f:[{n:"class-rac-selected",t:13,f:[{t:2,x:{r:["rac.value","."],s:"_0===_1"}}]}],n:50,r:"rac.valueBound"},{n:"class-rac-hover",t:13,f:[{t:2,x:{r:["rac.selected","@index"],s:"_0===_1"}}]},{t:4,f:[{n:["click"],t:70,f:{r:["@context",".","rac"],s:'[(_0).set("rac.value",_1),_2._drawDisplay()]'}},{n:["mouseover"],t:70,f:{r:["@context","@index"],s:'[(_0).set("rac.selected",_1)]'}}],n:50,r:"rac.popped"}],f:[{t:2,x:{r:["rac","."],s:"_0._display(_1)"}}]}],n:52,r:"items"}," "],n:"items"},{t:63,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rac-item rac-invalid",g:1}],f:["Load failed."]}]}],r:"rac.list"}]}]}]}],e:{2:function(){return 2},'[(_0).set("rac.pop",_1)]':function(_0,_1){return[_0.set("rac.pop",_1)]},"[_0.show(_1)]":function(_0,_1){return[_0.show(_1)]},"[_0.stash()]":function(_0){return[_0.stash()]},"[_0.checkBlur(_1)]":function(_0,_1){return[_0.checkBlur(_1)]},"[_0.input(_1)]":function(_0,_1){return[_0.input(_1)]},"[_0.key(_1)]":function(_0,_1){return[_0.key(_1)]},'[_0.show((_1).find("input"))]':function(_0,_1){return[_0.show(_1.find("input"))]},'[(_0).raise("pop",{},_1)]':function(_0,_1){return[_0.raise("pop",{},_1)]},"[_0.checkBlur()]":function(_0){return[_0.checkBlur()]},"_0===_1":function(_0,_1){return _0===_1},'[(_0).set("rac.value",_1),_2._drawDisplay()]':function(_0,_1,_2){return[_0.set("rac.value",_1),_2._drawDisplay()]},'[(_0).set("rac.selected",_1)]':function(_0,_1){return[_0.set("rac.selected",_1)]},"_0._display(_1)":function(_0,_1){return _0._display(_1)}}};function safeGet(obj,path){return path.reduce(function(a,c){return a?a[c]:a},obj)}var formNodes=["INPUT","SELECT","TEXTAREA","BUTTON","BODY"];export var Autocomplete=Ractive.macro(function(h){var tm;var root;h.aliasLocal("rac");h.set("rac.list",[]);h.set("rac.popped",false);h.set("rac.stash",function(){h.set("rac.tempDisplay",h.get("rac.display"));h.set("rac.tempValue",h.get("rac.value"))});h.set("rac.key",function(e){var k=e.which;if(k===27){h.set("rac.popped",false);h.set("rac.display",h.get("rac.tempDisplay"));h.set("rac.value",h.get("rac.tempValue"))}else if(k===38||k===40){e.preventDefault();h.get("rac.pop").show(h.find("input"));var i=h.get("rac.selected");var list=h.get("rac.list");if(k===38){if(i<=0||i==null){h.set("rac.selected",Array.isArray(list)?list.length-1:0)}else{h.set("rac.selected",i-1)}}else{if(Array.isArray(list)){h.set("rac.selected",i<list.length-1?i+1:0)}else{h.set("rac.selected",0)}}}else if(k===10||k===13){var list$1=h.get("rac.list");if(Array.isArray(list$1)){h.set("rac.value",list$1[h.get("rac.selected")]);display()}}else if(k===9){if(h.get("rac.popped")){var list$2=h.get("rac.list");if(Array.isArray(list$2)){var v=list$2[h.get("rac.selected")];if(v==null){v=getval(v,true)}h.set("rac.value",v)}if(!h.get("rac.limit")){setTimeout(function(){return display()},140)}}else if(h.get("rac.value")==null||!~h.get("rac.selected")||h.get("rac.display")!=h.get("rac.tempDisplay")){h.set("rac.value",getval(null,true))}h.set("rac.popped",false);h.get("rac.updateDisplay")()}});h.set("rac.input",function(e){if(tm){clearTimeout(tm)}tm=setTimeout(function(){tm=null;list(e.target.value);var el=h.find("input");if(el&&document.activeElement===el){h.get("rac.pop").show(el)}},500);if(!h.attributes.lazy){h.set("rac.display",e.target.value)}});h.setTemplate(template);function list(filter){if(filter==null){filter=h.get("rac.value")==null?"":h.get("rac.display")}if(filter===h.get("rac.tempDisplay")){filter=""}var items=h.get("rac._items");if(typeof items==="function"){var res=items(filter);if(typeof res==="object"&&typeof res.then==="function"){res.then(function(v){return h.set("rac.list",v)})}else{h.set("rac.list",res)}}else if(Array.isArray(items)){var member=h.get("rac._display");var re;try{re=new RegExp(filter||"","i")}catch(e){re=new RegExp((filter||"").replace(/([\{\(\[\]\)\}\?\*\^\$])/g,"\\$1"))}h.set("rac.list",items.filter(function(i){return re.test(member(i))}))}else{h.set("rac.list",[])}}function getval(v,nofetch){var def=h.get("rac.default");v=v==null&&!nofetch?h.get("rac.value"):v;if(v==null&&def){if(typeof def==="function"){v=def(h.get("rac.display"))}else{v=def}}return v}function refresh(value,old,path){var v=h.get("rac.displayprop");if(h.get("rac.__display")!==v||h.get("rac._display")===undefined){var def=function(){return h.attributes["display-value"]?h.get("rac.display"):"(none)"};if(typeof v==="string"){var path$1=Ractive.splitKeypath(v);v=function(v){if(v==null){v=getval()}return v==null?def():safeGet(v,path$1)}}else if(Array.isArray(v)){var path$2=v;v=function(v){if(v==null){v=getval()}return v==null?def():safeGet(v,path$2)}}else if(!v){v=function(v){if(v==null){v=getval()}return v==null?def():""+v}}h.set("rac._display",v);h.set("rac.__display",h.get("rac.displayprop"));h.set("rac.display",v(h.get("rac.value")))}v=h.get("rac.member");if(h.get("rac.__member")!==v||h.get("rac._member")===undefined){if(typeof v==="string"){var path$3=Ractive.splitKeypath(v);v=function(v){return safeGet(getval(v),path$3)}}else if(Array.isArray(v)){var path$4=v;v=function(v){return safeGet(getval(v),path$4)}}else if(!v){v=function(v){return getval(v)}}h.set("rac._member",v);h.set("rac.__member",h.get("rac.member"))}v=h.get("rac.items");if(h.get("rac.__items")!==v||h.get("rac._items")===undefined){if(Array.isArray(v)){h.set("rac._items",v)}else if(typeof v==="function"){h.set("rac._items",v)}else if(typeof v==="object"&&typeof v.then==="function"){v.then(function(v){h.set("rac._items",v);list()})}else{h.set("rac._items",[])}h.set("rac.__items",h.get("rac.items"))}if(root&&path==="rac.display"&&h.get("rac.limit")&&!root.contains(document.activeElement)){display()}list()}function display(){var member=h.get("rac._display");if(typeof member==="function"){var disp=member(h.get("rac.value"));h.set("rac.display",disp);h.set("rac.tempDisplay",disp)}}h.set("rac._drawDisplay",display);function value(){if(h.get("rac._value")&&!h.get("rac.value")){return}var member=h.get("rac._member");if(typeof member==="function"){var v=member(h.get("rac.value"));h.set("rac._value",v)}h.ractive.getContext(h.find("input")).raise("selected",{},h.get("rac._value"),h.get("rac.display"))}h.set("rac.updateDisplay",function(ev){setTimeout(function(){if(root&&h.get("rac.limit")&&!root.contains(document.activeElement)){display()}},140)});function update(attrs){if(attrs.items){h.link(attrs.items,"rac.items")}if(attrs.value){h.link(attrs.value,"rac._value")}h.set("rac.valueBound",!!attrs.value);if(attrs.selected){h.link(attrs.selected,"rac.selected")}if(attrs["display-value"]){h.link(attrs["display-value"],"rac.display")}if("display"in attrs){h.set("rac.displayprop",attrs.display)}if("member"in attrs){h.set("rac.member",attrs.member)}if("offsets"in attrs){h.set("rac.offsets",attrs.offsets);h.set("rac.fit","fit"in attrs?attrs.fit:true)}else{h.set("rac.fit","fit"in attrs?attrs.fit:false)}h.set("rac.limit",attrs["limit-set"]);h.set("rac.default",attrs.default);if(h.get("rac.limit")&&h.get("input")){var el=h.get("input");if(el!==document.activeElement){display()}}refresh()}update(h.attributes);var tmScroll;function scrollView(){if(tmScroll){clearTimeout(tm)}tmScroll=setTimeout(function(){tmScroll=null;var el=h.find(".rac-hover");if(el){el.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})}},14)}var justPopped=false;var opts={init:false,defer:true};var watches=[h.observe("rac.displayprop",refresh,opts),h.observe("rac.memberprop",refresh,opts),h.observe("rac.items",refresh,opts),h.observe("rac.list",function(v){if(Array.isArray(v)){h.set("rac.selected",v.indexOf(h.get("rac.value")))}else{h.set("rac.selected",-1)}},opts),h.observe("rac.value",function(v){display();value();h.set("rac.popped",false);h.set("rac.tempValue",v)}),h.observe("rac._value",function(v){var member=h.get("rac._member");var which=h.get("rac.list").find(function(i){return member(i)===v});if(which!==h.get("rac.value")){h.set("rac.value",which)}if(!which&&v!=null&&h.get("rac.valueBound")){h.set("rac.display",v);refresh()}}),h.observe("rac.selected",scrollView),h.observe("rac.popped",function(v){if(v){setTimeout(function(){return justPopped=false},300)}justPopped=true})];h.set("rac.checkBlur",function checkBlur(node){if(justPopped){return false}var active=document.activeElement;if(!~formNodes.indexOf(active.nodeName)&&!active.getAttribute("tabindex")){return}var inputs=h.findAll("input").concat(h.get("rac.pop").popFindAll("input"));if(document.activeElement&&!~inputs.indexOf(document.activeElement)){h.get("rac.key")({which:9})}});function teardown(){h.unlink("rac.items");h.unlink("rac._value");h.unlink("rac.selected");h.unlink("rac.display");watches.forEach(function(w){return w.cancel()})}return{teardown:teardown,update:update,render:function render(){root=h.find("span")}}},{attributes:["items","selected","display","value","member","limit-set","fit","offsets","display-value","default"],css:function(data){return[function(data){var primary=Object.assign({},data("raui.primary"),data("raui.autocomplete"),data("raui.autocomplete.primary"));var drop=Object.assign({},data("raui.autocomplete.drop"),data("raui.autocomplete.primary.drop"));var boxy=data("raui.form.boxy");return".rautocomplete {\n position: relative;\n display: inline-block;\n }\n \n .rac-drop {\n width: 2em;\n height: 100%;\n position: absolute;\n top: 0;\n right: 2px;\n cursor: pointer;\n }\n .rac-drop:after {\n font-family: "+(drop.font||"sans-serif")+";\n content: "+(drop.string||"'▾'")+";\n position: absolute;\n top: calc(50% - 0.5em);\n height: 1em;\n line-height: 1em;\n width: 100%;\n text-align: center;\n font-weight: "+(drop.weight||"normal")+";\n color: "+(drop.color||primary.bc||"#ccc")+";\n }\n \n .rac-pop {\n min-width: 100%;\n }\n \n .rac-pop > .rpop {\n padding: 0;\n }\n \n .rac-list {\n display: flex;\n flex-direction: column;\n max-height: 50vh;\n min-height: 2.125em;\n max-width: 100%;\n overflow: auto;\n }\n \n .rac-item {\n color: "+(primary.fg||"#222")+";\n background-color: "+(primary.bg||"#fff")+";\n padding: 0.25em;\n cursor: pointer;\n }\n \n .rac-selected {\n color: "+(primary.bg||"#fff")+";\n background-color: "+(primary.fga||"#07e")+";\n }\n \n .rac-hover {\n color: "+(primary.fg||"#222")+";\n background-color: "+(primary.bc||"#ccc")+";\n }\n \n .rac-selected.rac-hover {\n background-color: "+(primary.bc||"#ccc")+";\n color: "+(primary.fga||"#07e")+";\n }\n \n .rac-invalid {\n cursor: not-allowed;\n }\n \n input.rac-modal {\n width: 100%;\n box-sizing: border-box;\n display: block;\n border-width: "+(boxy?"0.0625em":"0 0 0.0625em 0")+";\n border-color: "+(primary.bc||"#ccc")+";\n border-style: solid;\n box-sizing: border-box;\n background-color: "+(boxy?primary.bg||"#fff":"transparent")+";\n transition: 0.2s ease-in-out;\n transition-property: box-shadow, color;\n outline: none;\n box-shadow: none;\n width: 100%;\n margin-bottom: 0.8em;\n font-size: 1.1em;"+(boxy?"\n border-radius: "+(primary.radius||"0.2em")+";":"")+"\n font-weight: 400;\n font-family: inherit;\n }"}.call(this,data)].join(" ")},cssId:"rautocomplete",noCssTransform:true});export function FieldType(opts){if(opts===void 0)opts={};return function(attrs,content,handle){return[{t:7,e:opts.name||"autocomplete",m:attrs,f:content}]}}export function plugin(opts){if(opts===void 0)opts={};return function(ref){var instance=ref.instance;instance.partials[opts.name||"autocomplete"]=Autocomplete;instance.components["rac-pop"]=Popover;instance.decorators["autocompletefocus"]=autofocus}}export default plugin;

@@ -98,2 +98,4 @@ // TODO: support for non-numeric formats?

var lastBackspace = false;
if (node.tagName !== 'INPUT') {

@@ -182,2 +184,16 @@ console.warn(("Attempted to add a date decorator a " + (node.tagName)));

var selectGroup = function (group, pos) {
if (pos === undefined) { pos = node.selectionStart; }
if (group && group.target) { group = undefined; }
if (!group) {
if (pos === node.value.length && node.selectionEnd === node.value.length) { group = groups[0]; }
else { group = groupForPos(groups, pos); }
}
if (lastBackspace) {
lastBackspace = false;
if (pos < group.start) { group = groups[groups.indexOf(group) - 1]; }
}
document.activeElement === node && node.setSelectionRange(group.start, group.end);
};
handles.listeners.push(ctx.listen('input', function () {

@@ -195,3 +211,3 @@ var pos = node.selectionStart;

var next = groups[groups.indexOf(active) + 1];
node.setSelectionRange(next.start, next.end);
selectGroup(next, pos);
} else {

@@ -203,12 +219,9 @@ node.setSelectionRange(pos, pos);

handles.listeners.push(ctx.listen('blur', function () {
lastBackspace = false;
if (sendValue(false)) { receiveValue(groups, groups.value, opts.parseDate); }
if (groups.value === null) { groups.forEach(function (g) { return g.value = null; }); }
groups.forEach(function (g) { return g.display = displayForGroup(g); });
updateDisplay(groups, node);
}));
var selectGroup = function () {
var group;
if (node.selectionStart === node.value.length && node.selectionEnd === node.value.length) { group = groups[0]; }
else { group = groupForPos(groups, node.selectionStart); }
document.activeElement === node && node.setSelectionRange(group.start, group.end);
};
handles.listeners.push(ctx.listen('click', selectGroup));

@@ -218,2 +231,3 @@ handles.listeners.push(ctx.listen('focus', selectGroup));

handles.listeners.push(ctx.listen('keydown', function (/** @type { KeyboardEvent } */ ev) {
lastBackspace = false;
switch (ev.key) {

@@ -229,7 +243,7 @@ case 'Enter':

if (ev.shiftKey && idx > 0) {
node.setSelectionRange(groups[idx - 1].start, groups[idx - 1].end);
selectGroup(groups[idx - 1]);
ev.preventDefault();
ev.stopPropagation();
} else if (!ev.shiftKey && idx + 1 < groups.length) {
node.setSelectionRange(groups[idx + 1].start, groups[idx + 1].end);
selectGroup(groups[idx + 1]);
ev.preventDefault();

@@ -241,2 +255,6 @@ ev.stopPropagation();

case 'Backspace':
lastBackspace = true;
break;
case 'ArrowUp':

@@ -318,2 +336,5 @@ case 'ArrowDown': {

accepted = true;
} else if (g.type === 'd' && v.length !== g.length && leave) {
g.value = +v;
g.display = displayForGroup(g);
} else if (v === '') {

@@ -320,0 +341,0 @@ g.value = null;

@@ -1,1 +0,1 @@

var nonDigits=/[^\d]+/;var nonDisplay=/[^\d_]+/;var blankChar="_";var map={y:0,M:1,d:2,H:3,m:4,s:5,S:6};export function padl(str,total,char){if(char===void 0)char="0";var v=str==null?"":""+str;for(var i=v.length;i<total;i++){v=char+v}return v}export function padr(str,total,char){if(char===void 0)char="0";var v=str==null?"":""+str;for(var i=v.length;i<total;i++){v+=char}return v}export var defaults={mask:"yyyy-MM-dd",time:[0,0,0,0],date:function date(){var now=new Date;var tm=defaults.time;return new Date(now.getFullYear(),now.getMonth(),now.getDate(),tm[0],tm[1],tm[2],tm[3])},parseDate:function parseDate(dt){return new Date(dt)}};function timeArray(value){if(value==="start"){value=[0,0,0,0]}else if(value==="end"){value=[23,59,59,999]}else if(value==="mid"){value=[12,0,0,0]}else if(value==="now"){value=function(){var dt=new Date;return[dt.getHours(),dt.getMinutes(),dt.getSeconds(),dt.getMilliseconds()]}}else if(typeof value==="string"){var dt=new Date("2000-05-13T"+value+"Z");if(+dt){value=[dt.getUTCHours(),dt.getUTCMinutes(),dt.getUTCSeconds(),dt.getUTCMilliseconds()]}}if(!Array.isArray(value)&&typeof value!=="function"&&!Array.isArray(value())){value=[0,0,0,0]}return value}export default function plugin(options){if(options===void 0)options={};var defaultMask=options.mask||defaults.mask;var defaultTime=timeArray(options.time||defaults.time);var defaultDate=options.date||defaults.date;if(typeof defaultDate!=="function"){var dt=defaultDate;defaultDate=function(){return dt}}return function(ref){var instance=ref.instance;instance.decorators[options.name||"date"]=function(node,optsin,other){if(optsin===void 0)optsin={};var opts=Object.assign({},options,typeof optsin==="string"?{value:optsin}:optsin,typeof other==="string"?{mask:other}:other);if(!opts.parseDate){opts.parseDate=options.parseDate||defaults.parseDate}var defdt=opts.date||defaultDate;var deftm=timeArray(opts.time||defaultTime);if(typeof defdt!=="function"){var dt=defdt;defdt=function(){return dt}}var ctx=this.getContext(node);var mask=opts.mask||defaultMask;var handles={observers:[],listeners:[]};if(node.tagName!=="INPUT"){console.warn("Attempted to add a date decorator a "+node.tagName);return noop}if(!mask){return noop}var groups=[];var match,last=0;while(match=dateRE.exec(mask)){var group={mask:match[0],type:match[0][0],length:match[0].length,start:match.index,end:match.index+match[0].length,chunk:groups.length,prefix:mask.substring(last,match.index),groups:groups,value:null,display:padr("",match[0].length,blankChar)};last=group.end;groups.push(group)}groups.suffix=mask.substring(groups[groups.length-1].end);groups.last=null;if(groups.slice(1).find(function(g){return!g.prefix})){console.warn("Attempted to add a date decorator missing interstitial between fields '"+mask+"'");return noop}if(opts.min>opts.max){delete opts.min}if(typeof opts.value==="string"){handles.observers.push(ctx.observe(opts.value,function(v){if(!v&&opts.null===false){v=defdt()}groups.value=v;receiveValue(groups,v,opts.parseDate);groups.last=v;updateDisplay(groups,node);if(opts.min&&v<opts.min||opts.max&&v>opts.max){groups.last=null;setTimeout(sendValue)}},{defer:true}))}if(typeof opts.display==="string"){handles.observers.push(ctx.observe(opts.display,function(v){node.value=v||"";readInput(groups,node,mask);updateValues(groups);applyValues(groups,sendValue,true,defdt,deftm);updateDisplay(groups,node)},{defer:true}))}if(!opts.display&&!opts.value){if(opts.date||opts.null===false){groups.value=getDateValue(opts.date||defdt(),opts.parseDate)}updateDisplay(groups,node)}function sendValue(focused){if(groups.value===null&&groups.last===null||+groups.value===+groups.last){return 1}if(focused&&opts.lazy!==false){return}if(opts.null===false&&groups.value===null){return receiveValue(groups,groups.last,opts.parseDate)&&1||1}if(opts.min&&groups.value<opts.min){receiveValue(groups,opts.min,opts.parseDate);updateDisplay(groups,node)}else if(opts.max&&groups.value>opts.max){receiveValue(groups,opts.max,opts.parseDate);updateDisplay(groups,node)}groups.last=groups.value;if(typeof opts.value==="string"){handles.observers.forEach(function(h){return h.silence()});ctx.set(opts.value,groups.value);handles.observers.forEach(function(h){return h.resume()})}if(typeof opts.display==="string"){handles.observers.forEach(function(h){return h.silence()});ctx.set(opts.display,node.value);handles.observers.forEach(function(h){return h.resume()})}}handles.listeners.push(ctx.listen("input",function(){var pos=node.selectionStart;var start=node.value;readInput(groups,node,mask);var active=groupForPos(groups,pos);var accepted=updateValues(groups,active,pos);applyValues(groups,sendValue,true,defdt,deftm);updateDisplay(groups,node);if(active&&(start.length>=mask.length&&pos===active.end||accepted)&&active!==groups[groups.length-1]){var next=groups[groups.indexOf(active)+1];node.setSelectionRange(next.start,next.end)}else{node.setSelectionRange(pos,pos)}}));handles.listeners.push(ctx.listen("blur",function(){if(sendValue(false)){receiveValue(groups,groups.value,opts.parseDate)}updateDisplay(groups,node)}));var selectGroup=function(){var group;if(node.selectionStart===node.value.length&&node.selectionEnd===node.value.length){group=groups[0]}else{group=groupForPos(groups,node.selectionStart)}document.activeElement===node&&node.setSelectionRange(group.start,group.end)};handles.listeners.push(ctx.listen("click",selectGroup));handles.listeners.push(ctx.listen("focus",selectGroup));handles.listeners.push(ctx.listen("keydown",function(ev){switch(ev.key){case"Enter":case"Tab":{var g=groupForPos(groups,node.selectionStart);var idx=groups.indexOf(g);if(updateValues(groups,g,node.selectionStart,true)){updateDisplay(groups,node);applyValues(groups,sendValue,ev.shiftKey&&idx>0||!ev.shiftKey&&idx+1<groups.length,defdt,deftm)}if(ev.shiftKey&&idx>0){node.setSelectionRange(groups[idx-1].start,groups[idx-1].end);ev.preventDefault();ev.stopPropagation()}else if(!ev.shiftKey&&idx+1<groups.length){node.setSelectionRange(groups[idx+1].start,groups[idx+1].end);ev.preventDefault();ev.stopPropagation()}break}case"ArrowUp":case"ArrowDown":{var ref=[node.selectionStart,node.selectionEnd];var s=ref[0];var e=ref[1];var g$1=groupForPos(groups,s);if(g$1.value===null){g$1.value=1}bumpValue(g$1,ev.key==="ArrowDown");g$1.input=g$1.display=displayForGroup(g$1);applyValues(groups,sendValue,true,defdt,deftm);updateDisplay(groups,node);ev.preventDefault();ev.stopPropagation();node.setSelectionRange(s,e);break}}}));return{teardown:function teardown(){handles.observers.forEach(function(o){return o.cancel()});handles.listeners.forEach(function(o){return o.cancel()})}}}}}function readInput(groups,node,mask){var val=node.value;var pos=node.selectionStart;var active=groupForPos(groups,pos);var gidx=0;var group=groups[gidx];var next=groups[gidx+1];groups.forEach(function(g){return g.input=""});for(var i=0;i<val.length;i++){if(next&&val[i]===next.prefix[0]&&(active!==group||group.input.length>=group.length||val.length-i<mask.length-group.end+(group.length-group.input.length))){if(next.prefix.length>1){i+=next.prefix.length-1}if(val[i+1]===next.prefix[0]){i+=next.prefix.length}group=groups[++gidx];next=groups[gidx+1]}else{group.input+=val[i]}}}function updateValues(groups,target,pos,leave){if(pos===void 0)pos=0;if(leave===void 0)leave=false;var accepted=false;for(var i=0;i<groups.length;i++){var g=groups[i];var v=(g.input||"").replace(nonDigits,"");var hasSep=groups[i+1]&&groups[i+1].prefix&&nonDisplay.test(g.input);if(v.length>g.length&&g===target){var drop=v.length-target.length;v=v.substr(0,pos-target.start)+v.substr(pos-target.start+drop)}else{v=v.substr(0,g.length)}g.input=v;if(g.type==="y"&&v.length===0&&(hasSep||leave)){g.value=(new Date).getFullYear();g.input=g.display=padl(g.value,g.length);accepted=true}else if(g.type==="m"&&v.length===0&&(hasSep||leave)){g.value=0;g.input=g.display=padl(g.value,g.length);accepted=true}else if(v===""){g.value=null;g.display=displayForGroup(g)}else if(g!==target){g.value=+v;if(g.type==="M"){g.value--}g.display=displayForGroup(g)}else{if(g.type==="M"&&+v>1||g.type==="d"&&+v>3||g.type==="H"&&+v>2||(g.type==="m"||g.type==="s")&&+v>6){g.value=+v;if(g.type==="M"){g.value--}g.display=padl(v,g.length);accepted=true}else if(g.type==="y"&&v.length===2&&(hasSep||leave)){var n=(new Date).getFullYear();var cen=Math.floor(n/100)*100;var val=Math.abs(n-(cen+ +v))<20?cen+ +v:cen-100+ +v;g.value=val;g.input=g.display=padl(val,g.length);accepted=true}else{g.display=padr(v,g.length,blankChar);g.value=+v}}}return accepted}function receiveValue(groups,v,parseDate){v=groups.value=v&&getDateValue(v,parseDate);var parts=v?[v.getFullYear(),v.getMonth(),v.getDate(),v.getHours(),v.getMinutes(),v.getSeconds(),v.getMilliseconds()]:[null,null,null,null,null,null,null];groups.forEach(function(g){g.value=parts[map[g.type]];g.input=g.display=displayForGroup(g)})}function applyValues(groups,send,focused,defaultDate,defaultTime){var v=groups.value||defaultDate();var parts=[v.getFullYear(),v.getMonth(),v.getDate(),v.getHours(),v.getMinutes(),v.getSeconds(),v.getMilliseconds()];if(!groups.find(function(p){return p.type==="m"||p.type==="s"||p.type==="h"||p.type==="S"})){if(typeof defaultTime==="function"){defaultTime=defaultTime()}for(var i=0;i<4;i++){parts[i+3]=defaultTime[i]}}groups.forEach(function(g){var vv=g.value;if(vv!==null&&g.type==="M"){if(vv<0){vv=0}else if(vv>11){vv=11}}else if(vv!==null&&(g.type==="m"||g.type==="s")){if(vv<0){vv=0}else if(vv>59){vv=59}}else if(vv!==null&&g.type==="H"){if(vv<0){vv=0}else if(vv>23){vv=23}}else if(vv!==null&&g.type==="h"){if(vv<1){vv=1}else if(vv>12){vv=12}}if(vv!==g.value){g.value=vv;g.display=displayForGroup(g)}parts[map[g.type]]=g.value});if(parts[0]!==null&&parts[1]!==null&&parts[2]!==null){var d=groups.find(function(g){return g.type==="d"});if(d){if(parts[2]<1){d.value=parts[2]=1;d.display=displayForGroup(d)}else{var last=lastDay(new Date(parts[0],parts[1],1));if(parts[2]>last){d.value=parts[2]=last;d.display=d.input=displayForGroup(d)}}}}if(groups.find(function(g){return g.value===null})||parts[0]===0||parts[1]>11||parts[1]<0||parts[2]===0){groups.value=null}else{parts.unshift(null);groups.value=new(Date.bind.apply(Date,parts))}send(focused)}function updateDisplay(groups,node){node.value=groups.reduce(function(a,c){return a+c.prefix+c.display},"")+groups.suffix}function groupForPos(groups,pos){return groups.find(function(g){return pos>=g.start&&pos<=g.end})}function displayForGroup(group){if(group.value===null){return padl("",group.length,blankChar)}switch(group.type){case"y":if(!group.value){return padl("",group.length,blankChar)}return group.length<=2?(""+group.value).substr(2,2):""+padl(group.value,group.length);case"M":if(!~group.value){return padl("",group.length,blankChar)}if(group.length===1){return""+(group.value+1)}else if(group.length===2){return(group.value<9?"0":"")+(group.value+1)}else if(group.length===3){return months[group.value].substr(0,3)}else{return months[group.value]}case"d":if(!group.value){return padl("",group.length,blankChar)}if(group.length===1){return""+group.value}else if(group.length===2){return(group.value<=9?"0":"")+group.value}else if(group.length===3){return days[group.groups.value.getDay()].substr(0,3)}else{return days[group.groups.value.getDay()]}case"H":case"h":case"m":case"s":if(group.length===1){return""+group.value}else{return padl(group.value,group.length)}case"S":if(group.length===1){return""+group.value}else{return padl(group.value,3)}}}var dateRE=/y+|M+|d+|E+|H+|m+|s+|S+|k+|a+/g;var months=["January","February","March","April","May","June","July","August","September","October","November","December"];var days=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];var noop={teardown:function teardown(){}};function bumpValue(group,down){switch(group.type){case"y":group.value=group.value+(down?-1:1);break;case"M":group.value=down?group.value<1?11:group.value-1:group.value>10?0:group.value+1;break;case"d":{var groups=group.groups;var last=lastDay(new Date((groups.find(function(g){return g.type==="y"})||{value:1}).value,(groups.find(function(g){return g.type==="M"})||{value:1}).value),1);if(down){group.value=group.value<2?last:group.value-1}else{group.value=group.value+1>last?1:group.value+1}break}case"H":group.value=down?group.value<1?23:group.value-1:group.value>22?0:group.value+1;break;case"h":group.value=down?group.value<1?12:group.value-1:group.value>11?1:group.value+1;break;case"m":case"s":group.value=down?group.value<1?59:group.value-1:group.value>58?0:group.value+1;break;case"S":group.value=down?group.value<1?999:group.value-1:group.value>998?0:group.value+1;break}}function lastDay(date){return new Date(new Date(date.getFullYear(),date.getMonth()+1,1)-864e5).getDate()}var origin=new Date("0000-01-01T00:00:00");function getDateValue(thing,parseDate){var v=thing;if(typeof v==="function"){v=thing()}if(typeof v==="string"){if(typeof parseDate==="function"){try{v=parseDate(v)}catch(e){return defaultDate()}}else{try{v=new Date(v)}catch(e){return defaultDate()}}}if(v instanceof Date){return v}else{return origin}}
var nonDigits=/[^\d]+/;var nonDisplay=/[^\d_]+/;var blankChar="_";var map={y:0,M:1,d:2,H:3,m:4,s:5,S:6};export function padl(str,total,char){if(char===void 0)char="0";var v=str==null?"":""+str;for(var i=v.length;i<total;i++){v=char+v}return v}export function padr(str,total,char){if(char===void 0)char="0";var v=str==null?"":""+str;for(var i=v.length;i<total;i++){v+=char}return v}export var defaults={mask:"yyyy-MM-dd",time:[0,0,0,0],date:function date(){var now=new Date;var tm=defaults.time;return new Date(now.getFullYear(),now.getMonth(),now.getDate(),tm[0],tm[1],tm[2],tm[3])},parseDate:function parseDate(dt){return new Date(dt)}};function timeArray(value){if(value==="start"){value=[0,0,0,0]}else if(value==="end"){value=[23,59,59,999]}else if(value==="mid"){value=[12,0,0,0]}else if(value==="now"){value=function(){var dt=new Date;return[dt.getHours(),dt.getMinutes(),dt.getSeconds(),dt.getMilliseconds()]}}else if(typeof value==="string"){var dt=new Date("2000-05-13T"+value+"Z");if(+dt){value=[dt.getUTCHours(),dt.getUTCMinutes(),dt.getUTCSeconds(),dt.getUTCMilliseconds()]}}if(!Array.isArray(value)&&typeof value!=="function"&&!Array.isArray(value())){value=[0,0,0,0]}return value}export default function plugin(options){if(options===void 0)options={};var defaultMask=options.mask||defaults.mask;var defaultTime=timeArray(options.time||defaults.time);var defaultDate=options.date||defaults.date;if(typeof defaultDate!=="function"){var dt=defaultDate;defaultDate=function(){return dt}}return function(ref){var instance=ref.instance;instance.decorators[options.name||"date"]=function(node,optsin,other){if(optsin===void 0)optsin={};var opts=Object.assign({},options,typeof optsin==="string"?{value:optsin}:optsin,typeof other==="string"?{mask:other}:other);if(!opts.parseDate){opts.parseDate=options.parseDate||defaults.parseDate}var defdt=opts.date||defaultDate;var deftm=timeArray(opts.time||defaultTime);if(typeof defdt!=="function"){var dt=defdt;defdt=function(){return dt}}var ctx=this.getContext(node);var mask=opts.mask||defaultMask;var handles={observers:[],listeners:[]};var lastBackspace=false;if(node.tagName!=="INPUT"){console.warn("Attempted to add a date decorator a "+node.tagName);return noop}if(!mask){return noop}var groups=[];var match,last=0;while(match=dateRE.exec(mask)){var group={mask:match[0],type:match[0][0],length:match[0].length,start:match.index,end:match.index+match[0].length,chunk:groups.length,prefix:mask.substring(last,match.index),groups:groups,value:null,display:padr("",match[0].length,blankChar)};last=group.end;groups.push(group)}groups.suffix=mask.substring(groups[groups.length-1].end);groups.last=null;if(groups.slice(1).find(function(g){return!g.prefix})){console.warn("Attempted to add a date decorator missing interstitial between fields '"+mask+"'");return noop}if(opts.min>opts.max){delete opts.min}if(typeof opts.value==="string"){handles.observers.push(ctx.observe(opts.value,function(v){if(!v&&opts.null===false){v=defdt()}groups.value=v;receiveValue(groups,v,opts.parseDate);groups.last=v;updateDisplay(groups,node);if(opts.min&&v<opts.min||opts.max&&v>opts.max){groups.last=null;setTimeout(sendValue)}},{defer:true}))}if(typeof opts.display==="string"){handles.observers.push(ctx.observe(opts.display,function(v){node.value=v||"";readInput(groups,node,mask);updateValues(groups);applyValues(groups,sendValue,true,defdt,deftm);updateDisplay(groups,node)},{defer:true}))}if(!opts.display&&!opts.value){if(opts.date||opts.null===false){groups.value=getDateValue(opts.date||defdt(),opts.parseDate)}updateDisplay(groups,node)}function sendValue(focused){if(groups.value===null&&groups.last===null||+groups.value===+groups.last){return 1}if(focused&&opts.lazy!==false){return}if(opts.null===false&&groups.value===null){return receiveValue(groups,groups.last,opts.parseDate)&&1||1}if(opts.min&&groups.value<opts.min){receiveValue(groups,opts.min,opts.parseDate);updateDisplay(groups,node)}else if(opts.max&&groups.value>opts.max){receiveValue(groups,opts.max,opts.parseDate);updateDisplay(groups,node)}groups.last=groups.value;if(typeof opts.value==="string"){handles.observers.forEach(function(h){return h.silence()});ctx.set(opts.value,groups.value);handles.observers.forEach(function(h){return h.resume()})}if(typeof opts.display==="string"){handles.observers.forEach(function(h){return h.silence()});ctx.set(opts.display,node.value);handles.observers.forEach(function(h){return h.resume()})}}var selectGroup=function(group,pos){if(pos===undefined){pos=node.selectionStart}if(group&&group.target){group=undefined}if(!group){if(pos===node.value.length&&node.selectionEnd===node.value.length){group=groups[0]}else{group=groupForPos(groups,pos)}}if(lastBackspace){lastBackspace=false;if(pos<group.start){group=groups[groups.indexOf(group)-1]}}document.activeElement===node&&node.setSelectionRange(group.start,group.end)};handles.listeners.push(ctx.listen("input",function(){var pos=node.selectionStart;var start=node.value;readInput(groups,node,mask);var active=groupForPos(groups,pos);var accepted=updateValues(groups,active,pos);applyValues(groups,sendValue,true,defdt,deftm);updateDisplay(groups,node);if(active&&(start.length>=mask.length&&pos===active.end||accepted)&&active!==groups[groups.length-1]){var next=groups[groups.indexOf(active)+1];selectGroup(next,pos)}else{node.setSelectionRange(pos,pos)}}));handles.listeners.push(ctx.listen("blur",function(){lastBackspace=false;if(sendValue(false)){receiveValue(groups,groups.value,opts.parseDate)}if(groups.value===null){groups.forEach(function(g){return g.value=null})}groups.forEach(function(g){return g.display=displayForGroup(g)});updateDisplay(groups,node)}));handles.listeners.push(ctx.listen("click",selectGroup));handles.listeners.push(ctx.listen("focus",selectGroup));handles.listeners.push(ctx.listen("keydown",function(ev){lastBackspace=false;switch(ev.key){case"Enter":case"Tab":{var g=groupForPos(groups,node.selectionStart);var idx=groups.indexOf(g);if(updateValues(groups,g,node.selectionStart,true)){updateDisplay(groups,node);applyValues(groups,sendValue,ev.shiftKey&&idx>0||!ev.shiftKey&&idx+1<groups.length,defdt,deftm)}if(ev.shiftKey&&idx>0){selectGroup(groups[idx-1]);ev.preventDefault();ev.stopPropagation()}else if(!ev.shiftKey&&idx+1<groups.length){selectGroup(groups[idx+1]);ev.preventDefault();ev.stopPropagation()}break}case"Backspace":lastBackspace=true;break;case"ArrowUp":case"ArrowDown":{var ref=[node.selectionStart,node.selectionEnd];var s=ref[0];var e=ref[1];var g$1=groupForPos(groups,s);if(g$1.value===null){g$1.value=1}bumpValue(g$1,ev.key==="ArrowDown");g$1.input=g$1.display=displayForGroup(g$1);applyValues(groups,sendValue,true,defdt,deftm);updateDisplay(groups,node);ev.preventDefault();ev.stopPropagation();node.setSelectionRange(s,e);break}}}));return{teardown:function teardown(){handles.observers.forEach(function(o){return o.cancel()});handles.listeners.forEach(function(o){return o.cancel()})}}}}}function readInput(groups,node,mask){var val=node.value;var pos=node.selectionStart;var active=groupForPos(groups,pos);var gidx=0;var group=groups[gidx];var next=groups[gidx+1];groups.forEach(function(g){return g.input=""});for(var i=0;i<val.length;i++){if(next&&val[i]===next.prefix[0]&&(active!==group||group.input.length>=group.length||val.length-i<mask.length-group.end+(group.length-group.input.length))){if(next.prefix.length>1){i+=next.prefix.length-1}if(val[i+1]===next.prefix[0]){i+=next.prefix.length}group=groups[++gidx];next=groups[gidx+1]}else{group.input+=val[i]}}}function updateValues(groups,target,pos,leave){if(pos===void 0)pos=0;if(leave===void 0)leave=false;var accepted=false;for(var i=0;i<groups.length;i++){var g=groups[i];var v=(g.input||"").replace(nonDigits,"");var hasSep=groups[i+1]&&groups[i+1].prefix&&nonDisplay.test(g.input);if(v.length>g.length&&g===target){var drop=v.length-target.length;v=v.substr(0,pos-target.start)+v.substr(pos-target.start+drop)}else{v=v.substr(0,g.length)}g.input=v;if(g.type==="y"&&v.length===0&&(hasSep||leave)){g.value=(new Date).getFullYear();g.input=g.display=padl(g.value,g.length);accepted=true}else if(g.type==="m"&&v.length===0&&(hasSep||leave)){g.value=0;g.input=g.display=padl(g.value,g.length);accepted=true}else if(g.type==="d"&&v.length!==g.length&&leave){g.value=+v;g.display=displayForGroup(g)}else if(v===""){g.value=null;g.display=displayForGroup(g)}else if(g!==target){g.value=+v;if(g.type==="M"){g.value--}g.display=displayForGroup(g)}else{if(g.type==="M"&&+v>1||g.type==="d"&&+v>3||g.type==="H"&&+v>2||(g.type==="m"||g.type==="s")&&+v>6){g.value=+v;if(g.type==="M"){g.value--}g.display=padl(v,g.length);accepted=true}else if(g.type==="y"&&v.length===2&&(hasSep||leave)){var n=(new Date).getFullYear();var cen=Math.floor(n/100)*100;var val=Math.abs(n-(cen+ +v))<20?cen+ +v:cen-100+ +v;g.value=val;g.input=g.display=padl(val,g.length);accepted=true}else{g.display=padr(v,g.length,blankChar);g.value=+v}}}return accepted}function receiveValue(groups,v,parseDate){v=groups.value=v&&getDateValue(v,parseDate);var parts=v?[v.getFullYear(),v.getMonth(),v.getDate(),v.getHours(),v.getMinutes(),v.getSeconds(),v.getMilliseconds()]:[null,null,null,null,null,null,null];groups.forEach(function(g){g.value=parts[map[g.type]];g.input=g.display=displayForGroup(g)})}function applyValues(groups,send,focused,defaultDate,defaultTime){var v=groups.value||defaultDate();var parts=[v.getFullYear(),v.getMonth(),v.getDate(),v.getHours(),v.getMinutes(),v.getSeconds(),v.getMilliseconds()];if(!groups.find(function(p){return p.type==="m"||p.type==="s"||p.type==="h"||p.type==="S"})){if(typeof defaultTime==="function"){defaultTime=defaultTime()}for(var i=0;i<4;i++){parts[i+3]=defaultTime[i]}}groups.forEach(function(g){var vv=g.value;if(vv!==null&&g.type==="M"){if(vv<0){vv=0}else if(vv>11){vv=11}}else if(vv!==null&&(g.type==="m"||g.type==="s")){if(vv<0){vv=0}else if(vv>59){vv=59}}else if(vv!==null&&g.type==="H"){if(vv<0){vv=0}else if(vv>23){vv=23}}else if(vv!==null&&g.type==="h"){if(vv<1){vv=1}else if(vv>12){vv=12}}if(vv!==g.value){g.value=vv;g.display=displayForGroup(g)}parts[map[g.type]]=g.value});if(parts[0]!==null&&parts[1]!==null&&parts[2]!==null){var d=groups.find(function(g){return g.type==="d"});if(d){if(parts[2]<1){d.value=parts[2]=1;d.display=displayForGroup(d)}else{var last=lastDay(new Date(parts[0],parts[1],1));if(parts[2]>last){d.value=parts[2]=last;d.display=d.input=displayForGroup(d)}}}}if(groups.find(function(g){return g.value===null})||parts[0]===0||parts[1]>11||parts[1]<0||parts[2]===0){groups.value=null}else{parts.unshift(null);groups.value=new(Date.bind.apply(Date,parts))}send(focused)}function updateDisplay(groups,node){node.value=groups.reduce(function(a,c){return a+c.prefix+c.display},"")+groups.suffix}function groupForPos(groups,pos){return groups.find(function(g){return pos>=g.start&&pos<=g.end})}function displayForGroup(group){if(group.value===null){return padl("",group.length,blankChar)}switch(group.type){case"y":if(!group.value){return padl("",group.length,blankChar)}return group.length<=2?(""+group.value).substr(2,2):""+padl(group.value,group.length);case"M":if(!~group.value){return padl("",group.length,blankChar)}if(group.length===1){return""+(group.value+1)}else if(group.length===2){return(group.value<9?"0":"")+(group.value+1)}else if(group.length===3){return months[group.value].substr(0,3)}else{return months[group.value]}case"d":if(!group.value){return padl("",group.length,blankChar)}if(group.length===1){return""+group.value}else if(group.length===2){return(group.value<=9?"0":"")+group.value}else if(group.length===3){return days[group.groups.value.getDay()].substr(0,3)}else{return days[group.groups.value.getDay()]}case"H":case"h":case"m":case"s":if(group.length===1){return""+group.value}else{return padl(group.value,group.length)}case"S":if(group.length===1){return""+group.value}else{return padl(group.value,3)}}}var dateRE=/y+|M+|d+|E+|H+|m+|s+|S+|k+|a+/g;var months=["January","February","March","April","May","June","July","August","September","October","November","December"];var days=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];var noop={teardown:function teardown(){}};function bumpValue(group,down){switch(group.type){case"y":group.value=group.value+(down?-1:1);break;case"M":group.value=down?group.value<1?11:group.value-1:group.value>10?0:group.value+1;break;case"d":{var groups=group.groups;var last=lastDay(new Date((groups.find(function(g){return g.type==="y"})||{value:1}).value,(groups.find(function(g){return g.type==="M"})||{value:1}).value),1);if(down){group.value=group.value<2?last:group.value-1}else{group.value=group.value+1>last?1:group.value+1}break}case"H":group.value=down?group.value<1?23:group.value-1:group.value>22?0:group.value+1;break;case"h":group.value=down?group.value<1?12:group.value-1:group.value>11?1:group.value+1;break;case"m":case"s":group.value=down?group.value<1?59:group.value-1:group.value>58?0:group.value+1;break;case"S":group.value=down?group.value<1?999:group.value-1:group.value>998?0:group.value+1;break}}function lastDay(date){return new Date(new Date(date.getFullYear(),date.getMonth()+1,1)-864e5).getDate()}var origin=new Date("0000-01-01T00:00:00");function getDateValue(thing,parseDate){var v=thing;if(typeof v==="function"){v=thing()}if(typeof v==="string"){if(typeof parseDate==="function"){try{v=parseDate(v)}catch(e){return defaultDate()}}else{try{v=new Date(v)}catch(e){return defaultDate()}}}if(v instanceof Date){return v}else{return origin}}

@@ -10,3 +10,3 @@ import globalRegister from './globalRegister';

return ("\n label.field, .field-manual {\n display: inline-block;\n font-size: 0.9em;\n font-weight: 500;\n color: " + (primary.fg || '#222') + ";\n transition: 0.2s ease-in-out;\n transition-property: color;\n vertical-align: top;\n box-sizing: border-box;\n padding: 0.25em 0.5em;\n line-height: 1.5em;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-family: inherit;\n }\n\n label.field.textarea {\n display: block;\n border: 0.0625em solid " + (primary.bc || '#ccc') + ";\n padding: 0.5em 0.8em 0.8em 0.8em;\n border-radius: " + (primary.radius || '0.2em') + ";\n box-shadow: none;\n transition-property: color, border-color, box-shadow;\n margin: 0.8em 0.2em;\n min-height: auto;\n background-color: " + (boxy ? primary.bg || '#fff' : 'transparent') + ";\n }\n\n label.field.focus {\n color: " + (active.fg || primary.fga || '#07e') + ";\n }\n\n label.field.textarea.focus {\n border-color: " + (active.fg || primary.fga || '#07e') + ";\n " + (!boxy ? ("box-shadow: 0.0625em 0.0625em " + (active.fg || primary.fga || '#07e') + ",\n -0.0625em 0.0625em " + (active.fg || primary.fga || '#07e') + ",\n 0.0625em -0.0625em " + (active.fg || primary.fga || '#07e') + ",\n -0.0625em -0.0625em " + (active.fg || primary.fga || '#07e') + ";") : '') + "\n }\n\n label.field input,\n label.field select,\n label.field textarea,\n .field-manual .field-body\n {\n display: block;\n border-width: " + (boxy ? '0.0625em' : '0 0 0.0625em 0') + ";\n border-color: " + (primary.bc || '#ccc') + ";\n border-style: solid;\n box-sizing: border-box;\n background-color: " + (boxy ? primary.bg || '#fff' : 'transparent') + ";\n transition: 0.2s ease-in-out;\n transition-property: box-shadow, color;\n outline: none;\n box-shadow: none;\n width: 100%;\n margin-bottom: 0.8em;\n font-size: 1.1em;" + (boxy ? ("\n border-radius: " + (primary.radius || '0.2em') + ";") : '') + "\n font-weight: 400;\n font-family: inherit;\n }\n\n label.field input" + (boxy ? '' : ':disabled') + ",\n label.field select" + (boxy ? '' : ':disabled') + " {\n padding: 0 0.75em;\n }\n label.field select" + (boxy ? '' : ':disabled') + " {\n padding-right: 2em;\n }\n\n label.field input:disabled,\n label.field input[readonly],\n label.field select:disabled,\n label.field textarea:disabled,\n label.field textarea[readonly] {\n background: " + (disabled.bg || '#f4f4f4') + ";\n color: " + (disabled.fg || '#444') + ";\n }\n\n label.field textarea {\n line-height: 1.2em;\n }\n label.field .field-wrapper {\n display: block;\n }\n label.field > select, label.field > input,\n label.field > .field-wrapper > input, label.field > .field-wrapper > select {\n height: 2.5em;\n }\n\n " + (!boxy ? ("label.field:hover > input,\n label.field:hover select,\n label.field.file:hover:after {\n box-shadow: 0 0.0625em 0 0 " + (primary.bc || '#ccc') + ";\n }\n\n label.field.textarea:hover {\n box-shadow: 0.0625em 0.0625em " + (primary.bc || '#ccc') + ",\n -0.0625em 0.0625em " + (primary.bc || '#ccc') + ",\n 0.0625em -0.0625em " + (primary.bc || '#ccc') + ",\n -0.0625em -0.0625em " + (primary.bc || '#ccc') + ";\n }\n\n label.field.textarea.focus:hover {\n box-shadow: 0.0625em 0.0625em " + (active.fg || primary.fga || '#07e') + ",\n -0.0625em 0.0625em " + (active.fg || primary.fga || '#07e') + ",\n 0.0625em -0.0625em " + (active.fg || primary.fga || '#07e') + ",\n -0.0625em -0.0625em " + (active.fg || primary.fga || '#07e') + ";\n }") : '') + "\n\n /**** CHECK BOXES ****/\n\n label.field.check, label.field.radio {\n position:relative;\n z-index: 0;\n overflow: visible;\n cursor: pointer;\n padding-top: 2.2em;\n white-space: normal;\n }\n label.field.check.inline, label.field.radio.inline {\n padding-top: 0.7em;\n }\n\n label.field.check input, label.field.radio input {\n appearance: none;\n -moz-appearance: none;\n -webkit-appearance: none;\n z-index: -1;\n position: absolute;\n left: -0.5em;\n top: 1em;\n display: block;\n margin: 0;\n border-radius: 50%;\n width: 3.2em;\n height: 3.2em;\n background-color: " + (primary.bc || '#ccc') + ";\n box-shadow: none;\n outline: none;\n opacity: 0;\n transform: scale(1);\n pointer-events: none;\n transition: opacity 0.3s, transform 0.2s;\n }\n label.field.inline.check input, label.field.inline.radio input {\n top: -0.45em;\n left: -0.55em;\n }\n\n label.field.check input:checked, label.field.radio input:checked {\n background-color: " + (primary.fga || '#07e') + ";\n }\n\n label.field.check:hover > input, label.field.radio:hover > input {\n opacity: 0.04;\n }\n\n label.field.check input:focus, label.field.radio input:focus {\n opacity: 0.12;\n }\n\n label.field.check:hover > input:focus, label.field.radio:hover > input:focus {\n opacity: 0.16;\n }\n\n label.field.check input:active, label.field.radio input:active {\n opacity: 0.6;\n transform: scale(0);\n transition: transform 0s, opacity 0s;\n }\n\n label.field.check:before, label.field.radio:before {\n content: '';\n display: inline-block;\n box-sizing: border-box;\n margin: 0 0.5em 0.2em 0.1em;\n border: solid 0.125em; /* Safari */\n border-color: " + (primary.fg || '#222') + ";\n border-radius: 0.125em;\n width: 1.2em;\n height: 1.2em;\n vertical-align: bottom;\n transition: border-color 0.2s, background-color 0.2s;\n }\n\n label.field.check:after, label.field.radio:after {\n content: '';\n display: inline-block;\n opacity: 0;\n position: absolute;\n width: 1.2em;\n height: 1.2em;\n top: 2.3em;\n left: 0.6em;\n border-radius: 0.125em;\n }\n label.field.check.inline:after, label.field.radio.inline:after {\n top: 0.8em;\n }\n\n label.field.check.checked:after {\n opacity: 1;\n background: no-repeat center/80% url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\"><path fill=\"" + ((primary.bg || '#fff').replace(/#/g, '%23')) + "\" d=\"m 15.378906,1.7050781 a 1.0583349,1.0583349 0 0 0 -1.478515,0.234375 L 6.6210937,11.960938 1.8652344,8.5058594 a 1.0583349,1.0583349 0 0 0 -1.47851565,0.234375 1.0583349,1.0583349 0 0 0 0.234375,1.4785156 L 6.234375,14.294922 A 1.0584408,1.0584408 0 0 0 7.7128906,14.060547 L 15.613281,3.1835938 A 1.0583349,1.0583349 0 0 0 15.378906,1.7050781 Z\" /></svg>') " + (primary.fga || '#07e') + ";\n }\n\n label.field.radio.checked:after {\n opacity: 1;\n background: no-repeat center/80% url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\"><circle fill=\"" + ((primary.bg || '#fff').replace(/#/g, '%23')) + "\" cx=\"8\" cy=\"8\" r=\"5\" /></svg>') " + (primary.fga || '#07e') + ";\n }\n\n label.field.check.checked:before, label.field.radio.checked:before {\n border-color: " + (primary.fga || '#07e') + ";\n }\n label.field.check.focus:before, label.field.radio.focus:before {\n border-color: " + (primary.fga || '#07e') + ";\n }\n\n label.field.check input:disabled, label.field.radio input:disabled {\n opacity: 0;\n }\n\n label.field.check.disabled, label.field.radio.disabled {\n color: " + (disabled.fg || '#444') + ";\n cursor: initial;\n }\n\n label.field.check.disabled:before, label.field.radio.disabled:before {\n border-color: " + (disabled.bc || '#ccc') + ";\n background-color: " + (disabled.bg || '#f4f4f4') + ";\n }\n\n label.field.check.checked.disabled:after, label.field.radio.checked.disabled:after {\n border-color: transparent;\n background-color: " + (disabled.bc || '#ccc') + ";\n }\n\n label.field select {\n padding-right: 2em;\n }\n\n label.field.select {\n cursor: pointer;\n position: relative;\n }\n\n label.field.select:after {\n content: ' ';\n position: absolute;\n display: block;\n width: 0.6em;\n right: 1.125em;\n height: 0.6em;\n top: 2.6em;\n border-bottom: 0.125em solid;\n border-right: 0.125em solid;\n transform: rotate(45deg);\n pointer-events: none;\n color: " + (primary.bc || '#ccc') + ";\n }\n\n label.field textarea {\n border: none;" + (boxy ? "\n padding: 0;" : '') + "\n }\n\n label.field > select {\n -moz-appearance: none;\n -webkit-appearance: none;\n }\n\n label.field input:focus,\n label.field select:focus,\n label.field.file.focus:after\n {\n border-color: " + (active.fg || primary.fga || '#07e') + ";\n " + (!boxy ? ("box-shadow: 0 0.0625em 0 0 " + (active.fg || primary.fga || '#07e') + ";") : '') + "\n }\n\n label.field input[type=checkbox]:focus,\n label.field input[type=radio]:focus {\n box-shadow: none;\n }\n\n label.field.file.focus:after {\n color: " + (active.fg || primary.fga || '#07e') + ";\n }\n label.field.file [type=file] {\n position: absolute;\n width: 0;\n height: 0;\n opacity: 0;\n z-index: -1;\n }\n label.field.file {\n position: relative;\n min-width: 9em;\n height: 5em;\n }\n label.field.file:after {\n position: absolute;\n content: 'Choose a file';\n box-sizing: border-box;\n width: calc(100% - 0.3em);\n height: 2.5em;\n font-size: 1.1em;\n line-height: 1.5em;\n color: " + (primary.fg || '#222') + ";\n text-align: " + (boxy ? 'center' : 'left') + ";\n padding: 0.5em " + (boxy ? '0.5em' : '0') + ";\n cursor: pointer;\n font-style: oblique;\n left: 0.25em;\n top: 1.6em;\n transition: 0.2s ease-in-out;\n transition-property: color, border-bolor, box-shadow;" + (boxy ? ("\n border-radius: " + (primary.radius || '0.2em') + ";\n border-color: " + (primary.bc || '#ccc') + ";\n border-style: solid;\n border-width: 0.0625em;") : ("\n border-bottom-color: " + (primary.bc || '#ccc') + ";\n border-bottom-width: 0.0625em;\n border-bottom-style: solid;\n ")) + "\n }\n label.field.file.inline:after {\n top: 0.2em;\n }\n\n label.field.button {\n vertical-align: top;\n padding-top: " + (boxy ? '1.7' : '1.958') + "em;\n }\n label.field .with-buttons button, label.field.button button {\n font-size: 1.1em;\n margin-top: " + (boxy ? '0.15em' : '0') + ";\n }\n\n label.field .field-wrapper.with-buttons {\n display: flex;\n }\n label.field .with-buttons button {\n flex-shrink: 0;\n padding-left: 0.5em;\n padding-right: 0.5em;\n margin-top: 0;\n margin-right: 0;\n " + (boxy ? ("height: 2.5em;\n box-shadow: none;\n border-radius: 0;\n border-left: 1px solid " + (primary.bg || '#fff') + ";\n margin-left: 0;") :
"height: 2.25em;") + "\n }" + (boxy ? ("\n label.field .with-buttons button:first-of-type {\n margin-left: -0.05em;\n border-left: none;\n }\n label.field .with-buttons button:last-of-type {\n border-radius: 0 " + (primary.radius || '0.2em') + " " + (primary.radius || '0.2em') + " 0;\n }\n label.field .with-buttons input {\n border-radius: " + (primary.radius || '0.2em') + " 0 0 " + (primary.radius || '0.2em') + ";\n min-width: 0;\n }\n ") : '') + "\n\n label.field.plain > div {\n position: absolute;\n font-size: 1.1em;\n top: 2.4em;\n font-weight: normal;\n }\n\n /* inline fields (no labels) */\n label.field.inline {\n height: 3.3em;\n }\n\n label.field.button.inline {\n margin-top: 0.2em;\n padding-top: 0.12em;\n }\n\n label.field.button.inline button {\n margin-top: 0;\n }\n\n label.field.inline.select:after {\n top: 1." + (boxy ? '15' : '1') + "em;\n }\n\n label.field .field-tip {\n display: inline-block;\n width: 1em;\n height: 1em;\n background-color: " + (primary.fga || '#07e') + ";\n color: " + (primary.bg || '#fff;') + ";\n cursor: default;\n user-select: none;\n border-radius: 1em;\n margin-left: 0.5em;\n line-height: 1.2em;\n text-align: center;\n margin-top: -0.2em;\n }\n\n label.field .field-solo-tip {\n margin-left: -0.1em;\n }\n ");
"height: 2.25em;") + "\n }" + (boxy ? ("\n label.field .with-buttons button:first-of-type {\n margin-left: -0.05em;\n border-left: none;\n }\n label.field .with-buttons button:last-of-type {\n border-radius: 0 " + (primary.radius || '0.2em') + " " + (primary.radius || '0.2em') + " 0;\n }\n label.field .with-buttons input {\n border-radius: " + (primary.radius || '0.2em') + " 0 0 " + (primary.radius || '0.2em') + ";\n min-width: 0;\n }\n ") : '') + "\n\n label.field.plain > div {\n position: absolute;\n font-size: 1.1em;\n top: 2.4em;\n font-weight: normal;\n }\n\n /* inline fields (no labels) */\n label.field.inline {\n min-height: 3.3em;\n }\n\n label.field.button.inline {\n margin-top: 0.2em;\n padding-top: 0.12em;\n }\n\n label.field.button.inline button {\n margin-top: 0;\n }\n\n label.field.inline.select:after {\n top: 1." + (boxy ? '15' : '1') + "em;\n }\n\n label.field .field-tip {\n display: inline-block;\n width: 1em;\n height: 1em;\n background-color: " + (primary.fga || '#07e') + ";\n color: " + (primary.bg || '#fff;') + ";\n cursor: default;\n user-select: none;\n border-radius: 1em;\n margin-left: 0.5em;\n line-height: 1.2em;\n text-align: center;\n margin-top: -0.2em;\n }\n\n label.field .field-solo-tip {\n margin-left: -0.1em;\n }\n ");
// TODO: other themes

@@ -193,2 +193,3 @@ }

var body = [];
var label = [];
var attrs = (handle.template.m || []).slice();

@@ -239,2 +240,9 @@ var content = handle.template.f || [];

// check for button wrapping
content.forEach(function (e) {
if (e.e === 'label') {
if (e.f && e.f.length) { label.push.apply(label, e.f); }
} else {
body.push(e);
}
});
var els = content.filter(function (e) { return e.e; });

@@ -246,13 +254,12 @@ if (els.find(function (e) { return e.e === 'button'; }) && els.length > 1) {

],
f: content
f: body
}];
} else {
body.push.apply(body, content);
}
}
var label = attrs.find(function (a) { return a.n === 'label'; });
var labelattr = attrs.find(function (a) { return a.n === 'label'; });
if (labelattr && labelattr.f && labelattr.f.length) { label.push.apply(label, Array.isArray(labelattr.f) ? labelattr.f : [labelattr.f]); }
if (tip) { body.unshift({
t: 7, e: 'span', m: [
{ t: 13, n: 'class', f: ("field-tip" + (!label ? ' field-solo-tip' : '')), g: 1 },
{ t: 13, n: 'class', f: ("field-tip" + (!label.length ? ' field-solo-tip' : '')), g: 1 },
{ t: 13, n: 'title', f: tip.f },

@@ -264,3 +271,3 @@ { t: 70, n: ['click'], f: { r: [], s: '[false]' } }

var inline = attrs.find(function (a) { return a.n === 'inline'; });
if (label && !inline) { body.unshift.apply(body, Array.isArray(label.f) ? label.f : [label.f]); }
if (label && !inline) { body.unshift.apply(body, label); }
else if (!inline) { body.unshift('\xa0'); }

@@ -267,0 +274,0 @@

@@ -1,1 +0,1 @@

import globalRegister from"./globalRegister";import Ractive from"ractive";export function style(data){var primary=Object.assign({},data("raui.primary"),data("raui.form.primary"));var active=Object.assign({},data("raui.primary.active"),data("raui.form.primary.active"));var disabled=Object.assign({},data("raui.primary.disabled"),data("raui.form.primary.disabled"));var boxy=data("raui.form.boxy");return"\n label.field, .field-manual {\n display: inline-block;\n font-size: 0.9em;\n font-weight: 500;\n color: "+(primary.fg||"#222")+";\n transition: 0.2s ease-in-out;\n transition-property: color;\n vertical-align: top;\n box-sizing: border-box;\n padding: 0.25em 0.5em;\n line-height: 1.5em;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-family: inherit;\n }\n\n label.field.textarea {\n display: block;\n border: 0.0625em solid "+(primary.bc||"#ccc")+";\n padding: 0.5em 0.8em 0.8em 0.8em;\n border-radius: "+(primary.radius||"0.2em")+";\n box-shadow: none;\n transition-property: color, border-color, box-shadow;\n margin: 0.8em 0.2em;\n min-height: auto;\n background-color: "+(boxy?primary.bg||"#fff":"transparent")+";\n }\n\n label.field.focus {\n color: "+(active.fg||primary.fga||"#07e")+";\n }\n\n label.field.textarea.focus {\n border-color: "+(active.fg||primary.fga||"#07e")+";\n "+(!boxy?"box-shadow: 0.0625em 0.0625em "+(active.fg||primary.fga||"#07e")+",\n -0.0625em 0.0625em "+(active.fg||primary.fga||"#07e")+",\n 0.0625em -0.0625em "+(active.fg||primary.fga||"#07e")+",\n -0.0625em -0.0625em "+(active.fg||primary.fga||"#07e")+";":"")+"\n }\n\n label.field input,\n label.field select,\n label.field textarea,\n .field-manual .field-body\n {\n display: block;\n border-width: "+(boxy?"0.0625em":"0 0 0.0625em 0")+";\n border-color: "+(primary.bc||"#ccc")+";\n border-style: solid;\n box-sizing: border-box;\n background-color: "+(boxy?primary.bg||"#fff":"transparent")+";\n transition: 0.2s ease-in-out;\n transition-property: box-shadow, color;\n outline: none;\n box-shadow: none;\n width: 100%;\n margin-bottom: 0.8em;\n font-size: 1.1em;"+(boxy?"\n border-radius: "+(primary.radius||"0.2em")+";":"")+"\n font-weight: 400;\n font-family: inherit;\n }\n\n label.field input"+(boxy?"":":disabled")+",\n label.field select"+(boxy?"":":disabled")+" {\n padding: 0 0.75em;\n }\n label.field select"+(boxy?"":":disabled")+" {\n padding-right: 2em;\n }\n\n label.field input:disabled,\n label.field input[readonly],\n label.field select:disabled,\n label.field textarea:disabled,\n label.field textarea[readonly] {\n background: "+(disabled.bg||"#f4f4f4")+";\n color: "+(disabled.fg||"#444")+";\n }\n\n label.field textarea {\n line-height: 1.2em;\n }\n label.field .field-wrapper {\n display: block;\n }\n label.field > select, label.field > input,\n label.field > .field-wrapper > input, label.field > .field-wrapper > select {\n height: 2.5em;\n }\n\n "+(!boxy?"label.field:hover > input,\n label.field:hover select,\n label.field.file:hover:after {\n box-shadow: 0 0.0625em 0 0 "+(primary.bc||"#ccc")+";\n }\n\n label.field.textarea:hover {\n box-shadow: 0.0625em 0.0625em "+(primary.bc||"#ccc")+",\n -0.0625em 0.0625em "+(primary.bc||"#ccc")+",\n 0.0625em -0.0625em "+(primary.bc||"#ccc")+",\n -0.0625em -0.0625em "+(primary.bc||"#ccc")+";\n }\n\n label.field.textarea.focus:hover {\n box-shadow: 0.0625em 0.0625em "+(active.fg||primary.fga||"#07e")+",\n -0.0625em 0.0625em "+(active.fg||primary.fga||"#07e")+",\n 0.0625em -0.0625em "+(active.fg||primary.fga||"#07e")+",\n -0.0625em -0.0625em "+(active.fg||primary.fga||"#07e")+";\n }":"")+"\n\n /**** CHECK BOXES ****/\n\n label.field.check, label.field.radio {\n position:relative;\n z-index: 0;\n overflow: visible;\n cursor: pointer;\n padding-top: 2.2em;\n white-space: normal;\n }\n label.field.check.inline, label.field.radio.inline {\n padding-top: 0.7em;\n }\n\n label.field.check input, label.field.radio input {\n appearance: none;\n -moz-appearance: none;\n -webkit-appearance: none;\n z-index: -1;\n position: absolute;\n left: -0.5em;\n top: 1em;\n display: block;\n margin: 0;\n border-radius: 50%;\n width: 3.2em;\n height: 3.2em;\n background-color: "+(primary.bc||"#ccc")+";\n box-shadow: none;\n outline: none;\n opacity: 0;\n transform: scale(1);\n pointer-events: none;\n transition: opacity 0.3s, transform 0.2s;\n }\n label.field.inline.check input, label.field.inline.radio input {\n top: -0.45em;\n left: -0.55em;\n }\n\n label.field.check input:checked, label.field.radio input:checked {\n background-color: "+(primary.fga||"#07e")+";\n }\n\n label.field.check:hover > input, label.field.radio:hover > input {\n opacity: 0.04;\n }\n\n label.field.check input:focus, label.field.radio input:focus {\n opacity: 0.12;\n }\n\n label.field.check:hover > input:focus, label.field.radio:hover > input:focus {\n opacity: 0.16;\n }\n\n label.field.check input:active, label.field.radio input:active {\n opacity: 0.6;\n transform: scale(0);\n transition: transform 0s, opacity 0s;\n }\n\n label.field.check:before, label.field.radio:before {\n content: '';\n display: inline-block;\n box-sizing: border-box;\n margin: 0 0.5em 0.2em 0.1em;\n border: solid 0.125em; /* Safari */\n border-color: "+(primary.fg||"#222")+';\n border-radius: 0.125em;\n width: 1.2em;\n height: 1.2em;\n vertical-align: bottom;\n transition: border-color 0.2s, background-color 0.2s;\n }\n\n label.field.check:after, label.field.radio:after {\n content: \'\';\n display: inline-block;\n opacity: 0;\n position: absolute;\n width: 1.2em;\n height: 1.2em;\n top: 2.3em;\n left: 0.6em;\n border-radius: 0.125em;\n }\n label.field.check.inline:after, label.field.radio.inline:after {\n top: 0.8em;\n }\n\n label.field.check.checked:after {\n opacity: 1;\n background: no-repeat center/80% url(\'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="'+(primary.bg||"#fff").replace(/#/g,"%23")+'" d="m 15.378906,1.7050781 a 1.0583349,1.0583349 0 0 0 -1.478515,0.234375 L 6.6210937,11.960938 1.8652344,8.5058594 a 1.0583349,1.0583349 0 0 0 -1.47851565,0.234375 1.0583349,1.0583349 0 0 0 0.234375,1.4785156 L 6.234375,14.294922 A 1.0584408,1.0584408 0 0 0 7.7128906,14.060547 L 15.613281,3.1835938 A 1.0583349,1.0583349 0 0 0 15.378906,1.7050781 Z" /></svg>\') '+(primary.fga||"#07e")+';\n }\n\n label.field.radio.checked:after {\n opacity: 1;\n background: no-repeat center/80% url(\'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><circle fill="'+(primary.bg||"#fff").replace(/#/g,"%23")+'" cx="8" cy="8" r="5" /></svg>\') '+(primary.fga||"#07e")+";\n }\n\n label.field.check.checked:before, label.field.radio.checked:before {\n border-color: "+(primary.fga||"#07e")+";\n }\n label.field.check.focus:before, label.field.radio.focus:before {\n border-color: "+(primary.fga||"#07e")+";\n }\n\n label.field.check input:disabled, label.field.radio input:disabled {\n opacity: 0;\n }\n\n label.field.check.disabled, label.field.radio.disabled {\n color: "+(disabled.fg||"#444")+";\n cursor: initial;\n }\n\n label.field.check.disabled:before, label.field.radio.disabled:before {\n border-color: "+(disabled.bc||"#ccc")+";\n background-color: "+(disabled.bg||"#f4f4f4")+";\n }\n\n label.field.check.checked.disabled:after, label.field.radio.checked.disabled:after {\n border-color: transparent;\n background-color: "+(disabled.bc||"#ccc")+";\n }\n\n label.field select {\n padding-right: 2em;\n }\n\n label.field.select {\n cursor: pointer;\n position: relative;\n }\n\n label.field.select:after {\n content: ' ';\n position: absolute;\n display: block;\n width: 0.6em;\n right: 1.125em;\n height: 0.6em;\n top: 2.6em;\n border-bottom: 0.125em solid;\n border-right: 0.125em solid;\n transform: rotate(45deg);\n pointer-events: none;\n color: "+(primary.bc||"#ccc")+";\n }\n\n label.field textarea {\n border: none;"+(boxy?"\n padding: 0;":"")+"\n }\n\n label.field > select {\n -moz-appearance: none;\n -webkit-appearance: none;\n }\n\n label.field input:focus,\n label.field select:focus,\n label.field.file.focus:after\n {\n border-color: "+(active.fg||primary.fga||"#07e")+";\n "+(!boxy?"box-shadow: 0 0.0625em 0 0 "+(active.fg||primary.fga||"#07e")+";":"")+"\n }\n\n label.field input[type=checkbox]:focus,\n label.field input[type=radio]:focus {\n box-shadow: none;\n }\n\n label.field.file.focus:after {\n color: "+(active.fg||primary.fga||"#07e")+";\n }\n label.field.file [type=file] {\n position: absolute;\n width: 0;\n height: 0;\n opacity: 0;\n z-index: -1;\n }\n label.field.file {\n position: relative;\n min-width: 9em;\n height: 5em;\n }\n label.field.file:after {\n position: absolute;\n content: 'Choose a file';\n box-sizing: border-box;\n width: calc(100% - 0.3em);\n height: 2.5em;\n font-size: 1.1em;\n line-height: 1.5em;\n color: "+(primary.fg||"#222")+";\n text-align: "+(boxy?"center":"left")+";\n padding: 0.5em "+(boxy?"0.5em":"0")+";\n cursor: pointer;\n font-style: oblique;\n left: 0.25em;\n top: 1.6em;\n transition: 0.2s ease-in-out;\n transition-property: color, border-bolor, box-shadow;"+(boxy?"\n border-radius: "+(primary.radius||"0.2em")+";\n border-color: "+(primary.bc||"#ccc")+";\n border-style: solid;\n border-width: 0.0625em;":"\n border-bottom-color: "+(primary.bc||"#ccc")+";\n border-bottom-width: 0.0625em;\n border-bottom-style: solid;\n ")+"\n }\n label.field.file.inline:after {\n top: 0.2em;\n }\n\n label.field.button {\n vertical-align: top;\n padding-top: "+(boxy?"1.7":"1.958")+"em;\n }\n label.field .with-buttons button, label.field.button button {\n font-size: 1.1em;\n margin-top: "+(boxy?"0.15em":"0")+";\n }\n\n label.field .field-wrapper.with-buttons {\n display: flex;\n }\n label.field .with-buttons button {\n flex-shrink: 0;\n padding-left: 0.5em;\n padding-right: 0.5em;\n margin-top: 0;\n margin-right: 0;\n "+(boxy?"height: 2.5em;\n box-shadow: none;\n border-radius: 0;\n border-left: 1px solid "+(primary.bg||"#fff")+";\n margin-left: 0;":"height: 2.25em;")+"\n }"+(boxy?"\n label.field .with-buttons button:first-of-type {\n margin-left: -0.05em;\n border-left: none;\n }\n label.field .with-buttons button:last-of-type {\n border-radius: 0 "+(primary.radius||"0.2em")+" "+(primary.radius||"0.2em")+" 0;\n }\n label.field .with-buttons input {\n border-radius: "+(primary.radius||"0.2em")+" 0 0 "+(primary.radius||"0.2em")+";\n min-width: 0;\n }\n ":"")+"\n\n label.field.plain > div {\n position: absolute;\n font-size: 1.1em;\n top: 2.4em;\n font-weight: normal;\n }\n\n /* inline fields (no labels) */\n label.field.inline {\n height: 3.3em;\n }\n\n label.field.button.inline {\n margin-top: 0.2em;\n padding-top: 0.12em;\n }\n\n label.field.button.inline button {\n margin-top: 0;\n }\n\n label.field.inline.select:after {\n top: 1."+(boxy?"15":"1")+"em;\n }\n\n label.field .field-tip {\n display: inline-block;\n width: 1em;\n height: 1em;\n background-color: "+(primary.fga||"#07e")+";\n color: "+(primary.bg||"#fff;")+";\n cursor: default;\n user-select: none;\n border-radius: 1em;\n margin-left: 0.5em;\n line-height: 1.2em;\n text-align: center;\n margin-top: -0.2em;\n }\n\n label.field .field-solo-tip {\n margin-left: -0.1em;\n }\n "}function noop(){}function focused(ev){if(!~this.className.indexOf("focus")){this.className+=" focus"}}function blurred(ev){this.className=this.className.replace(/\bfocus\b/g,"").trim()}export function field(node){var ctx=this.getContext(node);var isField,isCheck,isRadio,isArea,isSelect,isFile,isButton,isPlain,isInput;var change,attrs,desc,last;function invalidate(){var val=setup().split(/\s+/).filter(function(c){return!!c});isField=!!~val.indexOf("field");if(!isField){val.push("field");isField=true}isCheck=node.querySelector("input[type=checkbox]");if(isCheck&&!~val.indexOf("check")){val.push("check")}isRadio=node.querySelector("input[type=radio]");if(isRadio&&!~val.indexOf("radio")){val.push("radio")}var checkable=isCheck||isRadio;if(checkable&&checkable.checked&&!~val.indexOf("checked")){val.push("checked")}if(checkable&&checkable.disabled&&!~val.indexOf("disabled")){val.push("disabled")}if(!checkable&&change){change.cancel();change=0;if(attrs){attrs.disconnect();attrs=0}delete checkable._form_callback;if(last){delete last.checked;desc=last=undefined}}else if(checkable){checkable._form_callback=function(ev,init){if(init===void 0)init=true;if(init&&checkable.type==="radio"&&checkable.name){var list=[];list.push.apply(list,document.querySelectorAll("input[type=radio][name="+checkable.name+"]"));list=list.filter(function(i){return i!==checkable});list.forEach(function(l){return l._form_callback&&l._form_callback(ev,false)})}var checked=checkable.checked;if(checked&&!~node.className.indexOf("checked")){node.className+=" checked"}else if(!checked&&~node.className.indexOf("checked")){node.className=node.className.replace(/\bchecked\b/g,"").replace(/ +/g," ").trim()}};if(MutationObserver){attrs=new MutationObserver(function(){var val;val=checkable.disabled;if(val&&!~node.className.indexOf("disabled")){node.className+=" disabled"}else if(!val&&~node.className.indexOf("disabled")){node.className=node.className.replace(/\bdisabled\b/g,"").replace(/ +/g," ").trim()}});attrs.observe(checkable,{attributes:true})}change=this.getContext(checkable).listen("change",checkable._form_callback);desc=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(checkable),"checked");if(desc&&desc.configurable){last=checkable;Object.defineProperty(checkable,"checked",{get:desc.get,set:function set(v){desc.set.call(last,v);checkable._form_callback()},enumerable:true,configurable:true})}}isArea=!!node.querySelector("textarea");if(isArea&&!~val.indexOf("textarea")){val.push("textarea")}isSelect=!!node.querySelector("select");if(isSelect&&!~val.indexOf("select")){val.push("select")}isFile=!!node.querySelector("input[type=file]");if(isFile&&!~val.indexOf("file")){val.push("file")}isButton=node.querySelector("button");isButton=!!isButton&&isButton.parentNode===node;if(isButton&&!~val.indexOf("button")){val.push("button")}isPlain=!!node.querySelector("div");if(isPlain&&!~val.indexOf("plain")){val.push("plain")}isInput=!isCheck&&!isRadio&&!isFile&&!!node.querySelector("input");if(isInput&&!~val.indexOf("input")){val.push("input")}node.className=val.join(" ")}function setup(){var cls=node.className;if(!isField){cls=cls.replace(/\bfield\b/g,"").trim()}if(!isCheck){cls=cls.replace(/\bcheck(ed)?\b/g,"").trim()}if(!isRadio){cls=cls.replace(/\bradio\b/g,"").trim()}if(!isArea){cls=cls.replace(/\btextarea\b/g,"").trim()}if(!isSelect){cls=cls.replace(/\bselect\b/g,"").trim()}if(!isFile){cls=cls.replace(/\bfile\b/g,"").trim()}if(!isButton){cls=cls.replace(/\bbutton\b/g,"").trim()}if(!isPlain){cls=cls.replace(/\bplain\b/g,"").trim()}if(!isInput){cls=cls.replace(/\binput\b/g,"").trim()}cls=cls.replace(/ +/g," ");return cls}var focus=ctx.listen("focusin",focused);var blur=ctx.listen("focusout",blurred);invalidate.call(this);var res={update:noop,invalidate:invalidate.bind(this),teardown:function teardown(){ctx.ractive.fire("fieldUnregistered",ctx,node,res);var cls=setup();cls=cls.replace(/\bfocus\b/g,"").trim();focus.cancel();blur.cancel();change&&change.cancel();if(attrs){attrs.disconnect()}if(last){delete last.checked;desc=last=undefined}node.className=cls},setDisabled:function setDisabled(v){var children=node.querySelectorAll("input,button,select,textarea");children.forEach(function(c){return c.disabled=v});this.invalidate()}};ctx.ractive.fire("fieldRegistered",ctx,node,res);return res}field.style=style;function findDeep(els,el){if(!els){return false}for(var i=0;i<els.length;i++){if(els[i].e===el){return true}if(els[i].f&&findDeep(els[i].f,el)){return true}}return false}export var macro=Ractive.macro(function(handle){var body=[];var attrs=(handle.template.m||[]).slice();var content=handle.template.f||[];var value=attrs.find(function(a){return a.n==="value"});var type=attrs.find(function(a){return a.n==="type"});var tip=attrs.find(function(a){return a.n==="tip"});var disabled=attrs.find(function(a){return a.n==="disabled"});if(tip){attrs.splice(attrs.indexOf(tip),1)}if(type&&typeof macro.types[type.f]==="function"){body.push.apply(body,macro.types[type.f](attrs,content,handle))}else if(value){var el={t:7,e:"input",m:[value]};if(disabled){el.m.push(disabled)}if(findDeep(content,"option")){el.e="select";el.f=content}if(type){el.m.push(type);if(type.f==="checkbox"||type.f==="radio"){var target=attrs.find(function(a){return a.n==="target"});if(target){el.m.push(Object.assign({},target,{n:"name"}))}else{el.m.splice(el.m.indexOf(value),1,Object.assign({},value,{n:"checked"}))}}}el.m=el.m.concat(attrs.filter(function(a){return a.t===73||a.t===73||a.n==="placeholder"}));body.push(el);var btns=content.filter(function(e){return e.e==="button"||findDeep(e.f,"button")});if(btns.length){body.push.apply(body,btns);body=[{t:7,e:"span",m:[{t:13,n:"class",f:"field-wrapper with-buttons",g:1}],f:body}]}}else{var els=content.filter(function(e){return e.e});if(els.find(function(e){return e.e==="button"})&&els.length>1){body=[{t:7,e:"span",m:[{t:13,n:"class",f:"field-wrapper with-buttons",g:1}],f:content}]}else{body.push.apply(body,content)}}var label=attrs.find(function(a){return a.n==="label"});if(tip){body.unshift({t:7,e:"span",m:[{t:13,n:"class",f:"field-tip"+(!label?" field-solo-tip":""),g:1},{t:13,n:"title",f:tip.f},{t:70,n:["click"],f:{r:[],s:"[false]"}}],f:"?"})}var inline=attrs.find(function(a){return a.n==="inline"});if(label&&!inline){body.unshift.apply(body,Array.isArray(label.f)?label.f:[label.f])}else if(!inline){body.unshift(" ")}var outer={t:7,e:"label",m:[{t:71,n:"field"}].concat(attrs.filter(function(a){return a.t!==13&&a.t!==73||a.n!=="value"&&a.n!=="type"&&a.n!=="inline"&&a.n!=="label"&&a.n!=="placeholder"&&a.n!=="target"&&a.n!=="disabled"})),f:body};if(inline){outer.m.push({t:13,n:"class",f:"inline"})}handle.setTemplate([outer])});macro.types={};export function autofocus(node){if(typeof node.focus==="function"){node.focus()}return{teardown:noop}}export function plugin(opts){if(opts===void 0)opts={};return function(ref){var Ractive=ref.Ractive;var instance=ref.instance;if(!Ractive.isInstance(instance)){if(opts.includeStyle){if(instance===Ractive){Ractive.addCSS("form-decorator",style)}else{var css=instance.css;instance.css=function(data){var res=typeof css!=="function"?css||"":css(data);return res+style(data)}}}}instance.partials[opts.name||"field"]=macro;instance.decorators[opts.name||"field"]=field;instance.decorators[opts.autofocusName||"autofocus"]=autofocus}}globalRegister("field","decorators",field);globalRegister("field","partials",macro);globalRegister("autofocus","decorators",autofocus);export default plugin;
import globalRegister from"./globalRegister";import Ractive from"ractive";export function style(data){var primary=Object.assign({},data("raui.primary"),data("raui.form.primary"));var active=Object.assign({},data("raui.primary.active"),data("raui.form.primary.active"));var disabled=Object.assign({},data("raui.primary.disabled"),data("raui.form.primary.disabled"));var boxy=data("raui.form.boxy");return"\n label.field, .field-manual {\n display: inline-block;\n font-size: 0.9em;\n font-weight: 500;\n color: "+(primary.fg||"#222")+";\n transition: 0.2s ease-in-out;\n transition-property: color;\n vertical-align: top;\n box-sizing: border-box;\n padding: 0.25em 0.5em;\n line-height: 1.5em;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-family: inherit;\n }\n\n label.field.textarea {\n display: block;\n border: 0.0625em solid "+(primary.bc||"#ccc")+";\n padding: 0.5em 0.8em 0.8em 0.8em;\n border-radius: "+(primary.radius||"0.2em")+";\n box-shadow: none;\n transition-property: color, border-color, box-shadow;\n margin: 0.8em 0.2em;\n min-height: auto;\n background-color: "+(boxy?primary.bg||"#fff":"transparent")+";\n }\n\n label.field.focus {\n color: "+(active.fg||primary.fga||"#07e")+";\n }\n\n label.field.textarea.focus {\n border-color: "+(active.fg||primary.fga||"#07e")+";\n "+(!boxy?"box-shadow: 0.0625em 0.0625em "+(active.fg||primary.fga||"#07e")+",\n -0.0625em 0.0625em "+(active.fg||primary.fga||"#07e")+",\n 0.0625em -0.0625em "+(active.fg||primary.fga||"#07e")+",\n -0.0625em -0.0625em "+(active.fg||primary.fga||"#07e")+";":"")+"\n }\n\n label.field input,\n label.field select,\n label.field textarea,\n .field-manual .field-body\n {\n display: block;\n border-width: "+(boxy?"0.0625em":"0 0 0.0625em 0")+";\n border-color: "+(primary.bc||"#ccc")+";\n border-style: solid;\n box-sizing: border-box;\n background-color: "+(boxy?primary.bg||"#fff":"transparent")+";\n transition: 0.2s ease-in-out;\n transition-property: box-shadow, color;\n outline: none;\n box-shadow: none;\n width: 100%;\n margin-bottom: 0.8em;\n font-size: 1.1em;"+(boxy?"\n border-radius: "+(primary.radius||"0.2em")+";":"")+"\n font-weight: 400;\n font-family: inherit;\n }\n\n label.field input"+(boxy?"":":disabled")+",\n label.field select"+(boxy?"":":disabled")+" {\n padding: 0 0.75em;\n }\n label.field select"+(boxy?"":":disabled")+" {\n padding-right: 2em;\n }\n\n label.field input:disabled,\n label.field input[readonly],\n label.field select:disabled,\n label.field textarea:disabled,\n label.field textarea[readonly] {\n background: "+(disabled.bg||"#f4f4f4")+";\n color: "+(disabled.fg||"#444")+";\n }\n\n label.field textarea {\n line-height: 1.2em;\n }\n label.field .field-wrapper {\n display: block;\n }\n label.field > select, label.field > input,\n label.field > .field-wrapper > input, label.field > .field-wrapper > select {\n height: 2.5em;\n }\n\n "+(!boxy?"label.field:hover > input,\n label.field:hover select,\n label.field.file:hover:after {\n box-shadow: 0 0.0625em 0 0 "+(primary.bc||"#ccc")+";\n }\n\n label.field.textarea:hover {\n box-shadow: 0.0625em 0.0625em "+(primary.bc||"#ccc")+",\n -0.0625em 0.0625em "+(primary.bc||"#ccc")+",\n 0.0625em -0.0625em "+(primary.bc||"#ccc")+",\n -0.0625em -0.0625em "+(primary.bc||"#ccc")+";\n }\n\n label.field.textarea.focus:hover {\n box-shadow: 0.0625em 0.0625em "+(active.fg||primary.fga||"#07e")+",\n -0.0625em 0.0625em "+(active.fg||primary.fga||"#07e")+",\n 0.0625em -0.0625em "+(active.fg||primary.fga||"#07e")+",\n -0.0625em -0.0625em "+(active.fg||primary.fga||"#07e")+";\n }":"")+"\n\n /**** CHECK BOXES ****/\n\n label.field.check, label.field.radio {\n position:relative;\n z-index: 0;\n overflow: visible;\n cursor: pointer;\n padding-top: 2.2em;\n white-space: normal;\n }\n label.field.check.inline, label.field.radio.inline {\n padding-top: 0.7em;\n }\n\n label.field.check input, label.field.radio input {\n appearance: none;\n -moz-appearance: none;\n -webkit-appearance: none;\n z-index: -1;\n position: absolute;\n left: -0.5em;\n top: 1em;\n display: block;\n margin: 0;\n border-radius: 50%;\n width: 3.2em;\n height: 3.2em;\n background-color: "+(primary.bc||"#ccc")+";\n box-shadow: none;\n outline: none;\n opacity: 0;\n transform: scale(1);\n pointer-events: none;\n transition: opacity 0.3s, transform 0.2s;\n }\n label.field.inline.check input, label.field.inline.radio input {\n top: -0.45em;\n left: -0.55em;\n }\n\n label.field.check input:checked, label.field.radio input:checked {\n background-color: "+(primary.fga||"#07e")+";\n }\n\n label.field.check:hover > input, label.field.radio:hover > input {\n opacity: 0.04;\n }\n\n label.field.check input:focus, label.field.radio input:focus {\n opacity: 0.12;\n }\n\n label.field.check:hover > input:focus, label.field.radio:hover > input:focus {\n opacity: 0.16;\n }\n\n label.field.check input:active, label.field.radio input:active {\n opacity: 0.6;\n transform: scale(0);\n transition: transform 0s, opacity 0s;\n }\n\n label.field.check:before, label.field.radio:before {\n content: '';\n display: inline-block;\n box-sizing: border-box;\n margin: 0 0.5em 0.2em 0.1em;\n border: solid 0.125em; /* Safari */\n border-color: "+(primary.fg||"#222")+';\n border-radius: 0.125em;\n width: 1.2em;\n height: 1.2em;\n vertical-align: bottom;\n transition: border-color 0.2s, background-color 0.2s;\n }\n\n label.field.check:after, label.field.radio:after {\n content: \'\';\n display: inline-block;\n opacity: 0;\n position: absolute;\n width: 1.2em;\n height: 1.2em;\n top: 2.3em;\n left: 0.6em;\n border-radius: 0.125em;\n }\n label.field.check.inline:after, label.field.radio.inline:after {\n top: 0.8em;\n }\n\n label.field.check.checked:after {\n opacity: 1;\n background: no-repeat center/80% url(\'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="'+(primary.bg||"#fff").replace(/#/g,"%23")+'" d="m 15.378906,1.7050781 a 1.0583349,1.0583349 0 0 0 -1.478515,0.234375 L 6.6210937,11.960938 1.8652344,8.5058594 a 1.0583349,1.0583349 0 0 0 -1.47851565,0.234375 1.0583349,1.0583349 0 0 0 0.234375,1.4785156 L 6.234375,14.294922 A 1.0584408,1.0584408 0 0 0 7.7128906,14.060547 L 15.613281,3.1835938 A 1.0583349,1.0583349 0 0 0 15.378906,1.7050781 Z" /></svg>\') '+(primary.fga||"#07e")+';\n }\n\n label.field.radio.checked:after {\n opacity: 1;\n background: no-repeat center/80% url(\'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><circle fill="'+(primary.bg||"#fff").replace(/#/g,"%23")+'" cx="8" cy="8" r="5" /></svg>\') '+(primary.fga||"#07e")+";\n }\n\n label.field.check.checked:before, label.field.radio.checked:before {\n border-color: "+(primary.fga||"#07e")+";\n }\n label.field.check.focus:before, label.field.radio.focus:before {\n border-color: "+(primary.fga||"#07e")+";\n }\n\n label.field.check input:disabled, label.field.radio input:disabled {\n opacity: 0;\n }\n\n label.field.check.disabled, label.field.radio.disabled {\n color: "+(disabled.fg||"#444")+";\n cursor: initial;\n }\n\n label.field.check.disabled:before, label.field.radio.disabled:before {\n border-color: "+(disabled.bc||"#ccc")+";\n background-color: "+(disabled.bg||"#f4f4f4")+";\n }\n\n label.field.check.checked.disabled:after, label.field.radio.checked.disabled:after {\n border-color: transparent;\n background-color: "+(disabled.bc||"#ccc")+";\n }\n\n label.field select {\n padding-right: 2em;\n }\n\n label.field.select {\n cursor: pointer;\n position: relative;\n }\n\n label.field.select:after {\n content: ' ';\n position: absolute;\n display: block;\n width: 0.6em;\n right: 1.125em;\n height: 0.6em;\n top: 2.6em;\n border-bottom: 0.125em solid;\n border-right: 0.125em solid;\n transform: rotate(45deg);\n pointer-events: none;\n color: "+(primary.bc||"#ccc")+";\n }\n\n label.field textarea {\n border: none;"+(boxy?"\n padding: 0;":"")+"\n }\n\n label.field > select {\n -moz-appearance: none;\n -webkit-appearance: none;\n }\n\n label.field input:focus,\n label.field select:focus,\n label.field.file.focus:after\n {\n border-color: "+(active.fg||primary.fga||"#07e")+";\n "+(!boxy?"box-shadow: 0 0.0625em 0 0 "+(active.fg||primary.fga||"#07e")+";":"")+"\n }\n\n label.field input[type=checkbox]:focus,\n label.field input[type=radio]:focus {\n box-shadow: none;\n }\n\n label.field.file.focus:after {\n color: "+(active.fg||primary.fga||"#07e")+";\n }\n label.field.file [type=file] {\n position: absolute;\n width: 0;\n height: 0;\n opacity: 0;\n z-index: -1;\n }\n label.field.file {\n position: relative;\n min-width: 9em;\n height: 5em;\n }\n label.field.file:after {\n position: absolute;\n content: 'Choose a file';\n box-sizing: border-box;\n width: calc(100% - 0.3em);\n height: 2.5em;\n font-size: 1.1em;\n line-height: 1.5em;\n color: "+(primary.fg||"#222")+";\n text-align: "+(boxy?"center":"left")+";\n padding: 0.5em "+(boxy?"0.5em":"0")+";\n cursor: pointer;\n font-style: oblique;\n left: 0.25em;\n top: 1.6em;\n transition: 0.2s ease-in-out;\n transition-property: color, border-bolor, box-shadow;"+(boxy?"\n border-radius: "+(primary.radius||"0.2em")+";\n border-color: "+(primary.bc||"#ccc")+";\n border-style: solid;\n border-width: 0.0625em;":"\n border-bottom-color: "+(primary.bc||"#ccc")+";\n border-bottom-width: 0.0625em;\n border-bottom-style: solid;\n ")+"\n }\n label.field.file.inline:after {\n top: 0.2em;\n }\n\n label.field.button {\n vertical-align: top;\n padding-top: "+(boxy?"1.7":"1.958")+"em;\n }\n label.field .with-buttons button, label.field.button button {\n font-size: 1.1em;\n margin-top: "+(boxy?"0.15em":"0")+";\n }\n\n label.field .field-wrapper.with-buttons {\n display: flex;\n }\n label.field .with-buttons button {\n flex-shrink: 0;\n padding-left: 0.5em;\n padding-right: 0.5em;\n margin-top: 0;\n margin-right: 0;\n "+(boxy?"height: 2.5em;\n box-shadow: none;\n border-radius: 0;\n border-left: 1px solid "+(primary.bg||"#fff")+";\n margin-left: 0;":"height: 2.25em;")+"\n }"+(boxy?"\n label.field .with-buttons button:first-of-type {\n margin-left: -0.05em;\n border-left: none;\n }\n label.field .with-buttons button:last-of-type {\n border-radius: 0 "+(primary.radius||"0.2em")+" "+(primary.radius||"0.2em")+" 0;\n }\n label.field .with-buttons input {\n border-radius: "+(primary.radius||"0.2em")+" 0 0 "+(primary.radius||"0.2em")+";\n min-width: 0;\n }\n ":"")+"\n\n label.field.plain > div {\n position: absolute;\n font-size: 1.1em;\n top: 2.4em;\n font-weight: normal;\n }\n\n /* inline fields (no labels) */\n label.field.inline {\n min-height: 3.3em;\n }\n\n label.field.button.inline {\n margin-top: 0.2em;\n padding-top: 0.12em;\n }\n\n label.field.button.inline button {\n margin-top: 0;\n }\n\n label.field.inline.select:after {\n top: 1."+(boxy?"15":"1")+"em;\n }\n\n label.field .field-tip {\n display: inline-block;\n width: 1em;\n height: 1em;\n background-color: "+(primary.fga||"#07e")+";\n color: "+(primary.bg||"#fff;")+";\n cursor: default;\n user-select: none;\n border-radius: 1em;\n margin-left: 0.5em;\n line-height: 1.2em;\n text-align: center;\n margin-top: -0.2em;\n }\n\n label.field .field-solo-tip {\n margin-left: -0.1em;\n }\n "}function noop(){}function focused(ev){if(!~this.className.indexOf("focus")){this.className+=" focus"}}function blurred(ev){this.className=this.className.replace(/\bfocus\b/g,"").trim()}export function field(node){var ctx=this.getContext(node);var isField,isCheck,isRadio,isArea,isSelect,isFile,isButton,isPlain,isInput;var change,attrs,desc,last;function invalidate(){var val=setup().split(/\s+/).filter(function(c){return!!c});isField=!!~val.indexOf("field");if(!isField){val.push("field");isField=true}isCheck=node.querySelector("input[type=checkbox]");if(isCheck&&!~val.indexOf("check")){val.push("check")}isRadio=node.querySelector("input[type=radio]");if(isRadio&&!~val.indexOf("radio")){val.push("radio")}var checkable=isCheck||isRadio;if(checkable&&checkable.checked&&!~val.indexOf("checked")){val.push("checked")}if(checkable&&checkable.disabled&&!~val.indexOf("disabled")){val.push("disabled")}if(!checkable&&change){change.cancel();change=0;if(attrs){attrs.disconnect();attrs=0}delete checkable._form_callback;if(last){delete last.checked;desc=last=undefined}}else if(checkable){checkable._form_callback=function(ev,init){if(init===void 0)init=true;if(init&&checkable.type==="radio"&&checkable.name){var list=[];list.push.apply(list,document.querySelectorAll("input[type=radio][name="+checkable.name+"]"));list=list.filter(function(i){return i!==checkable});list.forEach(function(l){return l._form_callback&&l._form_callback(ev,false)})}var checked=checkable.checked;if(checked&&!~node.className.indexOf("checked")){node.className+=" checked"}else if(!checked&&~node.className.indexOf("checked")){node.className=node.className.replace(/\bchecked\b/g,"").replace(/ +/g," ").trim()}};if(MutationObserver){attrs=new MutationObserver(function(){var val;val=checkable.disabled;if(val&&!~node.className.indexOf("disabled")){node.className+=" disabled"}else if(!val&&~node.className.indexOf("disabled")){node.className=node.className.replace(/\bdisabled\b/g,"").replace(/ +/g," ").trim()}});attrs.observe(checkable,{attributes:true})}change=this.getContext(checkable).listen("change",checkable._form_callback);desc=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(checkable),"checked");if(desc&&desc.configurable){last=checkable;Object.defineProperty(checkable,"checked",{get:desc.get,set:function set(v){desc.set.call(last,v);checkable._form_callback()},enumerable:true,configurable:true})}}isArea=!!node.querySelector("textarea");if(isArea&&!~val.indexOf("textarea")){val.push("textarea")}isSelect=!!node.querySelector("select");if(isSelect&&!~val.indexOf("select")){val.push("select")}isFile=!!node.querySelector("input[type=file]");if(isFile&&!~val.indexOf("file")){val.push("file")}isButton=node.querySelector("button");isButton=!!isButton&&isButton.parentNode===node;if(isButton&&!~val.indexOf("button")){val.push("button")}isPlain=!!node.querySelector("div");if(isPlain&&!~val.indexOf("plain")){val.push("plain")}isInput=!isCheck&&!isRadio&&!isFile&&!!node.querySelector("input");if(isInput&&!~val.indexOf("input")){val.push("input")}node.className=val.join(" ")}function setup(){var cls=node.className;if(!isField){cls=cls.replace(/\bfield\b/g,"").trim()}if(!isCheck){cls=cls.replace(/\bcheck(ed)?\b/g,"").trim()}if(!isRadio){cls=cls.replace(/\bradio\b/g,"").trim()}if(!isArea){cls=cls.replace(/\btextarea\b/g,"").trim()}if(!isSelect){cls=cls.replace(/\bselect\b/g,"").trim()}if(!isFile){cls=cls.replace(/\bfile\b/g,"").trim()}if(!isButton){cls=cls.replace(/\bbutton\b/g,"").trim()}if(!isPlain){cls=cls.replace(/\bplain\b/g,"").trim()}if(!isInput){cls=cls.replace(/\binput\b/g,"").trim()}cls=cls.replace(/ +/g," ");return cls}var focus=ctx.listen("focusin",focused);var blur=ctx.listen("focusout",blurred);invalidate.call(this);var res={update:noop,invalidate:invalidate.bind(this),teardown:function teardown(){ctx.ractive.fire("fieldUnregistered",ctx,node,res);var cls=setup();cls=cls.replace(/\bfocus\b/g,"").trim();focus.cancel();blur.cancel();change&&change.cancel();if(attrs){attrs.disconnect()}if(last){delete last.checked;desc=last=undefined}node.className=cls},setDisabled:function setDisabled(v){var children=node.querySelectorAll("input,button,select,textarea");children.forEach(function(c){return c.disabled=v});this.invalidate()}};ctx.ractive.fire("fieldRegistered",ctx,node,res);return res}field.style=style;function findDeep(els,el){if(!els){return false}for(var i=0;i<els.length;i++){if(els[i].e===el){return true}if(els[i].f&&findDeep(els[i].f,el)){return true}}return false}export var macro=Ractive.macro(function(handle){var body=[];var label=[];var attrs=(handle.template.m||[]).slice();var content=handle.template.f||[];var value=attrs.find(function(a){return a.n==="value"});var type=attrs.find(function(a){return a.n==="type"});var tip=attrs.find(function(a){return a.n==="tip"});var disabled=attrs.find(function(a){return a.n==="disabled"});if(tip){attrs.splice(attrs.indexOf(tip),1)}if(type&&typeof macro.types[type.f]==="function"){body.push.apply(body,macro.types[type.f](attrs,content,handle))}else if(value){var el={t:7,e:"input",m:[value]};if(disabled){el.m.push(disabled)}if(findDeep(content,"option")){el.e="select";el.f=content}if(type){el.m.push(type);if(type.f==="checkbox"||type.f==="radio"){var target=attrs.find(function(a){return a.n==="target"});if(target){el.m.push(Object.assign({},target,{n:"name"}))}else{el.m.splice(el.m.indexOf(value),1,Object.assign({},value,{n:"checked"}))}}}el.m=el.m.concat(attrs.filter(function(a){return a.t===73||a.t===73||a.n==="placeholder"}));body.push(el);var btns=content.filter(function(e){return e.e==="button"||findDeep(e.f,"button")});if(btns.length){body.push.apply(body,btns);body=[{t:7,e:"span",m:[{t:13,n:"class",f:"field-wrapper with-buttons",g:1}],f:body}]}}else{content.forEach(function(e){if(e.e==="label"){if(e.f&&e.f.length){label.push.apply(label,e.f)}}else{body.push(e)}});var els=content.filter(function(e){return e.e});if(els.find(function(e){return e.e==="button"})&&els.length>1){body=[{t:7,e:"span",m:[{t:13,n:"class",f:"field-wrapper with-buttons",g:1}],f:body}]}}var labelattr=attrs.find(function(a){return a.n==="label"});if(labelattr&&labelattr.f&&labelattr.f.length){label.push.apply(label,Array.isArray(labelattr.f)?labelattr.f:[labelattr.f])}if(tip){body.unshift({t:7,e:"span",m:[{t:13,n:"class",f:"field-tip"+(!label.length?" field-solo-tip":""),g:1},{t:13,n:"title",f:tip.f},{t:70,n:["click"],f:{r:[],s:"[false]"}}],f:"?"})}var inline=attrs.find(function(a){return a.n==="inline"});if(label&&!inline){body.unshift.apply(body,label)}else if(!inline){body.unshift(" ")}var outer={t:7,e:"label",m:[{t:71,n:"field"}].concat(attrs.filter(function(a){return a.t!==13&&a.t!==73||a.n!=="value"&&a.n!=="type"&&a.n!=="inline"&&a.n!=="label"&&a.n!=="placeholder"&&a.n!=="target"&&a.n!=="disabled"})),f:body};if(inline){outer.m.push({t:13,n:"class",f:"inline"})}handle.setTemplate([outer])});macro.types={};export function autofocus(node){if(typeof node.focus==="function"){node.focus()}return{teardown:noop}}export function plugin(opts){if(opts===void 0)opts={};return function(ref){var Ractive=ref.Ractive;var instance=ref.instance;if(!Ractive.isInstance(instance)){if(opts.includeStyle){if(instance===Ractive){Ractive.addCSS("form-decorator",style)}else{var css=instance.css;instance.css=function(data){var res=typeof css!=="function"?css||"":css(data);return res+style(data)}}}}instance.partials[opts.name||"field"]=macro;instance.decorators[opts.name||"field"]=field;instance.decorators[opts.autofocusName||"autofocus"]=autofocus}}globalRegister("field","decorators",field);globalRegister("field","partials",macro);globalRegister("autofocus","decorators",autofocus);export default plugin;

@@ -187,2 +187,12 @@ import Ractive from 'ractive';

Popover.prototype.popFind = function popFind (pattern) {
if (mobilePopped) { return mobilePop.find(pattern); }
else { return this.find(pattenr); }
};
Popover.prototype.popFindAll = function popFindAll (pattern) {
if (mobilePopped) { return mobilePop.findAll(pattern); }
else { return this.findAll(pattenr); }
};
return Popover;

@@ -189,0 +199,0 @@ }(Ractive));

@@ -1,1 +0,1 @@

import Ractive from"ractive";import pop from"./transition-pop";import clickout from"./event-clickout";import fade from"./transition-fade";var template={v:4,t:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rpop-wrapper",g:1},{n:"class-rpop-with-tail",t:13,f:[{t:2,r:"position.tail"}]},{n:"class",f:["rpop-",{t:2,x:{r:["where"],s:'_0||"below"'}}," rpop-align-",{t:2,x:{r:["align"],s:'_0||"middle"'}}],t:13},{t:4,f:[{n:"style-top",f:[{t:2,r:"position.popTop"},"px"],t:13},{n:"style-left",f:[{t:2,r:"position.popLeft"},"px"],t:13}],n:50,r:"position"},{t:4,f:[{t:4,f:[{n:"style-top",f:[{t:2,r:"top"}],t:13}],n:50,r:"top"},{t:4,f:[{n:"style-left",f:[{t:2,r:"left"}],t:13}],n:50,r:"left"}],n:51,l:1},{n:"pop",t:72,f:{r:["where"],s:'[{dir:_0||"below"}]'},v:"t2"},{n:"cleanup",t:71},{t:4,f:[{n:["click"],t:70,f:{r:["@this"],s:'[_0.set("popped",false)]'}}],n:50,r:"clickClose"},{t:4,f:[{n:["clickout"],t:70,f:{r:["@this"],s:'[_0.set("popped",false)]'}}],n:51,r:"noClickout"},{t:16,r:"extra-attributes"}],f:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rpop-tail",g:1},{t:4,f:[{n:"style-top",f:[{t:2,x:{r:["position.tailTop","position.vert"],s:"_0+(_1?3:0)"}},"px"],t:13}],n:50,x:{r:["position.tailTop"],s:"_0!=null"}},{t:4,f:[{n:"style-bottom",f:[{t:2,x:{r:["position.tailBottom","position.vert"],s:"_0+(_1?3:0)"}},"px"],t:13}],n:50,x:{r:["position.tailBottom"],s:"_0!=null"}},{t:4,f:[{n:"style-left",f:[{t:2,x:{r:["position.tailLeft","position.vert"],s:"_0+(_1?0:3)"}},"px"],t:13}],n:50,x:{r:["position.tailLeft"],s:"_0!=null"}},{t:4,f:[{n:"style-right",f:[{t:2,x:{r:["position.tailRight","position.vert"],s:"_0+(_1?0:3)"}},"px"],t:13}],n:50,x:{r:["position.tailRight"],s:"_0!=null"}}]}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rpop-tail-outer",g:1},{t:4,f:[{n:"style-top",f:[{t:2,x:{r:["position.tailTop"],s:"_0-2"}},"px"],t:13}],n:50,x:{r:["position.tailTop"],s:"_0!=null"}},{t:4,f:[{n:"style-bottom",f:[{t:2,x:{r:["position.tailBottom"],s:"_0-2"}},"px"],t:13}],n:50,x:{r:["position.tailBottom"],s:"_0!=null"}},{t:4,f:[{n:"style-left",f:[{t:2,x:{r:["position.tailLeft"],s:"_0-2"}},"px"],t:13}],n:50,x:{r:["position.tailLeft"],s:"_0!=null"}},{t:4,f:[{n:"style-right",f:[{t:2,x:{r:["position.tailRight"],s:"_0-2"}},"px"],t:13}],n:50,x:{r:["position.tailRight"],s:"_0!=null"}}]}],n:50,r:"~/tail"}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rpop",g:1}],f:[{t:16,r:"content",z:[{n:"trigger",x:{r:"triggerContext"}}]}]}]}],n:50,r:"__popped"}],e:{'_0||"below"':function(_0){return _0||"below"},'_0||"middle"':function(_0){return _0||"middle"},'[{dir:_0||"below"}]':function(_0){return[{dir:_0||"below"}]},'[_0.set("popped",false)]':function(_0){return[_0.set("popped",false)]},"_0+(_1?3:0)":function(_0,_1){return _0+(_1?3:0)},"_0!=null":function(_0){return _0!=null},"_0+(_1?0:3)":function(_0,_1){return _0+(_1?0:3)},"_0-2":function(_0){return _0-2},"[{delay:200}]":function(){return[{delay:200}]},"[_0===_1&&_2.done(),true]":function(_0,_1,_2){return[_0===_1&&_2.done(),true]},"[_0.done()]":function(_0){return[_0.done()]},true:function(){return true}},p:{modal:[{t:4,f:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rpop-modal",g:1},{n:"fade",t:72,v:"t1"},{n:"fade",t:72,f:{r:[],s:"[{delay:200}]"},v:"t2"},{t:4,f:[{n:["click"],t:70,f:{r:["@node","@event.target","."],s:"[_0===_1&&_2.done(),true]"}}],n:51,r:".noClickout"}],f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rpop",g:1},{n:"pop",t:72,f:{r:[],s:"[{delay:200}]"},v:"t1"},{n:"pop",t:72,v:"t2"},{t:4,f:[{n:["click"],t:70,f:{r:["."],s:"[_0.done()]"}}],n:50,r:".clickClose"},{t:8,r:".attrs",c:{r:".context"},z:[{n:"inModal",x:{x:{r:[],s:"true"}}}]}],f:[{t:8,r:".content",c:{r:".context"},z:[{n:"inModal",x:{x:{r:[],s:"true"}}}]}]}]}],n:54,r:"contents.0"}],n:50,r:"contents.length"}]}};function noop(){}var source,tailSource,mobilePopped,mobilePop;export var Popover=function(Ractive){function Popover(opts){Ractive.call(this,opts)}if(Ractive)Popover.__proto__=Ractive;Popover.prototype=Object.create(Ractive&&Ractive.prototype);Popover.prototype.constructor=Popover;Popover.prototype.position=function position(node){var source=node||this.source;var popped=this.get("popped");if(!source||!popped){return}var wrapper=this.find("div");if(source&&wrapper&&wrapper.offsetParent){if(source){this.set("triggerContext",Ractive.getContext(source))}else{this.set("triggerContext",null)}var parent=wrapper.offsetParent;var offset=parent.getBoundingClientRect();var local=wrapper.getBoundingClientRect();var target=source.getBoundingClientRect();var where=this.get("where")||"below";var align=this.get("align")||"middle";var tail=this.get("tail");var vert=where==="above"||where==="below";var fit=this.get("fit");var gap=this.get("gap");var offx=where==="above"||where==="below"?0:where==="left"?-local.width-gap:target.width+gap;var offy=where==="left"||where==="right"?-target.height:where==="above"?-target.height-local.height-gap:gap;if(align==="middle"){if(where==="below"||where==="above"){offx-=(local.width-target.width)/2}else if(where==="left"||where==="right"){offy-=(local.height-target.height)/2}}else if(align==="end"){if(where==="below"||where==="above"){offx+=target.width-local.width}else if(where==="left"||where==="right"){offy+=target.height-local.height}}var pos={popTop:target.bottom-offset.top+offy,popLeft:target.left-offset.left+offx,tail:tail,vert:where==="above"||where==="below"};if(parent.scrollTop){pos.popTop+=parent.scrollTop}if(parent.scrollLeft){pos.popLeft+=parent.scrollLeft}if(tail){if(where==="above"){pos.tailBottom=-10}else if(where==="below"){pos.tailTop=-10}else if(where==="left"){pos.tailRight=-10}else if(where==="right"){pos.tailLeft=-10}var tailTarget=this.tailSource?this.tailSource.getBoundingClientRect():target;if(align==="start"){if(vert){pos.tailLeft=Math.floor(tailTarget.width/2)-10}else{pos.tailTop=Math.floor(tailTarget.height/2)-10}}else if(align==="end"){if(vert){pos.tailRight=Math.floor(tailTarget.width/2)-10}else{pos.tailBottom=Math.floor(tailTarget.height/2)-10}}else if(align==="middle"){if(vert){pos.tailLeft=Math.floor(tailTarget.width/2)-10}else{pos.tailTop=Math.floor(tailTarget.height/2)-10}}if(tailTarget!==target){if(vert){if(pos.tailLeft!=null){pos.tailLeft+=tailTarget.left-target.left}if(pos.tailRight!=null){pos.tailRight+=target.right-tailTarget.right}}else{if(pos.tailTop!=null){pos.tailTop+=tailTarget.top-target.top}if(pos.tailBottom!=null){pos.tailBottom+=target.bottom-tailTarget.bottom}}}else if(align==="middle"){if(vert){if(pos.tailLeft!=null){pos.tailLeft+=tailTarget.left-(pos.popLeft+offset.left)}if(pos.tailRight!=null){pos.tailRight+=pos.popLeft+offset.left+local.width-tailTarget.right}}else{if(pos.tailTop!=null){pos.tailTop+=tailTarget.top-(pos.popTop+offset.top)}if(pos.tailBottom!=null){pos.tailBottom+=pos.popTop+offset.top+local.height-tailTarget.bottom}}}}if(fit){var el=parent;if(this.get("offsets")){var i=this.get("offsets");while(i--){el=el.offsetParent}}var owidth=parent.scrollWidth;var oheight=parent.scrollHeight;if(pos.popLeft+local.width>owidth){var diff=pos.popLeft-(owidth-local.width);pos.popLeft-=diff;if(vert&&pos.tailLeft){pos.tailLeft+=diff}if(vert&&pos.tailRight){pos.tailRight-=diff}if(tail&&!vert){pos.tail=false}}if(pos.popLeft<0){var diff$1=-1*pos.popLeft;pos.popLeft+=diff$1;if(vert&&pos.tailLeft){pos.tailLeft-=diff$1}if(vert&&pos.tailRight){pos.tailRight+=diff$1}if(tail&&!vert){pos.tail=false}}if(pos.popTop+local.height>oheight){var diff$2=pos.popTop-(oheight-local.height);pos.popTop-=diff$2;if(!vert&&pos.tailTop){pos.tailTop+=diff$2}if(!vert&&pos.tailBottom){pos.tailBottom-=diff$2}if(tail&&vert){pos.tail=false}}if(pos.popTop<0){var diff$3=-1*pos.popTop;pos.popTop+=diff$3;if(!vert&&pos.tailTop){pos.tailTop-=diff$3}if(!vert&&pos.tailBottom){pos.tailBottom+=diff$3}if(tail&&vert){pos.tail=false}}}if(offset.left+pos.popLeft<0){var diff$4=0-(offset.left+pos.popLeft);pos.popLeft+=diff$4;if(vert&&pos.tailLeft){pos.tailLeft-=diff$4}if(vert&&pos.tailRight){pos.tailRight+=diff$4}if(tail&&!vert){pos.tail=false}}if(offset.top+pos.popTop<0){var diff$5=0-(offset.top+pos.popTop);pos.popTop+=diff$5;if(!vert&&pos.tailTop){pos.tailTop-=diff$5}if(!vert&&pos.tailBottom){pos.tailBottom+=diff$5}if(tail&&vert){pos.tail=false}}if(pos.tailLeft){pos.tailLeft=Math.floor(pos.tailLeft)}if(pos.tailRight){pos.tailRight=Math.floor(pos.tailRight)}if(pos.tailTop){pos.tailTop=Math.floor(pos.tailTop)}if(pos.tailBottom){pos.tailBottom=Math.floor(pos.tailBottom)}this.set("position",pos)}else{this.set("position",null)}};Popover.prototype.show=function show(node){this.source=node;this.set("popped",true);return this._transdone};Popover.prototype.hide=function hide(){this.set("popped",false);return this._transdone};return Popover}(Ractive);Ractive.extendWith(Popover,{attributes:["popped","tail","where","align","top","left","fit","clickClose","noClickout","gap","offsets"],use:[pop(),clickout(),fade()],template:template,css:function(data){return[function(data){var primary=Object.assign({},data("raui.primary"),data("raui.pop.primary"));var themes=(data("raui.themes")||[]).slice();(data("raui.pop.themes")||[]).forEach(function(t){if(!~themes.indexOf(t)){themes.push(t)}});return"\n .rpop-wrapper {\n position: absolute;\n display: inline-block;\n z-index: 21;\n transition-property: top, left, padding;\n transition-timing-function: ease-in-out;\n transition-duration: 0.3s;\n }\n .rpop-with-tail.rpop-above {\n padding-bottom: 10px;\n }\n .rpop-with-tail.rpop-below {\n padding-top: 10px;\n }\n .rpop-with-tail.rpop-left {\n padding-right: 10px;\n }\n .rpop-with-tail.rpop-right {\n padding-left: 10px;\n }\n \n .rpop {\n position: relative;\n box-shadow: 0 1px 4px 0 rgba(0,0,0,0.24);\n border: 1px solid #ccc;\n border-radius: 0.2em;\n background-color: "+(primary.bg||"#fff")+";\n color: "+(primary.fg||"#222")+";\n padding: 0.5em;\n z-index: 2;\n }\n \n .rpop-modal {\n position: fixed;\n display: flex;\n z-index: 20;\n background-color: rgba(0, 0, 0, 0.2);\n align-items: center;\n justify-content: center;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n padding: 1em;\n overflow: auto;\n }\n \n .rpop-tail, .rpop-tail-outer {\n z-index: 3;\n width: 0;\n height: 0;\n position: absolute;\n border-style: solid;\n border-width: 10px;\n border-color: transparent;\n transition-property: top, left, bottom, right, border-color;\n transition-timing-function: ease-in-out;\n transition-duration: 0.3s;\n }\n .rpop-tail-outer {\n z-index: 1;\n border-width: 12px;\n border-color: transparent;\n }\n \n .rpop-below .rpop-tail {\n border-bottom-color: "+(primary.bg||"#fff")+";\n }\n .rpop-below .rpop-tail-outer {\n border-bottom-color: "+(primary.bc||"#ccc")+";\n }\n \n .rpop-above .rpop-tail {\n border-top-color: "+(primary.bg||"#fff")+";\n }\n .rpop-above .rpop-tail-outer {\n border-top-color: "+(primary.bc||"#ccc")+";\n }\n \n .rpop-left .rpop-tail {\n border-left-color: "+(primary.bg||"#fff")+";\n }\n .rpop-left .rpop-tail-outer {\n border-left-color: "+(primary.bc||"#ccc")+";\n }\n \n .rpop-right .rpop-tail {\n border-right-color: "+(primary.bg||"#fff")+";\n }\n .rpop-right .rpop-tail-outer {\n border-right-color: "+(primary.bc||"#ccc")+";\n }\n "+themes.map(function(t){var theme=Object.assign({},data("raui.primary"),data("raui.pop.primary"),data("raui."+t),data("raui.pop."+t));return"\n ."+t+" .rpop {\n background-color: "+(theme.bg||"#fff")+";\n color: "+(theme.fg||"#222")+";\n }\n \n ."+t+".rpop-below .rpop-tail {\n border-bottom-color: "+(theme.bg||"#fff")+";\n }\n ."+t+".rpop-below .rpop-tail-outer {\n border-bottom-color: "+(theme.bc||"#ccc")+";\n }\n \n ."+t+".rpop-above .rpop-tail {\n border-top-color: "+(theme.bg||"#fff")+";\n }\n ."+t+".rpop-above .rpop-tail-outer {\n border-top-color: "+(theme.bc||"#ccc")+";\n }\n \n ."+t+".rpop-left .rpop-tail {\n border-left-color: "+(theme.bg||"#fff")+";\n }\n ."+t+".rpop-left .rpop-tail-outer {\n border-left-color: "+(theme.bc||"#ccc")+";\n }\n \n ."+t+".rpop-right .rpop-tail {\n border-right-color: "+(theme.bg||"#fff")+";\n }\n ."+t+".rpop-right .rpop-tail-outer {\n border-right-color: "+(theme.bc||"#ccc")+";\n }\n "})}.call(this,data)].join(" ")},cssId:"rpop",noCssTransform:true,observe:{popped:function popped(v){var this$1=this;if(v){if(source){this.source=source}if(tailSource){this.tailSource=tailSource}}var ok;var done=this._transdone=new Promise(function(o){return ok=o});done.resolve=ok;setTimeout(function(){this$1._transdone=done;if(this$1.get("popped")===v){this$1.set("_popped",v)}},1)},_popped:{handler:function handler(v){var this$1=this;var done=this._transdone.resolve;if(v){var mobile=this.get("@style.raui.pop.mobile");if(mobile&&window.matchMedia("(max-width: "+mobile+")").matches){if(!mobilePop){mobilePop=new MobilePop({target:document.body,append:true})}var context=this.getContext().getParent(true);context.isContext=1;this.set("__popped",false).then(done);mobilePop.unshift("contents",{content:this.partials.content,context:context,attrs:this.partials["extra-attributes"]||[],clickClose:this.get("clickClose"),noClickout:this.get("noClickout"),done:function(){this$1.set("popped",false)}})}else{this.set("__popped",true)}}else{if(mobilePopped){mobilePop.shift("contents");done()}else{this.set("__popped",false).then(done)}}},defer:true,init:false},__popped:{handler:function handler(v){var done=this._transdone.resolve;if(v){var el=this.find("div");var node=el;var h=node.offsetHeight+node.offsetTop;var w=node.offsetWidth+node.offsetLeft;var offset=node.offsetParent;if(!this.overflows){var o=this.overflows={e:[],v:[]};while(el&&el.style){if(el===offset){if(el.offsetWidth>=w&&el.offsetHeight>=h){break}else{w+=el.offsetLeft;h+=el.offsetTop;offset=el.offsetParent}}var css=getComputedStyle(el);if(css.overflow==="auto"){break}if(css.overflow==="hidden"){o.e.push(el);o.v.push(el.style.overflow);el.style.overflow="visible"}el=el.parentNode}}this.position();this.transition("pop",node,{intro:true,dir:this.get("where")||"below"}).then(done)}else{this.source=null;this.tailSource=null}},defer:true,init:false},"align where tail fit":{handler:function handler(){this.position()},defer:true}},decorators:{cleanup:function cleanup(node){var pop=this;return{teardown:function teardown(){var o=pop.overflows;if(o){pop.overflows=null;for(var i=0;i<o.e.length;i++){o.e[i].style.overflow=o.v[i]}}}}}},data:function data(){return{gap:4}}});export function trigger(options){if(options===void 0)options={};return function(ref){var instance=ref.instance;instance.decorators[options.name||"pop"]=function(node,path,opts){if(opts===void 0)opts={};if(!path){return{teardown:noop}}if(typeof path==="string"){opts.path=path}else if(typeof path==="object"){opts=path}var ctx=this.getContext(node);var clicked,hover;function listener(ev){if(ev.type==="mouseover"&&ctx.get(path)){return}if(ev.type!=="click"||!hover||clicked){var init=source;var initTail=tailSource;source=opts.node||node;if(typeof source==="function"){source=source()}source=source||node;tailSource=opts.tail;if(typeof tailSource==="function"){tailSource=tailSource()}ctx.toggle(opts.path);source=init;tailSource=initTail}if(hover&&ev.type==="click"){clicked=ctx.observeOnce(opts.path,function(){clicked=null})}}function out(ev){if(!clicked){ctx.set(opts.path,false)}}if("click"in opts?opts.click:options.click!==false){ctx.listen("click",listener)}if("hover"in opts?opts.hover:options.hover){hover=1;ctx.listen("mouseover",listener);ctx.listen("mouseout",out)}return{teardown:function teardown(){ctx.unlisten("click",listener);if(hover){ctx.unlisten("mouseover",listener);ctx.unlisten("mouseout",out);if(clicked){clicked.cancel()}}}}}}}var MobilePop=function(Ractive){function MobilePop(opts){Ractive.call(this,opts)}if(Ractive)MobilePop.__proto__=Ractive;MobilePop.prototype=Object.create(Ractive&&Ractive.prototype);MobilePop.prototype.constructor=MobilePop;return MobilePop}(Ractive);Ractive.extendWith(MobilePop,{template:{v:template.v,t:template.p.modal},data:function data(){return{contents:[]}},use:[pop(),fade()],observe:{contents:function contents(v){mobilePopped=(v||[]).length>0}},on:{init:function init(){if(mobilePop){console.warn("More than one PopOver mobile host created.")}else{mobilePop=this}}}});export default function plugin(options){if(options===void 0)options={};return function(ref){var instance=ref.instance;instance.components[options.name||"pop"]=Popover;instance.components[options.mobileName||"mobile-pop"]=MobilePop;var opts=Object.assign({},options);opts.name=opts.trigger||opts.name;trigger(opts)({instance:instance})}}
import Ractive from"ractive";import pop from"./transition-pop";import clickout from"./event-clickout";import fade from"./transition-fade";var template={v:4,t:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rpop-wrapper",g:1},{n:"class-rpop-with-tail",t:13,f:[{t:2,r:"position.tail"}]},{n:"class",f:["rpop-",{t:2,x:{r:["where"],s:'_0||"below"'}}," rpop-align-",{t:2,x:{r:["align"],s:'_0||"middle"'}}],t:13},{t:4,f:[{n:"style-top",f:[{t:2,r:"position.popTop"},"px"],t:13},{n:"style-left",f:[{t:2,r:"position.popLeft"},"px"],t:13}],n:50,r:"position"},{t:4,f:[{t:4,f:[{n:"style-top",f:[{t:2,r:"top"}],t:13}],n:50,r:"top"},{t:4,f:[{n:"style-left",f:[{t:2,r:"left"}],t:13}],n:50,r:"left"}],n:51,l:1},{n:"pop",t:72,f:{r:["where"],s:'[{dir:_0||"below"}]'},v:"t2"},{n:"cleanup",t:71},{t:4,f:[{n:["click"],t:70,f:{r:["@this"],s:'[_0.set("popped",false)]'}}],n:50,r:"clickClose"},{t:4,f:[{n:["clickout"],t:70,f:{r:["@this"],s:'[_0.set("popped",false)]'}}],n:51,r:"noClickout"},{t:16,r:"extra-attributes"}],f:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rpop-tail",g:1},{t:4,f:[{n:"style-top",f:[{t:2,x:{r:["position.tailTop","position.vert"],s:"_0+(_1?3:0)"}},"px"],t:13}],n:50,x:{r:["position.tailTop"],s:"_0!=null"}},{t:4,f:[{n:"style-bottom",f:[{t:2,x:{r:["position.tailBottom","position.vert"],s:"_0+(_1?3:0)"}},"px"],t:13}],n:50,x:{r:["position.tailBottom"],s:"_0!=null"}},{t:4,f:[{n:"style-left",f:[{t:2,x:{r:["position.tailLeft","position.vert"],s:"_0+(_1?0:3)"}},"px"],t:13}],n:50,x:{r:["position.tailLeft"],s:"_0!=null"}},{t:4,f:[{n:"style-right",f:[{t:2,x:{r:["position.tailRight","position.vert"],s:"_0+(_1?0:3)"}},"px"],t:13}],n:50,x:{r:["position.tailRight"],s:"_0!=null"}}]}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rpop-tail-outer",g:1},{t:4,f:[{n:"style-top",f:[{t:2,x:{r:["position.tailTop"],s:"_0-2"}},"px"],t:13}],n:50,x:{r:["position.tailTop"],s:"_0!=null"}},{t:4,f:[{n:"style-bottom",f:[{t:2,x:{r:["position.tailBottom"],s:"_0-2"}},"px"],t:13}],n:50,x:{r:["position.tailBottom"],s:"_0!=null"}},{t:4,f:[{n:"style-left",f:[{t:2,x:{r:["position.tailLeft"],s:"_0-2"}},"px"],t:13}],n:50,x:{r:["position.tailLeft"],s:"_0!=null"}},{t:4,f:[{n:"style-right",f:[{t:2,x:{r:["position.tailRight"],s:"_0-2"}},"px"],t:13}],n:50,x:{r:["position.tailRight"],s:"_0!=null"}}]}],n:50,r:"~/tail"}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rpop",g:1}],f:[{t:16,r:"content",z:[{n:"trigger",x:{r:"triggerContext"}}]}]}]}],n:50,r:"__popped"}],e:{'_0||"below"':function(_0){return _0||"below"},'_0||"middle"':function(_0){return _0||"middle"},'[{dir:_0||"below"}]':function(_0){return[{dir:_0||"below"}]},'[_0.set("popped",false)]':function(_0){return[_0.set("popped",false)]},"_0+(_1?3:0)":function(_0,_1){return _0+(_1?3:0)},"_0!=null":function(_0){return _0!=null},"_0+(_1?0:3)":function(_0,_1){return _0+(_1?0:3)},"_0-2":function(_0){return _0-2},"[{delay:200}]":function(){return[{delay:200}]},"[_0===_1&&_2.done(),true]":function(_0,_1,_2){return[_0===_1&&_2.done(),true]},"[_0.done()]":function(_0){return[_0.done()]},true:function(){return true}},p:{modal:[{t:4,f:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rpop-modal",g:1},{n:"fade",t:72,v:"t1"},{n:"fade",t:72,f:{r:[],s:"[{delay:200}]"},v:"t2"},{t:4,f:[{n:["click"],t:70,f:{r:["@node","@event.target","."],s:"[_0===_1&&_2.done(),true]"}}],n:51,r:".noClickout"}],f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rpop",g:1},{n:"pop",t:72,f:{r:[],s:"[{delay:200}]"},v:"t1"},{n:"pop",t:72,v:"t2"},{t:4,f:[{n:["click"],t:70,f:{r:["."],s:"[_0.done()]"}}],n:50,r:".clickClose"},{t:8,r:".attrs",c:{r:".context"},z:[{n:"inModal",x:{x:{r:[],s:"true"}}}]}],f:[{t:8,r:".content",c:{r:".context"},z:[{n:"inModal",x:{x:{r:[],s:"true"}}}]}]}]}],n:54,r:"contents.0"}],n:50,r:"contents.length"}]}};function noop(){}var source,tailSource,mobilePopped,mobilePop;export var Popover=function(Ractive){function Popover(opts){Ractive.call(this,opts)}if(Ractive)Popover.__proto__=Ractive;Popover.prototype=Object.create(Ractive&&Ractive.prototype);Popover.prototype.constructor=Popover;Popover.prototype.position=function position(node){var source=node||this.source;var popped=this.get("popped");if(!source||!popped){return}var wrapper=this.find("div");if(source&&wrapper&&wrapper.offsetParent){if(source){this.set("triggerContext",Ractive.getContext(source))}else{this.set("triggerContext",null)}var parent=wrapper.offsetParent;var offset=parent.getBoundingClientRect();var local=wrapper.getBoundingClientRect();var target=source.getBoundingClientRect();var where=this.get("where")||"below";var align=this.get("align")||"middle";var tail=this.get("tail");var vert=where==="above"||where==="below";var fit=this.get("fit");var gap=this.get("gap");var offx=where==="above"||where==="below"?0:where==="left"?-local.width-gap:target.width+gap;var offy=where==="left"||where==="right"?-target.height:where==="above"?-target.height-local.height-gap:gap;if(align==="middle"){if(where==="below"||where==="above"){offx-=(local.width-target.width)/2}else if(where==="left"||where==="right"){offy-=(local.height-target.height)/2}}else if(align==="end"){if(where==="below"||where==="above"){offx+=target.width-local.width}else if(where==="left"||where==="right"){offy+=target.height-local.height}}var pos={popTop:target.bottom-offset.top+offy,popLeft:target.left-offset.left+offx,tail:tail,vert:where==="above"||where==="below"};if(parent.scrollTop){pos.popTop+=parent.scrollTop}if(parent.scrollLeft){pos.popLeft+=parent.scrollLeft}if(tail){if(where==="above"){pos.tailBottom=-10}else if(where==="below"){pos.tailTop=-10}else if(where==="left"){pos.tailRight=-10}else if(where==="right"){pos.tailLeft=-10}var tailTarget=this.tailSource?this.tailSource.getBoundingClientRect():target;if(align==="start"){if(vert){pos.tailLeft=Math.floor(tailTarget.width/2)-10}else{pos.tailTop=Math.floor(tailTarget.height/2)-10}}else if(align==="end"){if(vert){pos.tailRight=Math.floor(tailTarget.width/2)-10}else{pos.tailBottom=Math.floor(tailTarget.height/2)-10}}else if(align==="middle"){if(vert){pos.tailLeft=Math.floor(tailTarget.width/2)-10}else{pos.tailTop=Math.floor(tailTarget.height/2)-10}}if(tailTarget!==target){if(vert){if(pos.tailLeft!=null){pos.tailLeft+=tailTarget.left-target.left}if(pos.tailRight!=null){pos.tailRight+=target.right-tailTarget.right}}else{if(pos.tailTop!=null){pos.tailTop+=tailTarget.top-target.top}if(pos.tailBottom!=null){pos.tailBottom+=target.bottom-tailTarget.bottom}}}else if(align==="middle"){if(vert){if(pos.tailLeft!=null){pos.tailLeft+=tailTarget.left-(pos.popLeft+offset.left)}if(pos.tailRight!=null){pos.tailRight+=pos.popLeft+offset.left+local.width-tailTarget.right}}else{if(pos.tailTop!=null){pos.tailTop+=tailTarget.top-(pos.popTop+offset.top)}if(pos.tailBottom!=null){pos.tailBottom+=pos.popTop+offset.top+local.height-tailTarget.bottom}}}}if(fit){var el=parent;if(this.get("offsets")){var i=this.get("offsets");while(i--){el=el.offsetParent}}var owidth=parent.scrollWidth;var oheight=parent.scrollHeight;if(pos.popLeft+local.width>owidth){var diff=pos.popLeft-(owidth-local.width);pos.popLeft-=diff;if(vert&&pos.tailLeft){pos.tailLeft+=diff}if(vert&&pos.tailRight){pos.tailRight-=diff}if(tail&&!vert){pos.tail=false}}if(pos.popLeft<0){var diff$1=-1*pos.popLeft;pos.popLeft+=diff$1;if(vert&&pos.tailLeft){pos.tailLeft-=diff$1}if(vert&&pos.tailRight){pos.tailRight+=diff$1}if(tail&&!vert){pos.tail=false}}if(pos.popTop+local.height>oheight){var diff$2=pos.popTop-(oheight-local.height);pos.popTop-=diff$2;if(!vert&&pos.tailTop){pos.tailTop+=diff$2}if(!vert&&pos.tailBottom){pos.tailBottom-=diff$2}if(tail&&vert){pos.tail=false}}if(pos.popTop<0){var diff$3=-1*pos.popTop;pos.popTop+=diff$3;if(!vert&&pos.tailTop){pos.tailTop-=diff$3}if(!vert&&pos.tailBottom){pos.tailBottom+=diff$3}if(tail&&vert){pos.tail=false}}}if(offset.left+pos.popLeft<0){var diff$4=0-(offset.left+pos.popLeft);pos.popLeft+=diff$4;if(vert&&pos.tailLeft){pos.tailLeft-=diff$4}if(vert&&pos.tailRight){pos.tailRight+=diff$4}if(tail&&!vert){pos.tail=false}}if(offset.top+pos.popTop<0){var diff$5=0-(offset.top+pos.popTop);pos.popTop+=diff$5;if(!vert&&pos.tailTop){pos.tailTop-=diff$5}if(!vert&&pos.tailBottom){pos.tailBottom+=diff$5}if(tail&&vert){pos.tail=false}}if(pos.tailLeft){pos.tailLeft=Math.floor(pos.tailLeft)}if(pos.tailRight){pos.tailRight=Math.floor(pos.tailRight)}if(pos.tailTop){pos.tailTop=Math.floor(pos.tailTop)}if(pos.tailBottom){pos.tailBottom=Math.floor(pos.tailBottom)}this.set("position",pos)}else{this.set("position",null)}};Popover.prototype.show=function show(node){this.source=node;this.set("popped",true);return this._transdone};Popover.prototype.hide=function hide(){this.set("popped",false);return this._transdone};Popover.prototype.popFind=function popFind(pattern){if(mobilePopped){return mobilePop.find(pattern)}else{return this.find(pattenr)}};Popover.prototype.popFindAll=function popFindAll(pattern){if(mobilePopped){return mobilePop.findAll(pattern)}else{return this.findAll(pattenr)}};return Popover}(Ractive);Ractive.extendWith(Popover,{attributes:["popped","tail","where","align","top","left","fit","clickClose","noClickout","gap","offsets"],use:[pop(),clickout(),fade()],template:template,css:function(data){return[function(data){var primary=Object.assign({},data("raui.primary"),data("raui.pop.primary"));var themes=(data("raui.themes")||[]).slice();(data("raui.pop.themes")||[]).forEach(function(t){if(!~themes.indexOf(t)){themes.push(t)}});return"\n .rpop-wrapper {\n position: absolute;\n display: inline-block;\n z-index: 21;\n transition-property: top, left, padding;\n transition-timing-function: ease-in-out;\n transition-duration: 0.3s;\n }\n .rpop-with-tail.rpop-above {\n padding-bottom: 10px;\n }\n .rpop-with-tail.rpop-below {\n padding-top: 10px;\n }\n .rpop-with-tail.rpop-left {\n padding-right: 10px;\n }\n .rpop-with-tail.rpop-right {\n padding-left: 10px;\n }\n \n .rpop {\n position: relative;\n box-shadow: 0 1px 4px 0 rgba(0,0,0,0.24);\n border: 1px solid #ccc;\n border-radius: 0.2em;\n background-color: "+(primary.bg||"#fff")+";\n color: "+(primary.fg||"#222")+";\n padding: 0.5em;\n z-index: 2;\n }\n \n .rpop-modal {\n position: fixed;\n display: flex;\n z-index: 20;\n background-color: rgba(0, 0, 0, 0.2);\n align-items: center;\n justify-content: center;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n padding: 1em;\n overflow: auto;\n }\n \n .rpop-tail, .rpop-tail-outer {\n z-index: 3;\n width: 0;\n height: 0;\n position: absolute;\n border-style: solid;\n border-width: 10px;\n border-color: transparent;\n transition-property: top, left, bottom, right, border-color;\n transition-timing-function: ease-in-out;\n transition-duration: 0.3s;\n }\n .rpop-tail-outer {\n z-index: 1;\n border-width: 12px;\n border-color: transparent;\n }\n \n .rpop-below .rpop-tail {\n border-bottom-color: "+(primary.bg||"#fff")+";\n }\n .rpop-below .rpop-tail-outer {\n border-bottom-color: "+(primary.bc||"#ccc")+";\n }\n \n .rpop-above .rpop-tail {\n border-top-color: "+(primary.bg||"#fff")+";\n }\n .rpop-above .rpop-tail-outer {\n border-top-color: "+(primary.bc||"#ccc")+";\n }\n \n .rpop-left .rpop-tail {\n border-left-color: "+(primary.bg||"#fff")+";\n }\n .rpop-left .rpop-tail-outer {\n border-left-color: "+(primary.bc||"#ccc")+";\n }\n \n .rpop-right .rpop-tail {\n border-right-color: "+(primary.bg||"#fff")+";\n }\n .rpop-right .rpop-tail-outer {\n border-right-color: "+(primary.bc||"#ccc")+";\n }\n "+themes.map(function(t){var theme=Object.assign({},data("raui.primary"),data("raui.pop.primary"),data("raui."+t),data("raui.pop."+t));return"\n ."+t+" .rpop {\n background-color: "+(theme.bg||"#fff")+";\n color: "+(theme.fg||"#222")+";\n }\n \n ."+t+".rpop-below .rpop-tail {\n border-bottom-color: "+(theme.bg||"#fff")+";\n }\n ."+t+".rpop-below .rpop-tail-outer {\n border-bottom-color: "+(theme.bc||"#ccc")+";\n }\n \n ."+t+".rpop-above .rpop-tail {\n border-top-color: "+(theme.bg||"#fff")+";\n }\n ."+t+".rpop-above .rpop-tail-outer {\n border-top-color: "+(theme.bc||"#ccc")+";\n }\n \n ."+t+".rpop-left .rpop-tail {\n border-left-color: "+(theme.bg||"#fff")+";\n }\n ."+t+".rpop-left .rpop-tail-outer {\n border-left-color: "+(theme.bc||"#ccc")+";\n }\n \n ."+t+".rpop-right .rpop-tail {\n border-right-color: "+(theme.bg||"#fff")+";\n }\n ."+t+".rpop-right .rpop-tail-outer {\n border-right-color: "+(theme.bc||"#ccc")+";\n }\n "})}.call(this,data)].join(" ")},cssId:"rpop",noCssTransform:true,observe:{popped:function popped(v){var this$1=this;if(v){if(source){this.source=source}if(tailSource){this.tailSource=tailSource}}var ok;var done=this._transdone=new Promise(function(o){return ok=o});done.resolve=ok;setTimeout(function(){this$1._transdone=done;if(this$1.get("popped")===v){this$1.set("_popped",v)}},1)},_popped:{handler:function handler(v){var this$1=this;var done=this._transdone.resolve;if(v){var mobile=this.get("@style.raui.pop.mobile");if(mobile&&window.matchMedia("(max-width: "+mobile+")").matches){if(!mobilePop){mobilePop=new MobilePop({target:document.body,append:true})}var context=this.getContext().getParent(true);context.isContext=1;this.set("__popped",false).then(done);mobilePop.unshift("contents",{content:this.partials.content,context:context,attrs:this.partials["extra-attributes"]||[],clickClose:this.get("clickClose"),noClickout:this.get("noClickout"),done:function(){this$1.set("popped",false)}})}else{this.set("__popped",true)}}else{if(mobilePopped){mobilePop.shift("contents");done()}else{this.set("__popped",false).then(done)}}},defer:true,init:false},__popped:{handler:function handler(v){var done=this._transdone.resolve;if(v){var el=this.find("div");var node=el;var h=node.offsetHeight+node.offsetTop;var w=node.offsetWidth+node.offsetLeft;var offset=node.offsetParent;if(!this.overflows){var o=this.overflows={e:[],v:[]};while(el&&el.style){if(el===offset){if(el.offsetWidth>=w&&el.offsetHeight>=h){break}else{w+=el.offsetLeft;h+=el.offsetTop;offset=el.offsetParent}}var css=getComputedStyle(el);if(css.overflow==="auto"){break}if(css.overflow==="hidden"){o.e.push(el);o.v.push(el.style.overflow);el.style.overflow="visible"}el=el.parentNode}}this.position();this.transition("pop",node,{intro:true,dir:this.get("where")||"below"}).then(done)}else{this.source=null;this.tailSource=null}},defer:true,init:false},"align where tail fit":{handler:function handler(){this.position()},defer:true}},decorators:{cleanup:function cleanup(node){var pop=this;return{teardown:function teardown(){var o=pop.overflows;if(o){pop.overflows=null;for(var i=0;i<o.e.length;i++){o.e[i].style.overflow=o.v[i]}}}}}},data:function data(){return{gap:4}}});export function trigger(options){if(options===void 0)options={};return function(ref){var instance=ref.instance;instance.decorators[options.name||"pop"]=function(node,path,opts){if(opts===void 0)opts={};if(!path){return{teardown:noop}}if(typeof path==="string"){opts.path=path}else if(typeof path==="object"){opts=path}var ctx=this.getContext(node);var clicked,hover;function listener(ev){if(ev.type==="mouseover"&&ctx.get(path)){return}if(ev.type!=="click"||!hover||clicked){var init=source;var initTail=tailSource;source=opts.node||node;if(typeof source==="function"){source=source()}source=source||node;tailSource=opts.tail;if(typeof tailSource==="function"){tailSource=tailSource()}ctx.toggle(opts.path);source=init;tailSource=initTail}if(hover&&ev.type==="click"){clicked=ctx.observeOnce(opts.path,function(){clicked=null})}}function out(ev){if(!clicked){ctx.set(opts.path,false)}}if("click"in opts?opts.click:options.click!==false){ctx.listen("click",listener)}if("hover"in opts?opts.hover:options.hover){hover=1;ctx.listen("mouseover",listener);ctx.listen("mouseout",out)}return{teardown:function teardown(){ctx.unlisten("click",listener);if(hover){ctx.unlisten("mouseover",listener);ctx.unlisten("mouseout",out);if(clicked){clicked.cancel()}}}}}}}var MobilePop=function(Ractive){function MobilePop(opts){Ractive.call(this,opts)}if(Ractive)MobilePop.__proto__=Ractive;MobilePop.prototype=Object.create(Ractive&&Ractive.prototype);MobilePop.prototype.constructor=MobilePop;return MobilePop}(Ractive);Ractive.extendWith(MobilePop,{template:{v:template.v,t:template.p.modal},data:function data(){return{contents:[]}},use:[pop(),fade()],observe:{contents:function contents(v){mobilePopped=(v||[]).length>0}},on:{init:function init(){if(mobilePop){console.warn("More than one PopOver mobile host created.")}else{mobilePop=this}}}});export default function plugin(options){if(options===void 0)options={};return function(ref){var instance=ref.instance;instance.components[options.name||"pop"]=Popover;instance.components[options.mobileName||"mobile-pop"]=MobilePop;var opts=Object.assign({},options);opts.name=opts.trigger||opts.name;trigger(opts)({instance:instance})}}
{
"name": "@evs-chris/raui",
"version": "0.15.2",
"version": "0.15.3",
"description": "Components, decorators, and helpers for Ractive apps that are generally Material-ish",

@@ -5,0 +5,0 @@ "homepage": "https://evs-chris.github.io/raui/demo",

@@ -88,2 +88,4 @@ // TODO: support for non-numeric formats?

let lastBackspace = false;
if (node.tagName !== 'INPUT') {

@@ -172,2 +174,16 @@ console.warn(`Attempted to add a date decorator a ${node.tagName}`);

const selectGroup = (group, pos) => {
if (pos === undefined) pos = node.selectionStart;
if (group && group.target) group = undefined;
if (!group) {
if (pos === node.value.length && node.selectionEnd === node.value.length) group = groups[0];
else group = groupForPos(groups, pos);
}
if (lastBackspace) {
lastBackspace = false;
if (pos < group.start) group = groups[groups.indexOf(group) - 1];
}
document.activeElement === node && node.setSelectionRange(group.start, group.end);
};
handles.listeners.push(ctx.listen('input', () => {

@@ -185,3 +201,3 @@ const pos = node.selectionStart;

const next = groups[groups.indexOf(active) + 1];
node.setSelectionRange(next.start, next.end);
selectGroup(next, pos);
} else {

@@ -193,12 +209,9 @@ node.setSelectionRange(pos, pos);

handles.listeners.push(ctx.listen('blur', () => {
lastBackspace = false;
if (sendValue(false)) receiveValue(groups, groups.value, opts.parseDate);
if (groups.value === null) groups.forEach(g => g.value = null);
groups.forEach(g => g.display = displayForGroup(g));
updateDisplay(groups, node);
}));
const selectGroup = () => {
let group;
if (node.selectionStart === node.value.length && node.selectionEnd === node.value.length) group = groups[0];
else group = groupForPos(groups, node.selectionStart);
document.activeElement === node && node.setSelectionRange(group.start, group.end);
};
handles.listeners.push(ctx.listen('click', selectGroup));

@@ -208,2 +221,3 @@ handles.listeners.push(ctx.listen('focus', selectGroup));

handles.listeners.push(ctx.listen('keydown', (/** @type { KeyboardEvent } */ ev) => {
lastBackspace = false;
switch (ev.key) {

@@ -219,7 +233,7 @@ case 'Enter':

if (ev.shiftKey && idx > 0) {
node.setSelectionRange(groups[idx - 1].start, groups[idx - 1].end);
selectGroup(groups[idx - 1]);
ev.preventDefault();
ev.stopPropagation();
} else if (!ev.shiftKey && idx + 1 < groups.length) {
node.setSelectionRange(groups[idx + 1].start, groups[idx + 1].end);
selectGroup(groups[idx + 1]);
ev.preventDefault();

@@ -231,2 +245,6 @@ ev.stopPropagation();

case 'Backspace':
lastBackspace = true;
break;
case 'ArrowUp':

@@ -303,2 +321,5 @@ case 'ArrowDown': {

accepted = true;
} else if (g.type === 'd' && v.length !== g.length && leave) {
g.value = +v;
g.display = displayForGroup(g);
} else if (v === '') {

@@ -305,0 +326,0 @@ g.value = null;

@@ -387,3 +387,3 @@ import globalRegister from './globalRegister';

label.field.inline {
height: 3.3em;
min-height: 3.3em;
}

@@ -602,2 +602,3 @@

let body = [];
let label = [];
const attrs = (handle.template.m || []).slice();

@@ -648,2 +649,9 @@ const content = handle.template.f || [];

// check for button wrapping
content.forEach(e => {
if (e.e === 'label') {
if (e.f && e.f.length) label.push.apply(label, e.f);
} else {
body.push(e);
}
});
const els = content.filter(e => e.e);

@@ -655,13 +663,12 @@ if (els.find(e => e.e === 'button') && els.length > 1) {

],
f: content
f: body
}];
} else {
body.push.apply(body, content);
}
}
const label = attrs.find(a => a.n === 'label');
const labelattr = attrs.find(a => a.n === 'label');
if (labelattr && labelattr.f && labelattr.f.length) label.push.apply(label, Array.isArray(labelattr.f) ? labelattr.f : [labelattr.f]);
if (tip) body.unshift({
t: 7, e: 'span', m: [
{ t: 13, n: 'class', f: `field-tip${!label ? ' field-solo-tip' : ''}`, g: 1 },
{ t: 13, n: 'class', f: `field-tip${!label.length ? ' field-solo-tip' : ''}`, g: 1 },
{ t: 13, n: 'title', f: tip.f },

@@ -673,3 +680,3 @@ { t: 70, n: ['click'], f: { r: [], s: '[false]' } }

const inline = attrs.find(a => a.n === 'inline');
if (label && !inline) body.unshift.apply(body, Array.isArray(label.f) ? label.f : [label.f]);
if (label && !inline) body.unshift.apply(body, label);
else if (!inline) body.unshift('\xa0');

@@ -676,0 +683,0 @@

@@ -322,2 +322,12 @@ (function (global, factory) {

Popover.prototype.popFind = function popFind (pattern) {
if (mobilePopped) { return mobilePop.find(pattern); }
else { return this.find(pattenr); }
};
Popover.prototype.popFindAll = function popFindAll (pattern) {
if (mobilePopped) { return mobilePop.findAll(pattern); }
else { return this.findAll(pattenr); }
};
return Popover;

@@ -496,3 +506,3 @@ }(Ractive$1));

return ("\n label.field, .field-manual {\n display: inline-block;\n font-size: 0.9em;\n font-weight: 500;\n color: " + (primary.fg || '#222') + ";\n transition: 0.2s ease-in-out;\n transition-property: color;\n vertical-align: top;\n box-sizing: border-box;\n padding: 0.25em 0.5em;\n line-height: 1.5em;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-family: inherit;\n }\n\n label.field.textarea {\n display: block;\n border: 0.0625em solid " + (primary.bc || '#ccc') + ";\n padding: 0.5em 0.8em 0.8em 0.8em;\n border-radius: " + (primary.radius || '0.2em') + ";\n box-shadow: none;\n transition-property: color, border-color, box-shadow;\n margin: 0.8em 0.2em;\n min-height: auto;\n background-color: " + (boxy ? primary.bg || '#fff' : 'transparent') + ";\n }\n\n label.field.focus {\n color: " + (active.fg || primary.fga || '#07e') + ";\n }\n\n label.field.textarea.focus {\n border-color: " + (active.fg || primary.fga || '#07e') + ";\n " + (!boxy ? ("box-shadow: 0.0625em 0.0625em " + (active.fg || primary.fga || '#07e') + ",\n -0.0625em 0.0625em " + (active.fg || primary.fga || '#07e') + ",\n 0.0625em -0.0625em " + (active.fg || primary.fga || '#07e') + ",\n -0.0625em -0.0625em " + (active.fg || primary.fga || '#07e') + ";") : '') + "\n }\n\n label.field input,\n label.field select,\n label.field textarea,\n .field-manual .field-body\n {\n display: block;\n border-width: " + (boxy ? '0.0625em' : '0 0 0.0625em 0') + ";\n border-color: " + (primary.bc || '#ccc') + ";\n border-style: solid;\n box-sizing: border-box;\n background-color: " + (boxy ? primary.bg || '#fff' : 'transparent') + ";\n transition: 0.2s ease-in-out;\n transition-property: box-shadow, color;\n outline: none;\n box-shadow: none;\n width: 100%;\n margin-bottom: 0.8em;\n font-size: 1.1em;" + (boxy ? ("\n border-radius: " + (primary.radius || '0.2em') + ";") : '') + "\n font-weight: 400;\n font-family: inherit;\n }\n\n label.field input" + (boxy ? '' : ':disabled') + ",\n label.field select" + (boxy ? '' : ':disabled') + " {\n padding: 0 0.75em;\n }\n label.field select" + (boxy ? '' : ':disabled') + " {\n padding-right: 2em;\n }\n\n label.field input:disabled,\n label.field input[readonly],\n label.field select:disabled,\n label.field textarea:disabled,\n label.field textarea[readonly] {\n background: " + (disabled.bg || '#f4f4f4') + ";\n color: " + (disabled.fg || '#444') + ";\n }\n\n label.field textarea {\n line-height: 1.2em;\n }\n label.field .field-wrapper {\n display: block;\n }\n label.field > select, label.field > input,\n label.field > .field-wrapper > input, label.field > .field-wrapper > select {\n height: 2.5em;\n }\n\n " + (!boxy ? ("label.field:hover > input,\n label.field:hover select,\n label.field.file:hover:after {\n box-shadow: 0 0.0625em 0 0 " + (primary.bc || '#ccc') + ";\n }\n\n label.field.textarea:hover {\n box-shadow: 0.0625em 0.0625em " + (primary.bc || '#ccc') + ",\n -0.0625em 0.0625em " + (primary.bc || '#ccc') + ",\n 0.0625em -0.0625em " + (primary.bc || '#ccc') + ",\n -0.0625em -0.0625em " + (primary.bc || '#ccc') + ";\n }\n\n label.field.textarea.focus:hover {\n box-shadow: 0.0625em 0.0625em " + (active.fg || primary.fga || '#07e') + ",\n -0.0625em 0.0625em " + (active.fg || primary.fga || '#07e') + ",\n 0.0625em -0.0625em " + (active.fg || primary.fga || '#07e') + ",\n -0.0625em -0.0625em " + (active.fg || primary.fga || '#07e') + ";\n }") : '') + "\n\n /**** CHECK BOXES ****/\n\n label.field.check, label.field.radio {\n position:relative;\n z-index: 0;\n overflow: visible;\n cursor: pointer;\n padding-top: 2.2em;\n white-space: normal;\n }\n label.field.check.inline, label.field.radio.inline {\n padding-top: 0.7em;\n }\n\n label.field.check input, label.field.radio input {\n appearance: none;\n -moz-appearance: none;\n -webkit-appearance: none;\n z-index: -1;\n position: absolute;\n left: -0.5em;\n top: 1em;\n display: block;\n margin: 0;\n border-radius: 50%;\n width: 3.2em;\n height: 3.2em;\n background-color: " + (primary.bc || '#ccc') + ";\n box-shadow: none;\n outline: none;\n opacity: 0;\n transform: scale(1);\n pointer-events: none;\n transition: opacity 0.3s, transform 0.2s;\n }\n label.field.inline.check input, label.field.inline.radio input {\n top: -0.45em;\n left: -0.55em;\n }\n\n label.field.check input:checked, label.field.radio input:checked {\n background-color: " + (primary.fga || '#07e') + ";\n }\n\n label.field.check:hover > input, label.field.radio:hover > input {\n opacity: 0.04;\n }\n\n label.field.check input:focus, label.field.radio input:focus {\n opacity: 0.12;\n }\n\n label.field.check:hover > input:focus, label.field.radio:hover > input:focus {\n opacity: 0.16;\n }\n\n label.field.check input:active, label.field.radio input:active {\n opacity: 0.6;\n transform: scale(0);\n transition: transform 0s, opacity 0s;\n }\n\n label.field.check:before, label.field.radio:before {\n content: '';\n display: inline-block;\n box-sizing: border-box;\n margin: 0 0.5em 0.2em 0.1em;\n border: solid 0.125em; /* Safari */\n border-color: " + (primary.fg || '#222') + ";\n border-radius: 0.125em;\n width: 1.2em;\n height: 1.2em;\n vertical-align: bottom;\n transition: border-color 0.2s, background-color 0.2s;\n }\n\n label.field.check:after, label.field.radio:after {\n content: '';\n display: inline-block;\n opacity: 0;\n position: absolute;\n width: 1.2em;\n height: 1.2em;\n top: 2.3em;\n left: 0.6em;\n border-radius: 0.125em;\n }\n label.field.check.inline:after, label.field.radio.inline:after {\n top: 0.8em;\n }\n\n label.field.check.checked:after {\n opacity: 1;\n background: no-repeat center/80% url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\"><path fill=\"" + ((primary.bg || '#fff').replace(/#/g, '%23')) + "\" d=\"m 15.378906,1.7050781 a 1.0583349,1.0583349 0 0 0 -1.478515,0.234375 L 6.6210937,11.960938 1.8652344,8.5058594 a 1.0583349,1.0583349 0 0 0 -1.47851565,0.234375 1.0583349,1.0583349 0 0 0 0.234375,1.4785156 L 6.234375,14.294922 A 1.0584408,1.0584408 0 0 0 7.7128906,14.060547 L 15.613281,3.1835938 A 1.0583349,1.0583349 0 0 0 15.378906,1.7050781 Z\" /></svg>') " + (primary.fga || '#07e') + ";\n }\n\n label.field.radio.checked:after {\n opacity: 1;\n background: no-repeat center/80% url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\"><circle fill=\"" + ((primary.bg || '#fff').replace(/#/g, '%23')) + "\" cx=\"8\" cy=\"8\" r=\"5\" /></svg>') " + (primary.fga || '#07e') + ";\n }\n\n label.field.check.checked:before, label.field.radio.checked:before {\n border-color: " + (primary.fga || '#07e') + ";\n }\n label.field.check.focus:before, label.field.radio.focus:before {\n border-color: " + (primary.fga || '#07e') + ";\n }\n\n label.field.check input:disabled, label.field.radio input:disabled {\n opacity: 0;\n }\n\n label.field.check.disabled, label.field.radio.disabled {\n color: " + (disabled.fg || '#444') + ";\n cursor: initial;\n }\n\n label.field.check.disabled:before, label.field.radio.disabled:before {\n border-color: " + (disabled.bc || '#ccc') + ";\n background-color: " + (disabled.bg || '#f4f4f4') + ";\n }\n\n label.field.check.checked.disabled:after, label.field.radio.checked.disabled:after {\n border-color: transparent;\n background-color: " + (disabled.bc || '#ccc') + ";\n }\n\n label.field select {\n padding-right: 2em;\n }\n\n label.field.select {\n cursor: pointer;\n position: relative;\n }\n\n label.field.select:after {\n content: ' ';\n position: absolute;\n display: block;\n width: 0.6em;\n right: 1.125em;\n height: 0.6em;\n top: 2.6em;\n border-bottom: 0.125em solid;\n border-right: 0.125em solid;\n transform: rotate(45deg);\n pointer-events: none;\n color: " + (primary.bc || '#ccc') + ";\n }\n\n label.field textarea {\n border: none;" + (boxy ? "\n padding: 0;" : '') + "\n }\n\n label.field > select {\n -moz-appearance: none;\n -webkit-appearance: none;\n }\n\n label.field input:focus,\n label.field select:focus,\n label.field.file.focus:after\n {\n border-color: " + (active.fg || primary.fga || '#07e') + ";\n " + (!boxy ? ("box-shadow: 0 0.0625em 0 0 " + (active.fg || primary.fga || '#07e') + ";") : '') + "\n }\n\n label.field input[type=checkbox]:focus,\n label.field input[type=radio]:focus {\n box-shadow: none;\n }\n\n label.field.file.focus:after {\n color: " + (active.fg || primary.fga || '#07e') + ";\n }\n label.field.file [type=file] {\n position: absolute;\n width: 0;\n height: 0;\n opacity: 0;\n z-index: -1;\n }\n label.field.file {\n position: relative;\n min-width: 9em;\n height: 5em;\n }\n label.field.file:after {\n position: absolute;\n content: 'Choose a file';\n box-sizing: border-box;\n width: calc(100% - 0.3em);\n height: 2.5em;\n font-size: 1.1em;\n line-height: 1.5em;\n color: " + (primary.fg || '#222') + ";\n text-align: " + (boxy ? 'center' : 'left') + ";\n padding: 0.5em " + (boxy ? '0.5em' : '0') + ";\n cursor: pointer;\n font-style: oblique;\n left: 0.25em;\n top: 1.6em;\n transition: 0.2s ease-in-out;\n transition-property: color, border-bolor, box-shadow;" + (boxy ? ("\n border-radius: " + (primary.radius || '0.2em') + ";\n border-color: " + (primary.bc || '#ccc') + ";\n border-style: solid;\n border-width: 0.0625em;") : ("\n border-bottom-color: " + (primary.bc || '#ccc') + ";\n border-bottom-width: 0.0625em;\n border-bottom-style: solid;\n ")) + "\n }\n label.field.file.inline:after {\n top: 0.2em;\n }\n\n label.field.button {\n vertical-align: top;\n padding-top: " + (boxy ? '1.7' : '1.958') + "em;\n }\n label.field .with-buttons button, label.field.button button {\n font-size: 1.1em;\n margin-top: " + (boxy ? '0.15em' : '0') + ";\n }\n\n label.field .field-wrapper.with-buttons {\n display: flex;\n }\n label.field .with-buttons button {\n flex-shrink: 0;\n padding-left: 0.5em;\n padding-right: 0.5em;\n margin-top: 0;\n margin-right: 0;\n " + (boxy ? ("height: 2.5em;\n box-shadow: none;\n border-radius: 0;\n border-left: 1px solid " + (primary.bg || '#fff') + ";\n margin-left: 0;") :
"height: 2.25em;") + "\n }" + (boxy ? ("\n label.field .with-buttons button:first-of-type {\n margin-left: -0.05em;\n border-left: none;\n }\n label.field .with-buttons button:last-of-type {\n border-radius: 0 " + (primary.radius || '0.2em') + " " + (primary.radius || '0.2em') + " 0;\n }\n label.field .with-buttons input {\n border-radius: " + (primary.radius || '0.2em') + " 0 0 " + (primary.radius || '0.2em') + ";\n min-width: 0;\n }\n ") : '') + "\n\n label.field.plain > div {\n position: absolute;\n font-size: 1.1em;\n top: 2.4em;\n font-weight: normal;\n }\n\n /* inline fields (no labels) */\n label.field.inline {\n height: 3.3em;\n }\n\n label.field.button.inline {\n margin-top: 0.2em;\n padding-top: 0.12em;\n }\n\n label.field.button.inline button {\n margin-top: 0;\n }\n\n label.field.inline.select:after {\n top: 1." + (boxy ? '15' : '1') + "em;\n }\n\n label.field .field-tip {\n display: inline-block;\n width: 1em;\n height: 1em;\n background-color: " + (primary.fga || '#07e') + ";\n color: " + (primary.bg || '#fff;') + ";\n cursor: default;\n user-select: none;\n border-radius: 1em;\n margin-left: 0.5em;\n line-height: 1.2em;\n text-align: center;\n margin-top: -0.2em;\n }\n\n label.field .field-solo-tip {\n margin-left: -0.1em;\n }\n ");
"height: 2.25em;") + "\n }" + (boxy ? ("\n label.field .with-buttons button:first-of-type {\n margin-left: -0.05em;\n border-left: none;\n }\n label.field .with-buttons button:last-of-type {\n border-radius: 0 " + (primary.radius || '0.2em') + " " + (primary.radius || '0.2em') + " 0;\n }\n label.field .with-buttons input {\n border-radius: " + (primary.radius || '0.2em') + " 0 0 " + (primary.radius || '0.2em') + ";\n min-width: 0;\n }\n ") : '') + "\n\n label.field.plain > div {\n position: absolute;\n font-size: 1.1em;\n top: 2.4em;\n font-weight: normal;\n }\n\n /* inline fields (no labels) */\n label.field.inline {\n min-height: 3.3em;\n }\n\n label.field.button.inline {\n margin-top: 0.2em;\n padding-top: 0.12em;\n }\n\n label.field.button.inline button {\n margin-top: 0;\n }\n\n label.field.inline.select:after {\n top: 1." + (boxy ? '15' : '1') + "em;\n }\n\n label.field .field-tip {\n display: inline-block;\n width: 1em;\n height: 1em;\n background-color: " + (primary.fga || '#07e') + ";\n color: " + (primary.bg || '#fff;') + ";\n cursor: default;\n user-select: none;\n border-radius: 1em;\n margin-left: 0.5em;\n line-height: 1.2em;\n text-align: center;\n margin-top: -0.2em;\n }\n\n label.field .field-solo-tip {\n margin-left: -0.1em;\n }\n ");
// TODO: other themes

@@ -679,2 +689,3 @@ }

var body = [];
var label = [];
var attrs = (handle.template.m || []).slice();

@@ -725,2 +736,9 @@ var content = handle.template.f || [];

// check for button wrapping
content.forEach(function (e) {
if (e.e === 'label') {
if (e.f && e.f.length) { label.push.apply(label, e.f); }
} else {
body.push(e);
}
});
var els = content.filter(function (e) { return e.e; });

@@ -732,13 +750,12 @@ if (els.find(function (e) { return e.e === 'button'; }) && els.length > 1) {

],
f: content
f: body
}];
} else {
body.push.apply(body, content);
}
}
var label = attrs.find(function (a) { return a.n === 'label'; });
var labelattr = attrs.find(function (a) { return a.n === 'label'; });
if (labelattr && labelattr.f && labelattr.f.length) { label.push.apply(label, Array.isArray(labelattr.f) ? labelattr.f : [labelattr.f]); }
if (tip) { body.unshift({
t: 7, e: 'span', m: [
{ t: 13, n: 'class', f: ("field-tip" + (!label ? ' field-solo-tip' : '')), g: 1 },
{ t: 13, n: 'class', f: ("field-tip" + (!label.length ? ' field-solo-tip' : '')), g: 1 },
{ t: 13, n: 'title', f: tip.f },

@@ -750,3 +767,3 @@ { t: 70, n: ['click'], f: { r: [], s: '[false]' } }

var inline = attrs.find(function (a) { return a.n === 'inline'; });
if (label && !inline) { body.unshift.apply(body, Array.isArray(label.f) ? label.f : [label.f]); }
if (label && !inline) { body.unshift.apply(body, label); }
else if (!inline) { body.unshift('\xa0'); }

@@ -999,2 +1016,3 @@

var justPopped = false;
var opts = { init: false, defer: true };

@@ -1024,8 +1042,13 @@ var watches = [

}),
h.observe('rac.selected', scrollView) ];
h.observe('rac.selected', scrollView),
h.observe('rac.popped', function (v) {
if (v) { setTimeout(function () { return justPopped = false; }, 300); }
justPopped = true;
}) ];
h.set('rac.checkBlur', function checkBlur(node) {
if (justPopped) { return false; }
var active = document.activeElement;
if (!~formNodes.indexOf(active.nodeName) && !active.getAttribute('tabindex')) { return; }
var inputs = h.findAll('input');
var inputs = h.findAll('input').concat(h.get('rac.pop').popFindAll('input'));
if (document.activeElement && !~inputs.indexOf(document.activeElement)) { h.get('rac.key')({ which: 9 }); }

@@ -1049,3 +1072,4 @@ });

var drop = Object.assign({}, data('raui.autocomplete.drop'), data('raui.autocomplete.primary.drop'));
return (".rautocomplete {\n position: relative;\n display: inline-block;\n }\n \n .rac-drop {\n width: 2em;\n height: 100%;\n position: absolute;\n top: 0;\n right: 2px;\n cursor: pointer;\n }\n .rac-drop:after {\n font-family: " + (drop.font || 'sans-serif') + ";\n content: " + (drop.string || '\'\u25be\'') + ";\n position: absolute;\n top: calc(50% - 0.5em);\n height: 1em;\n line-height: 1em;\n width: 100%;\n text-align: center;\n font-weight: " + (drop.weight || 'normal') + ";\n color: " + (drop.color || primary.bc || '#ccc') + ";\n }\n \n .rac-pop {\n min-width: 100%;\n }\n \n .rac-pop > .rpop {\n padding: 0;\n }\n \n .rac-list {\n display: flex;\n flex-direction: column;\n max-height: 50vh;\n min-height: 2.125em;\n max-width: 100%;\n overflow: auto;\n }\n \n .rac-item {\n color: " + (primary.fg || '#222') + ";\n background-color: " + (primary.bg || '#fff') + ";\n padding: 0.25em;\n cursor: pointer;\n }\n \n .rac-selected {\n color: " + (primary.bg || '#fff') + ";\n background-color: " + (primary.fga || '#07e') + ";\n }\n \n .rac-hover {\n color: " + (primary.fg || '#222') + ";\n background-color: " + (primary.bc || '#ccc') + ";\n }\n \n .rac-selected.rac-hover {\n background-color: " + (primary.bc || '#ccc') + ";\n color: " + (primary.fga || '#07e') + ";\n }\n \n .rac-invalid {\n cursor: not-allowed;\n }\n \n input.rac-modal {\n width: 100%;\n box-sizing: border-box;\n }");
var boxy = data('raui.form.boxy');
return (".rautocomplete {\n position: relative;\n display: inline-block;\n }\n \n .rac-drop {\n width: 2em;\n height: 100%;\n position: absolute;\n top: 0;\n right: 2px;\n cursor: pointer;\n }\n .rac-drop:after {\n font-family: " + (drop.font || 'sans-serif') + ";\n content: " + (drop.string || '\'\u25be\'') + ";\n position: absolute;\n top: calc(50% - 0.5em);\n height: 1em;\n line-height: 1em;\n width: 100%;\n text-align: center;\n font-weight: " + (drop.weight || 'normal') + ";\n color: " + (drop.color || primary.bc || '#ccc') + ";\n }\n \n .rac-pop {\n min-width: 100%;\n }\n \n .rac-pop > .rpop {\n padding: 0;\n }\n \n .rac-list {\n display: flex;\n flex-direction: column;\n max-height: 50vh;\n min-height: 2.125em;\n max-width: 100%;\n overflow: auto;\n }\n \n .rac-item {\n color: " + (primary.fg || '#222') + ";\n background-color: " + (primary.bg || '#fff') + ";\n padding: 0.25em;\n cursor: pointer;\n }\n \n .rac-selected {\n color: " + (primary.bg || '#fff') + ";\n background-color: " + (primary.fga || '#07e') + ";\n }\n \n .rac-hover {\n color: " + (primary.fg || '#222') + ";\n background-color: " + (primary.bc || '#ccc') + ";\n }\n \n .rac-selected.rac-hover {\n background-color: " + (primary.bc || '#ccc') + ";\n color: " + (primary.fga || '#07e') + ";\n }\n \n .rac-invalid {\n cursor: not-allowed;\n }\n \n input.rac-modal {\n width: 100%;\n box-sizing: border-box;\n display: block;\n border-width: " + (boxy ? '0.0625em' : '0 0 0.0625em 0') + ";\n border-color: " + (primary.bc || '#ccc') + ";\n border-style: solid;\n box-sizing: border-box;\n background-color: " + (boxy ? primary.bg || '#fff' : 'transparent') + ";\n transition: 0.2s ease-in-out;\n transition-property: box-shadow, color;\n outline: none;\n box-shadow: none;\n width: 100%;\n margin-bottom: 0.8em;\n font-size: 1.1em;" + (boxy ? ("\n border-radius: " + (primary.radius || '0.2em') + ";") : '') + "\n font-weight: 400;\n font-family: inherit;\n }");
}).call(this, data)].join(' '); },

@@ -1052,0 +1076,0 @@ cssId: 'rautocomplete',

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("ractive")):"function"==typeof define&&define.amd?define(["exports","ractive"],t):t(e.RauiAutocomplete={},e.Ractive)}(this,function(e,t){"use strict";t=t&&t.hasOwnProperty("default")?t.default:t;var n="undefined"!=typeof window?window:null;function i(e,t,i){if(n&&n.Ractive&&"object"==typeof n.Ractive[t]){var r=document.currentScript;if(r||(r=(r=document.querySelectorAll("script"))[r.length-1]),r){var o=r.getAttribute("data-alias");o&&(o=(o=o.split("&")).reduce(function(e,t){var n=t.split("="),i=n[0],r=n[1];return e[i]=r,e},{})),Ractive[t][o&&o[e]||e]=i}}}function r(e,t){void 0===t&&(t={});var n=e.processParams(t,{duration:400,easing:"easeInOut"});t.dir=t.dir||!1;var i=t.distance||"20px",r=t.scale||"0.9",o="above"===t.dir?"translateY("+i+")":"left"===t.dir?"translateX("+i+")":"right"===t.dir?"translateX(-"+i+")":"translateY(-"+i+")";return e.isIntro||n.intro?(e.setStyle("opacity",0),e.setStyle("transform","scale("+r+") "+o),e.animateStyle({opacity:1,transform:"none"},n)):(e.setStyle("opacity",1),e.setStyle("transform","none"),e.animateStyle({opacity:0,transform:"scale("+r+") "+o},n))}function o(e){return void 0===e&&(e={}),function(t){t.instance.transitions[e.name||"pop"]=r}}function a(e,t){var n=!1,i=!1;function r(n){for(var i=n.target;i;){if(i===e)return;if(!i.parentNode&&i!==document)return;i=i.parentNode}t(n)}return setTimeout(function(){n=!0,i||(document.body.addEventListener("click",r,{capture:!0}),document.body.addEventListener("touchstop",r,{capture:!0}))}),{teardown:function(){i=!0,n&&(document.body.removeEventListener("click",r,{capture:!0}),document.body.removeEventListener("touchstop",r,{capture:!0}))}}}function l(e,t){var n=e.processParams(t,{duration:200,easing:"easeInOut"});return e.isIntro||n.intro?(e.setStyle("opacity",0),e.animateStyle("opacity",1,n)):(e.setStyle("opacity",1),e.animateStyle("opacity",0,n))}function c(e){return void 0===e&&(e={}),function(t){t.instance.transitions[e.name||"fade"]=l}}i("pop","transitions",r),i("fade","transitions",l);var s,f,p,d={v:4,t:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rpop-wrapper",g:1},{n:"class-rpop-with-tail",t:13,f:[{t:2,r:"position.tail"}]},{n:"class",f:["rpop-",{t:2,x:{r:["where"],s:'_0||"below"'}}," rpop-align-",{t:2,x:{r:["align"],s:'_0||"middle"'}}],t:13},{t:4,f:[{n:"style-top",f:[{t:2,r:"position.popTop"},"px"],t:13},{n:"style-left",f:[{t:2,r:"position.popLeft"},"px"],t:13}],n:50,r:"position"},{t:4,f:[{t:4,f:[{n:"style-top",f:[{t:2,r:"top"}],t:13}],n:50,r:"top"},{t:4,f:[{n:"style-left",f:[{t:2,r:"left"}],t:13}],n:50,r:"left"}],n:51,l:1},{n:"pop",t:72,f:{r:["where"],s:'[{dir:_0||"below"}]'},v:"t2"},{n:"cleanup",t:71},{t:4,f:[{n:["click"],t:70,f:{r:["@this"],s:'[_0.set("popped",false)]'}}],n:50,r:"clickClose"},{t:4,f:[{n:["clickout"],t:70,f:{r:["@this"],s:'[_0.set("popped",false)]'}}],n:51,r:"noClickout"},{t:16,r:"extra-attributes"}],f:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rpop-tail",g:1},{t:4,f:[{n:"style-top",f:[{t:2,x:{r:["position.tailTop","position.vert"],s:"_0+(_1?3:0)"}},"px"],t:13}],n:50,x:{r:["position.tailTop"],s:"_0!=null"}},{t:4,f:[{n:"style-bottom",f:[{t:2,x:{r:["position.tailBottom","position.vert"],s:"_0+(_1?3:0)"}},"px"],t:13}],n:50,x:{r:["position.tailBottom"],s:"_0!=null"}},{t:4,f:[{n:"style-left",f:[{t:2,x:{r:["position.tailLeft","position.vert"],s:"_0+(_1?0:3)"}},"px"],t:13}],n:50,x:{r:["position.tailLeft"],s:"_0!=null"}},{t:4,f:[{n:"style-right",f:[{t:2,x:{r:["position.tailRight","position.vert"],s:"_0+(_1?0:3)"}},"px"],t:13}],n:50,x:{r:["position.tailRight"],s:"_0!=null"}}]}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rpop-tail-outer",g:1},{t:4,f:[{n:"style-top",f:[{t:2,x:{r:["position.tailTop"],s:"_0-2"}},"px"],t:13}],n:50,x:{r:["position.tailTop"],s:"_0!=null"}},{t:4,f:[{n:"style-bottom",f:[{t:2,x:{r:["position.tailBottom"],s:"_0-2"}},"px"],t:13}],n:50,x:{r:["position.tailBottom"],s:"_0!=null"}},{t:4,f:[{n:"style-left",f:[{t:2,x:{r:["position.tailLeft"],s:"_0-2"}},"px"],t:13}],n:50,x:{r:["position.tailLeft"],s:"_0!=null"}},{t:4,f:[{n:"style-right",f:[{t:2,x:{r:["position.tailRight"],s:"_0-2"}},"px"],t:13}],n:50,x:{r:["position.tailRight"],s:"_0!=null"}}]}],n:50,r:"~/tail"}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rpop",g:1}],f:[{t:16,r:"content",z:[{n:"trigger",x:{r:"triggerContext"}}]}]}]}],n:50,r:"__popped"}],e:{'_0||"below"':function(e){return e||"below"},'_0||"middle"':function(e){return e||"middle"},'[{dir:_0||"below"}]':function(e){return[{dir:e||"below"}]},'[_0.set("popped",false)]':function(e){return[e.set("popped",!1)]},"_0+(_1?3:0)":function(e,t){return e+(t?3:0)},"_0!=null":function(e){return null!=e},"_0+(_1?0:3)":function(e,t){return e+(t?0:3)},"_0-2":function(e){return e-2},"[{delay:200}]":function(){return[{delay:200}]},"[_0===_1&&_2.done(),true]":function(e,t,n){return[e===t&&n.done(),!0]},"[_0.done()]":function(e){return[e.done()]},true:function(){return!0}},p:{modal:[{t:4,f:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rpop-modal",g:1},{n:"fade",t:72,v:"t1"},{n:"fade",t:72,f:{r:[],s:"[{delay:200}]"},v:"t2"},{t:4,f:[{n:["click"],t:70,f:{r:["@node","@event.target","."],s:"[_0===_1&&_2.done(),true]"}}],n:51,r:".noClickout"}],f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rpop",g:1},{n:"pop",t:72,f:{r:[],s:"[{delay:200}]"},v:"t1"},{n:"pop",t:72,v:"t2"},{t:4,f:[{n:["click"],t:70,f:{r:["."],s:"[_0.done()]"}}],n:50,r:".clickClose"},{t:8,r:".attrs",c:{r:".context"},z:[{n:"inModal",x:{x:{r:[],s:"true"}}}]}],f:[{t:8,r:".content",c:{r:".context"},z:[{n:"inModal",x:{x:{r:[],s:"true"}}}]}]}]}],n:54,r:"contents.0"}],n:50,r:"contents.length"}]}},u=function(e){function t(t){e.call(this,t)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.position=function(t){var n=t||this.source,i=this.get("popped");if(n&&i){var r=this.find("div");if(n&&r&&r.offsetParent){n?this.set("triggerContext",e.getContext(n)):this.set("triggerContext",null);var o=r.offsetParent,a=o.getBoundingClientRect(),l=r.getBoundingClientRect(),c=n.getBoundingClientRect(),s=this.get("where")||"below",f=this.get("align")||"middle",p=this.get("tail"),d="above"===s||"below"===s,u=this.get("fit"),b=this.get("gap"),m="above"===s||"below"===s?0:"left"===s?-l.width-b:c.width+b,h="left"===s||"right"===s?-c.height:"above"===s?-c.height-l.height-b:b;"middle"===f?"below"===s||"above"===s?m-=(l.width-c.width)/2:"left"!==s&&"right"!==s||(h-=(l.height-c.height)/2):"end"===f&&("below"===s||"above"===s?m+=c.width-l.width:"left"!==s&&"right"!==s||(h+=c.height-l.height));var g={popTop:c.bottom-a.top+h,popLeft:c.left-a.left+m,tail:p,vert:"above"===s||"below"===s};if(o.scrollTop&&(g.popTop+=o.scrollTop),o.scrollLeft&&(g.popLeft+=o.scrollLeft),p){"above"===s?g.tailBottom=-10:"below"===s?g.tailTop=-10:"left"===s?g.tailRight=-10:"right"===s&&(g.tailLeft=-10);var v=this.tailSource?this.tailSource.getBoundingClientRect():c;"start"===f?d?g.tailLeft=Math.floor(v.width/2)-10:g.tailTop=Math.floor(v.height/2)-10:"end"===f?d?g.tailRight=Math.floor(v.width/2)-10:g.tailBottom=Math.floor(v.height/2)-10:"middle"===f&&(d?g.tailLeft=Math.floor(v.width/2)-10:g.tailTop=Math.floor(v.height/2)-10),v!==c?d?(null!=g.tailLeft&&(g.tailLeft+=v.left-c.left),null!=g.tailRight&&(g.tailRight+=c.right-v.right)):(null!=g.tailTop&&(g.tailTop+=v.top-c.top),null!=g.tailBottom&&(g.tailBottom+=c.bottom-v.bottom)):"middle"===f&&(d?(null!=g.tailLeft&&(g.tailLeft+=v.left-(g.popLeft+a.left)),null!=g.tailRight&&(g.tailRight+=g.popLeft+a.left+l.width-v.right)):(null!=g.tailTop&&(g.tailTop+=v.top-(g.popTop+a.top)),null!=g.tailBottom&&(g.tailBottom+=g.popTop+a.top+l.height-v.bottom)))}if(u){var y=o;if(this.get("offsets"))for(var _=this.get("offsets");_--;)y=y.offsetParent;var x=o.scrollWidth,w=o.scrollHeight;if(g.popLeft+l.width>x){var k=g.popLeft-(x-l.width);g.popLeft-=k,d&&g.tailLeft&&(g.tailLeft+=k),d&&g.tailRight&&(g.tailRight-=k),p&&!d&&(g.tail=!1)}if(g.popLeft<0){var T=-1*g.popLeft;g.popLeft+=T,d&&g.tailLeft&&(g.tailLeft-=T),d&&g.tailRight&&(g.tailRight+=T),p&&!d&&(g.tail=!1)}if(g.popTop+l.height>w){var L=g.popTop-(w-l.height);g.popTop-=L,!d&&g.tailTop&&(g.tailTop+=L),!d&&g.tailBottom&&(g.tailBottom-=L),p&&d&&(g.tail=!1)}if(g.popTop<0){var O=-1*g.popTop;g.popTop+=O,!d&&g.tailTop&&(g.tailTop-=O),!d&&g.tailBottom&&(g.tailBottom+=O),p&&d&&(g.tail=!1)}}if(a.left+g.popLeft<0){var B=0-(a.left+g.popLeft);g.popLeft+=B,d&&g.tailLeft&&(g.tailLeft-=B),d&&g.tailRight&&(g.tailRight+=B),p&&!d&&(g.tail=!1)}if(a.top+g.popTop<0){var A=0-(a.top+g.popTop);g.popTop+=A,!d&&g.tailTop&&(g.tailTop-=A),!d&&g.tailBottom&&(g.tailBottom+=A),p&&d&&(g.tail=!1)}g.tailLeft&&(g.tailLeft=Math.floor(g.tailLeft)),g.tailRight&&(g.tailRight=Math.floor(g.tailRight)),g.tailTop&&(g.tailTop=Math.floor(g.tailTop)),g.tailBottom&&(g.tailBottom=Math.floor(g.tailBottom)),this.set("position",g)}else this.set("position",null)}},t.prototype.show=function(e){return this.source=e,this.set("popped",!0),this._transdone},t.prototype.hide=function(){return this.set("popped",!1),this._transdone},t}(t);t.extendWith(u,{attributes:["popped","tail","where","align","top","left","fit","clickClose","noClickout","gap","offsets"],use:[o(),(void 0===p&&(p={}),function(e){e.instance.events[p.name||"clickout"]=a}),c()],template:d,css:function(e){return[function(e){var t=Object.assign({},e("raui.primary"),e("raui.pop.primary")),n=(e("raui.themes")||[]).slice();return(e("raui.pop.themes")||[]).forEach(function(e){~n.indexOf(e)||n.push(e)}),"\n .rpop-wrapper {\n position: absolute;\n display: inline-block;\n z-index: 21;\n transition-property: top, left, padding;\n transition-timing-function: ease-in-out;\n transition-duration: 0.3s;\n }\n .rpop-with-tail.rpop-above {\n padding-bottom: 10px;\n }\n .rpop-with-tail.rpop-below {\n padding-top: 10px;\n }\n .rpop-with-tail.rpop-left {\n padding-right: 10px;\n }\n .rpop-with-tail.rpop-right {\n padding-left: 10px;\n }\n \n .rpop {\n position: relative;\n box-shadow: 0 1px 4px 0 rgba(0,0,0,0.24);\n border: 1px solid #ccc;\n border-radius: 0.2em;\n background-color: "+(t.bg||"#fff")+";\n color: "+(t.fg||"#222")+";\n padding: 0.5em;\n z-index: 2;\n }\n \n .rpop-modal {\n position: fixed;\n display: flex;\n z-index: 20;\n background-color: rgba(0, 0, 0, 0.2);\n align-items: center;\n justify-content: center;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n padding: 1em;\n overflow: auto;\n }\n \n .rpop-tail, .rpop-tail-outer {\n z-index: 3;\n width: 0;\n height: 0;\n position: absolute;\n border-style: solid;\n border-width: 10px;\n border-color: transparent;\n transition-property: top, left, bottom, right, border-color;\n transition-timing-function: ease-in-out;\n transition-duration: 0.3s;\n }\n .rpop-tail-outer {\n z-index: 1;\n border-width: 12px;\n border-color: transparent;\n }\n \n .rpop-below .rpop-tail {\n border-bottom-color: "+(t.bg||"#fff")+";\n }\n .rpop-below .rpop-tail-outer {\n border-bottom-color: "+(t.bc||"#ccc")+";\n }\n \n .rpop-above .rpop-tail {\n border-top-color: "+(t.bg||"#fff")+";\n }\n .rpop-above .rpop-tail-outer {\n border-top-color: "+(t.bc||"#ccc")+";\n }\n \n .rpop-left .rpop-tail {\n border-left-color: "+(t.bg||"#fff")+";\n }\n .rpop-left .rpop-tail-outer {\n border-left-color: "+(t.bc||"#ccc")+";\n }\n \n .rpop-right .rpop-tail {\n border-right-color: "+(t.bg||"#fff")+";\n }\n .rpop-right .rpop-tail-outer {\n border-right-color: "+(t.bc||"#ccc")+";\n }\n "+n.map(function(t){var n=Object.assign({},e("raui.primary"),e("raui.pop.primary"),e("raui."+t),e("raui.pop."+t));return"\n ."+t+" .rpop {\n background-color: "+(n.bg||"#fff")+";\n color: "+(n.fg||"#222")+";\n }\n \n ."+t+".rpop-below .rpop-tail {\n border-bottom-color: "+(n.bg||"#fff")+";\n }\n ."+t+".rpop-below .rpop-tail-outer {\n border-bottom-color: "+(n.bc||"#ccc")+";\n }\n \n ."+t+".rpop-above .rpop-tail {\n border-top-color: "+(n.bg||"#fff")+";\n }\n ."+t+".rpop-above .rpop-tail-outer {\n border-top-color: "+(n.bc||"#ccc")+";\n }\n \n ."+t+".rpop-left .rpop-tail {\n border-left-color: "+(n.bg||"#fff")+";\n }\n ."+t+".rpop-left .rpop-tail-outer {\n border-left-color: "+(n.bc||"#ccc")+";\n }\n \n ."+t+".rpop-right .rpop-tail {\n border-right-color: "+(n.bg||"#fff")+";\n }\n ."+t+".rpop-right .rpop-tail-outer {\n border-right-color: "+(n.bc||"#ccc")+";\n }\n "})}.call(this,e)].join(" ")},cssId:"rpop",noCssTransform:!0,observe:{popped:function(e){var t,n=this,i=this._transdone=new Promise(function(e){return t=e});i.resolve=t,setTimeout(function(){n._transdone=i,n.get("popped")===e&&n.set("_popped",e)},1)},_popped:{handler:function(e){var t=this,n=this._transdone.resolve;if(e){var i=this.get("@style.raui.pop.mobile");if(i&&window.matchMedia("(max-width: "+i+")").matches){f||(f=new b({target:document.body,append:!0}));var r=this.getContext().getParent(!0);r.isContext=1,this.set("__popped",!1).then(n),f.unshift("contents",{content:this.partials.content,context:r,attrs:this.partials["extra-attributes"]||[],clickClose:this.get("clickClose"),noClickout:this.get("noClickout"),done:function(){t.set("popped",!1)}})}else this.set("__popped",!0)}else s?(f.shift("contents"),n()):this.set("__popped",!1).then(n)},defer:!0,init:!1},__popped:{handler:function(e){var t=this._transdone.resolve;if(e){var n=this.find("div"),i=n,r=i.offsetHeight+i.offsetTop,o=i.offsetWidth+i.offsetLeft,a=i.offsetParent;if(!this.overflows)for(var l=this.overflows={e:[],v:[]};n&&n.style;){if(n===a){if(n.offsetWidth>=o&&n.offsetHeight>=r)break;o+=n.offsetLeft,r+=n.offsetTop,a=n.offsetParent}var c=getComputedStyle(n);if("auto"===c.overflow)break;"hidden"===c.overflow&&(l.e.push(n),l.v.push(n.style.overflow),n.style.overflow="visible"),n=n.parentNode}this.position(),this.transition("pop",i,{intro:!0,dir:this.get("where")||"below"}).then(t)}else this.source=null,this.tailSource=null},defer:!0,init:!1},"align where tail fit":{handler:function(){this.position()},defer:!0}},decorators:{cleanup:function(e){var t=this;return{teardown:function(){var e=t.overflows;if(e){t.overflows=null;for(var n=0;n<e.e.length;n++)e.e[n].style.overflow=e.v[n]}}}}},data:function(){return{gap:4}}});var b=function(e){function t(t){e.call(this,t)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t}(t);function m(){}function h(e){~this.className.indexOf("focus")||(this.className+=" focus")}function g(e){this.className=this.className.replace(/\bfocus\b/g,"").trim()}function v(e){var t,n,i,r,o,a,l,c,s,f,p,d,u,b=this.getContext(e);function v(){var b=y().split(/\s+/).filter(function(e){return!!e});(t=!!~b.indexOf("field"))||(b.push("field"),t=!0),(n=e.querySelector("input[type=checkbox]"))&&!~b.indexOf("check")&&b.push("check"),(i=e.querySelector("input[type=radio]"))&&!~b.indexOf("radio")&&b.push("radio");var m=n||i;m&&m.checked&&!~b.indexOf("checked")&&b.push("checked"),m&&m.disabled&&!~b.indexOf("disabled")&&b.push("disabled"),!m&&f?(f.cancel(),f=0,p&&(p.disconnect(),p=0),delete m._form_callback,u&&(delete u.checked,d=u=void 0)):m&&(m._form_callback=function(t,n){if(void 0===n&&(n=!0),n&&"radio"===m.type&&m.name){var i=[];i.push.apply(i,document.querySelectorAll("input[type=radio][name="+m.name+"]")),(i=i.filter(function(e){return e!==m})).forEach(function(e){return e._form_callback&&e._form_callback(t,!1)})}var r=m.checked;r&&!~e.className.indexOf("checked")?e.className+=" checked":!r&&~e.className.indexOf("checked")&&(e.className=e.className.replace(/\bchecked\b/g,"").replace(/ +/g," ").trim())},MutationObserver&&(p=new MutationObserver(function(){var t;(t=m.disabled)&&!~e.className.indexOf("disabled")?e.className+=" disabled":!t&&~e.className.indexOf("disabled")&&(e.className=e.className.replace(/\bdisabled\b/g,"").replace(/ +/g," ").trim())})).observe(m,{attributes:!0}),f=this.getContext(m).listen("change",m._form_callback),(d=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(m),"checked"))&&d.configurable&&(u=m,Object.defineProperty(m,"checked",{get:d.get,set:function(e){d.set.call(u,e),m._form_callback()},enumerable:!0,configurable:!0}))),(r=!!e.querySelector("textarea"))&&!~b.indexOf("textarea")&&b.push("textarea"),(o=!!e.querySelector("select"))&&!~b.indexOf("select")&&b.push("select"),(a=!!e.querySelector("input[type=file]"))&&!~b.indexOf("file")&&b.push("file"),(l=!!(l=e.querySelector("button"))&&l.parentNode===e)&&!~b.indexOf("button")&&b.push("button"),(c=!!e.querySelector("div"))&&!~b.indexOf("plain")&&b.push("plain"),(s=!(n||i||a||!e.querySelector("input")))&&!~b.indexOf("input")&&b.push("input"),e.className=b.join(" ")}function y(){var f=e.className;return t||(f=f.replace(/\bfield\b/g,"").trim()),n||(f=f.replace(/\bcheck(ed)?\b/g,"").trim()),i||(f=f.replace(/\bradio\b/g,"").trim()),r||(f=f.replace(/\btextarea\b/g,"").trim()),o||(f=f.replace(/\bselect\b/g,"").trim()),a||(f=f.replace(/\bfile\b/g,"").trim()),l||(f=f.replace(/\bbutton\b/g,"").trim()),c||(f=f.replace(/\bplain\b/g,"").trim()),s||(f=f.replace(/\binput\b/g,"").trim()),f=f.replace(/ +/g," ")}var _=b.listen("focusin",h),x=b.listen("focusout",g);v.call(this);var w={update:m,invalidate:v.bind(this),teardown:function(){b.ractive.fire("fieldUnregistered",b,e,w);var t=y();t=t.replace(/\bfocus\b/g,"").trim(),_.cancel(),x.cancel(),f&&f.cancel(),p&&p.disconnect(),u&&(delete u.checked,d=u=void 0),e.className=t},setDisabled:function(t){e.querySelectorAll("input,button,select,textarea").forEach(function(e){return e.disabled=t}),this.invalidate()}};return b.ractive.fire("fieldRegistered",b,e,w),w}function y(e,t){if(!e)return!1;for(var n=0;n<e.length;n++){if(e[n].e===t)return!0;if(e[n].f&&y(e[n].f,t))return!0}return!1}t.extendWith(b,{template:{v:d.v,t:d.p.modal},data:function(){return{contents:[]}},use:[o(),c()],observe:{contents:function(e){s=(e||[]).length>0}},on:{init:function(){f?console.warn("More than one PopOver mobile host created."):f=this}}}),v.style=function(e){var t=Object.assign({},e("raui.primary"),e("raui.form.primary")),n=Object.assign({},e("raui.primary.active"),e("raui.form.primary.active")),i=Object.assign({},e("raui.primary.disabled"),e("raui.form.primary.disabled")),r=e("raui.form.boxy");return"\n label.field, .field-manual {\n display: inline-block;\n font-size: 0.9em;\n font-weight: 500;\n color: "+(t.fg||"#222")+";\n transition: 0.2s ease-in-out;\n transition-property: color;\n vertical-align: top;\n box-sizing: border-box;\n padding: 0.25em 0.5em;\n line-height: 1.5em;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-family: inherit;\n }\n\n label.field.textarea {\n display: block;\n border: 0.0625em solid "+(t.bc||"#ccc")+";\n padding: 0.5em 0.8em 0.8em 0.8em;\n border-radius: "+(t.radius||"0.2em")+";\n box-shadow: none;\n transition-property: color, border-color, box-shadow;\n margin: 0.8em 0.2em;\n min-height: auto;\n background-color: "+(r?t.bg||"#fff":"transparent")+";\n }\n\n label.field.focus {\n color: "+(n.fg||t.fga||"#07e")+";\n }\n\n label.field.textarea.focus {\n border-color: "+(n.fg||t.fga||"#07e")+";\n "+(r?"":"box-shadow: 0.0625em 0.0625em "+(n.fg||t.fga||"#07e")+",\n -0.0625em 0.0625em "+(n.fg||t.fga||"#07e")+",\n 0.0625em -0.0625em "+(n.fg||t.fga||"#07e")+",\n -0.0625em -0.0625em "+(n.fg||t.fga||"#07e")+";")+"\n }\n\n label.field input,\n label.field select,\n label.field textarea,\n .field-manual .field-body\n {\n display: block;\n border-width: "+(r?"0.0625em":"0 0 0.0625em 0")+";\n border-color: "+(t.bc||"#ccc")+";\n border-style: solid;\n box-sizing: border-box;\n background-color: "+(r?t.bg||"#fff":"transparent")+";\n transition: 0.2s ease-in-out;\n transition-property: box-shadow, color;\n outline: none;\n box-shadow: none;\n width: 100%;\n margin-bottom: 0.8em;\n font-size: 1.1em;"+(r?"\n border-radius: "+(t.radius||"0.2em")+";":"")+"\n font-weight: 400;\n font-family: inherit;\n }\n\n label.field input"+(r?"":":disabled")+",\n label.field select"+(r?"":":disabled")+" {\n padding: 0 0.75em;\n }\n label.field select"+(r?"":":disabled")+" {\n padding-right: 2em;\n }\n\n label.field input:disabled,\n label.field input[readonly],\n label.field select:disabled,\n label.field textarea:disabled,\n label.field textarea[readonly] {\n background: "+(i.bg||"#f4f4f4")+";\n color: "+(i.fg||"#444")+";\n }\n\n label.field textarea {\n line-height: 1.2em;\n }\n label.field .field-wrapper {\n display: block;\n }\n label.field > select, label.field > input,\n label.field > .field-wrapper > input, label.field > .field-wrapper > select {\n height: 2.5em;\n }\n\n "+(r?"":"label.field:hover > input,\n label.field:hover select,\n label.field.file:hover:after {\n box-shadow: 0 0.0625em 0 0 "+(t.bc||"#ccc")+";\n }\n\n label.field.textarea:hover {\n box-shadow: 0.0625em 0.0625em "+(t.bc||"#ccc")+",\n -0.0625em 0.0625em "+(t.bc||"#ccc")+",\n 0.0625em -0.0625em "+(t.bc||"#ccc")+",\n -0.0625em -0.0625em "+(t.bc||"#ccc")+";\n }\n\n label.field.textarea.focus:hover {\n box-shadow: 0.0625em 0.0625em "+(n.fg||t.fga||"#07e")+",\n -0.0625em 0.0625em "+(n.fg||t.fga||"#07e")+",\n 0.0625em -0.0625em "+(n.fg||t.fga||"#07e")+",\n -0.0625em -0.0625em "+(n.fg||t.fga||"#07e")+";\n }")+"\n\n /**** CHECK BOXES ****/\n\n label.field.check, label.field.radio {\n position:relative;\n z-index: 0;\n overflow: visible;\n cursor: pointer;\n padding-top: 2.2em;\n white-space: normal;\n }\n label.field.check.inline, label.field.radio.inline {\n padding-top: 0.7em;\n }\n\n label.field.check input, label.field.radio input {\n appearance: none;\n -moz-appearance: none;\n -webkit-appearance: none;\n z-index: -1;\n position: absolute;\n left: -0.5em;\n top: 1em;\n display: block;\n margin: 0;\n border-radius: 50%;\n width: 3.2em;\n height: 3.2em;\n background-color: "+(t.bc||"#ccc")+";\n box-shadow: none;\n outline: none;\n opacity: 0;\n transform: scale(1);\n pointer-events: none;\n transition: opacity 0.3s, transform 0.2s;\n }\n label.field.inline.check input, label.field.inline.radio input {\n top: -0.45em;\n left: -0.55em;\n }\n\n label.field.check input:checked, label.field.radio input:checked {\n background-color: "+(t.fga||"#07e")+";\n }\n\n label.field.check:hover > input, label.field.radio:hover > input {\n opacity: 0.04;\n }\n\n label.field.check input:focus, label.field.radio input:focus {\n opacity: 0.12;\n }\n\n label.field.check:hover > input:focus, label.field.radio:hover > input:focus {\n opacity: 0.16;\n }\n\n label.field.check input:active, label.field.radio input:active {\n opacity: 0.6;\n transform: scale(0);\n transition: transform 0s, opacity 0s;\n }\n\n label.field.check:before, label.field.radio:before {\n content: '';\n display: inline-block;\n box-sizing: border-box;\n margin: 0 0.5em 0.2em 0.1em;\n border: solid 0.125em; /* Safari */\n border-color: "+(t.fg||"#222")+';\n border-radius: 0.125em;\n width: 1.2em;\n height: 1.2em;\n vertical-align: bottom;\n transition: border-color 0.2s, background-color 0.2s;\n }\n\n label.field.check:after, label.field.radio:after {\n content: \'\';\n display: inline-block;\n opacity: 0;\n position: absolute;\n width: 1.2em;\n height: 1.2em;\n top: 2.3em;\n left: 0.6em;\n border-radius: 0.125em;\n }\n label.field.check.inline:after, label.field.radio.inline:after {\n top: 0.8em;\n }\n\n label.field.check.checked:after {\n opacity: 1;\n background: no-repeat center/80% url(\'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="'+(t.bg||"#fff").replace(/#/g,"%23")+'" d="m 15.378906,1.7050781 a 1.0583349,1.0583349 0 0 0 -1.478515,0.234375 L 6.6210937,11.960938 1.8652344,8.5058594 a 1.0583349,1.0583349 0 0 0 -1.47851565,0.234375 1.0583349,1.0583349 0 0 0 0.234375,1.4785156 L 6.234375,14.294922 A 1.0584408,1.0584408 0 0 0 7.7128906,14.060547 L 15.613281,3.1835938 A 1.0583349,1.0583349 0 0 0 15.378906,1.7050781 Z" /></svg>\') '+(t.fga||"#07e")+';\n }\n\n label.field.radio.checked:after {\n opacity: 1;\n background: no-repeat center/80% url(\'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><circle fill="'+(t.bg||"#fff").replace(/#/g,"%23")+'" cx="8" cy="8" r="5" /></svg>\') '+(t.fga||"#07e")+";\n }\n\n label.field.check.checked:before, label.field.radio.checked:before {\n border-color: "+(t.fga||"#07e")+";\n }\n label.field.check.focus:before, label.field.radio.focus:before {\n border-color: "+(t.fga||"#07e")+";\n }\n\n label.field.check input:disabled, label.field.radio input:disabled {\n opacity: 0;\n }\n\n label.field.check.disabled, label.field.radio.disabled {\n color: "+(i.fg||"#444")+";\n cursor: initial;\n }\n\n label.field.check.disabled:before, label.field.radio.disabled:before {\n border-color: "+(i.bc||"#ccc")+";\n background-color: "+(i.bg||"#f4f4f4")+";\n }\n\n label.field.check.checked.disabled:after, label.field.radio.checked.disabled:after {\n border-color: transparent;\n background-color: "+(i.bc||"#ccc")+";\n }\n\n label.field select {\n padding-right: 2em;\n }\n\n label.field.select {\n cursor: pointer;\n position: relative;\n }\n\n label.field.select:after {\n content: ' ';\n position: absolute;\n display: block;\n width: 0.6em;\n right: 1.125em;\n height: 0.6em;\n top: 2.6em;\n border-bottom: 0.125em solid;\n border-right: 0.125em solid;\n transform: rotate(45deg);\n pointer-events: none;\n color: "+(t.bc||"#ccc")+";\n }\n\n label.field textarea {\n border: none;"+(r?"\n padding: 0;":"")+"\n }\n\n label.field > select {\n -moz-appearance: none;\n -webkit-appearance: none;\n }\n\n label.field input:focus,\n label.field select:focus,\n label.field.file.focus:after\n {\n border-color: "+(n.fg||t.fga||"#07e")+";\n "+(r?"":"box-shadow: 0 0.0625em 0 0 "+(n.fg||t.fga||"#07e")+";")+"\n }\n\n label.field input[type=checkbox]:focus,\n label.field input[type=radio]:focus {\n box-shadow: none;\n }\n\n label.field.file.focus:after {\n color: "+(n.fg||t.fga||"#07e")+";\n }\n label.field.file [type=file] {\n position: absolute;\n width: 0;\n height: 0;\n opacity: 0;\n z-index: -1;\n }\n label.field.file {\n position: relative;\n min-width: 9em;\n height: 5em;\n }\n label.field.file:after {\n position: absolute;\n content: 'Choose a file';\n box-sizing: border-box;\n width: calc(100% - 0.3em);\n height: 2.5em;\n font-size: 1.1em;\n line-height: 1.5em;\n color: "+(t.fg||"#222")+";\n text-align: "+(r?"center":"left")+";\n padding: 0.5em "+(r?"0.5em":"0")+";\n cursor: pointer;\n font-style: oblique;\n left: 0.25em;\n top: 1.6em;\n transition: 0.2s ease-in-out;\n transition-property: color, border-bolor, box-shadow;"+(r?"\n border-radius: "+(t.radius||"0.2em")+";\n border-color: "+(t.bc||"#ccc")+";\n border-style: solid;\n border-width: 0.0625em;":"\n border-bottom-color: "+(t.bc||"#ccc")+";\n border-bottom-width: 0.0625em;\n border-bottom-style: solid;\n ")+"\n }\n label.field.file.inline:after {\n top: 0.2em;\n }\n\n label.field.button {\n vertical-align: top;\n padding-top: "+(r?"1.7":"1.958")+"em;\n }\n label.field .with-buttons button, label.field.button button {\n font-size: 1.1em;\n margin-top: "+(r?"0.15em":"0")+";\n }\n\n label.field .field-wrapper.with-buttons {\n display: flex;\n }\n label.field .with-buttons button {\n flex-shrink: 0;\n padding-left: 0.5em;\n padding-right: 0.5em;\n margin-top: 0;\n margin-right: 0;\n "+(r?"height: 2.5em;\n box-shadow: none;\n border-radius: 0;\n border-left: 1px solid "+(t.bg||"#fff")+";\n margin-left: 0;":"height: 2.25em;")+"\n }"+(r?"\n label.field .with-buttons button:first-of-type {\n margin-left: -0.05em;\n border-left: none;\n }\n label.field .with-buttons button:last-of-type {\n border-radius: 0 "+(t.radius||"0.2em")+" "+(t.radius||"0.2em")+" 0;\n }\n label.field .with-buttons input {\n border-radius: "+(t.radius||"0.2em")+" 0 0 "+(t.radius||"0.2em")+";\n min-width: 0;\n }\n ":"")+"\n\n label.field.plain > div {\n position: absolute;\n font-size: 1.1em;\n top: 2.4em;\n font-weight: normal;\n }\n\n /* inline fields (no labels) */\n label.field.inline {\n height: 3.3em;\n }\n\n label.field.button.inline {\n margin-top: 0.2em;\n padding-top: 0.12em;\n }\n\n label.field.button.inline button {\n margin-top: 0;\n }\n\n label.field.inline.select:after {\n top: 1."+(r?"15":"1")+"em;\n }\n\n label.field .field-tip {\n display: inline-block;\n width: 1em;\n height: 1em;\n background-color: "+(t.fga||"#07e")+";\n color: "+(t.bg||"#fff;")+";\n cursor: default;\n user-select: none;\n border-radius: 1em;\n margin-left: 0.5em;\n line-height: 1.2em;\n text-align: center;\n margin-top: -0.2em;\n }\n\n label.field .field-solo-tip {\n margin-left: -0.1em;\n }\n "};var _=t.macro(function(e){var t=[],n=(e.template.m||[]).slice(),i=e.template.f||[],r=n.find(function(e){return"value"===e.n}),o=n.find(function(e){return"type"===e.n}),a=n.find(function(e){return"tip"===e.n}),l=n.find(function(e){return"disabled"===e.n});if(a&&n.splice(n.indexOf(a),1),o&&"function"==typeof _.types[o.f])t.push.apply(t,_.types[o.f](n,i,e));else if(r){var c={t:7,e:"input",m:[r]};if(l&&c.m.push(l),y(i,"option")&&(c.e="select",c.f=i),o&&(c.m.push(o),"checkbox"===o.f||"radio"===o.f)){var s=n.find(function(e){return"target"===e.n});s?c.m.push(Object.assign({},s,{n:"name"})):c.m.splice(c.m.indexOf(r),1,Object.assign({},r,{n:"checked"}))}c.m=c.m.concat(n.filter(function(e){return 73===e.t||73===e.t||"placeholder"===e.n})),t.push(c);var f=i.filter(function(e){return"button"===e.e||y(e.f,"button")});f.length&&(t.push.apply(t,f),t=[{t:7,e:"span",m:[{t:13,n:"class",f:"field-wrapper with-buttons",g:1}],f:t}])}else{var p=i.filter(function(e){return e.e});p.find(function(e){return"button"===e.e})&&p.length>1?t=[{t:7,e:"span",m:[{t:13,n:"class",f:"field-wrapper with-buttons",g:1}],f:i}]:t.push.apply(t,i)}var d=n.find(function(e){return"label"===e.n});a&&t.unshift({t:7,e:"span",m:[{t:13,n:"class",f:"field-tip"+(d?"":" field-solo-tip"),g:1},{t:13,n:"title",f:a.f},{t:70,n:["click"],f:{r:[],s:"[false]"}}],f:"?"});var u=n.find(function(e){return"inline"===e.n});d&&!u?t.unshift.apply(t,Array.isArray(d.f)?d.f:[d.f]):u||t.unshift(" ");var b={t:7,e:"label",m:[{t:71,n:"field"}].concat(n.filter(function(e){return 13!==e.t&&73!==e.t||"value"!==e.n&&"type"!==e.n&&"inline"!==e.n&&"label"!==e.n&&"placeholder"!==e.n&&"target"!==e.n&&"disabled"!==e.n})),f:t};u&&b.m.push({t:13,n:"class",f:"inline"}),e.setTemplate([b])});function x(e){return"function"==typeof e.focus&&e.focus(),{teardown:m}}_.types={},i("field","decorators",v),i("field","partials",_),i("autofocus","decorators",x);var w={v:4,t:[{t:7,e:"span",m:[{t:13,n:"class",f:"rautocomplete field-wrapper",g:1},{n:["pop"],t:70,f:{r:["@context","$1"],s:'[(_0).set("rac.pop",_1)]'}}],f:[{t:7,e:"input",m:[{t:8,r:"extra-attributes"},{n:["dblclick"],t:70,f:{r:["rac.pop","@node"],s:"[_0.show(_1)]"}},{n:["focus"],t:70,f:{r:["rac"],s:"[_0.stash()]"}},{n:["blur"],t:70,f:{r:["rac","@node"],s:"[_0.checkBlur(_1)]"}},{n:["input"],t:70,f:{r:["rac","@event"],s:"[_0.input(_1)]"}},{n:["keydown"],t:70,f:{r:["rac","@event"],s:"[_0.key(_1)]"}},{t:73,v:"t",f:"false"},{n:"value",f:[{t:2,r:"rac.display"}],t:13}]}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rac-drop",g:1},{n:["click"],t:70,f:{r:["rac.pop","@context"],s:'[_0.show((_1).find("input"))]'}}]}," ",{t:7,e:"rac-pop",m:[{t:13,n:"style",f:"padding: 0;",g:1},{t:13,n:"class",f:"rac-pop",g:1},{n:["init"],t:70,f:{r:["@context","$1"],s:'[(_0).raise("pop",{},_1)]'}},{n:"popped",t:13,f:[{t:2,r:"rac.popped"}]},{n:"where",f:"below",t:13,g:1},{n:"align",f:"end",t:13,g:1},{n:"gap",f:[{t:2,x:{r:[],s:"2"},s:1}],t:13},{n:"offsets",t:13,f:[{t:2,r:"rac.offsets"}]},{n:"fit",t:13,f:[{t:2,r:"rac.fit"}]}],f:[{t:4,f:[{t:7,e:"input",m:[{n:"class-rac-modal",t:13},{n:["input"],t:70,f:{r:["rac","@event"],s:"[_0.input(_1)]"}},{n:["keydown"],t:70,f:{r:["rac","@event"],s:"[_0.key(_1)]"}},{t:73,v:"t",f:"false"},{n:"value",f:[{t:2,r:"rac.display"}],t:13},{n:["blur"],t:70,f:{r:["rac"],s:"[_0.checkBlur()]"}},{n:"autocompletefocus",t:71}]}],n:50,r:"inModal"}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rac-list",g:1},{n:"tabindex",f:"-1",t:13,g:1}],f:[{t:55,f:[{f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rac-item rac-invalid",g:1}],f:["Loading..."]}],t:4},{t:62,f:[" ",{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rac-item",g:1},{n:"tabindex",f:"-1",t:13,g:1},{t:4,f:[{n:"class-rac-selected",t:13,f:[{t:2,x:{r:["rac.value","."],s:"_0===_1"}}]}],n:50,r:"rac.valueBound"},{n:"class-rac-hover",t:13,f:[{t:2,x:{r:["rac.selected","@index"],s:"_0===_1"}}]},{t:4,f:[{n:["click"],t:70,f:{r:["@context",".","rac"],s:'[(_0).set("rac.value",_1),_2._drawDisplay()]'}},{n:["mouseover"],t:70,f:{r:["@context","@index"],s:'[(_0).set("rac.selected",_1)]'}}],n:50,r:"rac.popped"}],f:[{t:2,x:{r:["rac","."],s:"_0._display(_1)"}}]}],n:52,r:"items"}," "],n:"items"},{t:63,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rac-item rac-invalid",g:1}],f:["Load failed."]}]}],r:"rac.list"}]}]}]}],e:{2:function(){return 2},'[(_0).set("rac.pop",_1)]':function(e,t){return[e.set("rac.pop",t)]},"[_0.show(_1)]":function(e,t){return[e.show(t)]},"[_0.stash()]":function(e){return[e.stash()]},"[_0.checkBlur(_1)]":function(e,t){return[e.checkBlur(t)]},"[_0.input(_1)]":function(e,t){return[e.input(t)]},"[_0.key(_1)]":function(e,t){return[e.key(t)]},'[_0.show((_1).find("input"))]':function(e,t){return[e.show(t.find("input"))]},'[(_0).raise("pop",{},_1)]':function(e,t){return[e.raise("pop",{},t)]},"[_0.checkBlur()]":function(e){return[e.checkBlur()]},"_0===_1":function(e,t){return e===t},'[(_0).set("rac.value",_1),_2._drawDisplay()]':function(e,t,n){return[e.set("rac.value",t),n._drawDisplay()]},'[(_0).set("rac.selected",_1)]':function(e,t){return[e.set("rac.selected",t)]},"_0._display(_1)":function(e,t){return e._display(t)}}};function k(e,t){return t.reduce(function(e,t){return e?e[t]:e},e)}var T=["INPUT","SELECT","TEXTAREA","BUTTON","BODY"],L=t.macro(function(e){var n,i,r;function o(t){null==t&&(t=null==e.get("rac.value")?"":e.get("rac.display")),t===e.get("rac.tempDisplay")&&(t="");var n=e.get("rac._items");if("function"==typeof n){var i=n(t);"object"==typeof i&&"function"==typeof i.then?i.then(function(t){return e.set("rac.list",t)}):e.set("rac.list",i)}else if(Array.isArray(n)){var r,o=e.get("rac._display");try{r=new RegExp(t||"","i")}catch(e){r=new RegExp((t||"").replace(/([\{\(\[\]\)\}\?\*\^\$])/g,"\\$1"))}e.set("rac.list",n.filter(function(e){return r.test(o(e))}))}else e.set("rac.list",[])}function a(t,n){var i=e.get("rac.default");return null==(t=null!=t||n?t:e.get("rac.value"))&&i&&(t="function"==typeof i?i(e.get("rac.display")):i),t}function l(n,r,l){var s=e.get("rac.displayprop");if(e.get("rac.__display")!==s||void 0===e.get("rac._display")){var f=function(){return e.attributes["display-value"]?e.get("rac.display"):"(none)"};if("string"==typeof s){var p=t.splitKeypath(s);s=function(e){return null==e&&(e=a()),null==e?f():k(e,p)}}else if(Array.isArray(s)){var d=s;s=function(e){return null==e&&(e=a()),null==e?f():k(e,d)}}else s||(s=function(e){return null==e&&(e=a()),null==e?f():""+e});e.set("rac._display",s),e.set("rac.__display",e.get("rac.displayprop")),e.set("rac.display",s(e.get("rac.value")))}if(s=e.get("rac.member"),e.get("rac.__member")!==s||void 0===e.get("rac._member")){if("string"==typeof s){var u=t.splitKeypath(s);s=function(e){return k(a(e),u)}}else if(Array.isArray(s)){var b=s;s=function(e){return k(a(e),b)}}else s||(s=function(e){return a(e)});e.set("rac._member",s),e.set("rac.__member",e.get("rac.member"))}s=e.get("rac.items"),e.get("rac.__items")===s&&void 0!==e.get("rac._items")||(Array.isArray(s)?e.set("rac._items",s):"function"==typeof s?e.set("rac._items",s):"object"==typeof s&&"function"==typeof s.then?s.then(function(t){e.set("rac._items",t),o()}):e.set("rac._items",[]),e.set("rac.__items",e.get("rac.items"))),i&&"rac.display"===l&&e.get("rac.limit")&&!i.contains(document.activeElement)&&c(),o()}function c(){var t=e.get("rac._display");if("function"==typeof t){var n=t(e.get("rac.value"));e.set("rac.display",n),e.set("rac.tempDisplay",n)}}function s(t){(t.items&&e.link(t.items,"rac.items"),t.value&&e.link(t.value,"rac._value"),e.set("rac.valueBound",!!t.value),t.selected&&e.link(t.selected,"rac.selected"),t["display-value"]&&e.link(t["display-value"],"rac.display"),"display"in t&&e.set("rac.displayprop",t.display),"member"in t&&e.set("rac.member",t.member),"offsets"in t?(e.set("rac.offsets",t.offsets),e.set("rac.fit",!("fit"in t)||t.fit)):e.set("rac.fit","fit"in t&&t.fit),e.set("rac.limit",t["limit-set"]),e.set("rac.default",t.default),e.get("rac.limit")&&e.get("input"))&&(e.get("input")!==document.activeElement&&c());l()}e.aliasLocal("rac"),e.set("rac.list",[]),e.set("rac.popped",!1),e.set("rac.stash",function(){e.set("rac.tempDisplay",e.get("rac.display")),e.set("rac.tempValue",e.get("rac.value"))}),e.set("rac.key",function(t){var n=t.which;if(27===n)e.set("rac.popped",!1),e.set("rac.display",e.get("rac.tempDisplay")),e.set("rac.value",e.get("rac.tempValue"));else if(38===n||40===n){t.preventDefault(),e.get("rac.pop").show(e.find("input"));var i=e.get("rac.selected"),r=e.get("rac.list");38===n?i<=0||null==i?e.set("rac.selected",Array.isArray(r)?r.length-1:0):e.set("rac.selected",i-1):Array.isArray(r)?e.set("rac.selected",i<r.length-1?i+1:0):e.set("rac.selected",0)}else if(10===n||13===n){var o=e.get("rac.list");Array.isArray(o)&&(e.set("rac.value",o[e.get("rac.selected")]),c())}else if(9===n){if(e.get("rac.popped")){var l=e.get("rac.list");if(Array.isArray(l)){var s=l[e.get("rac.selected")];null==s&&(s=a(s,!0)),e.set("rac.value",s)}e.get("rac.limit")||setTimeout(function(){return c()},140)}else null!=e.get("rac.value")&&~e.get("rac.selected")&&e.get("rac.display")==e.get("rac.tempDisplay")||e.set("rac.value",a(null,!0));e.set("rac.popped",!1),e.get("rac.updateDisplay")()}}),e.set("rac.input",function(t){n&&clearTimeout(n),n=setTimeout(function(){n=null,o(t.target.value);var i=e.find("input");i&&document.activeElement===i&&e.get("rac.pop").show(i)},500),e.attributes.lazy||e.set("rac.display",t.target.value)}),e.setTemplate(w),e.set("rac._drawDisplay",c),e.set("rac.updateDisplay",function(t){setTimeout(function(){i&&e.get("rac.limit")&&!i.contains(document.activeElement)&&c()},140)}),s(e.attributes);var f={init:!1,defer:!0},p=[e.observe("rac.displayprop",l,f),e.observe("rac.memberprop",l,f),e.observe("rac.items",l,f),e.observe("rac.list",function(t){Array.isArray(t)?e.set("rac.selected",t.indexOf(e.get("rac.value"))):e.set("rac.selected",-1)},f),e.observe("rac.value",function(t){c(),function(){if(!e.get("rac._value")||e.get("rac.value")){var t=e.get("rac._member");if("function"==typeof t){var n=t(e.get("rac.value"));e.set("rac._value",n)}e.ractive.getContext(e.find("input")).raise("selected",{},e.get("rac._value"),e.get("rac.display"))}}(),e.set("rac.popped",!1),e.set("rac.tempValue",t)}),e.observe("rac._value",function(t){var n=e.get("rac._member"),i=e.get("rac.list").find(function(e){return n(e)===t});i!==e.get("rac.value")&&e.set("rac.value",i),!i&&null!=t&&e.get("rac.valueBound")&&(e.set("rac.display",t),l())}),e.observe("rac.selected",function(){r&&clearTimeout(n),r=setTimeout(function(){r=null;var t=e.find(".rac-hover");t&&t.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})},14)})];return e.set("rac.checkBlur",function(t){var n=document.activeElement;if(~T.indexOf(n.nodeName)||n.getAttribute("tabindex")){var i=e.findAll("input");document.activeElement&&!~i.indexOf(document.activeElement)&&e.get("rac.key")({which:9})}}),{teardown:function(){e.unlink("rac.items"),e.unlink("rac._value"),e.unlink("rac.selected"),e.unlink("rac.display"),p.forEach(function(e){return e.cancel()})},update:s,render:function(){i=e.find("span")}}},{attributes:["items","selected","display","value","member","limit-set","fit","offsets","display-value","default"],css:function(e){return[function(e){var t=Object.assign({},e("raui.primary"),e("raui.autocomplete"),e("raui.autocomplete.primary")),n=Object.assign({},e("raui.autocomplete.drop"),e("raui.autocomplete.primary.drop"));return".rautocomplete {\n position: relative;\n display: inline-block;\n }\n \n .rac-drop {\n width: 2em;\n height: 100%;\n position: absolute;\n top: 0;\n right: 2px;\n cursor: pointer;\n }\n .rac-drop:after {\n font-family: "+(n.font||"sans-serif")+";\n content: "+(n.string||"'▾'")+";\n position: absolute;\n top: calc(50% - 0.5em);\n height: 1em;\n line-height: 1em;\n width: 100%;\n text-align: center;\n font-weight: "+(n.weight||"normal")+";\n color: "+(n.color||t.bc||"#ccc")+";\n }\n \n .rac-pop {\n min-width: 100%;\n }\n \n .rac-pop > .rpop {\n padding: 0;\n }\n \n .rac-list {\n display: flex;\n flex-direction: column;\n max-height: 50vh;\n min-height: 2.125em;\n max-width: 100%;\n overflow: auto;\n }\n \n .rac-item {\n color: "+(t.fg||"#222")+";\n background-color: "+(t.bg||"#fff")+";\n padding: 0.25em;\n cursor: pointer;\n }\n \n .rac-selected {\n color: "+(t.bg||"#fff")+";\n background-color: "+(t.fga||"#07e")+";\n }\n \n .rac-hover {\n color: "+(t.fg||"#222")+";\n background-color: "+(t.bc||"#ccc")+";\n }\n \n .rac-selected.rac-hover {\n background-color: "+(t.bc||"#ccc")+";\n color: "+(t.fga||"#07e")+";\n }\n \n .rac-invalid {\n cursor: not-allowed;\n }\n \n input.rac-modal {\n width: 100%;\n box-sizing: border-box;\n }"}.call(this,e)].join(" ")},cssId:"rautocomplete",noCssTransform:!0});function O(e){return void 0===e&&(e={}),function(t){var n=t.instance;n.partials[e.name||"autocomplete"]=L,n.components["rac-pop"]=u,n.decorators.autocompletefocus=x}}e.Autocomplete=L,e.FieldType=function(e){return void 0===e&&(e={}),function(t,n,i){return[{t:7,e:e.name||"autocomplete",m:t,f:n}]}},e.plugin=O,e.default=O,Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("ractive")):"function"==typeof define&&define.amd?define(["exports","ractive"],t):t(e.RauiAutocomplete={},e.Ractive)}(this,function(e,t){"use strict";t=t&&t.hasOwnProperty("default")?t.default:t;var n="undefined"!=typeof window?window:null;function i(e,t,i){if(n&&n.Ractive&&"object"==typeof n.Ractive[t]){var r=document.currentScript;if(r||(r=(r=document.querySelectorAll("script"))[r.length-1]),r){var o=r.getAttribute("data-alias");o&&(o=(o=o.split("&")).reduce(function(e,t){var n=t.split("="),i=n[0],r=n[1];return e[i]=r,e},{})),Ractive[t][o&&o[e]||e]=i}}}function r(e,t){void 0===t&&(t={});var n=e.processParams(t,{duration:400,easing:"easeInOut"});t.dir=t.dir||!1;var i=t.distance||"20px",r=t.scale||"0.9",o="above"===t.dir?"translateY("+i+")":"left"===t.dir?"translateX("+i+")":"right"===t.dir?"translateX(-"+i+")":"translateY(-"+i+")";return e.isIntro||n.intro?(e.setStyle("opacity",0),e.setStyle("transform","scale("+r+") "+o),e.animateStyle({opacity:1,transform:"none"},n)):(e.setStyle("opacity",1),e.setStyle("transform","none"),e.animateStyle({opacity:0,transform:"scale("+r+") "+o},n))}function o(e){return void 0===e&&(e={}),function(t){t.instance.transitions[e.name||"pop"]=r}}function a(e,t){var n=!1,i=!1;function r(n){for(var i=n.target;i;){if(i===e)return;if(!i.parentNode&&i!==document)return;i=i.parentNode}t(n)}return setTimeout(function(){n=!0,i||(document.body.addEventListener("click",r,{capture:!0}),document.body.addEventListener("touchstop",r,{capture:!0}))}),{teardown:function(){i=!0,n&&(document.body.removeEventListener("click",r,{capture:!0}),document.body.removeEventListener("touchstop",r,{capture:!0}))}}}function l(e,t){var n=e.processParams(t,{duration:200,easing:"easeInOut"});return e.isIntro||n.intro?(e.setStyle("opacity",0),e.animateStyle("opacity",1,n)):(e.setStyle("opacity",1),e.animateStyle("opacity",0,n))}function c(e){return void 0===e&&(e={}),function(t){t.instance.transitions[e.name||"fade"]=l}}i("pop","transitions",r),i("fade","transitions",l);var s,f,p,d={v:4,t:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rpop-wrapper",g:1},{n:"class-rpop-with-tail",t:13,f:[{t:2,r:"position.tail"}]},{n:"class",f:["rpop-",{t:2,x:{r:["where"],s:'_0||"below"'}}," rpop-align-",{t:2,x:{r:["align"],s:'_0||"middle"'}}],t:13},{t:4,f:[{n:"style-top",f:[{t:2,r:"position.popTop"},"px"],t:13},{n:"style-left",f:[{t:2,r:"position.popLeft"},"px"],t:13}],n:50,r:"position"},{t:4,f:[{t:4,f:[{n:"style-top",f:[{t:2,r:"top"}],t:13}],n:50,r:"top"},{t:4,f:[{n:"style-left",f:[{t:2,r:"left"}],t:13}],n:50,r:"left"}],n:51,l:1},{n:"pop",t:72,f:{r:["where"],s:'[{dir:_0||"below"}]'},v:"t2"},{n:"cleanup",t:71},{t:4,f:[{n:["click"],t:70,f:{r:["@this"],s:'[_0.set("popped",false)]'}}],n:50,r:"clickClose"},{t:4,f:[{n:["clickout"],t:70,f:{r:["@this"],s:'[_0.set("popped",false)]'}}],n:51,r:"noClickout"},{t:16,r:"extra-attributes"}],f:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rpop-tail",g:1},{t:4,f:[{n:"style-top",f:[{t:2,x:{r:["position.tailTop","position.vert"],s:"_0+(_1?3:0)"}},"px"],t:13}],n:50,x:{r:["position.tailTop"],s:"_0!=null"}},{t:4,f:[{n:"style-bottom",f:[{t:2,x:{r:["position.tailBottom","position.vert"],s:"_0+(_1?3:0)"}},"px"],t:13}],n:50,x:{r:["position.tailBottom"],s:"_0!=null"}},{t:4,f:[{n:"style-left",f:[{t:2,x:{r:["position.tailLeft","position.vert"],s:"_0+(_1?0:3)"}},"px"],t:13}],n:50,x:{r:["position.tailLeft"],s:"_0!=null"}},{t:4,f:[{n:"style-right",f:[{t:2,x:{r:["position.tailRight","position.vert"],s:"_0+(_1?0:3)"}},"px"],t:13}],n:50,x:{r:["position.tailRight"],s:"_0!=null"}}]}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rpop-tail-outer",g:1},{t:4,f:[{n:"style-top",f:[{t:2,x:{r:["position.tailTop"],s:"_0-2"}},"px"],t:13}],n:50,x:{r:["position.tailTop"],s:"_0!=null"}},{t:4,f:[{n:"style-bottom",f:[{t:2,x:{r:["position.tailBottom"],s:"_0-2"}},"px"],t:13}],n:50,x:{r:["position.tailBottom"],s:"_0!=null"}},{t:4,f:[{n:"style-left",f:[{t:2,x:{r:["position.tailLeft"],s:"_0-2"}},"px"],t:13}],n:50,x:{r:["position.tailLeft"],s:"_0!=null"}},{t:4,f:[{n:"style-right",f:[{t:2,x:{r:["position.tailRight"],s:"_0-2"}},"px"],t:13}],n:50,x:{r:["position.tailRight"],s:"_0!=null"}}]}],n:50,r:"~/tail"}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rpop",g:1}],f:[{t:16,r:"content",z:[{n:"trigger",x:{r:"triggerContext"}}]}]}]}],n:50,r:"__popped"}],e:{'_0||"below"':function(e){return e||"below"},'_0||"middle"':function(e){return e||"middle"},'[{dir:_0||"below"}]':function(e){return[{dir:e||"below"}]},'[_0.set("popped",false)]':function(e){return[e.set("popped",!1)]},"_0+(_1?3:0)":function(e,t){return e+(t?3:0)},"_0!=null":function(e){return null!=e},"_0+(_1?0:3)":function(e,t){return e+(t?0:3)},"_0-2":function(e){return e-2},"[{delay:200}]":function(){return[{delay:200}]},"[_0===_1&&_2.done(),true]":function(e,t,n){return[e===t&&n.done(),!0]},"[_0.done()]":function(e){return[e.done()]},true:function(){return!0}},p:{modal:[{t:4,f:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rpop-modal",g:1},{n:"fade",t:72,v:"t1"},{n:"fade",t:72,f:{r:[],s:"[{delay:200}]"},v:"t2"},{t:4,f:[{n:["click"],t:70,f:{r:["@node","@event.target","."],s:"[_0===_1&&_2.done(),true]"}}],n:51,r:".noClickout"}],f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rpop",g:1},{n:"pop",t:72,f:{r:[],s:"[{delay:200}]"},v:"t1"},{n:"pop",t:72,v:"t2"},{t:4,f:[{n:["click"],t:70,f:{r:["."],s:"[_0.done()]"}}],n:50,r:".clickClose"},{t:8,r:".attrs",c:{r:".context"},z:[{n:"inModal",x:{x:{r:[],s:"true"}}}]}],f:[{t:8,r:".content",c:{r:".context"},z:[{n:"inModal",x:{x:{r:[],s:"true"}}}]}]}]}],n:54,r:"contents.0"}],n:50,r:"contents.length"}]}},u=function(e){function t(t){e.call(this,t)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.position=function(t){var n=t||this.source,i=this.get("popped");if(n&&i){var r=this.find("div");if(n&&r&&r.offsetParent){n?this.set("triggerContext",e.getContext(n)):this.set("triggerContext",null);var o=r.offsetParent,a=o.getBoundingClientRect(),l=r.getBoundingClientRect(),c=n.getBoundingClientRect(),s=this.get("where")||"below",f=this.get("align")||"middle",p=this.get("tail"),d="above"===s||"below"===s,u=this.get("fit"),b=this.get("gap"),m="above"===s||"below"===s?0:"left"===s?-l.width-b:c.width+b,h="left"===s||"right"===s?-c.height:"above"===s?-c.height-l.height-b:b;"middle"===f?"below"===s||"above"===s?m-=(l.width-c.width)/2:"left"!==s&&"right"!==s||(h-=(l.height-c.height)/2):"end"===f&&("below"===s||"above"===s?m+=c.width-l.width:"left"!==s&&"right"!==s||(h+=c.height-l.height));var g={popTop:c.bottom-a.top+h,popLeft:c.left-a.left+m,tail:p,vert:"above"===s||"below"===s};if(o.scrollTop&&(g.popTop+=o.scrollTop),o.scrollLeft&&(g.popLeft+=o.scrollLeft),p){"above"===s?g.tailBottom=-10:"below"===s?g.tailTop=-10:"left"===s?g.tailRight=-10:"right"===s&&(g.tailLeft=-10);var v=this.tailSource?this.tailSource.getBoundingClientRect():c;"start"===f?d?g.tailLeft=Math.floor(v.width/2)-10:g.tailTop=Math.floor(v.height/2)-10:"end"===f?d?g.tailRight=Math.floor(v.width/2)-10:g.tailBottom=Math.floor(v.height/2)-10:"middle"===f&&(d?g.tailLeft=Math.floor(v.width/2)-10:g.tailTop=Math.floor(v.height/2)-10),v!==c?d?(null!=g.tailLeft&&(g.tailLeft+=v.left-c.left),null!=g.tailRight&&(g.tailRight+=c.right-v.right)):(null!=g.tailTop&&(g.tailTop+=v.top-c.top),null!=g.tailBottom&&(g.tailBottom+=c.bottom-v.bottom)):"middle"===f&&(d?(null!=g.tailLeft&&(g.tailLeft+=v.left-(g.popLeft+a.left)),null!=g.tailRight&&(g.tailRight+=g.popLeft+a.left+l.width-v.right)):(null!=g.tailTop&&(g.tailTop+=v.top-(g.popTop+a.top)),null!=g.tailBottom&&(g.tailBottom+=g.popTop+a.top+l.height-v.bottom)))}if(u){var y=o;if(this.get("offsets"))for(var x=this.get("offsets");x--;)y=y.offsetParent;var _=o.scrollWidth,w=o.scrollHeight;if(g.popLeft+l.width>_){var k=g.popLeft-(_-l.width);g.popLeft-=k,d&&g.tailLeft&&(g.tailLeft+=k),d&&g.tailRight&&(g.tailRight-=k),p&&!d&&(g.tail=!1)}if(g.popLeft<0){var T=-1*g.popLeft;g.popLeft+=T,d&&g.tailLeft&&(g.tailLeft-=T),d&&g.tailRight&&(g.tailRight+=T),p&&!d&&(g.tail=!1)}if(g.popTop+l.height>w){var L=g.popTop-(w-l.height);g.popTop-=L,!d&&g.tailTop&&(g.tailTop+=L),!d&&g.tailBottom&&(g.tailBottom-=L),p&&d&&(g.tail=!1)}if(g.popTop<0){var O=-1*g.popTop;g.popTop+=O,!d&&g.tailTop&&(g.tailTop-=O),!d&&g.tailBottom&&(g.tailBottom+=O),p&&d&&(g.tail=!1)}}if(a.left+g.popLeft<0){var B=0-(a.left+g.popLeft);g.popLeft+=B,d&&g.tailLeft&&(g.tailLeft-=B),d&&g.tailRight&&(g.tailRight+=B),p&&!d&&(g.tail=!1)}if(a.top+g.popTop<0){var A=0-(a.top+g.popTop);g.popTop+=A,!d&&g.tailTop&&(g.tailTop-=A),!d&&g.tailBottom&&(g.tailBottom+=A),p&&d&&(g.tail=!1)}g.tailLeft&&(g.tailLeft=Math.floor(g.tailLeft)),g.tailRight&&(g.tailRight=Math.floor(g.tailRight)),g.tailTop&&(g.tailTop=Math.floor(g.tailTop)),g.tailBottom&&(g.tailBottom=Math.floor(g.tailBottom)),this.set("position",g)}else this.set("position",null)}},t.prototype.show=function(e){return this.source=e,this.set("popped",!0),this._transdone},t.prototype.hide=function(){return this.set("popped",!1),this._transdone},t.prototype.popFind=function(e){return s?f.find(e):this.find(pattenr)},t.prototype.popFindAll=function(e){return s?f.findAll(e):this.findAll(pattenr)},t}(t);t.extendWith(u,{attributes:["popped","tail","where","align","top","left","fit","clickClose","noClickout","gap","offsets"],use:[o(),(void 0===p&&(p={}),function(e){e.instance.events[p.name||"clickout"]=a}),c()],template:d,css:function(e){return[function(e){var t=Object.assign({},e("raui.primary"),e("raui.pop.primary")),n=(e("raui.themes")||[]).slice();return(e("raui.pop.themes")||[]).forEach(function(e){~n.indexOf(e)||n.push(e)}),"\n .rpop-wrapper {\n position: absolute;\n display: inline-block;\n z-index: 21;\n transition-property: top, left, padding;\n transition-timing-function: ease-in-out;\n transition-duration: 0.3s;\n }\n .rpop-with-tail.rpop-above {\n padding-bottom: 10px;\n }\n .rpop-with-tail.rpop-below {\n padding-top: 10px;\n }\n .rpop-with-tail.rpop-left {\n padding-right: 10px;\n }\n .rpop-with-tail.rpop-right {\n padding-left: 10px;\n }\n \n .rpop {\n position: relative;\n box-shadow: 0 1px 4px 0 rgba(0,0,0,0.24);\n border: 1px solid #ccc;\n border-radius: 0.2em;\n background-color: "+(t.bg||"#fff")+";\n color: "+(t.fg||"#222")+";\n padding: 0.5em;\n z-index: 2;\n }\n \n .rpop-modal {\n position: fixed;\n display: flex;\n z-index: 20;\n background-color: rgba(0, 0, 0, 0.2);\n align-items: center;\n justify-content: center;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n padding: 1em;\n overflow: auto;\n }\n \n .rpop-tail, .rpop-tail-outer {\n z-index: 3;\n width: 0;\n height: 0;\n position: absolute;\n border-style: solid;\n border-width: 10px;\n border-color: transparent;\n transition-property: top, left, bottom, right, border-color;\n transition-timing-function: ease-in-out;\n transition-duration: 0.3s;\n }\n .rpop-tail-outer {\n z-index: 1;\n border-width: 12px;\n border-color: transparent;\n }\n \n .rpop-below .rpop-tail {\n border-bottom-color: "+(t.bg||"#fff")+";\n }\n .rpop-below .rpop-tail-outer {\n border-bottom-color: "+(t.bc||"#ccc")+";\n }\n \n .rpop-above .rpop-tail {\n border-top-color: "+(t.bg||"#fff")+";\n }\n .rpop-above .rpop-tail-outer {\n border-top-color: "+(t.bc||"#ccc")+";\n }\n \n .rpop-left .rpop-tail {\n border-left-color: "+(t.bg||"#fff")+";\n }\n .rpop-left .rpop-tail-outer {\n border-left-color: "+(t.bc||"#ccc")+";\n }\n \n .rpop-right .rpop-tail {\n border-right-color: "+(t.bg||"#fff")+";\n }\n .rpop-right .rpop-tail-outer {\n border-right-color: "+(t.bc||"#ccc")+";\n }\n "+n.map(function(t){var n=Object.assign({},e("raui.primary"),e("raui.pop.primary"),e("raui."+t),e("raui.pop."+t));return"\n ."+t+" .rpop {\n background-color: "+(n.bg||"#fff")+";\n color: "+(n.fg||"#222")+";\n }\n \n ."+t+".rpop-below .rpop-tail {\n border-bottom-color: "+(n.bg||"#fff")+";\n }\n ."+t+".rpop-below .rpop-tail-outer {\n border-bottom-color: "+(n.bc||"#ccc")+";\n }\n \n ."+t+".rpop-above .rpop-tail {\n border-top-color: "+(n.bg||"#fff")+";\n }\n ."+t+".rpop-above .rpop-tail-outer {\n border-top-color: "+(n.bc||"#ccc")+";\n }\n \n ."+t+".rpop-left .rpop-tail {\n border-left-color: "+(n.bg||"#fff")+";\n }\n ."+t+".rpop-left .rpop-tail-outer {\n border-left-color: "+(n.bc||"#ccc")+";\n }\n \n ."+t+".rpop-right .rpop-tail {\n border-right-color: "+(n.bg||"#fff")+";\n }\n ."+t+".rpop-right .rpop-tail-outer {\n border-right-color: "+(n.bc||"#ccc")+";\n }\n "})}.call(this,e)].join(" ")},cssId:"rpop",noCssTransform:!0,observe:{popped:function(e){var t,n=this,i=this._transdone=new Promise(function(e){return t=e});i.resolve=t,setTimeout(function(){n._transdone=i,n.get("popped")===e&&n.set("_popped",e)},1)},_popped:{handler:function(e){var t=this,n=this._transdone.resolve;if(e){var i=this.get("@style.raui.pop.mobile");if(i&&window.matchMedia("(max-width: "+i+")").matches){f||(f=new b({target:document.body,append:!0}));var r=this.getContext().getParent(!0);r.isContext=1,this.set("__popped",!1).then(n),f.unshift("contents",{content:this.partials.content,context:r,attrs:this.partials["extra-attributes"]||[],clickClose:this.get("clickClose"),noClickout:this.get("noClickout"),done:function(){t.set("popped",!1)}})}else this.set("__popped",!0)}else s?(f.shift("contents"),n()):this.set("__popped",!1).then(n)},defer:!0,init:!1},__popped:{handler:function(e){var t=this._transdone.resolve;if(e){var n=this.find("div"),i=n,r=i.offsetHeight+i.offsetTop,o=i.offsetWidth+i.offsetLeft,a=i.offsetParent;if(!this.overflows)for(var l=this.overflows={e:[],v:[]};n&&n.style;){if(n===a){if(n.offsetWidth>=o&&n.offsetHeight>=r)break;o+=n.offsetLeft,r+=n.offsetTop,a=n.offsetParent}var c=getComputedStyle(n);if("auto"===c.overflow)break;"hidden"===c.overflow&&(l.e.push(n),l.v.push(n.style.overflow),n.style.overflow="visible"),n=n.parentNode}this.position(),this.transition("pop",i,{intro:!0,dir:this.get("where")||"below"}).then(t)}else this.source=null,this.tailSource=null},defer:!0,init:!1},"align where tail fit":{handler:function(){this.position()},defer:!0}},decorators:{cleanup:function(e){var t=this;return{teardown:function(){var e=t.overflows;if(e){t.overflows=null;for(var n=0;n<e.e.length;n++)e.e[n].style.overflow=e.v[n]}}}}},data:function(){return{gap:4}}});var b=function(e){function t(t){e.call(this,t)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t}(t);function m(){}function h(e){~this.className.indexOf("focus")||(this.className+=" focus")}function g(e){this.className=this.className.replace(/\bfocus\b/g,"").trim()}function v(e){var t,n,i,r,o,a,l,c,s,f,p,d,u,b=this.getContext(e);function v(){var b=y().split(/\s+/).filter(function(e){return!!e});(t=!!~b.indexOf("field"))||(b.push("field"),t=!0),(n=e.querySelector("input[type=checkbox]"))&&!~b.indexOf("check")&&b.push("check"),(i=e.querySelector("input[type=radio]"))&&!~b.indexOf("radio")&&b.push("radio");var m=n||i;m&&m.checked&&!~b.indexOf("checked")&&b.push("checked"),m&&m.disabled&&!~b.indexOf("disabled")&&b.push("disabled"),!m&&f?(f.cancel(),f=0,p&&(p.disconnect(),p=0),delete m._form_callback,u&&(delete u.checked,d=u=void 0)):m&&(m._form_callback=function(t,n){if(void 0===n&&(n=!0),n&&"radio"===m.type&&m.name){var i=[];i.push.apply(i,document.querySelectorAll("input[type=radio][name="+m.name+"]")),(i=i.filter(function(e){return e!==m})).forEach(function(e){return e._form_callback&&e._form_callback(t,!1)})}var r=m.checked;r&&!~e.className.indexOf("checked")?e.className+=" checked":!r&&~e.className.indexOf("checked")&&(e.className=e.className.replace(/\bchecked\b/g,"").replace(/ +/g," ").trim())},MutationObserver&&(p=new MutationObserver(function(){var t;(t=m.disabled)&&!~e.className.indexOf("disabled")?e.className+=" disabled":!t&&~e.className.indexOf("disabled")&&(e.className=e.className.replace(/\bdisabled\b/g,"").replace(/ +/g," ").trim())})).observe(m,{attributes:!0}),f=this.getContext(m).listen("change",m._form_callback),(d=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(m),"checked"))&&d.configurable&&(u=m,Object.defineProperty(m,"checked",{get:d.get,set:function(e){d.set.call(u,e),m._form_callback()},enumerable:!0,configurable:!0}))),(r=!!e.querySelector("textarea"))&&!~b.indexOf("textarea")&&b.push("textarea"),(o=!!e.querySelector("select"))&&!~b.indexOf("select")&&b.push("select"),(a=!!e.querySelector("input[type=file]"))&&!~b.indexOf("file")&&b.push("file"),(l=!!(l=e.querySelector("button"))&&l.parentNode===e)&&!~b.indexOf("button")&&b.push("button"),(c=!!e.querySelector("div"))&&!~b.indexOf("plain")&&b.push("plain"),(s=!(n||i||a||!e.querySelector("input")))&&!~b.indexOf("input")&&b.push("input"),e.className=b.join(" ")}function y(){var f=e.className;return t||(f=f.replace(/\bfield\b/g,"").trim()),n||(f=f.replace(/\bcheck(ed)?\b/g,"").trim()),i||(f=f.replace(/\bradio\b/g,"").trim()),r||(f=f.replace(/\btextarea\b/g,"").trim()),o||(f=f.replace(/\bselect\b/g,"").trim()),a||(f=f.replace(/\bfile\b/g,"").trim()),l||(f=f.replace(/\bbutton\b/g,"").trim()),c||(f=f.replace(/\bplain\b/g,"").trim()),s||(f=f.replace(/\binput\b/g,"").trim()),f=f.replace(/ +/g," ")}var x=b.listen("focusin",h),_=b.listen("focusout",g);v.call(this);var w={update:m,invalidate:v.bind(this),teardown:function(){b.ractive.fire("fieldUnregistered",b,e,w);var t=y();t=t.replace(/\bfocus\b/g,"").trim(),x.cancel(),_.cancel(),f&&f.cancel(),p&&p.disconnect(),u&&(delete u.checked,d=u=void 0),e.className=t},setDisabled:function(t){e.querySelectorAll("input,button,select,textarea").forEach(function(e){return e.disabled=t}),this.invalidate()}};return b.ractive.fire("fieldRegistered",b,e,w),w}function y(e,t){if(!e)return!1;for(var n=0;n<e.length;n++){if(e[n].e===t)return!0;if(e[n].f&&y(e[n].f,t))return!0}return!1}t.extendWith(b,{template:{v:d.v,t:d.p.modal},data:function(){return{contents:[]}},use:[o(),c()],observe:{contents:function(e){s=(e||[]).length>0}},on:{init:function(){f?console.warn("More than one PopOver mobile host created."):f=this}}}),v.style=function(e){var t=Object.assign({},e("raui.primary"),e("raui.form.primary")),n=Object.assign({},e("raui.primary.active"),e("raui.form.primary.active")),i=Object.assign({},e("raui.primary.disabled"),e("raui.form.primary.disabled")),r=e("raui.form.boxy");return"\n label.field, .field-manual {\n display: inline-block;\n font-size: 0.9em;\n font-weight: 500;\n color: "+(t.fg||"#222")+";\n transition: 0.2s ease-in-out;\n transition-property: color;\n vertical-align: top;\n box-sizing: border-box;\n padding: 0.25em 0.5em;\n line-height: 1.5em;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-family: inherit;\n }\n\n label.field.textarea {\n display: block;\n border: 0.0625em solid "+(t.bc||"#ccc")+";\n padding: 0.5em 0.8em 0.8em 0.8em;\n border-radius: "+(t.radius||"0.2em")+";\n box-shadow: none;\n transition-property: color, border-color, box-shadow;\n margin: 0.8em 0.2em;\n min-height: auto;\n background-color: "+(r?t.bg||"#fff":"transparent")+";\n }\n\n label.field.focus {\n color: "+(n.fg||t.fga||"#07e")+";\n }\n\n label.field.textarea.focus {\n border-color: "+(n.fg||t.fga||"#07e")+";\n "+(r?"":"box-shadow: 0.0625em 0.0625em "+(n.fg||t.fga||"#07e")+",\n -0.0625em 0.0625em "+(n.fg||t.fga||"#07e")+",\n 0.0625em -0.0625em "+(n.fg||t.fga||"#07e")+",\n -0.0625em -0.0625em "+(n.fg||t.fga||"#07e")+";")+"\n }\n\n label.field input,\n label.field select,\n label.field textarea,\n .field-manual .field-body\n {\n display: block;\n border-width: "+(r?"0.0625em":"0 0 0.0625em 0")+";\n border-color: "+(t.bc||"#ccc")+";\n border-style: solid;\n box-sizing: border-box;\n background-color: "+(r?t.bg||"#fff":"transparent")+";\n transition: 0.2s ease-in-out;\n transition-property: box-shadow, color;\n outline: none;\n box-shadow: none;\n width: 100%;\n margin-bottom: 0.8em;\n font-size: 1.1em;"+(r?"\n border-radius: "+(t.radius||"0.2em")+";":"")+"\n font-weight: 400;\n font-family: inherit;\n }\n\n label.field input"+(r?"":":disabled")+",\n label.field select"+(r?"":":disabled")+" {\n padding: 0 0.75em;\n }\n label.field select"+(r?"":":disabled")+" {\n padding-right: 2em;\n }\n\n label.field input:disabled,\n label.field input[readonly],\n label.field select:disabled,\n label.field textarea:disabled,\n label.field textarea[readonly] {\n background: "+(i.bg||"#f4f4f4")+";\n color: "+(i.fg||"#444")+";\n }\n\n label.field textarea {\n line-height: 1.2em;\n }\n label.field .field-wrapper {\n display: block;\n }\n label.field > select, label.field > input,\n label.field > .field-wrapper > input, label.field > .field-wrapper > select {\n height: 2.5em;\n }\n\n "+(r?"":"label.field:hover > input,\n label.field:hover select,\n label.field.file:hover:after {\n box-shadow: 0 0.0625em 0 0 "+(t.bc||"#ccc")+";\n }\n\n label.field.textarea:hover {\n box-shadow: 0.0625em 0.0625em "+(t.bc||"#ccc")+",\n -0.0625em 0.0625em "+(t.bc||"#ccc")+",\n 0.0625em -0.0625em "+(t.bc||"#ccc")+",\n -0.0625em -0.0625em "+(t.bc||"#ccc")+";\n }\n\n label.field.textarea.focus:hover {\n box-shadow: 0.0625em 0.0625em "+(n.fg||t.fga||"#07e")+",\n -0.0625em 0.0625em "+(n.fg||t.fga||"#07e")+",\n 0.0625em -0.0625em "+(n.fg||t.fga||"#07e")+",\n -0.0625em -0.0625em "+(n.fg||t.fga||"#07e")+";\n }")+"\n\n /**** CHECK BOXES ****/\n\n label.field.check, label.field.radio {\n position:relative;\n z-index: 0;\n overflow: visible;\n cursor: pointer;\n padding-top: 2.2em;\n white-space: normal;\n }\n label.field.check.inline, label.field.radio.inline {\n padding-top: 0.7em;\n }\n\n label.field.check input, label.field.radio input {\n appearance: none;\n -moz-appearance: none;\n -webkit-appearance: none;\n z-index: -1;\n position: absolute;\n left: -0.5em;\n top: 1em;\n display: block;\n margin: 0;\n border-radius: 50%;\n width: 3.2em;\n height: 3.2em;\n background-color: "+(t.bc||"#ccc")+";\n box-shadow: none;\n outline: none;\n opacity: 0;\n transform: scale(1);\n pointer-events: none;\n transition: opacity 0.3s, transform 0.2s;\n }\n label.field.inline.check input, label.field.inline.radio input {\n top: -0.45em;\n left: -0.55em;\n }\n\n label.field.check input:checked, label.field.radio input:checked {\n background-color: "+(t.fga||"#07e")+";\n }\n\n label.field.check:hover > input, label.field.radio:hover > input {\n opacity: 0.04;\n }\n\n label.field.check input:focus, label.field.radio input:focus {\n opacity: 0.12;\n }\n\n label.field.check:hover > input:focus, label.field.radio:hover > input:focus {\n opacity: 0.16;\n }\n\n label.field.check input:active, label.field.radio input:active {\n opacity: 0.6;\n transform: scale(0);\n transition: transform 0s, opacity 0s;\n }\n\n label.field.check:before, label.field.radio:before {\n content: '';\n display: inline-block;\n box-sizing: border-box;\n margin: 0 0.5em 0.2em 0.1em;\n border: solid 0.125em; /* Safari */\n border-color: "+(t.fg||"#222")+';\n border-radius: 0.125em;\n width: 1.2em;\n height: 1.2em;\n vertical-align: bottom;\n transition: border-color 0.2s, background-color 0.2s;\n }\n\n label.field.check:after, label.field.radio:after {\n content: \'\';\n display: inline-block;\n opacity: 0;\n position: absolute;\n width: 1.2em;\n height: 1.2em;\n top: 2.3em;\n left: 0.6em;\n border-radius: 0.125em;\n }\n label.field.check.inline:after, label.field.radio.inline:after {\n top: 0.8em;\n }\n\n label.field.check.checked:after {\n opacity: 1;\n background: no-repeat center/80% url(\'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="'+(t.bg||"#fff").replace(/#/g,"%23")+'" d="m 15.378906,1.7050781 a 1.0583349,1.0583349 0 0 0 -1.478515,0.234375 L 6.6210937,11.960938 1.8652344,8.5058594 a 1.0583349,1.0583349 0 0 0 -1.47851565,0.234375 1.0583349,1.0583349 0 0 0 0.234375,1.4785156 L 6.234375,14.294922 A 1.0584408,1.0584408 0 0 0 7.7128906,14.060547 L 15.613281,3.1835938 A 1.0583349,1.0583349 0 0 0 15.378906,1.7050781 Z" /></svg>\') '+(t.fga||"#07e")+';\n }\n\n label.field.radio.checked:after {\n opacity: 1;\n background: no-repeat center/80% url(\'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><circle fill="'+(t.bg||"#fff").replace(/#/g,"%23")+'" cx="8" cy="8" r="5" /></svg>\') '+(t.fga||"#07e")+";\n }\n\n label.field.check.checked:before, label.field.radio.checked:before {\n border-color: "+(t.fga||"#07e")+";\n }\n label.field.check.focus:before, label.field.radio.focus:before {\n border-color: "+(t.fga||"#07e")+";\n }\n\n label.field.check input:disabled, label.field.radio input:disabled {\n opacity: 0;\n }\n\n label.field.check.disabled, label.field.radio.disabled {\n color: "+(i.fg||"#444")+";\n cursor: initial;\n }\n\n label.field.check.disabled:before, label.field.radio.disabled:before {\n border-color: "+(i.bc||"#ccc")+";\n background-color: "+(i.bg||"#f4f4f4")+";\n }\n\n label.field.check.checked.disabled:after, label.field.radio.checked.disabled:after {\n border-color: transparent;\n background-color: "+(i.bc||"#ccc")+";\n }\n\n label.field select {\n padding-right: 2em;\n }\n\n label.field.select {\n cursor: pointer;\n position: relative;\n }\n\n label.field.select:after {\n content: ' ';\n position: absolute;\n display: block;\n width: 0.6em;\n right: 1.125em;\n height: 0.6em;\n top: 2.6em;\n border-bottom: 0.125em solid;\n border-right: 0.125em solid;\n transform: rotate(45deg);\n pointer-events: none;\n color: "+(t.bc||"#ccc")+";\n }\n\n label.field textarea {\n border: none;"+(r?"\n padding: 0;":"")+"\n }\n\n label.field > select {\n -moz-appearance: none;\n -webkit-appearance: none;\n }\n\n label.field input:focus,\n label.field select:focus,\n label.field.file.focus:after\n {\n border-color: "+(n.fg||t.fga||"#07e")+";\n "+(r?"":"box-shadow: 0 0.0625em 0 0 "+(n.fg||t.fga||"#07e")+";")+"\n }\n\n label.field input[type=checkbox]:focus,\n label.field input[type=radio]:focus {\n box-shadow: none;\n }\n\n label.field.file.focus:after {\n color: "+(n.fg||t.fga||"#07e")+";\n }\n label.field.file [type=file] {\n position: absolute;\n width: 0;\n height: 0;\n opacity: 0;\n z-index: -1;\n }\n label.field.file {\n position: relative;\n min-width: 9em;\n height: 5em;\n }\n label.field.file:after {\n position: absolute;\n content: 'Choose a file';\n box-sizing: border-box;\n width: calc(100% - 0.3em);\n height: 2.5em;\n font-size: 1.1em;\n line-height: 1.5em;\n color: "+(t.fg||"#222")+";\n text-align: "+(r?"center":"left")+";\n padding: 0.5em "+(r?"0.5em":"0")+";\n cursor: pointer;\n font-style: oblique;\n left: 0.25em;\n top: 1.6em;\n transition: 0.2s ease-in-out;\n transition-property: color, border-bolor, box-shadow;"+(r?"\n border-radius: "+(t.radius||"0.2em")+";\n border-color: "+(t.bc||"#ccc")+";\n border-style: solid;\n border-width: 0.0625em;":"\n border-bottom-color: "+(t.bc||"#ccc")+";\n border-bottom-width: 0.0625em;\n border-bottom-style: solid;\n ")+"\n }\n label.field.file.inline:after {\n top: 0.2em;\n }\n\n label.field.button {\n vertical-align: top;\n padding-top: "+(r?"1.7":"1.958")+"em;\n }\n label.field .with-buttons button, label.field.button button {\n font-size: 1.1em;\n margin-top: "+(r?"0.15em":"0")+";\n }\n\n label.field .field-wrapper.with-buttons {\n display: flex;\n }\n label.field .with-buttons button {\n flex-shrink: 0;\n padding-left: 0.5em;\n padding-right: 0.5em;\n margin-top: 0;\n margin-right: 0;\n "+(r?"height: 2.5em;\n box-shadow: none;\n border-radius: 0;\n border-left: 1px solid "+(t.bg||"#fff")+";\n margin-left: 0;":"height: 2.25em;")+"\n }"+(r?"\n label.field .with-buttons button:first-of-type {\n margin-left: -0.05em;\n border-left: none;\n }\n label.field .with-buttons button:last-of-type {\n border-radius: 0 "+(t.radius||"0.2em")+" "+(t.radius||"0.2em")+" 0;\n }\n label.field .with-buttons input {\n border-radius: "+(t.radius||"0.2em")+" 0 0 "+(t.radius||"0.2em")+";\n min-width: 0;\n }\n ":"")+"\n\n label.field.plain > div {\n position: absolute;\n font-size: 1.1em;\n top: 2.4em;\n font-weight: normal;\n }\n\n /* inline fields (no labels) */\n label.field.inline {\n min-height: 3.3em;\n }\n\n label.field.button.inline {\n margin-top: 0.2em;\n padding-top: 0.12em;\n }\n\n label.field.button.inline button {\n margin-top: 0;\n }\n\n label.field.inline.select:after {\n top: 1."+(r?"15":"1")+"em;\n }\n\n label.field .field-tip {\n display: inline-block;\n width: 1em;\n height: 1em;\n background-color: "+(t.fga||"#07e")+";\n color: "+(t.bg||"#fff;")+";\n cursor: default;\n user-select: none;\n border-radius: 1em;\n margin-left: 0.5em;\n line-height: 1.2em;\n text-align: center;\n margin-top: -0.2em;\n }\n\n label.field .field-solo-tip {\n margin-left: -0.1em;\n }\n "};var x=t.macro(function(e){var t=[],n=[],i=(e.template.m||[]).slice(),r=e.template.f||[],o=i.find(function(e){return"value"===e.n}),a=i.find(function(e){return"type"===e.n}),l=i.find(function(e){return"tip"===e.n}),c=i.find(function(e){return"disabled"===e.n});if(l&&i.splice(i.indexOf(l),1),a&&"function"==typeof x.types[a.f])t.push.apply(t,x.types[a.f](i,r,e));else if(o){var s={t:7,e:"input",m:[o]};if(c&&s.m.push(c),y(r,"option")&&(s.e="select",s.f=r),a&&(s.m.push(a),"checkbox"===a.f||"radio"===a.f)){var f=i.find(function(e){return"target"===e.n});f?s.m.push(Object.assign({},f,{n:"name"})):s.m.splice(s.m.indexOf(o),1,Object.assign({},o,{n:"checked"}))}s.m=s.m.concat(i.filter(function(e){return 73===e.t||73===e.t||"placeholder"===e.n})),t.push(s);var p=r.filter(function(e){return"button"===e.e||y(e.f,"button")});p.length&&(t.push.apply(t,p),t=[{t:7,e:"span",m:[{t:13,n:"class",f:"field-wrapper with-buttons",g:1}],f:t}])}else{r.forEach(function(e){"label"===e.e?e.f&&e.f.length&&n.push.apply(n,e.f):t.push(e)});var d=r.filter(function(e){return e.e});d.find(function(e){return"button"===e.e})&&d.length>1&&(t=[{t:7,e:"span",m:[{t:13,n:"class",f:"field-wrapper with-buttons",g:1}],f:t}])}var u=i.find(function(e){return"label"===e.n});u&&u.f&&u.f.length&&n.push.apply(n,Array.isArray(u.f)?u.f:[u.f]),l&&t.unshift({t:7,e:"span",m:[{t:13,n:"class",f:"field-tip"+(n.length?"":" field-solo-tip"),g:1},{t:13,n:"title",f:l.f},{t:70,n:["click"],f:{r:[],s:"[false]"}}],f:"?"});var b=i.find(function(e){return"inline"===e.n});n&&!b?t.unshift.apply(t,n):b||t.unshift(" ");var m={t:7,e:"label",m:[{t:71,n:"field"}].concat(i.filter(function(e){return 13!==e.t&&73!==e.t||"value"!==e.n&&"type"!==e.n&&"inline"!==e.n&&"label"!==e.n&&"placeholder"!==e.n&&"target"!==e.n&&"disabled"!==e.n})),f:t};b&&m.m.push({t:13,n:"class",f:"inline"}),e.setTemplate([m])});function _(e){return"function"==typeof e.focus&&e.focus(),{teardown:m}}x.types={},i("field","decorators",v),i("field","partials",x),i("autofocus","decorators",_);var w={v:4,t:[{t:7,e:"span",m:[{t:13,n:"class",f:"rautocomplete field-wrapper",g:1},{n:["pop"],t:70,f:{r:["@context","$1"],s:'[(_0).set("rac.pop",_1)]'}}],f:[{t:7,e:"input",m:[{t:8,r:"extra-attributes"},{n:["dblclick"],t:70,f:{r:["rac.pop","@node"],s:"[_0.show(_1)]"}},{n:["focus"],t:70,f:{r:["rac"],s:"[_0.stash()]"}},{n:["blur"],t:70,f:{r:["rac","@node"],s:"[_0.checkBlur(_1)]"}},{n:["input"],t:70,f:{r:["rac","@event"],s:"[_0.input(_1)]"}},{n:["keydown"],t:70,f:{r:["rac","@event"],s:"[_0.key(_1)]"}},{t:73,v:"t",f:"false"},{n:"value",f:[{t:2,r:"rac.display"}],t:13}]}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rac-drop",g:1},{n:["click"],t:70,f:{r:["rac.pop","@context"],s:'[_0.show((_1).find("input"))]'}}]}," ",{t:7,e:"rac-pop",m:[{t:13,n:"style",f:"padding: 0;",g:1},{t:13,n:"class",f:"rac-pop",g:1},{n:["init"],t:70,f:{r:["@context","$1"],s:'[(_0).raise("pop",{},_1)]'}},{n:"popped",t:13,f:[{t:2,r:"rac.popped"}]},{n:"where",f:"below",t:13,g:1},{n:"align",f:"end",t:13,g:1},{n:"gap",f:[{t:2,x:{r:[],s:"2"},s:1}],t:13},{n:"offsets",t:13,f:[{t:2,r:"rac.offsets"}]},{n:"fit",t:13,f:[{t:2,r:"rac.fit"}]}],f:[{t:4,f:[{t:7,e:"input",m:[{n:"class-rac-modal",t:13},{n:["input"],t:70,f:{r:["rac","@event"],s:"[_0.input(_1)]"}},{n:["keydown"],t:70,f:{r:["rac","@event"],s:"[_0.key(_1)]"}},{t:73,v:"t",f:"false"},{n:"value",f:[{t:2,r:"rac.display"}],t:13},{n:["blur"],t:70,f:{r:["rac"],s:"[_0.checkBlur()]"}},{n:"autocompletefocus",t:71}]}],n:50,r:"inModal"}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rac-list",g:1},{n:"tabindex",f:"-1",t:13,g:1}],f:[{t:55,f:[{f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rac-item rac-invalid",g:1}],f:["Loading..."]}],t:4},{t:62,f:[" ",{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rac-item",g:1},{n:"tabindex",f:"-1",t:13,g:1},{t:4,f:[{n:"class-rac-selected",t:13,f:[{t:2,x:{r:["rac.value","."],s:"_0===_1"}}]}],n:50,r:"rac.valueBound"},{n:"class-rac-hover",t:13,f:[{t:2,x:{r:["rac.selected","@index"],s:"_0===_1"}}]},{t:4,f:[{n:["click"],t:70,f:{r:["@context",".","rac"],s:'[(_0).set("rac.value",_1),_2._drawDisplay()]'}},{n:["mouseover"],t:70,f:{r:["@context","@index"],s:'[(_0).set("rac.selected",_1)]'}}],n:50,r:"rac.popped"}],f:[{t:2,x:{r:["rac","."],s:"_0._display(_1)"}}]}],n:52,r:"items"}," "],n:"items"},{t:63,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rac-item rac-invalid",g:1}],f:["Load failed."]}]}],r:"rac.list"}]}]}]}],e:{2:function(){return 2},'[(_0).set("rac.pop",_1)]':function(e,t){return[e.set("rac.pop",t)]},"[_0.show(_1)]":function(e,t){return[e.show(t)]},"[_0.stash()]":function(e){return[e.stash()]},"[_0.checkBlur(_1)]":function(e,t){return[e.checkBlur(t)]},"[_0.input(_1)]":function(e,t){return[e.input(t)]},"[_0.key(_1)]":function(e,t){return[e.key(t)]},'[_0.show((_1).find("input"))]':function(e,t){return[e.show(t.find("input"))]},'[(_0).raise("pop",{},_1)]':function(e,t){return[e.raise("pop",{},t)]},"[_0.checkBlur()]":function(e){return[e.checkBlur()]},"_0===_1":function(e,t){return e===t},'[(_0).set("rac.value",_1),_2._drawDisplay()]':function(e,t,n){return[e.set("rac.value",t),n._drawDisplay()]},'[(_0).set("rac.selected",_1)]':function(e,t){return[e.set("rac.selected",t)]},"_0._display(_1)":function(e,t){return e._display(t)}}};function k(e,t){return t.reduce(function(e,t){return e?e[t]:e},e)}var T=["INPUT","SELECT","TEXTAREA","BUTTON","BODY"],L=t.macro(function(e){var n,i,r;function o(t){null==t&&(t=null==e.get("rac.value")?"":e.get("rac.display")),t===e.get("rac.tempDisplay")&&(t="");var n=e.get("rac._items");if("function"==typeof n){var i=n(t);"object"==typeof i&&"function"==typeof i.then?i.then(function(t){return e.set("rac.list",t)}):e.set("rac.list",i)}else if(Array.isArray(n)){var r,o=e.get("rac._display");try{r=new RegExp(t||"","i")}catch(e){r=new RegExp((t||"").replace(/([\{\(\[\]\)\}\?\*\^\$])/g,"\\$1"))}e.set("rac.list",n.filter(function(e){return r.test(o(e))}))}else e.set("rac.list",[])}function a(t,n){var i=e.get("rac.default");return null==(t=null!=t||n?t:e.get("rac.value"))&&i&&(t="function"==typeof i?i(e.get("rac.display")):i),t}function l(n,r,l){var s=e.get("rac.displayprop");if(e.get("rac.__display")!==s||void 0===e.get("rac._display")){var f=function(){return e.attributes["display-value"]?e.get("rac.display"):"(none)"};if("string"==typeof s){var p=t.splitKeypath(s);s=function(e){return null==e&&(e=a()),null==e?f():k(e,p)}}else if(Array.isArray(s)){var d=s;s=function(e){return null==e&&(e=a()),null==e?f():k(e,d)}}else s||(s=function(e){return null==e&&(e=a()),null==e?f():""+e});e.set("rac._display",s),e.set("rac.__display",e.get("rac.displayprop")),e.set("rac.display",s(e.get("rac.value")))}if(s=e.get("rac.member"),e.get("rac.__member")!==s||void 0===e.get("rac._member")){if("string"==typeof s){var u=t.splitKeypath(s);s=function(e){return k(a(e),u)}}else if(Array.isArray(s)){var b=s;s=function(e){return k(a(e),b)}}else s||(s=function(e){return a(e)});e.set("rac._member",s),e.set("rac.__member",e.get("rac.member"))}s=e.get("rac.items"),e.get("rac.__items")===s&&void 0!==e.get("rac._items")||(Array.isArray(s)?e.set("rac._items",s):"function"==typeof s?e.set("rac._items",s):"object"==typeof s&&"function"==typeof s.then?s.then(function(t){e.set("rac._items",t),o()}):e.set("rac._items",[]),e.set("rac.__items",e.get("rac.items"))),i&&"rac.display"===l&&e.get("rac.limit")&&!i.contains(document.activeElement)&&c(),o()}function c(){var t=e.get("rac._display");if("function"==typeof t){var n=t(e.get("rac.value"));e.set("rac.display",n),e.set("rac.tempDisplay",n)}}function s(t){(t.items&&e.link(t.items,"rac.items"),t.value&&e.link(t.value,"rac._value"),e.set("rac.valueBound",!!t.value),t.selected&&e.link(t.selected,"rac.selected"),t["display-value"]&&e.link(t["display-value"],"rac.display"),"display"in t&&e.set("rac.displayprop",t.display),"member"in t&&e.set("rac.member",t.member),"offsets"in t?(e.set("rac.offsets",t.offsets),e.set("rac.fit",!("fit"in t)||t.fit)):e.set("rac.fit","fit"in t&&t.fit),e.set("rac.limit",t["limit-set"]),e.set("rac.default",t.default),e.get("rac.limit")&&e.get("input"))&&(e.get("input")!==document.activeElement&&c());l()}e.aliasLocal("rac"),e.set("rac.list",[]),e.set("rac.popped",!1),e.set("rac.stash",function(){e.set("rac.tempDisplay",e.get("rac.display")),e.set("rac.tempValue",e.get("rac.value"))}),e.set("rac.key",function(t){var n=t.which;if(27===n)e.set("rac.popped",!1),e.set("rac.display",e.get("rac.tempDisplay")),e.set("rac.value",e.get("rac.tempValue"));else if(38===n||40===n){t.preventDefault(),e.get("rac.pop").show(e.find("input"));var i=e.get("rac.selected"),r=e.get("rac.list");38===n?i<=0||null==i?e.set("rac.selected",Array.isArray(r)?r.length-1:0):e.set("rac.selected",i-1):Array.isArray(r)?e.set("rac.selected",i<r.length-1?i+1:0):e.set("rac.selected",0)}else if(10===n||13===n){var o=e.get("rac.list");Array.isArray(o)&&(e.set("rac.value",o[e.get("rac.selected")]),c())}else if(9===n){if(e.get("rac.popped")){var l=e.get("rac.list");if(Array.isArray(l)){var s=l[e.get("rac.selected")];null==s&&(s=a(s,!0)),e.set("rac.value",s)}e.get("rac.limit")||setTimeout(function(){return c()},140)}else null!=e.get("rac.value")&&~e.get("rac.selected")&&e.get("rac.display")==e.get("rac.tempDisplay")||e.set("rac.value",a(null,!0));e.set("rac.popped",!1),e.get("rac.updateDisplay")()}}),e.set("rac.input",function(t){n&&clearTimeout(n),n=setTimeout(function(){n=null,o(t.target.value);var i=e.find("input");i&&document.activeElement===i&&e.get("rac.pop").show(i)},500),e.attributes.lazy||e.set("rac.display",t.target.value)}),e.setTemplate(w),e.set("rac._drawDisplay",c),e.set("rac.updateDisplay",function(t){setTimeout(function(){i&&e.get("rac.limit")&&!i.contains(document.activeElement)&&c()},140)}),s(e.attributes);var f=!1,p={init:!1,defer:!0},d=[e.observe("rac.displayprop",l,p),e.observe("rac.memberprop",l,p),e.observe("rac.items",l,p),e.observe("rac.list",function(t){Array.isArray(t)?e.set("rac.selected",t.indexOf(e.get("rac.value"))):e.set("rac.selected",-1)},p),e.observe("rac.value",function(t){c(),function(){if(!e.get("rac._value")||e.get("rac.value")){var t=e.get("rac._member");if("function"==typeof t){var n=t(e.get("rac.value"));e.set("rac._value",n)}e.ractive.getContext(e.find("input")).raise("selected",{},e.get("rac._value"),e.get("rac.display"))}}(),e.set("rac.popped",!1),e.set("rac.tempValue",t)}),e.observe("rac._value",function(t){var n=e.get("rac._member"),i=e.get("rac.list").find(function(e){return n(e)===t});i!==e.get("rac.value")&&e.set("rac.value",i),!i&&null!=t&&e.get("rac.valueBound")&&(e.set("rac.display",t),l())}),e.observe("rac.selected",function(){r&&clearTimeout(n),r=setTimeout(function(){r=null;var t=e.find(".rac-hover");t&&t.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})},14)}),e.observe("rac.popped",function(e){e&&setTimeout(function(){return f=!1},300),f=!0})];return e.set("rac.checkBlur",function(t){if(f)return!1;var n=document.activeElement;if(~T.indexOf(n.nodeName)||n.getAttribute("tabindex")){var i=e.findAll("input").concat(e.get("rac.pop").popFindAll("input"));document.activeElement&&!~i.indexOf(document.activeElement)&&e.get("rac.key")({which:9})}}),{teardown:function(){e.unlink("rac.items"),e.unlink("rac._value"),e.unlink("rac.selected"),e.unlink("rac.display"),d.forEach(function(e){return e.cancel()})},update:s,render:function(){i=e.find("span")}}},{attributes:["items","selected","display","value","member","limit-set","fit","offsets","display-value","default"],css:function(e){return[function(e){var t=Object.assign({},e("raui.primary"),e("raui.autocomplete"),e("raui.autocomplete.primary")),n=Object.assign({},e("raui.autocomplete.drop"),e("raui.autocomplete.primary.drop")),i=e("raui.form.boxy");return".rautocomplete {\n position: relative;\n display: inline-block;\n }\n \n .rac-drop {\n width: 2em;\n height: 100%;\n position: absolute;\n top: 0;\n right: 2px;\n cursor: pointer;\n }\n .rac-drop:after {\n font-family: "+(n.font||"sans-serif")+";\n content: "+(n.string||"'▾'")+";\n position: absolute;\n top: calc(50% - 0.5em);\n height: 1em;\n line-height: 1em;\n width: 100%;\n text-align: center;\n font-weight: "+(n.weight||"normal")+";\n color: "+(n.color||t.bc||"#ccc")+";\n }\n \n .rac-pop {\n min-width: 100%;\n }\n \n .rac-pop > .rpop {\n padding: 0;\n }\n \n .rac-list {\n display: flex;\n flex-direction: column;\n max-height: 50vh;\n min-height: 2.125em;\n max-width: 100%;\n overflow: auto;\n }\n \n .rac-item {\n color: "+(t.fg||"#222")+";\n background-color: "+(t.bg||"#fff")+";\n padding: 0.25em;\n cursor: pointer;\n }\n \n .rac-selected {\n color: "+(t.bg||"#fff")+";\n background-color: "+(t.fga||"#07e")+";\n }\n \n .rac-hover {\n color: "+(t.fg||"#222")+";\n background-color: "+(t.bc||"#ccc")+";\n }\n \n .rac-selected.rac-hover {\n background-color: "+(t.bc||"#ccc")+";\n color: "+(t.fga||"#07e")+";\n }\n \n .rac-invalid {\n cursor: not-allowed;\n }\n \n input.rac-modal {\n width: 100%;\n box-sizing: border-box;\n display: block;\n border-width: "+(i?"0.0625em":"0 0 0.0625em 0")+";\n border-color: "+(t.bc||"#ccc")+";\n border-style: solid;\n box-sizing: border-box;\n background-color: "+(i?t.bg||"#fff":"transparent")+";\n transition: 0.2s ease-in-out;\n transition-property: box-shadow, color;\n outline: none;\n box-shadow: none;\n width: 100%;\n margin-bottom: 0.8em;\n font-size: 1.1em;"+(i?"\n border-radius: "+(t.radius||"0.2em")+";":"")+"\n font-weight: 400;\n font-family: inherit;\n }"}.call(this,e)].join(" ")},cssId:"rautocomplete",noCssTransform:!0});function O(e){return void 0===e&&(e={}),function(t){var n=t.instance;n.partials[e.name||"autocomplete"]=L,n.components["rac-pop"]=u,n.decorators.autocompletefocus=_}}e.Autocomplete=L,e.FieldType=function(e){return void 0===e&&(e={}),function(t,n,i){return[{t:7,e:e.name||"autocomplete",m:t,f:n}]}},e.plugin=O,e.default=O,Object.defineProperty(e,"__esModule",{value:!0})});

@@ -104,2 +104,4 @@ (function (global, factory) {

var lastBackspace = false;
if (node.tagName !== 'INPUT') {

@@ -188,2 +190,16 @@ console.warn(("Attempted to add a date decorator a " + (node.tagName)));

var selectGroup = function (group, pos) {
if (pos === undefined) { pos = node.selectionStart; }
if (group && group.target) { group = undefined; }
if (!group) {
if (pos === node.value.length && node.selectionEnd === node.value.length) { group = groups[0]; }
else { group = groupForPos(groups, pos); }
}
if (lastBackspace) {
lastBackspace = false;
if (pos < group.start) { group = groups[groups.indexOf(group) - 1]; }
}
document.activeElement === node && node.setSelectionRange(group.start, group.end);
};
handles.listeners.push(ctx.listen('input', function () {

@@ -201,3 +217,3 @@ var pos = node.selectionStart;

var next = groups[groups.indexOf(active) + 1];
node.setSelectionRange(next.start, next.end);
selectGroup(next, pos);
} else {

@@ -209,12 +225,9 @@ node.setSelectionRange(pos, pos);

handles.listeners.push(ctx.listen('blur', function () {
lastBackspace = false;
if (sendValue(false)) { receiveValue(groups, groups.value, opts.parseDate); }
if (groups.value === null) { groups.forEach(function (g) { return g.value = null; }); }
groups.forEach(function (g) { return g.display = displayForGroup(g); });
updateDisplay(groups, node);
}));
var selectGroup = function () {
var group;
if (node.selectionStart === node.value.length && node.selectionEnd === node.value.length) { group = groups[0]; }
else { group = groupForPos(groups, node.selectionStart); }
document.activeElement === node && node.setSelectionRange(group.start, group.end);
};
handles.listeners.push(ctx.listen('click', selectGroup));

@@ -224,2 +237,3 @@ handles.listeners.push(ctx.listen('focus', selectGroup));

handles.listeners.push(ctx.listen('keydown', function (/** @type { KeyboardEvent } */ ev) {
lastBackspace = false;
switch (ev.key) {

@@ -235,7 +249,7 @@ case 'Enter':

if (ev.shiftKey && idx > 0) {
node.setSelectionRange(groups[idx - 1].start, groups[idx - 1].end);
selectGroup(groups[idx - 1]);
ev.preventDefault();
ev.stopPropagation();
} else if (!ev.shiftKey && idx + 1 < groups.length) {
node.setSelectionRange(groups[idx + 1].start, groups[idx + 1].end);
selectGroup(groups[idx + 1]);
ev.preventDefault();

@@ -247,2 +261,6 @@ ev.stopPropagation();

case 'Backspace':
lastBackspace = true;
break;
case 'ArrowUp':

@@ -324,2 +342,5 @@ case 'ArrowDown': {

accepted = true;
} else if (g.type === 'd' && v.length !== g.length && leave) {
g.value = +v;
g.display = displayForGroup(g);
} else if (v === '') {

@@ -326,0 +347,0 @@ g.value = null;

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.RauiDate={})}(this,function(e){"use strict";var t=/[^\d]+/,n=/[^\d_]+/,a="_",l={y:0,M:1,d:2,H:3,m:4,s:5,S:6};function u(e,t,n){void 0===n&&(n="0");for(var a=null==e?"":""+e,l=a.length;l<t;l++)a=n+a;return a}function r(e,t,n){void 0===n&&(n="0");for(var a=null==e?"":""+e,l=a.length;l<t;l++)a+=n;return a}var s={mask:"yyyy-MM-dd",time:[0,0,0,0],date:function(){var e=new Date,t=s.time;return new Date(e.getFullYear(),e.getMonth(),e.getDate(),t[0],t[1],t[2],t[3])},parseDate:function(e){return new Date(e)}};function i(e){if("start"===e)e=[0,0,0,0];else if("end"===e)e=[23,59,59,999];else if("mid"===e)e=[12,0,0,0];else if("now"===e)e=function(){var e=new Date;return[e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()]};else if("string"==typeof e){var t=new Date("2000-05-13T"+e+"Z");+t&&(e=[t.getUTCHours(),t.getUTCMinutes(),t.getUTCSeconds(),t.getUTCMilliseconds()])}return Array.isArray(e)||"function"==typeof e||Array.isArray(e())||(e=[0,0,0,0]),e}function o(e,t,n){var a=t.value,l=d(e,t.selectionStart),u=0,r=e[u],s=e[u+1];e.forEach(function(e){return e.input=""});for(var i=0;i<a.length;i++)s&&a[i]===s.prefix[0]&&(l!==r||r.input.length>=r.length||a.length-i<n.length-r.end+(r.length-r.input.length))?(s.prefix.length>1&&(i+=s.prefix.length-1),a[i+1]===s.prefix[0]&&(i+=s.prefix.length),r=e[++u],s=e[u+1]):r.input+=a[i]}function v(e,l,s,i){void 0===s&&(s=0),void 0===i&&(i=!1);for(var o=!1,v=0;v<e.length;v++){var f=e[v],c=(f.input||"").replace(t,""),p=e[v+1]&&e[v+1].prefix&&n.test(f.input);if(c.length>f.length&&f===l){var d=c.length-l.length;c=c.substr(0,s-l.start)+c.substr(s-l.start+d)}else c=c.substr(0,f.length);if(f.input=c,"y"===f.type&&0===c.length&&(p||i))f.value=(new Date).getFullYear(),f.input=f.display=u(f.value,f.length),o=!0;else if("m"===f.type&&0===c.length&&(p||i))f.value=0,f.input=f.display=u(f.value,f.length),o=!0;else if(""===c)f.value=null,f.display=g(f);else if(f!==l)f.value=+c,"M"===f.type&&f.value--,f.display=g(f);else if("M"===f.type&&+c>1||"d"===f.type&&+c>3||"H"===f.type&&+c>2||("m"===f.type||"s"===f.type)&&+c>6)f.value=+c,"M"===f.type&&f.value--,f.display=u(c,f.length),o=!0;else if("y"===f.type&&2===c.length&&(p||i)){var y=(new Date).getFullYear(),h=100*Math.floor(y/100),m=Math.abs(y-(h+ +c))<20?h+ +c:h-100+ +c;f.value=m,f.input=f.display=u(m,f.length),o=!0}else f.display=r(c,f.length,a),f.value=+c}return o}function f(e,t,n){var a=(t=e.value=t&&M(t,n))?[t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()]:[null,null,null,null,null,null,null];e.forEach(function(e){e.value=a[l[e.type]],e.input=e.display=g(e)})}function c(e,t,n,a,u){var r=e.value||a(),s=[r.getFullYear(),r.getMonth(),r.getDate(),r.getHours(),r.getMinutes(),r.getSeconds(),r.getMilliseconds()];if(!e.find(function(e){return"m"===e.type||"s"===e.type||"h"===e.type||"S"===e.type})){"function"==typeof u&&(u=u());for(var i=0;i<4;i++)s[i+3]=u[i]}if(e.forEach(function(e){var t=e.value;null!==t&&"M"===e.type?t<0?t=0:t>11&&(t=11):null===t||"m"!==e.type&&"s"!==e.type?null!==t&&"H"===e.type?t<0?t=0:t>23&&(t=23):null!==t&&"h"===e.type&&(t<1?t=1:t>12&&(t=12)):t<0?t=0:t>59&&(t=59),t!==e.value&&(e.value=t,e.display=g(e)),s[l[e.type]]=e.value}),null!==s[0]&&null!==s[1]&&null!==s[2]){var o=e.find(function(e){return"d"===e.type});if(o)if(s[2]<1)o.value=s[2]=1,o.display=g(o);else{var v=b(new Date(s[0],s[1],1));s[2]>v&&(o.value=s[2]=v,o.display=o.input=g(o))}}e.find(function(e){return null===e.value})||0===s[0]||s[1]>11||s[1]<0||0===s[2]?e.value=null:(s.unshift(null),e.value=new(Date.bind.apply(Date,s))),t(n)}function p(e,t){t.value=e.reduce(function(e,t){return e+t.prefix+t.display},"")+e.suffix}function d(e,t){return e.find(function(e){return t>=e.start&&t<=e.end})}function g(e){if(null===e.value)return u("",e.length,a);switch(e.type){case"y":return e.value?e.length<=2?(""+e.value).substr(2,2):""+u(e.value,e.length):u("",e.length,a);case"M":return~e.value?1===e.length?""+(e.value+1):2===e.length?(e.value<9?"0":"")+(e.value+1):3===e.length?h[e.value].substr(0,3):h[e.value]:u("",e.length,a);case"d":return e.value?1===e.length?""+e.value:2===e.length?(e.value<=9?"0":"")+e.value:3===e.length?m[e.groups.value.getDay()].substr(0,3):m[e.groups.value.getDay()]:u("",e.length,a);case"H":case"h":case"m":case"s":return 1===e.length?""+e.value:u(e.value,e.length);case"S":return 1===e.length?""+e.value:u(e.value,3)}}var y=/y+|M+|d+|E+|H+|m+|s+|S+|k+|a+/g,h=["January","February","March","April","May","June","July","August","September","October","November","December"],m=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],D={teardown:function(){}};function b(e){return new Date(new Date(e.getFullYear(),e.getMonth()+1,1)-864e5).getDate()}var w=new Date("0000-01-01T00:00:00");function M(e,t){var n=e;if("function"==typeof n&&(n=e()),"string"==typeof n)if("function"==typeof t)try{n=t(n)}catch(e){return defaultDate()}else try{n=new Date(n)}catch(e){return defaultDate()}return n instanceof Date?n:w}e.padl=u,e.padr=r,e.defaults=s,e.default=function(e){void 0===e&&(e={});var t=e.mask||s.mask,n=i(e.time||s.time),l=e.date||s.date;if("function"!=typeof l){var u=l;l=function(){return u}}return function(u){u.instance.decorators[e.name||"date"]=function(u,h,m){void 0===h&&(h={});var w=Object.assign({},e,"string"==typeof h?{value:h}:h,"string"==typeof m?{mask:m}:m);w.parseDate||(w.parseDate=e.parseDate||s.parseDate);var x=w.date||l,S=i(w.time||n);if("function"!=typeof x){var k=x;x=function(){return k}}var E=this.getContext(u),A=w.mask||t,T={observers:[],listeners:[]};if("INPUT"!==u.tagName)return console.warn("Attempted to add a date decorator a "+u.tagName),D;if(!A)return D;for(var H,F=[],R=0;H=y.exec(A);){var U={mask:H[0],type:H[0][0],length:H[0].length,start:H.index,end:H.index+H[0].length,chunk:F.length,prefix:A.substring(R,H.index),groups:F,value:null,display:r("",H[0].length,a)};R=U.end,F.push(U)}if(F.suffix=A.substring(F[F.length-1].end),F.last=null,F.slice(1).find(function(e){return!e.prefix}))return console.warn("Attempted to add a date decorator missing interstitial between fields '"+A+"'"),D;function Y(e){if(null===F.value&&null===F.last||+F.value==+F.last)return 1;if(!e||!1===w.lazy){if(!1===w.null&&null===F.value)return f(F,F.last,w.parseDate),1;w.min&&F.value<w.min?(f(F,w.min,w.parseDate),p(F,u)):w.max&&F.value>w.max&&(f(F,w.max,w.parseDate),p(F,u)),F.last=F.value,"string"==typeof w.value&&(T.observers.forEach(function(e){return e.silence()}),E.set(w.value,F.value),T.observers.forEach(function(e){return e.resume()})),"string"==typeof w.display&&(T.observers.forEach(function(e){return e.silence()}),E.set(w.display,u.value),T.observers.forEach(function(e){return e.resume()}))}}w.min>w.max&&delete w.min,"string"==typeof w.value&&T.observers.push(E.observe(w.value,function(e){e||!1!==w.null||(e=x()),F.value=e,f(F,e,w.parseDate),F.last=e,p(F,u),(w.min&&e<w.min||w.max&&e>w.max)&&(F.last=null,setTimeout(Y))},{defer:!0})),"string"==typeof w.display&&T.observers.push(E.observe(w.display,function(e){u.value=e||"",o(F,u,A),v(F),c(F,Y,!0,x,S),p(F,u)},{defer:!0})),w.display||w.value||((w.date||!1===w.null)&&(F.value=M(w.date||x(),w.parseDate)),p(F,u)),T.listeners.push(E.listen("input",function(){var e=u.selectionStart,t=u.value;o(F,u,A);var n=d(F,e),a=v(F,n,e);if(c(F,Y,!0,x,S),p(F,u),n&&(t.length>=A.length&&e===n.end||a)&&n!==F[F.length-1]){var l=F[F.indexOf(n)+1];u.setSelectionRange(l.start,l.end)}else u.setSelectionRange(e,e)})),T.listeners.push(E.listen("blur",function(){Y(!1)&&f(F,F.value,w.parseDate),p(F,u)}));var C=function(){var e;e=u.selectionStart===u.value.length&&u.selectionEnd===u.value.length?F[0]:d(F,u.selectionStart),document.activeElement===u&&u.setSelectionRange(e.start,e.end)};return T.listeners.push(E.listen("click",C)),T.listeners.push(E.listen("focus",C)),T.listeners.push(E.listen("keydown",function(e){switch(e.key){case"Enter":case"Tab":var t=d(F,u.selectionStart),n=F.indexOf(t);v(F,t,u.selectionStart,!0)&&(p(F,u),c(F,Y,e.shiftKey&&n>0||!e.shiftKey&&n+1<F.length,x,S)),e.shiftKey&&n>0?(u.setSelectionRange(F[n-1].start,F[n-1].end),e.preventDefault(),e.stopPropagation()):!e.shiftKey&&n+1<F.length&&(u.setSelectionRange(F[n+1].start,F[n+1].end),e.preventDefault(),e.stopPropagation());break;case"ArrowUp":case"ArrowDown":var a=[u.selectionStart,u.selectionEnd],l=a[0],r=a[1],s=d(F,l);null===s.value&&(s.value=1),function(e,t){switch(e.type){case"y":e.value=e.value+(t?-1:1);break;case"M":e.value=t?e.value<1?11:e.value-1:e.value>10?0:e.value+1;break;case"d":var n=e.groups,a=b(new Date((n.find(function(e){return"y"===e.type})||{value:1}).value,(n.find(function(e){return"M"===e.type})||{value:1}).value));e.value=t?e.value<2?a:e.value-1:e.value+1>a?1:e.value+1;break;case"H":e.value=t?e.value<1?23:e.value-1:e.value>22?0:e.value+1;break;case"h":e.value=t?e.value<1?12:e.value-1:e.value>11?1:e.value+1;break;case"m":case"s":e.value=t?e.value<1?59:e.value-1:e.value>58?0:e.value+1;break;case"S":e.value=t?e.value<1?999:e.value-1:e.value>998?0:e.value+1}}(s,"ArrowDown"===e.key),s.input=s.display=g(s),c(F,Y,!0,x,S),p(F,u),e.preventDefault(),e.stopPropagation(),u.setSelectionRange(l,r)}})),{teardown:function(){T.observers.forEach(function(e){return e.cancel()}),T.listeners.forEach(function(e){return e.cancel()})}}}}},Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.RauiDate={})}(this,function(e){"use strict";var t=/[^\d]+/,n=/[^\d_]+/,a="_",l={y:0,M:1,d:2,H:3,m:4,s:5,S:6};function u(e,t,n){void 0===n&&(n="0");for(var a=null==e?"":""+e,l=a.length;l<t;l++)a=n+a;return a}function r(e,t,n){void 0===n&&(n="0");for(var a=null==e?"":""+e,l=a.length;l<t;l++)a+=n;return a}var i={mask:"yyyy-MM-dd",time:[0,0,0,0],date:function(){var e=new Date,t=i.time;return new Date(e.getFullYear(),e.getMonth(),e.getDate(),t[0],t[1],t[2],t[3])},parseDate:function(e){return new Date(e)}};function s(e){if("start"===e)e=[0,0,0,0];else if("end"===e)e=[23,59,59,999];else if("mid"===e)e=[12,0,0,0];else if("now"===e)e=function(){var e=new Date;return[e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()]};else if("string"==typeof e){var t=new Date("2000-05-13T"+e+"Z");+t&&(e=[t.getUTCHours(),t.getUTCMinutes(),t.getUTCSeconds(),t.getUTCMilliseconds()])}return Array.isArray(e)||"function"==typeof e||Array.isArray(e())||(e=[0,0,0,0]),e}function o(e,t,n){var a=t.value,l=d(e,t.selectionStart),u=0,r=e[u],i=e[u+1];e.forEach(function(e){return e.input=""});for(var s=0;s<a.length;s++)i&&a[s]===i.prefix[0]&&(l!==r||r.input.length>=r.length||a.length-s<n.length-r.end+(r.length-r.input.length))?(i.prefix.length>1&&(s+=i.prefix.length-1),a[s+1]===i.prefix[0]&&(s+=i.prefix.length),r=e[++u],i=e[u+1]):r.input+=a[s]}function v(e,l,i,s){void 0===i&&(i=0),void 0===s&&(s=!1);for(var o=!1,v=0;v<e.length;v++){var f=e[v],c=(f.input||"").replace(t,""),p=e[v+1]&&e[v+1].prefix&&n.test(f.input);if(c.length>f.length&&f===l){var d=c.length-l.length;c=c.substr(0,i-l.start)+c.substr(i-l.start+d)}else c=c.substr(0,f.length);if(f.input=c,"y"===f.type&&0===c.length&&(p||s))f.value=(new Date).getFullYear(),f.input=f.display=u(f.value,f.length),o=!0;else if("m"===f.type&&0===c.length&&(p||s))f.value=0,f.input=f.display=u(f.value,f.length),o=!0;else if("d"===f.type&&c.length!==f.length&&s)f.value=+c,f.display=g(f);else if(""===c)f.value=null,f.display=g(f);else if(f!==l)f.value=+c,"M"===f.type&&f.value--,f.display=g(f);else if("M"===f.type&&+c>1||"d"===f.type&&+c>3||"H"===f.type&&+c>2||("m"===f.type||"s"===f.type)&&+c>6)f.value=+c,"M"===f.type&&f.value--,f.display=u(c,f.length),o=!0;else if("y"===f.type&&2===c.length&&(p||s)){var y=(new Date).getFullYear(),h=100*Math.floor(y/100),m=Math.abs(y-(h+ +c))<20?h+ +c:h-100+ +c;f.value=m,f.input=f.display=u(m,f.length),o=!0}else f.display=r(c,f.length,a),f.value=+c}return o}function f(e,t,n){var a=(t=e.value=t&&M(t,n))?[t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()]:[null,null,null,null,null,null,null];e.forEach(function(e){e.value=a[l[e.type]],e.input=e.display=g(e)})}function c(e,t,n,a,u){var r=e.value||a(),i=[r.getFullYear(),r.getMonth(),r.getDate(),r.getHours(),r.getMinutes(),r.getSeconds(),r.getMilliseconds()];if(!e.find(function(e){return"m"===e.type||"s"===e.type||"h"===e.type||"S"===e.type})){"function"==typeof u&&(u=u());for(var s=0;s<4;s++)i[s+3]=u[s]}if(e.forEach(function(e){var t=e.value;null!==t&&"M"===e.type?t<0?t=0:t>11&&(t=11):null===t||"m"!==e.type&&"s"!==e.type?null!==t&&"H"===e.type?t<0?t=0:t>23&&(t=23):null!==t&&"h"===e.type&&(t<1?t=1:t>12&&(t=12)):t<0?t=0:t>59&&(t=59),t!==e.value&&(e.value=t,e.display=g(e)),i[l[e.type]]=e.value}),null!==i[0]&&null!==i[1]&&null!==i[2]){var o=e.find(function(e){return"d"===e.type});if(o)if(i[2]<1)o.value=i[2]=1,o.display=g(o);else{var v=b(new Date(i[0],i[1],1));i[2]>v&&(o.value=i[2]=v,o.display=o.input=g(o))}}e.find(function(e){return null===e.value})||0===i[0]||i[1]>11||i[1]<0||0===i[2]?e.value=null:(i.unshift(null),e.value=new(Date.bind.apply(Date,i))),t(n)}function p(e,t){t.value=e.reduce(function(e,t){return e+t.prefix+t.display},"")+e.suffix}function d(e,t){return e.find(function(e){return t>=e.start&&t<=e.end})}function g(e){if(null===e.value)return u("",e.length,a);switch(e.type){case"y":return e.value?e.length<=2?(""+e.value).substr(2,2):""+u(e.value,e.length):u("",e.length,a);case"M":return~e.value?1===e.length?""+(e.value+1):2===e.length?(e.value<9?"0":"")+(e.value+1):3===e.length?h[e.value].substr(0,3):h[e.value]:u("",e.length,a);case"d":return e.value?1===e.length?""+e.value:2===e.length?(e.value<=9?"0":"")+e.value:3===e.length?m[e.groups.value.getDay()].substr(0,3):m[e.groups.value.getDay()]:u("",e.length,a);case"H":case"h":case"m":case"s":return 1===e.length?""+e.value:u(e.value,e.length);case"S":return 1===e.length?""+e.value:u(e.value,3)}}var y=/y+|M+|d+|E+|H+|m+|s+|S+|k+|a+/g,h=["January","February","March","April","May","June","July","August","September","October","November","December"],m=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],D={teardown:function(){}};function b(e){return new Date(new Date(e.getFullYear(),e.getMonth()+1,1)-864e5).getDate()}var w=new Date("0000-01-01T00:00:00");function M(e,t){var n=e;if("function"==typeof n&&(n=e()),"string"==typeof n)if("function"==typeof t)try{n=t(n)}catch(e){return defaultDate()}else try{n=new Date(n)}catch(e){return defaultDate()}return n instanceof Date?n:w}e.padl=u,e.padr=r,e.defaults=i,e.default=function(e){void 0===e&&(e={});var t=e.mask||i.mask,n=s(e.time||i.time),l=e.date||i.date;if("function"!=typeof l){var u=l;l=function(){return u}}return function(u){u.instance.decorators[e.name||"date"]=function(u,h,m){void 0===h&&(h={});var w=Object.assign({},e,"string"==typeof h?{value:h}:h,"string"==typeof m?{mask:m}:m);w.parseDate||(w.parseDate=e.parseDate||i.parseDate);var x=w.date||l,k=s(w.time||n);if("function"!=typeof x){var S=x;x=function(){return S}}var E=this.getContext(u),A=w.mask||t,T={observers:[],listeners:[]},H=!1;if("INPUT"!==u.tagName)return console.warn("Attempted to add a date decorator a "+u.tagName),D;if(!A)return D;for(var F,O=[],U=0;F=y.exec(A);){var Y={mask:F[0],type:F[0][0],length:F[0].length,start:F.index,end:F.index+F[0].length,chunk:O.length,prefix:A.substring(U,F.index),groups:O,value:null,display:r("",F[0].length,a)};U=Y.end,O.push(Y)}if(O.suffix=A.substring(O[O.length-1].end),O.last=null,O.slice(1).find(function(e){return!e.prefix}))return console.warn("Attempted to add a date decorator missing interstitial between fields '"+A+"'"),D;function C(e){if(null===O.value&&null===O.last||+O.value==+O.last)return 1;if(!e||!1===w.lazy){if(!1===w.null&&null===O.value)return f(O,O.last,w.parseDate),1;w.min&&O.value<w.min?(f(O,w.min,w.parseDate),p(O,u)):w.max&&O.value>w.max&&(f(O,w.max,w.parseDate),p(O,u)),O.last=O.value,"string"==typeof w.value&&(T.observers.forEach(function(e){return e.silence()}),E.set(w.value,O.value),T.observers.forEach(function(e){return e.resume()})),"string"==typeof w.display&&(T.observers.forEach(function(e){return e.silence()}),E.set(w.display,u.value),T.observers.forEach(function(e){return e.resume()}))}}w.min>w.max&&delete w.min,"string"==typeof w.value&&T.observers.push(E.observe(w.value,function(e){e||!1!==w.null||(e=x()),O.value=e,f(O,e,w.parseDate),O.last=e,p(O,u),(w.min&&e<w.min||w.max&&e>w.max)&&(O.last=null,setTimeout(C))},{defer:!0})),"string"==typeof w.display&&T.observers.push(E.observe(w.display,function(e){u.value=e||"",o(O,u,A),v(O),c(O,C,!0,x,k),p(O,u)},{defer:!0})),w.display||w.value||((w.date||!1===w.null)&&(O.value=M(w.date||x(),w.parseDate)),p(O,u));var P=function(e,t){void 0===t&&(t=u.selectionStart),e&&e.target&&(e=void 0),e||(e=t===u.value.length&&u.selectionEnd===u.value.length?O[0]:d(O,t)),H&&(H=!1,t<e.start&&(e=O[O.indexOf(e)-1])),document.activeElement===u&&u.setSelectionRange(e.start,e.end)};return T.listeners.push(E.listen("input",function(){var e=u.selectionStart,t=u.value;o(O,u,A);var n=d(O,e),a=v(O,n,e);if(c(O,C,!0,x,k),p(O,u),n&&(t.length>=A.length&&e===n.end||a)&&n!==O[O.length-1]){var l=O[O.indexOf(n)+1];P(l,e)}else u.setSelectionRange(e,e)})),T.listeners.push(E.listen("blur",function(){H=!1,C(!1)&&f(O,O.value,w.parseDate),null===O.value&&O.forEach(function(e){return e.value=null}),O.forEach(function(e){return e.display=g(e)}),p(O,u)})),T.listeners.push(E.listen("click",P)),T.listeners.push(E.listen("focus",P)),T.listeners.push(E.listen("keydown",function(e){switch(H=!1,e.key){case"Enter":case"Tab":var t=d(O,u.selectionStart),n=O.indexOf(t);v(O,t,u.selectionStart,!0)&&(p(O,u),c(O,C,e.shiftKey&&n>0||!e.shiftKey&&n+1<O.length,x,k)),e.shiftKey&&n>0?(P(O[n-1]),e.preventDefault(),e.stopPropagation()):!e.shiftKey&&n+1<O.length&&(P(O[n+1]),e.preventDefault(),e.stopPropagation());break;case"Backspace":H=!0;break;case"ArrowUp":case"ArrowDown":var a=[u.selectionStart,u.selectionEnd],l=a[0],r=a[1],i=d(O,l);null===i.value&&(i.value=1),function(e,t){switch(e.type){case"y":e.value=e.value+(t?-1:1);break;case"M":e.value=t?e.value<1?11:e.value-1:e.value>10?0:e.value+1;break;case"d":var n=e.groups,a=b(new Date((n.find(function(e){return"y"===e.type})||{value:1}).value,(n.find(function(e){return"M"===e.type})||{value:1}).value));e.value=t?e.value<2?a:e.value-1:e.value+1>a?1:e.value+1;break;case"H":e.value=t?e.value<1?23:e.value-1:e.value>22?0:e.value+1;break;case"h":e.value=t?e.value<1?12:e.value-1:e.value>11?1:e.value+1;break;case"m":case"s":e.value=t?e.value<1?59:e.value-1:e.value>58?0:e.value+1;break;case"S":e.value=t?e.value<1?999:e.value-1:e.value>998?0:e.value+1}}(i,"ArrowDown"===e.key),i.input=i.display=g(i),c(O,C,!0,x,k),p(O,u),e.preventDefault(),e.stopPropagation(),u.setSelectionRange(l,r)}})),{teardown:function(){T.observers.forEach(function(e){return e.cancel()}),T.listeners.forEach(function(e){return e.cancel()})}}}}},Object.defineProperty(e,"__esModule",{value:!0})});

@@ -1,1 +0,1 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("ractive")):"function"==typeof define&&define.amd?define(["exports","ractive"],e):e(t.RauiDateInput={},t.Ractive)}(this,function(t,e){"use strict";e=e&&e.hasOwnProperty("default")?e.default:e;var n=function(){try{var t=navigator.language||navigator.browserLanguage||navigator.languages[0]||"en";return[[0,1,2,3,4,5,6,7,8,9,10,11].map(function(e){return new Date(2006,e,1).toLocaleString(t,{month:"long"})}),[1,2,3,4,5,6,7].map(function(e){return new Date(2006,0,e).toLocaleString(t,{weekday:"long"})})]}catch(t){return[["January","February","March","April","May","June","July","August","September","October","November","December"],["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]]}}(),r=n[0],i=n[1],a=i.map(function(t){return t[0]}).concat(i.map(function(t){return t[0].toUpperCase()})),o=r.map(function(t){return t.substr(0,3)}),l=function(t){function e(e){t.call(this,e)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.month=function(t,e){void 0===e&&(e=0);var n,r=t||new Date;if(!(r instanceof Date))return{};isNaN(r)&&(r=new Date),e&&(r=new Date(r.getFullYear(),r.getMonth()+e,r.getDate()));try{n=+this.get("firstDay")}catch(t){}("number"!=typeof n||isNaN(n))&&(n=0),n>6&&(n=0);for(var i=new Date(r.getFullYear(),r.getMonth(),0),o=new Date(r.getFullYear(),r.getMonth()+1,0).getDate(),l=new Date(r.getFullYear(),r.getMonth()+1,1),s=new Date(r.getFullYear(),r.getMonth(),1).getDay(),f=[],c=f[0]=[],u=0;u<7;u++)f[0].unshift({y:i.getFullYear(),m:i.getMonth(),d:i.getDate()-u}),f[0].push({y:r.getFullYear(),m:r.getMonth(),d:u+1});f[0]=n<=s?f[0].slice(7-(s-n),14-(s-n)):f[0].slice(n-s,7+n-s),1===f[0][0].d&&f.unshift(c.slice(0,7));for(var p=f[f.length-1][f[f.length-1].length-1].d,d=f.length;d<5;d++){f[d]=[];for(var g=0;g<7&&p+1<=o;g++)f[d].push({y:r.getFullYear(),m:r.getMonth(),d:++p});if(f[d].length<7){for(var h=7-f[d].length,v=1;v<=h;v++)f[d].push({y:l.getFullYear(),m:l.getMonth(),d:v});f[d+1]=[];for(var m=0,y=h+1;m<7;m++,y++)f[d+1].push({y:l.getFullYear(),m:l.getMonth(),d:y})}}if(!f[5]){for(f[5]=[];p<o;)f[5].push({y:r.getFullYear(),m:r.getMonth(),d:++p});for(var b=1;b<8;b++)f[5].push({y:l.getFullYear(),m:l.getMonth(),d:b});f[5]=f[5].slice(0,7)}return{days:a.slice(n,n+7),weeks:f,year:r.getFullYear(),month:r.getMonth(),currentYear:(new Date).getFullYear()}},e.prototype.year=function(t,e){void 0===e&&(e=0);var n=t||new Date;if(!(n instanceof Date))return{};e&&(n=new Date(n.getFullYear()+e,n.getMonth(),n.getDate()));for(var r=[],i=0;i<4;i++){r.push([]);for(var a=0;a<3;a++)r[i].push({m:3*i+a,y:n.getFullYear()})}return{year:n.getFullYear(),months:r}},e.prototype.decade=function(t,e){void 0===e&&(e=0);var n=t||new Date;if(!(n instanceof Date))return{};e&&(n=new Date(n.getFullYear()+10*e,n.getMonth(),n.getDate()));for(var r=10*Math.floor(n.getFullYear()/10),i=r-1,a=[],o=0;o<4;o++){a.push([]);for(var l=0;l<3;l++)a[o].push({y:i+3*o+l})}return{start:r,end:r+9,years:a}},e.prototype.monthName=function(t){return r[t]},e.prototype.shortMonthName=function(t){return o[t]},e.prototype.dayName=function(t){return i[t]},e.prototype.select=function(t){if(t&&t instanceof Date)this.set("date",t);else{var e=this.get("safeCurrent");t&&this.set("date",new Date(t.y||e.getFullYear(),"number"==typeof t.m?t.m:e.getMonth(),t.d||e.getDate()));var n=this.get("mode");"year"===n?this.set("mode","months"):"months"===n&&this.set("mode","month"),this.set("target",this.get("date"))}},e.prototype.isCurrent=function(t){var e=this.get("safeCurrent");return!!e&&(t&&t.y===e.getFullYear()&&(null==t.m||t.m===e.getMonth())&&(null==t.d||t.d===e.getDate()))},e.prototype.next=function(){var t=this.get("safeTarget"),e=this.get("mode");"month"===e&&this.set("target",new Date(t.getFullYear(),t.getMonth()+1,1)),"months"===e&&this.set("target",new Date(t.getFullYear()+1,t.getMonth(),1)),"year"===e&&this.set("target",new Date(t.getFullYear()+10,t.getMonth(),1))},e.prototype.prev=function(){var t=this.get("safeTarget"),e=this.get("mode");"month"===e&&this.set("target",new Date(t.getFullYear(),t.getMonth()-1,1)),"months"===e&&this.set("target",new Date(t.getFullYear()-1,t.getMonth(),1)),"year"===e&&this.set("target",new Date(t.getFullYear()-10,t.getMonth(),1))},e.prototype.today=function(){this.set("date",new Date),this.set("target",this.get("date"))},e}(e);e.extendWith(l,{template:{v:4,t:[{t:7,e:"div",m:[{t:13,n:"class",f:"rcal",g:1}],f:[{t:4,f:[{t:4,f:[{t:19,f:[{t:8,r:"~/mode"}],n:54,z:[{n:"left",x:{x:{r:["@index"],s:"_0===0"}}},{n:"right",x:{x:{r:["@last","@index"],s:"_0===_1"}}}]}],n:52,z:[{n:"offset",x:{r:"."}}],r:"~/padding"}],n:50,r:"~/padding"},{t:4,f:[{t:19,f:[{t:8,r:"~/mode"}],n:54,z:[{n:"offset",x:{x:{r:[],s:"0"}}},{n:"left",x:{x:{r:[],s:"true"}}},{n:"right",x:{x:{r:[],s:"true"}}}]}],n:51,l:1}]}],e:{0:function(){return 0},"_0===0":function(t){return 0===t},"_0===_1":function(t,e){return t===e},true:function(){return!0},"[_0.prev(),false]":function(t){return[t.prev(),!1]},'[_0.set("mode","month"),false]':function(t){return[t.set("mode","month"),!1]},"[_0.next(),false]":function(t){return[t.next(),!1]},"_1>_0||_1<_2":function(t,e,n){return e>t||e<n},"_0.isCurrent(_1)":function(t,e){return t.isCurrent(e)},"[_0.select(_1),false]":function(t,e){return[t.select(e),!1]},"_0.decade(_1,_2)":function(t,e,n){return t.decade(e,n)},'[_0.set("mode","year"),false]':function(t){return[t.set("mode","year"),!1]},"_0.shortMonthName(_1)":function(t,e){return t.shortMonthName(e)},"_0.year(_1,_2)":function(t,e,n){return t.year(e,n)},'[_0.set("mode","months"),false]':function(t){return[t.set("mode","months"),!1]},"_0.monthName(_1)":function(t,e){return t.monthName(e)},"_0!==_1":function(t,e){return t!==e},"[_0.select(_1)]":function(t,e){return[t.select(e)]},"_0.month(_1,_2)":function(t,e,n){return t.month(e,n)}},p:{year:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-wrapper",g:1}],f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-block-outer",g:1}],f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-block-header",g:1}],f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-click rcal-arrow",g:1},{t:4,f:[{n:["click"],t:70,f:{r:["@this"],s:"[_0.prev(),false]"}}],n:50,r:"left"}],f:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-left",g:1}]}],n:50,r:"left"}]}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-click rcal-title",g:1},{n:["click"],t:70,f:{r:["@this"],s:'[_0.set("mode","month"),false]'}}],f:[{t:2,r:".start"}," - ",{t:2,r:".end"}]}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-click rcal-arrow",g:1},{t:4,f:[{n:["click"],t:70,f:{r:["@this"],s:"[_0.next(),false]"}}],n:50,r:"right"}],f:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-right",g:1}]}],n:50,r:"right"}]}]}," ",{t:19,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-decade",g:1}],f:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-inner-row",g:1}],f:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-inner-pick",g:1},{n:"class-rcal-off-day",t:13,f:[{t:2,x:{r:["year.end",".y","year.start"],s:"_1>_0||_1<_2"}}]},{n:"class-rcal-current",t:13,f:[{t:2,x:{r:["@this","."],s:"_0.isCurrent(_1)"}}]},{n:["click"],t:70,f:{r:["@this","."],s:"[_0.select(_1),false]"}}],f:[{t:2,r:".y"}]}],n:52,r:"."}]}],n:52,r:".years"}]}],n:54,z:[{n:"year",x:{r:"."}}]}]}]}],n:54,x:{r:["@this","~/safeTarget","offset"],s:"_0.decade(_1,_2)"}}],months:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-wrapper",g:1}],f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-block-outer",g:1}],f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-block-header",g:1}],f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-click rcal-arrow",g:1},{t:4,f:[{n:["click"],t:70,f:{r:["@this"],s:"[_0.prev(),false]"}}],n:50,r:"left"}],f:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-left",g:1}]}],n:50,r:"left"}]}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-click rcal-title",g:1},{n:["click"],t:70,f:{r:["@this"],s:'[_0.set("mode","year"),false]'}}],f:[{t:2,r:".year"}]}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-click rcal-arrow",g:1},{t:4,f:[{n:["click"],t:70,f:{r:["@this"],s:"[_0.next(),false]"}}],n:50,r:"right"}],f:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-right",g:1}]}],n:50,r:"right"}]}]}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-year",g:1}],f:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-inner-row",g:1}],f:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-inner-pick",g:1},{n:"class-rcal-current",t:13,f:[{t:2,x:{r:["@this","."],s:"_0.isCurrent(_1)"}}]},{n:["click"],t:70,f:{r:["@this","."],s:"[_0.select(_1),false]"}}],f:[{t:2,x:{r:["@this",".m"],s:"_0.shortMonthName(_1)"}}]}],n:52,r:"."}]}],n:52,r:".months"}]}]}]}],n:54,x:{r:["@this","~/safeTarget","offset"],s:"_0.year(_1,_2)"}}],month:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-wrapper",g:1},{n:"class-rcal-pad",t:13,f:[{t:2,r:"~/pad"}]}],f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-block-outer",g:1}],f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-block-header",g:1}],f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-click rcal-arrow",g:1},{t:4,f:[{n:["click"],t:70,f:{r:["@this"],s:"[_0.prev(),false]"}}],n:50,r:"left"}],f:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-left",g:1}]}],n:50,r:"left"}]}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-click rcal-title",g:1},{n:["click"],t:70,f:{r:["@this"],s:'[_0.set("mode","months"),false]'}}],f:[{t:2,x:{r:["@this",".month"],s:"_0.monthName(_1)"}},{t:4,f:[" ",{t:2,r:".year"}],n:50,x:{r:[".currentYear",".year"],s:"_0!==_1"}}]}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-click rcal-arrow",g:1},{t:4,f:[{n:["click"],t:70,f:{r:["@this"],s:"[_0.next(),false]"}}],n:50,r:"right"}],f:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-right",g:1}]}],n:50,r:"right"}]}]}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-month",g:1}],f:[{t:19,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-week rcal-week-header",g:1}],f:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-day rcal-day-header",g:1}],f:[{t:2,r:"."}]}],n:52,r:".days"}]}," ",{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-week",g:1}],f:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-day",g:1},{n:"class-rcal-off-day",t:13,f:[{t:2,x:{r:[".m","month.month"],s:"_0!==_1"}}]},{n:"class-rcal-current",t:13,f:[{t:2,x:{r:["@this","."],s:"_0.isCurrent(_1)"}}]},{n:["click"],t:70,f:{r:["@this","."],s:"[_0.select(_1)]"}}],f:[{t:2,r:".d"}]}],n:52,r:"."}]}],n:52,r:".weeks"}],n:54,z:[{n:"month",x:{r:"."}}]}]}]}]}],n:54,x:{r:["@this","~/safeTarget","offset"],s:"_0.month(_1,_2)"}}]}},css:function(t){return[function(t){return".rcal-wrapper {\n display: flex;\n flex-direction: column;\n width: 15em;\n height: 17em;\n }\n \n .rcal-pad {\n padding: 0.5em;\n }\n \n .rcal-block-outer {\n border: 1px solid "+(t("raui.datePicker.primary.bga")||t("raui.primary.bga")||"#f4f4f4")+";\n display: flex;\n flex-direction: column;\n flex-grow: 1;\n }\n \n .rcal-block-header {\n text-align: center;\n background-color: "+(t("raui.datePicker.primary.fga")||t("raui.primary.fga")||"#07e")+";\n color: "+(t("raui.datePicker.primary.bg")||t("raui.primary.bg")||"#fff")+";\n cursor: default;\n display: flex;\n justify-content: space-between;\n line-height: 2em;\n height: 2em;\n align-items: center;\n }\n \n .rcal-arrow {\n width: 2em;\n }\n .rcal-title {\n flex-grow: 1;\n }\n \n .rcal-click {\n cursor: pointer;\n }\n \n .rcal-left, .rcal-right {\n height: 0.8em;\n display: inline-block;\n box-sizing: border-box;\n border: 0.4em solid transparent;\n cursor: pointer;\n }\n .rcal-left {\n border-right-color: "+(t("raui.datePicker.primary.bg")||t("raui.primary.bg")||"#fff")+";\n }\n .rcal-right {\n border-left-color: "+(t("raui.datePicker.primary.bg")||t("raui.primary.bg")||"#fff")+";\n }\n \n .rcal-month, .rcal-year, .rcal-decade {\n display: flex;\n flex-direction: column;\n background-color: "+(t("raui.datePicker.primary.bga")||t("raui.primary.bga")||"#f4f4f4")+";\n justify-content: space-between;\n flex-grow: 1;\n }\n .rcal-year, .rcal-decade {\n justify-content: space-around;\n }\n \n .rcal-week {\n height: 2em;\n display: flex;\n justify-content: space-between;\n }\n \n .rcal-inner-row {\n height: 2em;\n display: flex;\n justify-content: space-around;\n }\n \n .rcal-inner-pick {\n background-color: "+(t("raui.datePicker.primary.bg")||t("raui.primary.bg")||"#fff")+";\n width: 3em;\n height: 2em;\n line-height: 2em;\n text-align: center;\n cursor: pointer;\n }\n \n .rcal-week-header {\n background-color: "+(t("raui.datePicker.primary.fga")||t("raui.primary.fga")||"#07e")+";\n }\n \n .rcal-day {\n background-color: "+(t("raui.datePicker.primary.bg")||t("raui.primary.bg")||"#fff")+";\n width: 2em;\n height: 2em;\n text-align: center;\n line-height: 2em;\n cursor: pointer;\n }\n \n .rcal-day-header {\n color: "+(t("raui.datePicker.primary.bg")||t("raui.primary.bg")||"#fff")+";\n background-color: "+(t("raui.datePicker.primary.fga")||t("raui.primary.fga")||"#07e")+";\n cursor: default;\n }\n \n .rcal-off-day {\n background-color: "+(t("raui.datePicker.primary.bc")||t("raui.primary.bc")||"#ccc")+";\n }\n \n .rcal-current {\n color: "+(t("raui.datePicker.primary.bg")||t("raui.primary.bg")||"#fff")+";\n background-color: "+(t("raui.datePicker.primary.fg")||t("raui.primary.fg")||"#222")+";\n }\n "}.call(this,t)].join(" ")},noCssTransform:!0,data:function(){return{mode:"month",target:new Date}},computed:{safeCurrent:function(){var t=this.get("date");if("string"==typeof t)try{t=new Date(t)}catch(t){}return t&&t instanceof Date&&!isNaN(t)?t:new Date},safeTarget:function(){var t=this.get("target");if(t||(t=this.get("date")),"string"==typeof t)try{t=new Date(t)}catch(t){}return t&&t instanceof Date&&!isNaN(t)?t:new Date}}});var s="undefined"!=typeof window?window:null;function f(t,e,n){if(s&&s.Ractive&&"object"==typeof s.Ractive[e]){var r=document.currentScript;if(r||(r=(r=document.querySelectorAll("script"))[r.length-1]),r){var i=r.getAttribute("data-alias");i&&(i=(i=i.split("&")).reduce(function(t,e){var n=e.split("="),r=n[0],i=n[1];return t[r]=i,t},{})),Ractive[e][i&&i[t]||t]=n}}}function c(t,e){void 0===e&&(e={});var n=t.processParams(e,{duration:400,easing:"easeInOut"});e.dir=e.dir||!1;var r=e.distance||"20px",i=e.scale||"0.9",a="above"===e.dir?"translateY("+r+")":"left"===e.dir?"translateX("+r+")":"right"===e.dir?"translateX(-"+r+")":"translateY(-"+r+")";return t.isIntro||n.intro?(t.setStyle("opacity",0),t.setStyle("transform","scale("+i+") "+a),t.animateStyle({opacity:1,transform:"none"},n)):(t.setStyle("opacity",1),t.setStyle("transform","none"),t.animateStyle({opacity:0,transform:"scale("+i+") "+a},n))}function u(t){return void 0===t&&(t={}),function(e){e.instance.transitions[t.name||"pop"]=c}}function p(t,e){var n=!1,r=!1;function i(n){for(var r=n.target;r;){if(r===t)return;if(!r.parentNode&&r!==document)return;r=r.parentNode}e(n)}return setTimeout(function(){n=!0,r||(document.body.addEventListener("click",i,{capture:!0}),document.body.addEventListener("touchstop",i,{capture:!0}))}),{teardown:function(){r=!0,n&&(document.body.removeEventListener("click",i,{capture:!0}),document.body.removeEventListener("touchstop",i,{capture:!0}))}}}function d(t,e){var n=t.processParams(e,{duration:200,easing:"easeInOut"});return t.isIntro||n.intro?(t.setStyle("opacity",0),t.animateStyle("opacity",1,n)):(t.setStyle("opacity",1),t.animateStyle("opacity",0,n))}function g(t){return void 0===t&&(t={}),function(e){e.instance.transitions[t.name||"fade"]=d}}f("pop","transitions",c),f("fade","transitions",d);var h,v,m,y,b={v:4,t:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rpop-wrapper",g:1},{n:"class-rpop-with-tail",t:13,f:[{t:2,r:"position.tail"}]},{n:"class",f:["rpop-",{t:2,x:{r:["where"],s:'_0||"below"'}}," rpop-align-",{t:2,x:{r:["align"],s:'_0||"middle"'}}],t:13},{t:4,f:[{n:"style-top",f:[{t:2,r:"position.popTop"},"px"],t:13},{n:"style-left",f:[{t:2,r:"position.popLeft"},"px"],t:13}],n:50,r:"position"},{t:4,f:[{t:4,f:[{n:"style-top",f:[{t:2,r:"top"}],t:13}],n:50,r:"top"},{t:4,f:[{n:"style-left",f:[{t:2,r:"left"}],t:13}],n:50,r:"left"}],n:51,l:1},{n:"pop",t:72,f:{r:["where"],s:'[{dir:_0||"below"}]'},v:"t2"},{n:"cleanup",t:71},{t:4,f:[{n:["click"],t:70,f:{r:["@this"],s:'[_0.set("popped",false)]'}}],n:50,r:"clickClose"},{t:4,f:[{n:["clickout"],t:70,f:{r:["@this"],s:'[_0.set("popped",false)]'}}],n:51,r:"noClickout"},{t:16,r:"extra-attributes"}],f:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rpop-tail",g:1},{t:4,f:[{n:"style-top",f:[{t:2,x:{r:["position.tailTop","position.vert"],s:"_0+(_1?3:0)"}},"px"],t:13}],n:50,x:{r:["position.tailTop"],s:"_0!=null"}},{t:4,f:[{n:"style-bottom",f:[{t:2,x:{r:["position.tailBottom","position.vert"],s:"_0+(_1?3:0)"}},"px"],t:13}],n:50,x:{r:["position.tailBottom"],s:"_0!=null"}},{t:4,f:[{n:"style-left",f:[{t:2,x:{r:["position.tailLeft","position.vert"],s:"_0+(_1?0:3)"}},"px"],t:13}],n:50,x:{r:["position.tailLeft"],s:"_0!=null"}},{t:4,f:[{n:"style-right",f:[{t:2,x:{r:["position.tailRight","position.vert"],s:"_0+(_1?0:3)"}},"px"],t:13}],n:50,x:{r:["position.tailRight"],s:"_0!=null"}}]}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rpop-tail-outer",g:1},{t:4,f:[{n:"style-top",f:[{t:2,x:{r:["position.tailTop"],s:"_0-2"}},"px"],t:13}],n:50,x:{r:["position.tailTop"],s:"_0!=null"}},{t:4,f:[{n:"style-bottom",f:[{t:2,x:{r:["position.tailBottom"],s:"_0-2"}},"px"],t:13}],n:50,x:{r:["position.tailBottom"],s:"_0!=null"}},{t:4,f:[{n:"style-left",f:[{t:2,x:{r:["position.tailLeft"],s:"_0-2"}},"px"],t:13}],n:50,x:{r:["position.tailLeft"],s:"_0!=null"}},{t:4,f:[{n:"style-right",f:[{t:2,x:{r:["position.tailRight"],s:"_0-2"}},"px"],t:13}],n:50,x:{r:["position.tailRight"],s:"_0!=null"}}]}],n:50,r:"~/tail"}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rpop",g:1}],f:[{t:16,r:"content",z:[{n:"trigger",x:{r:"triggerContext"}}]}]}]}],n:50,r:"__popped"}],e:{'_0||"below"':function(t){return t||"below"},'_0||"middle"':function(t){return t||"middle"},'[{dir:_0||"below"}]':function(t){return[{dir:t||"below"}]},'[_0.set("popped",false)]':function(t){return[t.set("popped",!1)]},"_0+(_1?3:0)":function(t,e){return t+(e?3:0)},"_0!=null":function(t){return null!=t},"_0+(_1?0:3)":function(t,e){return t+(e?0:3)},"_0-2":function(t){return t-2},"[{delay:200}]":function(){return[{delay:200}]},"[_0===_1&&_2.done(),true]":function(t,e,n){return[t===e&&n.done(),!0]},"[_0.done()]":function(t){return[t.done()]},true:function(){return!0}},p:{modal:[{t:4,f:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rpop-modal",g:1},{n:"fade",t:72,v:"t1"},{n:"fade",t:72,f:{r:[],s:"[{delay:200}]"},v:"t2"},{t:4,f:[{n:["click"],t:70,f:{r:["@node","@event.target","."],s:"[_0===_1&&_2.done(),true]"}}],n:51,r:".noClickout"}],f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rpop",g:1},{n:"pop",t:72,f:{r:[],s:"[{delay:200}]"},v:"t1"},{n:"pop",t:72,v:"t2"},{t:4,f:[{n:["click"],t:70,f:{r:["."],s:"[_0.done()]"}}],n:50,r:".clickClose"},{t:8,r:".attrs",c:{r:".context"},z:[{n:"inModal",x:{x:{r:[],s:"true"}}}]}],f:[{t:8,r:".content",c:{r:".context"},z:[{n:"inModal",x:{x:{r:[],s:"true"}}}]}]}]}],n:54,r:"contents.0"}],n:50,r:"contents.length"}]}};function w(){}var x,_=function(t){function e(e){t.call(this,e)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.position=function(e){var n=e||this.source,r=this.get("popped");if(n&&r){var i=this.find("div");if(n&&i&&i.offsetParent){n?this.set("triggerContext",t.getContext(n)):this.set("triggerContext",null);var a=i.offsetParent,o=a.getBoundingClientRect(),l=i.getBoundingClientRect(),s=n.getBoundingClientRect(),f=this.get("where")||"below",c=this.get("align")||"middle",u=this.get("tail"),p="above"===f||"below"===f,d=this.get("fit"),g=this.get("gap"),h="above"===f||"below"===f?0:"left"===f?-l.width-g:s.width+g,v="left"===f||"right"===f?-s.height:"above"===f?-s.height-l.height-g:g;"middle"===c?"below"===f||"above"===f?h-=(l.width-s.width)/2:"left"!==f&&"right"!==f||(v-=(l.height-s.height)/2):"end"===c&&("below"===f||"above"===f?h+=s.width-l.width:"left"!==f&&"right"!==f||(v+=s.height-l.height));var m={popTop:s.bottom-o.top+v,popLeft:s.left-o.left+h,tail:u,vert:"above"===f||"below"===f};if(a.scrollTop&&(m.popTop+=a.scrollTop),a.scrollLeft&&(m.popLeft+=a.scrollLeft),u){"above"===f?m.tailBottom=-10:"below"===f?m.tailTop=-10:"left"===f?m.tailRight=-10:"right"===f&&(m.tailLeft=-10);var y=this.tailSource?this.tailSource.getBoundingClientRect():s;"start"===c?p?m.tailLeft=Math.floor(y.width/2)-10:m.tailTop=Math.floor(y.height/2)-10:"end"===c?p?m.tailRight=Math.floor(y.width/2)-10:m.tailBottom=Math.floor(y.height/2)-10:"middle"===c&&(p?m.tailLeft=Math.floor(y.width/2)-10:m.tailTop=Math.floor(y.height/2)-10),y!==s?p?(null!=m.tailLeft&&(m.tailLeft+=y.left-s.left),null!=m.tailRight&&(m.tailRight+=s.right-y.right)):(null!=m.tailTop&&(m.tailTop+=y.top-s.top),null!=m.tailBottom&&(m.tailBottom+=s.bottom-y.bottom)):"middle"===c&&(p?(null!=m.tailLeft&&(m.tailLeft+=y.left-(m.popLeft+o.left)),null!=m.tailRight&&(m.tailRight+=m.popLeft+o.left+l.width-y.right)):(null!=m.tailTop&&(m.tailTop+=y.top-(m.popTop+o.top)),null!=m.tailBottom&&(m.tailBottom+=m.popTop+o.top+l.height-y.bottom)))}if(d){var b=a;if(this.get("offsets"))for(var w=this.get("offsets");w--;)b=b.offsetParent;var x=a.scrollWidth,_=a.scrollHeight;if(m.popLeft+l.width>x){var k=m.popLeft-(x-l.width);m.popLeft-=k,p&&m.tailLeft&&(m.tailLeft+=k),p&&m.tailRight&&(m.tailRight-=k),u&&!p&&(m.tail=!1)}if(m.popLeft<0){var D=-1*m.popLeft;m.popLeft+=D,p&&m.tailLeft&&(m.tailLeft-=D),p&&m.tailRight&&(m.tailRight+=D),u&&!p&&(m.tail=!1)}if(m.popTop+l.height>_){var M=m.popTop-(_-l.height);m.popTop-=M,!p&&m.tailTop&&(m.tailTop+=M),!p&&m.tailBottom&&(m.tailBottom-=M),u&&p&&(m.tail=!1)}if(m.popTop<0){var T=-1*m.popTop;m.popTop+=T,!p&&m.tailTop&&(m.tailTop-=T),!p&&m.tailBottom&&(m.tailBottom+=T),u&&p&&(m.tail=!1)}}if(o.left+m.popLeft<0){var S=0-(o.left+m.popLeft);m.popLeft+=S,p&&m.tailLeft&&(m.tailLeft-=S),p&&m.tailRight&&(m.tailRight+=S),u&&!p&&(m.tail=!1)}if(o.top+m.popTop<0){var L=0-(o.top+m.popTop);m.popTop+=L,!p&&m.tailTop&&(m.tailTop-=L),!p&&m.tailBottom&&(m.tailBottom+=L),u&&p&&(m.tail=!1)}m.tailLeft&&(m.tailLeft=Math.floor(m.tailLeft)),m.tailRight&&(m.tailRight=Math.floor(m.tailRight)),m.tailTop&&(m.tailTop=Math.floor(m.tailTop)),m.tailBottom&&(m.tailBottom=Math.floor(m.tailBottom)),this.set("position",m)}else this.set("position",null)}},e.prototype.show=function(t){return this.source=t,this.set("popped",!0),this._transdone},e.prototype.hide=function(){return this.set("popped",!1),this._transdone},e}(e);e.extendWith(_,{attributes:["popped","tail","where","align","top","left","fit","clickClose","noClickout","gap","offsets"],use:[u(),(void 0===x&&(x={}),function(t){t.instance.events[x.name||"clickout"]=p}),g()],template:b,css:function(t){return[function(t){var e=Object.assign({},t("raui.primary"),t("raui.pop.primary")),n=(t("raui.themes")||[]).slice();return(t("raui.pop.themes")||[]).forEach(function(t){~n.indexOf(t)||n.push(t)}),"\n .rpop-wrapper {\n position: absolute;\n display: inline-block;\n z-index: 21;\n transition-property: top, left, padding;\n transition-timing-function: ease-in-out;\n transition-duration: 0.3s;\n }\n .rpop-with-tail.rpop-above {\n padding-bottom: 10px;\n }\n .rpop-with-tail.rpop-below {\n padding-top: 10px;\n }\n .rpop-with-tail.rpop-left {\n padding-right: 10px;\n }\n .rpop-with-tail.rpop-right {\n padding-left: 10px;\n }\n \n .rpop {\n position: relative;\n box-shadow: 0 1px 4px 0 rgba(0,0,0,0.24);\n border: 1px solid #ccc;\n border-radius: 0.2em;\n background-color: "+(e.bg||"#fff")+";\n color: "+(e.fg||"#222")+";\n padding: 0.5em;\n z-index: 2;\n }\n \n .rpop-modal {\n position: fixed;\n display: flex;\n z-index: 20;\n background-color: rgba(0, 0, 0, 0.2);\n align-items: center;\n justify-content: center;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n padding: 1em;\n overflow: auto;\n }\n \n .rpop-tail, .rpop-tail-outer {\n z-index: 3;\n width: 0;\n height: 0;\n position: absolute;\n border-style: solid;\n border-width: 10px;\n border-color: transparent;\n transition-property: top, left, bottom, right, border-color;\n transition-timing-function: ease-in-out;\n transition-duration: 0.3s;\n }\n .rpop-tail-outer {\n z-index: 1;\n border-width: 12px;\n border-color: transparent;\n }\n \n .rpop-below .rpop-tail {\n border-bottom-color: "+(e.bg||"#fff")+";\n }\n .rpop-below .rpop-tail-outer {\n border-bottom-color: "+(e.bc||"#ccc")+";\n }\n \n .rpop-above .rpop-tail {\n border-top-color: "+(e.bg||"#fff")+";\n }\n .rpop-above .rpop-tail-outer {\n border-top-color: "+(e.bc||"#ccc")+";\n }\n \n .rpop-left .rpop-tail {\n border-left-color: "+(e.bg||"#fff")+";\n }\n .rpop-left .rpop-tail-outer {\n border-left-color: "+(e.bc||"#ccc")+";\n }\n \n .rpop-right .rpop-tail {\n border-right-color: "+(e.bg||"#fff")+";\n }\n .rpop-right .rpop-tail-outer {\n border-right-color: "+(e.bc||"#ccc")+";\n }\n "+n.map(function(e){var n=Object.assign({},t("raui.primary"),t("raui.pop.primary"),t("raui."+e),t("raui.pop."+e));return"\n ."+e+" .rpop {\n background-color: "+(n.bg||"#fff")+";\n color: "+(n.fg||"#222")+";\n }\n \n ."+e+".rpop-below .rpop-tail {\n border-bottom-color: "+(n.bg||"#fff")+";\n }\n ."+e+".rpop-below .rpop-tail-outer {\n border-bottom-color: "+(n.bc||"#ccc")+";\n }\n \n ."+e+".rpop-above .rpop-tail {\n border-top-color: "+(n.bg||"#fff")+";\n }\n ."+e+".rpop-above .rpop-tail-outer {\n border-top-color: "+(n.bc||"#ccc")+";\n }\n \n ."+e+".rpop-left .rpop-tail {\n border-left-color: "+(n.bg||"#fff")+";\n }\n ."+e+".rpop-left .rpop-tail-outer {\n border-left-color: "+(n.bc||"#ccc")+";\n }\n \n ."+e+".rpop-right .rpop-tail {\n border-right-color: "+(n.bg||"#fff")+";\n }\n ."+e+".rpop-right .rpop-tail-outer {\n border-right-color: "+(n.bc||"#ccc")+";\n }\n "})}.call(this,t)].join(" ")},cssId:"rpop",noCssTransform:!0,observe:{popped:function(t){var e,n=this;t&&(h&&(this.source=h),v&&(this.tailSource=v));var r=this._transdone=new Promise(function(t){return e=t});r.resolve=e,setTimeout(function(){n._transdone=r,n.get("popped")===t&&n.set("_popped",t)},1)},_popped:{handler:function(t){var e=this,n=this._transdone.resolve;if(t){var r=this.get("@style.raui.pop.mobile");if(r&&window.matchMedia("(max-width: "+r+")").matches){y||(y=new k({target:document.body,append:!0}));var i=this.getContext().getParent(!0);i.isContext=1,this.set("__popped",!1).then(n),y.unshift("contents",{content:this.partials.content,context:i,attrs:this.partials["extra-attributes"]||[],clickClose:this.get("clickClose"),noClickout:this.get("noClickout"),done:function(){e.set("popped",!1)}})}else this.set("__popped",!0)}else m?(y.shift("contents"),n()):this.set("__popped",!1).then(n)},defer:!0,init:!1},__popped:{handler:function(t){var e=this._transdone.resolve;if(t){var n=this.find("div"),r=n,i=r.offsetHeight+r.offsetTop,a=r.offsetWidth+r.offsetLeft,o=r.offsetParent;if(!this.overflows)for(var l=this.overflows={e:[],v:[]};n&&n.style;){if(n===o){if(n.offsetWidth>=a&&n.offsetHeight>=i)break;a+=n.offsetLeft,i+=n.offsetTop,o=n.offsetParent}var s=getComputedStyle(n);if("auto"===s.overflow)break;"hidden"===s.overflow&&(l.e.push(n),l.v.push(n.style.overflow),n.style.overflow="visible"),n=n.parentNode}this.position(),this.transition("pop",r,{intro:!0,dir:this.get("where")||"below"}).then(e)}else this.source=null,this.tailSource=null},defer:!0,init:!1},"align where tail fit":{handler:function(){this.position()},defer:!0}},decorators:{cleanup:function(t){var e=this;return{teardown:function(){var t=e.overflows;if(t){e.overflows=null;for(var n=0;n<t.e.length;n++)t.e[n].style.overflow=t.v[n]}}}}},data:function(){return{gap:4}}});var k=function(t){function e(e){t.call(this,e)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(e);e.extendWith(k,{template:{v:b.v,t:b.p.modal},data:function(){return{contents:[]}},use:[u(),g()],observe:{contents:function(t){m=(t||[]).length>0}},on:{init:function(){y?console.warn("More than one PopOver mobile host created."):y=this}}});var D=/[^\d]+/,M=/[^\d_]+/,T="_",S={y:0,M:1,d:2,H:3,m:4,s:5,S:6};function L(t,e,n){void 0===n&&(n="0");for(var r=null==t?"":""+t,i=r.length;i<e;i++)r=n+r;return r}function C(t,e,n){void 0===n&&(n="0");for(var r=null==t?"":""+t,i=r.length;i<e;i++)r+=n;return r}var F={mask:"yyyy-MM-dd",time:[0,0,0,0],date:function(){var t=new Date,e=F.time;return new Date(t.getFullYear(),t.getMonth(),t.getDate(),e[0],e[1],e[2],e[3])},parseDate:function(t){return new Date(t)}};function Y(t){if("start"===t)t=[0,0,0,0];else if("end"===t)t=[23,59,59,999];else if("mid"===t)t=[12,0,0,0];else if("now"===t)t=function(){var t=new Date;return[t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()]};else if("string"==typeof t){var e=new Date("2000-05-13T"+t+"Z");+e&&(t=[e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds()])}return Array.isArray(t)||"function"==typeof t||Array.isArray(t())||(t=[0,0,0,0]),t}function R(t){void 0===t&&(t={});var e=t.mask||F.mask,n=Y(t.time||F.time),r=t.date||F.date;if("function"!=typeof r){var i=r;r=function(){return i}}return function(i){i.instance.decorators[t.name||"date"]=function(i,a,o){void 0===a&&(a={});var l=Object.assign({},t,"string"==typeof a?{value:a}:a,"string"==typeof o?{mask:o}:o);l.parseDate||(l.parseDate=t.parseDate||F.parseDate);var s=l.date||r,f=Y(l.time||n);if("function"!=typeof s){var c=s;s=function(){return c}}var u=this.getContext(i),p=l.mask||e,d={observers:[],listeners:[]};if("INPUT"!==i.tagName)return console.warn("Attempted to add a date decorator a "+i.tagName),W;if(!p)return W;for(var g,h=[],v=0;g=A.exec(p);){var m={mask:g[0],type:g[0][0],length:g[0].length,start:g.index,end:g.index+g[0].length,chunk:h.length,prefix:p.substring(v,g.index),groups:h,value:null,display:C("",g[0].length,T)};v=m.end,h.push(m)}if(h.suffix=p.substring(h[h.length-1].end),h.last=null,h.slice(1).find(function(t){return!t.prefix}))return console.warn("Attempted to add a date decorator missing interstitial between fields '"+p+"'"),W;function y(t){if(null===h.value&&null===h.last||+h.value==+h.last)return 1;if(!t||!1===l.lazy){if(!1===l.null&&null===h.value)return B(h,h.last,l.parseDate),1;l.min&&h.value<l.min?(B(h,l.min,l.parseDate),E(h,i)):l.max&&h.value>l.max&&(B(h,l.max,l.parseDate),E(h,i)),h.last=h.value,"string"==typeof l.value&&(d.observers.forEach(function(t){return t.silence()}),u.set(l.value,h.value),d.observers.forEach(function(t){return t.resume()})),"string"==typeof l.display&&(d.observers.forEach(function(t){return t.silence()}),u.set(l.display,i.value),d.observers.forEach(function(t){return t.resume()}))}}l.min>l.max&&delete l.min,"string"==typeof l.value&&d.observers.push(u.observe(l.value,function(t){t||!1!==l.null||(t=s()),h.value=t,B(h,t,l.parseDate),h.last=t,E(h,i),(l.min&&t<l.min||l.max&&t>l.max)&&(h.last=null,setTimeout(y))},{defer:!0})),"string"==typeof l.display&&d.observers.push(u.observe(l.display,function(t){i.value=t||"",P(h,i,p),N(h),j(h,y,!0,s,f),E(h,i)},{defer:!0})),l.display||l.value||((l.date||!1===l.null)&&(h.value=K(l.date||s(),l.parseDate)),E(h,i)),d.listeners.push(u.listen("input",function(){var t=i.selectionStart,e=i.value;P(h,i,p);var n=O(h,t),r=N(h,n,t);if(j(h,y,!0,s,f),E(h,i),n&&(e.length>=p.length&&t===n.end||r)&&n!==h[h.length-1]){var a=h[h.indexOf(n)+1];i.setSelectionRange(a.start,a.end)}else i.setSelectionRange(t,t)})),d.listeners.push(u.listen("blur",function(){y(!1)&&B(h,h.value,l.parseDate),E(h,i)}));var b=function(){var t;t=i.selectionStart===i.value.length&&i.selectionEnd===i.value.length?h[0]:O(h,i.selectionStart),document.activeElement===i&&i.setSelectionRange(t.start,t.end)};return d.listeners.push(u.listen("click",b)),d.listeners.push(u.listen("focus",b)),d.listeners.push(u.listen("keydown",function(t){switch(t.key){case"Enter":case"Tab":var e=O(h,i.selectionStart),n=h.indexOf(e);N(h,e,i.selectionStart,!0)&&(E(h,i),j(h,y,t.shiftKey&&n>0||!t.shiftKey&&n+1<h.length,s,f)),t.shiftKey&&n>0?(i.setSelectionRange(h[n-1].start,h[n-1].end),t.preventDefault(),t.stopPropagation()):!t.shiftKey&&n+1<h.length&&(i.setSelectionRange(h[n+1].start,h[n+1].end),t.preventDefault(),t.stopPropagation());break;case"ArrowUp":case"ArrowDown":var r=[i.selectionStart,i.selectionEnd],a=r[0],o=r[1],l=O(h,a);null===l.value&&(l.value=1),function(t,e){switch(t.type){case"y":t.value=t.value+(e?-1:1);break;case"M":t.value=e?t.value<1?11:t.value-1:t.value>10?0:t.value+1;break;case"d":var n=t.groups,r=U(new Date((n.find(function(t){return"y"===t.type})||{value:1}).value,(n.find(function(t){return"M"===t.type})||{value:1}).value));t.value=e?t.value<2?r:t.value-1:t.value+1>r?1:t.value+1;break;case"H":t.value=e?t.value<1?23:t.value-1:t.value>22?0:t.value+1;break;case"h":t.value=e?t.value<1?12:t.value-1:t.value>11?1:t.value+1;break;case"m":case"s":t.value=e?t.value<1?59:t.value-1:t.value>58?0:t.value+1;break;case"S":t.value=e?t.value<1?999:t.value-1:t.value>998?0:t.value+1}}(l,"ArrowDown"===t.key),l.input=l.display=z(l),j(h,y,!0,s,f),E(h,i),t.preventDefault(),t.stopPropagation(),i.setSelectionRange(a,o)}})),{teardown:function(){d.observers.forEach(function(t){return t.cancel()}),d.listeners.forEach(function(t){return t.cancel()})}}}}}function P(t,e,n){var r=e.value,i=O(t,e.selectionStart),a=0,o=t[a],l=t[a+1];t.forEach(function(t){return t.input=""});for(var s=0;s<r.length;s++)l&&r[s]===l.prefix[0]&&(i!==o||o.input.length>=o.length||r.length-s<n.length-o.end+(o.length-o.input.length))?(l.prefix.length>1&&(s+=l.prefix.length-1),r[s+1]===l.prefix[0]&&(s+=l.prefix.length),o=t[++a],l=t[a+1]):o.input+=r[s]}function N(t,e,n,r){void 0===n&&(n=0),void 0===r&&(r=!1);for(var i=!1,a=0;a<t.length;a++){var o=t[a],l=(o.input||"").replace(D,""),s=t[a+1]&&t[a+1].prefix&&M.test(o.input);if(l.length>o.length&&o===e){var f=l.length-e.length;l=l.substr(0,n-e.start)+l.substr(n-e.start+f)}else l=l.substr(0,o.length);if(o.input=l,"y"===o.type&&0===l.length&&(s||r))o.value=(new Date).getFullYear(),o.input=o.display=L(o.value,o.length),i=!0;else if("m"===o.type&&0===l.length&&(s||r))o.value=0,o.input=o.display=L(o.value,o.length),i=!0;else if(""===l)o.value=null,o.display=z(o);else if(o!==e)o.value=+l,"M"===o.type&&o.value--,o.display=z(o);else if("M"===o.type&&+l>1||"d"===o.type&&+l>3||"H"===o.type&&+l>2||("m"===o.type||"s"===o.type)&&+l>6)o.value=+l,"M"===o.type&&o.value--,o.display=L(l,o.length),i=!0;else if("y"===o.type&&2===l.length&&(s||r)){var c=(new Date).getFullYear(),u=100*Math.floor(c/100),p=Math.abs(c-(u+ +l))<20?u+ +l:u-100+ +l;o.value=p,o.input=o.display=L(p,o.length),i=!0}else o.display=C(l,o.length,T),o.value=+l}return i}function B(t,e,n){var r=(e=t.value=e&&K(e,n))?[e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()]:[null,null,null,null,null,null,null];t.forEach(function(t){t.value=r[S[t.type]],t.input=t.display=z(t)})}function j(t,e,n,r,i){var a=t.value||r(),o=[a.getFullYear(),a.getMonth(),a.getDate(),a.getHours(),a.getMinutes(),a.getSeconds(),a.getMilliseconds()];if(!t.find(function(t){return"m"===t.type||"s"===t.type||"h"===t.type||"S"===t.type})){"function"==typeof i&&(i=i());for(var l=0;l<4;l++)o[l+3]=i[l]}if(t.forEach(function(t){var e=t.value;null!==e&&"M"===t.type?e<0?e=0:e>11&&(e=11):null===e||"m"!==t.type&&"s"!==t.type?null!==e&&"H"===t.type?e<0?e=0:e>23&&(e=23):null!==e&&"h"===t.type&&(e<1?e=1:e>12&&(e=12)):e<0?e=0:e>59&&(e=59),e!==t.value&&(t.value=e,t.display=z(t)),o[S[t.type]]=t.value}),null!==o[0]&&null!==o[1]&&null!==o[2]){var s=t.find(function(t){return"d"===t.type});if(s)if(o[2]<1)s.value=o[2]=1,s.display=z(s);else{var f=U(new Date(o[0],o[1],1));o[2]>f&&(s.value=o[2]=f,s.display=s.input=z(s))}}t.find(function(t){return null===t.value})||0===o[0]||o[1]>11||o[1]<0||0===o[2]?t.value=null:(o.unshift(null),t.value=new(Date.bind.apply(Date,o))),e(n)}function E(t,e){e.value=t.reduce(function(t,e){return t+e.prefix+e.display},"")+t.suffix}function O(t,e){return t.find(function(t){return e>=t.start&&e<=t.end})}function z(t){if(null===t.value)return L("",t.length,T);switch(t.type){case"y":return t.value?t.length<=2?(""+t.value).substr(2,2):""+L(t.value,t.length):L("",t.length,T);case"M":return~t.value?1===t.length?""+(t.value+1):2===t.length?(t.value<9?"0":"")+(t.value+1):3===t.length?H[t.value].substr(0,3):H[t.value]:L("",t.length,T);case"d":return t.value?1===t.length?""+t.value:2===t.length?(t.value<=9?"0":"")+t.value:3===t.length?I[t.groups.value.getDay()].substr(0,3):I[t.groups.value.getDay()]:L("",t.length,T);case"H":case"h":case"m":case"s":return 1===t.length?""+t.value:L(t.value,t.length);case"S":return 1===t.length?""+t.value:L(t.value,3)}}var A=/y+|M+|d+|E+|H+|m+|s+|S+|k+|a+/g,H=["January","February","March","April","May","June","July","August","September","October","November","December"],I=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],W={teardown:function(){}};function U(t){return new Date(new Date(t.getFullYear(),t.getMonth()+1,1)-864e5).getDate()}var J=new Date("0000-01-01T00:00:00");function K(t,e){var n=t;if("function"==typeof n&&(n=t()),"string"==typeof n)if("function"==typeof e)try{n=e(n)}catch(t){return defaultDate()}else try{n=new Date(n)}catch(t){return defaultDate()}return n instanceof Date?n:J}function q(t){t.strObserver&&t.strObserver.cancel(),t.attributes.value?t.link(t.attributes.value,"rdi.val"):t.unlink("rdi.val"),t.attributes.display?t.link(t.attributes.display,"rdi.display"):t.unlink("rdi.display"),t.attributes.string&&(t.strObserver=t.observe("rdi.val",function(e){return t.set(t.attributes.string,e?e.toString():"")}));var e={};["null","lazy","eager","mask","min","max","mask","no-pick","time"].forEach(function(n){n in t.attributes&&(e[n.replace(/-/g,"")]=t.attributes[n]),"eager"===n&&n in t.attributes&&(e.lazy=!t.attributes.eager)}),t.attributes.value&&(e.value="rdi.val"),t.attributes.display&&(e.display="rdi.display"),t.set("rdi.opts",e)}var X=Ractive.macro(function(t){return t.aliasLocal("rdi"),q(t),t.setTemplate({v:4,t:[{t:7,e:"span",m:[{t:13,n:"class",f:"rdi-date field-wrapper",g:1}],f:[{t:7,e:"input",m:[{n:"rdi-reg",t:71,f:{r:[],s:'["node"]'}},{n:"rdi-date",t:71,f:{r:["rdi.opts"],s:"[_0]"}},{n:"class-rdi-date",t:13},{t:8,r:"extra-attributes"}]}," ",{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rdi-x",g:1},{n:["click"],t:70,f:{r:["@context"],s:'[(_0).set("rdi.val",null)]'}},{n:"title",f:"Clear",t:13,g:1}],f:["×"]}],n:50,x:{r:["rdi.opts.null","rdi.val"],s:"_0&&_1!==null"}}," ",{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rdi-pop",g:1},{n:"rdi-pop",t:71,f:{r:["rdi.node","rdi.tail"],s:'[{path:"rdi.popped",node:_0,tail:_1}]'}},{n:["click"],t:70,f:{r:[],s:"[false,false]"}},{n:"title",f:"Select from calendar",t:13,g:1}],f:[{t:7,e:"svg",m:[{n:"rdi-reg",t:71,f:{r:[],s:'["tail"]'}},{n:"x",f:"0px",t:13,g:1},{n:"y",f:"0px",t:13,g:1},{n:"viewBox",f:"0 0 48 48",t:13,g:1},{n:"xml:space",f:"preserve",t:13}],f:[{t:7,e:"rect",m:[{t:13,n:"style",f:"opacity:0.5;fill:none;stroke-width:1;",g:1},{n:"y",f:"1",t:13,g:1},{n:"x",f:"1",t:13,g:1},{n:"height",f:"46",t:13,g:1},{n:"width",f:"46",t:13,g:1}]}," ",{t:7,e:"rect",m:[{n:"y",f:"1",t:13,g:1},{n:"x",f:"1",t:13,g:1},{n:"height",f:"8",t:13,g:1},{n:"width",f:"46",t:13,g:1}]}," ",{t:7,e:"rect",m:[{t:13,n:"style",f:"opacity:0.2;stroke:none;",g:1},{n:"y",f:"13",t:13,g:1},{n:"x",f:"3",t:13,g:1},{n:"height",f:"8",t:13,g:1},{n:"width",f:"8",t:13,g:1}]}," ",{t:7,e:"rect",m:[{t:13,n:"style",f:"opacity:0.8;stroke:none;",g:1},{t:13,n:"class",f:"rdi-today",g:1},{n:"y",f:"13",t:13,g:1},{n:"x",f:"14",t:13,g:1},{n:"height",f:"8",t:13,g:1},{n:"width",f:"8",t:13,g:1}]}," ",{t:7,e:"rect",m:[{t:13,n:"style",f:"opacity:0.2;stroke:none;",g:1},{n:"y",f:"13",t:13,g:1},{n:"x",f:"25",t:13,g:1},{n:"height",f:"8",t:13,g:1},{n:"width",f:"8",t:13,g:1}]}," ",{t:7,e:"rect",m:[{t:13,n:"style",f:"opacity:0.4;stroke:none;",g:1},{n:"y",f:"13",t:13,g:1},{n:"x",f:"37",t:13,g:1},{n:"height",f:"8",t:13,g:1},{n:"width",f:"8",t:13,g:1}]}," ",{t:7,e:"rect",m:[{t:13,n:"style",f:"opacity:0.2;stroke:none;",g:1},{n:"y",f:"24",t:13,g:1},{n:"x",f:"3",t:13,g:1},{n:"height",f:"8",t:13,g:1},{n:"width",f:"8",t:13,g:1}]}," ",{t:7,e:"rect",m:[{t:13,n:"style",f:"opacity:0.2;stroke:none;",g:1},{n:"y",f:"24",t:13,g:1},{n:"x",f:"14",t:13,g:1},{n:"height",f:"8",t:13,g:1},{n:"width",f:"8",t:13,g:1}]}," ",{t:7,e:"rect",m:[{t:13,n:"style",f:"opacity:0.2;stroke:none;",g:1},{n:"y",f:"24",t:13,g:1},{n:"x",f:"25",t:13,g:1},{n:"height",f:"8",t:13,g:1},{n:"width",f:"8",t:13,g:1}]}," ",{t:7,e:"rect",m:[{t:13,n:"style",f:"opacity:0.4;stroke:none;",g:1},{n:"y",f:"24",t:13,g:1},{n:"x",f:"37",t:13,g:1},{n:"height",f:"8",t:13,g:1},{n:"width",f:"8",t:13,g:1}]}," ",{t:7,e:"rect",m:[{t:13,n:"style",f:"opacity:0.2;stroke:none;",g:1},{n:"y",f:"35",t:13,g:1},{n:"x",f:"3",t:13,g:1},{n:"height",f:"8",t:13,g:1},{n:"width",f:"8",t:13,g:1}]}," ",{t:7,e:"rect",m:[{t:13,n:"style",f:"opacity:0.2;stroke:none;",g:1},{n:"y",f:"35",t:13,g:1},{n:"x",f:"14",t:13,g:1},{n:"height",f:"8",t:13,g:1},{n:"width",f:"8",t:13,g:1}]}," ",{t:7,e:"rect",m:[{t:13,n:"style",f:"opacity:0.2;stroke:none;",g:1},{n:"y",f:"35",t:13,g:1},{n:"x",f:"25",t:13,g:1},{n:"height",f:"8",t:13,g:1},{n:"width",f:"8",t:13,g:1}]}," ",{t:7,e:"rect",m:[{t:13,n:"style",f:"opacity:0.4;stroke:none;",g:1},{n:"y",f:"35",t:13,g:1},{n:"x",f:"37",t:13,g:1},{n:"height",f:"8",t:13,g:1},{n:"width",f:"8",t:13,g:1}]}]}]}],n:51,r:"rdi.opts.nopick"}]}," ",{t:7,e:"rdi-pop",m:[{n:"popped",t:13,f:[{t:2,r:"rdi.popped"}]},{n:"tail",f:0,t:13},{n:"align",f:"end",t:13,g:1}],f:[{t:7,e:"rdi-picker",m:[{n:["init"],t:70,f:{r:["@context","rdi.val"],s:'[(_0).component.set("target",_1)]'}},{n:"date",t:13,f:[{t:2,r:"rdi.val"}]}]}]}],e:{'["node"]':function(){return["node"]},"[_0]":function(t){return[t]},'[(_0).set("rdi.val",null)]':function(t){return[t.set("rdi.val",null)]},"_0&&_1!==null":function(t,e){return t&&null!==e},'[{path:"rdi.popped",node:_0,tail:_1}]':function(t,e){return[{path:"rdi.popped",node:t,tail:e}]},"[false,false]":function(){return[!1,!1]},'["tail"]':function(){return["tail"]},'[(_0).component.set("target",_1)]':function(t,e){return[t.component.set("target",e)]}}}),{update:function(){q(t)}}},{css:function(t){return[function(t){return".rdi-date {\n position: relative;\n display: inline-block;\n }\n \n .rdi-date input.rdi-date {\n width: 100%;\n box-sizing: border-box;\n }\n \n .rdi-x {\n position: absolute;\n right: 2em;\n top: 0.025em;\n cursor: pointer;\n }\n \n .rdi-pop {\n position: absolute;\n display: flex;\n justify-content: space-around;\n align-items: flex-end;\n flex-direction: column;\n right: 0.5em;\n height: 100%;\n top: 0;\n cursor: pointer;\n }\n \n .rdi-pop > svg {\n height: 48px;\n max-height: 60%;\n fill: "+(t("raui.dateInput.primary.fg")||t("raui.primary.fg")||"#222")+";\n }\n \n .rdi-today {\n fill: "+(t("raui.dateInput.primary.fga")||t("raui.primary.fga")||"#07e")+";\n }"}.call(this,t)].join(" ")},cssId:"rdi",noCssTransform:!0,attributes:["value","null","lazy","eager","mask","string","display","min","max","no-pick","time"]});t.DateInput=X,t.default=function(t){return void 0===t&&(t={}),function(e){var n,r=e.instance;r.components["rdi-picker"]=l,r.components["rdi-pop"]=_,(void 0===(n={name:"rdi-pop"})&&(n={}),function(t){t.instance.decorators[n.name||"pop"]=function(t,e,r){if(void 0===r&&(r={}),!e)return{teardown:w};"string"==typeof e?r.path=e:"object"==typeof e&&(r=e);var i,a,o=this.getContext(t);function l(n){if("mouseover"!==n.type||!o.get(e)){if("click"!==n.type||!a||i){var l=h,s=v;"function"==typeof(h=r.node||t)&&(h=h()),h=h||t,"function"==typeof(v=r.tail)&&(v=v()),o.toggle(r.path),h=l,v=s}a&&"click"===n.type&&(i=o.observeOnce(r.path,function(){i=null}))}}function s(t){i||o.set(r.path,!1)}return("click"in r?r.click:!1!==n.click)&&o.listen("click",l),("hover"in r?r.hover:n.hover)&&(a=1,o.listen("mouseover",l),o.listen("mouseout",s)),{teardown:function(){o.unlisten("click",l),a&&(o.unlisten("mouseover",l),o.unlisten("mouseout",s),i&&i.cancel())}}}})({instance:r}),R({name:"rdi-date",parseDate:t.parseDate})({instance:r}),r.partials[t.name||"date-input"]=X,r.decorators["rdi-reg"]=function(t,e){return this.getContext(t).set("rdi."+e,function(){return t}),{teardown:function(){}}}}},Object.defineProperty(t,"__esModule",{value:!0})});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("ractive")):"function"==typeof define&&define.amd?define(["exports","ractive"],e):e(t.RauiDateInput={},t.Ractive)}(this,function(t,e){"use strict";e=e&&e.hasOwnProperty("default")?e.default:e;var n=function(){try{var t=navigator.language||navigator.browserLanguage||navigator.languages[0]||"en";return[[0,1,2,3,4,5,6,7,8,9,10,11].map(function(e){return new Date(2006,e,1).toLocaleString(t,{month:"long"})}),[1,2,3,4,5,6,7].map(function(e){return new Date(2006,0,e).toLocaleString(t,{weekday:"long"})})]}catch(t){return[["January","February","March","April","May","June","July","August","September","October","November","December"],["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]]}}(),r=n[0],i=n[1],a=i.map(function(t){return t[0]}).concat(i.map(function(t){return t[0].toUpperCase()})),o=r.map(function(t){return t.substr(0,3)}),l=function(t){function e(e){t.call(this,e)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.month=function(t,e){void 0===e&&(e=0);var n,r=t||new Date;if(!(r instanceof Date))return{};isNaN(r)&&(r=new Date),e&&(r=new Date(r.getFullYear(),r.getMonth()+e,r.getDate()));try{n=+this.get("firstDay")}catch(t){}("number"!=typeof n||isNaN(n))&&(n=0),n>6&&(n=0);for(var i=new Date(r.getFullYear(),r.getMonth(),0),o=new Date(r.getFullYear(),r.getMonth()+1,0).getDate(),l=new Date(r.getFullYear(),r.getMonth()+1,1),s=new Date(r.getFullYear(),r.getMonth(),1).getDay(),f=[],c=f[0]=[],u=0;u<7;u++)f[0].unshift({y:i.getFullYear(),m:i.getMonth(),d:i.getDate()-u}),f[0].push({y:r.getFullYear(),m:r.getMonth(),d:u+1});f[0]=n<=s?f[0].slice(7-(s-n),14-(s-n)):f[0].slice(n-s,7+n-s),1===f[0][0].d&&f.unshift(c.slice(0,7));for(var p=f[f.length-1][f[f.length-1].length-1].d,d=f.length;d<5;d++){f[d]=[];for(var g=0;g<7&&p+1<=o;g++)f[d].push({y:r.getFullYear(),m:r.getMonth(),d:++p});if(f[d].length<7){for(var h=7-f[d].length,v=1;v<=h;v++)f[d].push({y:l.getFullYear(),m:l.getMonth(),d:v});f[d+1]=[];for(var m=0,y=h+1;m<7;m++,y++)f[d+1].push({y:l.getFullYear(),m:l.getMonth(),d:y})}}if(!f[5]){for(f[5]=[];p<o;)f[5].push({y:r.getFullYear(),m:r.getMonth(),d:++p});for(var b=1;b<8;b++)f[5].push({y:l.getFullYear(),m:l.getMonth(),d:b});f[5]=f[5].slice(0,7)}return{days:a.slice(n,n+7),weeks:f,year:r.getFullYear(),month:r.getMonth(),currentYear:(new Date).getFullYear()}},e.prototype.year=function(t,e){void 0===e&&(e=0);var n=t||new Date;if(!(n instanceof Date))return{};e&&(n=new Date(n.getFullYear()+e,n.getMonth(),n.getDate()));for(var r=[],i=0;i<4;i++){r.push([]);for(var a=0;a<3;a++)r[i].push({m:3*i+a,y:n.getFullYear()})}return{year:n.getFullYear(),months:r}},e.prototype.decade=function(t,e){void 0===e&&(e=0);var n=t||new Date;if(!(n instanceof Date))return{};e&&(n=new Date(n.getFullYear()+10*e,n.getMonth(),n.getDate()));for(var r=10*Math.floor(n.getFullYear()/10),i=r-1,a=[],o=0;o<4;o++){a.push([]);for(var l=0;l<3;l++)a[o].push({y:i+3*o+l})}return{start:r,end:r+9,years:a}},e.prototype.monthName=function(t){return r[t]},e.prototype.shortMonthName=function(t){return o[t]},e.prototype.dayName=function(t){return i[t]},e.prototype.select=function(t){if(t&&t instanceof Date)this.set("date",t);else{var e=this.get("safeCurrent");t&&this.set("date",new Date(t.y||e.getFullYear(),"number"==typeof t.m?t.m:e.getMonth(),t.d||e.getDate()));var n=this.get("mode");"year"===n?this.set("mode","months"):"months"===n&&this.set("mode","month"),this.set("target",this.get("date"))}},e.prototype.isCurrent=function(t){var e=this.get("safeCurrent");return!!e&&(t&&t.y===e.getFullYear()&&(null==t.m||t.m===e.getMonth())&&(null==t.d||t.d===e.getDate()))},e.prototype.next=function(){var t=this.get("safeTarget"),e=this.get("mode");"month"===e&&this.set("target",new Date(t.getFullYear(),t.getMonth()+1,1)),"months"===e&&this.set("target",new Date(t.getFullYear()+1,t.getMonth(),1)),"year"===e&&this.set("target",new Date(t.getFullYear()+10,t.getMonth(),1))},e.prototype.prev=function(){var t=this.get("safeTarget"),e=this.get("mode");"month"===e&&this.set("target",new Date(t.getFullYear(),t.getMonth()-1,1)),"months"===e&&this.set("target",new Date(t.getFullYear()-1,t.getMonth(),1)),"year"===e&&this.set("target",new Date(t.getFullYear()-10,t.getMonth(),1))},e.prototype.today=function(){this.set("date",new Date),this.set("target",this.get("date"))},e}(e);e.extendWith(l,{template:{v:4,t:[{t:7,e:"div",m:[{t:13,n:"class",f:"rcal",g:1}],f:[{t:4,f:[{t:4,f:[{t:19,f:[{t:8,r:"~/mode"}],n:54,z:[{n:"left",x:{x:{r:["@index"],s:"_0===0"}}},{n:"right",x:{x:{r:["@last","@index"],s:"_0===_1"}}}]}],n:52,z:[{n:"offset",x:{r:"."}}],r:"~/padding"}],n:50,r:"~/padding"},{t:4,f:[{t:19,f:[{t:8,r:"~/mode"}],n:54,z:[{n:"offset",x:{x:{r:[],s:"0"}}},{n:"left",x:{x:{r:[],s:"true"}}},{n:"right",x:{x:{r:[],s:"true"}}}]}],n:51,l:1}]}],e:{0:function(){return 0},"_0===0":function(t){return 0===t},"_0===_1":function(t,e){return t===e},true:function(){return!0},"[_0.prev(),false]":function(t){return[t.prev(),!1]},'[_0.set("mode","month"),false]':function(t){return[t.set("mode","month"),!1]},"[_0.next(),false]":function(t){return[t.next(),!1]},"_1>_0||_1<_2":function(t,e,n){return e>t||e<n},"_0.isCurrent(_1)":function(t,e){return t.isCurrent(e)},"[_0.select(_1),false]":function(t,e){return[t.select(e),!1]},"_0.decade(_1,_2)":function(t,e,n){return t.decade(e,n)},'[_0.set("mode","year"),false]':function(t){return[t.set("mode","year"),!1]},"_0.shortMonthName(_1)":function(t,e){return t.shortMonthName(e)},"_0.year(_1,_2)":function(t,e,n){return t.year(e,n)},'[_0.set("mode","months"),false]':function(t){return[t.set("mode","months"),!1]},"_0.monthName(_1)":function(t,e){return t.monthName(e)},"_0!==_1":function(t,e){return t!==e},"[_0.select(_1)]":function(t,e){return[t.select(e)]},"_0.month(_1,_2)":function(t,e,n){return t.month(e,n)}},p:{year:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-wrapper",g:1}],f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-block-outer",g:1}],f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-block-header",g:1}],f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-click rcal-arrow",g:1},{t:4,f:[{n:["click"],t:70,f:{r:["@this"],s:"[_0.prev(),false]"}}],n:50,r:"left"}],f:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-left",g:1}]}],n:50,r:"left"}]}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-click rcal-title",g:1},{n:["click"],t:70,f:{r:["@this"],s:'[_0.set("mode","month"),false]'}}],f:[{t:2,r:".start"}," - ",{t:2,r:".end"}]}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-click rcal-arrow",g:1},{t:4,f:[{n:["click"],t:70,f:{r:["@this"],s:"[_0.next(),false]"}}],n:50,r:"right"}],f:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-right",g:1}]}],n:50,r:"right"}]}]}," ",{t:19,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-decade",g:1}],f:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-inner-row",g:1}],f:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-inner-pick",g:1},{n:"class-rcal-off-day",t:13,f:[{t:2,x:{r:["year.end",".y","year.start"],s:"_1>_0||_1<_2"}}]},{n:"class-rcal-current",t:13,f:[{t:2,x:{r:["@this","."],s:"_0.isCurrent(_1)"}}]},{n:["click"],t:70,f:{r:["@this","."],s:"[_0.select(_1),false]"}}],f:[{t:2,r:".y"}]}],n:52,r:"."}]}],n:52,r:".years"}]}],n:54,z:[{n:"year",x:{r:"."}}]}]}]}],n:54,x:{r:["@this","~/safeTarget","offset"],s:"_0.decade(_1,_2)"}}],months:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-wrapper",g:1}],f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-block-outer",g:1}],f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-block-header",g:1}],f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-click rcal-arrow",g:1},{t:4,f:[{n:["click"],t:70,f:{r:["@this"],s:"[_0.prev(),false]"}}],n:50,r:"left"}],f:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-left",g:1}]}],n:50,r:"left"}]}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-click rcal-title",g:1},{n:["click"],t:70,f:{r:["@this"],s:'[_0.set("mode","year"),false]'}}],f:[{t:2,r:".year"}]}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-click rcal-arrow",g:1},{t:4,f:[{n:["click"],t:70,f:{r:["@this"],s:"[_0.next(),false]"}}],n:50,r:"right"}],f:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-right",g:1}]}],n:50,r:"right"}]}]}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-year",g:1}],f:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-inner-row",g:1}],f:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-inner-pick",g:1},{n:"class-rcal-current",t:13,f:[{t:2,x:{r:["@this","."],s:"_0.isCurrent(_1)"}}]},{n:["click"],t:70,f:{r:["@this","."],s:"[_0.select(_1),false]"}}],f:[{t:2,x:{r:["@this",".m"],s:"_0.shortMonthName(_1)"}}]}],n:52,r:"."}]}],n:52,r:".months"}]}]}]}],n:54,x:{r:["@this","~/safeTarget","offset"],s:"_0.year(_1,_2)"}}],month:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-wrapper",g:1},{n:"class-rcal-pad",t:13,f:[{t:2,r:"~/pad"}]}],f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-block-outer",g:1}],f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-block-header",g:1}],f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-click rcal-arrow",g:1},{t:4,f:[{n:["click"],t:70,f:{r:["@this"],s:"[_0.prev(),false]"}}],n:50,r:"left"}],f:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-left",g:1}]}],n:50,r:"left"}]}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-click rcal-title",g:1},{n:["click"],t:70,f:{r:["@this"],s:'[_0.set("mode","months"),false]'}}],f:[{t:2,x:{r:["@this",".month"],s:"_0.monthName(_1)"}},{t:4,f:[" ",{t:2,r:".year"}],n:50,x:{r:[".currentYear",".year"],s:"_0!==_1"}}]}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-click rcal-arrow",g:1},{t:4,f:[{n:["click"],t:70,f:{r:["@this"],s:"[_0.next(),false]"}}],n:50,r:"right"}],f:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-right",g:1}]}],n:50,r:"right"}]}]}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-month",g:1}],f:[{t:19,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-week rcal-week-header",g:1}],f:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-day rcal-day-header",g:1}],f:[{t:2,r:"."}]}],n:52,r:".days"}]}," ",{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-week",g:1}],f:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rcal-day",g:1},{n:"class-rcal-off-day",t:13,f:[{t:2,x:{r:[".m","month.month"],s:"_0!==_1"}}]},{n:"class-rcal-current",t:13,f:[{t:2,x:{r:["@this","."],s:"_0.isCurrent(_1)"}}]},{n:["click"],t:70,f:{r:["@this","."],s:"[_0.select(_1)]"}}],f:[{t:2,r:".d"}]}],n:52,r:"."}]}],n:52,r:".weeks"}],n:54,z:[{n:"month",x:{r:"."}}]}]}]}]}],n:54,x:{r:["@this","~/safeTarget","offset"],s:"_0.month(_1,_2)"}}]}},css:function(t){return[function(t){return".rcal-wrapper {\n display: flex;\n flex-direction: column;\n width: 15em;\n height: 17em;\n }\n \n .rcal-pad {\n padding: 0.5em;\n }\n \n .rcal-block-outer {\n border: 1px solid "+(t("raui.datePicker.primary.bga")||t("raui.primary.bga")||"#f4f4f4")+";\n display: flex;\n flex-direction: column;\n flex-grow: 1;\n }\n \n .rcal-block-header {\n text-align: center;\n background-color: "+(t("raui.datePicker.primary.fga")||t("raui.primary.fga")||"#07e")+";\n color: "+(t("raui.datePicker.primary.bg")||t("raui.primary.bg")||"#fff")+";\n cursor: default;\n display: flex;\n justify-content: space-between;\n line-height: 2em;\n height: 2em;\n align-items: center;\n }\n \n .rcal-arrow {\n width: 2em;\n }\n .rcal-title {\n flex-grow: 1;\n }\n \n .rcal-click {\n cursor: pointer;\n }\n \n .rcal-left, .rcal-right {\n height: 0.8em;\n display: inline-block;\n box-sizing: border-box;\n border: 0.4em solid transparent;\n cursor: pointer;\n }\n .rcal-left {\n border-right-color: "+(t("raui.datePicker.primary.bg")||t("raui.primary.bg")||"#fff")+";\n }\n .rcal-right {\n border-left-color: "+(t("raui.datePicker.primary.bg")||t("raui.primary.bg")||"#fff")+";\n }\n \n .rcal-month, .rcal-year, .rcal-decade {\n display: flex;\n flex-direction: column;\n background-color: "+(t("raui.datePicker.primary.bga")||t("raui.primary.bga")||"#f4f4f4")+";\n justify-content: space-between;\n flex-grow: 1;\n }\n .rcal-year, .rcal-decade {\n justify-content: space-around;\n }\n \n .rcal-week {\n height: 2em;\n display: flex;\n justify-content: space-between;\n }\n \n .rcal-inner-row {\n height: 2em;\n display: flex;\n justify-content: space-around;\n }\n \n .rcal-inner-pick {\n background-color: "+(t("raui.datePicker.primary.bg")||t("raui.primary.bg")||"#fff")+";\n width: 3em;\n height: 2em;\n line-height: 2em;\n text-align: center;\n cursor: pointer;\n }\n \n .rcal-week-header {\n background-color: "+(t("raui.datePicker.primary.fga")||t("raui.primary.fga")||"#07e")+";\n }\n \n .rcal-day {\n background-color: "+(t("raui.datePicker.primary.bg")||t("raui.primary.bg")||"#fff")+";\n width: 2em;\n height: 2em;\n text-align: center;\n line-height: 2em;\n cursor: pointer;\n }\n \n .rcal-day-header {\n color: "+(t("raui.datePicker.primary.bg")||t("raui.primary.bg")||"#fff")+";\n background-color: "+(t("raui.datePicker.primary.fga")||t("raui.primary.fga")||"#07e")+";\n cursor: default;\n }\n \n .rcal-off-day {\n background-color: "+(t("raui.datePicker.primary.bc")||t("raui.primary.bc")||"#ccc")+";\n }\n \n .rcal-current {\n color: "+(t("raui.datePicker.primary.bg")||t("raui.primary.bg")||"#fff")+";\n background-color: "+(t("raui.datePicker.primary.fg")||t("raui.primary.fg")||"#222")+";\n }\n "}.call(this,t)].join(" ")},noCssTransform:!0,data:function(){return{mode:"month",target:new Date}},computed:{safeCurrent:function(){var t=this.get("date");if("string"==typeof t)try{t=new Date(t)}catch(t){}return t&&t instanceof Date&&!isNaN(t)?t:new Date},safeTarget:function(){var t=this.get("target");if(t||(t=this.get("date")),"string"==typeof t)try{t=new Date(t)}catch(t){}return t&&t instanceof Date&&!isNaN(t)?t:new Date}}});var s="undefined"!=typeof window?window:null;function f(t,e,n){if(s&&s.Ractive&&"object"==typeof s.Ractive[e]){var r=document.currentScript;if(r||(r=(r=document.querySelectorAll("script"))[r.length-1]),r){var i=r.getAttribute("data-alias");i&&(i=(i=i.split("&")).reduce(function(t,e){var n=e.split("="),r=n[0],i=n[1];return t[r]=i,t},{})),Ractive[e][i&&i[t]||t]=n}}}function c(t,e){void 0===e&&(e={});var n=t.processParams(e,{duration:400,easing:"easeInOut"});e.dir=e.dir||!1;var r=e.distance||"20px",i=e.scale||"0.9",a="above"===e.dir?"translateY("+r+")":"left"===e.dir?"translateX("+r+")":"right"===e.dir?"translateX(-"+r+")":"translateY(-"+r+")";return t.isIntro||n.intro?(t.setStyle("opacity",0),t.setStyle("transform","scale("+i+") "+a),t.animateStyle({opacity:1,transform:"none"},n)):(t.setStyle("opacity",1),t.setStyle("transform","none"),t.animateStyle({opacity:0,transform:"scale("+i+") "+a},n))}function u(t){return void 0===t&&(t={}),function(e){e.instance.transitions[t.name||"pop"]=c}}function p(t,e){var n=!1,r=!1;function i(n){for(var r=n.target;r;){if(r===t)return;if(!r.parentNode&&r!==document)return;r=r.parentNode}e(n)}return setTimeout(function(){n=!0,r||(document.body.addEventListener("click",i,{capture:!0}),document.body.addEventListener("touchstop",i,{capture:!0}))}),{teardown:function(){r=!0,n&&(document.body.removeEventListener("click",i,{capture:!0}),document.body.removeEventListener("touchstop",i,{capture:!0}))}}}function d(t,e){var n=t.processParams(e,{duration:200,easing:"easeInOut"});return t.isIntro||n.intro?(t.setStyle("opacity",0),t.animateStyle("opacity",1,n)):(t.setStyle("opacity",1),t.animateStyle("opacity",0,n))}function g(t){return void 0===t&&(t={}),function(e){e.instance.transitions[t.name||"fade"]=d}}f("pop","transitions",c),f("fade","transitions",d);var h,v,m,y,b={v:4,t:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rpop-wrapper",g:1},{n:"class-rpop-with-tail",t:13,f:[{t:2,r:"position.tail"}]},{n:"class",f:["rpop-",{t:2,x:{r:["where"],s:'_0||"below"'}}," rpop-align-",{t:2,x:{r:["align"],s:'_0||"middle"'}}],t:13},{t:4,f:[{n:"style-top",f:[{t:2,r:"position.popTop"},"px"],t:13},{n:"style-left",f:[{t:2,r:"position.popLeft"},"px"],t:13}],n:50,r:"position"},{t:4,f:[{t:4,f:[{n:"style-top",f:[{t:2,r:"top"}],t:13}],n:50,r:"top"},{t:4,f:[{n:"style-left",f:[{t:2,r:"left"}],t:13}],n:50,r:"left"}],n:51,l:1},{n:"pop",t:72,f:{r:["where"],s:'[{dir:_0||"below"}]'},v:"t2"},{n:"cleanup",t:71},{t:4,f:[{n:["click"],t:70,f:{r:["@this"],s:'[_0.set("popped",false)]'}}],n:50,r:"clickClose"},{t:4,f:[{n:["clickout"],t:70,f:{r:["@this"],s:'[_0.set("popped",false)]'}}],n:51,r:"noClickout"},{t:16,r:"extra-attributes"}],f:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rpop-tail",g:1},{t:4,f:[{n:"style-top",f:[{t:2,x:{r:["position.tailTop","position.vert"],s:"_0+(_1?3:0)"}},"px"],t:13}],n:50,x:{r:["position.tailTop"],s:"_0!=null"}},{t:4,f:[{n:"style-bottom",f:[{t:2,x:{r:["position.tailBottom","position.vert"],s:"_0+(_1?3:0)"}},"px"],t:13}],n:50,x:{r:["position.tailBottom"],s:"_0!=null"}},{t:4,f:[{n:"style-left",f:[{t:2,x:{r:["position.tailLeft","position.vert"],s:"_0+(_1?0:3)"}},"px"],t:13}],n:50,x:{r:["position.tailLeft"],s:"_0!=null"}},{t:4,f:[{n:"style-right",f:[{t:2,x:{r:["position.tailRight","position.vert"],s:"_0+(_1?0:3)"}},"px"],t:13}],n:50,x:{r:["position.tailRight"],s:"_0!=null"}}]}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rpop-tail-outer",g:1},{t:4,f:[{n:"style-top",f:[{t:2,x:{r:["position.tailTop"],s:"_0-2"}},"px"],t:13}],n:50,x:{r:["position.tailTop"],s:"_0!=null"}},{t:4,f:[{n:"style-bottom",f:[{t:2,x:{r:["position.tailBottom"],s:"_0-2"}},"px"],t:13}],n:50,x:{r:["position.tailBottom"],s:"_0!=null"}},{t:4,f:[{n:"style-left",f:[{t:2,x:{r:["position.tailLeft"],s:"_0-2"}},"px"],t:13}],n:50,x:{r:["position.tailLeft"],s:"_0!=null"}},{t:4,f:[{n:"style-right",f:[{t:2,x:{r:["position.tailRight"],s:"_0-2"}},"px"],t:13}],n:50,x:{r:["position.tailRight"],s:"_0!=null"}}]}],n:50,r:"~/tail"}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rpop",g:1}],f:[{t:16,r:"content",z:[{n:"trigger",x:{r:"triggerContext"}}]}]}]}],n:50,r:"__popped"}],e:{'_0||"below"':function(t){return t||"below"},'_0||"middle"':function(t){return t||"middle"},'[{dir:_0||"below"}]':function(t){return[{dir:t||"below"}]},'[_0.set("popped",false)]':function(t){return[t.set("popped",!1)]},"_0+(_1?3:0)":function(t,e){return t+(e?3:0)},"_0!=null":function(t){return null!=t},"_0+(_1?0:3)":function(t,e){return t+(e?0:3)},"_0-2":function(t){return t-2},"[{delay:200}]":function(){return[{delay:200}]},"[_0===_1&&_2.done(),true]":function(t,e,n){return[t===e&&n.done(),!0]},"[_0.done()]":function(t){return[t.done()]},true:function(){return!0}},p:{modal:[{t:4,f:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rpop-modal",g:1},{n:"fade",t:72,v:"t1"},{n:"fade",t:72,f:{r:[],s:"[{delay:200}]"},v:"t2"},{t:4,f:[{n:["click"],t:70,f:{r:["@node","@event.target","."],s:"[_0===_1&&_2.done(),true]"}}],n:51,r:".noClickout"}],f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rpop",g:1},{n:"pop",t:72,f:{r:[],s:"[{delay:200}]"},v:"t1"},{n:"pop",t:72,v:"t2"},{t:4,f:[{n:["click"],t:70,f:{r:["."],s:"[_0.done()]"}}],n:50,r:".clickClose"},{t:8,r:".attrs",c:{r:".context"},z:[{n:"inModal",x:{x:{r:[],s:"true"}}}]}],f:[{t:8,r:".content",c:{r:".context"},z:[{n:"inModal",x:{x:{r:[],s:"true"}}}]}]}]}],n:54,r:"contents.0"}],n:50,r:"contents.length"}]}};function w(){}var x,_=function(t){function e(e){t.call(this,e)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.position=function(e){var n=e||this.source,r=this.get("popped");if(n&&r){var i=this.find("div");if(n&&i&&i.offsetParent){n?this.set("triggerContext",t.getContext(n)):this.set("triggerContext",null);var a=i.offsetParent,o=a.getBoundingClientRect(),l=i.getBoundingClientRect(),s=n.getBoundingClientRect(),f=this.get("where")||"below",c=this.get("align")||"middle",u=this.get("tail"),p="above"===f||"below"===f,d=this.get("fit"),g=this.get("gap"),h="above"===f||"below"===f?0:"left"===f?-l.width-g:s.width+g,v="left"===f||"right"===f?-s.height:"above"===f?-s.height-l.height-g:g;"middle"===c?"below"===f||"above"===f?h-=(l.width-s.width)/2:"left"!==f&&"right"!==f||(v-=(l.height-s.height)/2):"end"===c&&("below"===f||"above"===f?h+=s.width-l.width:"left"!==f&&"right"!==f||(v+=s.height-l.height));var m={popTop:s.bottom-o.top+v,popLeft:s.left-o.left+h,tail:u,vert:"above"===f||"below"===f};if(a.scrollTop&&(m.popTop+=a.scrollTop),a.scrollLeft&&(m.popLeft+=a.scrollLeft),u){"above"===f?m.tailBottom=-10:"below"===f?m.tailTop=-10:"left"===f?m.tailRight=-10:"right"===f&&(m.tailLeft=-10);var y=this.tailSource?this.tailSource.getBoundingClientRect():s;"start"===c?p?m.tailLeft=Math.floor(y.width/2)-10:m.tailTop=Math.floor(y.height/2)-10:"end"===c?p?m.tailRight=Math.floor(y.width/2)-10:m.tailBottom=Math.floor(y.height/2)-10:"middle"===c&&(p?m.tailLeft=Math.floor(y.width/2)-10:m.tailTop=Math.floor(y.height/2)-10),y!==s?p?(null!=m.tailLeft&&(m.tailLeft+=y.left-s.left),null!=m.tailRight&&(m.tailRight+=s.right-y.right)):(null!=m.tailTop&&(m.tailTop+=y.top-s.top),null!=m.tailBottom&&(m.tailBottom+=s.bottom-y.bottom)):"middle"===c&&(p?(null!=m.tailLeft&&(m.tailLeft+=y.left-(m.popLeft+o.left)),null!=m.tailRight&&(m.tailRight+=m.popLeft+o.left+l.width-y.right)):(null!=m.tailTop&&(m.tailTop+=y.top-(m.popTop+o.top)),null!=m.tailBottom&&(m.tailBottom+=m.popTop+o.top+l.height-y.bottom)))}if(d){var b=a;if(this.get("offsets"))for(var w=this.get("offsets");w--;)b=b.offsetParent;var x=a.scrollWidth,_=a.scrollHeight;if(m.popLeft+l.width>x){var k=m.popLeft-(x-l.width);m.popLeft-=k,p&&m.tailLeft&&(m.tailLeft+=k),p&&m.tailRight&&(m.tailRight-=k),u&&!p&&(m.tail=!1)}if(m.popLeft<0){var D=-1*m.popLeft;m.popLeft+=D,p&&m.tailLeft&&(m.tailLeft-=D),p&&m.tailRight&&(m.tailRight+=D),u&&!p&&(m.tail=!1)}if(m.popTop+l.height>_){var M=m.popTop-(_-l.height);m.popTop-=M,!p&&m.tailTop&&(m.tailTop+=M),!p&&m.tailBottom&&(m.tailBottom-=M),u&&p&&(m.tail=!1)}if(m.popTop<0){var T=-1*m.popTop;m.popTop+=T,!p&&m.tailTop&&(m.tailTop-=T),!p&&m.tailBottom&&(m.tailBottom+=T),u&&p&&(m.tail=!1)}}if(o.left+m.popLeft<0){var L=0-(o.left+m.popLeft);m.popLeft+=L,p&&m.tailLeft&&(m.tailLeft-=L),p&&m.tailRight&&(m.tailRight+=L),u&&!p&&(m.tail=!1)}if(o.top+m.popTop<0){var S=0-(o.top+m.popTop);m.popTop+=S,!p&&m.tailTop&&(m.tailTop-=S),!p&&m.tailBottom&&(m.tailBottom+=S),u&&p&&(m.tail=!1)}m.tailLeft&&(m.tailLeft=Math.floor(m.tailLeft)),m.tailRight&&(m.tailRight=Math.floor(m.tailRight)),m.tailTop&&(m.tailTop=Math.floor(m.tailTop)),m.tailBottom&&(m.tailBottom=Math.floor(m.tailBottom)),this.set("position",m)}else this.set("position",null)}},e.prototype.show=function(t){return this.source=t,this.set("popped",!0),this._transdone},e.prototype.hide=function(){return this.set("popped",!1),this._transdone},e.prototype.popFind=function(t){return m?y.find(t):this.find(pattenr)},e.prototype.popFindAll=function(t){return m?y.findAll(t):this.findAll(pattenr)},e}(e);e.extendWith(_,{attributes:["popped","tail","where","align","top","left","fit","clickClose","noClickout","gap","offsets"],use:[u(),(void 0===x&&(x={}),function(t){t.instance.events[x.name||"clickout"]=p}),g()],template:b,css:function(t){return[function(t){var e=Object.assign({},t("raui.primary"),t("raui.pop.primary")),n=(t("raui.themes")||[]).slice();return(t("raui.pop.themes")||[]).forEach(function(t){~n.indexOf(t)||n.push(t)}),"\n .rpop-wrapper {\n position: absolute;\n display: inline-block;\n z-index: 21;\n transition-property: top, left, padding;\n transition-timing-function: ease-in-out;\n transition-duration: 0.3s;\n }\n .rpop-with-tail.rpop-above {\n padding-bottom: 10px;\n }\n .rpop-with-tail.rpop-below {\n padding-top: 10px;\n }\n .rpop-with-tail.rpop-left {\n padding-right: 10px;\n }\n .rpop-with-tail.rpop-right {\n padding-left: 10px;\n }\n \n .rpop {\n position: relative;\n box-shadow: 0 1px 4px 0 rgba(0,0,0,0.24);\n border: 1px solid #ccc;\n border-radius: 0.2em;\n background-color: "+(e.bg||"#fff")+";\n color: "+(e.fg||"#222")+";\n padding: 0.5em;\n z-index: 2;\n }\n \n .rpop-modal {\n position: fixed;\n display: flex;\n z-index: 20;\n background-color: rgba(0, 0, 0, 0.2);\n align-items: center;\n justify-content: center;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n padding: 1em;\n overflow: auto;\n }\n \n .rpop-tail, .rpop-tail-outer {\n z-index: 3;\n width: 0;\n height: 0;\n position: absolute;\n border-style: solid;\n border-width: 10px;\n border-color: transparent;\n transition-property: top, left, bottom, right, border-color;\n transition-timing-function: ease-in-out;\n transition-duration: 0.3s;\n }\n .rpop-tail-outer {\n z-index: 1;\n border-width: 12px;\n border-color: transparent;\n }\n \n .rpop-below .rpop-tail {\n border-bottom-color: "+(e.bg||"#fff")+";\n }\n .rpop-below .rpop-tail-outer {\n border-bottom-color: "+(e.bc||"#ccc")+";\n }\n \n .rpop-above .rpop-tail {\n border-top-color: "+(e.bg||"#fff")+";\n }\n .rpop-above .rpop-tail-outer {\n border-top-color: "+(e.bc||"#ccc")+";\n }\n \n .rpop-left .rpop-tail {\n border-left-color: "+(e.bg||"#fff")+";\n }\n .rpop-left .rpop-tail-outer {\n border-left-color: "+(e.bc||"#ccc")+";\n }\n \n .rpop-right .rpop-tail {\n border-right-color: "+(e.bg||"#fff")+";\n }\n .rpop-right .rpop-tail-outer {\n border-right-color: "+(e.bc||"#ccc")+";\n }\n "+n.map(function(e){var n=Object.assign({},t("raui.primary"),t("raui.pop.primary"),t("raui."+e),t("raui.pop."+e));return"\n ."+e+" .rpop {\n background-color: "+(n.bg||"#fff")+";\n color: "+(n.fg||"#222")+";\n }\n \n ."+e+".rpop-below .rpop-tail {\n border-bottom-color: "+(n.bg||"#fff")+";\n }\n ."+e+".rpop-below .rpop-tail-outer {\n border-bottom-color: "+(n.bc||"#ccc")+";\n }\n \n ."+e+".rpop-above .rpop-tail {\n border-top-color: "+(n.bg||"#fff")+";\n }\n ."+e+".rpop-above .rpop-tail-outer {\n border-top-color: "+(n.bc||"#ccc")+";\n }\n \n ."+e+".rpop-left .rpop-tail {\n border-left-color: "+(n.bg||"#fff")+";\n }\n ."+e+".rpop-left .rpop-tail-outer {\n border-left-color: "+(n.bc||"#ccc")+";\n }\n \n ."+e+".rpop-right .rpop-tail {\n border-right-color: "+(n.bg||"#fff")+";\n }\n ."+e+".rpop-right .rpop-tail-outer {\n border-right-color: "+(n.bc||"#ccc")+";\n }\n "})}.call(this,t)].join(" ")},cssId:"rpop",noCssTransform:!0,observe:{popped:function(t){var e,n=this;t&&(h&&(this.source=h),v&&(this.tailSource=v));var r=this._transdone=new Promise(function(t){return e=t});r.resolve=e,setTimeout(function(){n._transdone=r,n.get("popped")===t&&n.set("_popped",t)},1)},_popped:{handler:function(t){var e=this,n=this._transdone.resolve;if(t){var r=this.get("@style.raui.pop.mobile");if(r&&window.matchMedia("(max-width: "+r+")").matches){y||(y=new k({target:document.body,append:!0}));var i=this.getContext().getParent(!0);i.isContext=1,this.set("__popped",!1).then(n),y.unshift("contents",{content:this.partials.content,context:i,attrs:this.partials["extra-attributes"]||[],clickClose:this.get("clickClose"),noClickout:this.get("noClickout"),done:function(){e.set("popped",!1)}})}else this.set("__popped",!0)}else m?(y.shift("contents"),n()):this.set("__popped",!1).then(n)},defer:!0,init:!1},__popped:{handler:function(t){var e=this._transdone.resolve;if(t){var n=this.find("div"),r=n,i=r.offsetHeight+r.offsetTop,a=r.offsetWidth+r.offsetLeft,o=r.offsetParent;if(!this.overflows)for(var l=this.overflows={e:[],v:[]};n&&n.style;){if(n===o){if(n.offsetWidth>=a&&n.offsetHeight>=i)break;a+=n.offsetLeft,i+=n.offsetTop,o=n.offsetParent}var s=getComputedStyle(n);if("auto"===s.overflow)break;"hidden"===s.overflow&&(l.e.push(n),l.v.push(n.style.overflow),n.style.overflow="visible"),n=n.parentNode}this.position(),this.transition("pop",r,{intro:!0,dir:this.get("where")||"below"}).then(e)}else this.source=null,this.tailSource=null},defer:!0,init:!1},"align where tail fit":{handler:function(){this.position()},defer:!0}},decorators:{cleanup:function(t){var e=this;return{teardown:function(){var t=e.overflows;if(t){e.overflows=null;for(var n=0;n<t.e.length;n++)t.e[n].style.overflow=t.v[n]}}}}},data:function(){return{gap:4}}});var k=function(t){function e(e){t.call(this,e)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(e);e.extendWith(k,{template:{v:b.v,t:b.p.modal},data:function(){return{contents:[]}},use:[u(),g()],observe:{contents:function(t){m=(t||[]).length>0}},on:{init:function(){y?console.warn("More than one PopOver mobile host created."):y=this}}});var D=/[^\d]+/,M=/[^\d_]+/,T="_",L={y:0,M:1,d:2,H:3,m:4,s:5,S:6};function S(t,e,n){void 0===n&&(n="0");for(var r=null==t?"":""+t,i=r.length;i<e;i++)r=n+r;return r}function C(t,e,n){void 0===n&&(n="0");for(var r=null==t?"":""+t,i=r.length;i<e;i++)r+=n;return r}var F={mask:"yyyy-MM-dd",time:[0,0,0,0],date:function(){var t=new Date,e=F.time;return new Date(t.getFullYear(),t.getMonth(),t.getDate(),e[0],e[1],e[2],e[3])},parseDate:function(t){return new Date(t)}};function Y(t){if("start"===t)t=[0,0,0,0];else if("end"===t)t=[23,59,59,999];else if("mid"===t)t=[12,0,0,0];else if("now"===t)t=function(){var t=new Date;return[t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()]};else if("string"==typeof t){var e=new Date("2000-05-13T"+t+"Z");+e&&(t=[e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds()])}return Array.isArray(t)||"function"==typeof t||Array.isArray(t())||(t=[0,0,0,0]),t}function R(t){void 0===t&&(t={});var e=t.mask||F.mask,n=Y(t.time||F.time),r=t.date||F.date;if("function"!=typeof r){var i=r;r=function(){return i}}return function(i){i.instance.decorators[t.name||"date"]=function(i,a,o){void 0===a&&(a={});var l=Object.assign({},t,"string"==typeof a?{value:a}:a,"string"==typeof o?{mask:o}:o);l.parseDate||(l.parseDate=t.parseDate||F.parseDate);var s=l.date||r,f=Y(l.time||n);if("function"!=typeof s){var c=s;s=function(){return c}}var u=this.getContext(i),p=l.mask||e,d={observers:[],listeners:[]},g=!1;if("INPUT"!==i.tagName)return console.warn("Attempted to add a date decorator a "+i.tagName),W;if(!p)return W;for(var h,v=[],m=0;h=A.exec(p);){var y={mask:h[0],type:h[0][0],length:h[0].length,start:h.index,end:h.index+h[0].length,chunk:v.length,prefix:p.substring(m,h.index),groups:v,value:null,display:C("",h[0].length,T)};m=y.end,v.push(y)}if(v.suffix=p.substring(v[v.length-1].end),v.last=null,v.slice(1).find(function(t){return!t.prefix}))return console.warn("Attempted to add a date decorator missing interstitial between fields '"+p+"'"),W;function b(t){if(null===v.value&&null===v.last||+v.value==+v.last)return 1;if(!t||!1===l.lazy){if(!1===l.null&&null===v.value)return N(v,v.last,l.parseDate),1;l.min&&v.value<l.min?(N(v,l.min,l.parseDate),O(v,i)):l.max&&v.value>l.max&&(N(v,l.max,l.parseDate),O(v,i)),v.last=v.value,"string"==typeof l.value&&(d.observers.forEach(function(t){return t.silence()}),u.set(l.value,v.value),d.observers.forEach(function(t){return t.resume()})),"string"==typeof l.display&&(d.observers.forEach(function(t){return t.silence()}),u.set(l.display,i.value),d.observers.forEach(function(t){return t.resume()}))}}l.min>l.max&&delete l.min,"string"==typeof l.value&&d.observers.push(u.observe(l.value,function(t){t||!1!==l.null||(t=s()),v.value=t,N(v,t,l.parseDate),v.last=t,O(v,i),(l.min&&t<l.min||l.max&&t>l.max)&&(v.last=null,setTimeout(b))},{defer:!0})),"string"==typeof l.display&&d.observers.push(u.observe(l.display,function(t){i.value=t||"",P(v,i,p),B(v),E(v,b,!0,s,f),O(v,i)},{defer:!0})),l.display||l.value||((l.date||!1===l.null)&&(v.value=K(l.date||s(),l.parseDate)),O(v,i));var w=function(t,e){void 0===e&&(e=i.selectionStart),t&&t.target&&(t=void 0),t||(t=e===i.value.length&&i.selectionEnd===i.value.length?v[0]:j(v,e)),g&&(g=!1,e<t.start&&(t=v[v.indexOf(t)-1])),document.activeElement===i&&i.setSelectionRange(t.start,t.end)};return d.listeners.push(u.listen("input",function(){var t=i.selectionStart,e=i.value;P(v,i,p);var n=j(v,t),r=B(v,n,t);if(E(v,b,!0,s,f),O(v,i),n&&(e.length>=p.length&&t===n.end||r)&&n!==v[v.length-1]){var a=v[v.indexOf(n)+1];w(a,t)}else i.setSelectionRange(t,t)})),d.listeners.push(u.listen("blur",function(){g=!1,b(!1)&&N(v,v.value,l.parseDate),null===v.value&&v.forEach(function(t){return t.value=null}),v.forEach(function(t){return t.display=z(t)}),O(v,i)})),d.listeners.push(u.listen("click",w)),d.listeners.push(u.listen("focus",w)),d.listeners.push(u.listen("keydown",function(t){switch(g=!1,t.key){case"Enter":case"Tab":var e=j(v,i.selectionStart),n=v.indexOf(e);B(v,e,i.selectionStart,!0)&&(O(v,i),E(v,b,t.shiftKey&&n>0||!t.shiftKey&&n+1<v.length,s,f)),t.shiftKey&&n>0?(w(v[n-1]),t.preventDefault(),t.stopPropagation()):!t.shiftKey&&n+1<v.length&&(w(v[n+1]),t.preventDefault(),t.stopPropagation());break;case"Backspace":g=!0;break;case"ArrowUp":case"ArrowDown":var r=[i.selectionStart,i.selectionEnd],a=r[0],o=r[1],l=j(v,a);null===l.value&&(l.value=1),function(t,e){switch(t.type){case"y":t.value=t.value+(e?-1:1);break;case"M":t.value=e?t.value<1?11:t.value-1:t.value>10?0:t.value+1;break;case"d":var n=t.groups,r=U(new Date((n.find(function(t){return"y"===t.type})||{value:1}).value,(n.find(function(t){return"M"===t.type})||{value:1}).value));t.value=e?t.value<2?r:t.value-1:t.value+1>r?1:t.value+1;break;case"H":t.value=e?t.value<1?23:t.value-1:t.value>22?0:t.value+1;break;case"h":t.value=e?t.value<1?12:t.value-1:t.value>11?1:t.value+1;break;case"m":case"s":t.value=e?t.value<1?59:t.value-1:t.value>58?0:t.value+1;break;case"S":t.value=e?t.value<1?999:t.value-1:t.value>998?0:t.value+1}}(l,"ArrowDown"===t.key),l.input=l.display=z(l),E(v,b,!0,s,f),O(v,i),t.preventDefault(),t.stopPropagation(),i.setSelectionRange(a,o)}})),{teardown:function(){d.observers.forEach(function(t){return t.cancel()}),d.listeners.forEach(function(t){return t.cancel()})}}}}}function P(t,e,n){var r=e.value,i=j(t,e.selectionStart),a=0,o=t[a],l=t[a+1];t.forEach(function(t){return t.input=""});for(var s=0;s<r.length;s++)l&&r[s]===l.prefix[0]&&(i!==o||o.input.length>=o.length||r.length-s<n.length-o.end+(o.length-o.input.length))?(l.prefix.length>1&&(s+=l.prefix.length-1),r[s+1]===l.prefix[0]&&(s+=l.prefix.length),o=t[++a],l=t[a+1]):o.input+=r[s]}function B(t,e,n,r){void 0===n&&(n=0),void 0===r&&(r=!1);for(var i=!1,a=0;a<t.length;a++){var o=t[a],l=(o.input||"").replace(D,""),s=t[a+1]&&t[a+1].prefix&&M.test(o.input);if(l.length>o.length&&o===e){var f=l.length-e.length;l=l.substr(0,n-e.start)+l.substr(n-e.start+f)}else l=l.substr(0,o.length);if(o.input=l,"y"===o.type&&0===l.length&&(s||r))o.value=(new Date).getFullYear(),o.input=o.display=S(o.value,o.length),i=!0;else if("m"===o.type&&0===l.length&&(s||r))o.value=0,o.input=o.display=S(o.value,o.length),i=!0;else if("d"===o.type&&l.length!==o.length&&r)o.value=+l,o.display=z(o);else if(""===l)o.value=null,o.display=z(o);else if(o!==e)o.value=+l,"M"===o.type&&o.value--,o.display=z(o);else if("M"===o.type&&+l>1||"d"===o.type&&+l>3||"H"===o.type&&+l>2||("m"===o.type||"s"===o.type)&&+l>6)o.value=+l,"M"===o.type&&o.value--,o.display=S(l,o.length),i=!0;else if("y"===o.type&&2===l.length&&(s||r)){var c=(new Date).getFullYear(),u=100*Math.floor(c/100),p=Math.abs(c-(u+ +l))<20?u+ +l:u-100+ +l;o.value=p,o.input=o.display=S(p,o.length),i=!0}else o.display=C(l,o.length,T),o.value=+l}return i}function N(t,e,n){var r=(e=t.value=e&&K(e,n))?[e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()]:[null,null,null,null,null,null,null];t.forEach(function(t){t.value=r[L[t.type]],t.input=t.display=z(t)})}function E(t,e,n,r,i){var a=t.value||r(),o=[a.getFullYear(),a.getMonth(),a.getDate(),a.getHours(),a.getMinutes(),a.getSeconds(),a.getMilliseconds()];if(!t.find(function(t){return"m"===t.type||"s"===t.type||"h"===t.type||"S"===t.type})){"function"==typeof i&&(i=i());for(var l=0;l<4;l++)o[l+3]=i[l]}if(t.forEach(function(t){var e=t.value;null!==e&&"M"===t.type?e<0?e=0:e>11&&(e=11):null===e||"m"!==t.type&&"s"!==t.type?null!==e&&"H"===t.type?e<0?e=0:e>23&&(e=23):null!==e&&"h"===t.type&&(e<1?e=1:e>12&&(e=12)):e<0?e=0:e>59&&(e=59),e!==t.value&&(t.value=e,t.display=z(t)),o[L[t.type]]=t.value}),null!==o[0]&&null!==o[1]&&null!==o[2]){var s=t.find(function(t){return"d"===t.type});if(s)if(o[2]<1)s.value=o[2]=1,s.display=z(s);else{var f=U(new Date(o[0],o[1],1));o[2]>f&&(s.value=o[2]=f,s.display=s.input=z(s))}}t.find(function(t){return null===t.value})||0===o[0]||o[1]>11||o[1]<0||0===o[2]?t.value=null:(o.unshift(null),t.value=new(Date.bind.apply(Date,o))),e(n)}function O(t,e){e.value=t.reduce(function(t,e){return t+e.prefix+e.display},"")+t.suffix}function j(t,e){return t.find(function(t){return e>=t.start&&e<=t.end})}function z(t){if(null===t.value)return S("",t.length,T);switch(t.type){case"y":return t.value?t.length<=2?(""+t.value).substr(2,2):""+S(t.value,t.length):S("",t.length,T);case"M":return~t.value?1===t.length?""+(t.value+1):2===t.length?(t.value<9?"0":"")+(t.value+1):3===t.length?H[t.value].substr(0,3):H[t.value]:S("",t.length,T);case"d":return t.value?1===t.length?""+t.value:2===t.length?(t.value<=9?"0":"")+t.value:3===t.length?I[t.groups.value.getDay()].substr(0,3):I[t.groups.value.getDay()]:S("",t.length,T);case"H":case"h":case"m":case"s":return 1===t.length?""+t.value:S(t.value,t.length);case"S":return 1===t.length?""+t.value:S(t.value,3)}}var A=/y+|M+|d+|E+|H+|m+|s+|S+|k+|a+/g,H=["January","February","March","April","May","June","July","August","September","October","November","December"],I=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],W={teardown:function(){}};function U(t){return new Date(new Date(t.getFullYear(),t.getMonth()+1,1)-864e5).getDate()}var J=new Date("0000-01-01T00:00:00");function K(t,e){var n=t;if("function"==typeof n&&(n=t()),"string"==typeof n)if("function"==typeof e)try{n=e(n)}catch(t){return defaultDate()}else try{n=new Date(n)}catch(t){return defaultDate()}return n instanceof Date?n:J}function q(t){t.strObserver&&t.strObserver.cancel(),t.attributes.value?t.link(t.attributes.value,"rdi.val"):t.unlink("rdi.val"),t.attributes.display?t.link(t.attributes.display,"rdi.display"):t.unlink("rdi.display"),t.attributes.string&&(t.strObserver=t.observe("rdi.val",function(e){return t.set(t.attributes.string,e?e.toString():"")}));var e={};["null","lazy","eager","mask","min","max","mask","no-pick","time"].forEach(function(n){n in t.attributes&&(e[n.replace(/-/g,"")]=t.attributes[n]),"eager"===n&&n in t.attributes&&(e.lazy=!t.attributes.eager)}),t.attributes.value&&(e.value="rdi.val"),t.attributes.display&&(e.display="rdi.display"),t.set("rdi.opts",e)}var X=Ractive.macro(function(t){return t.aliasLocal("rdi"),q(t),t.setTemplate({v:4,t:[{t:7,e:"span",m:[{t:13,n:"class",f:"rdi-date field-wrapper",g:1}],f:[{t:7,e:"input",m:[{n:"rdi-reg",t:71,f:{r:[],s:'["node"]'}},{n:"rdi-date",t:71,f:{r:["rdi.opts"],s:"[_0]"}},{n:"class-rdi-date",t:13},{t:8,r:"extra-attributes"}]}," ",{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rdi-x",g:1},{n:["click"],t:70,f:{r:["@context"],s:'[(_0).set("rdi.val",null)]'}},{n:"title",f:"Clear",t:13,g:1}],f:["×"]}],n:50,x:{r:["rdi.opts.null","rdi.val"],s:"_0&&_1!==null"}}," ",{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rdi-pop",g:1},{n:"rdi-pop",t:71,f:{r:["rdi.node","rdi.tail"],s:'[{path:"rdi.popped",node:_0,tail:_1}]'}},{n:["click"],t:70,f:{r:[],s:"[false,false]"}},{n:"title",f:"Select from calendar",t:13,g:1}],f:[{t:7,e:"svg",m:[{n:"rdi-reg",t:71,f:{r:[],s:'["tail"]'}},{n:"x",f:"0px",t:13,g:1},{n:"y",f:"0px",t:13,g:1},{n:"viewBox",f:"0 0 48 48",t:13,g:1},{n:"xml:space",f:"preserve",t:13}],f:[{t:7,e:"rect",m:[{t:13,n:"style",f:"opacity:0.5;fill:none;stroke-width:1;",g:1},{n:"y",f:"1",t:13,g:1},{n:"x",f:"1",t:13,g:1},{n:"height",f:"46",t:13,g:1},{n:"width",f:"46",t:13,g:1}]}," ",{t:7,e:"rect",m:[{n:"y",f:"1",t:13,g:1},{n:"x",f:"1",t:13,g:1},{n:"height",f:"8",t:13,g:1},{n:"width",f:"46",t:13,g:1}]}," ",{t:7,e:"rect",m:[{t:13,n:"style",f:"opacity:0.2;stroke:none;",g:1},{n:"y",f:"13",t:13,g:1},{n:"x",f:"3",t:13,g:1},{n:"height",f:"8",t:13,g:1},{n:"width",f:"8",t:13,g:1}]}," ",{t:7,e:"rect",m:[{t:13,n:"style",f:"opacity:0.8;stroke:none;",g:1},{t:13,n:"class",f:"rdi-today",g:1},{n:"y",f:"13",t:13,g:1},{n:"x",f:"14",t:13,g:1},{n:"height",f:"8",t:13,g:1},{n:"width",f:"8",t:13,g:1}]}," ",{t:7,e:"rect",m:[{t:13,n:"style",f:"opacity:0.2;stroke:none;",g:1},{n:"y",f:"13",t:13,g:1},{n:"x",f:"25",t:13,g:1},{n:"height",f:"8",t:13,g:1},{n:"width",f:"8",t:13,g:1}]}," ",{t:7,e:"rect",m:[{t:13,n:"style",f:"opacity:0.4;stroke:none;",g:1},{n:"y",f:"13",t:13,g:1},{n:"x",f:"37",t:13,g:1},{n:"height",f:"8",t:13,g:1},{n:"width",f:"8",t:13,g:1}]}," ",{t:7,e:"rect",m:[{t:13,n:"style",f:"opacity:0.2;stroke:none;",g:1},{n:"y",f:"24",t:13,g:1},{n:"x",f:"3",t:13,g:1},{n:"height",f:"8",t:13,g:1},{n:"width",f:"8",t:13,g:1}]}," ",{t:7,e:"rect",m:[{t:13,n:"style",f:"opacity:0.2;stroke:none;",g:1},{n:"y",f:"24",t:13,g:1},{n:"x",f:"14",t:13,g:1},{n:"height",f:"8",t:13,g:1},{n:"width",f:"8",t:13,g:1}]}," ",{t:7,e:"rect",m:[{t:13,n:"style",f:"opacity:0.2;stroke:none;",g:1},{n:"y",f:"24",t:13,g:1},{n:"x",f:"25",t:13,g:1},{n:"height",f:"8",t:13,g:1},{n:"width",f:"8",t:13,g:1}]}," ",{t:7,e:"rect",m:[{t:13,n:"style",f:"opacity:0.4;stroke:none;",g:1},{n:"y",f:"24",t:13,g:1},{n:"x",f:"37",t:13,g:1},{n:"height",f:"8",t:13,g:1},{n:"width",f:"8",t:13,g:1}]}," ",{t:7,e:"rect",m:[{t:13,n:"style",f:"opacity:0.2;stroke:none;",g:1},{n:"y",f:"35",t:13,g:1},{n:"x",f:"3",t:13,g:1},{n:"height",f:"8",t:13,g:1},{n:"width",f:"8",t:13,g:1}]}," ",{t:7,e:"rect",m:[{t:13,n:"style",f:"opacity:0.2;stroke:none;",g:1},{n:"y",f:"35",t:13,g:1},{n:"x",f:"14",t:13,g:1},{n:"height",f:"8",t:13,g:1},{n:"width",f:"8",t:13,g:1}]}," ",{t:7,e:"rect",m:[{t:13,n:"style",f:"opacity:0.2;stroke:none;",g:1},{n:"y",f:"35",t:13,g:1},{n:"x",f:"25",t:13,g:1},{n:"height",f:"8",t:13,g:1},{n:"width",f:"8",t:13,g:1}]}," ",{t:7,e:"rect",m:[{t:13,n:"style",f:"opacity:0.4;stroke:none;",g:1},{n:"y",f:"35",t:13,g:1},{n:"x",f:"37",t:13,g:1},{n:"height",f:"8",t:13,g:1},{n:"width",f:"8",t:13,g:1}]}]}]}],n:51,r:"rdi.opts.nopick"}]}," ",{t:7,e:"rdi-pop",m:[{n:"popped",t:13,f:[{t:2,r:"rdi.popped"}]},{n:"tail",f:0,t:13},{n:"align",f:"end",t:13,g:1}],f:[{t:7,e:"rdi-picker",m:[{n:["init"],t:70,f:{r:["@context","rdi.val"],s:'[(_0).component.set("target",_1)]'}},{n:"date",t:13,f:[{t:2,r:"rdi.val"}]}]}]}],e:{'["node"]':function(){return["node"]},"[_0]":function(t){return[t]},'[(_0).set("rdi.val",null)]':function(t){return[t.set("rdi.val",null)]},"_0&&_1!==null":function(t,e){return t&&null!==e},'[{path:"rdi.popped",node:_0,tail:_1}]':function(t,e){return[{path:"rdi.popped",node:t,tail:e}]},"[false,false]":function(){return[!1,!1]},'["tail"]':function(){return["tail"]},'[(_0).component.set("target",_1)]':function(t,e){return[t.component.set("target",e)]}}}),{update:function(){q(t)}}},{css:function(t){return[function(t){return".rdi-date {\n position: relative;\n display: inline-block;\n }\n \n .rdi-date input.rdi-date {\n width: 100%;\n box-sizing: border-box;\n }\n \n .rdi-x {\n position: absolute;\n right: 2em;\n top: 0.025em;\n cursor: pointer;\n }\n \n .rdi-pop {\n position: absolute;\n display: flex;\n justify-content: space-around;\n align-items: flex-end;\n flex-direction: column;\n right: 0.5em;\n height: 100%;\n top: 0;\n cursor: pointer;\n }\n \n .rdi-pop > svg {\n height: 48px;\n max-height: 60%;\n fill: "+(t("raui.dateInput.primary.fg")||t("raui.primary.fg")||"#222")+";\n }\n \n .rdi-today {\n fill: "+(t("raui.dateInput.primary.fga")||t("raui.primary.fga")||"#07e")+";\n }"}.call(this,t)].join(" ")},cssId:"rdi",noCssTransform:!0,attributes:["value","null","lazy","eager","mask","string","display","min","max","no-pick","time"]});t.DateInput=X,t.default=function(t){return void 0===t&&(t={}),function(e){var n,r=e.instance;r.components["rdi-picker"]=l,r.components["rdi-pop"]=_,(void 0===(n={name:"rdi-pop"})&&(n={}),function(t){t.instance.decorators[n.name||"pop"]=function(t,e,r){if(void 0===r&&(r={}),!e)return{teardown:w};"string"==typeof e?r.path=e:"object"==typeof e&&(r=e);var i,a,o=this.getContext(t);function l(n){if("mouseover"!==n.type||!o.get(e)){if("click"!==n.type||!a||i){var l=h,s=v;"function"==typeof(h=r.node||t)&&(h=h()),h=h||t,"function"==typeof(v=r.tail)&&(v=v()),o.toggle(r.path),h=l,v=s}a&&"click"===n.type&&(i=o.observeOnce(r.path,function(){i=null}))}}function s(t){i||o.set(r.path,!1)}return("click"in r?r.click:!1!==n.click)&&o.listen("click",l),("hover"in r?r.hover:n.hover)&&(a=1,o.listen("mouseover",l),o.listen("mouseout",s)),{teardown:function(){o.unlisten("click",l),a&&(o.unlisten("mouseover",l),o.unlisten("mouseout",s),i&&i.cancel())}}}})({instance:r}),R({name:"rdi-date",parseDate:t.parseDate})({instance:r}),r.partials[t.name||"date-input"]=X,r.decorators["rdi-reg"]=function(t,e){return this.getContext(t).set("rdi."+e,function(){return t}),{teardown:function(){}}}}},Object.defineProperty(t,"__esModule",{value:!0})});

@@ -43,3 +43,3 @@ (function (global, factory) {

return ("\n label.field, .field-manual {\n display: inline-block;\n font-size: 0.9em;\n font-weight: 500;\n color: " + (primary.fg || '#222') + ";\n transition: 0.2s ease-in-out;\n transition-property: color;\n vertical-align: top;\n box-sizing: border-box;\n padding: 0.25em 0.5em;\n line-height: 1.5em;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-family: inherit;\n }\n\n label.field.textarea {\n display: block;\n border: 0.0625em solid " + (primary.bc || '#ccc') + ";\n padding: 0.5em 0.8em 0.8em 0.8em;\n border-radius: " + (primary.radius || '0.2em') + ";\n box-shadow: none;\n transition-property: color, border-color, box-shadow;\n margin: 0.8em 0.2em;\n min-height: auto;\n background-color: " + (boxy ? primary.bg || '#fff' : 'transparent') + ";\n }\n\n label.field.focus {\n color: " + (active.fg || primary.fga || '#07e') + ";\n }\n\n label.field.textarea.focus {\n border-color: " + (active.fg || primary.fga || '#07e') + ";\n " + (!boxy ? ("box-shadow: 0.0625em 0.0625em " + (active.fg || primary.fga || '#07e') + ",\n -0.0625em 0.0625em " + (active.fg || primary.fga || '#07e') + ",\n 0.0625em -0.0625em " + (active.fg || primary.fga || '#07e') + ",\n -0.0625em -0.0625em " + (active.fg || primary.fga || '#07e') + ";") : '') + "\n }\n\n label.field input,\n label.field select,\n label.field textarea,\n .field-manual .field-body\n {\n display: block;\n border-width: " + (boxy ? '0.0625em' : '0 0 0.0625em 0') + ";\n border-color: " + (primary.bc || '#ccc') + ";\n border-style: solid;\n box-sizing: border-box;\n background-color: " + (boxy ? primary.bg || '#fff' : 'transparent') + ";\n transition: 0.2s ease-in-out;\n transition-property: box-shadow, color;\n outline: none;\n box-shadow: none;\n width: 100%;\n margin-bottom: 0.8em;\n font-size: 1.1em;" + (boxy ? ("\n border-radius: " + (primary.radius || '0.2em') + ";") : '') + "\n font-weight: 400;\n font-family: inherit;\n }\n\n label.field input" + (boxy ? '' : ':disabled') + ",\n label.field select" + (boxy ? '' : ':disabled') + " {\n padding: 0 0.75em;\n }\n label.field select" + (boxy ? '' : ':disabled') + " {\n padding-right: 2em;\n }\n\n label.field input:disabled,\n label.field input[readonly],\n label.field select:disabled,\n label.field textarea:disabled,\n label.field textarea[readonly] {\n background: " + (disabled.bg || '#f4f4f4') + ";\n color: " + (disabled.fg || '#444') + ";\n }\n\n label.field textarea {\n line-height: 1.2em;\n }\n label.field .field-wrapper {\n display: block;\n }\n label.field > select, label.field > input,\n label.field > .field-wrapper > input, label.field > .field-wrapper > select {\n height: 2.5em;\n }\n\n " + (!boxy ? ("label.field:hover > input,\n label.field:hover select,\n label.field.file:hover:after {\n box-shadow: 0 0.0625em 0 0 " + (primary.bc || '#ccc') + ";\n }\n\n label.field.textarea:hover {\n box-shadow: 0.0625em 0.0625em " + (primary.bc || '#ccc') + ",\n -0.0625em 0.0625em " + (primary.bc || '#ccc') + ",\n 0.0625em -0.0625em " + (primary.bc || '#ccc') + ",\n -0.0625em -0.0625em " + (primary.bc || '#ccc') + ";\n }\n\n label.field.textarea.focus:hover {\n box-shadow: 0.0625em 0.0625em " + (active.fg || primary.fga || '#07e') + ",\n -0.0625em 0.0625em " + (active.fg || primary.fga || '#07e') + ",\n 0.0625em -0.0625em " + (active.fg || primary.fga || '#07e') + ",\n -0.0625em -0.0625em " + (active.fg || primary.fga || '#07e') + ";\n }") : '') + "\n\n /**** CHECK BOXES ****/\n\n label.field.check, label.field.radio {\n position:relative;\n z-index: 0;\n overflow: visible;\n cursor: pointer;\n padding-top: 2.2em;\n white-space: normal;\n }\n label.field.check.inline, label.field.radio.inline {\n padding-top: 0.7em;\n }\n\n label.field.check input, label.field.radio input {\n appearance: none;\n -moz-appearance: none;\n -webkit-appearance: none;\n z-index: -1;\n position: absolute;\n left: -0.5em;\n top: 1em;\n display: block;\n margin: 0;\n border-radius: 50%;\n width: 3.2em;\n height: 3.2em;\n background-color: " + (primary.bc || '#ccc') + ";\n box-shadow: none;\n outline: none;\n opacity: 0;\n transform: scale(1);\n pointer-events: none;\n transition: opacity 0.3s, transform 0.2s;\n }\n label.field.inline.check input, label.field.inline.radio input {\n top: -0.45em;\n left: -0.55em;\n }\n\n label.field.check input:checked, label.field.radio input:checked {\n background-color: " + (primary.fga || '#07e') + ";\n }\n\n label.field.check:hover > input, label.field.radio:hover > input {\n opacity: 0.04;\n }\n\n label.field.check input:focus, label.field.radio input:focus {\n opacity: 0.12;\n }\n\n label.field.check:hover > input:focus, label.field.radio:hover > input:focus {\n opacity: 0.16;\n }\n\n label.field.check input:active, label.field.radio input:active {\n opacity: 0.6;\n transform: scale(0);\n transition: transform 0s, opacity 0s;\n }\n\n label.field.check:before, label.field.radio:before {\n content: '';\n display: inline-block;\n box-sizing: border-box;\n margin: 0 0.5em 0.2em 0.1em;\n border: solid 0.125em; /* Safari */\n border-color: " + (primary.fg || '#222') + ";\n border-radius: 0.125em;\n width: 1.2em;\n height: 1.2em;\n vertical-align: bottom;\n transition: border-color 0.2s, background-color 0.2s;\n }\n\n label.field.check:after, label.field.radio:after {\n content: '';\n display: inline-block;\n opacity: 0;\n position: absolute;\n width: 1.2em;\n height: 1.2em;\n top: 2.3em;\n left: 0.6em;\n border-radius: 0.125em;\n }\n label.field.check.inline:after, label.field.radio.inline:after {\n top: 0.8em;\n }\n\n label.field.check.checked:after {\n opacity: 1;\n background: no-repeat center/80% url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\"><path fill=\"" + ((primary.bg || '#fff').replace(/#/g, '%23')) + "\" d=\"m 15.378906,1.7050781 a 1.0583349,1.0583349 0 0 0 -1.478515,0.234375 L 6.6210937,11.960938 1.8652344,8.5058594 a 1.0583349,1.0583349 0 0 0 -1.47851565,0.234375 1.0583349,1.0583349 0 0 0 0.234375,1.4785156 L 6.234375,14.294922 A 1.0584408,1.0584408 0 0 0 7.7128906,14.060547 L 15.613281,3.1835938 A 1.0583349,1.0583349 0 0 0 15.378906,1.7050781 Z\" /></svg>') " + (primary.fga || '#07e') + ";\n }\n\n label.field.radio.checked:after {\n opacity: 1;\n background: no-repeat center/80% url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\"><circle fill=\"" + ((primary.bg || '#fff').replace(/#/g, '%23')) + "\" cx=\"8\" cy=\"8\" r=\"5\" /></svg>') " + (primary.fga || '#07e') + ";\n }\n\n label.field.check.checked:before, label.field.radio.checked:before {\n border-color: " + (primary.fga || '#07e') + ";\n }\n label.field.check.focus:before, label.field.radio.focus:before {\n border-color: " + (primary.fga || '#07e') + ";\n }\n\n label.field.check input:disabled, label.field.radio input:disabled {\n opacity: 0;\n }\n\n label.field.check.disabled, label.field.radio.disabled {\n color: " + (disabled.fg || '#444') + ";\n cursor: initial;\n }\n\n label.field.check.disabled:before, label.field.radio.disabled:before {\n border-color: " + (disabled.bc || '#ccc') + ";\n background-color: " + (disabled.bg || '#f4f4f4') + ";\n }\n\n label.field.check.checked.disabled:after, label.field.radio.checked.disabled:after {\n border-color: transparent;\n background-color: " + (disabled.bc || '#ccc') + ";\n }\n\n label.field select {\n padding-right: 2em;\n }\n\n label.field.select {\n cursor: pointer;\n position: relative;\n }\n\n label.field.select:after {\n content: ' ';\n position: absolute;\n display: block;\n width: 0.6em;\n right: 1.125em;\n height: 0.6em;\n top: 2.6em;\n border-bottom: 0.125em solid;\n border-right: 0.125em solid;\n transform: rotate(45deg);\n pointer-events: none;\n color: " + (primary.bc || '#ccc') + ";\n }\n\n label.field textarea {\n border: none;" + (boxy ? "\n padding: 0;" : '') + "\n }\n\n label.field > select {\n -moz-appearance: none;\n -webkit-appearance: none;\n }\n\n label.field input:focus,\n label.field select:focus,\n label.field.file.focus:after\n {\n border-color: " + (active.fg || primary.fga || '#07e') + ";\n " + (!boxy ? ("box-shadow: 0 0.0625em 0 0 " + (active.fg || primary.fga || '#07e') + ";") : '') + "\n }\n\n label.field input[type=checkbox]:focus,\n label.field input[type=radio]:focus {\n box-shadow: none;\n }\n\n label.field.file.focus:after {\n color: " + (active.fg || primary.fga || '#07e') + ";\n }\n label.field.file [type=file] {\n position: absolute;\n width: 0;\n height: 0;\n opacity: 0;\n z-index: -1;\n }\n label.field.file {\n position: relative;\n min-width: 9em;\n height: 5em;\n }\n label.field.file:after {\n position: absolute;\n content: 'Choose a file';\n box-sizing: border-box;\n width: calc(100% - 0.3em);\n height: 2.5em;\n font-size: 1.1em;\n line-height: 1.5em;\n color: " + (primary.fg || '#222') + ";\n text-align: " + (boxy ? 'center' : 'left') + ";\n padding: 0.5em " + (boxy ? '0.5em' : '0') + ";\n cursor: pointer;\n font-style: oblique;\n left: 0.25em;\n top: 1.6em;\n transition: 0.2s ease-in-out;\n transition-property: color, border-bolor, box-shadow;" + (boxy ? ("\n border-radius: " + (primary.radius || '0.2em') + ";\n border-color: " + (primary.bc || '#ccc') + ";\n border-style: solid;\n border-width: 0.0625em;") : ("\n border-bottom-color: " + (primary.bc || '#ccc') + ";\n border-bottom-width: 0.0625em;\n border-bottom-style: solid;\n ")) + "\n }\n label.field.file.inline:after {\n top: 0.2em;\n }\n\n label.field.button {\n vertical-align: top;\n padding-top: " + (boxy ? '1.7' : '1.958') + "em;\n }\n label.field .with-buttons button, label.field.button button {\n font-size: 1.1em;\n margin-top: " + (boxy ? '0.15em' : '0') + ";\n }\n\n label.field .field-wrapper.with-buttons {\n display: flex;\n }\n label.field .with-buttons button {\n flex-shrink: 0;\n padding-left: 0.5em;\n padding-right: 0.5em;\n margin-top: 0;\n margin-right: 0;\n " + (boxy ? ("height: 2.5em;\n box-shadow: none;\n border-radius: 0;\n border-left: 1px solid " + (primary.bg || '#fff') + ";\n margin-left: 0;") :
"height: 2.25em;") + "\n }" + (boxy ? ("\n label.field .with-buttons button:first-of-type {\n margin-left: -0.05em;\n border-left: none;\n }\n label.field .with-buttons button:last-of-type {\n border-radius: 0 " + (primary.radius || '0.2em') + " " + (primary.radius || '0.2em') + " 0;\n }\n label.field .with-buttons input {\n border-radius: " + (primary.radius || '0.2em') + " 0 0 " + (primary.radius || '0.2em') + ";\n min-width: 0;\n }\n ") : '') + "\n\n label.field.plain > div {\n position: absolute;\n font-size: 1.1em;\n top: 2.4em;\n font-weight: normal;\n }\n\n /* inline fields (no labels) */\n label.field.inline {\n height: 3.3em;\n }\n\n label.field.button.inline {\n margin-top: 0.2em;\n padding-top: 0.12em;\n }\n\n label.field.button.inline button {\n margin-top: 0;\n }\n\n label.field.inline.select:after {\n top: 1." + (boxy ? '15' : '1') + "em;\n }\n\n label.field .field-tip {\n display: inline-block;\n width: 1em;\n height: 1em;\n background-color: " + (primary.fga || '#07e') + ";\n color: " + (primary.bg || '#fff;') + ";\n cursor: default;\n user-select: none;\n border-radius: 1em;\n margin-left: 0.5em;\n line-height: 1.2em;\n text-align: center;\n margin-top: -0.2em;\n }\n\n label.field .field-solo-tip {\n margin-left: -0.1em;\n }\n ");
"height: 2.25em;") + "\n }" + (boxy ? ("\n label.field .with-buttons button:first-of-type {\n margin-left: -0.05em;\n border-left: none;\n }\n label.field .with-buttons button:last-of-type {\n border-radius: 0 " + (primary.radius || '0.2em') + " " + (primary.radius || '0.2em') + " 0;\n }\n label.field .with-buttons input {\n border-radius: " + (primary.radius || '0.2em') + " 0 0 " + (primary.radius || '0.2em') + ";\n min-width: 0;\n }\n ") : '') + "\n\n label.field.plain > div {\n position: absolute;\n font-size: 1.1em;\n top: 2.4em;\n font-weight: normal;\n }\n\n /* inline fields (no labels) */\n label.field.inline {\n min-height: 3.3em;\n }\n\n label.field.button.inline {\n margin-top: 0.2em;\n padding-top: 0.12em;\n }\n\n label.field.button.inline button {\n margin-top: 0;\n }\n\n label.field.inline.select:after {\n top: 1." + (boxy ? '15' : '1') + "em;\n }\n\n label.field .field-tip {\n display: inline-block;\n width: 1em;\n height: 1em;\n background-color: " + (primary.fga || '#07e') + ";\n color: " + (primary.bg || '#fff;') + ";\n cursor: default;\n user-select: none;\n border-radius: 1em;\n margin-left: 0.5em;\n line-height: 1.2em;\n text-align: center;\n margin-top: -0.2em;\n }\n\n label.field .field-solo-tip {\n margin-left: -0.1em;\n }\n ");
// TODO: other themes

@@ -226,2 +226,3 @@ }

var body = [];
var label = [];
var attrs = (handle.template.m || []).slice();

@@ -272,2 +273,9 @@ var content = handle.template.f || [];

// check for button wrapping
content.forEach(function (e) {
if (e.e === 'label') {
if (e.f && e.f.length) { label.push.apply(label, e.f); }
} else {
body.push(e);
}
});
var els = content.filter(function (e) { return e.e; });

@@ -279,13 +287,12 @@ if (els.find(function (e) { return e.e === 'button'; }) && els.length > 1) {

],
f: content
f: body
}];
} else {
body.push.apply(body, content);
}
}
var label = attrs.find(function (a) { return a.n === 'label'; });
var labelattr = attrs.find(function (a) { return a.n === 'label'; });
if (labelattr && labelattr.f && labelattr.f.length) { label.push.apply(label, Array.isArray(labelattr.f) ? labelattr.f : [labelattr.f]); }
if (tip) { body.unshift({
t: 7, e: 'span', m: [
{ t: 13, n: 'class', f: ("field-tip" + (!label ? ' field-solo-tip' : '')), g: 1 },
{ t: 13, n: 'class', f: ("field-tip" + (!label.length ? ' field-solo-tip' : '')), g: 1 },
{ t: 13, n: 'title', f: tip.f },

@@ -297,3 +304,3 @@ { t: 70, n: ['click'], f: { r: [], s: '[false]' } }

var inline = attrs.find(function (a) { return a.n === 'inline'; });
if (label && !inline) { body.unshift.apply(body, Array.isArray(label.f) ? label.f : [label.f]); }
if (label && !inline) { body.unshift.apply(body, label); }
else if (!inline) { body.unshift('\xa0'); }

@@ -300,0 +307,0 @@

@@ -1,1 +0,1 @@

!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("ractive")):"function"==typeof define&&define.amd?define(["exports","ractive"],n):n(e.RauiForm={},e.Ractive)}(this,function(e,n){"use strict";n=n&&n.hasOwnProperty("default")?n.default:n;var i="undefined"!=typeof window?window:null;function l(e,n,l){if(i&&i.Ractive&&"object"==typeof i.Ractive[n]){var t=document.currentScript;if(t||(t=(t=document.querySelectorAll("script"))[t.length-1]),t){var a=t.getAttribute("data-alias");a&&(a=(a=a.split("&")).reduce(function(e,n){var i=n.split("="),l=i[0],t=i[1];return e[l]=t,e},{})),Ractive[n][a&&a[e]||e]=l}}}function t(e){var n=Object.assign({},e("raui.primary"),e("raui.form.primary")),i=Object.assign({},e("raui.primary.active"),e("raui.form.primary.active")),l=Object.assign({},e("raui.primary.disabled"),e("raui.form.primary.disabled")),t=e("raui.form.boxy");return"\n label.field, .field-manual {\n display: inline-block;\n font-size: 0.9em;\n font-weight: 500;\n color: "+(n.fg||"#222")+";\n transition: 0.2s ease-in-out;\n transition-property: color;\n vertical-align: top;\n box-sizing: border-box;\n padding: 0.25em 0.5em;\n line-height: 1.5em;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-family: inherit;\n }\n\n label.field.textarea {\n display: block;\n border: 0.0625em solid "+(n.bc||"#ccc")+";\n padding: 0.5em 0.8em 0.8em 0.8em;\n border-radius: "+(n.radius||"0.2em")+";\n box-shadow: none;\n transition-property: color, border-color, box-shadow;\n margin: 0.8em 0.2em;\n min-height: auto;\n background-color: "+(t?n.bg||"#fff":"transparent")+";\n }\n\n label.field.focus {\n color: "+(i.fg||n.fga||"#07e")+";\n }\n\n label.field.textarea.focus {\n border-color: "+(i.fg||n.fga||"#07e")+";\n "+(t?"":"box-shadow: 0.0625em 0.0625em "+(i.fg||n.fga||"#07e")+",\n -0.0625em 0.0625em "+(i.fg||n.fga||"#07e")+",\n 0.0625em -0.0625em "+(i.fg||n.fga||"#07e")+",\n -0.0625em -0.0625em "+(i.fg||n.fga||"#07e")+";")+"\n }\n\n label.field input,\n label.field select,\n label.field textarea,\n .field-manual .field-body\n {\n display: block;\n border-width: "+(t?"0.0625em":"0 0 0.0625em 0")+";\n border-color: "+(n.bc||"#ccc")+";\n border-style: solid;\n box-sizing: border-box;\n background-color: "+(t?n.bg||"#fff":"transparent")+";\n transition: 0.2s ease-in-out;\n transition-property: box-shadow, color;\n outline: none;\n box-shadow: none;\n width: 100%;\n margin-bottom: 0.8em;\n font-size: 1.1em;"+(t?"\n border-radius: "+(n.radius||"0.2em")+";":"")+"\n font-weight: 400;\n font-family: inherit;\n }\n\n label.field input"+(t?"":":disabled")+",\n label.field select"+(t?"":":disabled")+" {\n padding: 0 0.75em;\n }\n label.field select"+(t?"":":disabled")+" {\n padding-right: 2em;\n }\n\n label.field input:disabled,\n label.field input[readonly],\n label.field select:disabled,\n label.field textarea:disabled,\n label.field textarea[readonly] {\n background: "+(l.bg||"#f4f4f4")+";\n color: "+(l.fg||"#444")+";\n }\n\n label.field textarea {\n line-height: 1.2em;\n }\n label.field .field-wrapper {\n display: block;\n }\n label.field > select, label.field > input,\n label.field > .field-wrapper > input, label.field > .field-wrapper > select {\n height: 2.5em;\n }\n\n "+(t?"":"label.field:hover > input,\n label.field:hover select,\n label.field.file:hover:after {\n box-shadow: 0 0.0625em 0 0 "+(n.bc||"#ccc")+";\n }\n\n label.field.textarea:hover {\n box-shadow: 0.0625em 0.0625em "+(n.bc||"#ccc")+",\n -0.0625em 0.0625em "+(n.bc||"#ccc")+",\n 0.0625em -0.0625em "+(n.bc||"#ccc")+",\n -0.0625em -0.0625em "+(n.bc||"#ccc")+";\n }\n\n label.field.textarea.focus:hover {\n box-shadow: 0.0625em 0.0625em "+(i.fg||n.fga||"#07e")+",\n -0.0625em 0.0625em "+(i.fg||n.fga||"#07e")+",\n 0.0625em -0.0625em "+(i.fg||n.fga||"#07e")+",\n -0.0625em -0.0625em "+(i.fg||n.fga||"#07e")+";\n }")+"\n\n /**** CHECK BOXES ****/\n\n label.field.check, label.field.radio {\n position:relative;\n z-index: 0;\n overflow: visible;\n cursor: pointer;\n padding-top: 2.2em;\n white-space: normal;\n }\n label.field.check.inline, label.field.radio.inline {\n padding-top: 0.7em;\n }\n\n label.field.check input, label.field.radio input {\n appearance: none;\n -moz-appearance: none;\n -webkit-appearance: none;\n z-index: -1;\n position: absolute;\n left: -0.5em;\n top: 1em;\n display: block;\n margin: 0;\n border-radius: 50%;\n width: 3.2em;\n height: 3.2em;\n background-color: "+(n.bc||"#ccc")+";\n box-shadow: none;\n outline: none;\n opacity: 0;\n transform: scale(1);\n pointer-events: none;\n transition: opacity 0.3s, transform 0.2s;\n }\n label.field.inline.check input, label.field.inline.radio input {\n top: -0.45em;\n left: -0.55em;\n }\n\n label.field.check input:checked, label.field.radio input:checked {\n background-color: "+(n.fga||"#07e")+";\n }\n\n label.field.check:hover > input, label.field.radio:hover > input {\n opacity: 0.04;\n }\n\n label.field.check input:focus, label.field.radio input:focus {\n opacity: 0.12;\n }\n\n label.field.check:hover > input:focus, label.field.radio:hover > input:focus {\n opacity: 0.16;\n }\n\n label.field.check input:active, label.field.radio input:active {\n opacity: 0.6;\n transform: scale(0);\n transition: transform 0s, opacity 0s;\n }\n\n label.field.check:before, label.field.radio:before {\n content: '';\n display: inline-block;\n box-sizing: border-box;\n margin: 0 0.5em 0.2em 0.1em;\n border: solid 0.125em; /* Safari */\n border-color: "+(n.fg||"#222")+';\n border-radius: 0.125em;\n width: 1.2em;\n height: 1.2em;\n vertical-align: bottom;\n transition: border-color 0.2s, background-color 0.2s;\n }\n\n label.field.check:after, label.field.radio:after {\n content: \'\';\n display: inline-block;\n opacity: 0;\n position: absolute;\n width: 1.2em;\n height: 1.2em;\n top: 2.3em;\n left: 0.6em;\n border-radius: 0.125em;\n }\n label.field.check.inline:after, label.field.radio.inline:after {\n top: 0.8em;\n }\n\n label.field.check.checked:after {\n opacity: 1;\n background: no-repeat center/80% url(\'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="'+(n.bg||"#fff").replace(/#/g,"%23")+'" d="m 15.378906,1.7050781 a 1.0583349,1.0583349 0 0 0 -1.478515,0.234375 L 6.6210937,11.960938 1.8652344,8.5058594 a 1.0583349,1.0583349 0 0 0 -1.47851565,0.234375 1.0583349,1.0583349 0 0 0 0.234375,1.4785156 L 6.234375,14.294922 A 1.0584408,1.0584408 0 0 0 7.7128906,14.060547 L 15.613281,3.1835938 A 1.0583349,1.0583349 0 0 0 15.378906,1.7050781 Z" /></svg>\') '+(n.fga||"#07e")+';\n }\n\n label.field.radio.checked:after {\n opacity: 1;\n background: no-repeat center/80% url(\'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><circle fill="'+(n.bg||"#fff").replace(/#/g,"%23")+'" cx="8" cy="8" r="5" /></svg>\') '+(n.fga||"#07e")+";\n }\n\n label.field.check.checked:before, label.field.radio.checked:before {\n border-color: "+(n.fga||"#07e")+";\n }\n label.field.check.focus:before, label.field.radio.focus:before {\n border-color: "+(n.fga||"#07e")+";\n }\n\n label.field.check input:disabled, label.field.radio input:disabled {\n opacity: 0;\n }\n\n label.field.check.disabled, label.field.radio.disabled {\n color: "+(l.fg||"#444")+";\n cursor: initial;\n }\n\n label.field.check.disabled:before, label.field.radio.disabled:before {\n border-color: "+(l.bc||"#ccc")+";\n background-color: "+(l.bg||"#f4f4f4")+";\n }\n\n label.field.check.checked.disabled:after, label.field.radio.checked.disabled:after {\n border-color: transparent;\n background-color: "+(l.bc||"#ccc")+";\n }\n\n label.field select {\n padding-right: 2em;\n }\n\n label.field.select {\n cursor: pointer;\n position: relative;\n }\n\n label.field.select:after {\n content: ' ';\n position: absolute;\n display: block;\n width: 0.6em;\n right: 1.125em;\n height: 0.6em;\n top: 2.6em;\n border-bottom: 0.125em solid;\n border-right: 0.125em solid;\n transform: rotate(45deg);\n pointer-events: none;\n color: "+(n.bc||"#ccc")+";\n }\n\n label.field textarea {\n border: none;"+(t?"\n padding: 0;":"")+"\n }\n\n label.field > select {\n -moz-appearance: none;\n -webkit-appearance: none;\n }\n\n label.field input:focus,\n label.field select:focus,\n label.field.file.focus:after\n {\n border-color: "+(i.fg||n.fga||"#07e")+";\n "+(t?"":"box-shadow: 0 0.0625em 0 0 "+(i.fg||n.fga||"#07e")+";")+"\n }\n\n label.field input[type=checkbox]:focus,\n label.field input[type=radio]:focus {\n box-shadow: none;\n }\n\n label.field.file.focus:after {\n color: "+(i.fg||n.fga||"#07e")+";\n }\n label.field.file [type=file] {\n position: absolute;\n width: 0;\n height: 0;\n opacity: 0;\n z-index: -1;\n }\n label.field.file {\n position: relative;\n min-width: 9em;\n height: 5em;\n }\n label.field.file:after {\n position: absolute;\n content: 'Choose a file';\n box-sizing: border-box;\n width: calc(100% - 0.3em);\n height: 2.5em;\n font-size: 1.1em;\n line-height: 1.5em;\n color: "+(n.fg||"#222")+";\n text-align: "+(t?"center":"left")+";\n padding: 0.5em "+(t?"0.5em":"0")+";\n cursor: pointer;\n font-style: oblique;\n left: 0.25em;\n top: 1.6em;\n transition: 0.2s ease-in-out;\n transition-property: color, border-bolor, box-shadow;"+(t?"\n border-radius: "+(n.radius||"0.2em")+";\n border-color: "+(n.bc||"#ccc")+";\n border-style: solid;\n border-width: 0.0625em;":"\n border-bottom-color: "+(n.bc||"#ccc")+";\n border-bottom-width: 0.0625em;\n border-bottom-style: solid;\n ")+"\n }\n label.field.file.inline:after {\n top: 0.2em;\n }\n\n label.field.button {\n vertical-align: top;\n padding-top: "+(t?"1.7":"1.958")+"em;\n }\n label.field .with-buttons button, label.field.button button {\n font-size: 1.1em;\n margin-top: "+(t?"0.15em":"0")+";\n }\n\n label.field .field-wrapper.with-buttons {\n display: flex;\n }\n label.field .with-buttons button {\n flex-shrink: 0;\n padding-left: 0.5em;\n padding-right: 0.5em;\n margin-top: 0;\n margin-right: 0;\n "+(t?"height: 2.5em;\n box-shadow: none;\n border-radius: 0;\n border-left: 1px solid "+(n.bg||"#fff")+";\n margin-left: 0;":"height: 2.25em;")+"\n }"+(t?"\n label.field .with-buttons button:first-of-type {\n margin-left: -0.05em;\n border-left: none;\n }\n label.field .with-buttons button:last-of-type {\n border-radius: 0 "+(n.radius||"0.2em")+" "+(n.radius||"0.2em")+" 0;\n }\n label.field .with-buttons input {\n border-radius: "+(n.radius||"0.2em")+" 0 0 "+(n.radius||"0.2em")+";\n min-width: 0;\n }\n ":"")+"\n\n label.field.plain > div {\n position: absolute;\n font-size: 1.1em;\n top: 2.4em;\n font-weight: normal;\n }\n\n /* inline fields (no labels) */\n label.field.inline {\n height: 3.3em;\n }\n\n label.field.button.inline {\n margin-top: 0.2em;\n padding-top: 0.12em;\n }\n\n label.field.button.inline button {\n margin-top: 0;\n }\n\n label.field.inline.select:after {\n top: 1."+(t?"15":"1")+"em;\n }\n\n label.field .field-tip {\n display: inline-block;\n width: 1em;\n height: 1em;\n background-color: "+(n.fga||"#07e")+";\n color: "+(n.bg||"#fff;")+";\n cursor: default;\n user-select: none;\n border-radius: 1em;\n margin-left: 0.5em;\n line-height: 1.2em;\n text-align: center;\n margin-top: -0.2em;\n }\n\n label.field .field-solo-tip {\n margin-left: -0.1em;\n }\n "}function a(){}function r(e){~this.className.indexOf("focus")||(this.className+=" focus")}function o(e){this.className=this.className.replace(/\bfocus\b/g,"").trim()}function c(e){var n,i,l,t,c,d,f,s,b,u,p,m,h,g=this.getContext(e);function y(){var a=v().split(/\s+/).filter(function(e){return!!e});(n=!!~a.indexOf("field"))||(a.push("field"),n=!0),(i=e.querySelector("input[type=checkbox]"))&&!~a.indexOf("check")&&a.push("check"),(l=e.querySelector("input[type=radio]"))&&!~a.indexOf("radio")&&a.push("radio");var r=i||l;r&&r.checked&&!~a.indexOf("checked")&&a.push("checked"),r&&r.disabled&&!~a.indexOf("disabled")&&a.push("disabled"),!r&&u?(u.cancel(),u=0,p&&(p.disconnect(),p=0),delete r._form_callback,h&&(delete h.checked,m=h=void 0)):r&&(r._form_callback=function(n,i){if(void 0===i&&(i=!0),i&&"radio"===r.type&&r.name){var l=[];l.push.apply(l,document.querySelectorAll("input[type=radio][name="+r.name+"]")),(l=l.filter(function(e){return e!==r})).forEach(function(e){return e._form_callback&&e._form_callback(n,!1)})}var t=r.checked;t&&!~e.className.indexOf("checked")?e.className+=" checked":!t&&~e.className.indexOf("checked")&&(e.className=e.className.replace(/\bchecked\b/g,"").replace(/ +/g," ").trim())},MutationObserver&&(p=new MutationObserver(function(){var n;(n=r.disabled)&&!~e.className.indexOf("disabled")?e.className+=" disabled":!n&&~e.className.indexOf("disabled")&&(e.className=e.className.replace(/\bdisabled\b/g,"").replace(/ +/g," ").trim())})).observe(r,{attributes:!0}),u=this.getContext(r).listen("change",r._form_callback),(m=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(r),"checked"))&&m.configurable&&(h=r,Object.defineProperty(r,"checked",{get:m.get,set:function(e){m.set.call(h,e),r._form_callback()},enumerable:!0,configurable:!0}))),(t=!!e.querySelector("textarea"))&&!~a.indexOf("textarea")&&a.push("textarea"),(c=!!e.querySelector("select"))&&!~a.indexOf("select")&&a.push("select"),(d=!!e.querySelector("input[type=file]"))&&!~a.indexOf("file")&&a.push("file"),(f=!!(f=e.querySelector("button"))&&f.parentNode===e)&&!~a.indexOf("button")&&a.push("button"),(s=!!e.querySelector("div"))&&!~a.indexOf("plain")&&a.push("plain"),(b=!(i||l||d||!e.querySelector("input")))&&!~a.indexOf("input")&&a.push("input"),e.className=a.join(" ")}function v(){var a=e.className;return n||(a=a.replace(/\bfield\b/g,"").trim()),i||(a=a.replace(/\bcheck(ed)?\b/g,"").trim()),l||(a=a.replace(/\bradio\b/g,"").trim()),t||(a=a.replace(/\btextarea\b/g,"").trim()),c||(a=a.replace(/\bselect\b/g,"").trim()),d||(a=a.replace(/\bfile\b/g,"").trim()),f||(a=a.replace(/\bbutton\b/g,"").trim()),s||(a=a.replace(/\bplain\b/g,"").trim()),b||(a=a.replace(/\binput\b/g,"").trim()),a=a.replace(/ +/g," ")}var x=g.listen("focusin",r),k=g.listen("focusout",o);y.call(this);var w={update:a,invalidate:y.bind(this),teardown:function(){g.ractive.fire("fieldUnregistered",g,e,w);var n=v();n=n.replace(/\bfocus\b/g,"").trim(),x.cancel(),k.cancel(),u&&u.cancel(),p&&p.disconnect(),h&&(delete h.checked,m=h=void 0),e.className=n},setDisabled:function(n){e.querySelectorAll("input,button,select,textarea").forEach(function(e){return e.disabled=n}),this.invalidate()}};return g.ractive.fire("fieldRegistered",g,e,w),w}function d(e,n){if(!e)return!1;for(var i=0;i<e.length;i++){if(e[i].e===n)return!0;if(e[i].f&&d(e[i].f,n))return!0}return!1}c.style=t;var f=n.macro(function(e){var n=[],i=(e.template.m||[]).slice(),l=e.template.f||[],t=i.find(function(e){return"value"===e.n}),a=i.find(function(e){return"type"===e.n}),r=i.find(function(e){return"tip"===e.n}),o=i.find(function(e){return"disabled"===e.n});if(r&&i.splice(i.indexOf(r),1),a&&"function"==typeof f.types[a.f])n.push.apply(n,f.types[a.f](i,l,e));else if(t){var c={t:7,e:"input",m:[t]};if(o&&c.m.push(o),d(l,"option")&&(c.e="select",c.f=l),a&&(c.m.push(a),"checkbox"===a.f||"radio"===a.f)){var s=i.find(function(e){return"target"===e.n});s?c.m.push(Object.assign({},s,{n:"name"})):c.m.splice(c.m.indexOf(t),1,Object.assign({},t,{n:"checked"}))}c.m=c.m.concat(i.filter(function(e){return 73===e.t||73===e.t||"placeholder"===e.n})),n.push(c);var b=l.filter(function(e){return"button"===e.e||d(e.f,"button")});b.length&&(n.push.apply(n,b),n=[{t:7,e:"span",m:[{t:13,n:"class",f:"field-wrapper with-buttons",g:1}],f:n}])}else{var u=l.filter(function(e){return e.e});u.find(function(e){return"button"===e.e})&&u.length>1?n=[{t:7,e:"span",m:[{t:13,n:"class",f:"field-wrapper with-buttons",g:1}],f:l}]:n.push.apply(n,l)}var p=i.find(function(e){return"label"===e.n});r&&n.unshift({t:7,e:"span",m:[{t:13,n:"class",f:"field-tip"+(p?"":" field-solo-tip"),g:1},{t:13,n:"title",f:r.f},{t:70,n:["click"],f:{r:[],s:"[false]"}}],f:"?"});var m=i.find(function(e){return"inline"===e.n});p&&!m?n.unshift.apply(n,Array.isArray(p.f)?p.f:[p.f]):m||n.unshift(" ");var h={t:7,e:"label",m:[{t:71,n:"field"}].concat(i.filter(function(e){return 13!==e.t&&73!==e.t||"value"!==e.n&&"type"!==e.n&&"inline"!==e.n&&"label"!==e.n&&"placeholder"!==e.n&&"target"!==e.n&&"disabled"!==e.n})),f:n};m&&h.m.push({t:13,n:"class",f:"inline"}),e.setTemplate([h])});function s(e){return"function"==typeof e.focus&&e.focus(),{teardown:a}}function b(e){return void 0===e&&(e={}),function(n){var i=n.Ractive,l=n.instance;if(!i.isInstance(l)&&e.includeStyle)if(l===i)i.addCSS("form-decorator",t);else{var a=l.css;l.css=function(e){return("function"!=typeof a?a||"":a(e))+t(e)}}l.partials[e.name||"field"]=f,l.decorators[e.name||"field"]=c,l.decorators[e.autofocusName||"autofocus"]=s}}f.types={},l("field","decorators",c),l("field","partials",f),l("autofocus","decorators",s),e.style=t,e.field=c,e.macro=f,e.autofocus=s,e.plugin=b,e.default=b,Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("ractive")):"function"==typeof define&&define.amd?define(["exports","ractive"],n):n(e.RauiForm={},e.Ractive)}(this,function(e,n){"use strict";n=n&&n.hasOwnProperty("default")?n.default:n;var i="undefined"!=typeof window?window:null;function l(e,n,l){if(i&&i.Ractive&&"object"==typeof i.Ractive[n]){var t=document.currentScript;if(t||(t=(t=document.querySelectorAll("script"))[t.length-1]),t){var a=t.getAttribute("data-alias");a&&(a=(a=a.split("&")).reduce(function(e,n){var i=n.split("="),l=i[0],t=i[1];return e[l]=t,e},{})),Ractive[n][a&&a[e]||e]=l}}}function t(e){var n=Object.assign({},e("raui.primary"),e("raui.form.primary")),i=Object.assign({},e("raui.primary.active"),e("raui.form.primary.active")),l=Object.assign({},e("raui.primary.disabled"),e("raui.form.primary.disabled")),t=e("raui.form.boxy");return"\n label.field, .field-manual {\n display: inline-block;\n font-size: 0.9em;\n font-weight: 500;\n color: "+(n.fg||"#222")+";\n transition: 0.2s ease-in-out;\n transition-property: color;\n vertical-align: top;\n box-sizing: border-box;\n padding: 0.25em 0.5em;\n line-height: 1.5em;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-family: inherit;\n }\n\n label.field.textarea {\n display: block;\n border: 0.0625em solid "+(n.bc||"#ccc")+";\n padding: 0.5em 0.8em 0.8em 0.8em;\n border-radius: "+(n.radius||"0.2em")+";\n box-shadow: none;\n transition-property: color, border-color, box-shadow;\n margin: 0.8em 0.2em;\n min-height: auto;\n background-color: "+(t?n.bg||"#fff":"transparent")+";\n }\n\n label.field.focus {\n color: "+(i.fg||n.fga||"#07e")+";\n }\n\n label.field.textarea.focus {\n border-color: "+(i.fg||n.fga||"#07e")+";\n "+(t?"":"box-shadow: 0.0625em 0.0625em "+(i.fg||n.fga||"#07e")+",\n -0.0625em 0.0625em "+(i.fg||n.fga||"#07e")+",\n 0.0625em -0.0625em "+(i.fg||n.fga||"#07e")+",\n -0.0625em -0.0625em "+(i.fg||n.fga||"#07e")+";")+"\n }\n\n label.field input,\n label.field select,\n label.field textarea,\n .field-manual .field-body\n {\n display: block;\n border-width: "+(t?"0.0625em":"0 0 0.0625em 0")+";\n border-color: "+(n.bc||"#ccc")+";\n border-style: solid;\n box-sizing: border-box;\n background-color: "+(t?n.bg||"#fff":"transparent")+";\n transition: 0.2s ease-in-out;\n transition-property: box-shadow, color;\n outline: none;\n box-shadow: none;\n width: 100%;\n margin-bottom: 0.8em;\n font-size: 1.1em;"+(t?"\n border-radius: "+(n.radius||"0.2em")+";":"")+"\n font-weight: 400;\n font-family: inherit;\n }\n\n label.field input"+(t?"":":disabled")+",\n label.field select"+(t?"":":disabled")+" {\n padding: 0 0.75em;\n }\n label.field select"+(t?"":":disabled")+" {\n padding-right: 2em;\n }\n\n label.field input:disabled,\n label.field input[readonly],\n label.field select:disabled,\n label.field textarea:disabled,\n label.field textarea[readonly] {\n background: "+(l.bg||"#f4f4f4")+";\n color: "+(l.fg||"#444")+";\n }\n\n label.field textarea {\n line-height: 1.2em;\n }\n label.field .field-wrapper {\n display: block;\n }\n label.field > select, label.field > input,\n label.field > .field-wrapper > input, label.field > .field-wrapper > select {\n height: 2.5em;\n }\n\n "+(t?"":"label.field:hover > input,\n label.field:hover select,\n label.field.file:hover:after {\n box-shadow: 0 0.0625em 0 0 "+(n.bc||"#ccc")+";\n }\n\n label.field.textarea:hover {\n box-shadow: 0.0625em 0.0625em "+(n.bc||"#ccc")+",\n -0.0625em 0.0625em "+(n.bc||"#ccc")+",\n 0.0625em -0.0625em "+(n.bc||"#ccc")+",\n -0.0625em -0.0625em "+(n.bc||"#ccc")+";\n }\n\n label.field.textarea.focus:hover {\n box-shadow: 0.0625em 0.0625em "+(i.fg||n.fga||"#07e")+",\n -0.0625em 0.0625em "+(i.fg||n.fga||"#07e")+",\n 0.0625em -0.0625em "+(i.fg||n.fga||"#07e")+",\n -0.0625em -0.0625em "+(i.fg||n.fga||"#07e")+";\n }")+"\n\n /**** CHECK BOXES ****/\n\n label.field.check, label.field.radio {\n position:relative;\n z-index: 0;\n overflow: visible;\n cursor: pointer;\n padding-top: 2.2em;\n white-space: normal;\n }\n label.field.check.inline, label.field.radio.inline {\n padding-top: 0.7em;\n }\n\n label.field.check input, label.field.radio input {\n appearance: none;\n -moz-appearance: none;\n -webkit-appearance: none;\n z-index: -1;\n position: absolute;\n left: -0.5em;\n top: 1em;\n display: block;\n margin: 0;\n border-radius: 50%;\n width: 3.2em;\n height: 3.2em;\n background-color: "+(n.bc||"#ccc")+";\n box-shadow: none;\n outline: none;\n opacity: 0;\n transform: scale(1);\n pointer-events: none;\n transition: opacity 0.3s, transform 0.2s;\n }\n label.field.inline.check input, label.field.inline.radio input {\n top: -0.45em;\n left: -0.55em;\n }\n\n label.field.check input:checked, label.field.radio input:checked {\n background-color: "+(n.fga||"#07e")+";\n }\n\n label.field.check:hover > input, label.field.radio:hover > input {\n opacity: 0.04;\n }\n\n label.field.check input:focus, label.field.radio input:focus {\n opacity: 0.12;\n }\n\n label.field.check:hover > input:focus, label.field.radio:hover > input:focus {\n opacity: 0.16;\n }\n\n label.field.check input:active, label.field.radio input:active {\n opacity: 0.6;\n transform: scale(0);\n transition: transform 0s, opacity 0s;\n }\n\n label.field.check:before, label.field.radio:before {\n content: '';\n display: inline-block;\n box-sizing: border-box;\n margin: 0 0.5em 0.2em 0.1em;\n border: solid 0.125em; /* Safari */\n border-color: "+(n.fg||"#222")+';\n border-radius: 0.125em;\n width: 1.2em;\n height: 1.2em;\n vertical-align: bottom;\n transition: border-color 0.2s, background-color 0.2s;\n }\n\n label.field.check:after, label.field.radio:after {\n content: \'\';\n display: inline-block;\n opacity: 0;\n position: absolute;\n width: 1.2em;\n height: 1.2em;\n top: 2.3em;\n left: 0.6em;\n border-radius: 0.125em;\n }\n label.field.check.inline:after, label.field.radio.inline:after {\n top: 0.8em;\n }\n\n label.field.check.checked:after {\n opacity: 1;\n background: no-repeat center/80% url(\'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="'+(n.bg||"#fff").replace(/#/g,"%23")+'" d="m 15.378906,1.7050781 a 1.0583349,1.0583349 0 0 0 -1.478515,0.234375 L 6.6210937,11.960938 1.8652344,8.5058594 a 1.0583349,1.0583349 0 0 0 -1.47851565,0.234375 1.0583349,1.0583349 0 0 0 0.234375,1.4785156 L 6.234375,14.294922 A 1.0584408,1.0584408 0 0 0 7.7128906,14.060547 L 15.613281,3.1835938 A 1.0583349,1.0583349 0 0 0 15.378906,1.7050781 Z" /></svg>\') '+(n.fga||"#07e")+';\n }\n\n label.field.radio.checked:after {\n opacity: 1;\n background: no-repeat center/80% url(\'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><circle fill="'+(n.bg||"#fff").replace(/#/g,"%23")+'" cx="8" cy="8" r="5" /></svg>\') '+(n.fga||"#07e")+";\n }\n\n label.field.check.checked:before, label.field.radio.checked:before {\n border-color: "+(n.fga||"#07e")+";\n }\n label.field.check.focus:before, label.field.radio.focus:before {\n border-color: "+(n.fga||"#07e")+";\n }\n\n label.field.check input:disabled, label.field.radio input:disabled {\n opacity: 0;\n }\n\n label.field.check.disabled, label.field.radio.disabled {\n color: "+(l.fg||"#444")+";\n cursor: initial;\n }\n\n label.field.check.disabled:before, label.field.radio.disabled:before {\n border-color: "+(l.bc||"#ccc")+";\n background-color: "+(l.bg||"#f4f4f4")+";\n }\n\n label.field.check.checked.disabled:after, label.field.radio.checked.disabled:after {\n border-color: transparent;\n background-color: "+(l.bc||"#ccc")+";\n }\n\n label.field select {\n padding-right: 2em;\n }\n\n label.field.select {\n cursor: pointer;\n position: relative;\n }\n\n label.field.select:after {\n content: ' ';\n position: absolute;\n display: block;\n width: 0.6em;\n right: 1.125em;\n height: 0.6em;\n top: 2.6em;\n border-bottom: 0.125em solid;\n border-right: 0.125em solid;\n transform: rotate(45deg);\n pointer-events: none;\n color: "+(n.bc||"#ccc")+";\n }\n\n label.field textarea {\n border: none;"+(t?"\n padding: 0;":"")+"\n }\n\n label.field > select {\n -moz-appearance: none;\n -webkit-appearance: none;\n }\n\n label.field input:focus,\n label.field select:focus,\n label.field.file.focus:after\n {\n border-color: "+(i.fg||n.fga||"#07e")+";\n "+(t?"":"box-shadow: 0 0.0625em 0 0 "+(i.fg||n.fga||"#07e")+";")+"\n }\n\n label.field input[type=checkbox]:focus,\n label.field input[type=radio]:focus {\n box-shadow: none;\n }\n\n label.field.file.focus:after {\n color: "+(i.fg||n.fga||"#07e")+";\n }\n label.field.file [type=file] {\n position: absolute;\n width: 0;\n height: 0;\n opacity: 0;\n z-index: -1;\n }\n label.field.file {\n position: relative;\n min-width: 9em;\n height: 5em;\n }\n label.field.file:after {\n position: absolute;\n content: 'Choose a file';\n box-sizing: border-box;\n width: calc(100% - 0.3em);\n height: 2.5em;\n font-size: 1.1em;\n line-height: 1.5em;\n color: "+(n.fg||"#222")+";\n text-align: "+(t?"center":"left")+";\n padding: 0.5em "+(t?"0.5em":"0")+";\n cursor: pointer;\n font-style: oblique;\n left: 0.25em;\n top: 1.6em;\n transition: 0.2s ease-in-out;\n transition-property: color, border-bolor, box-shadow;"+(t?"\n border-radius: "+(n.radius||"0.2em")+";\n border-color: "+(n.bc||"#ccc")+";\n border-style: solid;\n border-width: 0.0625em;":"\n border-bottom-color: "+(n.bc||"#ccc")+";\n border-bottom-width: 0.0625em;\n border-bottom-style: solid;\n ")+"\n }\n label.field.file.inline:after {\n top: 0.2em;\n }\n\n label.field.button {\n vertical-align: top;\n padding-top: "+(t?"1.7":"1.958")+"em;\n }\n label.field .with-buttons button, label.field.button button {\n font-size: 1.1em;\n margin-top: "+(t?"0.15em":"0")+";\n }\n\n label.field .field-wrapper.with-buttons {\n display: flex;\n }\n label.field .with-buttons button {\n flex-shrink: 0;\n padding-left: 0.5em;\n padding-right: 0.5em;\n margin-top: 0;\n margin-right: 0;\n "+(t?"height: 2.5em;\n box-shadow: none;\n border-radius: 0;\n border-left: 1px solid "+(n.bg||"#fff")+";\n margin-left: 0;":"height: 2.25em;")+"\n }"+(t?"\n label.field .with-buttons button:first-of-type {\n margin-left: -0.05em;\n border-left: none;\n }\n label.field .with-buttons button:last-of-type {\n border-radius: 0 "+(n.radius||"0.2em")+" "+(n.radius||"0.2em")+" 0;\n }\n label.field .with-buttons input {\n border-radius: "+(n.radius||"0.2em")+" 0 0 "+(n.radius||"0.2em")+";\n min-width: 0;\n }\n ":"")+"\n\n label.field.plain > div {\n position: absolute;\n font-size: 1.1em;\n top: 2.4em;\n font-weight: normal;\n }\n\n /* inline fields (no labels) */\n label.field.inline {\n min-height: 3.3em;\n }\n\n label.field.button.inline {\n margin-top: 0.2em;\n padding-top: 0.12em;\n }\n\n label.field.button.inline button {\n margin-top: 0;\n }\n\n label.field.inline.select:after {\n top: 1."+(t?"15":"1")+"em;\n }\n\n label.field .field-tip {\n display: inline-block;\n width: 1em;\n height: 1em;\n background-color: "+(n.fga||"#07e")+";\n color: "+(n.bg||"#fff;")+";\n cursor: default;\n user-select: none;\n border-radius: 1em;\n margin-left: 0.5em;\n line-height: 1.2em;\n text-align: center;\n margin-top: -0.2em;\n }\n\n label.field .field-solo-tip {\n margin-left: -0.1em;\n }\n "}function a(){}function r(e){~this.className.indexOf("focus")||(this.className+=" focus")}function o(e){this.className=this.className.replace(/\bfocus\b/g,"").trim()}function c(e){var n,i,l,t,c,d,f,s,b,u,p,m,h,g=this.getContext(e);function y(){var a=v().split(/\s+/).filter(function(e){return!!e});(n=!!~a.indexOf("field"))||(a.push("field"),n=!0),(i=e.querySelector("input[type=checkbox]"))&&!~a.indexOf("check")&&a.push("check"),(l=e.querySelector("input[type=radio]"))&&!~a.indexOf("radio")&&a.push("radio");var r=i||l;r&&r.checked&&!~a.indexOf("checked")&&a.push("checked"),r&&r.disabled&&!~a.indexOf("disabled")&&a.push("disabled"),!r&&u?(u.cancel(),u=0,p&&(p.disconnect(),p=0),delete r._form_callback,h&&(delete h.checked,m=h=void 0)):r&&(r._form_callback=function(n,i){if(void 0===i&&(i=!0),i&&"radio"===r.type&&r.name){var l=[];l.push.apply(l,document.querySelectorAll("input[type=radio][name="+r.name+"]")),(l=l.filter(function(e){return e!==r})).forEach(function(e){return e._form_callback&&e._form_callback(n,!1)})}var t=r.checked;t&&!~e.className.indexOf("checked")?e.className+=" checked":!t&&~e.className.indexOf("checked")&&(e.className=e.className.replace(/\bchecked\b/g,"").replace(/ +/g," ").trim())},MutationObserver&&(p=new MutationObserver(function(){var n;(n=r.disabled)&&!~e.className.indexOf("disabled")?e.className+=" disabled":!n&&~e.className.indexOf("disabled")&&(e.className=e.className.replace(/\bdisabled\b/g,"").replace(/ +/g," ").trim())})).observe(r,{attributes:!0}),u=this.getContext(r).listen("change",r._form_callback),(m=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(r),"checked"))&&m.configurable&&(h=r,Object.defineProperty(r,"checked",{get:m.get,set:function(e){m.set.call(h,e),r._form_callback()},enumerable:!0,configurable:!0}))),(t=!!e.querySelector("textarea"))&&!~a.indexOf("textarea")&&a.push("textarea"),(c=!!e.querySelector("select"))&&!~a.indexOf("select")&&a.push("select"),(d=!!e.querySelector("input[type=file]"))&&!~a.indexOf("file")&&a.push("file"),(f=!!(f=e.querySelector("button"))&&f.parentNode===e)&&!~a.indexOf("button")&&a.push("button"),(s=!!e.querySelector("div"))&&!~a.indexOf("plain")&&a.push("plain"),(b=!(i||l||d||!e.querySelector("input")))&&!~a.indexOf("input")&&a.push("input"),e.className=a.join(" ")}function v(){var a=e.className;return n||(a=a.replace(/\bfield\b/g,"").trim()),i||(a=a.replace(/\bcheck(ed)?\b/g,"").trim()),l||(a=a.replace(/\bradio\b/g,"").trim()),t||(a=a.replace(/\btextarea\b/g,"").trim()),c||(a=a.replace(/\bselect\b/g,"").trim()),d||(a=a.replace(/\bfile\b/g,"").trim()),f||(a=a.replace(/\bbutton\b/g,"").trim()),s||(a=a.replace(/\bplain\b/g,"").trim()),b||(a=a.replace(/\binput\b/g,"").trim()),a=a.replace(/ +/g," ")}var x=g.listen("focusin",r),k=g.listen("focusout",o);y.call(this);var w={update:a,invalidate:y.bind(this),teardown:function(){g.ractive.fire("fieldUnregistered",g,e,w);var n=v();n=n.replace(/\bfocus\b/g,"").trim(),x.cancel(),k.cancel(),u&&u.cancel(),p&&p.disconnect(),h&&(delete h.checked,m=h=void 0),e.className=n},setDisabled:function(n){e.querySelectorAll("input,button,select,textarea").forEach(function(e){return e.disabled=n}),this.invalidate()}};return g.ractive.fire("fieldRegistered",g,e,w),w}function d(e,n){if(!e)return!1;for(var i=0;i<e.length;i++){if(e[i].e===n)return!0;if(e[i].f&&d(e[i].f,n))return!0}return!1}c.style=t;var f=n.macro(function(e){var n=[],i=[],l=(e.template.m||[]).slice(),t=e.template.f||[],a=l.find(function(e){return"value"===e.n}),r=l.find(function(e){return"type"===e.n}),o=l.find(function(e){return"tip"===e.n}),c=l.find(function(e){return"disabled"===e.n});if(o&&l.splice(l.indexOf(o),1),r&&"function"==typeof f.types[r.f])n.push.apply(n,f.types[r.f](l,t,e));else if(a){var s={t:7,e:"input",m:[a]};if(c&&s.m.push(c),d(t,"option")&&(s.e="select",s.f=t),r&&(s.m.push(r),"checkbox"===r.f||"radio"===r.f)){var b=l.find(function(e){return"target"===e.n});b?s.m.push(Object.assign({},b,{n:"name"})):s.m.splice(s.m.indexOf(a),1,Object.assign({},a,{n:"checked"}))}s.m=s.m.concat(l.filter(function(e){return 73===e.t||73===e.t||"placeholder"===e.n})),n.push(s);var u=t.filter(function(e){return"button"===e.e||d(e.f,"button")});u.length&&(n.push.apply(n,u),n=[{t:7,e:"span",m:[{t:13,n:"class",f:"field-wrapper with-buttons",g:1}],f:n}])}else{t.forEach(function(e){"label"===e.e?e.f&&e.f.length&&i.push.apply(i,e.f):n.push(e)});var p=t.filter(function(e){return e.e});p.find(function(e){return"button"===e.e})&&p.length>1&&(n=[{t:7,e:"span",m:[{t:13,n:"class",f:"field-wrapper with-buttons",g:1}],f:n}])}var m=l.find(function(e){return"label"===e.n});m&&m.f&&m.f.length&&i.push.apply(i,Array.isArray(m.f)?m.f:[m.f]),o&&n.unshift({t:7,e:"span",m:[{t:13,n:"class",f:"field-tip"+(i.length?"":" field-solo-tip"),g:1},{t:13,n:"title",f:o.f},{t:70,n:["click"],f:{r:[],s:"[false]"}}],f:"?"});var h=l.find(function(e){return"inline"===e.n});i&&!h?n.unshift.apply(n,i):h||n.unshift(" ");var g={t:7,e:"label",m:[{t:71,n:"field"}].concat(l.filter(function(e){return 13!==e.t&&73!==e.t||"value"!==e.n&&"type"!==e.n&&"inline"!==e.n&&"label"!==e.n&&"placeholder"!==e.n&&"target"!==e.n&&"disabled"!==e.n})),f:n};h&&g.m.push({t:13,n:"class",f:"inline"}),e.setTemplate([g])});function s(e){return"function"==typeof e.focus&&e.focus(),{teardown:a}}function b(e){return void 0===e&&(e={}),function(n){var i=n.Ractive,l=n.instance;if(!i.isInstance(l)&&e.includeStyle)if(l===i)i.addCSS("form-decorator",t);else{var a=l.css;l.css=function(e){return("function"!=typeof a?a||"":a(e))+t(e)}}l.partials[e.name||"field"]=f,l.decorators[e.name||"field"]=c,l.decorators[e.autofocusName||"autofocus"]=s}}f.types={},l("field","decorators",c),l("field","partials",f),l("autofocus","decorators",s),e.style=t,e.field=c,e.macro=f,e.autofocus=s,e.plugin=b,e.default=b,Object.defineProperty(e,"__esModule",{value:!0})});

@@ -324,2 +324,12 @@ (function (global, factory) {

Popover.prototype.popFind = function popFind (pattern) {
if (mobilePopped) { return mobilePop.find(pattern); }
else { return this.find(pattenr); }
};
Popover.prototype.popFindAll = function popFindAll (pattern) {
if (mobilePopped) { return mobilePop.findAll(pattern); }
else { return this.findAll(pattenr); }
};
return Popover;

@@ -326,0 +336,0 @@ }(Ractive$1));

@@ -1,1 +0,1 @@

!function(t,o){"object"==typeof exports&&"undefined"!=typeof module?o(exports,require("ractive")):"function"==typeof define&&define.amd?define(["exports","ractive"],o):o(t.RauiPopover={},t.Ractive)}(this,function(t,o){"use strict";o=o&&o.hasOwnProperty("default")?o.default:o;var e="undefined"!=typeof window?window:null;function n(t,o,n){if(e&&e.Ractive&&"object"==typeof e.Ractive[o]){var i=document.currentScript;if(i||(i=(i=document.querySelectorAll("script"))[i.length-1]),i){var r=i.getAttribute("data-alias");r&&(r=(r=r.split("&")).reduce(function(t,o){var e=o.split("="),n=e[0],i=e[1];return t[n]=i,t},{})),Ractive[o][r&&r[t]||t]=n}}}function i(t,o){void 0===o&&(o={});var e=t.processParams(o,{duration:400,easing:"easeInOut"});o.dir=o.dir||!1;var n=o.distance||"20px",i=o.scale||"0.9",r="above"===o.dir?"translateY("+n+")":"left"===o.dir?"translateX("+n+")":"right"===o.dir?"translateX(-"+n+")":"translateY(-"+n+")";return t.isIntro||e.intro?(t.setStyle("opacity",0),t.setStyle("transform","scale("+i+") "+r),t.animateStyle({opacity:1,transform:"none"},e)):(t.setStyle("opacity",1),t.setStyle("transform","none"),t.animateStyle({opacity:0,transform:"scale("+i+") "+r},e))}function r(t){return void 0===t&&(t={}),function(o){o.instance.transitions[t.name||"pop"]=i}}function p(t,o){var e=!1,n=!1;function i(e){for(var n=e.target;n;){if(n===t)return;if(!n.parentNode&&n!==document)return;n=n.parentNode}o(e)}return setTimeout(function(){e=!0,n||(document.body.addEventListener("click",i,{capture:!0}),document.body.addEventListener("touchstop",i,{capture:!0}))}),{teardown:function(){n=!0,e&&(document.body.removeEventListener("click",i,{capture:!0}),document.body.removeEventListener("touchstop",i,{capture:!0}))}}}function l(t,o){var e=t.processParams(o,{duration:200,easing:"easeInOut"});return t.isIntro||e.intro?(t.setStyle("opacity",0),t.animateStyle("opacity",1,e)):(t.setStyle("opacity",1),t.animateStyle("opacity",0,e))}function a(t){return void 0===t&&(t={}),function(o){o.instance.transitions[t.name||"fade"]=l}}n("pop","transitions",i),n("fade","transitions",l);var s,f,c,u,d={v:4,t:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rpop-wrapper",g:1},{n:"class-rpop-with-tail",t:13,f:[{t:2,r:"position.tail"}]},{n:"class",f:["rpop-",{t:2,x:{r:["where"],s:'_0||"below"'}}," rpop-align-",{t:2,x:{r:["align"],s:'_0||"middle"'}}],t:13},{t:4,f:[{n:"style-top",f:[{t:2,r:"position.popTop"},"px"],t:13},{n:"style-left",f:[{t:2,r:"position.popLeft"},"px"],t:13}],n:50,r:"position"},{t:4,f:[{t:4,f:[{n:"style-top",f:[{t:2,r:"top"}],t:13}],n:50,r:"top"},{t:4,f:[{n:"style-left",f:[{t:2,r:"left"}],t:13}],n:50,r:"left"}],n:51,l:1},{n:"pop",t:72,f:{r:["where"],s:'[{dir:_0||"below"}]'},v:"t2"},{n:"cleanup",t:71},{t:4,f:[{n:["click"],t:70,f:{r:["@this"],s:'[_0.set("popped",false)]'}}],n:50,r:"clickClose"},{t:4,f:[{n:["clickout"],t:70,f:{r:["@this"],s:'[_0.set("popped",false)]'}}],n:51,r:"noClickout"},{t:16,r:"extra-attributes"}],f:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rpop-tail",g:1},{t:4,f:[{n:"style-top",f:[{t:2,x:{r:["position.tailTop","position.vert"],s:"_0+(_1?3:0)"}},"px"],t:13}],n:50,x:{r:["position.tailTop"],s:"_0!=null"}},{t:4,f:[{n:"style-bottom",f:[{t:2,x:{r:["position.tailBottom","position.vert"],s:"_0+(_1?3:0)"}},"px"],t:13}],n:50,x:{r:["position.tailBottom"],s:"_0!=null"}},{t:4,f:[{n:"style-left",f:[{t:2,x:{r:["position.tailLeft","position.vert"],s:"_0+(_1?0:3)"}},"px"],t:13}],n:50,x:{r:["position.tailLeft"],s:"_0!=null"}},{t:4,f:[{n:"style-right",f:[{t:2,x:{r:["position.tailRight","position.vert"],s:"_0+(_1?0:3)"}},"px"],t:13}],n:50,x:{r:["position.tailRight"],s:"_0!=null"}}]}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rpop-tail-outer",g:1},{t:4,f:[{n:"style-top",f:[{t:2,x:{r:["position.tailTop"],s:"_0-2"}},"px"],t:13}],n:50,x:{r:["position.tailTop"],s:"_0!=null"}},{t:4,f:[{n:"style-bottom",f:[{t:2,x:{r:["position.tailBottom"],s:"_0-2"}},"px"],t:13}],n:50,x:{r:["position.tailBottom"],s:"_0!=null"}},{t:4,f:[{n:"style-left",f:[{t:2,x:{r:["position.tailLeft"],s:"_0-2"}},"px"],t:13}],n:50,x:{r:["position.tailLeft"],s:"_0!=null"}},{t:4,f:[{n:"style-right",f:[{t:2,x:{r:["position.tailRight"],s:"_0-2"}},"px"],t:13}],n:50,x:{r:["position.tailRight"],s:"_0!=null"}}]}],n:50,r:"~/tail"}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rpop",g:1}],f:[{t:16,r:"content",z:[{n:"trigger",x:{r:"triggerContext"}}]}]}]}],n:50,r:"__popped"}],e:{'_0||"below"':function(t){return t||"below"},'_0||"middle"':function(t){return t||"middle"},'[{dir:_0||"below"}]':function(t){return[{dir:t||"below"}]},'[_0.set("popped",false)]':function(t){return[t.set("popped",!1)]},"_0+(_1?3:0)":function(t,o){return t+(o?3:0)},"_0!=null":function(t){return null!=t},"_0+(_1?0:3)":function(t,o){return t+(o?0:3)},"_0-2":function(t){return t-2},"[{delay:200}]":function(){return[{delay:200}]},"[_0===_1&&_2.done(),true]":function(t,o,e){return[t===o&&e.done(),!0]},"[_0.done()]":function(t){return[t.done()]},true:function(){return!0}},p:{modal:[{t:4,f:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rpop-modal",g:1},{n:"fade",t:72,v:"t1"},{n:"fade",t:72,f:{r:[],s:"[{delay:200}]"},v:"t2"},{t:4,f:[{n:["click"],t:70,f:{r:["@node","@event.target","."],s:"[_0===_1&&_2.done(),true]"}}],n:51,r:".noClickout"}],f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rpop",g:1},{n:"pop",t:72,f:{r:[],s:"[{delay:200}]"},v:"t1"},{n:"pop",t:72,v:"t2"},{t:4,f:[{n:["click"],t:70,f:{r:["."],s:"[_0.done()]"}}],n:50,r:".clickClose"},{t:8,r:".attrs",c:{r:".context"},z:[{n:"inModal",x:{x:{r:[],s:"true"}}}]}],f:[{t:8,r:".content",c:{r:".context"},z:[{n:"inModal",x:{x:{r:[],s:"true"}}}]}]}]}],n:54,r:"contents.0"}],n:50,r:"contents.length"}]}};function h(){}var g,v=function(t){function o(o){t.call(this,o)}return t&&(o.__proto__=t),o.prototype=Object.create(t&&t.prototype),o.prototype.constructor=o,o.prototype.position=function(o){var e=o||this.source,n=this.get("popped");if(e&&n){var i=this.find("div");if(e&&i&&i.offsetParent){e?this.set("triggerContext",t.getContext(e)):this.set("triggerContext",null);var r=i.offsetParent,p=r.getBoundingClientRect(),l=i.getBoundingClientRect(),a=e.getBoundingClientRect(),s=this.get("where")||"below",f=this.get("align")||"middle",c=this.get("tail"),u="above"===s||"below"===s,d=this.get("fit"),h=this.get("gap"),g="above"===s||"below"===s?0:"left"===s?-l.width-h:a.width+h,v="left"===s||"right"===s?-a.height:"above"===s?-a.height-l.height-h:h;"middle"===f?"below"===s||"above"===s?g-=(l.width-a.width)/2:"left"!==s&&"right"!==s||(v-=(l.height-a.height)/2):"end"===f&&("below"===s||"above"===s?g+=a.width-l.width:"left"!==s&&"right"!==s||(v+=a.height-l.height));var b={popTop:a.bottom-p.top+v,popLeft:a.left-p.left+g,tail:c,vert:"above"===s||"below"===s};if(r.scrollTop&&(b.popTop+=r.scrollTop),r.scrollLeft&&(b.popLeft+=r.scrollLeft),c){"above"===s?b.tailBottom=-10:"below"===s?b.tailTop=-10:"left"===s?b.tailRight=-10:"right"===s&&(b.tailLeft=-10);var m=this.tailSource?this.tailSource.getBoundingClientRect():a;"start"===f?u?b.tailLeft=Math.floor(m.width/2)-10:b.tailTop=Math.floor(m.height/2)-10:"end"===f?u?b.tailRight=Math.floor(m.width/2)-10:b.tailBottom=Math.floor(m.height/2)-10:"middle"===f&&(u?b.tailLeft=Math.floor(m.width/2)-10:b.tailTop=Math.floor(m.height/2)-10),m!==a?u?(null!=b.tailLeft&&(b.tailLeft+=m.left-a.left),null!=b.tailRight&&(b.tailRight+=a.right-m.right)):(null!=b.tailTop&&(b.tailTop+=m.top-a.top),null!=b.tailBottom&&(b.tailBottom+=a.bottom-m.bottom)):"middle"===f&&(u?(null!=b.tailLeft&&(b.tailLeft+=m.left-(b.popLeft+p.left)),null!=b.tailRight&&(b.tailRight+=b.popLeft+p.left+l.width-m.right)):(null!=b.tailTop&&(b.tailTop+=m.top-(b.popTop+p.top)),null!=b.tailBottom&&(b.tailBottom+=b.popTop+p.top+l.height-m.bottom)))}if(d){var y=r;if(this.get("offsets"))for(var w=this.get("offsets");w--;)y=y.offsetParent;var _=r.scrollWidth,x=r.scrollHeight;if(b.popLeft+l.width>_){var L=b.popLeft-(_-l.width);b.popLeft-=L,u&&b.tailLeft&&(b.tailLeft+=L),u&&b.tailRight&&(b.tailRight-=L),c&&!u&&(b.tail=!1)}if(b.popLeft<0){var T=-1*b.popLeft;b.popLeft+=T,u&&b.tailLeft&&(b.tailLeft-=T),u&&b.tailRight&&(b.tailRight+=T),c&&!u&&(b.tail=!1)}if(b.popTop+l.height>x){var k=b.popTop-(x-l.height);b.popTop-=k,!u&&b.tailTop&&(b.tailTop+=k),!u&&b.tailBottom&&(b.tailBottom-=k),c&&u&&(b.tail=!1)}if(b.popTop<0){var R=-1*b.popTop;b.popTop+=R,!u&&b.tailTop&&(b.tailTop-=R),!u&&b.tailBottom&&(b.tailBottom+=R),c&&u&&(b.tail=!1)}}if(p.left+b.popLeft<0){var B=0-(p.left+b.popLeft);b.popLeft+=B,u&&b.tailLeft&&(b.tailLeft-=B),u&&b.tailRight&&(b.tailRight+=B),c&&!u&&(b.tail=!1)}if(p.top+b.popTop<0){var C=0-(p.top+b.popTop);b.popTop+=C,!u&&b.tailTop&&(b.tailTop-=C),!u&&b.tailBottom&&(b.tailBottom+=C),c&&u&&(b.tail=!1)}b.tailLeft&&(b.tailLeft=Math.floor(b.tailLeft)),b.tailRight&&(b.tailRight=Math.floor(b.tailRight)),b.tailTop&&(b.tailTop=Math.floor(b.tailTop)),b.tailBottom&&(b.tailBottom=Math.floor(b.tailBottom)),this.set("position",b)}else this.set("position",null)}},o.prototype.show=function(t){return this.source=t,this.set("popped",!0),this._transdone},o.prototype.hide=function(){return this.set("popped",!1),this._transdone},o}(o);function b(t){return void 0===t&&(t={}),function(o){o.instance.decorators[t.name||"pop"]=function(o,e,n){if(void 0===n&&(n={}),!e)return{teardown:h};"string"==typeof e?n.path=e:"object"==typeof e&&(n=e);var i,r,p=this.getContext(o);function l(t){if("mouseover"!==t.type||!p.get(e)){if("click"!==t.type||!r||i){var l=s,a=f;"function"==typeof(s=n.node||o)&&(s=s()),s=s||o,"function"==typeof(f=n.tail)&&(f=f()),p.toggle(n.path),s=l,f=a}r&&"click"===t.type&&(i=p.observeOnce(n.path,function(){i=null}))}}function a(t){i||p.set(n.path,!1)}return("click"in n?n.click:!1!==t.click)&&p.listen("click",l),("hover"in n?n.hover:t.hover)&&(r=1,p.listen("mouseover",l),p.listen("mouseout",a)),{teardown:function(){p.unlisten("click",l),r&&(p.unlisten("mouseover",l),p.unlisten("mouseout",a),i&&i.cancel())}}}}}o.extendWith(v,{attributes:["popped","tail","where","align","top","left","fit","clickClose","noClickout","gap","offsets"],use:[r(),(void 0===g&&(g={}),function(t){t.instance.events[g.name||"clickout"]=p}),a()],template:d,css:function(t){return[function(t){var o=Object.assign({},t("raui.primary"),t("raui.pop.primary")),e=(t("raui.themes")||[]).slice();return(t("raui.pop.themes")||[]).forEach(function(t){~e.indexOf(t)||e.push(t)}),"\n .rpop-wrapper {\n position: absolute;\n display: inline-block;\n z-index: 21;\n transition-property: top, left, padding;\n transition-timing-function: ease-in-out;\n transition-duration: 0.3s;\n }\n .rpop-with-tail.rpop-above {\n padding-bottom: 10px;\n }\n .rpop-with-tail.rpop-below {\n padding-top: 10px;\n }\n .rpop-with-tail.rpop-left {\n padding-right: 10px;\n }\n .rpop-with-tail.rpop-right {\n padding-left: 10px;\n }\n \n .rpop {\n position: relative;\n box-shadow: 0 1px 4px 0 rgba(0,0,0,0.24);\n border: 1px solid #ccc;\n border-radius: 0.2em;\n background-color: "+(o.bg||"#fff")+";\n color: "+(o.fg||"#222")+";\n padding: 0.5em;\n z-index: 2;\n }\n \n .rpop-modal {\n position: fixed;\n display: flex;\n z-index: 20;\n background-color: rgba(0, 0, 0, 0.2);\n align-items: center;\n justify-content: center;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n padding: 1em;\n overflow: auto;\n }\n \n .rpop-tail, .rpop-tail-outer {\n z-index: 3;\n width: 0;\n height: 0;\n position: absolute;\n border-style: solid;\n border-width: 10px;\n border-color: transparent;\n transition-property: top, left, bottom, right, border-color;\n transition-timing-function: ease-in-out;\n transition-duration: 0.3s;\n }\n .rpop-tail-outer {\n z-index: 1;\n border-width: 12px;\n border-color: transparent;\n }\n \n .rpop-below .rpop-tail {\n border-bottom-color: "+(o.bg||"#fff")+";\n }\n .rpop-below .rpop-tail-outer {\n border-bottom-color: "+(o.bc||"#ccc")+";\n }\n \n .rpop-above .rpop-tail {\n border-top-color: "+(o.bg||"#fff")+";\n }\n .rpop-above .rpop-tail-outer {\n border-top-color: "+(o.bc||"#ccc")+";\n }\n \n .rpop-left .rpop-tail {\n border-left-color: "+(o.bg||"#fff")+";\n }\n .rpop-left .rpop-tail-outer {\n border-left-color: "+(o.bc||"#ccc")+";\n }\n \n .rpop-right .rpop-tail {\n border-right-color: "+(o.bg||"#fff")+";\n }\n .rpop-right .rpop-tail-outer {\n border-right-color: "+(o.bc||"#ccc")+";\n }\n "+e.map(function(o){var e=Object.assign({},t("raui.primary"),t("raui.pop.primary"),t("raui."+o),t("raui.pop."+o));return"\n ."+o+" .rpop {\n background-color: "+(e.bg||"#fff")+";\n color: "+(e.fg||"#222")+";\n }\n \n ."+o+".rpop-below .rpop-tail {\n border-bottom-color: "+(e.bg||"#fff")+";\n }\n ."+o+".rpop-below .rpop-tail-outer {\n border-bottom-color: "+(e.bc||"#ccc")+";\n }\n \n ."+o+".rpop-above .rpop-tail {\n border-top-color: "+(e.bg||"#fff")+";\n }\n ."+o+".rpop-above .rpop-tail-outer {\n border-top-color: "+(e.bc||"#ccc")+";\n }\n \n ."+o+".rpop-left .rpop-tail {\n border-left-color: "+(e.bg||"#fff")+";\n }\n ."+o+".rpop-left .rpop-tail-outer {\n border-left-color: "+(e.bc||"#ccc")+";\n }\n \n ."+o+".rpop-right .rpop-tail {\n border-right-color: "+(e.bg||"#fff")+";\n }\n ."+o+".rpop-right .rpop-tail-outer {\n border-right-color: "+(e.bc||"#ccc")+";\n }\n "})}.call(this,t)].join(" ")},cssId:"rpop",noCssTransform:!0,observe:{popped:function(t){var o,e=this;t&&(s&&(this.source=s),f&&(this.tailSource=f));var n=this._transdone=new Promise(function(t){return o=t});n.resolve=o,setTimeout(function(){e._transdone=n,e.get("popped")===t&&e.set("_popped",t)},1)},_popped:{handler:function(t){var o=this,e=this._transdone.resolve;if(t){var n=this.get("@style.raui.pop.mobile");if(n&&window.matchMedia("(max-width: "+n+")").matches){u||(u=new m({target:document.body,append:!0}));var i=this.getContext().getParent(!0);i.isContext=1,this.set("__popped",!1).then(e),u.unshift("contents",{content:this.partials.content,context:i,attrs:this.partials["extra-attributes"]||[],clickClose:this.get("clickClose"),noClickout:this.get("noClickout"),done:function(){o.set("popped",!1)}})}else this.set("__popped",!0)}else c?(u.shift("contents"),e()):this.set("__popped",!1).then(e)},defer:!0,init:!1},__popped:{handler:function(t){var o=this._transdone.resolve;if(t){var e=this.find("div"),n=e,i=n.offsetHeight+n.offsetTop,r=n.offsetWidth+n.offsetLeft,p=n.offsetParent;if(!this.overflows)for(var l=this.overflows={e:[],v:[]};e&&e.style;){if(e===p){if(e.offsetWidth>=r&&e.offsetHeight>=i)break;r+=e.offsetLeft,i+=e.offsetTop,p=e.offsetParent}var a=getComputedStyle(e);if("auto"===a.overflow)break;"hidden"===a.overflow&&(l.e.push(e),l.v.push(e.style.overflow),e.style.overflow="visible"),e=e.parentNode}this.position(),this.transition("pop",n,{intro:!0,dir:this.get("where")||"below"}).then(o)}else this.source=null,this.tailSource=null},defer:!0,init:!1},"align where tail fit":{handler:function(){this.position()},defer:!0}},decorators:{cleanup:function(t){var o=this;return{teardown:function(){var t=o.overflows;if(t){o.overflows=null;for(var e=0;e<t.e.length;e++)t.e[e].style.overflow=t.v[e]}}}}},data:function(){return{gap:4}}});var m=function(t){function o(o){t.call(this,o)}return t&&(o.__proto__=t),o.prototype=Object.create(t&&t.prototype),o.prototype.constructor=o,o}(o);o.extendWith(m,{template:{v:d.v,t:d.p.modal},data:function(){return{contents:[]}},use:[r(),a()],observe:{contents:function(t){c=(t||[]).length>0}},on:{init:function(){u?console.warn("More than one PopOver mobile host created."):u=this}}}),t.Popover=v,t.trigger=b,t.default=function(t){return void 0===t&&(t={}),function(o){var e=o.instance;e.components[t.name||"pop"]=v,e.components[t.mobileName||"mobile-pop"]=m;var n=Object.assign({},t);n.name=n.trigger||n.name,b(n)({instance:e})}},Object.defineProperty(t,"__esModule",{value:!0})});
!function(t,o){"object"==typeof exports&&"undefined"!=typeof module?o(exports,require("ractive")):"function"==typeof define&&define.amd?define(["exports","ractive"],o):o(t.RauiPopover={},t.Ractive)}(this,function(t,o){"use strict";o=o&&o.hasOwnProperty("default")?o.default:o;var e="undefined"!=typeof window?window:null;function n(t,o,n){if(e&&e.Ractive&&"object"==typeof e.Ractive[o]){var i=document.currentScript;if(i||(i=(i=document.querySelectorAll("script"))[i.length-1]),i){var r=i.getAttribute("data-alias");r&&(r=(r=r.split("&")).reduce(function(t,o){var e=o.split("="),n=e[0],i=e[1];return t[n]=i,t},{})),Ractive[o][r&&r[t]||t]=n}}}function i(t,o){void 0===o&&(o={});var e=t.processParams(o,{duration:400,easing:"easeInOut"});o.dir=o.dir||!1;var n=o.distance||"20px",i=o.scale||"0.9",r="above"===o.dir?"translateY("+n+")":"left"===o.dir?"translateX("+n+")":"right"===o.dir?"translateX(-"+n+")":"translateY(-"+n+")";return t.isIntro||e.intro?(t.setStyle("opacity",0),t.setStyle("transform","scale("+i+") "+r),t.animateStyle({opacity:1,transform:"none"},e)):(t.setStyle("opacity",1),t.setStyle("transform","none"),t.animateStyle({opacity:0,transform:"scale("+i+") "+r},e))}function r(t){return void 0===t&&(t={}),function(o){o.instance.transitions[t.name||"pop"]=i}}function p(t,o){var e=!1,n=!1;function i(e){for(var n=e.target;n;){if(n===t)return;if(!n.parentNode&&n!==document)return;n=n.parentNode}o(e)}return setTimeout(function(){e=!0,n||(document.body.addEventListener("click",i,{capture:!0}),document.body.addEventListener("touchstop",i,{capture:!0}))}),{teardown:function(){n=!0,e&&(document.body.removeEventListener("click",i,{capture:!0}),document.body.removeEventListener("touchstop",i,{capture:!0}))}}}function l(t,o){var e=t.processParams(o,{duration:200,easing:"easeInOut"});return t.isIntro||e.intro?(t.setStyle("opacity",0),t.animateStyle("opacity",1,e)):(t.setStyle("opacity",1),t.animateStyle("opacity",0,e))}function a(t){return void 0===t&&(t={}),function(o){o.instance.transitions[t.name||"fade"]=l}}n("pop","transitions",i),n("fade","transitions",l);var s,f,c,u,d={v:4,t:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rpop-wrapper",g:1},{n:"class-rpop-with-tail",t:13,f:[{t:2,r:"position.tail"}]},{n:"class",f:["rpop-",{t:2,x:{r:["where"],s:'_0||"below"'}}," rpop-align-",{t:2,x:{r:["align"],s:'_0||"middle"'}}],t:13},{t:4,f:[{n:"style-top",f:[{t:2,r:"position.popTop"},"px"],t:13},{n:"style-left",f:[{t:2,r:"position.popLeft"},"px"],t:13}],n:50,r:"position"},{t:4,f:[{t:4,f:[{n:"style-top",f:[{t:2,r:"top"}],t:13}],n:50,r:"top"},{t:4,f:[{n:"style-left",f:[{t:2,r:"left"}],t:13}],n:50,r:"left"}],n:51,l:1},{n:"pop",t:72,f:{r:["where"],s:'[{dir:_0||"below"}]'},v:"t2"},{n:"cleanup",t:71},{t:4,f:[{n:["click"],t:70,f:{r:["@this"],s:'[_0.set("popped",false)]'}}],n:50,r:"clickClose"},{t:4,f:[{n:["clickout"],t:70,f:{r:["@this"],s:'[_0.set("popped",false)]'}}],n:51,r:"noClickout"},{t:16,r:"extra-attributes"}],f:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rpop-tail",g:1},{t:4,f:[{n:"style-top",f:[{t:2,x:{r:["position.tailTop","position.vert"],s:"_0+(_1?3:0)"}},"px"],t:13}],n:50,x:{r:["position.tailTop"],s:"_0!=null"}},{t:4,f:[{n:"style-bottom",f:[{t:2,x:{r:["position.tailBottom","position.vert"],s:"_0+(_1?3:0)"}},"px"],t:13}],n:50,x:{r:["position.tailBottom"],s:"_0!=null"}},{t:4,f:[{n:"style-left",f:[{t:2,x:{r:["position.tailLeft","position.vert"],s:"_0+(_1?0:3)"}},"px"],t:13}],n:50,x:{r:["position.tailLeft"],s:"_0!=null"}},{t:4,f:[{n:"style-right",f:[{t:2,x:{r:["position.tailRight","position.vert"],s:"_0+(_1?0:3)"}},"px"],t:13}],n:50,x:{r:["position.tailRight"],s:"_0!=null"}}]}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rpop-tail-outer",g:1},{t:4,f:[{n:"style-top",f:[{t:2,x:{r:["position.tailTop"],s:"_0-2"}},"px"],t:13}],n:50,x:{r:["position.tailTop"],s:"_0!=null"}},{t:4,f:[{n:"style-bottom",f:[{t:2,x:{r:["position.tailBottom"],s:"_0-2"}},"px"],t:13}],n:50,x:{r:["position.tailBottom"],s:"_0!=null"}},{t:4,f:[{n:"style-left",f:[{t:2,x:{r:["position.tailLeft"],s:"_0-2"}},"px"],t:13}],n:50,x:{r:["position.tailLeft"],s:"_0!=null"}},{t:4,f:[{n:"style-right",f:[{t:2,x:{r:["position.tailRight"],s:"_0-2"}},"px"],t:13}],n:50,x:{r:["position.tailRight"],s:"_0!=null"}}]}],n:50,r:"~/tail"}," ",{t:7,e:"div",m:[{t:13,n:"class",f:"rpop",g:1}],f:[{t:16,r:"content",z:[{n:"trigger",x:{r:"triggerContext"}}]}]}]}],n:50,r:"__popped"}],e:{'_0||"below"':function(t){return t||"below"},'_0||"middle"':function(t){return t||"middle"},'[{dir:_0||"below"}]':function(t){return[{dir:t||"below"}]},'[_0.set("popped",false)]':function(t){return[t.set("popped",!1)]},"_0+(_1?3:0)":function(t,o){return t+(o?3:0)},"_0!=null":function(t){return null!=t},"_0+(_1?0:3)":function(t,o){return t+(o?0:3)},"_0-2":function(t){return t-2},"[{delay:200}]":function(){return[{delay:200}]},"[_0===_1&&_2.done(),true]":function(t,o,e){return[t===o&&e.done(),!0]},"[_0.done()]":function(t){return[t.done()]},true:function(){return!0}},p:{modal:[{t:4,f:[{t:4,f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rpop-modal",g:1},{n:"fade",t:72,v:"t1"},{n:"fade",t:72,f:{r:[],s:"[{delay:200}]"},v:"t2"},{t:4,f:[{n:["click"],t:70,f:{r:["@node","@event.target","."],s:"[_0===_1&&_2.done(),true]"}}],n:51,r:".noClickout"}],f:[{t:7,e:"div",m:[{t:13,n:"class",f:"rpop",g:1},{n:"pop",t:72,f:{r:[],s:"[{delay:200}]"},v:"t1"},{n:"pop",t:72,v:"t2"},{t:4,f:[{n:["click"],t:70,f:{r:["."],s:"[_0.done()]"}}],n:50,r:".clickClose"},{t:8,r:".attrs",c:{r:".context"},z:[{n:"inModal",x:{x:{r:[],s:"true"}}}]}],f:[{t:8,r:".content",c:{r:".context"},z:[{n:"inModal",x:{x:{r:[],s:"true"}}}]}]}]}],n:54,r:"contents.0"}],n:50,r:"contents.length"}]}};function h(){}var g,v=function(t){function o(o){t.call(this,o)}return t&&(o.__proto__=t),o.prototype=Object.create(t&&t.prototype),o.prototype.constructor=o,o.prototype.position=function(o){var e=o||this.source,n=this.get("popped");if(e&&n){var i=this.find("div");if(e&&i&&i.offsetParent){e?this.set("triggerContext",t.getContext(e)):this.set("triggerContext",null);var r=i.offsetParent,p=r.getBoundingClientRect(),l=i.getBoundingClientRect(),a=e.getBoundingClientRect(),s=this.get("where")||"below",f=this.get("align")||"middle",c=this.get("tail"),u="above"===s||"below"===s,d=this.get("fit"),h=this.get("gap"),g="above"===s||"below"===s?0:"left"===s?-l.width-h:a.width+h,v="left"===s||"right"===s?-a.height:"above"===s?-a.height-l.height-h:h;"middle"===f?"below"===s||"above"===s?g-=(l.width-a.width)/2:"left"!==s&&"right"!==s||(v-=(l.height-a.height)/2):"end"===f&&("below"===s||"above"===s?g+=a.width-l.width:"left"!==s&&"right"!==s||(v+=a.height-l.height));var b={popTop:a.bottom-p.top+v,popLeft:a.left-p.left+g,tail:c,vert:"above"===s||"below"===s};if(r.scrollTop&&(b.popTop+=r.scrollTop),r.scrollLeft&&(b.popLeft+=r.scrollLeft),c){"above"===s?b.tailBottom=-10:"below"===s?b.tailTop=-10:"left"===s?b.tailRight=-10:"right"===s&&(b.tailLeft=-10);var m=this.tailSource?this.tailSource.getBoundingClientRect():a;"start"===f?u?b.tailLeft=Math.floor(m.width/2)-10:b.tailTop=Math.floor(m.height/2)-10:"end"===f?u?b.tailRight=Math.floor(m.width/2)-10:b.tailBottom=Math.floor(m.height/2)-10:"middle"===f&&(u?b.tailLeft=Math.floor(m.width/2)-10:b.tailTop=Math.floor(m.height/2)-10),m!==a?u?(null!=b.tailLeft&&(b.tailLeft+=m.left-a.left),null!=b.tailRight&&(b.tailRight+=a.right-m.right)):(null!=b.tailTop&&(b.tailTop+=m.top-a.top),null!=b.tailBottom&&(b.tailBottom+=a.bottom-m.bottom)):"middle"===f&&(u?(null!=b.tailLeft&&(b.tailLeft+=m.left-(b.popLeft+p.left)),null!=b.tailRight&&(b.tailRight+=b.popLeft+p.left+l.width-m.right)):(null!=b.tailTop&&(b.tailTop+=m.top-(b.popTop+p.top)),null!=b.tailBottom&&(b.tailBottom+=b.popTop+p.top+l.height-m.bottom)))}if(d){var y=r;if(this.get("offsets"))for(var w=this.get("offsets");w--;)y=y.offsetParent;var _=r.scrollWidth,x=r.scrollHeight;if(b.popLeft+l.width>_){var L=b.popLeft-(_-l.width);b.popLeft-=L,u&&b.tailLeft&&(b.tailLeft+=L),u&&b.tailRight&&(b.tailRight-=L),c&&!u&&(b.tail=!1)}if(b.popLeft<0){var T=-1*b.popLeft;b.popLeft+=T,u&&b.tailLeft&&(b.tailLeft-=T),u&&b.tailRight&&(b.tailRight+=T),c&&!u&&(b.tail=!1)}if(b.popTop+l.height>x){var k=b.popTop-(x-l.height);b.popTop-=k,!u&&b.tailTop&&(b.tailTop+=k),!u&&b.tailBottom&&(b.tailBottom-=k),c&&u&&(b.tail=!1)}if(b.popTop<0){var R=-1*b.popTop;b.popTop+=R,!u&&b.tailTop&&(b.tailTop-=R),!u&&b.tailBottom&&(b.tailBottom+=R),c&&u&&(b.tail=!1)}}if(p.left+b.popLeft<0){var B=0-(p.left+b.popLeft);b.popLeft+=B,u&&b.tailLeft&&(b.tailLeft-=B),u&&b.tailRight&&(b.tailRight+=B),c&&!u&&(b.tail=!1)}if(p.top+b.popTop<0){var C=0-(p.top+b.popTop);b.popTop+=C,!u&&b.tailTop&&(b.tailTop-=C),!u&&b.tailBottom&&(b.tailBottom+=C),c&&u&&(b.tail=!1)}b.tailLeft&&(b.tailLeft=Math.floor(b.tailLeft)),b.tailRight&&(b.tailRight=Math.floor(b.tailRight)),b.tailTop&&(b.tailTop=Math.floor(b.tailTop)),b.tailBottom&&(b.tailBottom=Math.floor(b.tailBottom)),this.set("position",b)}else this.set("position",null)}},o.prototype.show=function(t){return this.source=t,this.set("popped",!0),this._transdone},o.prototype.hide=function(){return this.set("popped",!1),this._transdone},o.prototype.popFind=function(t){return c?u.find(t):this.find(pattenr)},o.prototype.popFindAll=function(t){return c?u.findAll(t):this.findAll(pattenr)},o}(o);function b(t){return void 0===t&&(t={}),function(o){o.instance.decorators[t.name||"pop"]=function(o,e,n){if(void 0===n&&(n={}),!e)return{teardown:h};"string"==typeof e?n.path=e:"object"==typeof e&&(n=e);var i,r,p=this.getContext(o);function l(t){if("mouseover"!==t.type||!p.get(e)){if("click"!==t.type||!r||i){var l=s,a=f;"function"==typeof(s=n.node||o)&&(s=s()),s=s||o,"function"==typeof(f=n.tail)&&(f=f()),p.toggle(n.path),s=l,f=a}r&&"click"===t.type&&(i=p.observeOnce(n.path,function(){i=null}))}}function a(t){i||p.set(n.path,!1)}return("click"in n?n.click:!1!==t.click)&&p.listen("click",l),("hover"in n?n.hover:t.hover)&&(r=1,p.listen("mouseover",l),p.listen("mouseout",a)),{teardown:function(){p.unlisten("click",l),r&&(p.unlisten("mouseover",l),p.unlisten("mouseout",a),i&&i.cancel())}}}}}o.extendWith(v,{attributes:["popped","tail","where","align","top","left","fit","clickClose","noClickout","gap","offsets"],use:[r(),(void 0===g&&(g={}),function(t){t.instance.events[g.name||"clickout"]=p}),a()],template:d,css:function(t){return[function(t){var o=Object.assign({},t("raui.primary"),t("raui.pop.primary")),e=(t("raui.themes")||[]).slice();return(t("raui.pop.themes")||[]).forEach(function(t){~e.indexOf(t)||e.push(t)}),"\n .rpop-wrapper {\n position: absolute;\n display: inline-block;\n z-index: 21;\n transition-property: top, left, padding;\n transition-timing-function: ease-in-out;\n transition-duration: 0.3s;\n }\n .rpop-with-tail.rpop-above {\n padding-bottom: 10px;\n }\n .rpop-with-tail.rpop-below {\n padding-top: 10px;\n }\n .rpop-with-tail.rpop-left {\n padding-right: 10px;\n }\n .rpop-with-tail.rpop-right {\n padding-left: 10px;\n }\n \n .rpop {\n position: relative;\n box-shadow: 0 1px 4px 0 rgba(0,0,0,0.24);\n border: 1px solid #ccc;\n border-radius: 0.2em;\n background-color: "+(o.bg||"#fff")+";\n color: "+(o.fg||"#222")+";\n padding: 0.5em;\n z-index: 2;\n }\n \n .rpop-modal {\n position: fixed;\n display: flex;\n z-index: 20;\n background-color: rgba(0, 0, 0, 0.2);\n align-items: center;\n justify-content: center;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n padding: 1em;\n overflow: auto;\n }\n \n .rpop-tail, .rpop-tail-outer {\n z-index: 3;\n width: 0;\n height: 0;\n position: absolute;\n border-style: solid;\n border-width: 10px;\n border-color: transparent;\n transition-property: top, left, bottom, right, border-color;\n transition-timing-function: ease-in-out;\n transition-duration: 0.3s;\n }\n .rpop-tail-outer {\n z-index: 1;\n border-width: 12px;\n border-color: transparent;\n }\n \n .rpop-below .rpop-tail {\n border-bottom-color: "+(o.bg||"#fff")+";\n }\n .rpop-below .rpop-tail-outer {\n border-bottom-color: "+(o.bc||"#ccc")+";\n }\n \n .rpop-above .rpop-tail {\n border-top-color: "+(o.bg||"#fff")+";\n }\n .rpop-above .rpop-tail-outer {\n border-top-color: "+(o.bc||"#ccc")+";\n }\n \n .rpop-left .rpop-tail {\n border-left-color: "+(o.bg||"#fff")+";\n }\n .rpop-left .rpop-tail-outer {\n border-left-color: "+(o.bc||"#ccc")+";\n }\n \n .rpop-right .rpop-tail {\n border-right-color: "+(o.bg||"#fff")+";\n }\n .rpop-right .rpop-tail-outer {\n border-right-color: "+(o.bc||"#ccc")+";\n }\n "+e.map(function(o){var e=Object.assign({},t("raui.primary"),t("raui.pop.primary"),t("raui."+o),t("raui.pop."+o));return"\n ."+o+" .rpop {\n background-color: "+(e.bg||"#fff")+";\n color: "+(e.fg||"#222")+";\n }\n \n ."+o+".rpop-below .rpop-tail {\n border-bottom-color: "+(e.bg||"#fff")+";\n }\n ."+o+".rpop-below .rpop-tail-outer {\n border-bottom-color: "+(e.bc||"#ccc")+";\n }\n \n ."+o+".rpop-above .rpop-tail {\n border-top-color: "+(e.bg||"#fff")+";\n }\n ."+o+".rpop-above .rpop-tail-outer {\n border-top-color: "+(e.bc||"#ccc")+";\n }\n \n ."+o+".rpop-left .rpop-tail {\n border-left-color: "+(e.bg||"#fff")+";\n }\n ."+o+".rpop-left .rpop-tail-outer {\n border-left-color: "+(e.bc||"#ccc")+";\n }\n \n ."+o+".rpop-right .rpop-tail {\n border-right-color: "+(e.bg||"#fff")+";\n }\n ."+o+".rpop-right .rpop-tail-outer {\n border-right-color: "+(e.bc||"#ccc")+";\n }\n "})}.call(this,t)].join(" ")},cssId:"rpop",noCssTransform:!0,observe:{popped:function(t){var o,e=this;t&&(s&&(this.source=s),f&&(this.tailSource=f));var n=this._transdone=new Promise(function(t){return o=t});n.resolve=o,setTimeout(function(){e._transdone=n,e.get("popped")===t&&e.set("_popped",t)},1)},_popped:{handler:function(t){var o=this,e=this._transdone.resolve;if(t){var n=this.get("@style.raui.pop.mobile");if(n&&window.matchMedia("(max-width: "+n+")").matches){u||(u=new m({target:document.body,append:!0}));var i=this.getContext().getParent(!0);i.isContext=1,this.set("__popped",!1).then(e),u.unshift("contents",{content:this.partials.content,context:i,attrs:this.partials["extra-attributes"]||[],clickClose:this.get("clickClose"),noClickout:this.get("noClickout"),done:function(){o.set("popped",!1)}})}else this.set("__popped",!0)}else c?(u.shift("contents"),e()):this.set("__popped",!1).then(e)},defer:!0,init:!1},__popped:{handler:function(t){var o=this._transdone.resolve;if(t){var e=this.find("div"),n=e,i=n.offsetHeight+n.offsetTop,r=n.offsetWidth+n.offsetLeft,p=n.offsetParent;if(!this.overflows)for(var l=this.overflows={e:[],v:[]};e&&e.style;){if(e===p){if(e.offsetWidth>=r&&e.offsetHeight>=i)break;r+=e.offsetLeft,i+=e.offsetTop,p=e.offsetParent}var a=getComputedStyle(e);if("auto"===a.overflow)break;"hidden"===a.overflow&&(l.e.push(e),l.v.push(e.style.overflow),e.style.overflow="visible"),e=e.parentNode}this.position(),this.transition("pop",n,{intro:!0,dir:this.get("where")||"below"}).then(o)}else this.source=null,this.tailSource=null},defer:!0,init:!1},"align where tail fit":{handler:function(){this.position()},defer:!0}},decorators:{cleanup:function(t){var o=this;return{teardown:function(){var t=o.overflows;if(t){o.overflows=null;for(var e=0;e<t.e.length;e++)t.e[e].style.overflow=t.v[e]}}}}},data:function(){return{gap:4}}});var m=function(t){function o(o){t.call(this,o)}return t&&(o.__proto__=t),o.prototype=Object.create(t&&t.prototype),o.prototype.constructor=o,o}(o);o.extendWith(m,{template:{v:d.v,t:d.p.modal},data:function(){return{contents:[]}},use:[r(),a()],observe:{contents:function(t){c=(t||[]).length>0}},on:{init:function(){u?console.warn("More than one PopOver mobile host created."):u=this}}}),t.Popover=v,t.trigger=b,t.default=function(t){return void 0===t&&(t={}),function(o){var e=o.instance;e.components[t.name||"pop"]=v,e.components[t.mobileName||"mobile-pop"]=m;var n=Object.assign({},t);n.name=n.trigger||n.name,b(n)({instance:e})}},Object.defineProperty(t,"__esModule",{value:!0})});

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc