shark-mvc
Version:
Shark-MVC is a small MVC framework born to make our small JS apps easier to build.
2 lines • 93.6 kB
JavaScript
/*! For license information please see shark-mvc.min.js.LICENSE.txt */
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("jquery"),require("mustache"),require("moment"),require("html2hscript"),require("preact"),require("preact-html-converter")):"function"==typeof define&&define.amd?define(["jquery","mustache","moment","html2hscript","preact","preact-html-converter"],t):"object"==typeof exports?exports["shark-mvc"]=t(require("jquery"),require("mustache"),require("moment"),require("html2hscript"),require("preact"),require("preact-html-converter")):e["shark-mvc"]=t(e.$,e.Mustache,e.Moment,e.html2hscript,e.preact,e["preact-html-converter"])}(this,((e,t,r,o,n,a)=>(()=>{var s={893:e=>{var t,r,o;e.exports=(r=String.prototype.split,o=/()??/.exec("")[1]===t,function(e,n,a){if("[object RegExp]"!==Object.prototype.toString.call(n))return r.call(e,n,a);var s,i,l,c,d=[],p=(n.ignoreCase?"i":"")+(n.multiline?"m":"")+(n.extended?"x":"")+(n.sticky?"y":""),u=0;for(n=new RegExp(n.source,p+"g"),e+="",o||(s=new RegExp("^"+n.source+"$(?!\\s)",p)),a=a===t?-1>>>0:a>>>0;(i=n.exec(e))&&!((l=i.index+i[0].length)>u&&(d.push(e.slice(u,i.index)),!o&&i.length>1&&i[0].replace(s,(function(){for(var e=1;e<arguments.length-2;e++)arguments[e]===t&&(i[e]=t)})),i.length>1&&i.index<e.length&&Array.prototype.push.apply(d,i.slice(1)),c=i[0].length,u=l,d.length>=a));)n.lastIndex===i.index&&n.lastIndex++;return u===e.length?!c&&n.test("")||d.push(""):d.push(e.slice(u)),d.length>a?d.slice(0,a):d})},914:(e,t,r)=>{"use strict";r(15)("ev-store","7");var o="__EV_STORE_KEY@7";e.exports=function(e){var t=e[o];return t||(t=e[o]={}),t}},697:(e,t,r)=>{var o,n=void 0!==r.g?r.g:"undefined"!=typeof window?window:{},a=r(542);"undefined"!=typeof document?o=document:(o=n["__GLOBAL_DOCUMENT_CACHE@4"])||(o=n["__GLOBAL_DOCUMENT_CACHE@4"]=a),e.exports=o},98:(e,t,r)=>{"use strict";var o="undefined"!=typeof window?window:void 0!==r.g?r.g:{};e.exports=function(e,t){return e in o?o[e]:(o[e]=t,t)}},15:(e,t,r)=>{"use strict";var o=r(98);e.exports=function(e,t,r){var n="__INDIVIDUAL_ONE_VERSION_"+e,a=o(n+"_ENFORCE_SINGLETON",t);if(a!==t)throw new Error("Can only have one copy of "+e+".\nYou already have version "+a+" installed.\nThis means you cannot install version "+t);return o(n,r)}},203:e=>{"use strict";e.exports=function(e){return"object"==typeof e&&null!==e}},208:(e,t,r)=>{var o=r(247);e.exports=o},717:(e,t,r)=>{var o=r(353);e.exports=o},985:(e,t,r)=>{var o=r(429);e.exports=o},311:(e,t,r)=>{var o=r(434);e.exports=o},676:(e,t,r)=>{var o=r(203),n=r(758);function a(e,t,r,o){if(o){var a=o[t];if(n(a))a.unhook&&a.unhook(e,t,r);else if("attributes"===t)for(var s in a)e.removeAttribute(s);else if("style"===t)for(var i in a)e.style[i]="";else e[t]="string"==typeof a?"":null}}function s(e,t,r,n,a){var s=r?r[n]:void 0;if("attributes"!==n)if(s&&o(s)&&i(s)!==i(a))e[n]=a;else{o(e[n])||(e[n]={});var l="style"===n?"":void 0;for(var c in a){var d=a[c];e[n][c]=void 0===d?l:d}}else for(var p in a){var u=a[p];void 0===u?e.removeAttribute(p):e.setAttribute(p,u)}}function i(e){return Object.getPrototypeOf?Object.getPrototypeOf(e):e.__proto__?e.__proto__:e.constructor?e.constructor.prototype:void 0}e.exports=function(e,t,r){for(var i in t){var l=t[i];void 0===l?a(e,i,l,r):n(l)?(a(e,i,l,r),l.hook&&l.hook(e,i,r?r[i]:void 0)):o(l)?s(e,0,r,i,l):e[i]=l}}},247:(e,t,r)=>{var o=r(697),n=r(676),a=r(649),s=r(570),i=r(507),l=r(253);e.exports=function e(t,r){var c=r&&r.document||o,d=r?r.warn:null;if(t=l(t).a,i(t))return t.init();if(s(t))return c.createTextNode(t.text);if(!a(t))return d&&d("Item is not a valid virtual dom node",t),null;var p=null===t.namespace?c.createElement(t.tagName):c.createElementNS(t.namespace,t.tagName),u=t.properties;n(p,u);for(var h=t.children,_=0;_<h.length;_++){var f=e(h[_],r);f&&p.appendChild(f)}return p}},9:e=>{var t={};function r(e,n,a,s,i){if(s=s||{},e){o(a,i,i)&&(s[i]=e);var l=n.children;if(l)for(var c=e.childNodes,d=0;d<n.children.length;d++){i+=1;var p=l[d]||t,u=i+(p.count||0);o(a,i,u)&&r(c[d],p,a,s,i),i=u}}return s}function o(e,t,r){if(0===e.length)return!1;for(var o,n,a=0,s=e.length-1;a<=s;){if(n=e[o=(s+a)/2|0],a===s)return n>=t&&n<=r;if(n<t)a=o+1;else{if(!(n>r))return!0;s=o-1}}return!1}function n(e,t){return e>t?1:-1}e.exports=function(e,t,o,a){return o&&0!==o.length?(o.sort(n),r(e,t,o,a,0)):{}}},512:(e,t,r)=>{var o=r(676),n=r(507),a=r(646),s=r(296);function i(e,t){"function"==typeof t.destroy&&n(t)&&t.destroy(e)}e.exports=function(e,t,r){var n,l,c=e.type,d=e.vNode,p=e.patch;switch(c){case a.REMOVE:return function(e,t){var r=e.parentNode;return r&&r.removeChild(e),i(e,t),null}(t,d);case a.INSERT:return function(e,t,r){var o=r.render(t,r);return e&&e.appendChild(o),e}(t,p,r);case a.VTEXT:return function(e,t,r,o){var n;if(3===e.nodeType)e.replaceData(0,e.length,r.text),n=e;else{var a=e.parentNode;n=o.render(r,o),a&&n!==e&&a.replaceChild(n,e)}return n}(t,0,p,r);case a.WIDGET:return function(e,t,r,o){var n,a=s(t,r);n=a?r.update(t,e)||e:o.render(r,o);var l=e.parentNode;return l&&n!==e&&l.replaceChild(n,e),a||i(e,t),n}(t,d,p,r);case a.VNODE:return function(e,t,r,o){var n=e.parentNode,a=o.render(r,o);return n&&a!==e&&n.replaceChild(a,e),a}(t,0,p,r);case a.ORDER:return function(e,t){for(var r,o,n,a=e.childNodes,s={},i=0;i<t.removes.length;i++)r=a[(o=t.removes[i]).from],o.key&&(s[o.key]=r),e.removeChild(r);for(var l=a.length,c=0;c<t.inserts.length;c++)r=s[(n=t.inserts[c]).key],e.insertBefore(r,n.to>=l++?null:a[n.to])}(t,p),t;case a.PROPS:return o(t,p,d.properties),t;case a.THUNK:return n=t,l=r.patch(t,p,r),n&&l&&n!==l&&n.parentNode&&n.parentNode.replaceChild(l,n),l;default:return t}}},434:(e,t,r)=>{var o=r(697),n=r(786),a=r(247),s=r(9),i=r(512);function l(e,t,r){var n=function(e){var t=[];for(var r in e)"a"!==r&&t.push(Number(r));return t}(t);if(0===n.length)return e;var a=s(e,t.a,n),i=e.ownerDocument;r.document||i===o||(r.document=i);for(var l=0;l<n.length;l++){var d=n[l];e=c(e,a[d],t[d],r)}return e}function c(e,t,r,o){if(!t)return e;var a;if(n(r))for(var s=0;s<r.length;s++)a=i(r[s],t,o),t===e&&(e=a);else a=i(r,t,o),t===e&&(e=a);return e}e.exports=function e(t,r,o){return(o=o||{}).patch=o.patch&&o.patch!==e?o.patch:l,o.render=o.render||a,o.patch(t,r,o)}},296:(e,t,r)=>{var o=r(507);e.exports=function(e,t){return!(!o(e)||!o(t))&&("name"in e&&"name"in t?e.id===t.id:e.init===t.init)}},827:(e,t,r)=>{"use strict";var o=r(914);function n(e){if(!(this instanceof n))return new n(e);this.value=e}e.exports=n,n.prototype.hook=function(e,t){o(e)[t.substr(3)]=this.value},n.prototype.unhook=function(e,t){o(e)[t.substr(3)]=void 0}},889:e=>{"use strict";function t(e){if(!(this instanceof t))return new t(e);this.value=e}e.exports=t,t.prototype.hook=function(e,t){e[t]!==this.value&&(e[t]=this.value)}},429:(e,t,r)=>{"use strict";var o=r(786),n=r(978),a=r(637),s=r(649),i=r(570),l=r(507),c=r(758),d=r(811),p=r(27),u=r(889),h=r(827);function _(e,t,r,n){if("string"==typeof e)t.push(new a(e));else if("number"==typeof e)t.push(new a(String(e)));else if(f(e))t.push(e);else{if(!o(e)){if(null==e)return;throw i={foreignObject:e,parentVnode:{tagName:r,properties:n}},(l=new Error).type="virtual-hyperscript.unexpected.virtual-element",l.message="Unexpected virtual child passed to h().\nExpected a VNode / Vthunk / VWidget / string but:\ngot:\n"+m(i.foreignObject)+".\nThe parent vnode is:\n"+m(i.parentVnode),l.foreignObject=i.foreignObject,l.parentVnode=i.parentVnode,l}for(var s=0;s<e.length;s++)_(e[s],t,r,n)}var i,l}function f(e){return s(e)||i(e)||l(e)||d(e)}function m(e){try{return JSON.stringify(e,null," ")}catch(t){return String(e)}}e.exports=function(e,t,r){var a,s,i,l,d,m=[];return!r&&("string"==typeof(d=t)||o(d)||f(d))&&(r=t,s={}),a=p(e,s=s||t||{}),s.hasOwnProperty("key")&&(i=s.key,s.key=void 0),s.hasOwnProperty("namespace")&&(l=s.namespace,s.namespace=void 0),"INPUT"!==a||l||!s.hasOwnProperty("value")||void 0===s.value||c(s.value)||(s.value=u(s.value)),function(e){for(var t in e)if(e.hasOwnProperty(t)){var r=e[t];if(c(r))continue;"ev-"===t.substr(0,3)&&(e[t]=h(r))}}(s),null!=r&&_(r,m,a,s),new n(a,s,m,i,l)}},27:(e,t,r)=>{"use strict";var o=r(893),n=/([\.#]?[a-zA-Z0-9\u007F-\uFFFF_:-]+)/,a=/^\.|#/;e.exports=function(e,t){if(!e)return"DIV";var r,s,i,l,c=!t.hasOwnProperty("id"),d=o(e,n),p=null;for(a.test(d[1])&&(p="DIV"),l=0;l<d.length;l++)(s=d[l])&&(i=s.charAt(0),p?"."===i?(r=r||[]).push(s.substring(1,s.length)):"#"===i&&c&&(t.id=s.substring(1,s.length)):p=s);return r&&(t.className&&r.push(t.className),t.className=r.join(" ")),t.namespace?p:p.toUpperCase()}},253:(e,t,r)=>{var o=r(649),n=r(570),a=r(507),s=r(811);function i(e,t){var r=e.vnode;if(r||(r=e.vnode=e.render(t)),!(o(r)||n(r)||a(r)))throw new Error("thunk did not return a valid node");return r}e.exports=function(e,t){var r=e,o=t;return s(t)&&(o=i(t,e)),s(e)&&(r=i(e,null)),{a:r,b:o}}},811:e=>{e.exports=function(e){return e&&"Thunk"===e.type}},758:e=>{e.exports=function(e){return e&&("function"==typeof e.hook&&!e.hasOwnProperty("hook")||"function"==typeof e.unhook&&!e.hasOwnProperty("unhook"))}},649:(e,t,r)=>{var o=r(84);e.exports=function(e){return e&&"VirtualNode"===e.type&&e.version===o}},570:(e,t,r)=>{var o=r(84);e.exports=function(e){return e&&"VirtualText"===e.type&&e.version===o}},507:e=>{e.exports=function(e){return e&&"Widget"===e.type}},84:e=>{e.exports="2"},978:(e,t,r)=>{var o=r(84),n=r(649),a=r(507),s=r(811),i=r(758);e.exports=d;var l={},c=[];function d(e,t,r,o,d){this.tagName=e,this.properties=t||l,this.children=r||c,this.key=null!=o?String(o):void 0,this.namespace="string"==typeof d?d:null;var p,u=r&&r.length||0,h=0,_=!1,f=!1,m=!1;for(var g in t)if(t.hasOwnProperty(g)){var y=t[g];i(y)&&y.unhook&&(p||(p={}),p[g]=y)}for(var v=0;v<u;v++){var w=r[v];n(w)?(h+=w.count||0,!_&&w.hasWidgets&&(_=!0),!f&&w.hasThunks&&(f=!0),m||!w.hooks&&!w.descendantHooks||(m=!0)):!_&&a(w)?"function"==typeof w.destroy&&(_=!0):!f&&s(w)&&(f=!0)}this.count=u+h,this.hasWidgets=_,this.hasThunks=f,this.hooks=p,this.descendantHooks=m}d.prototype.version=o,d.prototype.type="VirtualNode"},646:(e,t,r)=>{var o=r(84);function n(e,t,r){this.type=Number(e),this.vNode=t,this.patch=r}n.NONE=0,n.VTEXT=1,n.VNODE=2,n.WIDGET=3,n.PROPS=4,n.ORDER=5,n.INSERT=6,n.REMOVE=7,n.THUNK=8,e.exports=n,n.prototype.version=o,n.prototype.type="VirtualPatch"},637:(e,t,r)=>{var o=r(84);function n(e){this.text=String(e)}e.exports=n,n.prototype.version=o,n.prototype.type="VirtualText"},142:(e,t,r)=>{var o=r(203),n=r(758);function a(e){return Object.getPrototypeOf?Object.getPrototypeOf(e):e.__proto__?e.__proto__:e.constructor?e.constructor.prototype:void 0}e.exports=function e(t,r){var s;for(var i in t){i in r||((s=s||{})[i]=void 0);var l=t[i],c=r[i];if(l!==c)if(o(l)&&o(c))if(a(c)!==a(l))(s=s||{})[i]=c;else if(n(c))(s=s||{})[i]=c;else{var d=e(l,c);d&&((s=s||{})[i]=d)}else(s=s||{})[i]=c}for(var p in r)p in t||((s=s||{})[p]=r[p]);return s}},353:(e,t,r)=>{var o=r(786),n=r(646),a=r(649),s=r(570),i=r(507),l=r(811),c=r(253),d=r(142);function p(e,t){var r={a:e};return u(e,t,r,0),r}function u(e,t,r,o){if(e!==t){var c=r[o],p=!1;if(l(e)||l(t))f(e,t,r,o);else if(null==t)i(e)||(h(e,r,o),c=r[o]),c=v(c,new n(n.REMOVE,e,t));else if(a(t))if(a(e))if(e.tagName===t.tagName&&e.namespace===t.namespace&&e.key===t.key){var _=d(e.properties,t.properties);_&&(c=v(c,new n(n.PROPS,e,_))),c=function(e,t,r,o,s){for(var i=e.children,l=function(e,t){var r=y(t),o=r.keys,n=r.free;if(n.length===t.length)return{children:t,moves:null};var a=y(e),s=a.keys;if(a.free.length===e.length)return{children:t,moves:null};for(var i=[],l=0,c=n.length,d=0,p=0;p<e.length;p++){var u,h=e[p];h.key?o.hasOwnProperty(h.key)?(u=o[h.key],i.push(t[u])):(u=p-d++,i.push(null)):l<c?(u=n[l++],i.push(t[u])):(u=p-d++,i.push(null))}for(var _=l>=n.length?t.length:n[l],f=0;f<t.length;f++){var m=t[f];m.key?s.hasOwnProperty(m.key)||i.push(m):f>=_&&i.push(m)}for(var v,w=i.slice(),b=0,O=[],R=[],x=0;x<t.length;){var E=t[x];for(v=w[b];null===v&&w.length;)O.push(g(w,b,null)),v=w[b];v&&v.key===E.key?(b++,x++):E.key?(v&&v.key&&o[v.key]!==x+1?(O.push(g(w,b,v.key)),(v=w[b])&&v.key===E.key?b++:R.push({key:E.key,to:x})):R.push({key:E.key,to:x}),x++):v&&v.key&&O.push(g(w,b,v.key))}for(;b<w.length;)v=w[b],O.push(g(w,b,v&&v.key));return O.length!==d||R.length?{children:i,moves:{removes:O,inserts:R}}:{children:i,moves:null}}(i,t.children),c=l.children,d=i.length,p=c.length,h=d>p?d:p,_=0;_<h;_++){var f=i[_],m=c[_];s+=1,f?u(f,m,r,s):m&&(o=v(o,new n(n.INSERT,null,m))),a(f)&&f.count&&(s+=f.count)}return l.moves&&(o=v(o,new n(n.ORDER,e,l.moves))),o}(e,t,r,c,o)}else c=v(c,new n(n.VNODE,e,t)),p=!0;else c=v(c,new n(n.VNODE,e,t)),p=!0;else s(t)?s(e)?e.text!==t.text&&(c=v(c,new n(n.VTEXT,e,t))):(c=v(c,new n(n.VTEXT,e,t)),p=!0):i(t)&&(i(e)||(p=!0),c=v(c,new n(n.WIDGET,e,t)));c&&(r[o]=c),p&&h(e,r,o)}}function h(e,t,r){m(e,t,r),_(e,t,r)}function _(e,t,r){if(i(e))"function"==typeof e.destroy&&(t[r]=v(t[r],new n(n.REMOVE,e,null)));else if(a(e)&&(e.hasWidgets||e.hasThunks))for(var o=e.children,s=o.length,c=0;c<s;c++){var d=o[c];_(d,t,r+=1),a(d)&&d.count&&(r+=d.count)}else l(e)&&f(e,null,t,r)}function f(e,t,r,o){var a=c(e,t),s=p(a.a,a.b);(function(e){for(var t in e)if("a"!==t)return!0;return!1})(s)&&(r[o]=new n(n.THUNK,null,s))}function m(e,t,r){if(a(e)){if(e.hooks&&(t[r]=v(t[r],new n(n.PROPS,e,function(e){var t={};for(var r in e)t[r]=void 0;return t}(e.hooks)))),e.descendantHooks||e.hasThunks)for(var o=e.children,s=o.length,i=0;i<s;i++){var c=o[i];m(c,t,r+=1),a(c)&&c.count&&(r+=c.count)}}else l(e)&&f(e,null,t,r)}function g(e,t,r){return e.splice(t,1),{from:t,key:r}}function y(e){for(var t={},r=[],o=e.length,n=0;n<o;n++){var a=e[n];a.key?t[a.key]=n:r.push(n)}return{keys:t,free:r}}function v(e,t){return e?(o(e)?e.push(t):e=[e,t],e):t}e.exports=p},786:e=>{var t=Array.isArray,r=Object.prototype.toString;e.exports=t||function(e){return"[object Array]"===r.call(e)}},182:e=>{"use strict";e.exports=o},274:t=>{"use strict";t.exports=e},230:e=>{"use strict";e.exports=r},410:e=>{"use strict";e.exports=t},524:e=>{"use strict";e.exports=n},906:e=>{"use strict";e.exports=a},542:()=>{}},i={};function l(e){var t=i[e];if(void 0!==t)return t.exports;var r=i[e]={exports:{}};return s[e](r,r.exports,l),r.exports}l.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return l.d(t,{a:t}),t},l.d=(e,t)=>{for(var r in t)l.o(t,r)&&!l.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},l.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),l.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),l.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var c={};return(()=>{"use strict";l.r(c),l.d(c,{Component:()=>I,Controller:()=>H,Jaw:()=>a,ModelRenderer:()=>u,PreactRenderer:()=>$,RenderableJaw:()=>D,Shark:()=>V,SmartModel:()=>_,SwimWay:()=>B,Utils:()=>o,View:()=>U,VirtualDOMRenderer:()=>C});var e=l(274),t=l.n(e);class r{constructor(){this.__id="Utils"}static betterRandom(e,t){let r=parseFloat(e),o=Math.random();return!(t=parseFloat(t))&&e&&(r=0,t=parseFloat(e)),r||(r=0),t||(t=1),o*=t-r,o+=r,o}static betterRandomInt(e,t){return Math.round(r.betterRandom(e,t))}static camelToDashed(e){let t="";return e.split("").forEach(((e,r)=>{e.toLowerCase()!==e&&(r>0&&(t+="-"),e=e.toLowerCase()),t+=e})),t}static computeHash(e){return(r.safeStringify(e)||"").split("").reduce((function(e,t){return 0|(e<<5)-e+t.charCodeAt(0)}),0)}static dashedToCamel(e){let t=e,r=0;for(;r>-1;)r=t.indexOf("-"),r>-1&&(t=t.substr(0,r)+t.substr(r+1,1).toUpperCase()+t.substr(r+2));return t}static deepMerge(...e){if(0===e.length)return{};const t={};return e.forEach((e=>{for(let o in e)null!==e[o]&&void 0!==e[o]&&"object"==typeof e[o]?t[o]=r.deepMerge(t[o],e[o]):t[o]=e[o]})),t}static extractDifferentProperties(e,t){const r={};for(let o in e)e[o]&&t[o]&&e[o]!==t[o]&&(r[o]=t[o]);return r}static flatten(e){const t={};for(var o in e)"function"!=typeof e[o]&&("object"==typeof e[o]?t[o]=r.flatten(e[o]):t[o]=e[o]);return t}static generateGUID(e="",t=""){return e+"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)})).toUpperCase()+t}static getDeepProperty(e,t){if(e){const a=t.split(".");for(var r=0;r<a.length-1;r++){var o=-1;if((n=a[r].indexOf("["))>-1&&(o=parseInt(a[r].substring(n+1,a[r].indexOf("]"))),a[r]=a[r].substr(0,n)),-1===o){if(!e[a[r]])break;e=e[a[r]]}else{if(!e[a[r]][o])break;e=e[a[r]][o]}}var n;return o=-1,(n=a[r].indexOf("["))>-1&&(o=parseInt(a[r].substring(n+1,a[r].indexOf("]"))),a[r]=a[r].substr(0,n)),-1===o?e[a[r]]:e[a[r]][o]}}static matchLists(e=[],t={},o={}){e.forEach((e=>{for(const o in e)if("Guid"===o.substr(-2)){const n=o.substr(0,o.length-2),a=t[n];a&&(e[`__${n}`]=r.safp(a,"guid",e[o]))}}))}static matchProperties(e,o,n){let a={createMissingProperties:!1,exclude:[],matchEmptyParameters:!0,matchUndefinedParameters:!1};Object.assign(a,n),Array.isArray(a.exclude)||(a.exclude=[]);for(let s in o)(Object.prototype.hasOwnProperty.call(e,s)&&Object.getOwnPropertyDescriptor(e,s).writable||!Object.prototype.hasOwnProperty.call(e,s)&&a.createMissingProperties)&&(0!==a.exclude.length&&-1!==a.exclude.indexOf(s)||void 0===e[s]&&!a.createMissingProperties||!(o[s]&&""!==o[s]||a.matchEmptyParameters)||void 0===o[s]&&!a.matchUndefinedParameters||(Array.isArray(o[s])?e[s]=[...o[s]]:"object"!=typeof o[s]&&"object"!=typeof e[s]||null===o[s]||null===e[s]?e[s]=o[s]:e[s]&&"Object"===e[s].constructor.name&&"Object"===o[s].constructor.name&&Object.keys(e[s]).length>0?r.matchProperties(e[s],o[s],n):e[s]&&"Object"===e[s].constructor.name&&"string"==typeof o[s]?e[s]=t().extend(!0,e[s],r.parseJSON(o[s],"object")):e[s]&&"Array"===e[s].constructor.name&&"string"==typeof o[s]?e[s]=r.parseJSON(o[s],"array"):e[s]=t().extend(!0,{},o[s])))}static moveCaretToEnd(e){setTimeout((function(){if("number"==typeof e.selectionStart)e.selectionStart=e.selectionEnd=e.value.length;else if(void 0!==e.createTextRange){e.focus();var t=e.createTextRange();t.collapse(!1),t.select()}}),10)}static objectToFlatMap(e,t=""){return t=""===t?t:t+".",(null!=e?Object.getOwnPropertyNames(e):[]).filter((e=>"__"!==e.slice(0,2))).map((r=>"object"==typeof e[r]?this.objectToFlatMap(e[r],t+r):t+r)).flat()}static parseJSON(e,t){if("string"==typeof e&&"array"===e.toLowerCase())return[];if(""===e||'""'===e)return"array"===t?[]:{};if("string"!=typeof e)return void 0===e?"array"===t?[]:{}:e;{let r;try{r=JSON.parse(e)}catch(o){console.error("Utisl.parseJSON",{error:o,data:e,expectedType:t}),r=null}if(null!==r&&""!==r)return"array"===t?"function"==typeof r.splice?r:[]:r;switch(t){case"array":return[];case"object":return{};default:return r}}}static reindexList(e){e.forEach(((e,t)=>{e._index=t,e._displayIndex=t+1}))}static replaceNullValue(e,t){if(Array.isArray(e))e.forEach((e=>r.replaceNullValue(e,t)));else for(let r in e)void 0!==e[r]&&null!==e[r]||(e[r]=t)}static safeStringify(e){return JSON.stringify(e,((e,t)=>(t instanceof Map&&(t=Array.from(t)),"__shguid"!==e&&"__"===e.slice(0,2)?void 0:t)))}static safp(e,t,o,n){return r.searchArrayForProperty(e,t,o,n)}static searchArrayForProperty(e,t,r,o){if(e){switch(typeof o){case"undefined":o="first";break;case"boolean":o=o?"first":"all"}for(var n,a=[],s=(n=t.indexOf(".")>-1?t.split("."):[t]).length,i=e.length,l=0;l<i;l++){var c=e[l][n[0]];if(c)for(var d=1;d<s&&c[n[d]];d++)c=c[n[d]];if(c===r)switch(o){case"all":a.push(e[l]);break;case"first":return e[l];case"index":return l}}return a.length>0?a:null}console.warn("Error, cant search on a null list.")}static setDeepProperty(e,t,o,n=0){const a=t.split(".");return e[a[n]]||(e[a[n]]={}),n<a.length-1?r.setDeepProperty(e[a[n]],t,o,n+1):e[a[n]]=o,e}static trace(e){try{AppData.consoleDebugActive&&console.debug(e)}catch(t){alert(e)}}static toCamelCase(e){return e.slice(0,1).toLowerCase()+e.slice(1)}static toTitleCase(e,t=!0){return e.slice(0,1).toUpperCase()+(t?e.slice(1).toLowerCase():e.substr(1))}static zeroFill(e,t){let r=e.toString();return r.length<t?r.padStart(t,"0"):r}}const o=r;class n extends EventTarget{#e=[];get activeComponents(){return this.#e}constructor(e,t){if(super(),null!=e&&""!==e||(e=this.constructor.name.substr(0,1).toLowerCase()+this.constructor.name.substr(1)),"string"!=typeof e)throw new Error("Jaw id must be passed");Object.defineProperty(this,"className",{configurable:!1,enumerable:!0,value:e,writable:!1}),Object.defineProperty(this,"id",{configurable:!1,enumerable:!0,value:e,writable:!1}),Object.defineProperty(this,"addComponents",{configurable:!1,value:this.addComponents,writable:!1}),this.__renderFields=[],this.isInitialized=!1,this.currentOpenOptions={},this.route=null,this.$store={},this.__store={getLabel:function(){return function(e,t){return e.indexOf("{{")>-1&&(e=t(e)),t(V.labels.labels[e])}}},this.__activeComponents=[],this.__autoBoundProperties=[],this.__childTemplates={},this.__dynamicDataBindings={},this.__listeners={},this.__methods={},this.__viewBinds={},this.__viewBinds2={},this.__storeHashMap=new Map}addComponent(e){return void 0===e?(console.error("Jaw.addComponent: You can't pass this type of data (must be a component)"),this.#e):("string"==typeof e&&(console.warn("You should avoid to use string to add component. The right way is to pass the Component instance."),e=V.__components[e]),this.#e.push(e),this.#e)}addComponents(e){return Array.isArray(e)?e.forEach((e=>{this.addComponent(e)}),this):console.error("Jaw.addComponents: You can't pass this type of data (must be an Array)"),this.#e}get(e){if(arguments.length>1&&console.warn("WARNING!! The jaw.get() method has deprecated the 'forcedType' parameter, and now works only on jaw-local data"),void 0===e)return this.__store;if(Array.isArray(e)){const t=[];return e.forEach((e=>{const r=this.__store[e];t.push(r)})),t}return this.__store[e]}init(){this.trace("The init method for '"+this.className+"' Jaw has not been implemented. (I'm just setting this as Initialized)","info"),this.isInitialized=!0}_extractComponentsValidMethodList(e,t,r){const o=[];return e.forEach((e=>{-1===t.indexOf(e.id)?(o.push(...this._extractValidMethodList(e)),t.push(e.id)):r.push("= NO "+e.id),e.activeComponents.length>0&&o.push(...this._extractComponentsValidMethodList(e.activeComponents,t,r))})),o}_extractValidMethodList(e){const t=[];for(var r in e)"function"==typeof e[r]&&"Handler"===r.slice(-7)&&(t.find((e=>e.handlerName===r))||t.push({handlerName:r,handlerHolder:e,_from:"_extractValidMethodList-targetObject"}));if(e.__proto__ instanceof n){const r=e.__proto__;Object.getOwnPropertyNames(e.__proto__).forEach((o=>{"function"==typeof r[o]&&"constructor"!==o&&"Handler"===o.slice(-7)&&(t.find((e=>e.handlerName===o))||t.push({handlerName:o,handlerHolder:e,_from:"_extractValidMethodList-referenceObject"}))})),t.push(...this._extractValidMethodList(e.__proto__))}return t}_initComponents(e=null,t=[]){null===e&&(e=this.#e),e.forEach((function(e){this.#e.find((t=>t.id===e.id))||this.#e.push(e),t.includes(e.id)||("function"==typeof e.jawInit&&e.jawInit.call(e,{jaw:currJaw}),"function"!=typeof e.init||e.isInitialized||(e.init.call(e),e.isInitialized=!0),t.push(e.id),e.activeComponents.length>0&&this._initComponents(e.activeComponents,t))}),this)}set(e,t){arguments.length>2&&console.error("WARNING!! The Jaw.set() method has been called with more than 2 parameters.");let r=0;if(Array.isArray(e))for(var o=e.length,n=0;n<o;n++){var a=e[n];if(""===a.name)throw new Error("Can't pass an empty 'name' for a property");r+=this.__singleSet(a.name,a.value)}else if("object"==typeof e)for(let t in e)r+=this.__singleSet(t,e[t]);else if("string"==typeof e){if(""===e)throw new Error("Can't pass an empty 'name' for a property");r+=this.__singleSet(e,t)}else console.error("Jaw.set: This kind of data could not be used.");V.trace({__store:this.__store,nameOrItems:e,value:t,type:typeof e},V.TRACE_LOG),V.settings.enableJawStoreAutoRender&&r>0&&(V.trace(`%c SharkMVC: AUTORENDER TRIGGERED by JAW (${r})`,"background-color: red; color: white; font-weight: bold;",{nameOrItems:e,value:t},V.TRACE_INFO),V.render(),V.trace("%c SharkMVC: AUTORENDER COMPLETED by JAW","background-color: red; color: white; font-weight: bold;",V.TRACE_INFO))}__singleSet(e,t){this.__store[e]=t;const r=this;this.$store.hasOwnProperty(e)||Object.defineProperty(this.$store,e,{configurable:!0,enumerable:!0,get:()=>r.__store[e],set(t){const n=r.__store[e];r.__store[e]=t,V.settings.enableJawStoreAutoRender&&o.computeHash(t)!==o.computeHash(n)&&V.render()}});let n=this.__store[e],a=n,s="",i=a!==s;if(void 0!==n)try{a=o.computeHash(n)}catch(e){a=n}if(void 0!==t)try{s=o.computeHash(t)}catch(e){s=t}return i=this.__storeHashMap.has(e)?this.__storeHashMap.get(e)!==s:a!==s,this.__storeHashMap.set(e,s),this.__store[e]=t,i}}n.prototype.emit=function(e,r){return t()(this).trigger(e,r)},n.prototype.off=function(e,r){return t()(this).off(e,r)},n.prototype.on=function(e,r){return t()(this).on(e,r)},n.__getNodeDepth=function(e){let t=0;for(;"BODY"!=e.nodeName;)e=e.parentNode,t++;return t},n.prototype.smartListen2=function(e,r){const o=[];for(let e in this)"function"==typeof this[e]&&e.indexOf("Handler")>-1&&o.push({handlerName:e,handlerHolder:this});this.activeComponents.forEach((e=>{for(let t in e)"function"==typeof e[t]&&t.indexOf("Handler")>-1&&o.push({handlerName:t,handlerHolder:e})})),o.forEach((e=>{let r,o=e.handlerName;r=o.lastIndexOf("_")>-1?o.substr(0,o.lastIndexOf("_")):o;let a=r,s="#"+a,i=!0,l=document.querySelector(s),c="singleNode";if(!l)if(s="."+a,l=document.querySelectorAll(s),0===l.length)V.__controllers[r]?c="manager":i=!1;else{c="multiNode";const t=[];l.forEach((e=>{t.push(n.__getNodeDepth(e))}));const r=Math.min(...t);e.depthList=t,e.minDepth=r}if(e.targetType=c,i){let o=!1;"manager"===c&&(e.handlerHolder.__listeners[r]?e.handlerHolder.__listeners[r][eventName]?"component"===e.handlerHolder.type&&(o=!0):o=!0:(o=!0,e.handlerHolder.__listeners[r]={}),o&&(this.trace("Auto-listener assigned to the '"+V.__controllers[r].className+"' Controller for the '"+eventName+"' event.","log"),e.handlerHolder.__listeners[r][eventName]={handler:currHandler,target:"controller",type:"autoListener"},"component"===e.handlerHolder.type&&t()(V.__controllers[r]).off(eventName,e.handlerHolder[currHandler]),t()(V.__controllers[r]).on(eventName,e.handlerHolder[currHandler])))}}),this),this.trace("Jaw.prototype.smartListen2: validMethodList",o,"log")},n.prototype.smartListen=function(e,r){void 0===r&&(r=!1);var o=this._extractValidMethodList(this);this.trace("smartListen",{__validMethodList:this.__validMethodList,jaw:this},"log");const n=[],a=[];o.push(...this._extractComponentsValidMethodList(this.activeComponents,n,a)),this.trace("Jaw.prototype.smartListen: data",{processedComponentList:n,__activeComponents:this.activeComponents,notProcessedComponentList:a,validMethodList:o},"log"),this.trace("Jaw.prototype.smartListen: validMethodList",o,"log"),this.__validMethodList=o,o.forEach((function(o){var n,a=o.handlerName,s=!0;n=a.indexOf("_")>-1?a.substr(0,a.indexOf("_")):a;var i=o.handlerHolder.className+"_"+n,l="#"+i,c=a.substring(a.indexOf("_")+1,a.indexOf("Handler")),d=t()(l);if(e){var p=t()(e);r&&"#"+n===e?(this.trace(d,p,"log"),d=p):(0===(d=p.find(l)).length&&(l="#"+n,d=p.find(l)),0===d.length&&(l="."+i,d=p.find(l)),0===d.length&&(l="."+n,d=p.find(l)),d.selector!==p.selector&&0===d.closest(p).length&&(s=!1))}else 0===d.length&&(l="#"+n,d=t()(l)),0===d.length&&(l="."+i,d=t()(l)),0===d.length&&(l="."+n,d=t()(l));if(s){var u=!1;if(d.length>0){if(o.handlerHolder.__listeners||(o.handlerHolder.__listeners={}),o.handlerHolder.__listeners[l]?o.handlerHolder.__listeners[l][c]?"component"===o.handlerHolder.type&&(u=!0):u=!0:(u=!0,o.handlerHolder.__listeners[l]={}),u){this.trace("Auto-listener assigned to '"+l+"' item of the '"+o.handlerHolder.className+"' "+o.handlerHolder.type+" for the '"+c+"' event.","log");var h=function(e){e.data.handler.call(o.handlerHolder,e,this.dataset)};"component"===o.handlerHolder.type&&o.handlerHolder.__listeners[l][c]&&o.handlerHolder.__listeners[l][c].handler&&d.off(c,o.handlerHolder.__listeners[l][c].handler),o.handlerHolder.__listeners[l][c]={context:"jaw",handler:h,originalHandler:a,target:"DOM",type:"autoListener"},d.on(c,{handler:o.handlerHolder[a],handlerHolder:o.handlerHolder},h),o.handlerHolder.__methods||(o.handlerHolder.__methods={}),o.handlerHolder.__methods[a]&&o.handlerHolder.__methods[a].settings&&void 0!==o.handlerHolder.__methods[a].settings.smartUnlisten&&(o.handlerHolder.__listeners[l][c].smartUnlisten=o.handlerHolder.__methods[a].settings.smartUnlisten)}}else V.__controllers[n]?(o.handlerHolder.__listeners[n]?o.handlerHolder.__listeners[n][c]?"component"===o.handlerHolder.type&&(u=!0):u=!0:(u=!0,o.handlerHolder.__listeners[n]={}),u&&(this.trace("Auto-listener assigned to the '"+V.__controllers[n].className+"' Controller for the '"+c+"' event.","log"),o.handlerHolder.__listeners[n][c]={handler:a,target:"controller",type:"autoListener"},"component"===o.handlerHolder.type&&t()(V.__controllers[n]).off(c,o.handlerHolder[a]),t()(V.__controllers[n]).on(c,o.handlerHolder[a]))):V.__components[n]&&(o.handlerHolder.__listeners[n]?o.handlerHolder.__listeners[n][c]?"component"===o.handlerHolder.type&&(u=!0):u=!0:(u=!0,o.handlerHolder.__listeners[n]={}),u&&(this.trace("Auto-listener assigned to the '"+V.__components[n].className+"' Component for the '"+c+"' event.","log"),o.handlerHolder.__listeners[n][c]={handler:a,target:"component",type:"autoListener"},o.handlerHolder[a]=o.handlerHolder[a].bind(o.handlerHolder),t()(V.__components[n]).off(c,o.handlerHolder[a]),t()(V.__components[n]).on(c,o.handlerHolder[a])))}else this.trace("Auto-listener not assigned for the '"+c+"' event because of the container selector. The target: ",d,"log")}),this)},n.prototype.smartUnlisten=function(e){this.trace("smartUnlisten",{__validMethodList:this.__validMethodList},"log"),this.__validMethodList&&this.__validMethodList.forEach((e=>{for(var r in e.handlerHolder.__listeners){var o=e.handlerHolder.__listeners[r];for(var n in o){var a=o[n];if(!0===a.smartUnlisten||void 0===a.smartUnlisten){switch(a.target){case"DOM":t()(r).off(n,e.handlerHolder[a.handler]);break;case"component":t()(V.__components[r]).off(n,e.handlerHolder[a.handler]);break;case"controller":t()(V.__components[r]).off(n,e.handlerHolder[a.handler]),t()(V.__controllers[r]).off(n,e.handlerHolder[a.handler])}delete e.handlerHolder.__listeners[r][n]}}delete e.handlerHolder.__listeners[r]}}))},n.prototype.trace=function(e,t){V&&V.trace&&V.trace(e,t)},n.prototype.updateDisplay=function(e,r){V.get(e,"appData"),console.warn("UPDATE DISPLAY!!!!!!");var o=t()("body"),n="sh-model",a=o.find("[data-"+n+"]");if(0===a.length&&(n="sh-reference-model",a=o.find("[data-"+n+"]")),(a=o.find("[data-"+n+"='"+e+"']")).length>0){var s,i=(e=a.data(n)).indexOf("["),l=-1;i>-1&&(l=e.substring(i+1,e.indexOf("]")),e=e.substr(0,i)),(s=-1===l?V.getReferenceModel(e):V.getReferenceModel(e)[l]).__dirtyProperties.map((function(r){var o=a.find("[data-sh-prop^='"+r+"@']").add("[data-sh-model-prop^='"+r+"@']");if(o.length>0){var n=V.getTemplate("models."+e+"_"+r);if(""!==n){var i=t().extend({},V.__templateMap,jaw.__childTemplates),l=Mustache.render(n,this.__store,i);o.html(l)}else o.html(s[r])}})),s.__dirtyProperties=[],s.__isDirty=!1}};const a=n;var s=l(410),i=l.n(s),d=l(230),p=l.n(d);const u=class{#t=new Set;#r="";constructor(e){this.model=e,this.parseModelValues()}cssClasses(){return this.#r}addClasses(...e){console.log({classes:e,arguments}),Array.isArray(e)||(e=[e]),e.forEach((e=>this.#t.add(e))),this.#o()}removeClasses(...e){Array.isArray(e)||(e=[e]),e.forEach((e=>this.#t.delete(e))),this.#o()}#o(){this.#r=[...this.#t].map((e=>e+" ")).join("")}#n(){for(let e in this.model)"function"!=typeof this.model[e]&&(this[e]=this.model[e])}parseModelValues(e){return this.#n(e)}setModel(e){this.model=e}};class h{constructor(e,t,r){Object.defineProperties(this,{__shguid:{value:o.generateGUID(),writable:!1}}),r&&o.matchProperties(this,r,{createMissingProperties:!0,matchEmptyParameters:!0}),Object.defineProperties(this,{__clean:{value:e=>(this.__dirtyProperties=e?this.__dirtyProperties.filter((t=>-1===e.indexOf(t.property))):[],this.__isDirty=this.__dirtyProperties.length>0,this.__dirtyProperties),writable:!1},__export:{value:e=>{const t={};if(e&&e.hasOwnProperty("fields"))e.fields.forEach((e=>{this.hasOwnProperty(e)&&(t[e]=this[e])}));else for(let e in this)"function"!=typeof this[e]&&"__"!==e.substr(0,2)&&"jQuery"!==e.substr(0,6)&&(t[e]=this[e]);return t},writable:!1},__import:{value:(e,t)=>{const r=Object.assign({createMissingProperties:!1,matchEmptyParameters:!0},t);return o.matchProperties(this,e,r)},writable:!1},__restore:{value:e=>{e||([...this.__dirtyProperties].forEach((e=>{this.set(e.property,e.originalValue)})),this.__dirtyProperties=[],this.__isDirty=!1)},writable:!1},__setPropertyDirtiness:{value:(e,t)=>{const r=this.__dirtyProperties.findIndex((t=>t.property===e));if(-1===r)this.__dirtyProperties.push({property:e,originalValue:t.oldValue});else if(t.newValue===this.__dirtyProperties[r].originalValue)this.__dirtyProperties.splice(r,1);else if(Array.isArray(t.newValue)&&Array.isArray(this.__dirtyProperties[r].originalValue))try{o.computeHash(t.newValue)===o.computeHash(this.__dirtyProperties[r].originalValue)&&this.__dirtyProperties.splice(r,1)}catch(e){console.error(e)}},writable:!1},__toJSON:{value:e=>{"boolean"==typeof e||(e=!1);var t={};for(var r in this)"function"==typeof this[r]||"__"===r.substr(0,2)&&"__shguid"!==r&&!e||"jQuery"===r.substr(0,6)||(t[r]=this[r]);return t},writable:!1}}),Object.defineProperties(this,{__dirtyProperties:{value:[],writable:!0}}),this.__boundProperties=[],this.__isDirty=!1,this.__modelStructure=r,this.__renderer=new u(this)}addRenderer(e){this.__renderer=this.__=e,this.__renderer.setModel(this)}clean(e){return this.__clean(e)}emit(e,r){return t()(this).trigger(e,r)}export(e){return this.__export(e)}exportArrayField(e,t="JSON"){return this.__exportArrayField(e,t)}__exportArrayField(e,t="JSON"){const r=o.getDeepProperty(this,e);let n;return"JSON"===t&&(n=JSON.stringify(r)),n}exportBooleanField(e,t="number"){return this.__exportBooleanField(e,t)}__exportBooleanField(e,t="number"){const r=o.getDeepProperty(this,e);let n;switch(t){case"number":n=!0===r?1:0;break;case"string":n=r.toString()}return n}exportDateField(e,t="ISO",r=!0){return this.__exportDateField(e,t,r)}__exportDateField(e,t="ISO",r=!0){const n=o.getDeepProperty(this,e);let a;const s=p()(n);return a=s.isValid()?r?s.utc().format("YYYY-MM-DD HH:mm:ss"):s.format("YYYY-MM-DD HH:mm:ss"):"0000-00-00 00:00:00",a}exportNumberField(e,t){return this.__exportNumberField(e,t)}__exportNumberField(e,t){const r=o.getDeepProperty(this,e);let n;return"number"==typeof r?n=r:"string"==typeof r&&(n=parseFloat(r)),n}exportObjectField(e,t="JSON"){return this.__exportObjectField(e,t)}__exportObjectField(e,t="JSON"){const r=o.getDeepProperty(this,e);let n;return"JSON"===t&&(n=JSON.stringify(r)),n}import(e,t){return this.__import(e,t)}importBooleanField(e,t){return this.__importBooleanField(e,t)}__importBooleanField(e,t){if(void 0===t||null==t)return!1;let r,n=!1;return"number"==typeof t?(r=1===t,n=!0):"string"==typeof t?(r="false"!==t.toLowerCase()&&(1===parseInt(t)||"true"===t.toLowerCase()),n=!0):"boolean"==typeof t&&(r=t,n=!0),n&&o.setDeepProperty(this,e,r),n}importDateField(e,t,r=!0){return this.__importDateField(e,t,r)}__importDateField(e,t,r){if(void 0===t||null==t)return!1;let n;return n=r?p().utc(t).local():p()(t),o.setDeepProperty(this,e,n),n.isValid()}importNumberField(e,t,r){return this.__importNumberField(e,t,r)}__importNumberField(e,t,r){if(void 0===t||null==t)return!1;let n;return"number"==typeof t?n=t:"string"==typeof t&&(n=parseFloat(t)),isNaN(n)?void 0!==r&&"number"==typeof r&&(o.setDeepProperty(this,e,r),!0):(o.setDeepProperty(this,e,n),!0)}importField(e,t,r){if(r=Object.assign({acceptUndefined:!1,dataType:"auto",defaultValue:void 0,useUTC:!0},r),(void 0===t||null==t)&&!r.acceptUndefined)return!1;switch(r.dataType){case"auto":break;case"boolean":return this.importBooleanField(e,t);case"date":return this.importDateField(e,t,r.useUTC);case"number":return this.importNumberField(e,t,r.defaultValue)}return!0}static inferTypes(){const e=new this,t={};console.log("Inferring types for",this.name);for(let r in e)if("__"!==r.slice(0,2)&&"_"!==r.slice(0,1))switch(console.log(r,e[r]),e[r]){case 0:case-1:t[r]="number";break;case"0000-00-00 00:00:00":case"0000-00-00":t[r]="datetime";break;case!0:case!1:t[r]="boolean";break;case"":t[r]="string";break;default:Array.isArray(e[r])?t[r]="array":e[r].constructor===Object?t[r]="object":e[r].prototype instanceof h&&(t[r]=e[r])}this.inferTypes=t,console.log("Inferred types",t,this)}isDirty(e=null,t="any"){return null==e?this.__isDirty:(Array.isArray(e)||(e=[e]),"any"===t?this.__dirtyProperties.filter((t=>e.includes(t.property))).length>0:"all"===t?this.__dirtyProperties.filter((t=>e.includes(t.property))).length===e.length:void 0)}off(e,r){return t()(this).off(e,r)}on(e,r){return t()(this).on(e,r)}restore(e){this.__restore(e)}__singleSet(e,t,r){let n=o.getDeepProperty(this,e);const a=o.computeHash(n);let s=!0;switch(typeof n){case"number":V.trace("%cChiamato il metodo set e la propietà è di tipo "+typeof n,"font-size: 16px; color: red;",V.TRACE_LOG),t=parseFloat(t);break;case"object":if(Array.isArray(n)&&!Array.isArray(t)){let e=Array.from(n),r=e.indexOf(t);if(r>-1)e.splice(r,1);else{let r=e.indexOf(parseFloat(t));r>-1?e.splice(r,1):e.push(t)}t=e,V.trace(`%cChiamato il metodo set e la propietà è di tipo ${typeof e} ed è un array`,"font-size: 16px; color: red;",V.TRACE_LOG)}else V.activeFeatures.moment&&(n._isAMomentObject||n instanceof p())?(V.trace(`%cChiamato il metodo set e la propietà è di tipo ${typeof n} ed è un moment`,"font-size: 16px; color: red;",V.TRACE_LOG),t=p()(t)):V.trace("%cChiamato il metodo set e la propietà è di tipo "+typeof n,"font-size: 16px; color: red;",V.TRACE_LOG);if(Array.isArray(n)&&Array.isArray(t))try{s=a!==o.computeHash(t)}catch(e){console.error(e)}break;case"string":V.trace("%cChiamato il metodo set e la propietà è di tipo "+typeof n,"font-size: 16px; color: red;",V.TRACE_LOG),void 0!==t?"function"==typeof t.toString&&(t=t.toString()):t=""}var i={modelName:this.__modelName,newValue:t,oldValue:o.getDeepProperty(this,e),property:e};if(o.setDeepProperty(this,e,t),i.oldValue!==i.newValue&&s){this.__setPropertyDirtiness(e,i),this.__isDirty=this.__dirtyProperties.length>0,V.settings.enableSmartModelSetUpdatesView&&this.updateScreenWithModelValue(e,r,t,i),"function"==typeof this.onDataChanged&&this.onDataChanged.call(this,i);const n=o.toTitleCase(e,!1).replace(/\./g,"_");"Data"!==n&&n!==e&&"function"==typeof this["on"+n+"Changed"]&&this["on"+n+"Changed"].call(this,i),this.emit("dataChanged",i),"data"!==e&&this.emit(e+"Changed",i)}}set(e,t,r){if(Array.isArray(e))e.forEach((e=>{this.__singleSet(e.name,e.value,r)}));else if("object"==typeof e)for(let t in e)this.__singleSet(t,e[t],r);else"string"==typeof e?this.__singleSet(e,t,r):console.error("Shark.set: This kind of data could not be used.");this.__renderer&&"function"==typeof this.__renderer.parseModelValues&&this.__renderer.parseModelValues({name:e,value:t})}toJSON(e){return this.__toJSON(e)}toString(e){return JSON.stringify(this.toJSON(e))}updateScreenWithModelValue(e,t,r,o){document.querySelectorAll(`[data-sh-prop="${e}"]`).forEach((e=>{if(e!==t){const t=e.closest("[data-shguid]");let n=t?t.dataset.shguid:"";if(""===n||n===this.__shguid){let t=!1,n=!1;switch(e.nodeName.toUpperCase()){case"INPUT":switch(e.type.toUpperCase()){case"CHECKBOX":case"RADIO":break;default:t=!0}break;case"SELECT":case"TEXTAREA":t=!0;break;default:n=!0}t?e.value=r:n?e.innerHTML=r:V.trace("Non aggiorno il valore",{eventData:o},V.TRACE_LOG)}}}))}updateScreenWithModelValues(){for(let e in this)console.log({currProp:e,value:this[e]}),this.updateScreenWithModelValue(e,null,this[e],"no event")}}const _=h;var f=function(){if(void 0===i())throw new Error("Mustache is needed to use MustacheRenderer!")};f.prototype.render=function(e,r){if(console.time("MustacheRenderer.render"),V.trace("MustacheRenderer.render: ",e,r,V.TRACE_INFO),r=t().extend({renderOnScreen:!0},r),!e.__templateParsed){for(var n=e.templateContent,a=0,s=n.match(/{{>[\w\.]+\}\}/g);s&&a<100;)s.forEach((function(e){var t=e.replace("{{>","").replace("}}","");t?n=n.replace(e,V.getTemplate(t)):V.trace("MustacheRenderer.render > Missing SubTemplate: "+t,V.TRACE_ERROR)})),s=n.match(/{{>[\w\.]+\}\}/g),a++;for(var l=n.match(/{{=>[\w\.]+\}\}/g);l;)l.forEach((function(e){let t=!0,r=e.replace("{{=>","").replace("}}","");r.indexOf(".")>-1&&(r=r.substr(0,r.indexOf(".")),t=!1);let o=V.__components[r];if(o){if(t&&(n=n.replace(e,o.templateContent)),o.__templates)for(let e in o.__templates)n=n.replace(`{{=>${r}.${e}}}`,o.__templates[e])}else V.trace("MustacheRenderer.render > Missing component: "+r,V.TRACE_ERROR),n=n.replace(e,e.replace("{{=>","{{>"))})),l=n.match(/{{=>[\w\.]+\}\}/g);let t=new RegExp(/<shark-[\w]+.+\/*>/g),r=n.match(t);for(;r;)r.forEach((function(e){let t=e,r="";t.indexOf("></shark-")>-1&&(t=t.substr(0,t.indexOf("></shark-"))),t.indexOf("/>")>-1&&(t=t.substr(0,t.indexOf("/>"))),t.indexOf(">")>-1&&(t=t.substr(0,t.indexOf(">"))),t.indexOf(" ")>-1&&(t=t.substr(0,t.indexOf(" "))),t=t.replace("<shark-",""),t.indexOf("-")>-1&&(t=o.dashedToCamel(t));let a=e.indexOf('template="');a>-1&&(r=e.substring(a+10,e.indexOf('"',a+11)),"default"===r&&(r=""));let s=V.__components[t];s?""===r?n=n.replace(e,s.templateContent):s.__templates&&s.__templates[r]&&(n=n.replace(e,s.__templates[r])):(V.trace("MustacheRenderer.render > Missing component: "+t+", removing from template.",V.TRACE_ERROR),n=n.replace(e,""))})),r=n.match(t);n=n.replace(/data-sh-model=\"(.\S+)\"/g,'$& data-shguid="{{$1.__shguid}}"'),e.__autoBoundListSection=[];const i=n.match(/{{\[\>[\w\.]+\}\}/g);i&&(i.forEach((t=>{const r=t.replace("{{[>","").replace("}}","");let o=new RegExp("{{\\[\\>"+r+"\\}\\}([\\s\\S]*){{"+r+"\\<\\]\\}\\}","g").exec(n)[1];const a=o.indexOf(">");o=o.substr(0,a)+' data-shguid="{{__shguid}}"'+o.substr(a),console.log({listSection:t}),e.__autoBoundListSection.push({propertyName:r,template:o});const s=new RegExp("{{\\[\\>("+r+")\\}\\}","g"),i=new RegExp("{{("+r+")\\<\\]\\}\\}","g");n=(n=n.replace(s,'<shark-list property="'+r+'">{{#$1}}')).replace(i,"{{/$1}}</shark-list>")})),console.log({__autoBoundListSection:e.__autoBoundListSection})),console.time("autoBind"),V.trace({renderField:n.match(/{{[\w\.]+\}\}/g),renderListOrPresence:n.match(/{{#[\w\.]+\}\}/g),renderAbsence:n.match(/{{\^[\w\.]+\}\}/g)},V.TRACE_LOG),V.trace({renderField:[...new Set(n.match(/{{[\w\.]+\}\}/g))].map((e=>e.replace("{{","").replace("}}",""))),renderListOrPresence:[...new Set(n.match(/{{#[\w\.]+\}\}/g))].map((e=>e.replace("{{#","").replace("}}",""))),renderAbsence:[...new Set(n.match(/{{\^[\w\.]+\}\}/g))].map((e=>e.replace("{{^","").replace("}}","")))},V.TRACE_LOG);const c=[...[...new Set(n.match(/{{[\w\.]+\}\}/g))].map((e=>e.replace("{{","").replace("}}",""))),...[...new Set(n.match(/{{#[\w\.]+\}\}/g))].map((e=>e.replace("{{#","").replace("}}",""))),...[...new Set(n.match(/{{\^[\w\.]+\}\}/g))].map((e=>e.replace("{{^","").replace("}}","")))];V.__autoBoundProperties=[];for(const t in V.__store)c.indexOf(t)>-1&&(V.__autoBoundProperties.push(t),e.__autoBoundProperties.push(t));V.trace({renderField:c,SharkAutoBoundProperties:V.__autoBoundProperties,JawAutoBoundProperties:e.__autoBoundProperties}),console.timeEnd("autoBind");for(const e in V.__store)V.__store[e]instanceof _&&(V.__store[e].__boundProperties=[]);const d=n.match(/{{[\w\.]+\}\}/g);d&&d.length>0&&d.forEach((e=>{const t=e.replace("{{","").replace("}}","").split("."),r=V.get(t[0]);r&&r instanceof _&&-1===r.__boundProperties.indexOf(t[1])&&(r.__boundProperties.push(t[1]),V.trace("dynamicFields",r,"log"))})),V.__dynamicSections={};const p=n.match(/\<shark-section(.*?)\>/g);p&&p.length>0&&(p.forEach((e=>{const t=e,r="</shark-section>",o={closeTag:r,openTag:t,rGuid:V.__generateGUID("rid_"),storeReference:/model=\"(.*?)\"/g.exec(e)[1]};var a=new RegExp(t+"(.*?)"+r.replace("/","/"),"gs");o.templateContent=a.exec(n)[1],n=window.customElements?n.replace(e,`<shark-section data-sh-rguid='${o.rGuid}'>${t}`).replace(r,`${r}</shark-section>`):n.replace(e,`<span data-sh-rguid='${o.rGuid}'>${t}`).replace(r,`${r}</span>`),V.__dynamicSections[o.storeReference]?V.__dynamicSections[o.storeReference].push(o):V.__dynamicSections[o.storeReference]=[o]})),V.trace("dynamicSections",V.__dynamicSections,"log")),n=n.replace(/\[\[([\w\.]+)\]\]/g,"{{{__renderer.$1}}}"),e.__parsedTemplate=n,e.__templateParsed=!0}const c={},d=[];e.activeComponents.forEach((e=>{-1===d.indexOf(e.id)&&Object.assign(c,e.__store),e.activeComponents.forEach((e=>{-1===d.indexOf(e.id)&&Object.assign(c,e.__store)}))}));const p=t().extend({},V.__templateMap,e.__childTemplates),u=Object.assign({},V.__store,c,e.__store),h=i().render(e.__parsedTemplate,u,p);if(!r.renderOnScreen)return console.timeEnd("MustacheRenderer.render"),h;t()(r.container).html(h),console.timeEnd("MustacheRenderer.render")},f.prototype.renderItem=function(e){if(!e.templateSource)throw new Error("MustacheRenderer.renderItem: To render an item you must specify the template parameter");var r={append:!1,childTemplates:{},containerSelector:"",renderItems:{},replace:!1,templateSource:null};if(t().extend(!0,r,e),V.trace("MustacheRenderer.renderItem",r,V.TRACE_INFO),e.replace&&""===e.containerSelector)throw new Error("Could not use replace parameter without setting a containerSelector!");var o=t().extend({},V.__templateMap,r.childTemplates),n=i().render(r.templateSource,r.renderItems,o);if(""===e.containerSelector||!e.containerSelector)return n;e.append?t()(e.containerSelector).append(n):e.replace?t()(e.containerSelector).replaceWith(n):t()(e.containerSelector).html(n)};var m=l(182),g=l.n(m),y=l(985),v=l.n(y),w=l(717),b=l.n(w),O=l(311),R=l.n(O),x=l(208),E=l.n(x);const C=class{constructor(){if(void 0===i())throw new Error("Mustache is needed to use VirtualDOMRenderer!");this.rootNode=null,this.tree=null}render(e,r){return new Promise(((n,a)=>{if(console.time("VirtualDOMRenderer.render"),V.trace("VirtualDOMRenderer.render: ",e,r,V.TRACE_INFO),r=t().extend({renderOnScreen:!0},r),!e.__templateParsed){for(var s=e.templateContent,l=s.match(/{{=>[\w\.]+\}\}/g);l;)l.forEach((function(e){let t=!0,r=e.replace("{{=>","").replace("}}","");r.indexOf(".")>-1&&(r=r.substr(0,r.indexOf(".")),t=!1);let o=V.__components[r];if(o){if(t&&(s=s.replace(e,o.templateContent)),o.__templates)for(let e in o.__templates)s=s.replace(`{{=>${r}.${e}}}`,o.__templates[e])}else V.trace("VirtualDOMRenderer.render > Missing component: "+r,V.TRACE_ERROR),s=s.replace(e,e.replace("{{=>","{{>"))})),l=s.match(/{{=>[\w\.]+\}\}/g);let t=new RegExp(/<shark-[\w]+.+\/*>/g),r=s.match(t);for(;r;)r.forEach((function(e){let t=e,r="";t.indexOf("></shark-")>-1&&(t=t.substr(0,t.indexOf("></shark-"))),t.indexOf("/>")>-1&&(t=t.substr(0,t.indexOf("/>"))),t.indexOf(">")>-1&&(t=t.substr(0,t.indexOf(">"))),t.indexOf(" ")>-1&&(t=t.substr(0,t.indexOf(" "))),t=t.replace("<shark-",""),t.indexOf("-")>-1&&(t=o.dashedToCamel(t));let n=e.indexOf('template="');n>-1&&(r=e.substring(n+10,e.indexOf('"',n+11)),"default"===r&&(r=""));let a=V.__components[t];a?""===r?s=s.replace(e,a.templateContent):a.__templates&&a.__templates[r]&&(s=s.replace(e,a.__templates[r])):(V.trace("VirtualDOMRenderer.render > Missing component: "+t+", removing from template.",V.TRACE_ERROR),s=s.replace(e,""))})),r=s.match(t);s=s.replace(/data-sh-model=\"(.\S+)\"/g,'$& data-shguid="{{$1.__shguid}}"'),e.__autoBoundListSection=[];const n=s.match(/{{\[\>[\w\.]+\}\}/g);n&&(n.forEach((t=>{const r=t.replace("{{[>","").replace("}}","");let o=new RegExp("{{\\[\\>"+r+"\\}\\}([\\s\\S]*){{"+r+"\\<\\]\\}\\}","g").exec(s)[1];const n=o.indexOf(">");o=o.substr(0,n)+' data-shguid="{{__shguid}}"'+o.substr(n),console.log({listSection:t}),e.__autoBoundListSection.push({propertyName:r,template:o});const a=new RegExp("{{\\[\\>("+r+")\\}\\}","g"),i=new RegExp("{{("+r+")\\<\\]\\}\\}","g");s=(s=s.replace(a,'<shark-list property="'+r+'">{{#$1}}')).replace(i,"{{/$1}}</shark-list>")})),console.log({__autoBoundListSection:e.__autoBoundListSection})),console.time("autoBind"),V.trace({renderField:s.match(/{{[\w\.]+\}\}/g),renderListOrPresence:s.match(/{{#[\w\.]+\}\}/g),renderAbsence:s.match(/{{\^[\w\.]+\}\}/g)},V.TRACE_LOG),V.trace({renderField:[...new Set(s.match(/{{[\w\.]+\}\}/g))].map((e=>e.replace("{{","").replace("}}",""))),renderListOrPresence:[...new Set(s.match(/{{#[\w\.]+\}\}/g))].map((e=>e.replace("{{#","").replace("}}",""))),renderAbsence:[...new Set(s.match(/{{\^[\w\.]+\}\}/g))].map((e=>e.replace("{{^","").replace("}}","")))},V.TRACE_LOG);const a=[...[...new Set(s.match(/{{[\w\.]+\}\}/g))].map((e=>e.replace("{{","").replace("}}",""))),...[...new Set(s.match(/{{#[\w\.]+\}\}/g))].map((e=>e.replace("{{#","").replace("}}",""))),...[...new Set(s.match(/{{\^[\w\.]+\}\}/g))].map((e=>e.replace("{{^","").replace("}}","")))];V.__autoBoundProperties=[];for(const t in V.__store)a.indexOf(t)>-1&&(V.__autoBoundProperties.push(t),e.__autoBoundProperties.push(t));V.trace({renderField:a,SharkAutoBoundProperties:V.__autoBoundProperties,JawAutoBoundProperties:e.__autoBoundProperties}),console.timeEnd("autoBind");for(const e in V.__store)V.__store[e]instanceof _&&(V.__store[e].__boundProperties=[]);const i=s.match(/{{[\w\.]+\}\}/g);i&&i.length>0&&i.forEach((e=>{const t=e.replace("{{","").replace("}}","").split("."),r=V.get(t[0]);r&&r instanceof _&&-1===r.__boundProperties.indexOf(t[1])&&(r.__boundProperties.push(t[1]),V.trace("dynamicFields",r,"log"))})),V.__dynamicSections={};const c=s.match(/\<shark-section(.*?)\>/g);c&&c.length>0&&(c.forEach((e=>{const t