mithril-materialized 0.19.6 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -2
- package/dist/dropdown.d.ts +10 -10
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +1 -1
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/option.d.ts +9 -9
- package/dist/radio.d.ts +12 -12
- package/dist/select.d.ts +7 -7
- package/package.json +4 -4
- package/dist/kanban.d.ts +0 -47
- package/dist/layout-form-generator.d.ts +0 -75
package/dist/index.modern.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e from"materialize-css";function t(e,t,n,a,i,o){return{tag:e,key:t,attrs:n,children:a,text:i,dom:o,domSize:void 0,state:void 0,events:void 0,instance:void 0}}t.normalize=function(e){return Array.isArray(e)?t("[",void 0,void 0,t.normalizeChildren(e),void 0,void 0):null==e||"boolean"==typeof e?null:"object"==typeof e?e:t("#",void 0,void 0,String(e),void 0,void 0)},t.normalizeChildren=function(e){var n=[];if(e.length){for(var a=null!=e[0]&&null!=e[0].key,i=1;i<e.length;i++)if((null!=e[i]&&null!=e[i].key)!==a)throw new TypeError(!a||null==e[i]&&"boolean"!=typeof e[i]?"In fragments, vnodes must either all have keys or none have keys.":"In fragments, vnodes must either all have keys or none have keys. You may wish to consider using an explicit keyed empty fragment, m.fragment({key: ...}), instead of a hole.");for(i=0;i<e.length;i++)n[i]=t.normalize(e[i])}return n};var n=t,a=function(){var e,t=arguments[this],a=this+1;if(null==t?t={}:("object"!=typeof t||null!=t.tag||Array.isArray(t))&&(t={},a=this),arguments.length===a+1)e=arguments[a],Array.isArray(e)||(e=[e]);else for(e=[];a<arguments.length;)e.push(arguments[a++]);return n("",t.key,t,e)},i={}.hasOwnProperty,o=/(?:(^|#|\.)([^#\.\[\]]+))|(\[(.+?)(?:\s*=\s*("|'|)((?:\\["'\]]|.)*?)\5)?\])/g,r={};function l(e){for(var t in e)if(i.call(e,t))return!1;return!0}function s(e){for(var t,n="div",a=[],i={};t=o.exec(e);){var l=t[1],s=t[2];if(""===l&&""!==s)n=s;else if("#"===l)i.id=s;else if("."===l)a.push(s);else if("["===t[3][0]){var c=t[6];c&&(c=c.replace(/\\(["'])/g,"$1").replace(/\\\\/g,"\\")),"class"===t[4]?a.push(c):i[t[4]]=""===c?c:c||!0}}return a.length>0&&(i.className=a.join(" ")),r[e]={tag:n,attrs:i}}function c(e,t){var n=t.attrs,a=i.call(n,"class"),o=a?n.class:n.className;if(t.tag=e.tag,t.attrs={},!l(e.attrs)&&!l(n)){var r={};for(var s in n)i.call(n,s)&&(r[s]=n[s]);n=r}for(var s in e.attrs)i.call(e.attrs,s)&&"className"!==s&&!i.call(n,s)&&(n[s]=e.attrs[s]);for(var s in null==o&&null==e.attrs.className||(n.className=null!=o?null!=e.attrs.className?String(e.attrs.className)+" "+String(o):o:null!=e.attrs.className?e.attrs.className:null),a&&(n.class=null),n)if(i.call(n,s)&&"key"!==s){t.attrs=n;break}return t}var d=function(e){if(null==e||"string"!=typeof e&&"function"!=typeof e&&"function"!=typeof e.view)throw Error("The selector must be either a string or a component.");var t=a.apply(1,arguments);return"string"==typeof e&&(t.children=n.normalizeChildren(t.children),"["!==e)?c(r[e]||s(e),t):(t.tag=e,t)};d.trust=function(e){return null==e&&(e=""),n("<",void 0,void 0,e,void 0,void 0)},d.fragment=function(){var e=a.apply(0,arguments);return e.tag="[",e.children=n.normalizeChildren(e.children),e};var u=d,f="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},m=function(e){if(!(this instanceof m))throw new Error("Promise must be called with 'new'.");if("function"!=typeof e)throw new TypeError("executor must be a function.");var t=this,n=[],a=[],i=s(n,!0),o=s(a,!1),r=t._instance={resolvers:n,rejectors:a},l="function"==typeof setImmediate?setImmediate:setTimeout;function s(e,i){return function s(d){var u;try{if(!i||null==d||"object"!=typeof d&&"function"!=typeof d||"function"!=typeof(u=d.then))l(function(){i||0!==e.length||console.error("Possible unhandled promise rejection:",d);for(var t=0;t<e.length;t++)e[t](d);n.length=0,a.length=0,r.state=i,r.retry=function(){s(d)}});else{if(d===t)throw new TypeError("Promise can't be resolved with itself.");c(u.bind(d))}}catch(e){o(e)}}}function c(e){var t=0;function n(e){return function(n){t++>0||e(n)}}var a=n(o);try{e(n(i),a)}catch(e){a(e)}}c(e)};m.prototype.then=function(e,t){var n,a,i=this._instance;function o(e,t,o,r){t.push(function(t){if("function"!=typeof e)o(t);else try{n(e(t))}catch(e){a&&a(e)}}),"function"==typeof i.retry&&r===i.state&&i.retry()}var r=new m(function(e,t){n=e,a=t});return o(e,i.resolvers,n,!0),o(t,i.rejectors,a,!1),r},m.prototype.catch=function(e){return this.then(null,e)},m.prototype.finally=function(e){return this.then(function(t){return m.resolve(e()).then(function(){return t})},function(t){return m.resolve(e()).then(function(){return m.reject(t)})})},m.resolve=function(e){return e instanceof m?e:new m(function(t){t(e)})},m.reject=function(e){return new m(function(t,n){n(e)})},m.all=function(e){return new m(function(t,n){var a=e.length,i=0,o=[];if(0===e.length)t([]);else for(var r=0;r<e.length;r++)!function(r){function l(e){i++,o[r]=e,i===a&&t(o)}null==e[r]||"object"!=typeof e[r]&&"function"!=typeof e[r]||"function"!=typeof e[r].then?l(e[r]):e[r].then(l,n)}(r)})},m.race=function(e){return new m(function(t,n){for(var a=0;a<e.length;a++)e[a].then(t,n)})};var p,h,v=m,g=(p=function(e){"undefined"!=typeof window?(void 0===window.Promise?window.Promise=v:window.Promise.prototype.finally||(window.Promise.prototype.finally=v.prototype.finally),e.exports=window.Promise):void 0!==f?(void 0===f.Promise?f.Promise=v:f.Promise.prototype.finally||(f.Promise.prototype.finally=v.prototype.finally),e.exports=f.Promise):e.exports=v},p(h={exports:{}}),h.exports),y=function(e){var t,a=e&&e.document,i={svg:"http://www.w3.org/2000/svg",math:"http://www.w3.org/1998/Math/MathML"};function o(e){return e.attrs&&e.attrs.xmlns||i[e.tag]}function r(e,t){if(e.state!==t)throw new Error("'vnode.state' must not be modified.")}function l(e){var t=e.state;try{return this.apply(t,arguments)}finally{r(e,t)}}function s(){try{return a.activeElement}catch(e){return null}}function c(e,t,n,a,i,o,r){for(var l=n;l<a;l++){var s=t[l];null!=s&&d(e,s,i,r,o)}}function d(e,t,n,i,r){var l=t.tag;if("string"==typeof l)switch(t.state={},null!=t.attrs&&P(t.attrs,t,n),l){case"#":!function(e,t,n){t.dom=a.createTextNode(t.children),x(e,t.dom,n)}(e,t,r);break;case"<":f(e,t,i,r);break;case"[":!function(e,t,n,i,o){var r=a.createDocumentFragment();if(null!=t.children){var l=t.children;c(r,l,0,l.length,n,null,i)}t.dom=r.firstChild,t.domSize=r.childNodes.length,x(e,r,o)}(e,t,n,i,r);break;default:!function(e,t,n,i,r){var l=t.tag,s=t.attrs,d=s&&s.is,u=(i=o(t)||i)?d?a.createElementNS(i,l,{is:d}):a.createElementNS(i,l):d?a.createElement(l,{is:d}):a.createElement(l);if(t.dom=u,null!=s&&function(e,t,n){"input"===e.tag&&null!=t.type&&e.dom.setAttribute("type",t.type);var a=null!=t&&"input"===e.tag&&"file"===t.type;for(var i in t)A(e,i,null,t[i],n,a)}(t,s,i),x(e,u,r),!N(t)&&null!=t.children){var f=t.children;c(u,f,0,f.length,n,null,i),"select"===t.tag&&null!=s&&function(e,t){if("value"in t)if(null===t.value)-1!==e.dom.selectedIndex&&(e.dom.value=null);else{var n=""+t.value;e.dom.value===n&&-1!==e.dom.selectedIndex||(e.dom.value=n)}"selectedIndex"in t&&A(e,"selectedIndex",null,t.selectedIndex,void 0)}(t,s)}}(e,t,n,i,r)}else!function(e,t,n,a,i){m(t,n),null!=t.instance?(d(e,t.instance,n,a,i),t.dom=t.instance.dom,t.domSize=null!=t.dom?t.instance.domSize:0):t.domSize=0}(e,t,n,i,r)}var u={caption:"table",thead:"table",tbody:"table",tfoot:"table",tr:"tbody",th:"tr",td:"tr",colgroup:"table",col:"colgroup"};function f(e,t,n,i){var o=t.children.match(/^\s*?<(\w+)/im)||[],r=a.createElement(u[o[1]]||"div");"http://www.w3.org/2000/svg"===n?(r.innerHTML='<svg xmlns="http://www.w3.org/2000/svg">'+t.children+"</svg>",r=r.firstChild):r.innerHTML=t.children,t.dom=r.firstChild,t.domSize=r.childNodes.length,t.instance=[];for(var l,s=a.createDocumentFragment();l=r.firstChild;)t.instance.push(l),s.appendChild(l);x(e,s,i)}function m(e,t){var a;if("function"==typeof e.tag.view){if(e.state=Object.create(e.tag),null!=(a=e.state.view).$$reentrantLock$$)return;a.$$reentrantLock$$=!0}else{if(e.state=void 0,null!=(a=e.tag).$$reentrantLock$$)return;a.$$reentrantLock$$=!0,e.state=null!=e.tag.prototype&&"function"==typeof e.tag.prototype.view?new e.tag(e):e.tag(e)}if(P(e.state,e,t),null!=e.attrs&&P(e.attrs,e,t),e.instance=n.normalize(l.call(e.state.view,e)),e.instance===e)throw Error("A view cannot return the vnode it received as argument");a.$$reentrantLock$$=null}function p(e,t,n,a,i,o){if(t!==n&&(null!=t||null!=n))if(null==t||0===t.length)c(e,n,0,n.length,a,i,o);else if(null==n||0===n.length)I(e,t,0,t.length);else{var r=null!=t[0]&&null!=t[0].key,l=null!=n[0]&&null!=n[0].key,s=0,u=0;if(!r)for(;u<t.length&&null==t[u];)u++;if(!l)for(;s<n.length&&null==n[s];)s++;if(r!==l)I(e,t,u,t.length),c(e,n,s,n.length,a,i,o);else if(l){for(var f,m,p,v,k,x=t.length-1,N=n.length-1;x>=u&&N>=s&&(p=t[x]).key===(v=n[N]).key;)p!==v&&h(e,p,v,a,i,o),null!=v.dom&&(i=v.dom),x--,N--;for(;x>=u&&N>=s&&(f=t[u]).key===(m=n[s]).key;)u++,s++,f!==m&&h(e,f,m,a,b(t,u,i),o);for(;x>=u&&N>=s&&s!==N&&f.key===v.key&&p.key===m.key;)w(e,p,k=b(t,u,i)),p!==m&&h(e,p,m,a,k,o),++s<=--N&&w(e,f,i),f!==v&&h(e,f,v,a,i,o),null!=v.dom&&(i=v.dom),u++,p=t[--x],v=n[N],f=t[u],m=n[s];for(;x>=u&&N>=s&&p.key===v.key;)p!==v&&h(e,p,v,a,i,o),null!=v.dom&&(i=v.dom),N--,p=t[--x],v=n[N];if(s>N)I(e,t,u,x+1);else if(u>x)c(e,n,s,N+1,a,i,o);else{var C,S,T=i,A=N-s+1,M=new Array(A),E=0,_=0,j=2147483647,O=0;for(_=0;_<A;_++)M[_]=-1;for(_=N;_>=s;_--){null==C&&(C=g(t,u,x+1));var L=C[(v=n[_]).key];null!=L&&(j=L<j?L:-1,M[_-s]=L,p=t[L],t[L]=null,p!==v&&h(e,p,v,a,i,o),null!=v.dom&&(i=v.dom),O++)}if(i=T,O!==x-u+1&&I(e,t,u,x+1),0===O)c(e,n,s,N+1,a,i,o);else if(-1===j)for(S=function(e){var t=[0],n=0,a=0,i=0,o=y.length=e.length;for(i=0;i<o;i++)y[i]=e[i];for(i=0;i<o;++i)if(-1!==e[i]){var r=t[t.length-1];if(e[r]<e[i])y[i]=r,t.push(i);else{for(n=0,a=t.length-1;n<a;){var l=(n>>>1)+(a>>>1)+(n&a&1);e[t[l]]<e[i]?n=l+1:a=l}e[i]<e[t[n]]&&(n>0&&(y[i]=t[n-1]),t[n]=i)}}for(a=t[(n=t.length)-1];n-- >0;)t[n]=a,a=y[a];return y.length=0,t}(M),E=S.length-1,_=N;_>=s;_--)m=n[_],-1===M[_-s]?d(e,m,a,o,i):S[E]===_-s?E--:w(e,m,i),null!=m.dom&&(i=n[_].dom);else for(_=N;_>=s;_--)m=n[_],-1===M[_-s]&&d(e,m,a,o,i),null!=m.dom&&(i=n[_].dom)}}else{var V=t.length<n.length?t.length:n.length;for(s=s<u?s:u;s<V;s++)(f=t[s])===(m=n[s])||null==f&&null==m||(null==f?d(e,m,a,o,b(t,s+1,i)):null==m?$(e,f):h(e,f,m,a,b(t,s+1,i),o));t.length>V&&I(e,t,s,t.length),n.length>V&&c(e,n,s,n.length,a,i,o)}}}function h(e,t,n,a,i,r){var s=t.tag;if(s===n.tag){if(n.state=t.state,n.events=t.events,function(e,t){do{var n;if(null!=e.attrs&&"function"==typeof e.attrs.onbeforeupdate&&void 0!==(n=l.call(e.attrs.onbeforeupdate,e,t))&&!n)break;if("string"!=typeof e.tag&&"function"==typeof e.state.onbeforeupdate&&void 0!==(n=l.call(e.state.onbeforeupdate,e,t))&&!n)break;return!1}while(0);return e.dom=t.dom,e.domSize=t.domSize,e.instance=t.instance,e.attrs=t.attrs,e.children=t.children,e.text=t.text,!0}(n,t))return;if("string"==typeof s)switch(null!=n.attrs&&F(n.attrs,n,a),s){case"#":!function(e,t){e.children.toString()!==t.children.toString()&&(e.dom.nodeValue=t.children),t.dom=e.dom}(t,n);break;case"<":!function(e,t,n,a,i){t.children!==n.children?(C(e,t),f(e,n,a,i)):(n.dom=t.dom,n.domSize=t.domSize,n.instance=t.instance)}(e,t,n,r,i);break;case"[":!function(e,t,n,a,i,o){p(e,t.children,n.children,a,i,o);var r=0,l=n.children;if(n.dom=null,null!=l){for(var s=0;s<l.length;s++){var c=l[s];null!=c&&null!=c.dom&&(null==n.dom&&(n.dom=c.dom),r+=c.domSize||1)}1!==r&&(n.domSize=r)}}(e,t,n,a,i,r);break;default:!function(e,t,n,a){var i=t.dom=e.dom;a=o(t)||a,"textarea"===t.tag&&null==t.attrs&&(t.attrs={}),function(e,t,n,a){if(t&&t===n&&console.warn("Don't reuse attrs object, use new object for every redraw, this will throw in next major"),null!=n){"input"===e.tag&&null!=n.type&&e.dom.setAttribute("type",n.type);var i="input"===e.tag&&"file"===n.type;for(var o in n)A(e,o,t&&t[o],n[o],a,i)}var r;if(null!=t)for(var o in t)null==(r=t[o])||null!=n&&null!=n[o]||M(e,o,r,a)}(t,e.attrs,t.attrs,a),N(t)||p(i,e.children,t.children,n,null,a)}(t,n,a,r)}else v(e,t,n,a,i,r)}else $(e,t),d(e,n,a,r,i)}function v(e,t,a,i,o,r){if(a.instance=n.normalize(l.call(a.state.view,a)),a.instance===a)throw Error("A view cannot return the vnode it received as argument");F(a.state,a,i),null!=a.attrs&&F(a.attrs,a,i),null!=a.instance?(null==t.instance?d(e,a.instance,i,r,o):h(e,t.instance,a.instance,i,o,r),a.dom=a.instance.dom,a.domSize=a.instance.domSize):null!=t.instance?($(e,t.instance),a.dom=void 0,a.domSize=0):(a.dom=t.dom,a.domSize=t.domSize)}function g(e,t,n){for(var a=Object.create(null);t<n;t++){var i=e[t];if(null!=i){var o=i.key;null!=o&&(a[o]=t)}}return a}var y=[];function b(e,t,n){for(;t<e.length;t++)if(null!=e[t]&&null!=e[t].dom)return e[t].dom;return n}function w(e,t,n){var i=a.createDocumentFragment();k(e,i,t),x(e,i,n)}function k(e,t,n){for(;null!=n.dom&&n.dom.parentNode===e;){if("string"!=typeof n.tag){if(null!=(n=n.instance))continue}else if("<"===n.tag)for(var a=0;a<n.instance.length;a++)t.appendChild(n.instance[a]);else if("["!==n.tag)t.appendChild(n.dom);else if(1===n.children.length){if(null!=(n=n.children[0]))continue}else for(a=0;a<n.children.length;a++){var i=n.children[a];null!=i&&k(e,t,i)}break}}function x(e,t,n){null!=n?e.insertBefore(t,n):e.appendChild(t)}function N(e){if(null==e.attrs||null==e.attrs.contenteditable&&null==e.attrs.contentEditable)return!1;var t=e.children;if(null!=t&&1===t.length&&"<"===t[0].tag){var n=t[0].children;e.dom.innerHTML!==n&&(e.dom.innerHTML=n)}else if(null!=t&&0!==t.length)throw new Error("Child node of a contenteditable must be trusted.");return!0}function I(e,t,n,a){for(var i=n;i<a;i++){var o=t[i];null!=o&&$(e,o)}}function $(e,t){var n,a,i,o,s=0,c=t.state;function d(){r(t,c),T(t),S(e,t)}"string"!=typeof t.tag&&"function"==typeof t.state.onbeforeremove&&null!=(i=l.call(t.state.onbeforeremove,t))&&"function"==typeof i.then&&(s=1,n=i),t.attrs&&"function"==typeof t.attrs.onbeforeremove&&null!=(i=l.call(t.attrs.onbeforeremove,t))&&"function"==typeof i.then&&(s|=2,a=i),r(t,c),s?(null!=n&&n.then(o=function(){1&s&&((s&=2)||d())},o),null!=a&&a.then(o=function(){2&s&&((s&=1)||d())},o)):(T(t),S(e,t))}function C(e,t){for(var n=0;n<t.instance.length;n++)e.removeChild(t.instance[n])}function S(e,t){for(;null!=t.dom&&t.dom.parentNode===e;){if("string"!=typeof t.tag){if(null!=(t=t.instance))continue}else if("<"===t.tag)C(e,t);else{if("["!==t.tag&&(e.removeChild(t.dom),!Array.isArray(t.children)))break;if(1===t.children.length){if(null!=(t=t.children[0]))continue}else for(var n=0;n<t.children.length;n++){var a=t.children[n];null!=a&&S(e,a)}}break}}function T(e){if("string"!=typeof e.tag&&"function"==typeof e.state.onremove&&l.call(e.state.onremove,e),e.attrs&&"function"==typeof e.attrs.onremove&&l.call(e.attrs.onremove,e),"string"!=typeof e.tag)null!=e.instance&&T(e.instance);else{var t=e.children;if(Array.isArray(t))for(var n=0;n<t.length;n++){var a=t[n];null!=a&&T(a)}}}function A(e,t,n,i,o,r){if(!("key"===t||"is"===t||null==i||E(t)||n===i&&!function(e,t){return"value"===t||"checked"===t||"selectedIndex"===t||"selected"===t&&e.dom===s()||"option"===e.tag&&e.dom.parentNode===a.activeElement}(e,t)&&"object"!=typeof i||"type"===t&&"input"===e.tag)){if("o"===t[0]&&"n"===t[1])return z(e,t,i);if("xlink:"===t.slice(0,6))e.dom.setAttributeNS("http://www.w3.org/1999/xlink",t.slice(6),i);else if("style"===t)D(e.dom,n,i);else if(_(e,t,o)){if("value"===t){if(("input"===e.tag||"textarea"===e.tag)&&e.dom.value===""+i&&(r||e.dom===s()))return;if("select"===e.tag&&null!==n&&e.dom.value===""+i)return;if("option"===e.tag&&null!==n&&e.dom.value===""+i)return;if(r&&""+i!="")return void console.error("`value` is read-only on file inputs!")}e.dom[t]=i}else"boolean"==typeof i?i?e.dom.setAttribute(t,""):e.dom.removeAttribute(t):e.dom.setAttribute("className"===t?"class":t,i)}}function M(e,t,n,a){if("key"!==t&&"is"!==t&&null!=n&&!E(t))if("o"===t[0]&&"n"===t[1])z(e,t,void 0);else if("style"===t)D(e.dom,n,null);else if(!_(e,t,a)||"className"===t||"title"===t||"value"===t&&("option"===e.tag||"select"===e.tag&&-1===e.dom.selectedIndex&&e.dom===s())||"input"===e.tag&&"type"===t){var i=t.indexOf(":");-1!==i&&(t=t.slice(i+1)),!1!==n&&e.dom.removeAttribute("className"===t?"class":t)}else e.dom[t]=null}function E(e){return"oninit"===e||"oncreate"===e||"onupdate"===e||"onremove"===e||"onbeforeremove"===e||"onbeforeupdate"===e}function _(e,t,n){return void 0===n&&(e.tag.indexOf("-")>-1||null!=e.attrs&&e.attrs.is||"href"!==t&&"list"!==t&&"form"!==t&&"width"!==t&&"height"!==t)&&t in e.dom}var j,O=/[A-Z]/g;function L(e){return"-"+e.toLowerCase()}function V(e){return"-"===e[0]&&"-"===e[1]?e:"cssFloat"===e?"float":e.replace(O,L)}function D(e,t,n){if(t===n);else if(null==n)e.style.cssText="";else if("object"!=typeof n)e.style.cssText=n;else if(null==t||"object"!=typeof t)for(var a in e.style.cssText="",n)null!=(i=n[a])&&e.style.setProperty(V(a),String(i));else{for(var a in n){var i;null!=(i=n[a])&&(i=String(i))!==String(t[a])&&e.style.setProperty(V(a),i)}for(var a in t)null!=t[a]&&null==n[a]&&e.style.removeProperty(V(a))}}function R(){this._=t}function z(e,n,a){if(null!=e.events){if(e.events._=t,e.events[n]===a)return;null==a||"function"!=typeof a&&"object"!=typeof a?(null!=e.events[n]&&e.dom.removeEventListener(n.slice(2),e.events,!1),e.events[n]=void 0):(null==e.events[n]&&e.dom.addEventListener(n.slice(2),e.events,!1),e.events[n]=a)}else null==a||"function"!=typeof a&&"object"!=typeof a||(e.events=new R,e.dom.addEventListener(n.slice(2),e.events,!1),e.events[n]=a)}function P(e,t,n){"function"==typeof e.oninit&&l.call(e.oninit,t),"function"==typeof e.oncreate&&n.push(l.bind(e.oncreate,t))}function F(e,t,n){"function"==typeof e.onupdate&&n.push(l.bind(e.onupdate,t))}return(R.prototype=Object.create(null)).handleEvent=function(e){var t,n=this["on"+e.type];"function"==typeof n?t=n.call(e.currentTarget,e):"function"==typeof n.handleEvent&&n.handleEvent(e),this._&&!1!==e.redraw&&(0,this._)(),!1===t&&(e.preventDefault(),e.stopPropagation())},function(e,a,i){if(!e)throw new TypeError("DOM element being rendered to does not exist.");if(null!=j&&e.contains(j))throw new TypeError("Node is currently being rendered to and thus is locked.");var o=t,r=j,l=[],c=s(),d=e.namespaceURI;j=e,t="function"==typeof i?i:void 0;try{null==e.vnodes&&(e.textContent=""),a=n.normalizeChildren(Array.isArray(a)?a:[a]),p(e,e.vnodes,a,l,null,"http://www.w3.org/1999/xhtml"===d?void 0:d),e.vnodes=a,null!=c&&s()!==c&&"function"==typeof c.focus&&c.focus();for(var u=0;u<l.length;u++)l[u]()}finally{t=o,j=r}}}("undefined"!=typeof window?window:null),b=function(e,t,a){var i=[],o=!1,r=-1;function l(){for(r=0;r<i.length;r+=2)try{e(i[r],n(i[r+1]),s)}catch(e){a.error(e)}r=-1}function s(){o||(o=!0,t(function(){o=!1,l()}))}return s.sync=l,{mount:function(t,a){if(null!=a&&null==a.view&&"function"!=typeof a)throw new TypeError("m.mount expects a component, not a vnode.");var o=i.indexOf(t);o>=0&&(i.splice(o,2),o<=r&&(r-=2),e(t,[])),null!=a&&(i.push(t,a),e(t,n(a),s))},redraw:s}}(y,"undefined"!=typeof requestAnimationFrame?requestAnimationFrame:null,"undefined"!=typeof console?console:null),w=function(e){if("[object Object]"!==Object.prototype.toString.call(e))return"";var t=[];for(var n in e)a(n,e[n]);return t.join("&");function a(e,n){if(Array.isArray(n))for(var i=0;i<n.length;i++)a(e+"["+i+"]",n[i]);else if("[object Object]"===Object.prototype.toString.call(n))for(var i in n)a(e+"["+i+"]",n[i]);else t.push(encodeURIComponent(e)+(null!=n&&""!==n?"="+encodeURIComponent(n):""))}},k=Object.assign||function(e,t){for(var n in t)i.call(t,n)&&(e[n]=t[n])},x=function(e,t){if(/:([^\/\.-]+)(\.{3})?:/.test(e))throw new SyntaxError("Template parameter names must be separated by either a '/', '-', or '.'.");if(null==t)return e;var n=e.indexOf("?"),a=e.indexOf("#"),i=a<0?e.length:a,o=e.slice(0,n<0?i:n),r={};k(r,t);var l=o.replace(/:([^\/\.-]+)(\.{3})?/g,function(e,n,a){return delete r[n],null==t[n]?e:a?t[n]:encodeURIComponent(String(t[n]))}),s=l.indexOf("?"),c=l.indexOf("#"),d=c<0?l.length:c,u=l.slice(0,s<0?d:s);n>=0&&(u+=e.slice(n,i)),s>=0&&(u+=(n<0?"?":"&")+l.slice(s,d));var f=w(r);return f&&(u+=(n<0&&s<0?"?":"&")+f),a>=0&&(u+=e.slice(a)),c>=0&&(u+=(a<0?"":"&")+l.slice(c)),u},N=function(e,t,n){var a=0;function o(e){return new t(e)}function r(e){return function(a,i){"string"!=typeof a?(i=a,a=a.url):null==i&&(i={});var r=new t(function(t,n){e(x(a,i.params),i,function(e){if("function"==typeof i.type)if(Array.isArray(e))for(var n=0;n<e.length;n++)e[n]=new i.type(e[n]);else e=new i.type(e);t(e)},n)});if(!0===i.background)return r;var l=0;function s(){0==--l&&"function"==typeof n&&n()}return function e(t){var n=t.then;return t.constructor=o,t.then=function(){l++;var a=n.apply(t,arguments);return a.then(s,function(e){if(s(),0===l)throw e}),e(a)},t}(r)}}function l(e,t){for(var n in e.headers)if(i.call(e.headers,n)&&n.toLowerCase()===t)return!0;return!1}return o.prototype=t.prototype,o.__proto__=t,{request:r(function(t,n,a,o){var r,s=null!=n.method?n.method.toUpperCase():"GET",c=n.body,d=(null==n.serialize||n.serialize===JSON.serialize)&&!(c instanceof e.FormData||c instanceof e.URLSearchParams),u=n.responseType||("function"==typeof n.extract?"":"json"),f=new e.XMLHttpRequest,m=!1,p=!1,h=f,v=f.abort;for(var g in f.abort=function(){m=!0,v.call(this)},f.open(s,t,!1!==n.async,"string"==typeof n.user?n.user:void 0,"string"==typeof n.password?n.password:void 0),d&&null!=c&&!l(n,"content-type")&&f.setRequestHeader("Content-Type","application/json; charset=utf-8"),"function"==typeof n.deserialize||l(n,"accept")||f.setRequestHeader("Accept","application/json, text/*"),n.withCredentials&&(f.withCredentials=n.withCredentials),n.timeout&&(f.timeout=n.timeout),f.responseType=u,n.headers)i.call(n.headers,g)&&f.setRequestHeader(g,n.headers[g]);f.onreadystatechange=function(e){if(!m&&4===e.target.readyState)try{var i,r=e.target.status>=200&&e.target.status<300||304===e.target.status||/^file:\/\//i.test(t),l=e.target.response;if("json"===u){if(!e.target.responseType&&"function"!=typeof n.extract)try{l=JSON.parse(e.target.responseText)}catch(e){l=null}}else u&&"text"!==u||null==l&&(l=e.target.responseText);if("function"==typeof n.extract?(l=n.extract(e.target,n),r=!0):"function"==typeof n.deserialize&&(l=n.deserialize(l)),r)a(l);else{var s=function(){try{i=e.target.responseText}catch(e){i=l}var t=new Error(i);t.code=e.target.status,t.response=l,o(t)};0===f.status?setTimeout(function(){p||s()}):s()}}catch(e){o(e)}},f.ontimeout=function(e){p=!0;var t=new Error("Request timed out");t.code=e.target.status,o(t)},"function"==typeof n.config&&(f=n.config(f,n,t)||f)!==h&&(r=f.abort,f.abort=function(){m=!0,r.call(this)}),null==c?f.send():f.send("function"==typeof n.serialize?n.serialize(c):c instanceof e.FormData||c instanceof e.URLSearchParams?c:JSON.stringify(c))}),jsonp:r(function(t,n,i,o){var r=n.callbackName||"_mithril_"+Math.round(1e16*Math.random())+"_"+a++,l=e.document.createElement("script");e[r]=function(t){delete e[r],l.parentNode.removeChild(l),i(t)},l.onerror=function(){delete e[r],l.parentNode.removeChild(l),o(new Error("JSONP request failed"))},l.src=t+(t.indexOf("?")<0?"?":"&")+encodeURIComponent(n.callbackKey||"callback")+"="+encodeURIComponent(r),e.document.documentElement.appendChild(l)})}}("undefined"!=typeof window?window:null,g,b.redraw);function I(e){try{return decodeURIComponent(e)}catch(t){return e}}var $=function(e){if(""===e||null==e)return{};"?"===e.charAt(0)&&(e=e.slice(1));for(var t=e.split("&"),n={},a={},i=0;i<t.length;i++){var o=t[i].split("="),r=I(o[0]),l=2===o.length?I(o[1]):"";"true"===l?l=!0:"false"===l&&(l=!1);var s=r.split(/\]\[?|\[/),c=a;r.indexOf("[")>-1&&s.pop();for(var d=0;d<s.length;d++){var u=s[d],f=s[d+1],m=""==f||!isNaN(parseInt(f,10));if(""===u)null==n[r=s.slice(0,d).join()]&&(n[r]=Array.isArray(c)?c.length:0),u=n[r]++;else if("__proto__"===u)break;if(d===s.length-1)c[u]=l;else{var p=Object.getOwnPropertyDescriptor(c,u);null!=p&&(p=p.value),null==p&&(c[u]=p=m?[]:{}),c=p}}}return a},C=function(e){var t=e.indexOf("?"),n=e.indexOf("#"),a=n<0?e.length:n,i=e.slice(0,t<0?a:t).replace(/\/{2,}/g,"/");return i?("/"!==i[0]&&(i="/"+i),i.length>1&&"/"===i[i.length-1]&&(i=i.slice(0,-1))):i="/",{path:i,params:t<0?{}:$(e.slice(t+1,a))}},S=new RegExp("^(?:key|oninit|oncreate|onbeforeupdate|onupdate|onbeforeremove|onremove)$"),T=function(e,t){var n={};if(null!=t)for(var a in e)i.call(e,a)&&!S.test(a)&&t.indexOf(a)<0&&(n[a]=e[a]);else for(var a in e)i.call(e,a)&&!S.test(a)&&(n[a]=e[a]);return n},A={};function E(e){try{return decodeURIComponent(e)}catch(t){return e}}var _=function(e,t){var a,i,o,r,l,s,c=null==e?null:"function"==typeof e.setImmediate?e.setImmediate:e.setTimeout,u=g.resolve(),f=!1,m=!1,p=0,h=A,v={onbeforeupdate:function(){return!(!(p=p?2:1)||A===h)},onremove:function(){e.removeEventListener("popstate",w,!1),e.removeEventListener("hashchange",b,!1)},view:function(){if(p&&A!==h){var e=[n(o,r.key,r)];return h&&(e=h.render(e[0])),e}}},y=I.SKIP={};function b(){f=!1;var n=e.location.hash;"#"!==I.prefix[0]&&(n=e.location.search+n,"?"!==I.prefix[0]&&"/"!==(n=e.location.pathname+n)[0]&&(n="/"+n));var c=n.concat().replace(/(?:%[a-f89][a-f0-9])+/gim,E).slice(I.prefix.length),d=C(c);function m(e){console.error(e),N(i,null,{replace:!0})}k(d.params,e.history.state),function e(n){for(;n<a.length;n++)if(a[n].check(d)){var f=a[n].component,v=a[n].route,g=f,b=s=function(a){if(b===s){if(a===y)return e(n+1);o=null==a||"function"!=typeof a.view&&"function"!=typeof a?"div":a,r=d.params,l=c,s=null,h=f.render?f:null,2===p?t.redraw():(p=2,t.redraw.sync())}};return void(f.view||"function"==typeof f?(f={},b(g)):f.onmatch?u.then(function(){return f.onmatch(d.params,c,v)}).then(b,c===i?null:m):b("div"))}if(c===i)throw new Error("Could not resolve default route "+i+".");N(i,null,{replace:!0})}(0)}function w(){f||(f=!0,c(b))}function N(t,n,a){if(t=x(t,n),m){w();var i=a?a.state:null,o=a?a.title:null;a&&a.replace?e.history.replaceState(i,o,I.prefix+t):e.history.pushState(i,o,I.prefix+t)}else e.location.href=I.prefix+t}function I(n,o,r){if(!n)throw new TypeError("DOM element being rendered to does not exist.");if(a=Object.keys(r).map(function(e){if("/"!==e[0])throw new SyntaxError("Routes must start with a '/'.");if(/:([^\/\.-]+)(\.{3})?:/.test(e))throw new SyntaxError("Route parameter names must be separated with either '/', '.', or '-'.");return{route:e,component:r[e],check:(t=e,n=C(t),a=Object.keys(n.params),i=[],o=new RegExp("^"+n.path.replace(/:([^\/.-]+)(\.{3}|\.(?!\.)|-)?|[\\^$*+.()|\[\]{}]/g,function(e,t,n){return null==t?"\\"+e:(i.push({k:t,r:"..."===n}),"..."===n?"(.*)":"."===n?"([^/]+)\\.":"([^/]+)"+(n||""))})+"$"),function(e){for(var t=0;t<a.length;t++)if(n.params[a[t]]!==e.params[a[t]])return!1;if(!i.length)return o.test(e.path);var r=o.exec(e.path);if(null==r)return!1;for(t=0;t<i.length;t++)e.params[i[t].k]=i[t].r?r[t+1]:decodeURIComponent(r[t+1]);return!0})};var t,n,a,i,o}),i=o,null!=o){var l=C(o);if(!a.some(function(e){return e.check(l)}))throw new ReferenceError("Default route doesn't match any known routes.")}"function"==typeof e.history.pushState?e.addEventListener("popstate",w,!1):"#"===I.prefix[0]&&e.addEventListener("hashchange",b,!1),m=!0,t.mount(n,v),b()}return I.set=function(e,t,n){null!=s&&((n=n||{}).replace=!0),s=null,N(e,t,n)},I.get=function(){return l},I.prefix="#!",I.Link={view:function(e){var t,n,a,i=d(e.attrs.selector||"a",T(e.attrs,["options","params","selector","onclick"]),e.children);return(i.attrs.disabled=Boolean(i.attrs.disabled))?(i.attrs.href=null,i.attrs["aria-disabled"]="true"):(t=e.attrs.options,n=e.attrs.onclick,a=x(i.attrs.href,e.attrs.params),i.attrs.href=I.prefix+a,i.attrs.onclick=function(e){var i;"function"==typeof n?i=n.call(e.currentTarget,e):null==n||"object"!=typeof n||"function"==typeof n.handleEvent&&n.handleEvent(e),!1===i||e.defaultPrevented||0!==e.button&&0!==e.which&&1!==e.which||e.currentTarget.target&&"_self"!==e.currentTarget.target||e.ctrlKey||e.metaKey||e.shiftKey||e.altKey||(e.preventDefault(),e.redraw=!1,I.set(a,null,t))}),i}},I.param=function(e){return r&&null!=e?r[e]:r},I}("undefined"!=typeof window?window:null,b),j=function(){return u.apply(this,arguments)};j.m=u,j.trust=u.trust,j.fragment=u.fragment,j.Fragment="[",j.mount=b.mount,j.route=_,j.render=y,j.redraw=b.redraw,j.request=N.request,j.jsonp=N.jsonp,j.parseQueryString=$,j.buildQueryString=w,j.parsePathname=C,j.buildPathname=x,j.vnode=n,j.PromisePolyfill=v,j.censor=T;var O=j;const L=()=>"idxxxxxxxx".replace(/[x]/g,()=>(16*Math.random()|0).toString(16)),V=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}),D=(...e)=>t=>e.reduceRight((e,t)=>t(e),t),R=e=>t=>Array.prototype.map.call(t,e),z=e=>t=>Array.prototype.join.call(t,e),P=e=>e.replace(/([A-Z])/g,e=>"-"+e.toLowerCase()),F=e=>e?D(z(""),R(t=>`[${P(t)}="${((e="")=>e.toString().replace(/"/g,"""))(e[t])}"]`),Object.keys)(e):"",U=["min","max","minLength","maxLength","rows","cols","placeholder","autocomplete","pattern","readOnly","step"],q=e=>U.indexOf(e)>=0,K=({disabled:e})=>e?"[disabled]":"",B=({required:e,isMandatory:t})=>e||t?"[required][aria-required=true]":"",H=e=>(e=>{const t=(n=e,e=>void 0!==n[e]);var n;return Object.keys(e).filter(q).filter(t).reduce((t,n)=>{const a=e[n];return t.push(`[${n.toLowerCase()}=${a}]`),t},[]).join("")})(e)+(e=>e.maxLength?`[data-length=${e.maxLength}]`:"")(e)+K(e)+B(e)+(({autofocus:e})=>"boolean"==typeof e&&e||e&&e()?"[autofocus]":"")(e),J=e=>!isNaN(parseFloat(e))&&isFinite(e),Y=(...e)=>t=>e.reduce((e,t)=>t(e),t),Q=(e,t=2,n="0")=>(e+="").length>=t?e:new Array(t-e.length+1).join(n)+e,Z=(e,t,n)=>{const a=e[t];e[t]=e[n],e[n]=a},G=(e,t,n)=>{const a=e[t];e.splice(t,1),e.splice(n,0,a)};function W(){return W=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},W.apply(this,arguments)}function X(e,t){if(null==e)return{};var n,a,i={},o=Object.keys(e);for(a=0;a<o.length;a++)t.indexOf(n=o[a])>=0||(i[n]=e[n]);return i}const ee=["label","id","isMandatory","isActive"],te={view:({attrs:e})=>O("span.mandatory",e,"*")},ne=()=>({view:e=>{let{attrs:{label:t,id:n,isMandatory:a,isActive:i}}=e,o=X(e.attrs,ee);return t?O(`label${i?".active":""}${n?`[for=${n}]`:""}`,o,[O.trust(t),a?O(te):void 0]):void 0}}),ae=()=>({view:({attrs:{helperText:e,dataError:t,dataSuccess:n}})=>{const a=t||n?F({dataError:t,dataSuccess:n}):"";return e||a?O(`span.helper-text${a}`,e?O.trust(e):""):void 0}}),ie=()=>{const e={id:L()};return{view:({attrs:t})=>{const n=t.id||e.id,a=H(t),{label:i,helperText:o,initialValue:r,onchange:l,newRow:s,className:c="col s12",style:d,iconName:u,isMandatory:f}=t;return O(".input-field"+(s?".clear":""),{className:c,style:d},[u?O("i.material-icons.prefix",u):"",O(`input.autocomplete[type=text][tabindex=0][id=${n}]${a}`,{oncreate:({dom:e})=>{M.Autocomplete.init(e,t)},onchange:l?e=>{e.target&&e.target.value&&l(e.target.value)}:void 0,value:r}),O(ne,{label:i,id:n,isMandatory:f,isActive:r}),O(ae,{helperText:o})])}}},oe=["iconName"],re=()=>({view:e=>{let{attrs:{iconName:t}}=e,n=X(e.attrs,oe);return O("i.material-icons",n,t)}}),le=["modalId","tooltip","tooltipPostion","iconName","iconClass","label","attr"],se=(e,t="")=>()=>{const n=`${e}${t}`;return{view:({attrs:e})=>{const{modalId:t,tooltip:a,tooltipPostion:i,iconName:o,iconClass:r,label:l,attr:s}=e,c=X(e,le);return O(`${n}${t?`.modal-trigger[href=#${t}]`:""}${a?`.tooltipped[data-position=${i||"top"}][data-tooltip=${a}]`:""}${F(s)}`,c,o?O(re,{iconName:o,className:r||"left"}):void 0,l||void 0)}}},ce=se("a.waves-effect.waves-light.btn"),de=se("a.waves-effect.waves-light.btn-large"),ue=se("a.waves-effect.waves-light.btn-small"),fe=se("a.waves-effect.waves-teal.btn-flat"),me=se("button.btn-floating.btn-large.waves-effect.waves-light"),pe=se("button.btn.waves-effect.waves-light","[type=submit]"),he=()=>({view:({attrs:{href:e,src:t}})=>O("a.carousel-item",{href:e},O(`img[src=${t}]`))}),ve=()=>({view:({attrs:e})=>{const{items:t}=e;return t&&t.length>0?O(".carousel",{oncreate:({dom:t})=>{M.Carousel.init(t,e)}},t.map(e=>O(he,e))):void 0}}),ge=()=>({oncreate:({attrs:e,dom:t})=>{const{onchange:n,onChipAdd:a,onChipDelete:i}=e,o=M.Chips.getInstance(t.children[0]),r=a?a.bind(o):void 0;e.onChipAdd=function(e,t){n&&n(this.chipsData),r&&r(e,t)};const l=i?i.bind(o):void 0;e.onChipDelete=function(e,t){n&&n(this.chipsData),l&&l(e,t)},M.Chips.init(t.children[0],e)},onupdate:({dom:e,attrs:{data:t}})=>{if(!t||0===t.length)return;const n=M.Chips.getInstance(e.children[0]);t.forEach(e=>n.addChip(e))},view:({attrs:{placeholder:e,required:t,isMandatory:n=t,data:a,className:i="col s12",label:o,helperText:r}})=>O(".input-field",{className:i},[O(`.chips.chips-autocomplete${e?".chips-placeholder":""}${a?".chips-initial":""}`),o?O(ne,{label:o,isMandatory:n,className:"active"}):void 0,r?O(ae,{helperText:r}):void 0])}),ye=()=>({view:({attrs:e})=>{const{newRow:t,code:n,language:a}=e,i=a||"lang-TypeScript",o=i.replace("lang-",""),r=n instanceof Array?n.join("\n"):n;return O("pre.codeblock"+(t?".clear":""),e,[O("div",O("label",o)),O(`code.${i}`,r)])}}),be=()=>({view:({attrs:{header:e,body:t,active:n,iconName:a}})=>O(n?"li.active":"li",[e||a?O(".collapsible-header",[a?O("i.material-icons",a):void 0,e?"string"==typeof e?O("span",e):e:void 0]):void 0,t?O(".collapsible-body",t):void 0])}),we=()=>({oncreate:({dom:e,attrs:t})=>{M.Collapsible.init(e,t)},view:({attrs:e})=>{const{items:t,class:n,className:a,style:i,id:o}=e;return t&&t.length>0?O("ul.collapsible",{class:n||a,style:i,id:o},t.map(e=>O(be,e))):void 0}}),ke=["header","items","mode"],xe=["title","active","href"],Ne=["items","header"],Ie=["items","header","mode"];var $e;!function(e){e[e.BASIC=0]="BASIC",e[e.LINKS=1]="LINKS",e[e.AVATAR=2]="AVATAR"}($e||($e={}));const Ce=e=>e&&/https?:\/\//.test(e),Se=()=>({view:({attrs:e})=>{const{href:t,iconName:n="send",onclick:a,style:i={cursor:"pointer"}}=e,o={href:t,style:i,className:"secondary-content",onclick:a?()=>a(e):void 0};return Ce(t)||!t?O("a[target=_]",o,O(re,{iconName:n})):O(O.route.Link,o,O(re,{iconName:n}))}}),Te=(e="")=>/\./.test(e),Ae=()=>({view:({attrs:{item:e,mode:t}})=>{const{title:n,content:a="",active:i,iconName:o,avatar:r,className:l,onclick:s}=e;return t===$e.AVATAR?O("li.collection-item.avatar"+(i?".active":""),{onclick:s?()=>s(e):void 0},[Te(r)?O("img.circle",{src:r}):O("i.material-icons.circle",{className:l},r),O("span.title",n),O("p",O.trust(a)),O(Se,e)]):O("li.collection-item"+(i?".active":""),o?O("div",[n,O(Se,e)]):n)}}),Me=()=>({view:e=>{let{attrs:{header:t,items:n,mode:a=$e.BASIC}}=e,i=X(e.attrs,ke);const o=n.map(e=>O(Ae,{key:e.id,item:e,mode:a}));return t?O("ul.collection.with-header",i,[O("li.collection-header",O("h4",t)),o]):O("ul.collection",i,o)}}),Ee=()=>({view:({attrs:{item:e}})=>{const{title:t,active:n,href:a}=e,i=W({},X(e,xe),{className:"collection-item "+(n?"active":""),href:a});return Ce(a)||!a?O("a[target=_]",i,t):O(O.route.Link,i,t)}}),_e=()=>({view:e=>{let{attrs:{items:t,header:n}}=e,a=X(e.attrs,Ne);return n?O(".collection.with-header",a,[O(".collection-header",O("h4",n)),t.map(e=>O(Ee,{key:e.id,item:e}))]):O(".collection",a,t.map(e=>O(Ee,{key:e.id,item:e})))}}),je=()=>({view:e=>{let{attrs:{items:t,header:n,mode:a=$e.BASIC}}=e,i=X(e.attrs,Ie);return n||t&&t.length>0?a===$e.LINKS?O(_e,W({header:n,items:t},i)):O(Me,W({header:n,items:t,mode:a},i)):void 0}}),Oe=["key","label","onchange","disabled","items","iconName","helperText","style","className"],Le=()=>{const e={};return{oninit:({attrs:{id:t=L(),initialValue:n,checkedId:a}})=>{e.id=t,e.initialValue=n||a},view:t=>{let{attrs:{key:n,label:a,onchange:i,disabled:o=!1,items:r,iconName:l,helperText:s,style:c,className:d="col s12"}}=t,u=X(t.attrs,Oe);const{id:f,initialValue:m}=e,p=m?r.filter(e=>e.id?e.id===m:e.label===m).shift():void 0,h=p?p.label:a||"Select";return O(".input-field",{className:d,key:n,style:c},[l?O("i.material-icons.prefix",l):void 0,O(ae,{helperText:s}),O(`a.dropdown-trigger.btn.truncate[href=#][data-target=${f}]${o?"[disabled]":""}`,{className:"col s12",style:c||(l?"margin: 0.2em 0 0 3em;":void 0),oncreate:({dom:e})=>{M.Dropdown.init(e,u)}},h),O(`ul.dropdown-content[id=${f}]`,r.map(t=>O("li"+(t.divider?".divider[tabindex=-1]":""),t.divider?void 0:O("a",{onclick:i?()=>{e.initialValue=t.id||t.label,i(e.initialValue)}:void 0},[t.iconName?O("i.material-icons",t.iconName):void 0,t.label]))))])}}},Ve=["className","iconName","iconClass","position","style","buttons"],De=()=>({view:e=>{let{attrs:{className:t,iconName:n,iconClass:a="large",position:i,style:o=("left"===i||"inline-left"===i?"position: absolute; display: inline-block; left: 24px;":"right"===i||"inline-right"===i?"position: absolute; display: inline-block; right: 24px;":void 0),buttons:r}}=e,l=X(e.attrs,Ve);const s=O(".fixed-action-btn",{style:o,oncreate:({dom:e})=>M.FloatingActionButton.init(e,l)},[O("a.btn-floating.btn-large",{className:t},O("i.material-icons",{classNames:a},n)),r?O("ul",r.map(e=>O("li",O("a.btn-floating",{className:e.className,onclick:t=>e.onClick&&e.onClick(t)},O("i.material-icons",{className:e.iconClass},e.iconName))))):void 0]);return"inline-right"===i||"inline-left"===i?O("div",{style:"position: relative; height: 70px;"},s):s}}),Re=["className","helperText","iconName","id","initialValue","isMandatory","label","onchange","style"],ze=["className","dataError","dataSuccess","helperText","iconName","id","initialValue","isMandatory","label","maxLength","newRow","onchange","onkeydown","onkeypress","onkeyup","style","validate"],Pe=()=>{const t={id:L()};return{view:({attrs:n})=>{const{className:a="col s12",helperText:i,iconName:o,id:r=t.id,initialValue:l,isMandatory:s,label:c,onchange:d,style:u}=n,f=X(n,Re),m=H(f);return O(".input-field",{className:a,style:u},[o?O("i.material-icons.prefix",o):"",O(`textarea.materialize-textarea[tabindex=0][id=${r}]${m}`,{oncreate:({dom:t})=>{e.textareaAutoResize(t),n.maxLength&&e.CharacterCounter.init(t)},onchange:d?e=>{const t=e.target;d(t&&"string"==typeof t.value?t.value:"")}:void 0,value:l}),O(ne,{label:c,id:r,isMandatory:s,isActive:l||n.placeholder}),O(ae,{helperText:i})])}}},Fe=(t,n="")=>()=>{const a={id:L()},i=e=>{const n=e.value;return!n||"number"!==t&&"range"!==t?n:+n},o=(e,t)=>{e.setCustomValidity("boolean"==typeof t?t?"":"Custom validation failed":t)};return{view:({attrs:r})=>{const{className:l="col s12",dataError:s,dataSuccess:c,helperText:d,iconName:u,id:f=a.id,initialValue:m,isMandatory:p,label:h,maxLength:v,newRow:g,onchange:y,onkeydown:b,onkeypress:w,onkeyup:k,style:x,validate:N}=r,I=X(r,ze),$=H(I);return O(`.input-field${g?".clear":""}${n}`,{className:l,style:x},[u?O("i.material-icons.prefix",u):void 0,O(`input.validate[type=${t}][tabindex=0][id=${f}]${$}`,{oncreate:({dom:n})=>{(({autofocus:e})=>!!e&&("boolean"==typeof e?e:e()))(r)&&n.focus(),v&&e.CharacterCounter.init(n),"range"===t&&e.Range.init(n)},onkeyup:k?e=>{k(e,i(e.target))}:void 0,onkeydown:b?e=>{b(e,i(e.target))}:void 0,onkeypress:w?e=>{w(e,i(e.target))}:void 0,onupdate:N?({dom:e})=>{const t=e;o(t,N(i(t),t))}:void 0,onchange:e=>{const t=e.target;if(t){const e=i(t);y&&y(e),N&&o(t,N(e,t))}},value:m}),O(ne,{label:h,id:f,isMandatory:p,isActive:!(void 0===m&&!r.placeholder&&"number"!==t&&"color"!==t&&"range"!==t)}),O(ae,{helperText:d,dataError:s,dataSuccess:c})])}}},Ue=Fe("text"),qe=Fe("password"),Ke=Fe("number"),Be=Fe("url"),He=Fe("color"),Je=Fe("range",".range-field"),Ye=Fe("email"),Qe=()=>{let e,t=!1;return{view:({attrs:n})=>{const{multiple:a,disabled:i,initialValue:o,placeholder:r,onchange:l,className:s="col s12",accept:c,label:d="File"}=n,u=c?c instanceof Array?c.join(", "):c:void 0,f=u?`[accept=${u}]`:"",m=a?"[multiple]":"",p=i?"[disabled]":"",h=r?`[placeholder=${r}]`:"";return O(".file-field.input-field",{className:n.class||s},[O(".btn",[O("span",d),O(`input[type=file]${m}${p}${f}`,{onchange:l?e=>{const n=e.target;n&&n.files&&l&&(t=!0,l(n.files))}:void 0})]),O(".file-path-wrapper",O(`input.file-path.validate${h}[type=text]`,{oncreate:({dom:t})=>{e=t,o&&(e.value=o)}})),(t||o)&&O("a.waves-effect.waves-teal.btn-flat",{style:"float: right;position: relative;top: -3rem; padding: 0",onclick:()=>{t=!1,e.value="",l&&l({})}},O("i.material-icons","clear"))])}}},Ze=["label","helperText","initialValue","newRow","className","iconName","isMandatory","onchange","disabled"],Ge=["label","helperText","initialValue","newRow","className","iconName","isMandatory","onchange","disabled"],We=()=>{const e={id:L()};return{view:t=>{let{attrs:{label:n,helperText:a,initialValue:i,newRow:o,className:r="col s12",iconName:l,isMandatory:s,onchange:c,disabled:d}}=t,u=X(t.attrs,Ze);const f=e.id,m=H(u),p=c?()=>e.dp&&c(e.dp.date):void 0;return O(".input-field"+(o?".clear":""),{className:r,onremove:()=>e.dp&&e.dp.destroy()},[l?O("i.material-icons.prefix",l):"",O(`input.datepicker[type=text][tabindex=0][id=${f}]${m}${d?"[disabled]":""}`,{oncreate:({dom:t})=>{e.dp=M.Datepicker.init(t,W({format:"yyyy/mm/dd",showClearBtn:!0,setDefaultDate:!0,defaultDate:i?new Date(i):new Date},u,{onClose:p}))}}),O(ne,{label:n,id:f,isMandatory:s,isActive:!!i}),O(ae,{helperText:a})])}}},Xe=()=>{const e={id:L()};return{view:t=>{let{attrs:{label:n,helperText:a,initialValue:i,newRow:o,className:r="col s12",iconName:l,isMandatory:s,onchange:c,disabled:d}}=t,u=X(t.attrs,Ge);const f=e.id,m=H(u),p=o?".clear":"",h=new Date,v=c?()=>e.tp&&c(e.tp.time||i||`${h.getHours()}:${h.getMinutes()}`):void 0;return O(`.input-field.timepicker${p}`,{className:r,onremove:()=>e.tp&&e.tp.destroy()},[l?O("i.material-icons.prefix",l):"",O(`input[type=text][tabindex=0][id=${f}]${m}${d?"[disabled]":""}`,{value:i,oncreate:({dom:t})=>{e.tp=M.Timepicker.init(t,W({twelveHour:!1,showClearBtn:!0,defaultTime:i},u,{onCloseEnd:v}))}}),O(ne,{label:n,id:f,isMandatory:s,isActive:i}),O(ae,{helperText:a})])}}},et=()=>({view:({attrs:{className:e="col s12",onchange:t,label:n,checked:a,disabled:i}})=>O("div",{className:e},O("label",[O(`input[type=checkbox][tabindex=0]${a?"[checked]":""}${i?"[disabled]":""}`,{onclick:t?e=>{e.target&&void 0!==e.target.checked&&t(e.target.checked)}:void 0}),n?"string"==typeof n?O("span",n):n:void 0]))}),tt=()=>{const e={},t=t=>e.checkedIds.indexOf(t)>=0;return{oninit:({attrs:{initialValue:t,checkedId:n}})=>{const a=n||t;e.checkedId=n,e.checkedIds=a?a instanceof Array?[...a]:[a]:[]},view:({attrs:{label:n,id:a,options:i,checkedId:o,description:r,className:l="col s12",disabled:s,checkboxClass:c,newRow:d,isMandatory:u,onchange:f}})=>{o&&e.checkedId!==o&&(e.checkedId=o,e.checkedIds=o instanceof Array?o:[o]);const m=f?(t,n)=>{const a=e.checkedIds.filter(e=>e!==t);n&&a.push(t),e.checkedIds=a,f(a)}:void 0;return O("div"+(d?".clear":""),{className:l},[O("div",{className:"input-field options"},O(ne,{id:a,label:n,isMandatory:u})),O(ae,{helperText:r}),...i.map(e=>O(et,{disabled:s||e.disabled,label:e.label,onchange:m?t=>m(e.id,t):void 0,className:c,checked:t(e.id)}))])}}},nt=()=>{const e={},t=e=>e.map(e=>e.id).join(""),n=(e,t,n=!1)=>n||(t instanceof Array&&(e||"number"==typeof e)?t.indexOf(e)>=0:t===e);return{oninit:({attrs:{checkedId:n,initialValue:a,options:i}})=>{e.ids=t(i);const o=n||a;e.checkedId=n,e.initialValue=o?o instanceof Array?[...o.filter(e=>null!==e)]:[o]:[]},view:({attrs:{id:a,newRow:i,className:o="col s12",checkedId:r,key:l,options:s,multiple:c,label:d,helperText:u,placeholder:f,isMandatory:m,iconName:p,disabled:h,classes:v,dropdownOptions:g,onchange:y}})=>{e.checkedId!==r&&(e.initialValue=r?r instanceof Array?r:[r]:void 0);const{initialValue:b}=e,w=y?c?()=>{const t=e.instance&&e.instance.getSelectedValues(),n=t?t.length>0&&J(t[0])?t.map(e=>+e):t.filter(e=>null!==e||void 0!==e):void 0;e.initialValue=n||[],y(e.initialValue)}:t=>{if(t&&t.currentTarget){const n=t.currentTarget,a=J(n.value)?+n.value:n.value;e.initialValue=void 0!==typeof a?[a]:[]}e.initialValue&&y(e.initialValue)}:void 0,k=i?".clear":"",x=h?"[disabled]":"",N=c?"[multiple]":"",I=0===s.filter(e=>n(e.id,b)).length;return O(`.input-field.select-space${k}`,{className:o,key:l},[p&&O("i.material-icons.prefix",p),O(`select[id=${a}]${x}${N}`,{oncreate:({dom:t})=>{e.instance=M.FormSelect.init(t,{classes:v,dropdownOptions:g})},onupdate:({dom:n})=>{const a=t(s);let i=r&&e.checkedId!==r.toString();e.ids!==a&&(e.ids=a,i=!0),e.checkedId!==r&&(e.checkedId=r,i=!0),i&&(e.instance=M.FormSelect.init(n,{classes:v,dropdownOptions:g}))},onchange:w},f?O("option[disabled]"+(I?"[selected]":""),f):"",s.map((e,t)=>O(`option[value=${e.id}]${e.title?`[title=${e.title}]`:""}${e.disabled?"[disabled]":""}${n(e.id,b,0===t&&I&&!f)?"[selected]":""}`,e.label.replace("&","&")))),O(ne,{label:d,isMandatory:m}),O(ae,{helperText:u})])}}},at=()=>{const e={groupId:L()};return{oninit:({attrs:{checkedId:t,initialValue:n}})=>{e.oldCheckedId=t,e.checkedId=t||n},view:({attrs:{id:t,checkedId:n,newRow:a,className:i="col s12",label:o="",disabled:r,description:l,options:s,isMandatory:c,checkboxClass:d,onchange:u}})=>{e.oldCheckedId!==n&&(e.oldCheckedId=e.checkedId=n);const{groupId:f,checkedId:m}=e,p=t=>{e.checkedId=t,u&&u(t)};return O(`div${t?`[id=${t}]`:""}${a?".clear":""}`,{className:i},[O("div",{className:"input-field options"},O(ne,{id:t,label:o,isMandatory:c})),l?O("p.helper-text",O.trust(l)):"",...s.map(e=>O(it,W({},e,{onchange:p,groupId:f,disabled:r,className:d,checked:e.id===m})))])}}},it=()=>({view:({attrs:{id:e,groupId:t,label:n,onchange:a,className:i="col s12",checked:o,disabled:r}})=>O("div",{className:i},O("label",[O(`input[type=radio][tabindex=0][name=${t}]${o?"[checked=checked]":""}${r?"[disabled]":""}`,{onclick:a?()=>a(e):void 0}),O("span",O.trust(n))]))}),ot=["component","required","options","autogenerate"],rt=(e,t,n={})=>{let{component:a,required:i,options:o,autogenerate:r}=e,l=X(e,ot);const{containerId:s,autofocus:c,disabled:d=!1,onchange:u,multiline:f,key:m}=n;r&&u&&u("id"===r?L():V(),!1);const p=i?e=>e instanceof Array?e&&e.length>0:void 0!==typeof e:void 0;switch(a){case"text":return O(f?Pe:Ue,W({},l,{key:m,isMandatory:i,validate:p,autofocus:c,disabled:d,onchange:u,initialValue:t}));case"number":return O(Ke,W({},l,{key:m,isMandatory:i,validate:p,autofocus:c,disabled:d,onchange:u,initialValue:t}));case"url":return O(Be,W({},l,{key:m,isMandatory:i,validate:p,autofocus:c,disabled:d,onchange:u,initialValue:t}));case"email":return O(Ye,W({},l,{key:m,isMandatory:i,validate:p,autofocus:c,disabled:d,onchange:u,initialValue:t}));case"checkbox":return O(et,W({},l,{validate:p,disabled:d,onchange:u,checked:t}));case"select":return O(nt,W({},l,{key:m,options:o||[{id:"none",label:"Unspecified"}],disabled:d,isMandatory:i,validate:p,onchange:e=>e&&u&&u(e),checkedId:t}));case"options":return O(tt,W({},l,{key:m,options:o||[{id:"none",label:"Unspecified"}],disabled:d,isMandatory:i,validate:p,onchange:e=>u&&u(e),checkedId:t}));case"radios":return O(at,W({},l,{key:m,options:o||[{id:"none",label:"Unspecified"}],disabled:d,isMandatory:i,validate:p,onchange:e=>e&&u&&u(e),checkedId:t}));case"date":const e=t||new Date;return!t&&u&&u(e),O(We,W({},l,{key:m,isMandatory:i,autofocus:c,disabled:d,onchange:u,initialValue:e,container:s?document.getElementById(s):document.body}));case"time":const n=t||"00:00";return!t&&u&&u(n),O(Xe,W({},l,{key:m,isMandatory:i,autofocus:c,disabled:d,onchange:u,initialValue:n,container:s||document.body.id}));default:return}},lt=()=>{const e={};return{view:({attrs:{el:t=".row",model:n,item:a,containerId:i,disabled:o=!1,editableIds:r=[],onchange:l}})=>(e.item=a,e.model=n,l&&l(!1),O(t,{style:"margin-bottom: -15px;",key:a.id},n.map((t,n)=>rt(t,a[t.id],{containerId:i,autofocus:0===n,disabled:o&&r.indexOf(t.id)<0,onchange:o&&r.indexOf(t.id)<0?void 0:(n,a=!0)=>{(a||void 0===e.item[t.id])&&(e.item[t.id]=n,l&&l((()=>{const{model:t,item:n}=e;return t.filter(e=>e.required).reduce((e,t)=>e&&!(void 0===n[t.id]||n[t.id]instanceof Array&&0===n[t.id].length||"string"==typeof n[t.id]&&0===n[t.id].length),!0)})()))}}))))}},st=()=>({oncreate:({dom:e,attrs:{options:t,onCreate:n}})=>{const a=M.Modal.init(e,t);n&&n(a)},view:({attrs:{id:e,title:t,description:n,fixedFooter:a,bottomSheet:i,buttons:o,richContent:r}})=>O(`.modal${a?".modal-fixed-footer":""}${i?".bottom-sheet":""}[id=${e}]`,[O(".modal-content",[O("h4",t),r&&"string"==typeof n?O.trust(n||""):"string"==typeof n?O("p",n):n]),o?O(".modal-footer",o.map(e=>O(fe,W({},e,{className:"modal-close"})))):void 0])}),ct=()=>{const e={id:L()},t=()=>e.onchange&&e.onchange(e.items),n=(e,t)=>{const{top:n,height:a}=e.getBoundingClientRect();return t.clientY-n<a/2?"above":"below"},a=e=>{const t=e.getAttribute("data-kanban-index");return t?+t:e.parentElement?a(e.parentElement):-1},i=e=>!!/kanban__item/.test(e.className)||!!e.parentElement&&i(e.parentElement),o=e=>/kanban__item/.test(e.className)?e:e.parentElement?o(e.parentElement):null,r=(t,n,a)=>e.moveBetweenList?"above"===t?n:n+1:a<n?"above"===t?n-1:n:"above"===t?n:n-1,l={draggable:!0,ondrop:i=>{i.preventDefault();const{dragIndex:l,moveBetweenList:s,copying:c}=e,d=i.target,u=o(d);if(u){u.classList.remove("kanban__above","kanban__below");const o=n(d,i),f=a(d),m=r(o,f,l);if(m<l&&e.dragIndex++,s&&i.dataTransfer){const t=JSON.parse(i.dataTransfer.getData("application/json"));c&&(t=>{const{model:n}=e;n.filter(e=>e.autogenerate).forEach(({id:e,autogenerate:n})=>{t[e]="id"===n?L():V()})})(t),e.items.splice(m,0,t)}else G(e.items,l,m);t()}},ondragstart:t=>{const n=t.target;if(t.dataTransfer){const{items:i}=e;t.dataTransfer.effectAllowed="copyMove",e.dragIndex=a(n),t.dataTransfer.setData("application/json",JSON.stringify(i[e.dragIndex],null,2))}},ondragover:t=>{t.redraw=!1,t.preventDefault();const l=o(t.target);if(l&&t.dataTransfer){const o=t.getModifierState("Control");l.classList.remove("kanban__above","kanban__below");const s=n(l,t);((t,n)=>{if(!i(t))return!1;const{dragIndex:o,moveBetweenList:l}=e;if(l)return!0;const s=a(t),c=r(n,s,o);return o!==s&&c!==o})(l,s)?(l.classList.add("kanban__"+s),e.copying=o,t.dataTransfer.dropEffect=o?"copy":"move"):t.dataTransfer.dropEffect="none"}},ondragleave:e=>{e.redraw=!1;const t=o(e.target);t&&t.classList.remove("kanban__above","kanban__below")},ondragend:n=>{n.dataTransfer&&"move"===n.dataTransfer.dropEffect&&(e.items.splice(e.dragIndex,1),t())}};return{oninit:({attrs:{items:t=[],canEdit:n=!0,canSort:a=!0,canDrag:i=!1,sortDirection:o="asc",model:r=[],label:l="item",i18n:s={newItem:`New ${l}`,modalDeleteItem:`Delete ${l}`,modalCreateNewItem:`Create new ${l}`,modalEditNewItem:`Edit new ${l}`},containerId:c,editableIds:d=[],fixedFooter:u=!1,moveBetweenList:f=!1}})=>{e.items=t.map(e=>W({},e)),e.model=r,e.i18n=s,e.canEdit=n,e.canSort=a,e.canDrag=i,e.sortDirection=o,e.containerId=c,e.fixedFooter=u,e.editId=`edit_item_${e.id}`,e.deleteId=`delete_item_${e.id}`,e.moveBetweenList=f,e.editableIds=d,e.sortableIds=[{label:"None"},...r.filter(e=>e.label).map(e=>({label:e.label,id:e.id}))]},view:({attrs:{disabled:n,onchange:a}})=>{const{model:i,items:o,canSort:r,sortDirection:s,curSortId:c,i18n:d,containerId:u,fixedFooter:f,canDrag:m,canEdit:p,moveBetweenList:h,sortableIds:v,editableIds:g}=e;if(!i)return;e.onchange=a;const y="asc"===s?1:-1,b=r&&c?o.sort((e,t)=>e[c]>t[c]?y:e[c]<t[c]?-y:0):o;return O(".kanban",[O(".row.kanban__menu",{style:"margin-bottom: 0;"},[p&&!n?O(fe,{label:d.newItem,modalId:e.editId,iconName:"add",onclick:()=>{e.curItem=void 0,e.updatedItem={}}}):void 0,r&&!m&&v&&o.length>1?[O(fe,{iconName:"sort",iconClass:"asc"===s?"left twist":"",className:"right",onclick:()=>{e.sortDirection="asc"===e.sortDirection?"desc":"asc"}}),O(Le,{items:v,checkedId:c,className:"right",style:"margin: 0 auto;",onchange:t=>e.curSortId=t})]:void 0]),O(".row.kanban__items",O(".col.s12",b.length>0||!h?b.map((t,o)=>O(`.card-panel.kanban__item[data-kanban-index=${o}]${n?".disabled":""}`,m&&!n?W({key:t.id},l):{key:t.id},[O(".card-content",O(lt,{model:i,item:t,containerId:u,disabled:!0,editableIds:g,onchange:t=>{e.canSave=t,t&&a&&a(e.items)}})),p&&!n?O(".card-action.row",O(".col.s12",[O(fe,{iconName:"edit",modalId:e.editId,onclick:()=>{e.curItem=t,e.updatedItem=W({},t)}}),O(fe,{iconName:"delete",modalId:e.deleteId,onclick:()=>e.curItem=t})])):void 0])):O(".card-panel.kanban__item",W({},l)))),O(st,{id:e.editId,title:d.modalCreateNewItem,fixedFooter:f,description:e.updatedItem?O(lt,{model:i,item:e.updatedItem||{},containerId:u,onchange:t=>{e.canSave=t}}):void 0,buttons:[{iconName:"cancel",label:"Cancel"},{iconName:"save",label:"Save",disabled:!e.canSave,onclick:()=>{if(e.curItem){const t=e.curItem;i.forEach(n=>{t[n.id]=e.updatedItem[n.id]})}else e.updatedItem&&e.items.push(e.updatedItem);t()}}]}),O(st,{id:e.deleteId,title:d.modalDeleteItem,description:"Are you sure?",buttons:[{label:"No"},{label:"Yes",onclick:()=>{e.items=e.items.filter(t=>t!==e.curItem),t()}}]})])}}},dt=()=>{const e=e=>t.curKey=t.id=e,t={elementId:L(),id:"",curKey:"",kvc:(e,t,n)=>{const{keyClass:a=".col.s4",valueClass:i=".col.s8"}=n,o=t instanceof Array?t.join(", "):"boolean"==typeof t?O(et,{label:" ",checked:t,disabled:!0,className:"checkbox-in-collection"}):t.toString();return{title:O(".row",{style:"margin-bottom: 0"},[O(a,O("b",e)),O(i,o)])}}},n=()=>{t.id="",t.curKey=""};return{oninit:({attrs:{keyValueConverter:e,id:n}})=>{e&&(t.kvc=e),n&&(t.elementId=n)},view:({attrs:{className:a="col s12",disabled:i,disallowArrays:o,header:r,iconName:l,iconNameKey:s=(l?"label":void 0),isMandatory:c,label:d,labelKey:u="Key",labelValue:f="Value",properties:m,keyClass:p,valueClass:h,onchange:v,falsy:g=["false"],truthy:y=["true"]}})=>{const b=()=>v?v(m):void 0,w=((n,a)=>Object.keys(n).map(e=>({key:e,value:n[e]})).map(n=>((n,a)=>{const i=a.onclick;return a.id=a.id||n,a.active=n===t.curKey,a.onclick=i?()=>e(n)&&i(a):()=>e(n),a})(n.key,t.kvc(n.key,n.value,{keyClass:a.keyClass,valueClass:a.valueClass}))))(m,{keyClass:p,valueClass:h}),k=t.curKey,x=m[k],N="boolean"==typeof x||"number"==typeof x?x:x?x instanceof Array?`[${x.join(", ")}]`:x:"",I=t.elementId;return[O(".map-editor",O(".input-field",{className:a,style:"min-height: 1.5em;"},[l?O("i.material-icons.prefix",l):"",O(ne,{label:d,isMandatory:c,isActive:w.length>0}),O(je,{id:I,items:w,mode:$e.LINKS,header:r})])),i?void 0:[O(Ue,{label:u,iconName:s,className:"col s5",initialValue:k,onchange:e=>{t.curKey=e,t.id&&(delete m[t.id],m[e]=x,t.id=e),b()}}),"string"==typeof N?O(Pe,{label:f,initialValue:N,className:"col s7",onchange:e=>{const t=(a=g,y.indexOf(n=e)>=0||!(a.indexOf(n)>=0)&&void 0);var n,a;const i=void 0===t&&/^\s*\d+\s*$/i.test(e)?+e:void 0;m[k]="boolean"==typeof t?t:"number"==typeof i?i:((e,t=!1)=>{if(t)return e;if(!e)return;const n=/\s*\[(.*)\]\s*/gi.exec(e);return n&&2===n.length?n[1].split(",").map(e=>e.trim()).map(e=>/^\d+$/g.test(e)?+e:e):void 0})(e,o)||e,b()}}):"number"==typeof N?O(Ke,{label:f,initialValue:N,className:"col s7",onchange:e=>{m[k]=e,b()}}):O(et,{label:f,checked:N,className:"input-field col s7",onchange:e=>{m[k]=e,b()}}),O(".col.s12.right-align",[O(fe,{iconName:"add",onclick:n}),O(fe,{iconName:"delete",disabled:!k,onclick:()=>{delete m[k],n(),b()}})])]]}}},ut=()=>({oncreate:({dom:e,attrs:t})=>{M.Materialbox.init(e,t)},view:({attrs:e})=>{const{src:t,width:n,height:a}=e;return O(`img.materialboxed[src=${t}]${n?`[width=${n}]`:""}${a?`[height=${a}]`:""}`,e)}}),ft=()=>({view:({attrs:{title:e,href:t,active:n,disabled:a}})=>O("li",{className:n?"active":a?"disabled":"waves-effect"},"number"==typeof e?O(O.route.Link,{href:t},e):e)}),mt=()=>{const e={pagIndex:0};return{view:({attrs:{items:t,curPage:n=1,size:a=Math.min(9,t.length)}})=>{const{pagIndex:i}=e,o=i*a,r=o+a,l=i>0,s=r<t.length,c=[{title:O("a",{onclick:()=>l&&e.pagIndex--},O("i.material-icons","chevron_left")),disabled:!l},...t.filter((e,t)=>o<=t&&t<r),{title:O("a",{onclick:()=>s&&e.pagIndex++},O("i.material-icons","chevron_right")),disabled:!s}];return O("ul.pagination",c.map((e,t)=>O(ft,W({title:o+t},e,{active:o+t===n}))))}}},pt=()=>({oncreate:({dom:e,attrs:t})=>{M.Parallax.init(e,t)},view:({attrs:{src:e}})=>e?O(".parallax-container",O(".parallax",O(`img[src=${e}]`))):void 0}),ht=()=>{const e={id:L()};return{view:({attrs:t})=>{const n=t.id||e.id,{label:a,left:i,right:o,disabled:r,newRow:l,onchange:s,checked:c,isMandatory:d,className:u="col s12"}=t;return O("div"+(l?".clear":""),{className:u},[a?O(ne,{label:a||"",id:n,isMandatory:d}):void 0,O(".switch",O("label",[i||"Off",O(`input[id=${n}][type=checkbox]${K({disabled:r})}${c?"[checked]":""}`,{onclick:s?e=>{e.target&&void 0!==e.target.checked&&s(e.target.checked)}:void 0}),O("span.lever"),o||"On"]))])}}},vt=()=>{const e={},t=(e,t)=>t||e.replace(/ /g,"").toLowerCase();return{view:({attrs:{tabWidth:n,selectedTabId:a,tabs:i,className:o,style:r,duration:l,onShow:s,swipeable:c,responsiveThreshold:d}})=>{const u=i.filter(e=>e.active).shift(),f=a||(u?t(u.title,u.id):"");return O(".row",[O(".col.s12",O("ul.tabs"+("fill"===n?".tabs-fixed-width":""),{className:o,style:r,oncreate:({dom:t})=>{e.instance=M.Tabs.init(t,{duration:l,onShow:s,responsiveThreshold:d,swipeable:c})},onupdate:()=>{if(f){const e=document.getElementById(`tab_${f}`);e&&e.click()}},onremove:()=>e.instance.destroy()},i.map(({className:e,title:a,id:o,active:r,disabled:l,target:s,href:c})=>O(`li.tab${l?".disabled":""}${"fixed"===n?`.col.s${Math.floor(12/i.length)}`:""}`,{className:e},O(`a[id=tab_${t(a,o)}]${r?".active":""}`,{target:s,href:c||`#${t(a,o)}`},a))))),i.filter(({href:e})=>void 0===e).map(({id:e,title:n,vnode:a,contentClass:i})=>O(`.col.s12[id=${t(n,e)}]`,{className:i},a))])}}},gt=()=>({view:({attrs:{id:e,title:t,datetime:n,active:a,content:i,iconName:o,dateFormatter:r,timeFormatter:l,onSelect:s}})=>O(`li${a?".active":""}${e?`[id=${e}]`:""}`,{onclick:s?()=>s({id:e,title:t,datetime:n,active:a,content:i}):void 0,style:s?"cursor: pointer;":void 0},[O(".mm_time",{datetime:n},[O("span",r(n)),O("span",l(n))]),o?O(".mm_icon",O("i.material-icons",o)):void 0,O(".mm_label",[t?"string"==typeof t?O("h5",t):t:void 0,i?"string"==typeof i?O("p",i):i:void 0])])}),yt=()=>{const e=e=>`${e.getUTCDate()}/${e.getUTCMonth()+1}/${e.getUTCFullYear()}`,t=e=>`${Q(e.getUTCHours())}:${Q(e.getUTCMinutes())}`;return{view:({attrs:{items:n,onSelect:a,timeFormatter:i=t,dateFormatter:o=e}})=>O("ul.mm_timeline",n.map(e=>O(gt,W({onSelect:a,dateFormatter:o,timeFormatter:i},e))))}};export{Ee as AnchorItem,ie as Autocomplete,ce as Button,se as ButtonFactory,ve as Carousel,he as CarouselItem,ge as Chips,ye as CodeBlock,we as Collapsible,be as CollapsibleItem,je as Collection,$e as CollectionMode,He as ColorInput,We as DatePicker,Le as Dropdown,Ye as EmailInput,Qe as FileInput,fe as FlatButton,De as FloatingActionButton,ae as HelperText,re as Icon,et as InputCheckbox,ct as Kanban,ne as Label,de as LargeButton,lt as LayoutForm,Ae as ListItem,te as Mandatory,dt as MapEditor,ut as MaterialBox,st as ModalPanel,Ke as NumberInput,tt as Options,mt as Pagination,pt as Parallax,qe as PasswordInput,it as RadioButton,at as RadioButtons,Je as RangeInput,me as RoundIconButton,Se as SecondaryContent,nt as Select,ue as SmallButton,pe as SubmitButton,ht as Switch,vt as Tabs,Pe as TextArea,Ue as TextInput,Xe as TimePicker,yt as Timeline,Be as UrlInput,P as camelToSnake,D as compose,K as disable,rt as fieldToComponent,J as isNumeric,z as join,R as map,G as move,Q as padLeft,Y as pipe,B as req,Z as swap,F as toAttributeString,H as toAttrs,L as uniqueId,V as uuid4};
|
|
1
|
+
import e from"mithril";import t from"materialize-css";const a=()=>"idxxxxxxxx".replace(/[x]/g,()=>(16*Math.random()|0).toString(16)),i=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}),l=(...e)=>t=>e.reduceRight((e,t)=>t(e),t),n=e=>t=>Array.prototype.map.call(t,e),o=e=>t=>Array.prototype.join.call(t,e),s=e=>e.replace(/([A-Z])/g,e=>"-"+e.toLowerCase()),r=e=>e?l(o(""),n(t=>`[${s(t)}="${((e="")=>e.toString().replace(/"/g,"""))(e[t])}"]`),Object.keys)(e):"",c=["min","max","minLength","maxLength","rows","cols","placeholder","autocomplete","pattern","readOnly","step"],d=e=>c.indexOf(e)>=0,m=({disabled:e})=>e?"[disabled]":"",p=({required:e,isMandatory:t})=>e||t?"[required][aria-required=true]":"",u=e=>(e=>{const t=(a=e,e=>void 0!==a[e]);var a;return Object.keys(e).filter(d).filter(t).reduce((t,a)=>{const i=e[a];return t.push(`[${a.toLowerCase()}=${i}]`),t},[]).join("")})(e)+(e=>e.maxLength?`[data-length=${e.maxLength}]`:"")(e)+m(e)+p(e)+(({autofocus:e})=>"boolean"==typeof e&&e||e&&e()?"[autofocus]":"")(e),h=e=>!isNaN(parseFloat(e))&&isFinite(e),v=(...e)=>t=>e.reduce((e,t)=>t(e),t),b=(e,t=2,a="0")=>(e+="").length>=t?e:new Array(t-e.length+1).join(a)+e,g=(e,t,a)=>{const i=e[t];e[t]=e[a],e[a]=i},y=(e,t,a)=>{const i=e[t];e.splice(t,1),e.splice(a,0,i)};function f(){return f=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var i in a)Object.prototype.hasOwnProperty.call(a,i)&&(e[i]=a[i])}return e},f.apply(this,arguments)}function x(e,t){if(null==e)return{};var a,i,l={},n=Object.keys(e);for(i=0;i<n.length;i++)t.indexOf(a=n[i])>=0||(l[a]=e[a]);return l}const w=["label","id","isMandatory","isActive"],k={view:({attrs:t})=>e("span.mandatory",t,"*")},N=()=>({view:t=>{let{attrs:{label:a,id:i,isMandatory:l,isActive:n}}=t,o=x(t.attrs,w);return a?e(`label${n?".active":""}${i?`[for=${i}]`:""}`,o,[e.trust(a),l?e(k):void 0]):void 0}}),$=()=>({view:({attrs:{helperText:t,dataError:a,dataSuccess:i}})=>{const l=a||i?r({dataError:a,dataSuccess:i}):"";return t||l?e(`span.helper-text${l}`,t?e.trust(t):""):void 0}}),C=()=>{const t={id:a()};return{view:({attrs:a})=>{const i=a.id||t.id,l=u(a),{label:n,helperText:o,initialValue:s,onchange:r,newRow:c,className:d="col s12",style:m,iconName:p,isMandatory:h}=a;return e(".input-field"+(c?".clear":""),{className:d,style:m},[p?e("i.material-icons.prefix",p):"",e(`input.autocomplete[type=text][tabindex=0][id=${i}]${l}`,{oncreate:({dom:e})=>{M.Autocomplete.init(e,a)},onchange:r?e=>{e.target&&e.target.value&&r(e.target.value)}:void 0,value:s}),e(N,{label:n,id:i,isMandatory:h,isActive:s}),e($,{helperText:o})])}}},I=["iconName"],A=()=>({view:t=>{let{attrs:{iconName:a}}=t,i=x(t.attrs,I);return e("i.material-icons",i,a)}}),T=["modalId","tooltip","tooltipPostion","iconName","iconClass","label","attr"],V=(t,a="")=>()=>{const i=`${t}${a}`;return{view:({attrs:t})=>{const{modalId:a,tooltip:l,tooltipPostion:n,iconName:o,iconClass:s,label:c,attr:d}=t,m=x(t,T);return e(`${i}${a?`.modal-trigger[href=#${a}]`:""}${l?`.tooltipped[data-position=${n||"top"}][data-tooltip=${l}]`:""}${r(d)}`,m,o?e(A,{iconName:o,className:s||"left"}):void 0,c||void 0)}}},S=V("a.waves-effect.waves-light.btn"),O=V("a.waves-effect.waves-light.btn-large"),R=V("a.waves-effect.waves-light.btn-small"),L=V("a.waves-effect.waves-teal.btn-flat"),j=V("button.btn-floating.btn-large.waves-effect.waves-light"),F=V("button.btn.waves-effect.waves-light","[type=submit]"),D=()=>({view:({attrs:{href:t,src:a}})=>e("a.carousel-item",{href:t},e(`img[src=${a}]`))}),K=()=>({view:({attrs:t})=>{const{items:a}=t;return a&&a.length>0?e(".carousel",{oncreate:({dom:e})=>{M.Carousel.init(e,t)}},a.map(t=>e(D,t))):void 0}}),_=()=>({oncreate:({attrs:e,dom:t})=>{const{onchange:a,onChipAdd:i,onChipDelete:l}=e,n=M.Chips.getInstance(t.children[0]),o=i?i.bind(n):void 0;e.onChipAdd=function(e,t){a&&a(this.chipsData),o&&o(e,t)};const s=l?l.bind(n):void 0;e.onChipDelete=function(e,t){a&&a(this.chipsData),s&&s(e,t)},M.Chips.init(t.children[0],e)},onupdate:({dom:e,attrs:{data:t}})=>{if(!t||0===t.length)return;const a=M.Chips.getInstance(e.children[0]);t.forEach(e=>a.addChip(e))},view:({attrs:{placeholder:t,required:a,isMandatory:i=a,data:l,className:n="col s12",label:o,helperText:s}})=>e(".input-field",{className:n},[e(`.chips.chips-autocomplete${t?".chips-placeholder":""}${l?".chips-initial":""}`),o?e(N,{label:o,isMandatory:i,className:"active"}):void 0,s?e($,{helperText:s}):void 0])}),B=()=>({view:({attrs:t})=>{const{newRow:a,code:i,language:l}=t,n=l||"lang-TypeScript",o=n.replace("lang-",""),s=i instanceof Array?i.join("\n"):i;return e("pre.codeblock"+(a?".clear":""),t,[e("div",e("label",o)),e(`code.${n}`,s)])}}),E=()=>({view:({attrs:{header:t,body:a,active:i,iconName:l}})=>e(i?"li.active":"li",[t||l?e(".collapsible-header",[l?e("i.material-icons",l):void 0,t?"string"==typeof t?e("span",t):t:void 0]):void 0,a?e(".collapsible-body",a):void 0])}),q=()=>({oncreate:({dom:e,attrs:t})=>{M.Collapsible.init(e,t)},view:({attrs:t})=>{const{items:a,class:i,className:l,style:n,id:o}=t;return a&&a.length>0?e("ul.collapsible",{class:i||l,style:n,id:o},a.map(t=>e(E,t))):void 0}}),P=["header","items","mode"],U=["title","active","href"],z=["items","header"],H=["items","header","mode"];var W;!function(e){e[e.BASIC=0]="BASIC",e[e.LINKS=1]="LINKS",e[e.AVATAR=2]="AVATAR"}(W||(W={}));const Y=e=>e&&/https?:\/\//.test(e),Z=()=>({view:({attrs:t})=>{const{href:a,iconName:i="send",onclick:l,style:n={cursor:"pointer"}}=t,o={href:a,style:n,className:"secondary-content",onclick:l?()=>l(t):void 0};return Y(a)||!a?e("a[target=_]",o,e(A,{iconName:i})):e(e.route.Link,o,e(A,{iconName:i}))}}),G=(e="")=>/\./.test(e),J=()=>({view:({attrs:{item:t,mode:a}})=>{const{title:i,content:l="",active:n,iconName:o,avatar:s,className:r,onclick:c}=t;return a===W.AVATAR?e("li.collection-item.avatar"+(n?".active":""),{onclick:c?()=>c(t):void 0},[G(s)?e("img.circle",{src:s}):e("i.material-icons.circle",{className:r},s),e("span.title",i),e("p",e.trust(l)),e(Z,t)]):e("li.collection-item"+(n?".active":""),o?e("div",[i,e(Z,t)]):i)}}),Q=()=>({view:t=>{let{attrs:{header:a,items:i,mode:l=W.BASIC}}=t,n=x(t.attrs,P);const o=i.map(t=>e(J,{key:t.id,item:t,mode:l}));return a?e("ul.collection.with-header",n,[e("li.collection-header",e("h4",a)),o]):e("ul.collection",n,o)}}),X=()=>({view:({attrs:{item:t}})=>{const{title:a,active:i,href:l}=t,n=f({},x(t,U),{className:"collection-item "+(i?"active":""),href:l});return Y(l)||!l?e("a[target=_]",n,a):e(e.route.Link,n,a)}}),ee=()=>({view:t=>{let{attrs:{items:a,header:i}}=t,l=x(t.attrs,z);return i?e(".collection.with-header",l,[e(".collection-header",e("h4",i)),a.map(t=>e(X,{key:t.id,item:t}))]):e(".collection",l,a.map(t=>e(X,{key:t.id,item:t})))}}),te=()=>({view:t=>{let{attrs:{items:a,header:i,mode:l=W.BASIC}}=t,n=x(t.attrs,H);return i||a&&a.length>0?l===W.LINKS?e(ee,f({header:i,items:a},n)):e(Q,f({header:i,items:a,mode:l},n)):void 0}}),ae=["key","label","onchange","disabled","items","iconName","helperText","style","className"],ie=()=>{const t={};return{oninit:({attrs:{id:e=a(),initialValue:i,checkedId:l}})=>{t.id=e,t.initialValue=i||l},view:a=>{let{attrs:{key:i,label:l,onchange:n,disabled:o=!1,items:s,iconName:r,helperText:c,style:d,className:m="col s12"}}=a,p=x(a.attrs,ae);const{id:u,initialValue:h}=t,v=h?s.filter(e=>e.id?e.id===h:e.label===h).shift():void 0,b=v?v.label:l||"Select";return e(".input-field",{className:m,key:i,style:d},[r?e("i.material-icons.prefix",r):void 0,e($,{helperText:c}),e(`a.dropdown-trigger.btn.truncate[href=#][data-target=${u}]${o?"[disabled]":""}`,{className:"col s12",style:d||(r?"margin: 0.2em 0 0 3em;":void 0),oncreate:({dom:e})=>{M.Dropdown.init(e,p)}},b),e(`ul.dropdown-content[id=${u}]`,s.map(a=>e("li"+(a.divider?".divider[tabindex=-1]":""),a.divider?void 0:e("a",{onclick:n?()=>{t.initialValue=a.id||a.label,n(t.initialValue)}:void 0},[a.iconName?e("i.material-icons",a.iconName):void 0,a.label]))))])}}},le=["className","iconName","iconClass","position","style","buttons"],ne=()=>({view:t=>{let{attrs:{className:a,iconName:i,iconClass:l="large",position:n,style:o=("left"===n||"inline-left"===n?"position: absolute; display: inline-block; left: 24px;":"right"===n||"inline-right"===n?"position: absolute; display: inline-block; right: 24px;":void 0),buttons:s}}=t,r=x(t.attrs,le);const c=e(".fixed-action-btn",{style:o,oncreate:({dom:e})=>M.FloatingActionButton.init(e,r)},[e("a.btn-floating.btn-large",{className:a},e("i.material-icons",{classNames:l},i)),s?e("ul",s.map(t=>e("li",e("a.btn-floating",{className:t.className,onclick:e=>t.onClick&&t.onClick(e)},e("i.material-icons",{className:t.iconClass},t.iconName))))):void 0]);return"inline-right"===n||"inline-left"===n?e("div",{style:"position: relative; height: 70px;"},c):c}}),oe=["className","helperText","iconName","id","initialValue","isMandatory","label","onchange","style"],se=["className","dataError","dataSuccess","helperText","iconName","id","initialValue","isMandatory","label","maxLength","newRow","onchange","onkeydown","onkeypress","onkeyup","style","validate"],re=()=>{const i={id:a()};return{view:({attrs:a})=>{const{className:l="col s12",helperText:n,iconName:o,id:s=i.id,initialValue:r,isMandatory:c,label:d,onchange:m,style:p}=a,h=x(a,oe),v=u(h);return e(".input-field",{className:l,style:p},[o?e("i.material-icons.prefix",o):"",e(`textarea.materialize-textarea[tabindex=0][id=${s}]${v}`,{oncreate:({dom:e})=>{t.textareaAutoResize(e),a.maxLength&&t.CharacterCounter.init(e)},onchange:m?e=>{const t=e.target;m(t&&"string"==typeof t.value?t.value:"")}:void 0,value:r}),e(N,{label:d,id:s,isMandatory:c,isActive:r||a.placeholder}),e($,{helperText:n})])}}},ce=(i,l="")=>()=>{const n={id:a()},o=e=>{const t=e.value;return!t||"number"!==i&&"range"!==i?t:+t},s=(e,t)=>{e.setCustomValidity("boolean"==typeof t?t?"":"Custom validation failed":t)};return{view:({attrs:a})=>{const{className:r="col s12",dataError:c,dataSuccess:d,helperText:m,iconName:p,id:h=n.id,initialValue:v,isMandatory:b,label:g,maxLength:y,newRow:f,onchange:w,onkeydown:k,onkeypress:C,onkeyup:M,style:I,validate:A}=a,T=x(a,se),V=u(T);return e(`.input-field${f?".clear":""}${l}`,{className:r,style:I},[p?e("i.material-icons.prefix",p):void 0,e(`input.validate[type=${i}][tabindex=0][id=${h}]${V}`,{oncreate:({dom:e})=>{(({autofocus:e})=>!!e&&("boolean"==typeof e?e:e()))(a)&&e.focus(),y&&t.CharacterCounter.init(e),"range"===i&&t.Range.init(e)},onkeyup:M?e=>{M(e,o(e.target))}:void 0,onkeydown:k?e=>{k(e,o(e.target))}:void 0,onkeypress:C?e=>{C(e,o(e.target))}:void 0,onupdate:A?({dom:e})=>{const t=e;s(t,A(o(t),t))}:void 0,onchange:e=>{const t=e.target;if(t){const e=o(t);w&&w(e),A&&s(t,A(e,t))}},value:v}),e(N,{label:g,id:h,isMandatory:b,isActive:!(void 0===v&&!a.placeholder&&"number"!==i&&"color"!==i&&"range"!==i)}),e($,{helperText:m,dataError:c,dataSuccess:d})])}}},de=ce("text"),me=ce("password"),pe=ce("number"),ue=ce("url"),he=ce("color"),ve=ce("range",".range-field"),be=ce("email"),ge=()=>{let t,a=!1;return{view:({attrs:i})=>{const{multiple:l,disabled:n,initialValue:o,placeholder:s,onchange:r,className:c="col s12",accept:d,label:m="File"}=i,p=d?d instanceof Array?d.join(", "):d:void 0,u=p?`[accept=${p}]`:"",h=l?"[multiple]":"",v=n?"[disabled]":"",b=s?`[placeholder=${s}]`:"";return e(".file-field.input-field",{className:i.class||c},[e(".btn",[e("span",m),e(`input[type=file]${h}${v}${u}`,{onchange:r?e=>{const t=e.target;t&&t.files&&r&&(a=!0,r(t.files))}:void 0})]),e(".file-path-wrapper",e(`input.file-path.validate${b}[type=text]`,{oncreate:({dom:e})=>{t=e,o&&(t.value=o)}})),(a||o)&&e("a.waves-effect.waves-teal.btn-flat",{style:"float: right;position: relative;top: -3rem; padding: 0",onclick:()=>{a=!1,t.value="",r&&r({})}},e("i.material-icons","clear"))])}}},ye=()=>({view:({attrs:{className:t="col s12",onchange:a,label:i,checked:l,disabled:n}})=>e("div",{className:t},e("label",[e(`input[type=checkbox][tabindex=0]${l?"[checked]":""}${n?"[disabled]":""}`,{onclick:a?e=>{e.target&&void 0!==e.target.checked&&a(e.target.checked)}:void 0}),i?"string"==typeof i?e("span",i):i:void 0]))}),fe=()=>{const t={},a=e=>t.checkedIds.indexOf(e)>=0;return{oninit:({attrs:{initialValue:e,checkedId:a}})=>{const i=a||e;t.checkedId=a,t.checkedIds=i?i instanceof Array?[...i]:[i]:[]},view:({attrs:{label:i,id:l,options:n,checkedId:o,description:s,className:r="col s12",disabled:c,checkboxClass:d,newRow:m,isMandatory:p,onchange:u}})=>{o&&t.checkedId!==o&&(t.checkedId=o,t.checkedIds=o instanceof Array?o:[o]);const h=u?(e,a)=>{const i=t.checkedIds.filter(t=>t!==e);a&&i.push(e),t.checkedIds=i,u(i)}:void 0;return e("div"+(m?".clear":""),{className:r},[e("div",{className:"input-field options"},e(N,{id:l,label:i,isMandatory:p})),e($,{helperText:s}),...n.map(t=>e(ye,{disabled:c||t.disabled,label:t.label,onchange:h?e=>h(t.id,e):void 0,className:d,checked:a(t.id)}))])}}},xe=()=>{const t=e=>i.curKey=i.id=e,i={elementId:a(),id:"",curKey:"",kvc:(t,a,i)=>{const{keyClass:l=".col.s4",valueClass:n=".col.s8"}=i,o=a instanceof Array?a.join(", "):"boolean"==typeof a?e(ye,{label:" ",checked:a,disabled:!0,className:"checkbox-in-collection"}):a.toString();return{title:e(".row",{style:"margin-bottom: 0"},[e(l,e("b",t)),e(n,o)])}}},l=()=>{i.id="",i.curKey=""};return{oninit:({attrs:{keyValueConverter:e,id:t}})=>{e&&(i.kvc=e),t&&(i.elementId=t)},view:({attrs:{className:a="col s12",disabled:n,disallowArrays:o,header:s,iconName:r,iconNameKey:c=(r?"label":void 0),isMandatory:d,label:m,labelKey:p="Key",labelValue:u="Value",properties:h,keyClass:v,valueClass:b,onchange:g,falsy:y=["false"],truthy:f=["true"]}})=>{const x=()=>g?g(h):void 0,w=((e,a)=>Object.keys(e).map(t=>({key:t,value:e[t]})).map(e=>((e,a)=>{const l=a.onclick;return a.id=a.id||e,a.active=e===i.curKey,a.onclick=l?()=>t(e)&&l(a):()=>t(e),a})(e.key,i.kvc(e.key,e.value,{keyClass:a.keyClass,valueClass:a.valueClass}))))(h,{keyClass:v,valueClass:b}),k=i.curKey,$=h[k],C="boolean"==typeof $||"number"==typeof $?$:$?$ instanceof Array?`[${$.join(", ")}]`:$:"",M=i.elementId;return[e(".map-editor",e(".input-field",{className:a,style:"min-height: 1.5em;"},[r?e("i.material-icons.prefix",r):"",e(N,{label:m,isMandatory:d,isActive:w.length>0}),e(te,{id:M,items:w,mode:W.LINKS,header:s})])),n?void 0:[e(de,{label:p,iconName:c,className:"col s5",initialValue:k,onchange:e=>{i.curKey=e,i.id&&(delete h[i.id],h[e]=$,i.id=e),x()}}),"string"==typeof C?e(re,{label:u,initialValue:C,className:"col s7",onchange:e=>{const t=(i=y,f.indexOf(a=e)>=0||!(i.indexOf(a)>=0)&&void 0);var a,i;const l=void 0===t&&/^\s*\d+\s*$/i.test(e)?+e:void 0;h[k]="boolean"==typeof t?t:"number"==typeof l?l:((e,t=!1)=>{if(t)return e;if(!e)return;const a=/\s*\[(.*)\]\s*/gi.exec(e);return a&&2===a.length?a[1].split(",").map(e=>e.trim()).map(e=>/^\d+$/g.test(e)?+e:e):void 0})(e,o)||e,x()}}):"number"==typeof C?e(pe,{label:u,initialValue:C,className:"col s7",onchange:e=>{h[k]=e,x()}}):e(ye,{label:u,checked:C,className:"input-field col s7",onchange:e=>{h[k]=e,x()}}),e(".col.s12.right-align",[e(L,{iconName:"add",onclick:l}),e(L,{iconName:"delete",disabled:!k,onclick:()=>{delete h[k],l(),x()}})])]]}}},we=()=>({oncreate:({dom:e,attrs:t})=>{M.Materialbox.init(e,t)},view:({attrs:t})=>{const{src:a,width:i,height:l}=t;return e(`img.materialboxed[src=${a}]${i?`[width=${i}]`:""}${l?`[height=${l}]`:""}`,t)}}),ke=()=>({oncreate:({dom:e,attrs:{options:t,onCreate:a}})=>{const i=M.Modal.init(e,t);a&&a(i)},view:({attrs:{id:t,title:a,description:i,fixedFooter:l,bottomSheet:n,buttons:o,richContent:s}})=>e(`.modal${l?".modal-fixed-footer":""}${n?".bottom-sheet":""}[id=${t}]`,[e(".modal-content",[e("h4",a),s&&"string"==typeof i?e.trust(i||""):"string"==typeof i?e("p",i):i]),o?e(".modal-footer",o.map(t=>e(L,f({},t,{className:"modal-close"})))):void 0])}),Ne=()=>({view:({attrs:{title:t,href:a,active:i,disabled:l}})=>e("li",{className:i?"active":l?"disabled":"waves-effect"},"number"==typeof t?e(e.route.Link,{href:a},t):t)}),$e=()=>{const t={pagIndex:0};return{view:({attrs:{items:a,curPage:i=1,size:l=Math.min(9,a.length)}})=>{const{pagIndex:n}=t,o=n*l,s=o+l,r=n>0,c=s<a.length,d=[{title:e("a",{onclick:()=>r&&t.pagIndex--},e("i.material-icons","chevron_left")),disabled:!r},...a.filter((e,t)=>o<=t&&t<s),{title:e("a",{onclick:()=>c&&t.pagIndex++},e("i.material-icons","chevron_right")),disabled:!c}];return e("ul.pagination",d.map((t,a)=>e(Ne,f({title:o+a},t,{active:o+a===i}))))}}},Ce=()=>({oncreate:({dom:e,attrs:t})=>{M.Parallax.init(e,t)},view:({attrs:{src:t}})=>t?e(".parallax-container",e(".parallax",e(`img[src=${t}]`))):void 0}),Me=["label","helperText","initialValue","newRow","className","iconName","isMandatory","onchange","disabled"],Ie=["label","helperText","initialValue","newRow","className","iconName","isMandatory","onchange","disabled"],Ae=()=>{const t={id:a()};return{view:a=>{let{attrs:{label:i,helperText:l,initialValue:n,newRow:o,className:s="col s12",iconName:r,isMandatory:c,onchange:d,disabled:m}}=a,p=x(a.attrs,Me);const h=t.id,v=u(p),b=d?()=>t.dp&&d(t.dp.date):void 0;return e(".input-field"+(o?".clear":""),{className:s,onremove:()=>t.dp&&t.dp.destroy()},[r?e("i.material-icons.prefix",r):"",e(`input.datepicker[type=text][tabindex=0][id=${h}]${v}${m?"[disabled]":""}`,{oncreate:({dom:e})=>{t.dp=M.Datepicker.init(e,f({format:"yyyy/mm/dd",showClearBtn:!0,setDefaultDate:!0,defaultDate:n?new Date(n):new Date},p,{onClose:b}))}}),e(N,{label:i,id:h,isMandatory:c,isActive:!!n}),e($,{helperText:l})])}}},Te=()=>{const t={id:a()};return{view:a=>{let{attrs:{label:i,helperText:l,initialValue:n,newRow:o,className:s="col s12",iconName:r,isMandatory:c,onchange:d,disabled:m}}=a,p=x(a.attrs,Ie);const h=t.id,v=u(p),b=o?".clear":"",g=new Date,y=d?()=>t.tp&&d(t.tp.time||n||`${g.getHours()}:${g.getMinutes()}`):void 0;return e(`.input-field.timepicker${b}`,{className:s,onremove:()=>t.tp&&t.tp.destroy()},[r?e("i.material-icons.prefix",r):"",e(`input[type=text][tabindex=0][id=${h}]${v}${m?"[disabled]":""}`,{value:n,oncreate:({dom:e})=>{t.tp=M.Timepicker.init(e,f({twelveHour:!1,showClearBtn:!0,defaultTime:n},p,{onCloseEnd:y}))}}),e(N,{label:i,id:h,isMandatory:c,isActive:n}),e($,{helperText:l})])}}},Ve=()=>({view:({attrs:{id:t,groupId:a,label:i,onchange:l,className:n="col s12",checked:o,disabled:s}})=>e("div",{className:n},e("label",[e(`input[type=radio][tabindex=0][name=${a}]${o?"[checked=checked]":""}${s?"[disabled]":""}`,{onclick:l?()=>l(t):void 0}),e("span",e.trust(i))]))}),Se=()=>{const t={groupId:a()};return{oninit:({attrs:{checkedId:e,initialValue:a}})=>{t.oldCheckedId=e,t.checkedId=e||a},view:({attrs:{id:a,checkedId:i,newRow:l,className:n="col s12",label:o="",disabled:s,description:r,options:c,isMandatory:d,checkboxClass:m,onchange:p}})=>{t.oldCheckedId!==i&&(t.oldCheckedId=t.checkedId=i);const{groupId:u,checkedId:h}=t,v=e=>{t.checkedId=e,p&&p(e)};return e(`div${a?`[id=${a}]`:""}${l?".clear":""}`,{className:n},[e("div",{className:"input-field options"},e(N,{id:a,label:o,isMandatory:d})),r?e("p.helper-text",e.trust(r)):"",...c.map(t=>e(Ve,f({},t,{onchange:v,groupId:u,disabled:s,className:m,checked:t.id===h})))])}}},Oe=()=>{const t={},a=e=>e.map(e=>e.id).join(""),i=(e,t,a=!1)=>a||(t instanceof Array&&(e||"number"==typeof e)?t.indexOf(e)>=0:t===e);return{oninit:({attrs:{checkedId:e,initialValue:i,options:l}})=>{t.ids=a(l);const n=e||i;t.checkedId=e,t.initialValue=n?n instanceof Array?[...n.filter(e=>null!==e)]:[n]:[]},view:({attrs:{id:l,newRow:n,className:o="col s12",checkedId:s,key:r,options:c,multiple:d,label:m,helperText:p,placeholder:u,isMandatory:v,iconName:b,disabled:g,classes:y,dropdownOptions:f,onchange:x}})=>{t.checkedId!==s&&(t.initialValue=s?s instanceof Array?s:[s]:void 0);const{initialValue:w}=t,k=x?d?()=>{const e=t.instance&&t.instance.getSelectedValues(),a=e?e.length>0&&h(e[0])?e.map(e=>+e):e.filter(e=>null!==e||void 0!==e):void 0;t.initialValue=a||[],x(t.initialValue)}:e=>{if(e&&e.currentTarget){const a=e.currentTarget,i=h(a.value)?+a.value:a.value;t.initialValue=void 0!==typeof i?[i]:[]}t.initialValue&&x(t.initialValue)}:void 0,C=n?".clear":"",I=g?"[disabled]":"",A=d?"[multiple]":"",T=0===c.filter(e=>i(e.id,w)).length;return e(`.input-field.select-space${C}`,{className:o,key:r},[b&&e("i.material-icons.prefix",b),e(`select[id=${l}]${I}${A}`,{oncreate:({dom:e})=>{t.instance=M.FormSelect.init(e,{classes:y,dropdownOptions:f})},onupdate:({dom:e})=>{const i=a(c);let l=s&&t.checkedId!==s.toString();t.ids!==i&&(t.ids=i,l=!0),(t.checkedId instanceof Array&&s instanceof Array?t.checkedId.join()!==s.join():t.checkedId!==s)&&(t.checkedId=s,l=!0),l&&(t.instance=M.FormSelect.init(e,{classes:y,dropdownOptions:f}))},onchange:k},u?e("option[disabled]"+(T?"[selected]":""),u):"",c.map((t,a)=>e(`option[value=${t.id}]${t.title?`[title=${t.title}]`:""}${t.disabled?"[disabled]":""}${i(t.id,w,0===a&&T&&!u)?"[selected]":""}`,t.label.replace("&","&")))),e(N,{label:m,isMandatory:v}),e($,{helperText:p})])}}},Re=["label","left","right","disabled","newRow","onchange","checked","isMandatory","className"],Le=()=>{const t={id:a()};return{view:({attrs:a})=>{const i=a.id||t.id,{label:l,left:n,right:o,disabled:s,newRow:r,onchange:c,checked:d,isMandatory:p,className:u="col s12"}=a,h=x(a,Re);return e("div"+(r?".clear":""),{className:u},[l?e(N,{label:l||"",id:i,isMandatory:p}):void 0,e(".switch",h,e("label",[n||"Off",e(`input[id=${i}][type=checkbox]${m({disabled:s})}${d?"[checked]":""}`,{onclick:c?e=>{e.target&&void 0!==e.target.checked&&c(e.target.checked)}:void 0}),e("span.lever"),o||"On"]))])}}},je=()=>{const t={},a=(e,t)=>t||e.replace(/ /g,"").toLowerCase();return{view:({attrs:{tabWidth:i,selectedTabId:l,tabs:n,className:o,style:s,duration:r,onShow:c,swipeable:d,responsiveThreshold:m}})=>{const p=n.filter(e=>e.active).shift(),u=l||(p?a(p.title,p.id):"");return e(".row",[e(".col.s12",e("ul.tabs"+("fill"===i?".tabs-fixed-width":""),{className:o,style:s,oncreate:({dom:e})=>{t.instance=M.Tabs.init(e,{duration:r,onShow:c,responsiveThreshold:m,swipeable:d})},onupdate:()=>{if(u){const e=document.getElementById(`tab_${u}`);e&&e.click()}},onremove:()=>t.instance.destroy()},n.map(({className:t,title:l,id:o,active:s,disabled:r,target:c,href:d})=>e(`li.tab${r?".disabled":""}${"fixed"===i?`.col.s${Math.floor(12/n.length)}`:""}`,{className:t},e(`a[id=tab_${a(l,o)}]${s?".active":""}`,{target:c,href:d||`#${a(l,o)}`},l))))),n.filter(({href:e})=>void 0===e).map(({id:t,title:i,vnode:l,contentClass:n})=>e(`.col.s12[id=${a(i,t)}]`,{className:n},l))])}}},Fe=()=>({view:({attrs:{id:t,title:a,datetime:i,active:l,content:n,iconName:o,dateFormatter:s,timeFormatter:r,onSelect:c}})=>e(`li${l?".active":""}${t?`[id=${t}]`:""}`,{onclick:c?()=>c({id:t,title:a,datetime:i,active:l,content:n}):void 0,style:c?"cursor: pointer;":void 0},[e(".mm_time",{datetime:i},[e("span",s(i)),e("span",r(i))]),o?e(".mm_icon",e("i.material-icons",o)):void 0,e(".mm_label",[a?"string"==typeof a?e("h5",a):a:void 0,n?"string"==typeof n?e("p",n):n:void 0])])}),De=()=>{const t=e=>`${e.getUTCDate()}/${e.getUTCMonth()+1}/${e.getUTCFullYear()}`,a=e=>`${b(e.getUTCHours())}:${b(e.getUTCMinutes())}`;return{view:({attrs:{items:i,onSelect:l,timeFormatter:n=a,dateFormatter:o=t}})=>e("ul.mm_timeline",i.map(t=>e(Fe,f({onSelect:l,dateFormatter:o,timeFormatter:n},t))))}};export{X as AnchorItem,C as Autocomplete,S as Button,V as ButtonFactory,K as Carousel,D as CarouselItem,_ as Chips,B as CodeBlock,q as Collapsible,E as CollapsibleItem,te as Collection,W as CollectionMode,he as ColorInput,Ae as DatePicker,ie as Dropdown,be as EmailInput,ge as FileInput,L as FlatButton,ne as FloatingActionButton,$ as HelperText,A as Icon,ye as InputCheckbox,N as Label,O as LargeButton,J as ListItem,k as Mandatory,xe as MapEditor,we as MaterialBox,ke as ModalPanel,pe as NumberInput,fe as Options,$e as Pagination,Ce as Parallax,me as PasswordInput,Ve as RadioButton,Se as RadioButtons,ve as RangeInput,j as RoundIconButton,Z as SecondaryContent,Oe as Select,R as SmallButton,F as SubmitButton,Le as Switch,je as Tabs,re as TextArea,de as TextInput,Te as TimePicker,De as Timeline,ue as UrlInput,s as camelToSnake,l as compose,m as disable,h as isNumeric,o as join,n as map,y as move,b as padLeft,v as pipe,p as req,g as swap,r as toAttributeString,u as toAttrs,a as uniqueId,i as uuid4};
|
|
2
2
|
//# sourceMappingURL=index.modern.js.map
|