ywana-core8 0.0.7 → 0.0.11

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/dist/index.umd.js CHANGED
@@ -1,2 +1,2 @@
1
- !function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("material-design-icons-iconfont/dist/material-design-icons.css"),require("react"),require("deep-equal"),require("resumablejs")):"function"==typeof define&&define.amd?define(["exports","material-design-icons-iconfont/dist/material-design-icons.css","react","deep-equal","resumablejs"],n):n((e||self).ywanaCore8={},0,e.react,e.deepEqual,e.resumablejs)}(this,function(e,n,t,i,o){function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=/*#__PURE__*/r(t),l=/*#__PURE__*/r(i),u=/*#__PURE__*/r(o),c=function(e,n,t,i){void 0===t&&(t=null);try{console.log("FETCH",e,n);var o={method:e,mode:"cors",headers:{Accept:"application/json","Content-Type":"application/json","x-access-token":i},body:t};return Promise.resolve(function(e,t){try{var i=Promise.resolve(fetch(n,o)).then(function(e){var n;function t(t){if(n)return t;throw e}var i=function(){if(e.ok)return Promise.resolve(e.json()).then(function(e){return n=1,e})}();return i&&i.then?i.then(t):t(i)})}catch(e){return t(e)}return i&&i.then?i.then(void 0,t):i}(0,function(e){if(e instanceof Error)throw{error:e};return Promise.resolve(e.json()).then(function(e){throw{success:!1,message:e.message}})}))}catch(e){return Promise.reject(e)}},s=function(e,n){return{GET:function(t){var i=n?n.token():null;return c("GET",e+t,void 0,i)},POST:function(t,i){var o=n?n.token():null;return c("POST",e+t,i,o)},PUT:function(t,i){var o=n?n.token():null;return c("PUT",e+t,i,o)},PATCH:function(t,i){var o=n?n.token():null;return c("PATCH",e+t,i,o)},DELETE:function(t){var i=n?n.token():null;return c("DELETE",e+t,void 0,i)}}},d=process.env.REACT_APP_SESSION||window&&window.SESSION?window.SESSION:"YWANA-CORE6-SESSION",f={token:function(){return(sessionStorage.getItem(d)?JSON.parse(sessionStorage.getItem(d)):{}).token},me:function(){return(sessionStorage.getItem(d)?JSON.parse(sessionStorage.getItem(d)):{}).me},init:function(e,n){sessionStorage.setItem(d,JSON.stringify({token:e,me:n}))},refresh:function(e){var n=this.me();sessionStorage.setItem(d,JSON.stringify({token:e,me:n}))},isLoggedIn:function(){return!!sessionStorage.DSSession},logout:function(){sessionStorage.removeItem(d)}},v=function(e){var n=e.size,t=e.clickable,i=e.action;return h("i",{className:"icon "+(void 0===n?"normal":n)+" "+(void 0!==t&&t?"clickable":"")+" material-icons",onClick:function(e){e.stopPropagation(),e.preventDefault(),i&&i()}},e.icon)},m=function(e){var n=e.label,t=e.icon,i=e.action,o=e.disabled,r=void 0!==o&&o,a=e.raised?"raised":e.outlined?"outlined":"normal";return r&&(a+=" disabled"),h("button",{className:"btn "+a,onClick:function(e){r||(e.stopPropagation(),e.preventDefault(),i&&i())}},t?h(v,{icon:t,size:"small"}):null,h("span",null,n))},p=React.createContext({}),g=function(e){var n=e.children,i=t.useContext(p);if(i){var o=i.dictionary,r=(void 0===o?{}:o)[n],a=r?r[i.lang]:n;return a?h("span",null,a):""}return n?h("span",null,n):""},b=function(e){var n=e.id,t=e.label,i=e.placeholder,o=e.value,r=e.onChange;function a(e){r&&r(n,e.target.checked)}var l=h(g,null,t);return console.log(t,o),!0===o?h("div",{className:"checkbox",key:n+"1"},h("input",{id:n,type:"checkbox",placeholder:i,checked:!0,value:o,onChange:a}),h("span",{class:"checkmark"}),h("label",{htmlFor:n},l)):h("div",{className:"checkbox",key:n+"0"},h("input",{id:n,type:"checkbox",placeholder:i,value:o,onChange:a}),h("span",{class:"checkmark"}),h("label",{htmlFor:n},l))},C=function(e){var n=e.title,i=e.columns,o=void 0===i?1:i,r=e.children,l=e.outlined,u=e.onChange,c=t.useState([]),s=c[0],d=c[1],f=function(e){return null==e||""===e};t.useEffect(function(){var e=a.default.Children.toArray(r).filter(function(e){return null!==e&&""!==e}).map(function(e){var n=e.props,t=n.id,i=n.value,o=n.required,r=void 0!==o&&o,a=n.validation,l=!r||(a?a(i):!f(i));return{id:t,value:i,required:r,validation:a,valid:l}}).filter(function(e){return void 0!==e.id});d(e)},[]),t.useEffect(function(){if(u){var e=s.every(function(e){return!0===e.valid}),n=s.reduce(function(e,n){var t=n.value;return(t||!1===t)&&(e[n.id]=t),e},{});u(n,e)}},[s]);var v=function(e,n){var t=s.find(function(n){return n.id===e});if(t){var i=!t.required||(t.validation?t.validation(n):!f(n));Object.assign(t,{value:n,valid:i}),d(s.slice())}},m=a.default.Children.toArray(r).filter(function(e){return null!==e&&""!==e}).map(function(e){var n=e.props.span,t=void 0===n?1:n,i=a.default.cloneElement(e,{onChange:v,outlined:!!l});return h(y,{style:{gridColumn:"span "+t}},i)}),p={gridTemplateColumns:"repeat("+o+", 1fr)"};return h(t.Fragment,null,n?h("header",{className:"form-header"},h(g,{use:"headline6"},n)):"",h("form",{className:"form-grid",style:p},m))},y=function(e){return h("div",{className:"field-wrapper",style:e.style},e.children)},N=function(e){var n=e.caption?"caption":"",t=e.prominent?"prominent":"",i=e.dense?"dense":"",o=e.primary?"primary":"";o=e.secondary?"secondary":o;var r=e.icon?h(v,{icon:e.icon,clickable:e.clickable,action:e.action}):"";r=e.iconSrc?h("img",{className:"header-icon",src:e.iconSrc}):r;var a=e.img?{backgroundImage:"url("+e.img+")"}:{},l=h(g,null,e.title);return h("header",{className:"header "+n+" "+t+" "+i+" "+o+" "+e.className,style:a},r,e.title?h("label",null,l):null,h("span",{className:"actions"},e.children))};function S(){return S=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},S.apply(this,arguments)}var k=function(e){var n=e.items,t=void 0===n?[]:n,i=e.children,o=e.onSelect;function r(e){o&&o(e)}return e.groupBy?h(E,S({},e,{onSelect:r})):h("div",{className:"list"},h("ul",null,t.map(function(e){return h(P,{key:e.id,item:e,onSelect:r})})),i)},E=function(e){var n=e.items,i=e.children,o=e.onSelect,r=e.groupBy,a=(void 0===n?[]:n).reduce(function(e,n){var t=e.find(function(e){return e.name===n.content[r]});return t||e.push(t={name:n.content[r],items:[]}),t.items.push(n),e},[]);return h("div",{className:"list"},a.map(function(e){return h(t.Fragment,{key:e.name},h("header",{key:e.name+"-header"},h(g,null,e.name)),h("ul",{key:e.name+"-ul"},e.items.map(function(e){return h(P,{key:e.id,item:e,onSelect:o})})))}),i)},P=function(e){var n=e.item,t=e.onSelect,i=n.id,o=n.icon,r=n.line1,a=n.line2,l=n.meta;return h("li",{id:i,onClick:function(){t&&t(i)}},o?h(v,{icon:o,size:"small"}):null,h("main",null,h("div",{className:"primary-line"},h(g,null,r)),a?h("div",{className:"secondary-line"},h(g,null,a)):null),l?h("div",{className:"meta"},l):null)},O=a.default.createContext({}),w=function(e){return h("ul",null,e.children)},x=function(e){var n=e.icon,i=void 0===n?"more_vert":n,o=e.children,r=e.align,a=t.useState(!1),l=a[0],u=a[1];function c(){u(!l)}return h(O.Provider,{value:[l,u]},h("div",{className:"menu-icon"},h(v,{icon:i,clickable:!0,action:c}),l?h("menu",{className:""+r},o):null,l?h("div",{className:"overlay",onClick:c}):null))},T=function(e){var n=e.icon,i=e.label,o=e.meta,r=e.onSelect,a=t.useContext(O)[1];return h("li",{className:"menu-item",onClick:function(){r&&r(),a(!1)}},n?h(v,{icon:n}):null,h("label",null,i),o?h("div",{className:"meta"},o):null)},j=function(e){return h("div",{className:"circular-progress"},h(v,{icon:"refresh",size:"small"}))},A=function(e){var n=e.progress,t=e.max;return h("div",{className:"linear-progress"},h("progress",{value:void 0===n?0:n,max:void 0===t?100:t}))},D=function(e){var n=e.selected,t=e.onChange,i=a.default.Children.map(e.children,function(e,i){return a.default.cloneElement(e,{selected:i===n,onSelect:function(){t&&t(i)}})});return h("div",{class:"tabs"},i,h("div",{class:"tab-filler"}))},R=function(e){var n=e.onSelect;return h("div",{className:"tab "+(e.selected?"selected":""),onClick:function(){n&&n()}},e.label,e.actions||null)},I=function(e){var n=e.selected,i=void 0===n?0:n,o=a.default.Children.toArray(e.children).filter(function(e,n){return n===i})[0];return h(t.Fragment,null,o)},_=function(e){var n=t.useContext(p),i=e.id,o=e.type,r=void 0===o?"text":o,a=e.label,l=e.placeholder,u=e.value,c=e.readOnly,s=void 0!==c&&c,d=e.onChange,f=e.onEnter,v=e.onClick,m=(a?"":"no-label")+" "+(e.outlined?"textfield-outlined":"textfield"),b=h(g,null,a);return h("div",{className:""+m,onClick:v},h("input",{id:i,type:r,placeholder:l,value:u,required:!0,onChange:function(e){e.stopPropagation(),e.preventDefault(),d&&d(i,e.target.value)},onKeyDown:function(e){13==(e.charCode?e.charCode:e.keyCode?e.keyCode:0)&&f()},onFocus:function(){n&&n.changeFocus({lose:function(){}})},readOnly:s}),h("span",{className:"bar"}),a?h("label",null,b):null)},F=function(e){var n=t.useContext(p),i=e.id,o=e.options,r=void 0===o?[]:o,a=e.value,l=e.onChange,u=t.useState(!1),c=u[0],s=u[1],d=t.useState(),f=d[0],m=d[1];function g(){n&&n.changeFocus({lose:function(){s(!1)}}),s(!c)}return t.useEffect(function(){if(Array.isArray(r)){var e=r.find(function(e){return e.value===a});e&&m(e.label)}},[a]),h("div",{className:"dropdown"},h(_,S({},e,{onClick:g,value:f})),h(v,{icon:"expand_more",clickable:!0,size:"small",action:g}),1==c?h("menu",null,h("ul",{onClick:function(e){var n=e.target.getAttribute("value"),t=r.find(function(e){return e.value===n});l&&l(i,n),m(t.label),s(!1)}},Array.isArray(r)?r.map(function(e){return h("li",{key:e.value,value:e.value},e.label)}):null)):null)},L=function(e){var n=e.columns,i=void 0===n?[]:n,o=e.rows,r=void 0===o?[]:o,a=e.onRowSelection,l=e.onSort,u=e.editable,c=e.outlined,s=t.useState({})[0];function d(e,n){a&&a(e,n)}function f(e,n){l&&l(e,n)}return h("div",{className:"datatable8 "+(c?"outlined":"")},h("table",null,h("thead",null,h("tr",null,i.map(function(e){var n=e.sortable;return h("th",null,h(g,null,e.label),n?h(v,{icon:"arrow_up",size:"small",clickable:!0}):null)}))),h("tbody",null,function(e,n){void 0===n&&(n={});var t=Object.keys(n);if(!t.length)return e;var i=function(e,n,t){return t=null!==t?t:1,e===n?0:e>n?t:-1*t};return e.sort(function(e,o){for(var r=0,a=0;0===r&&a<t.length;){var l=t[a];l&&(r=i(e[l],o[l],n[l]),a++)}return r})}(r,s).map(function(e){return h(B,{key:e.id,row:e,columns:i,onSelect:d,onDrop:f,editable:u})}))))},B=function(e){var n,i=e.row,o=e.columns,r=void 0===o?[]:o,a=e.onSelect,l=e.editable,u=t.useState(!1),c=u[0],s=u[1],d=c?"expand_more":"expand_less";return h(t.Fragment,null,h("tr",{onClick:function(e){return a(i,e)}},r.map(function(e){return h(K,{row:i,column:e,cell:i[e.id],editable:l})}),i.info?h(v,{icon:d,clickable:!0,action:function(){return s(!c)}}):null),i.info&&c?h("tr",{className:"table-row-info"},(n=i.info)&&("[object Function]"===Object.prototype.toString.call(n)||"function"==typeof n||n instanceof Function)?i.info():i.info):null)},K=function(e){var n=e.row,t=e.column,i=e.cell,o=e.editable;return h("td",{className:t.id},function(e){var r=t.id,a=t.disabled,l=void 0!==a&&a,u=t.min,c=t.max,s=t.onChange,d=t.options;if(o&&s)switch(e){case"ICON":return h(v,{icon:i});case"BOOLEAN":case"Boolean":return h(b,{id:r,value:i,onChange:function(e,t){return s(n.id,e,t)},disabled:l});case"SELECTION":return h(F,{id:r,value:i,placeholder:"--Select--",options:d,onChange:function(e,t){return s(n.id,e,t)}});case"CHECK":return h(b,{id:r,value:i,onChange:function(e,t){return s(n.id,e,t)},disabled:n.disabled});case"CHECKABLE":return i&&i.value?h(b,{id:r,value:i.checked||!1,label:i.value,onChange:function(e,t){return s(n.id,e,i.value,t,i)}}):"";case"TEXTFIELD":return h(_,{id:r,value:i,onChange:function(e,t){return s(n.id,e,t)}});case"String":return h(z,{id:r,value:i,options:d,onChange:function(e,t){return s(n.id,e,t)}});case"Number":return h(_,{id:r,type:"number",value:i,min:u,max:c,onChange:function(e,t){return s(n.id,e,t)}});default:return i}else switch(e){case"ICON":return h(v,{icon:i});case"Boolean":return h(q,{id:r,value:i});case"String":return h(U,{id:r,value:i,options:d});default:return i}}(t.type))},q=function(e){var n=e.value;return h(v,{icon:!0===(void 0!==n&&n)?"check_box":"check_box_outline_blank"})},U=function(e){var n=e.value,t=e.options,i=t?t.find(function(e){return e.value===n}):null;return h("div",{className:"field-editor string-editor"},i?i.label:n)},z=function(e){var n=e.id,t=e.value,i=void 0===t?"":t,o=e.options,r=e.onChange;function a(e,n){r&&r(e,n)}return h("div",{className:"field-editor string-editor"},o?h(F,{outlined:!0,id:n,value:i,onChange:a,options:o}):h(_,{outlined:!0,id:n,value:i,onChange:a}))},M=function(e){var n=e.id,i=e.label,o=e.init,r=e.onChange,a=t.useRef(!1),l=t.useState(),u=l[0],c=l[1],s=t.useState(o),d=s[0],f=s[1];return t.useEffect(function(){a.current?r&&d&&r(n,d):a.current=!0},[d]),h("div",{className:"tokenField"},h("label",null,i),d.map(function(e,n){return h(Y,{text:e,onDelete:function(){return function(e){var n=d.slice();n.splice(e,1),f(n)}(n)}})}),h("input",{type:"text",value:u,onChange:function(e){c(e.target.value)},onKeyDown:function(e){if("Enter"===e.key){e.preventDefault(),e.stopPropagation();var n=d.concat(e.target.value);f(n),c("")}if(""===u&&d.length>0&&"Backspace"===e.key){var t=d.slice(0,-1);f(t)}}}))},Y=function(e){var n=e.onDelete;return h("div",{className:"token"},h(g,{use:"caption",tag:"div"},e.text),h(v,{icon:"close",clickable:!0,action:n,size:"small"}))},G=function(e){var n=e.nodes;return h("div",{className:"tree"},void 0===n?[]:n,e.children)},H=function(e){var n=e.icon,t=void 0===n?"folder":n,i=e.label,o=e.open,r=e.children,a=e.actions;return h("details",{className:"tree-node",open:void 0!==o&&o},h("summary",{className:"tree-item"},t?h(v,{icon:t,size:"small",small:!0}):null,h("div",{className:"label"},i),h("div",{className:"actions"},a)),r)},J=function(e){var n=e.id,t=e.icon,i=e.label,o=e.actions,r=e.onSelect;return h("div",{className:"tree-item final",onClick:function(){r&&r(n)}},h(v,{icon:void 0===t?"description":t,size:"small",small:!0}),h("div",{className:"label"},i),h("div",{className:"actions"},o))},V=a.default.createContext({}),W=function(e){var n=e.context,i=e.children,o=t.useState(void 0===n?{}:n);return h(V.Provider,{value:[o[0],o[1]]},i)},X=function(e){var n=e.layout,t=e.context;return h(W,{context:void 0===t?{}:t},h("article",{className:"page6 "+(void 0===n?"simple":n)},e.children))},Q=function(e){var n=e.children,i=e.siteDictionary,o=t.useState(e.siteLang),r=o[0],a=o[1],l=t.useState(i),u=l[0],c=l[1],s=t.useState("max"),d=s[0],f=s[1],v=t.useState(!1),m=v[0],g=v[1],b=t.useState(null),C=b[0],y=b[1],N=t.useState(!1),S=N[0],k=N[1],E=t.useState(),P=E[0],O=E[1],w=t.useState(),x=w[0],T=w[1],j=t.useState(),A=j[0],D=j[1],R=t.useState(),I=R[0],_=R[1],F=t.useState(),L=F[0],B=F[1],K={lang:r,setLang:a,dictionary:u,setDictionary:c,focused:L,changeFocus:function(e){L&&L.lose(),B(e)},sideNav:d,setSideNav:f,showNav:m,setShowNav:g,info:C,openInfo:function(e){y(e)},closeInfo:function(){y(null)},console:S,toggleConsole:function(){k(!S)},breadcrumb:I,setBreadcrumb:_,page:P,goto:function(e){O(e)},dialog:x,openDialog:function(e){T(e)},closeDialog:function(){T(null)},preview:A,openPreview:function(e){D(e)},closePreview:function(){D(null)}};return h(p.Provider,{value:K},n)},Z=function(e){var n=e.icon;return h(N,{icon:void 0===n?"equalizer":n,title:e.title})},$=function(e){var n=e.children;return t.useContext(p),h("nav",null,n)},ee=function(){var e=t.useContext(p);return e.info?h("aside",null,e.info):""},ne=function(e){var n=e.children,i=e.min,o=t.useContext(p),r=o.showNav;t.useEffect(function(){i&&o.setSideNav("min")},[]);var a=n?t.Children.toArray(n).reduce(function(e,n){var t=n.props?n.props.section:"...";e[t]||(e[t]=[]);var i=n.props,o=i.title;return o&&e[t].push({id:i.id,icon:i.icon,title:o}),e},{}):{};return h("menu",{className:"min "+(r?"show":"")},h("main",null,Object.keys(a).map(function(e){return h(t.Fragment,{key:e},a[e].map(function(e){var n=e.id,t=e.icon;return h(v,{key:n,icon:void 0===t?"info":t,clickable:!0,checked:n===o.page,action:function(){return function(e){o.setShowNav(!1),o.goto(e)}(n)}})}),h("div",{className:"section-divider"}))})))},te=function(e){var n=e.children,i=e.init,o=t.useContext(p),r=o.page;return t.useEffect(function(){o.goto(i||"EMPTY")},[]),h("main",null,a.default.Children.toArray(n).filter(function(e){return!!e.props&&e.props.id===r}))},ie=function(){var e=t.useContext(p);return e.dialog?e.dialog:""},oe=function(){var e=t.useContext(p);return e.preview?h("div",{className:"site-preview"},e.preview):""},re=function(){return t.useContext(p).console?h("footer",{className:"site-console"},h(N,null,h(D,null,h(R,{label:"Console"}))),h("main",null)):""},ae=function(e){var n=t.useContext(p),i=e.icon,o=e.title,r=void 0===o?"Dialog":o,a=e.children,l=e.actions;return h(t.Fragment,null,h("div",{className:"overlay"}),h("div",{className:"dialog",onClick:function(){n.closeDialog()}},h("div",{className:"dialog-panel",onClick:function(e){e.preventDefault(),e.stopPropagation()}},h("header",null,i?h(x,{icon:i}):null,h(g,null,r)),h("main",null,a),h("footer",null,l))))},le={STRING:"String",NUMBER:"Number",DATE:"Date",BOOLEAN:"Boolean",ARRAY:"Array",ENTITY:"Object",FUNCTION:"Function",EMAIL:"String"},ue=Object.values(le).reduce(function(e,n){return e["is"+n]=function(e){return toString.call(e)=="[object "+n+"]"},e},{}),ce=/*#__PURE__*/function(){function e(e){this._schema=e}var n=e.prototype;return n.checkType=function(n,t){var i=n.type,o=n.item,r=!0,a=!0;if(o){var l=new e(o);switch(i){case le.ARRAY:r=ue["is"+i](t),a=t.every(function(e){return l.validate(e)});break;case le.ENTITY:r=ue["is"+i](t),a=l.validate(t);break;case le.NUMBER:r=ue["is"+i](t.value),a=!0;break;default:r=!0,a=!0}}return r&&a},n.validate=function(e){var n=this;return Object.entries(this._schema).filter(function(e){return!0===e[1].required}).every(function(t){var i=t[0];return void 0!==e[i]&&n.checkType(t[1],e[i])})},n.form=function(e){return Object.entries(this._schema).reduce(function(n,t){var i=t[0];return n[i]=Object.assign({},t[1],{value:e[i]}),n},{})},n.sections=function(e){var n=this.form(e),t=Object.values(n).reduce(function(e,n){var t=n.section||"";return e.hasOwnProperty(t)||(e[t]={title:t,fields:[]}),e[t].fields.push(n),e},{});return Object.values(t)},n.value=function(n){return Object.entries(this._schema).reduce(function(t,i){var o=i[0],r=i[1],a=r.item,l=n?n[o]:null;switch(r.type){case le.STRING:case le.NUMBER:case le.BOOLEAN:t[o]=l||r.default;break;case le.ENTITY:var u=new e(a);t[o]=u.value(l);break;case le.ARRAY:if(a===le.STRING)t[o]=l||[];else{var c=new e(a);t[o]=l?l.map(function(e){return c.value(e)}):[]}break;default:t[o]=r}return t},{})},e}(),se=/*#__PURE__*/function(){function e(e,n){this.type=e,this._type=new ce(e),this._value=n}var n=e.prototype;return n.isValid=function(){return this._type.validate(this._value)},n.value=function(){return this._type.value(this._value)},n.form=function(){return this._type.form(this._value)},n.sections=function(){return this._type.sections(this._value)},n.update=function(e){this._value=e},e}(),de=function(e){var n=e.columns,t=void 0===n?1:n,i=e.filter,o=e.onChange,r=e.content.form();console.log(r);var a=Object.keys(r).map(function(e){return r[e]}).filter(function(e){return!i||i(e)});return console.log(a),h(C,{className:"content-form",columns:t,outlined:!0,onChange:o},a.map(function(e){return h(he,S({key:e.id},e))}))},he=function(e){switch(e.type){case le.BOOLEAN:return h(b,S({key:e.id},e));case le.NUMBER:return h(ve,S({key:e.id},e));default:return h(fe,S({key:e.id},e))}},fe=function(e){var n,t=e.id,i=e.type,o=e.label,r=e.options,a=e.textarea,l=e.required,u=void 0!==l&&l,c=e.value,s=e.onChange,d=e.outlined,f=((n={})[le.NUMBER]="number",n[le.DATE]="date",n)[i]||"text";return r?h(F,{key:t,id:t,label:o,value:c,onChange:s,options:"function"==typeof r?r():r,outlined:d}):h(_,{key:t,id:t,type:f,label:o,value:c,onChange:s,required:u,outlined:d,textarea:a})},ve=function(e){var n=e.id,t=e.label,i=e.options,o=e.required,r=void 0!==o&&o,a=e.value,l=e.onChange,u=e.outlined;function c(e,n){l&&l(e,+n?+n:n)}return i?h(F,{key:n,id:n,label:t,value:a,onChange:c,options:i,outlined:u}):h(_,{key:n,id:n,type:"number",label:t,value:a,onChange:c,required:r,outlined:u})},me=function(e){var n=e.content,t=e.filter,i=e.onChange;function o(e,t){var o,r=Object.assign({},n.value(),((o={})[e]=t,o));i&&i(r)}var r=n.sections();return h("div",{className:"content-editor"},r.map(function(e){var i=e.title,r=e.fields;return h("section",{key:i},h("header",null,i),h("main",null,r.filter(function(e){return"id"!==e.id}).filter(function(e){return!t||t(e,n)}).map(function(e){return h(be,{key:e.id,field:e,onChange:o})})))}))},pe=function(e){var n=e.content,i=e.filter,o=e.grouped,r=void 0!==o&&o,a=e.onChange,l=t.useState(0),u=l[0],c=l[1];function s(e,t){var i,o=Object.assign({},n.value(),((i={})[e]=t,i));a&&a(o)}var d=n.sections();return h("div",{className:"content-editor tabbed"},h(D,{selected:u,onChange:function(e){c(e)}},d.map(function(e){return h(R,{label:e.title})})),h(I,{selected:u},d.map(function(e){var o=e.fields;return h("section",{key:e.title},h("nav",null," "),h("main",null,r?function(e){var n=e.fields,t=(void 0===n?[]:n).reduce(function(e,n){var t=n.group||"",i=e[t]||{name:t,fields:[]};return i.fields.push(n),e[t]=i,e},{});return Object.values(t)}(e).map(function(e){return h(t.Fragment,null,e.name.length>0?h("div",{className:"group-caption"},e.name):null,e.fields.filter(function(e){return"id"!==e.id}).filter(function(e){return!i||i(e)}).map(function(e){return h(be,{key:e.id,field:e,onChange:s,content:n})}))}):o.filter(function(e){return"id"!==e.id}).filter(function(e){return!i||i(e)}).map(function(e){return h(be,{key:e.id,field:e,onChange:s,content:n})})))})))},ge=function(e){var n=e.content,i=e.onChange,o=n.value(),r=Object.values(n.type).filter(function(e){return e.type===le.ARRAY}),a=t.useState(),l=a[0],u=a[1];function c(){}return h("div",{className:"content-editor treeded-editor"},h("menu",null,h("header",null,h(g,{use:"caption"},"Tree Editor")),h(G,null,r.map(function(e,n){return h(H,{icon:"folder",label:e.label,actions:[h(v,{small:!0,icon:"add",clickable:!0,action:c})]},o[e.id]?o[e.id].map(function(n,t){return h(J,{icon:n.icon||"description",label:n.name||n.label,onSelect:function(){return function(e,n,t){var i=new se(t.item,n);u({index:e,item:i,node:t,value:o[t.id]})}(t,n,e)}})}):null)}))),h("div",null,l?h(pe,{content:l.item,onChange:function(e){var n,t=l.value.slice();t[l.index]=e;var r=Object.assign({},o,((n={})[l.node.id]=t,n));i&&i(r)}}):"select"))},be=function(e){var n=e.field,t=e.onChange,i=e.content,o=e.outlined,r=void 0!==o&&o,a=n.id,l=n.type,u=n.item,c=n.label,s=n.editable,d=n.options;function f(e,n){t&&t(e,n)}return function(){var e=n.value?n.value:n.default;switch(l){case le.ENTITY:return h(Ce,{field:n,value:e,onChange:f});case le.STRING:return h(ye,{outlined:r,field:n,value:e,onChange:f,content:i});case le.BOOLEAN:return h(b,{outlined:!0,id:a,label:c,value:e,onChange:f});case le.DATE:return h(_,{outlined:r,id:a,type:"date",label:c,value:e,onChange:f,disabled:s});case le.NUMBER:return h(Ne,{outlined:r,field:n,value:e,onChange:f});case le.ARRAY:return u===le.STRING?d?h(ke,{content:i,field:n,value:e,onChange:f}):h(Se,{field:n,value:e,onChange:f}):h(Ee,{field:n,value:e,onChange:f});default:return h("div",null,c)}}()},Ce=function(e){var n=e.field,t=e.value,i=e.onChange,o=n.id,r=n.label,a=new se(n.item,void 0===t?{}:t);function l(e,n){var t,r=Object.assign({},a.value(),((t={})[e]=n,t));i&&i(o,r)}var u=a.form(),c=Object.keys(u).map(function(e){return u[e]});return h("div",{className:"entity-editor"},h("header",null,h(g,{use:"caption"},r)),h("main",null,c.map(function(e){return h(be,{key:e.id,field:e,onChange:l})})))},ye=function(e){var n=e.field,t=e.value,i=void 0===t?"":t,o=e.onChange,r=e.outlined,a=n.id,l=n.label,u=n.options,c=n.editable;function s(e,n){o&&o(e,n)}return h("div",{className:"field-editor string-editor"},void 0===c||c?u?h(F,{outlined:r,id:a,label:l,value:i,onChange:s,options:"function"==typeof u?u(n,e.content):u}):h(_,{outlined:r,id:a,label:l,value:i,onChange:s}):h(_,{outlined:r,id:a,label:l,value:i,onChange:s,readOnly:!0}))},Ne=function(e){var n=e.field,t=e.onChange,i=n.editable;return h("div",{className:"field-editor number-editor"},h(_,{outlined:!0,id:n.id,label:n.label,type:"NUMBER",value:e.value||n.default,max:n.max,min:n.min,onChange:function(e,n){t&&t(e,n)},disabled:!(void 0===i||i)}))},Se=function(e){var n=e.field,t=e.value,i=e.onChange;return h("div",{className:"list-editor"},h(M,{id:n.id,label:n.label,init:void 0===t?[]:t,onChange:function(e,n){i&&i(e,n)}}))},ke=function(e){var n=e.field,t=e.value,i=void 0===t?[]:t,o=e.content,r=e.onChange,a=n.id,l=n.options;return h("div",{className:"multiselection-editor"},h("label",null,n.label),("function"==typeof l?l(n,o):l).map(function(e){var n=i.includes(e.value);return h(b,{value:n,label:e.label,onChange:function(){return(t=i.indexOf(n=e.value))>=0?i.splice(t,1):i.push(n),void(r&&r(a,i));var n,t}})}))},Ee=function(e){var n=e.field,t=e.value,i=void 0===t?[]:t,o=e.onChange,r=n.id,a=n.item,l=n.label,u=n.Feeder,c=n.Renderer,s=n.Adder,d=void 0===s||s,f=n.editable,m=void 0===f||f;function p(e){if(o){var n=i.concat(e);o(r,n)}}function b(e){if(o){var n=i.filter(function(n,t){return t!==e});o(r,n)}}function C(e,n,t){if(o){var a=i.slice();a[e][n]=t,o(r,a)}}var y=Object.values(a).map(function(e){return S({},e,{onChange:C})});y.push({id:"actions",label:"Actions"});var N=i.map(function(e,n){return S({},e,{id:n,actions:[h(v,{icon:"delete",clickable:!0,action:function(){return b(n)},small:!0})]})}),k={columns:y,rows:N};return h("div",{className:"collection-editor"},h("header",null,h(g,{use:"caption"},l),h("div",{className:"actions"},u?h(u,{onAdd:p}):null)),c?h(c,{field:n,value:i,onRemove:b,onChange:o}):h(L,S({},k,{editable:m})),h("footer",null,d?h(Pe,{item:a,onAdd:p}):null))},Pe=function(e){var n=e.item,i=e.onAdd,o=t.useState(!1),r=o[0],a=o[1],l=t.useState({}),u=l[0],c=l[1];function s(){a(!r)}function d(e,n,t){if(i){var o,r=Object.assign({},u,((o={})[n]=t,o));c(r)}}var f=Object.values(n).map(function(e){return S({},e,{type:"String",onChange:d})});f.push({id:"actions",label:""});var p=[{actions:[h(v,{icon:"done",clickable:!0,action:function(){i&&i([u]),s()}}),h(v,{icon:"close",clickable:!0,action:s})]}];return p[0]=Object.assign({},u,p[0]),h("div",{className:"collection-adder"},r?h(L,S({},{columns:f,rows:p},{editable:!0})):h(m,{icon:"add",label:"Add",action:s}))},Oe=function(e){var n=e.label,i=e.type,o=e.value,r=void 0===o?{}:o,a=e.filter,l=e.validator,u=e.onOK,c=t.useContext(p),s=t.useState(r),d=s[0],f=s[1],v=t.useState(!1),b=v[0],C=v[1],y=t.useState([]),N=y[0],S=y[1];function k(e){"OK"===e&&u&&u(Object.assign({},r,d)),c.closeDialog()}var E=h(t.Fragment,null,h(m,{label:"CLOSE",action:function(){return k("CLOSE")}}),h("div",{className:"expand"}),h(m,{label:"OK",action:function(){return k("OK")},disabled:!b,raised:!0})),P=h(g,{use:"headline6"},n),O=new se(i,d);return h(ae,{title:P,open:!0,onAction:k,actions:E},h(me,{content:O,onChange:function(e){if(f(e),l){var n=l(e),t=n.errors,i=void 0===t?[]:t;C(n.validation),S(i)}else C(!0)},filter:a}),N.map(function(e){return h(g,{use:"overline",tag:"div",className:"error"},e)}))};function we(e,n){try{var t=e()}catch(e){return n(e)}return t&&t.then?t.then(void 0,n):t}var xe=s(window.API||process.env.REACT_APP_API,f),Te=function(e){var n=e.groupBy,i=t.useContext(V),o=i[0],r=i[1],a=o.all,l=void 0===a?[]:a,u=l?l.map(function(e){return{id:e.id,line1:e.name,line2:e.description,content:e}}):[];return h(k,{items:u,onSelect:function(e){try{return o.clear(),r(Object.assign({},o)),Promise.resolve(o.select(e)).then(function(){r(Object.assign({},o))})}catch(e){return Promise.reject(e)}},groupBy:n})},je=function(e){var n=function(e){try{return r.clear(),a(Object.assign({},r)),Promise.resolve(r.select(e)).then(function(){a(Object.assign({},r))})}catch(e){return Promise.reject(e)}},i=e.levels,o=t.useContext(V),r=o[0],a=o[1],l=r.all,u=function e(n,t){var i=function(e,n){return e.reduce(function(e,t){var i=e.find(function(e){return e.name===t[n]});return i||e.push(i={name:t[n],items:[],field:n}),i.items.push(t),e},[])}(t,n[0]);return n.length>1&&i.forEach(function(t){return t.nodes=e(n.slice(1),t.items)}),i}(i,void 0===l?[]:l);return h("main",null,h(G,null,function e(t){return t.map(function(t){return h(H,{key:t.name,icon:null,label:"boolean"==typeof t.name?t.field+" = "+t.name:t.name,open:!0},t.nodes?e(t.nodes):t.items.map(function(e){return h(J,{key:e.id,id:e.id,label:e.name,onSelect:n},"item")}))})}(u)))},Ae=function(e){var n=function(){try{return console.log("saving....."),Promise.resolve(o.update(k)).then(function(){r(Object.assign({},o))})}catch(e){return Promise.reject(e)}},i=t.useContext(V),o=i[0],r=i[1],a=o.selected,u=e.icon,c=e.schema,s=e.layout,d=e.autosave,f=void 0!==d&&d,p=e.delay,b=void 0===p?1e3:p,C=t.useRef(null),y=t.useState(a),k=y[0],E=y[1];function P(e){E(e)}function O(){return!l.default(k,a)}return t.useEffect(function(){E(a)},[a]),t.useEffect(function(){f&&(clearTimeout(C.current),C.current=setTimeout(function(){O()&&n()},b))},[k]),a&&k?h(t.Fragment,null,h(N,{icon:u,title:h(g,null,a.name)},h(v,{icon:"close",clickable:!0,action:function(){o.clear(),r(Object.assign({},o))}}),h(x,{align:"alignRight"},h(w,null,h(T,{label:"Eliminar",onSelect:function(){try{return Promise.resolve(o.remove(a.id)).then(function(){o.clear(),r(Object.assign({},o))})}catch(e){return Promise.reject(e)}}}))),!0===f?null:h(m,{icon:"save",label:"Guardar Cambios",raised:!0,disabled:!O(),action:n})),function(){var n=new se(c,k);switch(s){case"TABBED":return h(pe,S({},e,{content:n,onChange:P}));case"TREEDED":return h(ge,S({},e,{content:n,onChange:P}));default:return h(me,S({},e,{content:n,onChange:P}))}}()):null},De=function(e,n){var t=Re(e);return{all:[],selected:null,load:function(){try{var e=this,i=we(function(){return Promise.resolve(t.all()).then(function(t){e.all=n?t[n]:t})},function(e){console.log(e)});return Promise.resolve(i&&i.then?i.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},select:function(e){var n=this.all.find(function(n){return n.id===e});this.selected=n},clear:function(){this.selected=null},create:function(e){try{var n=this,i=we(function(){return Promise.resolve(t.create(e)).then(function(){return Promise.resolve(n.load()).then(function(){})})},function(e){console.log("CREATE ERROR",e)});return Promise.resolve(i&&i.then?i.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},update:function(e){try{var n=this,i=we(function(){return Promise.resolve(t.update(e)).then(function(){return Promise.resolve(n.load()).then(function(){})})},function(e){console.log(e)});return Promise.resolve(i&&i.then?i.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},patch:function(e,n){try{var i=this,o=we(function(){return Promise.resolve(t.patch(e,n)).then(function(){return Promise.resolve(i.load()).then(function(){})})},function(e){console.log(e)});return Promise.resolve(o&&o.then?o.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},updateProperty:function(e,n,i){try{var o=this,r=we(function(){return Promise.resolve(t.updateProperty(e,n,i)).then(function(){return Promise.resolve(o.load()).then(function(){})})},function(e){console.log(e)});return Promise.resolve(r&&r.then?r.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},remove:function(e){try{var n=this,i=we(function(){return Promise.resolve(t.remove(e)).then(function(){return Promise.resolve(n.load()).then(function(){})})},function(e){console.log(e)});return Promise.resolve(i&&i.then?i.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}}},Re=function(e){return{all:function(){return xe.GET(e)},find:function(n){return xe.GET(e+"/"+n)},create:function(n){var t=JSON.stringify(n);return xe.POST(e,t)},update:function(n){var t=JSON.stringify(n);return xe.PUT(e+"/"+n.id,t)},patch:function(n,t){var i=JSON.stringify(t);return xe.PATCH(e+"/"+n,i)},updateProperty:function(n,t,i){var o=JSON.stringify(i);return xe.PUT(e+"/"+n+"/"+t,o)},remove:function(n){return xe.DELETE(e+"/"+n)}}},Ie=function(e){var n=t.useRef(),i=t.useState(!1),o=i[0],r=i[1];t.useEffect(function(){var t=e.resumable;t&&n&&t.assignDrop(n.current)},[]);var a=e.state,l=void 0===a?0:a,u=e.label,c=void 0===u?"Add file or drop file here...":u,s=e.error;return h("div",{className:"upload-area6 "+(!0===o?"drag-over":""),onDragOver:function(){r(!0)},onDragLeave:function(){r(!1)},ref:n},0===l?h(_e,{resumable:e.resumable}):"",0===l?h("label",null,c):"",1===l?h(j,{size:"xlarge"}):"",2===l?h(v,{icon:"done_all"}):"",3===l?h(g,{use:"body1"},s):"",e.children)},_e=function(e){var n=e.resumable,i=t.useRef();return t.useEffect(function(){n&&i&&n.assignBrowse(i.current)},[]),h("div",{className:"upload-icon",ref:i},h(v,{icon:"folder_open",clickable:!0}))},Fe=function(e){var n=e.label,i=e.target,o=e.accept,r=e.className,a=e.onSuccess,l=e.onError,c=e.onComplete,s=t.useMemo(function(){var e=new u.default({target:i,chunkSize:1048576,simultaneousUploads:1,testChunks:!1,throttleProgressCallbacks:1,fileType:o});return e.on("fileAdded",S),e.on("fileProgress",k),e.on("fileSuccess",E),e.on("fileError",P),e.on("complete",O),e},[]),d=t.useState(0)[1],f=t.useState(0),v=f[0],m=f[1],p=t.useState(),g=p[0],b=p[1],C=t.useState([]),y=C[0],N=C[1];function S(e){y.push(e),N(y),s.upload()}function k(e){var n=e.progress();d(n)}function E(e,n){m(2),a&&a(e,n)}function P(e,n){b(n),m(3),l&&l(e,n)}function O(){m(0),c&&c(y)}return h("div",{className:"uploader "+r},h(Ie,{resumable:s,state:v,label:n,error:g}))},Le=function(e){var n=e.file,i=e.state,o=e.progress,r=e.error,a=r?h(v,{icon:"image",className:"error"}):h(v,{icon:"image"});return 0!==i?h(t.Fragment,null,h("div",{className:"upload-file"},a,h(g,{use:"body1",tag:"label"},n.fileName),1===i?h(A,{progress:o}):"",1===i?h(v,{icon:"close",clickable:!0}):"",2===i?h(v,{icon:"done"}):"",3===i?h(v,{icon:"error"}):""),r?h("div",{className:"error"},h(g,{use:"overline"},r)):""):""};e.Button=m,e.CheckBox=b,e.Chip=function(e){var n=e.id,t=e.icon,i=e.label,o=e.action,r=e.onSelect,a=e.outlined?"outlined":"normal";return e.selected&&(a+=" selected"),h("div",{className:"chip "+a,onClick:function(e){e.stopPropagation(),e.preventDefault(),r&&r(n)}},t?h(v,{icon:t,size:"small"}):null,h("main",null,h(g,null,i)),o?h("span",{className:"meta"},o):null)},e.Chips=function(e){return h("div",{className:"chips"},e.children)},e.CircularProgress=j,e.CollectionContext=De,e.CollectionEditor=Ee,e.CollectionPage=function(e){var n=t.useContext(p),i=e.id,o=void 0===i?"collection":i,r=e.icon,a=e.title,l=e.name,u=void 0===l?"Collection 1":l,c=e.schema,s=e.url,d=e.groupBy,f=e.editor,v=e.field,b=e.autosave,C=void 0!==b&&b,y=e.delay,S=void 0===y?1e3:y,k=e.actions,E=e.levels,P=t.useContext(V),O=P[0],w=P[1],x=De(s,v);return t.useEffect(function(){try{return Promise.resolve(x.load()).then(function(){w(x)})}catch(e){return Promise.reject(e)}},[]),h(t.Fragment,null,h(N,{className:"collection-page",title:h(g,null,a)},h(m,{icon:"add",label:"Add",action:function(){n.openDialog(h(Oe,{label:"Crear "+u,type:c,onOK:function(e){try{return Promise.resolve(O.create(e)).then(function(){w(Object.assign({},O))})}catch(e){return Promise.reject(e)}}}))}}),h(m,{icon:"refresh",label:"Reload",action:function(){try{return Promise.resolve(O.load()).then(function(){w(Object.assign({},O))})}catch(e){return Promise.reject(e)}}}),k),h("menu",{className:"collection-page"},h(N,{title:h(g,null,"Lista de ",u)}),E?h(je,{levels:E}):h(Te,{groupBy:d})),h("main",{key:o,className:"collection-page"},h(Ae,{icon:r,schema:c,layout:f,autosave:C,delay:S})))},e.Content=se,e.ContentEditor=me,e.ContentForm=de,e.CreateContentDialog=function(e){var n=e.label,i=e.type,o=e.validator,r=e.onOK,a=e.onActionClose,l=void 0===a||a,u=t.useContext(p),c=t.useState({}),s=c[0],d=c[1],f=t.useState(!1),v=f[0],b=f[1],C=t.useState([]),y=C[0],N=C[1];function S(e){"OK"===e&&r&&r(s),"CLOSE"!==e&&!0!==l||u.closeDialog()}var k=h(t.Fragment,null,h(m,{label:"CLOSE",action:function(){return S("CLOSE")}}),h(m,{label:"OK",action:function(){return S("OK")},disabled:!v,raised:!0})),E=h(g,{use:"headline6"},n),P=new se(i,s);return h(ae,{title:E,open:!0,onAction:S,actions:k},h(de,{content:P,filter:function(e){return function(e){var n=e.required;return void 0!==n&&n}(e)||function(e){var n=e.creation;return void 0!==n&&n}(e)},onChange:function(e,n){if(d(e),o){var t=o(e),i=t.errors,r=void 0===i?[]:i;b(n&&t.validation),N(r)}else b(n)}}),y.map(function(e){return h(g,{use:"overline",tag:"div",className:"error"},e)}))},e.DataTable=L,e.Dialog=ae,e.DropDown=F,e.EditContentDialog=Oe,e.FieldEditor=be,e.Form=C,e.HTTPClient=s,e.Header=N,e.Icon=v,e.Kanban=function(e){return h("div",{className:"kanban"},e.children)},e.KanbanCard=function(e){return h("div",{className:"kanban-card "+e.color},e.children)},e.KanbanColumn=function(e){var n=e.id,i=e.icon,o=e.title,r=e.subtitle,a=e.badge,l=e.children,u=e.minified,c=e.disabled,s=void 0!==c&&c,d=t.useState(void 0!==u&&u),f=d[0],m=d[1];function p(){m(!f)}return f?h("div",{className:"kanban-column "+n+" min"},h("main",null,o),h("footer",null,h(v,{icon:"toggle_off",onIcon:"toggle_on",clickable:!0,action:p}))):h("div",{className:"kanban-column "+n+" "+(s?"disabled":"")},h("header",null,h(v,{icon:i}),h("div",{className:"title"},h(g,{use:"headline6"},o),h(g,{className:"secondary-text",use:"body2"},r)),h("div",{className:"badge"},a)),h("main",null,l),h("footer",null,h(v,{icon:"toggle_off",onIcon:"toggle_on",clickable:!0,action:p})))},e.LinearProgress=A,e.List=k,e.ListEditor=Se,e.LoginBox=function(e){var n=e.logo,i=e.title,o=e.userLabel,r=void 0===o?"User":o,a=e.passwordLabel,l=void 0===a?"Password":a,u=e.loginLabel,c=void 0===u?"Log In":u,s=e.onOK,d=e.forgotLabel,f=void 0===d?"Forgot Password ?":d,p=e.onForgot,b=e.message,C=e.loading,y=t.useState(""),N=y[0],S=y[1],k=t.useState(""),E=k[0],P=k[1];function O(){return N&&N.length>0&&E&&E.length>0}function w(e){s&&O()&&s(N,e||E)}function x(e){return h(g,null,e)}return h("div",{className:"login-box"},h("header",null,n?h("img",{src:n}):"",h("div",{className:"title"},h(g,null,i))),h("main",null,h(_,{label:x(r),value:N,onChange:function(e,n){S(n)},onEnter:w,outlined:!0}),h(_,{label:x(l),value:E,onChange:function(e,n){P(n)},onEnter:w,type:"password",outlined:!0})),h("footer",null,p?h(m,{label:x(f),action:function(){p&&p(N)},disabled:!(N&&N.length>0)}):null,C?h("div",{className:"load-box"},h(v,{icon:"refresh"})):h(m,{label:x(c),action:w,disabled:!O(),raised:!0}),b?h("div",{className:"message"},h(g,null,b)):null))},e.Menu=w,e.MenuIcon=x,e.MenuItem=T,e.MenuSeparator=function(e){return h("li",null,"menuSeparator")},e.Page=X,e.PageContext=V,e.PageProvider=W,e.Property=function(e){var n=e.value;return h("div",{className:"property"},h("div",{className:"property-name"},e.name),h("div",{className:"property-value"},n))},e.RadioButton=function(e){var n=e.id,t=e.name,i=e.placeholder,o=e.value,r=e.onChange,a=h(g,null,e.label);return h("div",{className:"radio"},h("input",{id:n,name:t,type:"radio",placeholder:i,value:o,onClick:function(e){r&&r(n,e.target.value)}}),h("span",{class:"checkmark"}),h("label",{htmlFor:n},a))},e.ResetPasswordBox=function(e){var n=e.logo,i=e.title,o=e.children,r=e.onOK,a=e.onClose,l=t.useState({}),u=l[0],c=l[1],s=t.useState(),d=s[0],f=s[1];function v(){return u.password1&&u.password2}function p(e,n){var t,i=Object.assign({},u,((t={})[e]=n,t));c(i)}function b(){r&&v()&&(u.password1===u.password2?(f(null),r(u)):f("New Password and Confirm New Password do not match"))}return h("div",{className:"reset-password-box"},h("header",null,n?h("img",{src:n}):null,i?h("div",{className:"title"},h(g,null,i)):null,o),h("main",null,h(g,{use:"headline6"},"Change Password"),h(_,{id:"password1",outlined:!0,icon:"lock",type:"password",label:"New Password",lapse:100,onChange:p,onEnter:b}),h(_,{id:"password2",outlined:!0,icon:"lock",type:"password",label:"Confirm New Password",lapse:100,onChange:p,onEnter:b}),d?h("div",{className:"error"},d):null),h("footer",null,h(m,{label:"Close",action:function(){a&&a()}}),h(m,{label:"OK",raised:!0,disabled:!v(),action:b})))},e.Section=function(e){var n=e.icon,i=e.title,o=void 0===i?"":i,r=e.canCollapse,a=void 0===r||r,l=e.open,u=void 0!==l&&l,c=e.actions,s=e.children,d=e.className,f=t.useState(u),m=f[0],p=f[1];return t.useEffect(function(){p(u)},[u]),h("section",{className:"section2 "+d},h(N,{icon:{icon:n},title:o},c,a?h(v,{icon:"expand_more",onIcon:"expand_less",clickable:!0,action:function(){p(!u)}}):""),m?h("main",null,s):"")},e.Session=f,e.Site=function(e){var n=e.logo,t=e.title,i=e.toolbar,o=e.children,r=e.init,a=e.min;return h(Q,{siteLang:e.lang,siteDictionary:e.dictionary},h("div",{className:"site6"},h(Z,{icon:e.icon}),h($,null,i),h(ne,{logo:n,title:t,min:a},o),h(te,{init:r},o,h(X,{id:"EMPTY"},"EMPTY")),h(ee,null),h(re,null),h(ie,null),h(oe,null)))},e.SiteContext=p,e.SiteProvider=Q,e.Stack=I,e.TYPES=le,e.Tab=R,e.TabbedContentEditor=pe,e.Tabs=D,e.Text=g,e.TextField=_,e.TokenField=M,e.Tree=G,e.TreeItem=J,e.TreeNode=H,e.TreededContentEditor=ge,e.UploadArea=Ie,e.UploadDialog=function(e){var n=e.label,i=e.target,o=e.accept,r=e.onSuccess,a=e.onClose,l=e.onActionClose,u=void 0===l||l,c=t.useContext(p),s=t.useState(),d=s[0],f=s[1],v=t.useState([])[0];function b(e){"CLOSE"!==e&&!0!==u||(c.closeDialog(),a())}var C=h(t.Fragment,null,h(m,{label:"CLOSE",action:function(){return b("CLOSE")}})),y=h(g,{use:"headline6"},n);return h(ae,{title:y,open:!0,onAction:b,actions:C},d?h(Le,{file:d}):h(Fe,{label:n,accept:o,target:i,onComplete:function(e){f(e[0]),r&&r(e[0])}}),v.map(function(e){return h(g,{use:"overline",tag:"div",className:"error"},e)}))},e.UploadFile=Le,e.Uploader=Fe,e.Viewer=function(e){var n=e.title,i=e.src,o=e.info,r=e.actions,a=void 0===r?[]:r,l=e.tools,u=void 0!==l&&l,c=e.onClose,s=t.useState(!1),d=s[0],f=s[1];function m(){f(!d)}var p=h(g,{use:"headline6"},n);return h("div",{className:"viewer"},h(N,{icon:{icon:"close",clickable:!0,action:c},title:p},d?"":h(v,{icon:"info",clickable:!0,action:m}),a),h("main",null,h("div",{className:"resizer"},h("picture",null,h("img",{src:i})))),h("aside",{className:d?"open":""},h(N,{title:"Detalles"},h(v,{icon:"close",clickable:!0,action:m})),h("main",null,o)),u?h("footer",null,h(v,{clickable:!0,icon:"zoom_out"}),h(v,{clickable:!0,icon:"zoom_out_map"}),h(v,{clickable:!0,icon:"zoom_in"})):null)},e.isFunction=function(e){return e&&("[object Function]"===Object.prototype.toString.call(e)||"function"==typeof e||e instanceof Function)}});
1
+ !function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("material-design-icons-iconfont/dist/material-design-icons.css"),require("react"),require("deep-equal"),require("resumablejs")):"function"==typeof define&&define.amd?define(["exports","material-design-icons-iconfont/dist/material-design-icons.css","react","deep-equal","resumablejs"],n):n((e||self).ywanaCore8={},0,e.react,e.deepEqual,e.resumablejs)}(this,function(e,n,t,i,o){function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=/*#__PURE__*/r(t),l=/*#__PURE__*/r(i),u=/*#__PURE__*/r(o),c=function(e,n,t,i){void 0===t&&(t=null);try{console.log("FETCH",e,n);var o={method:e,mode:"cors",headers:{Accept:"application/json","Content-Type":"application/json","x-access-token":i},body:t};return Promise.resolve(function(e,t){try{var i=Promise.resolve(fetch(n,o)).then(function(e){var n;function t(t){if(n)return t;throw e}var i=function(){if(e.ok)return Promise.resolve(e.json()).then(function(e){return n=1,e})}();return i&&i.then?i.then(t):t(i)})}catch(e){return t(e)}return i&&i.then?i.then(void 0,t):i}(0,function(e){if(e instanceof Error)throw{error:e};return Promise.resolve(e.json()).then(function(e){throw{success:!1,message:e.message}})}))}catch(e){return Promise.reject(e)}},s=function(e,n){return{GET:function(t){var i=n?n.token():null;return c("GET",e+t,void 0,i)},POST:function(t,i){var o=n?n.token():null;return c("POST",e+t,i,o)},PUT:function(t,i){var o=n?n.token():null;return c("PUT",e+t,i,o)},PATCH:function(t,i){var o=n?n.token():null;return c("PATCH",e+t,i,o)},DELETE:function(t){var i=n?n.token():null;return c("DELETE",e+t,void 0,i)}}},d=process.env.REACT_APP_SESSION||window&&window.SESSION?window.SESSION:"YWANA-CORE6-SESSION",f={token:function(){return(sessionStorage.getItem(d)?JSON.parse(sessionStorage.getItem(d)):{}).token},me:function(){return(sessionStorage.getItem(d)?JSON.parse(sessionStorage.getItem(d)):{}).me},init:function(e,n){sessionStorage.setItem(d,JSON.stringify({token:e,me:n}))},refresh:function(e){var n=this.me();sessionStorage.setItem(d,JSON.stringify({token:e,me:n}))},isLoggedIn:function(){return!!sessionStorage.DSSession},logout:function(){sessionStorage.removeItem(d)}},v=function(e){var n=e.size,t=e.clickable,i=e.action;return h("i",{className:"icon "+(void 0===n?"normal":n)+" "+(void 0!==t&&t?"clickable":"")+" material-icons",onClick:function(e){e.stopPropagation(),e.preventDefault(),i&&i()}},e.icon)},m=function(e){var n=e.label,t=e.icon,i=e.action,o=e.disabled,r=void 0!==o&&o,a=e.raised?"raised":e.outlined?"outlined":"normal";return r&&(a+=" disabled"),h("button",{className:"btn "+a,onClick:function(e){r||(e.stopPropagation(),e.preventDefault(),i&&i())}},t?h(v,{icon:t,size:"small"}):null,h("span",null,n))},p=a.default.createContext({}),g=function(e){var n=e.children,i=t.useContext(p);if(i){var o=i.dictionary,r=(void 0===o?{}:o)[n],a=r?r[i.lang]:n;return a?h("span",null,a):""}return n?h("span",null,n):""},b=function(e){var n=e.id,t=e.label,i=e.placeholder,o=e.value,r=e.onChange;function a(e){r&&r(n,e.target.checked)}var l=h(g,null,t);return console.log(t,o),!0===o?h("div",{className:"checkbox",key:n+"1"},h("input",{id:n,type:"checkbox",placeholder:i,checked:!0,value:o,onChange:a}),h("span",{class:"checkmark"}),h("label",{htmlFor:n},l)):h("div",{className:"checkbox",key:n+"0"},h("input",{id:n,type:"checkbox",placeholder:i,value:o,onChange:a}),h("span",{class:"checkmark"}),h("label",{htmlFor:n},l))},C=function(e){var n=e.title,i=e.columns,o=void 0===i?1:i,r=e.children,l=e.outlined,u=e.onChange,c=t.useState([]),s=c[0],d=c[1],f=function(e){return null==e||""===e};t.useEffect(function(){var e=a.default.Children.toArray(r).filter(function(e){return null!==e&&""!==e}).map(function(e){var n=e.props,t=n.id,i=n.value,o=n.required,r=void 0!==o&&o,a=n.validation,l=!r||(a?a(i):!f(i));return{id:t,value:i,required:r,validation:a,valid:l}}).filter(function(e){return void 0!==e.id});d(e)},[]),t.useEffect(function(){if(u){var e=s.every(function(e){return!0===e.valid}),n=s.reduce(function(e,n){var t=n.value;return(t||!1===t)&&(e[n.id]=t),e},{});u(n,e)}},[s]);var v=function(e,n){var t=s.find(function(n){return n.id===e});if(t){var i=!t.required||(t.validation?t.validation(n):!f(n));Object.assign(t,{value:n,valid:i}),d(s.slice())}},m=a.default.Children.toArray(r).filter(function(e){return null!==e&&""!==e}).map(function(e){var n=e.props.span,t=void 0===n?1:n,i=a.default.cloneElement(e,{onChange:v,outlined:!!l});return h(y,{style:{gridColumn:"span "+t}},i)}),p={gridTemplateColumns:"repeat("+o+", 1fr)"};return h(t.Fragment,null,n?h("header",{className:"form-header"},h(g,{use:"headline6"},n)):"",h("form",{className:"form-grid",style:p},m))},y=function(e){return h("div",{className:"field-wrapper",style:e.style},e.children)},N=function(e){var n=e.caption?"caption":"",t=e.prominent?"prominent":"",i=e.dense?"dense":"",o=e.primary?"primary":"";o=e.secondary?"secondary":o;var r=e.icon?h(v,{icon:e.icon,clickable:e.clickable,action:e.action}):"";r=e.iconSrc?h("img",{className:"header-icon",src:e.iconSrc}):r;var a=e.img?{backgroundImage:"url("+e.img+")"}:{},l=h(g,null,e.title);return h("header",{className:"header "+n+" "+t+" "+i+" "+o+" "+e.className,style:a},r,e.title?h("label",null,l):null,h("span",{className:"actions"},e.children))};function S(){return S=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},S.apply(this,arguments)}var k=function(e){var n=e.items,t=void 0===n?[]:n,i=e.children,o=e.onSelect;function r(e){o&&o(e)}return e.groupBy?h(E,S({},e,{onSelect:r})):h("div",{className:"list"},h("ul",null,t.map(function(e){return h(P,{key:e.id,item:e,onSelect:r})})),i)},E=function(e){var n=e.items,i=e.children,o=e.onSelect,r=e.groupBy,a=(void 0===n?[]:n).reduce(function(e,n){var t=e.find(function(e){return e.name===n.content[r]});return t||e.push(t={name:n.content[r],items:[]}),t.items.push(n),e},[]);return h("div",{className:"list"},a.map(function(e){return h(t.Fragment,{key:e.name},h("header",{key:e.name+"-header"},h(g,null,e.name)),h("ul",{key:e.name+"-ul"},e.items.map(function(e){return h(P,{key:e.id,item:e,onSelect:o})})))}),i)},P=function(e){var n=e.item,t=e.onSelect,i=n.id,o=n.icon,r=n.line1,a=n.line2,l=n.meta;return h("li",{id:i,onClick:function(){t&&t(i)}},o?h(v,{icon:o,size:"small"}):null,h("main",null,h("div",{className:"primary-line"},h(g,null,r)),a?h("div",{className:"secondary-line"},h(g,null,a)):null),l?h("div",{className:"meta"},l):null)},O=a.default.createContext({}),w=function(e){return h("ul",null,e.children)},x=function(e){var n=e.icon,i=void 0===n?"more_vert":n,o=e.children,r=e.align,a=t.useState(!1),l=a[0],u=a[1];function c(){u(!l)}return h(O.Provider,{value:[l,u]},h("div",{className:"menu-icon"},h(v,{icon:i,clickable:!0,action:c}),l?h("menu",{className:""+r},o):null,l?h("div",{className:"overlay",onClick:c}):null))},T=function(e){var n=e.icon,i=e.label,o=e.meta,r=e.onSelect,a=t.useContext(O)[1];return h("li",{className:"menu-item",onClick:function(){r&&r(),a(!1)}},n?h(v,{icon:n}):null,h("label",null,i),o?h("div",{className:"meta"},o):null)},j=function(e){return h("div",{className:"circular-progress"},h(v,{icon:"refresh",size:"small"}))},A=function(e){var n=e.progress,t=e.max;return h("div",{className:"linear-progress"},h("progress",{value:void 0===n?0:n,max:void 0===t?100:t}))},D=function(e){var n=e.selected,t=e.onChange,i=a.default.Children.map(e.children,function(e,i){return a.default.cloneElement(e,{selected:i===n,onSelect:function(){t&&t(i)}})});return h("div",{class:"tabs"},i,h("div",{class:"tab-filler"}))},R=function(e){var n=e.onSelect;return h("div",{className:"tab "+(e.selected?"selected":""),onClick:function(){n&&n()}},e.label,e.actions||null)},I=function(e){var n=e.selected,i=void 0===n?0:n,o=a.default.Children.toArray(e.children).filter(function(e,n){return n===i})[0];return h(t.Fragment,null,o)},_=function(e){var n=t.useContext(p),i=e.id,o=e.type,r=void 0===o?"text":o,a=e.label,l=e.placeholder,u=e.value,c=e.readOnly,s=void 0!==c&&c,d=e.onChange,f=e.onEnter,v=e.onClick,m=(a?"":"no-label")+" "+(e.outlined?"textfield-outlined":"textfield"),b=h(g,null,a);return h("div",{className:""+m,onClick:v},h("input",{id:i,type:r,placeholder:l,value:u,required:!0,onChange:function(e){e.stopPropagation(),e.preventDefault(),d&&d(i,e.target.value)},onKeyDown:function(e){13==(e.charCode?e.charCode:e.keyCode?e.keyCode:0)&&f()},onFocus:function(){n&&n.changeFocus({lose:function(){}})},readOnly:s}),h("span",{className:"bar"}),a?h("label",null,b):null)},F=function(e){var n=t.useContext(p),i=e.id,o=e.options,r=void 0===o?[]:o,a=e.value,l=e.onChange,u=t.useState(!1),c=u[0],s=u[1],d=t.useState(),f=d[0],m=d[1];function g(){n&&n.changeFocus({lose:function(){s(!1)}}),s(!c)}return t.useEffect(function(){if(Array.isArray(r)){var e=r.find(function(e){return e.value===a});e&&m(e.label)}},[a]),h("div",{className:"dropdown"},h(_,S({},e,{onClick:g,value:f})),h(v,{icon:"expand_more",clickable:!0,size:"small",action:g}),1==c?h("menu",null,h("ul",{onClick:function(e){var n=e.target.getAttribute("value"),t=r.find(function(e){return e.value===n});l&&l(i,n),m(t.label),s(!1)}},Array.isArray(r)?r.map(function(e){return h("li",{key:e.value,value:e.value},e.label)}):null)):null)},L=function(e){var n=e.columns,i=void 0===n?[]:n,o=e.rows,r=void 0===o?[]:o,a=e.onRowSelection,l=e.onSort,u=e.editable,c=e.outlined,s=t.useState({})[0];function d(e,n){a&&a(e,n)}function f(e,n){l&&l(e,n)}return h("div",{className:"datatable8 "+(c?"outlined":"")},h("table",null,h("thead",null,h("tr",null,i.map(function(e){var n=e.sortable;return h("th",null,h(g,null,e.label),n?h(v,{icon:"arrow_up",size:"small",clickable:!0}):null)}))),h("tbody",null,function(e,n){void 0===n&&(n={});var t=Object.keys(n);if(!t.length)return e;var i=function(e,n,t){return t=null!==t?t:1,e===n?0:e>n?t:-1*t};return e.sort(function(e,o){for(var r=0,a=0;0===r&&a<t.length;){var l=t[a];l&&(r=i(e[l],o[l],n[l]),a++)}return r})}(r,s).map(function(e){return h(B,{key:e.id,row:e,columns:i,onSelect:d,onDrop:f,editable:u})}))))},B=function(e){var n,i=e.row,o=e.columns,r=void 0===o?[]:o,a=e.onSelect,l=e.editable,u=t.useState(!1),c=u[0],s=u[1],d=c?"expand_more":"expand_less";return h(t.Fragment,null,h("tr",{onClick:function(e){return a(i,e)}},r.map(function(e){return h(K,{row:i,column:e,cell:i[e.id],editable:l})}),i.info?h(v,{icon:d,clickable:!0,action:function(){return s(!c)}}):null),i.info&&c?h("tr",{className:"table-row-info"},(n=i.info)&&("[object Function]"===Object.prototype.toString.call(n)||"function"==typeof n||n instanceof Function)?i.info():i.info):null)},K=function(e){var n=e.row,t=e.column,i=e.cell,o=e.editable;return h("td",{className:t.id},function(e){var r=t.id,a=t.disabled,l=void 0!==a&&a,u=t.min,c=t.max,s=t.onChange,d=t.options;if(o&&s)switch(e){case"ICON":return h(v,{icon:i});case"BOOLEAN":case"Boolean":return h(b,{id:r,value:i,onChange:function(e,t){return s(n.id,e,t)},disabled:l});case"SELECTION":return h(F,{id:r,value:i,placeholder:"--Select--",options:d,onChange:function(e,t){return s(n.id,e,t)}});case"CHECK":return h(b,{id:r,value:i,onChange:function(e,t){return s(n.id,e,t)},disabled:n.disabled});case"CHECKABLE":return i&&i.value?h(b,{id:r,value:i.checked||!1,label:i.value,onChange:function(e,t){return s(n.id,e,i.value,t,i)}}):"";case"TEXTFIELD":return h(_,{id:r,value:i,onChange:function(e,t){return s(n.id,e,t)}});case"String":return h(z,{id:r,value:i,options:d,onChange:function(e,t){return s(n.id,e,t)}});case"Number":return h(_,{id:r,type:"number",value:i,min:u,max:c,onChange:function(e,t){return s(n.id,e,t)}});default:return i}else switch(e){case"ICON":return h(v,{icon:i});case"Boolean":return h(q,{id:r,value:i});case"String":return h(U,{id:r,value:i,options:d});default:return i}}(t.type))},q=function(e){var n=e.value;return h(v,{icon:!0===(void 0!==n&&n)?"check_box":"check_box_outline_blank"})},U=function(e){var n=e.value,t=e.options,i=t?t.find(function(e){return e.value===n}):null;return h("div",{className:"field-editor string-editor"},i?i.label:n)},z=function(e){var n=e.id,t=e.value,i=void 0===t?"":t,o=e.options,r=e.onChange;function a(e,n){r&&r(e,n)}return h("div",{className:"field-editor string-editor"},o?h(F,{outlined:!0,id:n,value:i,onChange:a,options:o}):h(_,{outlined:!0,id:n,value:i,onChange:a}))},M=function(e){var n=e.id,i=e.label,o=e.init,r=e.onChange,a=t.useRef(!1),l=t.useState(),u=l[0],c=l[1],s=t.useState(o),d=s[0],f=s[1];return t.useEffect(function(){a.current?r&&d&&r(n,d):a.current=!0},[d]),h("div",{className:"tokenField"},h("label",null,i),d.map(function(e,n){return h(Y,{text:e,onDelete:function(){return function(e){var n=d.slice();n.splice(e,1),f(n)}(n)}})}),h("input",{type:"text",value:u,onChange:function(e){c(e.target.value)},onKeyDown:function(e){if("Enter"===e.key){e.preventDefault(),e.stopPropagation();var n=d.concat(e.target.value);f(n),c("")}if(""===u&&d.length>0&&"Backspace"===e.key){var t=d.slice(0,-1);f(t)}}}))},Y=function(e){var n=e.onDelete;return h("div",{className:"token"},h(g,{use:"caption",tag:"div"},e.text),h(v,{icon:"close",clickable:!0,action:n,size:"small"}))},G=function(e){var n=e.nodes;return h("div",{className:"tree"},void 0===n?[]:n,e.children)},H=function(e){var n=e.icon,t=void 0===n?"folder":n,i=e.label,o=e.open,r=e.children,a=e.actions;return h("details",{className:"tree-node",open:void 0!==o&&o},h("summary",{className:"tree-item"},t?h(v,{icon:t,size:"small",small:!0}):null,h("div",{className:"label"},i),h("div",{className:"actions"},a)),r)},J=function(e){var n=e.id,t=e.icon,i=e.label,o=e.actions,r=e.onSelect;return h("div",{className:"tree-item final",onClick:function(){r&&r(n)}},h(v,{icon:void 0===t?"description":t,size:"small",small:!0}),h("div",{className:"label"},i),h("div",{className:"actions"},o))},V=a.default.createContext({}),W=function(e){var n=e.context,i=e.children,o=t.useState(void 0===n?{}:n);return h(V.Provider,{value:[o[0],o[1]]},i)},X=function(e){var n=e.layout,t=e.context;return h(W,{context:void 0===t?{}:t},h("article",{className:"page6 "+(void 0===n?"simple":n)},e.children))},Q=function(e){var n=e.children,i=e.siteDictionary,o=t.useState(e.siteLang),r=o[0],a=o[1],l=t.useState(i),u=l[0],c=l[1],s=t.useState("max"),d=s[0],f=s[1],v=t.useState(!1),m=v[0],g=v[1],b=t.useState(null),C=b[0],y=b[1],N=t.useState(!1),S=N[0],k=N[1],E=t.useState(),P=E[0],O=E[1],w=t.useState(),x=w[0],T=w[1],j=t.useState(),A=j[0],D=j[1],R=t.useState(),I=R[0],_=R[1],F=t.useState(),L=F[0],B=F[1],K={lang:r,setLang:a,dictionary:u,setDictionary:c,focused:L,changeFocus:function(e){L&&L.lose(),B(e)},sideNav:d,setSideNav:f,showNav:m,setShowNav:g,info:C,openInfo:function(e){y(e)},closeInfo:function(){y(null)},console:S,toggleConsole:function(){k(!S)},breadcrumb:I,setBreadcrumb:_,page:P,goto:function(e){O(e)},dialog:x,openDialog:function(e){T(e)},closeDialog:function(){T(null)},preview:A,openPreview:function(e){D(e)},closePreview:function(){D(null)}};return h(p.Provider,{value:K},n)},Z=function(e){var n=e.icon;return h(N,{icon:void 0===n?"equalizer":n,title:e.title})},$=function(e){var n=e.children;return t.useContext(p),h("nav",null,n)},ee=function(){var e=t.useContext(p);return e.info?h("aside",null,e.info):""},ne=function(e){var n=e.children,i=e.min,o=t.useContext(p),r=o.showNav;t.useEffect(function(){i&&o.setSideNav("min")},[]);var a=n?t.Children.toArray(n).reduce(function(e,n){var t=n.props?n.props.section:"...";e[t]||(e[t]=[]);var i=n.props,o=i.title;return o&&e[t].push({id:i.id,icon:i.icon,title:o}),e},{}):{};return h("menu",{className:"min "+(r?"show":"")},h("main",null,Object.keys(a).map(function(e){return h(t.Fragment,{key:e},a[e].map(function(e){var n=e.id,t=e.icon;return h(v,{key:n,icon:void 0===t?"info":t,clickable:!0,checked:n===o.page,action:function(){return function(e){o.setShowNav(!1),o.goto(e)}(n)}})}),h("div",{className:"section-divider"}))})))},te=function(e){var n=e.children,i=e.init,o=t.useContext(p),r=o.page;return t.useEffect(function(){o.goto(i||"EMPTY")},[]),h("main",null,a.default.Children.toArray(n).filter(function(e){return!!e.props&&e.props.id===r}))},ie=function(){var e=t.useContext(p);return e.dialog?e.dialog:""},oe=function(){var e=t.useContext(p);return e.preview?h("div",{className:"site-preview"},e.preview):""},re=function(){return t.useContext(p).console?h("footer",{className:"site-console"},h(N,null,h(D,null,h(R,{label:"Console"}))),h("main",null)):""},ae=function(e){var n=t.useContext(p),i=e.icon,o=e.title,r=void 0===o?"Dialog":o,a=e.children,l=e.actions;return h(t.Fragment,null,h("div",{className:"overlay"}),h("div",{className:"dialog",onClick:function(){n.closeDialog()}},h("div",{className:"dialog-panel",onClick:function(e){e.preventDefault(),e.stopPropagation()}},h("header",null,i?h(x,{icon:i}):null,h(g,null,r)),h("main",null,a),h("footer",null,l))))},le={STRING:"String",NUMBER:"Number",DATE:"Date",BOOLEAN:"Boolean",ARRAY:"Array",ENTITY:"Object",FUNCTION:"Function",EMAIL:"String"},ue=Object.values(le).reduce(function(e,n){return e["is"+n]=function(e){return toString.call(e)=="[object "+n+"]"},e},{}),ce=/*#__PURE__*/function(){function e(e){this._schema=e}var n=e.prototype;return n.checkType=function(n,t){var i=n.type,o=n.item,r=!0,a=!0;if(o){var l=new e(o);switch(i){case le.ARRAY:r=ue["is"+i](t),a=t.every(function(e){return l.validate(e)});break;case le.ENTITY:r=ue["is"+i](t),a=l.validate(t);break;case le.NUMBER:r=ue["is"+i](t.value),a=!0;break;default:r=!0,a=!0}}return r&&a},n.validate=function(e){var n=this;return Object.entries(this._schema).filter(function(e){return!0===e[1].required}).every(function(t){var i=t[0];return void 0!==e[i]&&n.checkType(t[1],e[i])})},n.form=function(e){return Object.entries(this._schema).reduce(function(n,t){var i=t[0];return n[i]=Object.assign({},t[1],{value:e[i]}),n},{})},n.sections=function(e){var n=this.form(e),t=Object.values(n).reduce(function(e,n){var t=n.section||"";return e.hasOwnProperty(t)||(e[t]={title:t,fields:[]}),e[t].fields.push(n),e},{});return Object.values(t)},n.value=function(n){return Object.entries(this._schema).reduce(function(t,i){var o=i[0],r=i[1],a=r.item,l=n?n[o]:null;switch(r.type){case le.STRING:case le.NUMBER:case le.BOOLEAN:t[o]=l||r.default;break;case le.ENTITY:var u=new e(a);t[o]=u.value(l);break;case le.ARRAY:if(a===le.STRING)t[o]=l||[];else{var c=new e(a);t[o]=l?l.map(function(e){return c.value(e)}):[]}break;default:t[o]=r}return t},{})},e}(),se=/*#__PURE__*/function(){function e(e,n){this.type=e,this._type=new ce(e),this._value=n}var n=e.prototype;return n.isValid=function(){return this._type.validate(this._value)},n.value=function(){return this._type.value(this._value)},n.form=function(){return this._type.form(this._value)},n.sections=function(){return this._type.sections(this._value)},n.update=function(e){this._value=e},e}(),de=function(e){var n=e.columns,t=void 0===n?1:n,i=e.filter,o=e.onChange,r=e.content.form();console.log(r);var a=Object.keys(r).map(function(e){return r[e]}).filter(function(e){return!i||i(e)});return console.log(a),h(C,{className:"content-form",columns:t,outlined:!0,onChange:o},a.map(function(e){return h(he,S({key:e.id},e))}))},he=function(e){switch(e.type){case le.BOOLEAN:return h(b,S({key:e.id},e));case le.NUMBER:return h(ve,S({key:e.id},e));default:return h(fe,S({key:e.id},e))}},fe=function(e){var n,t=e.id,i=e.type,o=e.label,r=e.options,a=e.textarea,l=e.required,u=void 0!==l&&l,c=e.value,s=e.onChange,d=e.outlined,f=((n={})[le.NUMBER]="number",n[le.DATE]="date",n)[i]||"text";return r?h(F,{key:t,id:t,label:o,value:c,onChange:s,options:"function"==typeof r?r():r,outlined:d}):h(_,{key:t,id:t,type:f,label:o,value:c,onChange:s,required:u,outlined:d,textarea:a})},ve=function(e){var n=e.id,t=e.label,i=e.options,o=e.required,r=void 0!==o&&o,a=e.value,l=e.onChange,u=e.outlined;function c(e,n){l&&l(e,+n?+n:n)}return i?h(F,{key:n,id:n,label:t,value:a,onChange:c,options:i,outlined:u}):h(_,{key:n,id:n,type:"number",label:t,value:a,onChange:c,required:r,outlined:u})},me=function(e){var n=e.content,t=e.filter,i=e.onChange;function o(e,t){var o,r=Object.assign({},n.value(),((o={})[e]=t,o));i&&i(r)}var r=n.sections();return h("div",{className:"content-editor"},r.map(function(e){var i=e.title,r=e.fields;return h("section",{key:i},h("header",null,i),h("main",null,r.filter(function(e){return"id"!==e.id}).filter(function(e){return!t||t(e,n)}).map(function(e){return h(be,{key:e.id,field:e,onChange:o})})))}))},pe=function(e){var n=e.content,i=e.filter,o=e.grouped,r=void 0!==o&&o,a=e.onChange,l=t.useState(0),u=l[0],c=l[1];function s(e,t){var i,o=Object.assign({},n.value(),((i={})[e]=t,i));a&&a(o)}var d=n.sections();return h("div",{className:"content-editor tabbed"},h(D,{selected:u,onChange:function(e){c(e)}},d.map(function(e){return h(R,{label:e.title})})),h(I,{selected:u},d.map(function(e){var o=e.fields;return h("section",{key:e.title},h("nav",null," "),h("main",null,r?function(e){var n=e.fields,t=(void 0===n?[]:n).reduce(function(e,n){var t=n.group||"",i=e[t]||{name:t,fields:[]};return i.fields.push(n),e[t]=i,e},{});return Object.values(t)}(e).map(function(e){return h(t.Fragment,null,e.name.length>0?h("div",{className:"group-caption"},e.name):null,e.fields.filter(function(e){return"id"!==e.id}).filter(function(e){return!i||i(e)}).map(function(e){return h(be,{key:e.id,field:e,onChange:s,content:n})}))}):o.filter(function(e){return"id"!==e.id}).filter(function(e){return!i||i(e)}).map(function(e){return h(be,{key:e.id,field:e,onChange:s,content:n})})))})))},ge=function(e){var n=e.content,i=e.onChange,o=n.value(),r=Object.values(n.type).filter(function(e){return e.type===le.ARRAY}),a=t.useState(),l=a[0],u=a[1];function c(){}return h("div",{className:"content-editor treeded-editor"},h("menu",null,h("header",null,h(g,{use:"caption"},"Tree Editor")),h(G,null,r.map(function(e,n){return h(H,{icon:"folder",label:e.label,actions:[h(v,{small:!0,icon:"add",clickable:!0,action:c})]},o[e.id]?o[e.id].map(function(n,t){return h(J,{icon:n.icon||"description",label:n.name||n.label,onSelect:function(){return function(e,n,t){var i=new se(t.item,n);u({index:e,item:i,node:t,value:o[t.id]})}(t,n,e)}})}):null)}))),h("div",null,l?h(pe,{content:l.item,onChange:function(e){var n,t=l.value.slice();t[l.index]=e;var r=Object.assign({},o,((n={})[l.node.id]=t,n));i&&i(r)}}):"select"))},be=function(e){var n=e.field,t=e.onChange,i=e.content,o=e.outlined,r=void 0!==o&&o,a=n.id,l=n.type,u=n.item,c=n.label,s=n.editable,d=n.options;function f(e,n){t&&t(e,n)}return function(){var e=n.value?n.value:n.default;switch(l){case le.ENTITY:return h(Ce,{field:n,value:e,onChange:f});case le.STRING:return h(ye,{outlined:r,field:n,value:e,onChange:f,content:i});case le.BOOLEAN:return h(b,{outlined:!0,id:a,label:c,value:e,onChange:f});case le.DATE:return h(_,{outlined:r,id:a,type:"date",label:c,value:e,onChange:f,disabled:s});case le.NUMBER:return h(Ne,{outlined:r,field:n,value:e,onChange:f});case le.ARRAY:return u===le.STRING?d?h(ke,{content:i,field:n,value:e,onChange:f}):h(Se,{field:n,value:e,onChange:f}):h(Ee,{field:n,value:e,onChange:f});default:return h("div",null,c)}}()},Ce=function(e){var n=e.field,t=e.value,i=e.onChange,o=n.id,r=n.label,a=new se(n.item,void 0===t?{}:t);function l(e,n){var t,r=Object.assign({},a.value(),((t={})[e]=n,t));i&&i(o,r)}var u=a.form(),c=Object.keys(u).map(function(e){return u[e]});return h("div",{className:"entity-editor"},h("header",null,h(g,{use:"caption"},r)),h("main",null,c.map(function(e){return h(be,{key:e.id,field:e,onChange:l})})))},ye=function(e){var n=e.field,t=e.value,i=void 0===t?"":t,o=e.onChange,r=e.outlined,a=n.id,l=n.label,u=n.options,c=n.editable;function s(e,n){o&&o(e,n)}return h("div",{className:"field-editor string-editor"},void 0===c||c?u?h(F,{outlined:r,id:a,label:l,value:i,onChange:s,options:"function"==typeof u?u(n,e.content):u}):h(_,{outlined:r,id:a,label:l,value:i,onChange:s}):h(_,{outlined:r,id:a,label:l,value:i,onChange:s,readOnly:!0}))},Ne=function(e){var n=e.field,t=e.onChange,i=n.editable;return h("div",{className:"field-editor number-editor"},h(_,{outlined:!0,id:n.id,label:n.label,type:"NUMBER",value:e.value||n.default,max:n.max,min:n.min,onChange:function(e,n){t&&t(e,n)},disabled:!(void 0===i||i)}))},Se=function(e){var n=e.field,t=e.value,i=e.onChange;return h("div",{className:"list-editor"},h(M,{id:n.id,label:n.label,init:void 0===t?[]:t,onChange:function(e,n){i&&i(e,n)}}))},ke=function(e){var n=e.field,t=e.value,i=void 0===t?[]:t,o=e.content,r=e.onChange,a=n.id,l=n.options;return h("div",{className:"multiselection-editor"},h("label",null,n.label),("function"==typeof l?l(n,o):l).map(function(e){var n=i.includes(e.value);return h(b,{value:n,label:e.label,onChange:function(){return(t=i.indexOf(n=e.value))>=0?i.splice(t,1):i.push(n),void(r&&r(a,i));var n,t}})}))},Ee=function(e){var n=e.field,t=e.value,i=void 0===t?[]:t,o=e.onChange,r=n.id,a=n.item,l=n.label,u=n.Feeder,c=n.Renderer,s=n.Adder,d=void 0===s||s,f=n.editable,m=void 0===f||f;function p(e){if(o){var n=i.concat(e);o(r,n)}}function b(e){if(o){var n=i.filter(function(n,t){return t!==e});o(r,n)}}function C(e,n,t){if(o){var a=i.slice();a[e][n]=t,o(r,a)}}var y=Object.values(a).map(function(e){return S({},e,{onChange:C})});y.push({id:"actions",label:"Actions"});var N=i.map(function(e,n){return S({},e,{id:n,actions:[h(v,{icon:"delete",clickable:!0,action:function(){return b(n)},small:!0})]})}),k={columns:y,rows:N};return h("div",{className:"collection-editor"},h("header",null,h(g,{use:"caption"},l),h("div",{className:"actions"},u?h(u,{onAdd:p}):null)),c?h(c,{field:n,value:i,onRemove:b,onChange:o}):h(L,S({},k,{editable:m})),h("footer",null,d?h(Pe,{item:a,onAdd:p}):null))},Pe=function(e){var n=e.item,i=e.onAdd,o=t.useState(!1),r=o[0],a=o[1],l=t.useState({}),u=l[0],c=l[1];function s(){a(!r)}function d(e,n,t){if(i){var o,r=Object.assign({},u,((o={})[n]=t,o));c(r)}}var f=Object.values(n).map(function(e){return S({},e,{type:"String",onChange:d})});f.push({id:"actions",label:""});var p=[{actions:[h(v,{icon:"done",clickable:!0,action:function(){i&&i([u]),s()}}),h(v,{icon:"close",clickable:!0,action:s})]}];return p[0]=Object.assign({},u,p[0]),h("div",{className:"collection-adder"},r?h(L,S({},{columns:f,rows:p},{editable:!0})):h(m,{icon:"add",label:"Add",action:s}))},Oe=function(e){var n=e.label,i=e.type,o=e.value,r=void 0===o?{}:o,a=e.filter,l=e.validator,u=e.onOK,c=t.useContext(p),s=t.useState(r),d=s[0],f=s[1],v=t.useState(!1),b=v[0],C=v[1],y=t.useState([]),N=y[0],S=y[1];function k(e){"OK"===e&&u&&u(Object.assign({},r,d)),c.closeDialog()}var E=h(t.Fragment,null,h(m,{label:"CLOSE",action:function(){return k("CLOSE")}}),h("div",{className:"expand"}),h(m,{label:"OK",action:function(){return k("OK")},disabled:!b,raised:!0})),P=h(g,{use:"headline6"},n),O=new se(i,d);return h(ae,{title:P,open:!0,onAction:k,actions:E},h(me,{content:O,onChange:function(e){if(f(e),l){var n=l(e),t=n.errors,i=void 0===t?[]:t;C(n.validation),S(i)}else C(!0)},filter:a}),N.map(function(e){return h(g,{use:"overline",tag:"div",className:"error"},e)}))};function we(e,n){try{var t=e()}catch(e){return n(e)}return t&&t.then?t.then(void 0,n):t}var xe=s(window.API||process.env.REACT_APP_API,f),Te=function(e){var n=e.groupBy,i=t.useContext(V),o=i[0],r=i[1],a=o.all,l=void 0===a?[]:a,u=l?l.map(function(e){return{id:e.id,line1:e.name,line2:e.description,content:e}}):[];return h(k,{items:u,onSelect:function(e){try{return o.clear(),r(Object.assign({},o)),Promise.resolve(o.select(e)).then(function(){r(Object.assign({},o))})}catch(e){return Promise.reject(e)}},groupBy:n})},je=function(e){var n=function(e){try{return r.clear(),a(Object.assign({},r)),Promise.resolve(r.select(e)).then(function(){a(Object.assign({},r))})}catch(e){return Promise.reject(e)}},i=e.levels,o=t.useContext(V),r=o[0],a=o[1],l=r.all,u=function e(n,t){var i=function(e,n){return e.reduce(function(e,t){var i=e.find(function(e){return e.name===t[n]});return i||e.push(i={name:t[n],items:[],field:n}),i.items.push(t),e},[])}(t,n[0]);return n.length>1&&i.forEach(function(t){return t.nodes=e(n.slice(1),t.items)}),i}(i,void 0===l?[]:l);return h("main",null,h(G,null,function e(t){return t.map(function(t){return h(H,{key:t.name,icon:null,label:"boolean"==typeof t.name?t.field+" = "+t.name:t.name,open:!0},t.nodes?e(t.nodes):t.items.map(function(e){return h(J,{key:e.id,id:e.id,label:e.name,onSelect:n},"item")}))})}(u)))},Ae=function(e){var n=function(){try{return console.log("saving....."),Promise.resolve(o.update(k)).then(function(){r(Object.assign({},o))})}catch(e){return Promise.reject(e)}},i=t.useContext(V),o=i[0],r=i[1],a=o.selected,u=e.icon,c=e.schema,s=e.layout,d=e.autosave,f=void 0!==d&&d,p=e.delay,b=void 0===p?1e3:p,C=t.useRef(null),y=t.useState(a),k=y[0],E=y[1];function P(e){E(e)}function O(){return!l.default(k,a)}return t.useEffect(function(){E(a)},[a]),t.useEffect(function(){f&&(clearTimeout(C.current),C.current=setTimeout(function(){O()&&n()},b))},[k]),a&&k?h(t.Fragment,null,h(N,{icon:u,title:h(g,null,a.name)},h(v,{icon:"close",clickable:!0,action:function(){o.clear(),r(Object.assign({},o))}}),h(x,{align:"alignRight"},h(w,null,h(T,{label:"Eliminar",onSelect:function(){try{return Promise.resolve(o.remove(a.id)).then(function(){o.clear(),r(Object.assign({},o))})}catch(e){return Promise.reject(e)}}}))),!0===f?null:h(m,{icon:"save",label:"Guardar Cambios",raised:!0,disabled:!O(),action:n})),function(){var n=new se(c,k);switch(s){case"TABBED":return h(pe,S({},e,{content:n,onChange:P}));case"TREEDED":return h(ge,S({},e,{content:n,onChange:P}));default:return h(me,S({},e,{content:n,onChange:P}))}}()):null},De=function(e,n){var t=Re(e);return{all:[],selected:null,load:function(){try{var e=this,i=we(function(){return Promise.resolve(t.all()).then(function(t){e.all=n?t[n]:t})},function(e){console.log(e)});return Promise.resolve(i&&i.then?i.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},select:function(e){var n=this.all.find(function(n){return n.id===e});this.selected=n},clear:function(){this.selected=null},create:function(e){try{var n=this,i=we(function(){return Promise.resolve(t.create(e)).then(function(){return Promise.resolve(n.load()).then(function(){})})},function(e){console.log("CREATE ERROR",e)});return Promise.resolve(i&&i.then?i.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},update:function(e){try{var n=this,i=we(function(){return Promise.resolve(t.update(e)).then(function(){return Promise.resolve(n.load()).then(function(){})})},function(e){console.log(e)});return Promise.resolve(i&&i.then?i.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},patch:function(e,n){try{var i=this,o=we(function(){return Promise.resolve(t.patch(e,n)).then(function(){return Promise.resolve(i.load()).then(function(){})})},function(e){console.log(e)});return Promise.resolve(o&&o.then?o.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},updateProperty:function(e,n,i){try{var o=this,r=we(function(){return Promise.resolve(t.updateProperty(e,n,i)).then(function(){return Promise.resolve(o.load()).then(function(){})})},function(e){console.log(e)});return Promise.resolve(r&&r.then?r.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},remove:function(e){try{var n=this,i=we(function(){return Promise.resolve(t.remove(e)).then(function(){return Promise.resolve(n.load()).then(function(){})})},function(e){console.log(e)});return Promise.resolve(i&&i.then?i.then(function(){}):void 0)}catch(e){return Promise.reject(e)}}}},Re=function(e){return{all:function(){return xe.GET(e)},find:function(n){return xe.GET(e+"/"+n)},create:function(n){var t=JSON.stringify(n);return xe.POST(e,t)},update:function(n){var t=JSON.stringify(n);return xe.PUT(e+"/"+n.id,t)},patch:function(n,t){var i=JSON.stringify(t);return xe.PATCH(e+"/"+n,i)},updateProperty:function(n,t,i){var o=JSON.stringify(i);return xe.PUT(e+"/"+n+"/"+t,o)},remove:function(n){return xe.DELETE(e+"/"+n)}}},Ie=function(e){var n=t.useRef(),i=t.useState(!1),o=i[0],r=i[1];t.useEffect(function(){var t=e.resumable;t&&n&&t.assignDrop(n.current)},[]);var a=e.state,l=void 0===a?0:a,u=e.label,c=void 0===u?"Add file or drop file here...":u,s=e.error;return h("div",{className:"upload-area6 "+(!0===o?"drag-over":""),onDragOver:function(){r(!0)},onDragLeave:function(){r(!1)},ref:n},0===l?h(_e,{resumable:e.resumable}):"",0===l?h("label",null,c):"",1===l?h(j,{size:"xlarge"}):"",2===l?h(v,{icon:"done_all"}):"",3===l?h(g,{use:"body1"},s):"",e.children)},_e=function(e){var n=e.resumable,i=t.useRef();return t.useEffect(function(){n&&i&&n.assignBrowse(i.current)},[]),h("div",{className:"upload-icon",ref:i},h(v,{icon:"folder_open",clickable:!0}))},Fe=function(e){var n=e.label,i=e.target,o=e.accept,r=e.className,a=e.onSuccess,l=e.onError,c=e.onComplete,s=t.useMemo(function(){var e=new u.default({target:i,chunkSize:1048576,simultaneousUploads:1,testChunks:!1,throttleProgressCallbacks:1,fileType:o});return e.on("fileAdded",S),e.on("fileProgress",k),e.on("fileSuccess",E),e.on("fileError",P),e.on("complete",O),e},[]),d=t.useState(0)[1],f=t.useState(0),v=f[0],m=f[1],p=t.useState(),g=p[0],b=p[1],C=t.useState([]),y=C[0],N=C[1];function S(e){y.push(e),N(y),s.upload()}function k(e){var n=e.progress();d(n)}function E(e,n){m(2),a&&a(e,n)}function P(e,n){b(n),m(3),l&&l(e,n)}function O(){m(0),c&&c(y)}return h("div",{className:"uploader "+r},h(Ie,{resumable:s,state:v,label:n,error:g}))},Le=function(e){var n=e.file,i=e.state,o=e.progress,r=e.error,a=r?h(v,{icon:"image",className:"error"}):h(v,{icon:"image"});return 0!==i?h(t.Fragment,null,h("div",{className:"upload-file"},a,h(g,{use:"body1",tag:"label"},n.fileName),1===i?h(A,{progress:o}):"",1===i?h(v,{icon:"close",clickable:!0}):"",2===i?h(v,{icon:"done"}):"",3===i?h(v,{icon:"error"}):""),r?h("div",{className:"error"},h(g,{use:"overline"},r)):""):""};e.Button=m,e.CheckBox=b,e.Chip=function(e){var n=e.id,t=e.icon,i=e.label,o=e.action,r=e.onSelect,a=e.outlined?"outlined":"normal";return e.selected&&(a+=" selected"),h("div",{className:"chip "+a,onClick:function(e){e.stopPropagation(),e.preventDefault(),r&&r(n)}},t?h(v,{icon:t,size:"small"}):null,h("main",null,h(g,null,i)),o?h("span",{className:"meta"},o):null)},e.Chips=function(e){return h("div",{className:"chips"},e.children)},e.CircularProgress=j,e.CollectionContext=De,e.CollectionEditor=Ee,e.CollectionPage=function(e){var n=t.useContext(p),i=e.id,o=void 0===i?"collection":i,r=e.icon,a=e.title,l=e.name,u=void 0===l?"Collection 1":l,c=e.schema,s=e.url,d=e.groupBy,f=e.editor,v=e.field,b=e.autosave,C=void 0!==b&&b,y=e.delay,S=void 0===y?1e3:y,k=e.actions,E=e.levels,P=t.useContext(V),O=P[0],w=P[1],x=De(s,v);return t.useEffect(function(){try{return Promise.resolve(x.load()).then(function(){w(x)})}catch(e){return Promise.reject(e)}},[]),h(t.Fragment,null,h(N,{className:"collection-page",title:h(g,null,a)},h(m,{icon:"add",label:"Add",action:function(){n.openDialog(h(Oe,{label:"Crear "+u,type:c,onOK:function(e){try{return Promise.resolve(O.create(e)).then(function(){w(Object.assign({},O))})}catch(e){return Promise.reject(e)}}}))}}),h(m,{icon:"refresh",label:"Reload",action:function(){try{return Promise.resolve(O.load()).then(function(){w(Object.assign({},O))})}catch(e){return Promise.reject(e)}}}),k),h("menu",{className:"collection-page"},h(N,{title:h(g,null,"Lista de ",u)}),E?h(je,{levels:E}):h(Te,{groupBy:d})),h("main",{key:o,className:"collection-page"},h(Ae,{icon:r,schema:c,layout:f,autosave:C,delay:S})))},e.Content=se,e.ContentEditor=me,e.ContentForm=de,e.CreateContentDialog=function(e){var n=e.label,i=e.type,o=e.validator,r=e.onOK,a=e.onActionClose,l=void 0===a||a,u=t.useContext(p),c=t.useState({}),s=c[0],d=c[1],f=t.useState(!1),v=f[0],b=f[1],C=t.useState([]),y=C[0],N=C[1];function S(e){"OK"===e&&r&&r(s),"CLOSE"!==e&&!0!==l||u.closeDialog()}var k=h(t.Fragment,null,h(m,{label:"CLOSE",action:function(){return S("CLOSE")}}),h(m,{label:"OK",action:function(){return S("OK")},disabled:!v,raised:!0})),E=h(g,{use:"headline6"},n),P=new se(i,s);return h(ae,{title:E,open:!0,onAction:S,actions:k},h(de,{content:P,filter:function(e){return function(e){var n=e.required;return void 0!==n&&n}(e)||function(e){var n=e.creation;return void 0!==n&&n}(e)},onChange:function(e,n){if(d(e),o){var t=o(e),i=t.errors,r=void 0===i?[]:i;b(n&&t.validation),N(r)}else b(n)}}),y.map(function(e){return h(g,{use:"overline",tag:"div",className:"error"},e)}))},e.DataTable=L,e.Dialog=ae,e.DropDown=F,e.EditContentDialog=Oe,e.FieldEditor=be,e.Form=C,e.HTTPClient=s,e.Header=N,e.Icon=v,e.Kanban=function(e){return h("div",{className:"kanban"},e.children)},e.KanbanCard=function(e){return h("div",{className:"kanban-card "+e.color},e.children)},e.KanbanColumn=function(e){var n=e.id,i=e.icon,o=e.title,r=e.subtitle,a=e.badge,l=e.children,u=e.minified,c=e.disabled,s=void 0!==c&&c,d=t.useState(void 0!==u&&u),f=d[0],m=d[1];function p(){m(!f)}return f?h("div",{className:"kanban-column "+n+" min"},h("main",null,o),h("footer",null,h(v,{icon:"toggle_off",onIcon:"toggle_on",clickable:!0,action:p}))):h("div",{className:"kanban-column "+n+" "+(s?"disabled":"")},h("header",null,h(v,{icon:i}),h("div",{className:"title"},h(g,{use:"headline6"},o),h(g,{className:"secondary-text",use:"body2"},r)),h("div",{className:"badge"},a)),h("main",null,l),h("footer",null,h(v,{icon:"toggle_off",onIcon:"toggle_on",clickable:!0,action:p})))},e.LinearProgress=A,e.List=k,e.ListEditor=Se,e.LoginBox=function(e){var n=e.logo,i=e.title,o=e.userLabel,r=void 0===o?"User":o,a=e.passwordLabel,l=void 0===a?"Password":a,u=e.loginLabel,c=void 0===u?"Log In":u,s=e.onOK,d=e.forgotLabel,f=void 0===d?"Forgot Password ?":d,p=e.onForgot,b=e.message,C=e.loading,y=t.useState(""),N=y[0],S=y[1],k=t.useState(""),E=k[0],P=k[1];function O(){return N&&N.length>0&&E&&E.length>0}function w(e){s&&O()&&s(N,e||E)}function x(e){return h(g,null,e)}return h("div",{className:"login-box"},h("header",null,n?h("img",{src:n}):"",h("div",{className:"title"},h(g,null,i))),h("main",null,h(_,{label:x(r),value:N,onChange:function(e,n){S(n)},onEnter:w,outlined:!0}),h(_,{label:x(l),value:E,onChange:function(e,n){P(n)},onEnter:w,type:"password",outlined:!0})),h("footer",null,p?h(m,{label:x(f),action:function(){p&&p(N)},disabled:!(N&&N.length>0)}):null,C?h("div",{className:"load-box"},h(v,{icon:"refresh"})):h(m,{label:x(c),action:w,disabled:!O(),raised:!0}),b?h("div",{className:"message"},h(g,null,b)):null))},e.Menu=w,e.MenuIcon=x,e.MenuItem=T,e.MenuSeparator=function(e){return h("li",null,"menuSeparator")},e.Page=X,e.PageContext=V,e.PageProvider=W,e.Property=function(e){var n=e.value;return h("div",{className:"property"},h("div",{className:"property-name"},e.name),h("div",{className:"property-value"},n))},e.RadioButton=function(e){var n=e.id,t=e.name,i=e.placeholder,o=e.value,r=e.onChange,a=h(g,null,e.label);return h("div",{className:"radio"},h("input",{id:n,name:t,type:"radio",placeholder:i,value:o,onClick:function(e){r&&r(n,e.target.value)}}),h("span",{class:"checkmark"}),h("label",{htmlFor:n},a))},e.ResetPasswordBox=function(e){var n=e.logo,i=e.title,o=e.children,r=e.onOK,a=e.onClose,l=t.useState({}),u=l[0],c=l[1],s=t.useState(),d=s[0],f=s[1];function v(){return u.password1&&u.password2}function p(e,n){var t,i=Object.assign({},u,((t={})[e]=n,t));c(i)}function b(){r&&v()&&(u.password1===u.password2?(f(null),r(u)):f("New Password and Confirm New Password do not match"))}return h("div",{className:"reset-password-box"},h("header",null,n?h("img",{src:n}):null,i?h("div",{className:"title"},h(g,null,i)):null,o),h("main",null,h(g,{use:"headline6"},"Change Password"),h(_,{id:"password1",outlined:!0,icon:"lock",type:"password",label:"New Password",lapse:100,onChange:p,onEnter:b}),h(_,{id:"password2",outlined:!0,icon:"lock",type:"password",label:"Confirm New Password",lapse:100,onChange:p,onEnter:b}),d?h("div",{className:"error"},d):null),h("footer",null,h(m,{label:"Close",action:function(){a&&a()}}),h(m,{label:"OK",raised:!0,disabled:!v(),action:b})))},e.Section=function(e){var n=e.icon,i=e.title,o=void 0===i?"":i,r=e.canCollapse,a=void 0===r||r,l=e.open,u=void 0!==l&&l,c=e.actions,s=e.children,d=e.className,f=t.useState(u),m=f[0],p=f[1];return t.useEffect(function(){p(u)},[u]),h("section",{className:"section2 "+d},h(N,{icon:{icon:n},title:o},c,a?h(v,{icon:"expand_more",onIcon:"expand_less",clickable:!0,action:function(){p(!u)}}):""),m?h("main",null,s):"")},e.Session=f,e.Site=function(e){var n=e.logo,t=e.title,i=e.toolbar,o=e.children,r=e.init,a=e.min;return h(Q,{siteLang:e.lang,siteDictionary:e.dictionary},h("div",{className:"site6"},h(Z,{icon:e.icon}),h($,null,i),h(ne,{logo:n,title:t,min:a},o),h(te,{init:r},o,h(X,{id:"EMPTY"},"EMPTY")),h(ee,null),h(re,null),h(ie,null),h(oe,null)))},e.SiteContext=p,e.SiteProvider=Q,e.Stack=I,e.TYPES=le,e.Tab=R,e.TabbedContentEditor=pe,e.Tabs=D,e.Text=g,e.TextField=_,e.TokenField=M,e.Tree=G,e.TreeItem=J,e.TreeNode=H,e.TreededContentEditor=ge,e.UploadArea=Ie,e.UploadDialog=function(e){var n=e.label,i=e.target,o=e.accept,r=e.onSuccess,a=e.onClose,l=e.onActionClose,u=void 0===l||l,c=t.useContext(p),s=t.useState(),d=s[0],f=s[1],v=t.useState([])[0];function b(e){"CLOSE"!==e&&!0!==u||(c.closeDialog(),a())}var C=h(t.Fragment,null,h(m,{label:"CLOSE",action:function(){return b("CLOSE")}})),y=h(g,{use:"headline6"},n);return h(ae,{title:y,open:!0,onAction:b,actions:C},d?h(Le,{file:d}):h(Fe,{label:n,accept:o,target:i,onComplete:function(e){f(e[0]),r&&r(e[0])}}),v.map(function(e){return h(g,{use:"overline",tag:"div",className:"error"},e)}))},e.UploadFile=Le,e.Uploader=Fe,e.Viewer=function(e){var n=e.title,i=e.src,o=e.info,r=e.actions,a=void 0===r?[]:r,l=e.tools,u=void 0!==l&&l,c=e.onClose,s=t.useState(!1),d=s[0],f=s[1];function m(){f(!d)}var p=h(g,{use:"headline6"},n);return h("div",{className:"viewer"},h(N,{icon:{icon:"close",clickable:!0,action:c},title:p},d?"":h(v,{icon:"info",clickable:!0,action:m}),a),h("main",null,h("div",{className:"resizer"},h("picture",null,h("img",{src:i})))),h("aside",{className:d?"open":""},h(N,{title:"Detalles"},h(v,{icon:"close",clickable:!0,action:m})),h("main",null,o)),u?h("footer",null,h(v,{clickable:!0,icon:"zoom_out"}),h(v,{clickable:!0,icon:"zoom_out_map"}),h(v,{clickable:!0,icon:"zoom_in"})):null)},e.isFunction=function(e){return e&&("[object Function]"===Object.prototype.toString.call(e)||"function"==typeof e||e instanceof Function)}});
2
2
  //# sourceMappingURL=index.umd.js.map