@joystick.js/ui-canary 0.0.0-canary.97 → 0.0.0-canary.98

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.
@@ -1,4 +1,4 @@
1
- var tr=Object.create;var ie=Object.defineProperty;var rr=Object.getOwnPropertyDescriptor;var or=Object.getOwnPropertyNames;var ir=Object.getPrototypeOf,nr=Object.prototype.hasOwnProperty;var sr=t=>ie(t,"__esModule",{value:!0});var ar=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var dr=(t,e,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of or(e))!nr.call(t,o)&&o!=="default"&&ie(t,o,{get:()=>e[o],enumerable:!(r=rr(e,o))||r.enumerable});return t},cr=t=>dr(sr(ie(t!=null?tr(ir(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var Et=ar(X=>{(function(t,e){if(typeof define=="function"&&define.amd)define(["exports"],e);else if(typeof X!="undefined")e(X);else{var r={exports:{}};e(r.exports),t.index=r.exports}})(X,function(t){"use strict";function e(p){return e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(d){return typeof d}:function(d){return d&&typeof Symbol=="function"&&d.constructor===Symbol&&d!==Symbol.prototype?"symbol":typeof d},e(p)}function r(p,d){return d&&(e(d)==="object"||typeof d=="function")?d:o(p)}function o(p){if(p===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return p}function i(p){return i=Object.setPrototypeOf?Object.getPrototypeOf:function(d){return d.__proto__||Object.getPrototypeOf(d)},i(p)}function s(p,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function");p.prototype=Object.create(d&&d.prototype,{constructor:{value:p,writable:!0,configurable:!0}}),d&&c(p,d)}function c(p,d){return c=Object.setPrototypeOf||function(F,v){return F.__proto__=v,F},c(p,d)}function a(p,d){if(!(p instanceof d))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0}),t.diff=void 0;var m=function p(d,F){a(this,p),this.type=d,this.path=F?F.toString():""},g=function(p){function d(F,v,w){var L;return a(this,d),L=r(this,i(d).call(this,"E",F)),L.lhs=v,L.rhs=w,L}return s(d,p),d}(m),y=function(p){function d(F,v,w,L){var k;return a(this,d),k=r(this,i(d).call(this,"M",F)),k.item=v,k.lhsIndex=w,k.rhsIndex=L,k}return s(d,p),d}(m),x=function(p){function d(F,v){var w;return a(this,d),w=r(this,i(d).call(this,"D",F)),w.lhs=v,w}return s(d,p),d}(m),j=function(p){function d(F,v){var w;return a(this,d),w=r(this,i(d).call(this,"A",F)),w.rhs=v,w}return s(d,p),d}(m),f=function(p,d){return p?"".concat(p,".").concat(d):d};t.diff=function(d,F){var v=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{},w=[],L=v.matchKey,k=v.types||["E","A","D","M"],er=function(E,$,M,P){E.forEach(function(D,S){var _=$.findIndex(function(T){return T[P]===D[P]});-1<_?(-1<k.indexOf("M")&&S!==_&&w.push(new y(M,D,S,_)),G(D,$[_],f(M,_))):-1<k.indexOf("D")&&w.push(new x(M,D))}),$.forEach(function(D,S){var _=E.findIndex(function(T){return D[P]===T[P]});-1<k.indexOf("A")&&_===-1&&w.push(new j(f(M,S),D))})},G=function(E,$,M){var P=Object.prototype.toString.call(E),D=Object.prototype.toString.call($);if(-1<k.indexOf("E")&&P!==D)return w.push(new g(M,E,$)),!1;if(P==="[object Object]")Object.getOwnPropertyNames(E).forEach(function(T){Object.prototype.hasOwnProperty.call($,T)?G(E[T],$[T],f(M,T)):-1<k.indexOf("D")&&w.push(new x(f(M,T),E[T]))}),Object.getOwnPropertyNames($).forEach(function(T){-1<k.indexOf("A")&&!Object.prototype.hasOwnProperty.call(E,T)&&w.push(new j(f(M,T),$[T]))});else if(P!=="[object Array]")-1<k.indexOf("E")&&E!==$&&w.push(new g(M,E,$));else if(L)er(E,$,M,L);else{var S=E.length-1,_=$.length-1;if(-1<k.indexOf("D"))for(;S>_;)w.push(new x(f(M,S),E[S--]));if(-1<k.indexOf("A"))for(;_>S;)w.push(new j(f(M,_),$[_--]));for(;0<=S;--S)G(E[S],$[S],f(M,S))}};return G(d,F),w}})});var n=(t="",e={})=>{throw new Error(`[joystick${t?`.${t}`:""}] ${e.message||e.reason||e}`)};var fe=["render"];var he=(t={})=>{try{return fe.every(e=>Object.keys(t).includes(e))}catch(e){n("component.hasAllRequiredOptions",e)}};var we=["_componentId","_ssrId","api","dataFromSSR","existingProps","existingState","instanceId","parent","req","css","data","defaultProps","events","id","lifecycle","methods","name","props","render","state","test","translations","url","websockets","wrapper"];var ye=t=>{try{return typeof t=="undefined"}catch(e){n("types.isUndefined",e)}},ge=t=>{try{return t===null}catch(e){n("types.isNull",e)}};var R=t=>{try{return!!Array.isArray(t)}catch(e){n("types.isArray",e)}};var l=t=>{try{return typeof t=="function"}catch(e){n("types.isFunction",e)}};var u=t=>{try{return!!(t&&typeof t=="object"&&!Array.isArray(t))}catch(e){n("types.isObject",e)}};var O=t=>{try{return typeof t=="string"}catch(e){n("types.isString",e)}};var xe=(t=null)=>{try{!O(t)&&!l(t)&&!u(t)&&n("component.optionValidators.css","options.css must be a string, function returning a string, or an object returning breakpoints.")}catch(e){n("component.optionValidators.css",e)}};var be=["readystatechange","pointerlockchange","pointerlockerror","beforecopy","beforecut","beforepaste","freeze","resume","search","securitypolicyviolation","visibilitychange","fullscreenchange","fullscreenerror","webkitfullscreenchange","webkitfullscreenerror","beforexrselect","abort","blur","cancel","canplay","canplaythrough","change","click","close","contextmenu","cuechange","dblclick","drag","dragend","dragenter","dragleave","dragover","dragstart","drop","durationchange","emptied","ended","error","focus","formdata","input","invalid","keydown","keypress","keyup","load","loadeddata","loadedmetadata","loadstart","mousedown","mouseenter","mouseleave","mousemove","mouseout","mouseover","mouseup","mousewheel","pause","play","playing","progress","ratechange","reset","resize","scroll","seeked","seeking","select","stalled","submit","suspend","timeupdate","toggle","volumechange","waiting","webkitanimationend","webkitanimationiteration","webkitanimationstart","webkittransitionend","wheel","auxclick","gotpointercapture","lostpointercapture","pointerdown","pointermove","pointerup","pointercancel","pointerover","pointerout","pointerenter","pointerleave","selectstart","selectionchange","animationend","animationiteration","animationstart","transitionrun","transitionstart","transitionend","transitioncancel","copy","cut","paste","pointerrawupdate"];var $e=(t=null)=>{try{u(t)||n("component.optionValidators.events","options.events must be an object.");for(let e of Object.keys(t)){let[r]=e.split(" ");be.includes(r)||n("component.optionValidators.events",`${r} is not a supported JavaScript event type.`)}for(let[e,r]of Object.entries(t))l(r)||n("component.optionValidators.events",`options.events.${e} must be assigned a function.`)}catch(e){n("component.optionValidators.events",e)}};var Fe=["onBeforeMount","onMount","onUpdateProps","onBeforeUnmount","onRefetchData"];var ke=(t=null)=>{try{u(t)||n("component.optionValidators.lifecycle","options.lifecycle must be an object.");for(let[e,r]of Object.entries(t))Fe.includes(e)||n("component.optionValidators.lifecycle",`options.lifecycle.${e} is not supported.`),l(r)||n("component.optionValidators.lifecycle",`options.lifecycle.${e} must be assigned a function.`)}catch(e){n("component.optionValidators.lifecycle",e)}};var Ee=(t=null)=>{try{u(t)||n("component.optionValidators.methods","options.methods must be an object.");for(let[e,r]of Object.entries(t))l(r)||n("component.optionValidators.methods",`options.methods.${e} must be assigned a function.`)}catch(e){n("component.optionValidators.methods",e)}};var Me=(t=null)=>{typeof t!="string"&&n("component.optionValidators.name","options.name must be a string.")};var Se=(t=null)=>{try{l(t)||n("component.optionValidators.render","options.render must be a function returning a string.")}catch(e){n("component.optionValidators.render",e)}};var Te=(t=null)=>{try{u(t)||n("component.optionValidators.test","options.test must be an object."),t?.name&&!O(t.name)&&n("component.optionValidators.test","options.test.name must be assigned a string.")}catch(e){n("component.optionValidators.test",e)}};var Oe=(t=null)=>{try{l(t)||n("component.optionValidators.websockets","options.websockets must be a function returning an object.")}catch(e){n("component.optionValidators.websockets",e)}};var Ce=(t=null)=>{try{u(t)||n("component.optionValidators.wrapper","options.wrapper must be an object.");for(let[e,r]of Object.entries(t))e==="id"&&!O(r)&&n("component.optionValidators.wrapper",`options.wrapper.${e} must be assigned a string.`),e==="classList"&&!R(r)&&n("component.optionValidators.wrapper",`options.wrapper.${e} must be assigned an array of strings.`)}catch(e){n("component.optionValidators.wrapper",e)}};var ve={css:xe,events:$e,lifecycle:ke,methods:Ee,name:Me,render:Se,test:Te,websockets:Oe,wrapper:Ce};var _e=(t={})=>{try{he(t)||n("component.validateOptions",`component options must include ${required.options.join(",")}.`);for(let[e,r]of Object.entries(t)){we.includes(e)||n("component.validateOptions",`${e} is not supported by joystick.component.`);let o=ve[e];o&&l(o)&&o(r)}}catch(e){n("component.validateOptions",e)}};var je="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890".split(""),h=(t=16)=>{let e="",r=0;for(;r<t;)e+=je[Math.floor(Math.random()*(je.length-1))],r+=1;return e};var K=(t=[],e="")=>{try{return(R(t)&&t.find(o=>o?.componentId===e))?.data||{}}catch(r){n("findComponentDataFromSSR",r)}};var Re=(()=>{let t=0;return(e,r)=>{clearTimeout(t),t=setTimeout(e,r)}})();var I=t=>!!(t&&typeof t=="object"&&!Array.isArray(t));var Ae=t=>typeof t=="string";var Le=/^(?:4[0-9]{12}(?:[0-9]{3,6})?|5[1-5][0-9]{14}|(222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)[0-9]{12}|6(?:011|5[0-9][0-9])[0-9]{12,15}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11}|6[27][0-9]{14}|^(81[0-9]{14,17}))$/,De=(t,e="")=>{if(!e)return!0;if(e&&!Ae(e))return!1;let r=e?e.replace(/[- ]+/g,""):"";return t===!0?r.match(new RegExp(Le)):!r.match(new RegExp(Le))};var Pe=(t="",e="")=>t(e);var Ie=/^((?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\]))$/,Ve=(t,e="")=>t===!0?!!e.match(Ie):!e.match(Ie);var Ne=(t,e="")=>t===e;var Ue=(t,e="")=>t===e;var qe=(t,e="")=>e.length<=t;var ze=(t,e="")=>e.length>=t;var He=/^[\+]?[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]{4,6}$/,Ze=(t,e="")=>t===!0?!!e.match(He):!e.match(He);var Be={AF:/^\d{4}$/,AX:/^\d{5}$/,AL:/^\d{4}$/,DZ:/^\d{5}$/,AS:/^\d{5}(-{1}\d{4,6})$/,AD:/^[Aa][Dd]\d{3}$/,AI:/^[Aa][I][-][2][6][4][0]$/,AR:/^\d{4}|[A-Za-z]\d{4}[a-zA-Z]{3}$/,AM:/^\d{4}$/,AC:/^[Aa][Ss][Cc][Nn]\s{0,1}[1][Zz][Zz]$/,AU:/^\d{4}$/,AT:/^\d{4}$/,AZ:/^[Aa][Zz]\d{4}$/,BH:/^\d{3,4}$/,BD:/^\d{4}$/,BB:/^[Aa][Zz]\d{5}$/,BY:/^\d{6}$/,BE:/^\d{4}$/,BM:/^[A-Za-z]{2}\s([A-Za-z]{2}|\d{2})$/,BT:/^\d{5}$/,BO:/^\d{4}$/,BA:/^\d{5}$/,BR:/^\d{5}-\d{3}$/,"":/^[Bb][Ii][Qq]{2}\s{0,1}[1][Zz]{2}$/,IO:/^[Bb]{2}[Nn][Dd]\s{0,1}[1][Zz]{2}$/,VG:/^[Vv][Gg]\d{4}$/,BN:/^[A-Za-z]{2}\d{4}$/,BG:/^\d{4}$/,KH:/^\d{5}$/,CA:/^(?=[^DdFfIiOoQqUu\d\s])[A-Za-z]\d(?=[^DdFfIiOoQqUu\d\s])[A-Za-z]\s{0,1}\d(?=[^DdFfIiOoQqUu\d\s])[A-Za-z]\d$/,CV:/^\d{4}$/,KY:/^[Kk][Yy]\d[-\s]{0,1}\d{4}$/,TD:/^\d{5}$/,CL:/^\d{7}\s\(\d{3}-\d{4}\)$/,CN:/^\d{6}$/,CX:/^\d{4}$/,CC:/^\d{4}$/,CO:/^\d{6}$/,CD:/^[Cc][Dd]$/,CR:/^\d{4,5}$/,HR:/^\d{5}$/,CU:/^\d{5}$/,CY:/^\d{4}$/,CZ:/^\d{5}\s\(\d{3}\s\d{2}\)$/,DK:/^\d{4}$/,DO:/^\d{5}$/,EC:/^\d{6}$/,SV:/^1101$/,EG:/^\d{5}$/,EE:/^\d{5}$/,ET:/^\d{4}$/,FK:/^[Ff][Ii][Qq]{2}\s{0,1}[1][Zz]{2}$/,FO:/^\d{3}$/,FI:/^\d{5}$/,FR:/^\d{5}$/,GF:/^973\d{2}$/,PF:/^987\d{2}$/,GA:/^\d{2}\s[a-zA-Z-_ ]\s\d{2}$/,GE:/^\d{4}$/,DE:/^\d{2}$/,GI:/^[Gg][Xx][1]{2}\s{0,1}[1][Aa]{2}$/,GR:/^\d{3}\s{0,1}\d{2}$/,GL:/^\d{4}$/,GP:/^971\d{2}$/,GU:/^\d{5}$/,GT:/^\d{5}$/,GG:/^[A-Za-z]{2}\d\s{0,1}\d[A-Za-z]{2}$/,GW:/^\d{4}$/,HT:/^\d{4}$/,HM:/^\d{4}$/,HN:/^\d{5}$/,HU:/^\d{4}$/,IS:/^\d{3}$/,IN:/^\d{6}$/,ID:/^\d{5}$/,IR:/^\d{5}-\d{5}$/,IQ:/^\d{5}$/,IM:/^[Ii[Mm]\d{1,2}\s\d\[A-Z]{2}$/,IL:/^\b\d{5}(\d{2})?$/,IT:/^\d{5}$/,JM:/^\d{2}$/,JP:/^\d{7}\s\(\d{3}-\d{4}\)$/,JE:/^[Jj][Ee]\d\s{0,1}\d[A-Za-z]{2}$/,JO:/^\d{5}$/,KZ:/^\d{6}$/,KE:/^\d{5}$/,KR:/^\d{6}\s\(\d{3}-\d{3}\)$/,XK:/^\d{5}$/,KW:/^\d{5}$/,KG:/^\d{6}$/,LV:/^[Ll][Vv][- ]{0,1}\d{4}$/,LA:/^\d{5}$/,LB:/^\d{4}\s{0,1}\d{4}$/,LS:/^\d{3}$/,LR:/^\d{4}$/,LY:/^\d{5}$/,LI:/^\d{4}$/,LT:/^[Ll][Tt][- ]{0,1}\d{5}$/,LU:/^\d{4}$/,MK:/^\d{4}$/,MG:/^\d{3}$/,MV:/^\d{4,5}$/,MY:/^\d{5}$/,MT:/^[A-Za-z]{3}\s{0,1}\d{4}$/,MH:/^\d{5}$/,MQ:/^972\d{2}$/,YT:/^976\d{2}$/,FM:/^\d{5}(-{1}\d{4})$/,MX:/^\d{5}$/,MD:/^[Mm][Dd][- ]{0,1}\d{4}$/,MC:/^980\d{2}$/,MN:/^\d{5}$/,ME:/^\d{5}$/,MS:/^[Mm][Ss][Rr]\s{0,1}\d{4}$/,MA:/^\d{5}$/,MZ:/^\d{4}$/,MM:/^\d{5}$/,NA:/^\d{5}$/,NP:/^\d{5}$/,NL:/^\d{4}\s{0,1}[A-Za-z]{2}$/,NC:/^988\d{2}$/,NZ:/^\d{4}$/,NI:/^\d{5}$/,NE:/^\d{4}$/,NG:/^\d{6}$/,NF:/^\d{4}$/,MP:/^\d{5}$/,NO:/^\d{4}$/,OM:/^\d{3}$/,PK:/^\d{5}$/,PW:/^\d{5}$/,PA:/^\d{6}$/,PG:/^\d{3}$/,PY:/^\d{4}$/,PE:/^\d{5}$/,PH:/^\d{4}$/,PN:/^[Pp][Cc][Rr][Nn]\s{0,1}[1][Zz]{2}$/,PL:/^\d{2}[- ]{0,1}\d{3}$/,PT:/^\d{4}$/,PR:/^\d{5}$/,RE:/^974\d{2}$/,RO:/^\d{6}$/,RU:/^\d{6}$/,BL:/^97133$/,SH:/^[Ss][Tt][Hh][Ll]\s{0,1}[1][Zz]{2}$/,MF:/^97150$/,PM:/^97500$/,VC:/^[Vv][Cc]\d{4}$/,SM:/^4789\d$/,SA:/^\d{5}(-{1}\d{4})?$/,SN:/^\d{5}$/,RS:/^\d{5}$/,SG:/^\d{2}$/,SK:/^\d{5}\s\(\d{3}\s\d{2}\)$/,SI:/^([Ss][Ii][- ]{0,1}){0,1}\d{4}$/,ZA:/^\d{4}$/,GS:/^[Ss][Ii][Qq]{2}\s{0,1}[1][Zz]{2}$/,ES:/^\d{5}$/,LK:/^\d{5}$/,SD:/^\d{5}$/,SZ:/^[A-Za-z]\d{3}$/,SE:/^\d{3}\s*\d{2}$/,CH:/^\d{4}$/,SJ:/^\d{4}$/,TW:/^\d{5}$/,TJ:/^\d{6}$/,TH:/^\d{5}$/,TT:/^\d{6}$/,TN:/^\d{4}$/,TR:/^\d{5}$/,TM:/^\d{6}$/,TC:/^[Tt][Kk][Cc][Aa]\s{0,1}[1][Zz]{2}$/,UA:/^\d{5}$/,GB:/^[A-Z]{1,2}[0-9R][0-9A-Z]?\s*[0-9][A-Z-[CIKMOV]]{2}/,US:/^\b\d{5}\b(?:[- ]{1}\d{4})?$/,UY:/^\d{5}$/,VI:/^\d{5}$/,UZ:/^\d{3} \d{3}$/,VA:/^120$/,VE:/^\d{4}(\s[a-zA-Z]{1})?$/,VN:/^\d{6}$/,WF:/^986\d{2}$/,ZM:/^\d{5}$/},Ge=(t,e="")=>{let r=I(t)&&t.iso?Be[t.iso||"US"]:Be.US;return I(t)?t.rule===!0?!!e.match(r):!e.match(r):t===!0?!!e.match(r):!e.match(r)};var Ke=(t="",e="")=>(e?.match(t)||[])?.length>0;var We=(t,e="",r={isChecked:!1})=>{if(!r.isChecked)return t===!0?e&&e.trim()!=="":e&&e.trim()==="";if(r.isChecked)return t===!0?e:!e};var Je=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/,Qe=(t,e="")=>t===!0?!!e.match(Je):!e.match(Je);var Ye=/^[a-z0-9]+(?:-[a-z0-9]+)*$/,Xe=(t,e="")=>t===!0?!!e.match(Ye):!e.match(Ye);var et=/^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$ %^&*-]).{8,}$/,tt=(t,e="")=>t===!0?!!e.match(et):!e.match(et);var rt=/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()!@:%_\+.~#?&\/\/=]*)/,ot=(t,e="")=>t===!0?!!e.match(rt):!e.match(rt);var it={AT:/^(AT)(U\d{8}$)/i,BE:/^(BE)(\d{10}$)/i,BG:/^(BG)(\d{9,10}$)/i,CY:/^(CY)([0-5|9]\d{7}[A-Z]$)/i,CZ:/^(CZ)(\d{8,10})?$/i,DE:/^(DE)([1-9]\d{8}$)/i,DK:/^(DK)(\d{8}$)/i,EE:/^(EE)(10\d{7}$)/i,EL:/^(EL)(\d{9}$)/i,ES:/^(ES)([0-9A-Z][0-9]{7}[0-9A-Z]$)/i,EU:/^(EU)(\d{9}$)/i,FI:/^(FI)(\d{8}$)/i,FR:/^(FR)([0-9A-Z]{2}[0-9]{9}$)/i,GB:/^(GB)((?:[0-9]{12}|[0-9]{9}|(?:GD|HA)[0-9]{3})$)/i,GR:/^(GR)(\d{8,9}$)/i,HR:/^(HR)(\d{11}$)/i,HU:/^(HU)(\d{8}$)/i,IE:/^(IE)([0-9A-Z\*\+]{7}[A-Z]{1,2}$)/i,IT:/^(IT)(\d{11}$)/i,LV:/^(LV)(\d{11}$)/i,LT:/^(LT)(\d{9}$|\d{12}$)/i,LU:/^(LU)(\d{8}$)/i,MT:/^(MT)([1-9]\d{7}$)/i,NL:/^(NL)(\d{9}B\d{2}$)/i,NO:/^(NO)(\d{9}$)/i,PL:/^(PL)(\d{10}$)/i,PT:/^(PT)(\d{9}$)/i,RO:/^(RO)([1-9]\d{1,9}$)/i,RU:/^(RU)(\d{10}$|\d{12}$)/i,RS:/^(RS)(\d{9}$)/i,SI:/^(SI)([1-9]\d{7}$)/i,SK:/^(SK)([1-9]\d[(2-4)|(6-9)]\d{7}$)/i,SE:/^(SE)(\d{10}01$)/i},nt=(t,e="")=>{let r=I(t)&&t.iso?it[t.iso||"EU"]:it.EU;return I(t)?t.rule===!0?!!e.match(r):!e.match(r):t===!0?!!e.match(r):!e.match(r)};var st={creditCard:De,custom:Pe,email:Ve,equals:Ne,matches:Ue,maxLength:qe,minLength:ze,phone:Ze,postalCode:Ge,regex:Ke,required:We,semVer:Qe,slug:Xe,strongPassword:tt,url:ot,vat:nt};var at=class{constructor(e,r={}){this.fieldsToListenToForChanges=["checkbox","color","date","datetime-local","email","file","hidden","month","number","password","radio","range","search","tel","text","time","url","week"],this.defaultValidationErrors={creditCard:()=>"Must be a valid credit card number.",custom:()=>"Must return true.",email:()=>"Must be a valid email.",equals:o=>`Value must equal ${o}.`,matches:o=>`Field must match ${o}.`,maxLength:o=>`Field value can be no greater than ${o}.`,minLength:o=>`Field value can be no less than ${o}.`,phone:()=>"Field value must be a valid telephone number.",postalCode:()=>"Field value must be a valid postal code.",regex:()=>"Must match regex.",required:()=>"This field is required.",semVer:()=>"Field value must be a valid semantic version.",slug:()=>"Field value must be a valid URL slug.",strongPassword:()=>"Field value must be a valid password.",url:()=>"Field value must be a valid URL.",vat:()=>"Field value must be a valid VAT code."},e||console.warn("[validateForm] Must pass an HTML <form></form> element to validate."),this.form=e,this.setOptions(r),this.attachEventListeners()}setOptions(e={}){this.rules=e.rules||{},this.messages=e.messages||{},this.onSubmit=e.onSubmit,this.onRenderError=e.onRenderError,this.fields=this.serialize()}updateOptions(e={}){this.setOptions(e)}serialize(){if(this.form)return Object.keys(this.rules).map(r=>{let o=this.form.querySelector(`[name="${r}"]`),i=o?.type;return{listenForChanges:this.fieldsToListenToForChanges.includes(i),type:i,name:r,element:o,validations:Object.entries(this.rules[r]).map(([c,a])=>({name:c,rule:a,valid:!1})).sort((c,a)=>c.name>a.name?1:-1),errorMessages:this.messages[r]?Object.keys(this.messages[r]):{}}})?.filter(r=>!!r?.element)}attachEventListeners(){if(this.form){let e=r=>{r.stopPropagation(),r.preventDefault(),this.validate()&&this.onSubmit&&this.onSubmit()};if(this.form.listeners?.length>0)for(let r=0;r<this.form.listeners.length;r+=1){let o=this.form.listeners[r];this.form.removeEventListener("submit",o)}this.form.addEventListener("submit",e),this.form.listeners=[...this.form.listeners||[],e]}this.fields.forEach(e=>{if(e?.element&&e?.listenForChanges){let r=()=>{Re(()=>{this.validate(e.name)},100)};e.element.removeEventListener("input",r),e.element.addEventListener("input",r),e.element.removeEventListener("change",r),e.element.addEventListener("change",r)}})}validate(e=null){if(e){let r=this.fields.find(o=>o.name===e);return this.clearExistingError(e),this.validateField(r),this.checkIfValid()}else return this.clearExistingErrors(),this.fields.forEach(r=>{this.validateField(r)}),this.checkIfValid()}checkIfValid(){return!this.fields.map(r=>r.validations.some(o=>!o.valid)).includes(!0)}validateField(e){let r=this.form.querySelector(`[name="${e.name}"]`),o=["checkbox","radio"].includes(e.type),i=o?null:e?.element?.value?.trim(),s=o?e?.element?.checked:null;e.validations.forEach(a=>{if(this.isValidValue(o,o?s:i,a))this.markValidationAsValid(e,a.name);else{let m=this.messages[e.name]&&this.messages[e.name][a.name];this.markValidationAsInvalid(e,a.name),this.renderError(e.element,m||this.defaultValidationErrors[a.name](a.rule,i))}});let c=e.validations.some(a=>!a.valid);return c&&(r.classList.add("error"),r.focus()),c||(r.classList.remove("error"),this.clearExistingError(e.name)),!c}markValidationAsInvalid(e,r){let i=[...e.validations].find(s=>s.name===r);i.valid=!1}markValidationAsValid(e,r){let i=[...e.validations].find(s=>s.name===r);i.valid=!0}isValidValue(e,r,o){let i=st[o.name];return i?i(o.rule,r,{isChecked:e}):!0}clearExistingErrors(){this.form&&this.form.querySelectorAll(".input-hint.error").forEach(e=>e.parentNode.removeChild(e))}clearExistingError(e=""){let r=document.getElementById(`error-${e}`);r&&r.parentNode.removeChild(r)}renderError(e,r=""){if(e){if(this.clearExistingError(e.name),typeof this.onRenderError=="function")return this.onRenderError(e,r);let o=document.createElement("p");o.classList.add("input-hint"),o.classList.add("error"),o.setAttribute("id",`error-${e.name}`),o.innerText=r,e.after(o)}}},lr=(t,e)=>new Promise((r,o)=>{try{new at(t,e).validate()?r():o()}catch(i){console.warn(i)}}),dt=lr;var ct=(t={},e={})=>{try{return[...Object.keys(e),...Object.keys(t)].filter((o,i,s)=>s.indexOf(o)===i).reduce((o,i)=>{let s=e[i],c=t[i]||null,a=!ye(s)&&!ge(s);return o[i]=a?s:c,o},{})}catch(r){n("component.props.compile",r)}};var lt=(t="",e={})=>{try{let r="";if(t&&O(t))return r=t,r;if(t&&l(t))return r=t(e),r;if(t&&u(t)){let o=t?.print&&(O(t?.print)||l(t?.print)),i=t?.min&&u(t?.min),s=t?.min?.width&&u(t?.min?.width),c=t?.min?.height&&u(t?.min?.height),a=t?.max&&u(t?.max),m=t?.max?.width&&u(t?.max?.width),g=t?.max?.height&&u(t?.max?.height);if(o&&(r+=`
1
+ var tr=Object.create;var ie=Object.defineProperty;var rr=Object.getOwnPropertyDescriptor;var or=Object.getOwnPropertyNames;var ir=Object.getPrototypeOf,nr=Object.prototype.hasOwnProperty;var sr=t=>ie(t,"__esModule",{value:!0});var ar=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var dr=(t,e,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of or(e))!nr.call(t,o)&&o!=="default"&&ie(t,o,{get:()=>e[o],enumerable:!(r=rr(e,o))||r.enumerable});return t},cr=t=>dr(sr(ie(t!=null?tr(ir(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var Et=ar(X=>{(function(t,e){if(typeof define=="function"&&define.amd)define(["exports"],e);else if(typeof X!="undefined")e(X);else{var r={exports:{}};e(r.exports),t.index=r.exports}})(X,function(t){"use strict";function e(p){return e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(d){return typeof d}:function(d){return d&&typeof Symbol=="function"&&d.constructor===Symbol&&d!==Symbol.prototype?"symbol":typeof d},e(p)}function r(p,d){return d&&(e(d)==="object"||typeof d=="function")?d:o(p)}function o(p){if(p===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return p}function i(p){return i=Object.setPrototypeOf?Object.getPrototypeOf:function(d){return d.__proto__||Object.getPrototypeOf(d)},i(p)}function s(p,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function");p.prototype=Object.create(d&&d.prototype,{constructor:{value:p,writable:!0,configurable:!0}}),d&&c(p,d)}function c(p,d){return c=Object.setPrototypeOf||function(F,C){return F.__proto__=C,F},c(p,d)}function a(p,d){if(!(p instanceof d))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0}),t.diff=void 0;var m=function p(d,F){a(this,p),this.type=d,this.path=F?F.toString():""},g=function(p){function d(F,C,w){var L;return a(this,d),L=r(this,i(d).call(this,"E",F)),L.lhs=C,L.rhs=w,L}return s(d,p),d}(m),y=function(p){function d(F,C,w,L){var k;return a(this,d),k=r(this,i(d).call(this,"M",F)),k.item=C,k.lhsIndex=w,k.rhsIndex=L,k}return s(d,p),d}(m),x=function(p){function d(F,C){var w;return a(this,d),w=r(this,i(d).call(this,"D",F)),w.lhs=C,w}return s(d,p),d}(m),j=function(p){function d(F,C){var w;return a(this,d),w=r(this,i(d).call(this,"A",F)),w.rhs=C,w}return s(d,p),d}(m),f=function(p,d){return p?"".concat(p,".").concat(d):d};t.diff=function(d,F){var C=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{},w=[],L=C.matchKey,k=C.types||["E","A","D","M"],er=function(E,$,M,P){E.forEach(function(D,S){var _=$.findIndex(function(T){return T[P]===D[P]});-1<_?(-1<k.indexOf("M")&&S!==_&&w.push(new y(M,D,S,_)),G(D,$[_],f(M,_))):-1<k.indexOf("D")&&w.push(new x(M,D))}),$.forEach(function(D,S){var _=E.findIndex(function(T){return D[P]===T[P]});-1<k.indexOf("A")&&_===-1&&w.push(new j(f(M,S),D))})},G=function(E,$,M){var P=Object.prototype.toString.call(E),D=Object.prototype.toString.call($);if(-1<k.indexOf("E")&&P!==D)return w.push(new g(M,E,$)),!1;if(P==="[object Object]")Object.getOwnPropertyNames(E).forEach(function(T){Object.prototype.hasOwnProperty.call($,T)?G(E[T],$[T],f(M,T)):-1<k.indexOf("D")&&w.push(new x(f(M,T),E[T]))}),Object.getOwnPropertyNames($).forEach(function(T){-1<k.indexOf("A")&&!Object.prototype.hasOwnProperty.call(E,T)&&w.push(new j(f(M,T),$[T]))});else if(P!=="[object Array]")-1<k.indexOf("E")&&E!==$&&w.push(new g(M,E,$));else if(L)er(E,$,M,L);else{var S=E.length-1,_=$.length-1;if(-1<k.indexOf("D"))for(;S>_;)w.push(new x(f(M,S),E[S--]));if(-1<k.indexOf("A"))for(;_>S;)w.push(new j(f(M,_),$[_--]));for(;0<=S;--S)G(E[S],$[S],f(M,S))}};return G(d,F),w}})});var n=(t="",e={})=>{throw new Error(`[joystick${t?`.${t}`:""}] ${e.message||e.reason||e}`)};var fe=["render"];var he=(t={})=>{try{return fe.every(e=>Object.keys(t).includes(e))}catch(e){n("component.hasAllRequiredOptions",e)}};var we=["_componentId","_ssrId","api","dataFromSSR","existingProps","existingState","instanceId","parent","req","css","data","defaultProps","events","id","lifecycle","methods","name","props","render","state","test","translations","url","values","websockets","wrapper"];var ye=t=>{try{return typeof t=="undefined"}catch(e){n("types.isUndefined",e)}},ge=t=>{try{return t===null}catch(e){n("types.isNull",e)}};var R=t=>{try{return!!Array.isArray(t)}catch(e){n("types.isArray",e)}};var l=t=>{try{return typeof t=="function"}catch(e){n("types.isFunction",e)}};var u=t=>{try{return!!(t&&typeof t=="object"&&!Array.isArray(t))}catch(e){n("types.isObject",e)}};var O=t=>{try{return typeof t=="string"}catch(e){n("types.isString",e)}};var xe=(t=null)=>{try{!O(t)&&!l(t)&&!u(t)&&n("component.optionValidators.css","options.css must be a string, function returning a string, or an object returning breakpoints.")}catch(e){n("component.optionValidators.css",e)}};var be=["readystatechange","pointerlockchange","pointerlockerror","beforecopy","beforecut","beforepaste","freeze","resume","search","securitypolicyviolation","visibilitychange","fullscreenchange","fullscreenerror","webkitfullscreenchange","webkitfullscreenerror","beforexrselect","abort","blur","cancel","canplay","canplaythrough","change","click","close","contextmenu","cuechange","dblclick","drag","dragend","dragenter","dragleave","dragover","dragstart","drop","durationchange","emptied","ended","error","focus","formdata","input","invalid","keydown","keypress","keyup","load","loadeddata","loadedmetadata","loadstart","mousedown","mouseenter","mouseleave","mousemove","mouseout","mouseover","mouseup","mousewheel","pause","play","playing","progress","ratechange","reset","resize","scroll","seeked","seeking","select","stalled","submit","suspend","timeupdate","toggle","volumechange","waiting","webkitanimationend","webkitanimationiteration","webkitanimationstart","webkittransitionend","wheel","auxclick","gotpointercapture","lostpointercapture","pointerdown","pointermove","pointerup","pointercancel","pointerover","pointerout","pointerenter","pointerleave","selectstart","selectionchange","animationend","animationiteration","animationstart","transitionrun","transitionstart","transitionend","transitioncancel","copy","cut","paste","pointerrawupdate"];var $e=(t=null)=>{try{u(t)||n("component.optionValidators.events","options.events must be an object.");for(let e of Object.keys(t)){let[r]=e.split(" ");be.includes(r)||n("component.optionValidators.events",`${r} is not a supported JavaScript event type.`)}for(let[e,r]of Object.entries(t))l(r)||n("component.optionValidators.events",`options.events.${e} must be assigned a function.`)}catch(e){n("component.optionValidators.events",e)}};var Fe=["onBeforeMount","onMount","onUpdateProps","onBeforeUnmount","onRefetchData"];var ke=(t=null)=>{try{u(t)||n("component.optionValidators.lifecycle","options.lifecycle must be an object.");for(let[e,r]of Object.entries(t))Fe.includes(e)||n("component.optionValidators.lifecycle",`options.lifecycle.${e} is not supported.`),l(r)||n("component.optionValidators.lifecycle",`options.lifecycle.${e} must be assigned a function.`)}catch(e){n("component.optionValidators.lifecycle",e)}};var Ee=(t=null)=>{try{u(t)||n("component.optionValidators.methods","options.methods must be an object.");for(let[e,r]of Object.entries(t))l(r)||n("component.optionValidators.methods",`options.methods.${e} must be assigned a function.`)}catch(e){n("component.optionValidators.methods",e)}};var Me=(t=null)=>{typeof t!="string"&&n("component.optionValidators.name","options.name must be a string.")};var Se=(t=null)=>{try{l(t)||n("component.optionValidators.render","options.render must be a function returning a string.")}catch(e){n("component.optionValidators.render",e)}};var Te=(t=null)=>{try{u(t)||n("component.optionValidators.test","options.test must be an object."),t?.name&&!O(t.name)&&n("component.optionValidators.test","options.test.name must be assigned a string.")}catch(e){n("component.optionValidators.test",e)}};var Oe=(t=null)=>{try{l(t)||n("component.optionValidators.websockets","options.websockets must be a function returning an object.")}catch(e){n("component.optionValidators.websockets",e)}};var ve=(t=null)=>{try{u(t)||n("component.optionValidators.wrapper","options.wrapper must be an object.");for(let[e,r]of Object.entries(t))e==="id"&&!O(r)&&n("component.optionValidators.wrapper",`options.wrapper.${e} must be assigned a string.`),e==="classList"&&!R(r)&&n("component.optionValidators.wrapper",`options.wrapper.${e} must be assigned an array of strings.`)}catch(e){n("component.optionValidators.wrapper",e)}};var Ce={css:xe,events:$e,lifecycle:ke,methods:Ee,name:Me,render:Se,test:Te,websockets:Oe,wrapper:ve};var _e=(t={})=>{try{he(t)||n("component.validateOptions",`component options must include ${required.options.join(",")}.`);for(let[e,r]of Object.entries(t)){we.includes(e)||n("component.validateOptions",`${e} is not supported by joystick.component.`);let o=Ce[e];o&&l(o)&&o(r)}}catch(e){n("component.validateOptions",e)}};var je="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890".split(""),h=(t=16)=>{let e="",r=0;for(;r<t;)e+=je[Math.floor(Math.random()*(je.length-1))],r+=1;return e};var K=(t=[],e="")=>{try{return(R(t)&&t.find(o=>o?.componentId===e))?.data||{}}catch(r){n("findComponentDataFromSSR",r)}};var Re=(()=>{let t=0;return(e,r)=>{clearTimeout(t),t=setTimeout(e,r)}})();var I=t=>!!(t&&typeof t=="object"&&!Array.isArray(t));var Ae=t=>typeof t=="string";var Le=/^(?:4[0-9]{12}(?:[0-9]{3,6})?|5[1-5][0-9]{14}|(222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)[0-9]{12}|6(?:011|5[0-9][0-9])[0-9]{12,15}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11}|6[27][0-9]{14}|^(81[0-9]{14,17}))$/,De=(t,e="")=>{if(!e)return!0;if(e&&!Ae(e))return!1;let r=e?e.replace(/[- ]+/g,""):"";return t===!0?r.match(new RegExp(Le)):!r.match(new RegExp(Le))};var Pe=(t="",e="")=>t(e);var Ie=/^((?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\]))$/,Ve=(t,e="")=>t===!0?!!e.match(Ie):!e.match(Ie);var Ne=(t,e="")=>t===e;var Ue=(t,e="")=>t===e;var qe=(t,e="")=>e.length<=t;var ze=(t,e="")=>e.length>=t;var He=/^[\+]?[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]{4,6}$/,Ze=(t,e="")=>t===!0?!!e.match(He):!e.match(He);var Be={AF:/^\d{4}$/,AX:/^\d{5}$/,AL:/^\d{4}$/,DZ:/^\d{5}$/,AS:/^\d{5}(-{1}\d{4,6})$/,AD:/^[Aa][Dd]\d{3}$/,AI:/^[Aa][I][-][2][6][4][0]$/,AR:/^\d{4}|[A-Za-z]\d{4}[a-zA-Z]{3}$/,AM:/^\d{4}$/,AC:/^[Aa][Ss][Cc][Nn]\s{0,1}[1][Zz][Zz]$/,AU:/^\d{4}$/,AT:/^\d{4}$/,AZ:/^[Aa][Zz]\d{4}$/,BH:/^\d{3,4}$/,BD:/^\d{4}$/,BB:/^[Aa][Zz]\d{5}$/,BY:/^\d{6}$/,BE:/^\d{4}$/,BM:/^[A-Za-z]{2}\s([A-Za-z]{2}|\d{2})$/,BT:/^\d{5}$/,BO:/^\d{4}$/,BA:/^\d{5}$/,BR:/^\d{5}-\d{3}$/,"":/^[Bb][Ii][Qq]{2}\s{0,1}[1][Zz]{2}$/,IO:/^[Bb]{2}[Nn][Dd]\s{0,1}[1][Zz]{2}$/,VG:/^[Vv][Gg]\d{4}$/,BN:/^[A-Za-z]{2}\d{4}$/,BG:/^\d{4}$/,KH:/^\d{5}$/,CA:/^(?=[^DdFfIiOoQqUu\d\s])[A-Za-z]\d(?=[^DdFfIiOoQqUu\d\s])[A-Za-z]\s{0,1}\d(?=[^DdFfIiOoQqUu\d\s])[A-Za-z]\d$/,CV:/^\d{4}$/,KY:/^[Kk][Yy]\d[-\s]{0,1}\d{4}$/,TD:/^\d{5}$/,CL:/^\d{7}\s\(\d{3}-\d{4}\)$/,CN:/^\d{6}$/,CX:/^\d{4}$/,CC:/^\d{4}$/,CO:/^\d{6}$/,CD:/^[Cc][Dd]$/,CR:/^\d{4,5}$/,HR:/^\d{5}$/,CU:/^\d{5}$/,CY:/^\d{4}$/,CZ:/^\d{5}\s\(\d{3}\s\d{2}\)$/,DK:/^\d{4}$/,DO:/^\d{5}$/,EC:/^\d{6}$/,SV:/^1101$/,EG:/^\d{5}$/,EE:/^\d{5}$/,ET:/^\d{4}$/,FK:/^[Ff][Ii][Qq]{2}\s{0,1}[1][Zz]{2}$/,FO:/^\d{3}$/,FI:/^\d{5}$/,FR:/^\d{5}$/,GF:/^973\d{2}$/,PF:/^987\d{2}$/,GA:/^\d{2}\s[a-zA-Z-_ ]\s\d{2}$/,GE:/^\d{4}$/,DE:/^\d{2}$/,GI:/^[Gg][Xx][1]{2}\s{0,1}[1][Aa]{2}$/,GR:/^\d{3}\s{0,1}\d{2}$/,GL:/^\d{4}$/,GP:/^971\d{2}$/,GU:/^\d{5}$/,GT:/^\d{5}$/,GG:/^[A-Za-z]{2}\d\s{0,1}\d[A-Za-z]{2}$/,GW:/^\d{4}$/,HT:/^\d{4}$/,HM:/^\d{4}$/,HN:/^\d{5}$/,HU:/^\d{4}$/,IS:/^\d{3}$/,IN:/^\d{6}$/,ID:/^\d{5}$/,IR:/^\d{5}-\d{5}$/,IQ:/^\d{5}$/,IM:/^[Ii[Mm]\d{1,2}\s\d\[A-Z]{2}$/,IL:/^\b\d{5}(\d{2})?$/,IT:/^\d{5}$/,JM:/^\d{2}$/,JP:/^\d{7}\s\(\d{3}-\d{4}\)$/,JE:/^[Jj][Ee]\d\s{0,1}\d[A-Za-z]{2}$/,JO:/^\d{5}$/,KZ:/^\d{6}$/,KE:/^\d{5}$/,KR:/^\d{6}\s\(\d{3}-\d{3}\)$/,XK:/^\d{5}$/,KW:/^\d{5}$/,KG:/^\d{6}$/,LV:/^[Ll][Vv][- ]{0,1}\d{4}$/,LA:/^\d{5}$/,LB:/^\d{4}\s{0,1}\d{4}$/,LS:/^\d{3}$/,LR:/^\d{4}$/,LY:/^\d{5}$/,LI:/^\d{4}$/,LT:/^[Ll][Tt][- ]{0,1}\d{5}$/,LU:/^\d{4}$/,MK:/^\d{4}$/,MG:/^\d{3}$/,MV:/^\d{4,5}$/,MY:/^\d{5}$/,MT:/^[A-Za-z]{3}\s{0,1}\d{4}$/,MH:/^\d{5}$/,MQ:/^972\d{2}$/,YT:/^976\d{2}$/,FM:/^\d{5}(-{1}\d{4})$/,MX:/^\d{5}$/,MD:/^[Mm][Dd][- ]{0,1}\d{4}$/,MC:/^980\d{2}$/,MN:/^\d{5}$/,ME:/^\d{5}$/,MS:/^[Mm][Ss][Rr]\s{0,1}\d{4}$/,MA:/^\d{5}$/,MZ:/^\d{4}$/,MM:/^\d{5}$/,NA:/^\d{5}$/,NP:/^\d{5}$/,NL:/^\d{4}\s{0,1}[A-Za-z]{2}$/,NC:/^988\d{2}$/,NZ:/^\d{4}$/,NI:/^\d{5}$/,NE:/^\d{4}$/,NG:/^\d{6}$/,NF:/^\d{4}$/,MP:/^\d{5}$/,NO:/^\d{4}$/,OM:/^\d{3}$/,PK:/^\d{5}$/,PW:/^\d{5}$/,PA:/^\d{6}$/,PG:/^\d{3}$/,PY:/^\d{4}$/,PE:/^\d{5}$/,PH:/^\d{4}$/,PN:/^[Pp][Cc][Rr][Nn]\s{0,1}[1][Zz]{2}$/,PL:/^\d{2}[- ]{0,1}\d{3}$/,PT:/^\d{4}$/,PR:/^\d{5}$/,RE:/^974\d{2}$/,RO:/^\d{6}$/,RU:/^\d{6}$/,BL:/^97133$/,SH:/^[Ss][Tt][Hh][Ll]\s{0,1}[1][Zz]{2}$/,MF:/^97150$/,PM:/^97500$/,VC:/^[Vv][Cc]\d{4}$/,SM:/^4789\d$/,SA:/^\d{5}(-{1}\d{4})?$/,SN:/^\d{5}$/,RS:/^\d{5}$/,SG:/^\d{2}$/,SK:/^\d{5}\s\(\d{3}\s\d{2}\)$/,SI:/^([Ss][Ii][- ]{0,1}){0,1}\d{4}$/,ZA:/^\d{4}$/,GS:/^[Ss][Ii][Qq]{2}\s{0,1}[1][Zz]{2}$/,ES:/^\d{5}$/,LK:/^\d{5}$/,SD:/^\d{5}$/,SZ:/^[A-Za-z]\d{3}$/,SE:/^\d{3}\s*\d{2}$/,CH:/^\d{4}$/,SJ:/^\d{4}$/,TW:/^\d{5}$/,TJ:/^\d{6}$/,TH:/^\d{5}$/,TT:/^\d{6}$/,TN:/^\d{4}$/,TR:/^\d{5}$/,TM:/^\d{6}$/,TC:/^[Tt][Kk][Cc][Aa]\s{0,1}[1][Zz]{2}$/,UA:/^\d{5}$/,GB:/^[A-Z]{1,2}[0-9R][0-9A-Z]?\s*[0-9][A-Z-[CIKMOV]]{2}/,US:/^\b\d{5}\b(?:[- ]{1}\d{4})?$/,UY:/^\d{5}$/,VI:/^\d{5}$/,UZ:/^\d{3} \d{3}$/,VA:/^120$/,VE:/^\d{4}(\s[a-zA-Z]{1})?$/,VN:/^\d{6}$/,WF:/^986\d{2}$/,ZM:/^\d{5}$/},Ge=(t,e="")=>{let r=I(t)&&t.iso?Be[t.iso||"US"]:Be.US;return I(t)?t.rule===!0?!!e.match(r):!e.match(r):t===!0?!!e.match(r):!e.match(r)};var Ke=(t="",e="")=>(e?.match(t)||[])?.length>0;var We=(t,e="",r={isChecked:!1})=>{if(!r.isChecked)return t===!0?e&&e.trim()!=="":e&&e.trim()==="";if(r.isChecked)return t===!0?e:!e};var Je=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/,Qe=(t,e="")=>t===!0?!!e.match(Je):!e.match(Je);var Ye=/^[a-z0-9]+(?:-[a-z0-9]+)*$/,Xe=(t,e="")=>t===!0?!!e.match(Ye):!e.match(Ye);var et=/^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$ %^&*-]).{8,}$/,tt=(t,e="")=>t===!0?!!e.match(et):!e.match(et);var rt=/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()!@:%_\+.~#?&\/\/=]*)/,ot=(t,e="")=>t===!0?!!e.match(rt):!e.match(rt);var it={AT:/^(AT)(U\d{8}$)/i,BE:/^(BE)(\d{10}$)/i,BG:/^(BG)(\d{9,10}$)/i,CY:/^(CY)([0-5|9]\d{7}[A-Z]$)/i,CZ:/^(CZ)(\d{8,10})?$/i,DE:/^(DE)([1-9]\d{8}$)/i,DK:/^(DK)(\d{8}$)/i,EE:/^(EE)(10\d{7}$)/i,EL:/^(EL)(\d{9}$)/i,ES:/^(ES)([0-9A-Z][0-9]{7}[0-9A-Z]$)/i,EU:/^(EU)(\d{9}$)/i,FI:/^(FI)(\d{8}$)/i,FR:/^(FR)([0-9A-Z]{2}[0-9]{9}$)/i,GB:/^(GB)((?:[0-9]{12}|[0-9]{9}|(?:GD|HA)[0-9]{3})$)/i,GR:/^(GR)(\d{8,9}$)/i,HR:/^(HR)(\d{11}$)/i,HU:/^(HU)(\d{8}$)/i,IE:/^(IE)([0-9A-Z\*\+]{7}[A-Z]{1,2}$)/i,IT:/^(IT)(\d{11}$)/i,LV:/^(LV)(\d{11}$)/i,LT:/^(LT)(\d{9}$|\d{12}$)/i,LU:/^(LU)(\d{8}$)/i,MT:/^(MT)([1-9]\d{7}$)/i,NL:/^(NL)(\d{9}B\d{2}$)/i,NO:/^(NO)(\d{9}$)/i,PL:/^(PL)(\d{10}$)/i,PT:/^(PT)(\d{9}$)/i,RO:/^(RO)([1-9]\d{1,9}$)/i,RU:/^(RU)(\d{10}$|\d{12}$)/i,RS:/^(RS)(\d{9}$)/i,SI:/^(SI)([1-9]\d{7}$)/i,SK:/^(SK)([1-9]\d[(2-4)|(6-9)]\d{7}$)/i,SE:/^(SE)(\d{10}01$)/i},nt=(t,e="")=>{let r=I(t)&&t.iso?it[t.iso||"EU"]:it.EU;return I(t)?t.rule===!0?!!e.match(r):!e.match(r):t===!0?!!e.match(r):!e.match(r)};var st={creditCard:De,custom:Pe,email:Ve,equals:Ne,matches:Ue,maxLength:qe,minLength:ze,phone:Ze,postalCode:Ge,regex:Ke,required:We,semVer:Qe,slug:Xe,strongPassword:tt,url:ot,vat:nt};var at=class{constructor(e,r={}){this.fieldsToListenToForChanges=["checkbox","color","date","datetime-local","email","file","hidden","month","number","password","radio","range","search","tel","text","time","url","week"],this.defaultValidationErrors={creditCard:()=>"Must be a valid credit card number.",custom:()=>"Must return true.",email:()=>"Must be a valid email.",equals:o=>`Value must equal ${o}.`,matches:o=>`Field must match ${o}.`,maxLength:o=>`Field value can be no greater than ${o}.`,minLength:o=>`Field value can be no less than ${o}.`,phone:()=>"Field value must be a valid telephone number.",postalCode:()=>"Field value must be a valid postal code.",regex:()=>"Must match regex.",required:()=>"This field is required.",semVer:()=>"Field value must be a valid semantic version.",slug:()=>"Field value must be a valid URL slug.",strongPassword:()=>"Field value must be a valid password.",url:()=>"Field value must be a valid URL.",vat:()=>"Field value must be a valid VAT code."},e||console.warn("[validateForm] Must pass an HTML <form></form> element to validate."),this.form=e,this.setOptions(r),this.attachEventListeners()}setOptions(e={}){this.rules=e.rules||{},this.messages=e.messages||{},this.onSubmit=e.onSubmit,this.onRenderError=e.onRenderError,this.fields=this.serialize()}updateOptions(e={}){this.setOptions(e)}serialize(){if(this.form)return Object.keys(this.rules).map(r=>{let o=this.form.querySelector(`[name="${r}"]`),i=o?.type;return{listenForChanges:this.fieldsToListenToForChanges.includes(i),type:i,name:r,element:o,validations:Object.entries(this.rules[r]).map(([c,a])=>({name:c,rule:a,valid:!1})).sort((c,a)=>c.name>a.name?1:-1),errorMessages:this.messages[r]?Object.keys(this.messages[r]):{}}})?.filter(r=>!!r?.element)}attachEventListeners(){if(this.form){let e=r=>{r.stopPropagation(),r.preventDefault(),this.validate()&&this.onSubmit&&this.onSubmit()};if(this.form.listeners?.length>0)for(let r=0;r<this.form.listeners.length;r+=1){let o=this.form.listeners[r];this.form.removeEventListener("submit",o)}this.form.addEventListener("submit",e),this.form.listeners=[...this.form.listeners||[],e]}this.fields.forEach(e=>{if(e?.element&&e?.listenForChanges){let r=()=>{Re(()=>{this.validate(e.name)},100)};e.element.removeEventListener("input",r),e.element.addEventListener("input",r),e.element.removeEventListener("change",r),e.element.addEventListener("change",r)}})}validate(e=null){if(e){let r=this.fields.find(o=>o.name===e);return this.clearExistingError(e),this.validateField(r),this.checkIfValid()}else return this.clearExistingErrors(),this.fields.forEach(r=>{this.validateField(r)}),this.checkIfValid()}checkIfValid(){return!this.fields.map(r=>r.validations.some(o=>!o.valid)).includes(!0)}validateField(e){let r=this.form.querySelector(`[name="${e.name}"]`),o=["checkbox","radio"].includes(e.type),i=o?null:e?.element?.value?.trim(),s=o?e?.element?.checked:null;e.validations.forEach(a=>{if(this.isValidValue(o,o?s:i,a))this.markValidationAsValid(e,a.name);else{let m=this.messages[e.name]&&this.messages[e.name][a.name];this.markValidationAsInvalid(e,a.name),this.renderError(e.element,m||this.defaultValidationErrors[a.name](a.rule,i))}});let c=e.validations.some(a=>!a.valid);return c&&(r.classList.add("error"),r.focus()),c||(r.classList.remove("error"),this.clearExistingError(e.name)),!c}markValidationAsInvalid(e,r){let i=[...e.validations].find(s=>s.name===r);i.valid=!1}markValidationAsValid(e,r){let i=[...e.validations].find(s=>s.name===r);i.valid=!0}isValidValue(e,r,o){let i=st[o.name];return i?i(o.rule,r,{isChecked:e}):!0}clearExistingErrors(){this.form&&this.form.querySelectorAll(".input-hint.error").forEach(e=>e.parentNode.removeChild(e))}clearExistingError(e=""){let r=document.getElementById(`error-${e}`);r&&r.parentNode.removeChild(r)}renderError(e,r=""){if(e){if(this.clearExistingError(e.name),typeof this.onRenderError=="function")return this.onRenderError(e,r);let o=document.createElement("p");o.classList.add("input-hint"),o.classList.add("error"),o.setAttribute("id",`error-${e.name}`),o.innerText=r,e.after(o)}}},lr=(t,e)=>new Promise((r,o)=>{try{new at(t,e).validate()?r():o()}catch(i){console.warn(i)}}),dt=lr;var ct=(t={},e={})=>{try{return[...Object.keys(e),...Object.keys(t)].filter((o,i,s)=>s.indexOf(o)===i).reduce((o,i)=>{let s=e[i],c=t[i]||null,a=!ye(s)&&!ge(s);return o[i]=a?s:c,o},{})}catch(r){n("component.props.compile",r)}};var lt=(t="",e={})=>{try{let r="";if(t&&O(t))return r=t,r;if(t&&l(t))return r=t(e),r;if(t&&u(t)){let o=t?.print&&(O(t?.print)||l(t?.print)),i=t?.min&&u(t?.min),s=t?.min?.width&&u(t?.min?.width),c=t?.min?.height&&u(t?.min?.height),a=t?.max&&u(t?.max),m=t?.max?.width&&u(t?.max?.width),g=t?.max?.height&&u(t?.max?.height);if(o&&(r+=`
2
2
  @media print {
3
3
  ${typeof t?.print=="function"?t?.print(e):t.print}
4
4
  }
@@ -18,4 +18,4 @@ var tr=Object.create;var ie=Object.defineProperty;var rr=Object.getOwnPropertyDe
18
18
  @media screen and (max-height: ${j}px) {
19
19
  ${typeof f=="function"?f(e):f}
20
20
  }
21
- `}}return r}return""}catch(r){n("component.css.compileCSS",r)}};var ur=(t={},e=null)=>{try{let r=e(t);return r&&u(r)&&!R(r)?Object.assign({},r):{}}catch(r){n("component.state.compile.compileState",r)}},z=(t={},e={})=>{try{return l(e)?ur(t,e):Object.assign({},e)}catch(r){n("component.state.compile",r)}};var mr=(t={},e=null)=>{try{let r=e(t);return r&&u(r)&&!R(r)?Object.assign({},r):{}}catch(r){n("component.values.compile.compileValues",r)}},ut=(t={},e={})=>{try{return l(e)?mr(t,e):Object.assign({},e)}catch(r){n("component.values.compile",r)}};var ne={onBeforeMount:()=>null,onMount:()=>null,onBeforeUnmount:()=>null,onUpdateProps:()=>null,onRefetchData:()=>null};var mt=(t={},e={})=>{try{return e?Object.entries({...ne,...e||{}}).reduce((r={},[o,i])=>(r[o]=()=>i({...t,setState:t.setState.bind(t),...t.renderMethods||{}}),r),{}):ne}catch(r){n("component.lifecycle.compile",r)}};var b=(t="",e=[])=>{typeof window!="undefined"&&!!window.__joystick_test__&&(window.test={...window.test||{},functionCalls:{...window?.test?.functionCalls||{},[t]:[...window?.test?.functionCalls&&window?.test?.functionCalls[t]||[],{calledAt:new Date().toISOString(),args:e}]}})};var W=(t={},e={})=>{try{return Object.entries(e).reduce((r={},[o,i])=>(r[o]=(...s)=>(b(`ui.${t?.options?.test?.name||h()}.methods.${o}`,[...s,{...t,setState:t.setState.bind(t),...t.renderMethods||{}}]),i(...s,{...t,setState:t.setState.bind(t),...t.renderMethods||{}})),r),{})}catch{n("component.methods.compile")}};var se=(t={})=>{try{return{...t,query:{...t?.query||{},set:(e="",r="")=>{if(typeof window!="undefined"){let o=new URL(window.location);o.searchParams.append(e,r),window.history.pushState({},"",o)}},unset:(e="")=>{if(typeof window!="undefined"){let r=new URL(window.location);r.searchParams.delete(e),window.history.pushState({},"",r)}}},isActive:(e="")=>O(e)&&t?.route!=="*"?e===(typeof location!="undefined"?location.pathname:t.path):!1}}catch(e){n("component.url.compile",e)}};var C=()=>typeof window=="undefined";var V=null,J=0,pt=(t={},e=null)=>{try{if(window?.__joystick_test__)return e();let r=t?.url;t?.query&&(r=`${r}?${new URLSearchParams(t.query).toString()}`);let o=new WebSocket(r);V&&(clearInterval(V),V=null);let i={client:o,send:(s={})=>(b(`ui.websockets.${t?.test?.name||h()}.send`,[s]),o.send(JSON.stringify(s)))};return o.addEventListener("open",()=>{t?.options?.logging&&console.log(`[joystick.websockets] Connected to ${t?.url}`),t?.events?.onOpen&&(t.events.onOpen(i),b(`ui.websockets.${t?.test?.name||h()}.onOpen`,[i])),J=0}),o.addEventListener("message",s=>{s?.data&&t?.events?.onMessage&&(t.events.onMessage(JSON.parse(s.data||{}),i),b(`ui.websockets.${t?.test?.name||h()}.onMessage`,[s.data||{},i]))}),o.addEventListener("close",s=>{t?.options?.logging&&console.log(`[joystick.websockets] Disconnected from ${t?.url}`),t?.events?.onClose&&(t.events.onClose(s?.code,s?.reason,i),b(`ui.websockets.${t?.test?.name||h()}.onClose`,[s.data||{},i])),o=null;let c=[1e3,1001].includes(s?.code);t?.options?.autoReconnect&&!V&&!c&&(V=setInterval(()=>{o=null,J<(t?.options?.reconnectAttempts||12)?(pt(t,e),t?.options?.logging&&console.log(`[joystick.websockets] Attempting to reconnect (${J+1}/12)...`),J+=1):clearInterval(V)},t?.options?.reconnectDelayInSeconds*1e3||5e3))}),e&&e(i),i}catch(r){n("websockets.client",r)}},ft=pt;var pr=(t={},e=null)=>{try{let r=e(t);return r&&u(r)&&!R(r)?Object.assign({},r):{}}catch(r){n("component.props.compileDefaultProps.compile",r)}},ht=(t={},e={})=>{try{return l(e)?pr(t,e):Object.assign({},e)}catch(r){n("component.props.compileDefaultProps",r)}};var wt=(t={},e={})=>{try{t.options=e||{},t.id=e?._componentId||null,t.instanceId=h(8),t.ssrId=e?._ssrId||null,t.css=lt(),t.data=K(e?.dataFromSSR,e?._componentId),t.defaultProps=ht(t,e?.defaultProps),t.props=ct(t?.defaultProps,e?.props),t.state=z(t,e?.state),t.values=ut(t,e?.values),t.events=e?.events||{},t.lifecycle=mt(t,e?.lifecycle),t.methods=W(t,e?.methods),t.wrapper=e?.wrapper||{},t.translations=e?.translations||{},t.validateForm=dt,t.DOMNode=null,t.dom={},t.dom.virtual={},t.dom.actual={};let r=!C();if(r||(t.url=se(e?.url)),r&&window.__joystick_url__&&(t.url=se(window.__joystick_url__)),r&&window.__joystick_user__&&(t.user=window.__joystick_user__),r&&e?.websockets&&l(e?.websockets)){let o=e.websockets(t),i=u(o)&&Object.entries(o);for(let s=0;s<i?.length;s+=1){let[c,a]=i[s];ft({test:t?.test,url:`${window?.process?.env.NODE_ENV==="development"?"ws":"wss"}://${location.host}/api/_websockets/${c}`,options:a?.options||{},query:a?.query||{},events:a?.events||{}},(m={})=>{t.websockets={...t.websockets||{},[c]:m}})}}}catch(r){n("component.registerOptions",r)}};var N=(t="",e=[])=>{try{console.error(`${t} failed with the following errors:`),e.forEach(r=>{console.log(r.message),r.stack&&console.log(r.stack)})}catch(r){n(t,r)}};var Q=(t="{}")=>{try{return JSON.parse(t)}catch{return t}};var yt=(t={})=>Object.entries(t).map(([e,r])=>`${e}=${r}`)?.join("; ");var fr=async(t={})=>{try{let e=await t.text();return Q(e)}catch(e){n("api.get.handleParseResponse",e)}},gt=(t="",e={})=>{try{return typeof window.fetch!="undefined"&&!e?.skip?new Promise((r,o)=>{let i=e.input?JSON.stringify(e.input):null,s=e.output?JSON.stringify(e.output):null,c=`${window.location.origin}/api/_getters/${t}?input=${i}&output=${s}`,a=document.querySelector('[name="csrf"]')?.getAttribute("content"),m={...e?.headers||{},"x-joystick-csrf":a};return window?.__joystick_test__&&(m.Cookie=yt({joystickLoginToken:window.__joystick_test_login_token__,joystickLoginTokenExpiresAt:window.__joystick_test_login_token_expires_at__})),e?.loader?.instance&&e?.loader?.instance?.setState({[e?.loader?.state||`${t}_loading`]:!0}),fetch(c,{method:"GET",mode:"cors",headers:m,credentials:"include"}).then(async g=>{let y=await fr(g);return e?.loader?.instance&&e?.loader?.instance?.setState({[e?.loader?.state||`${t}_loading`]:!1}),y?.errors?(N("get request",y.errors),o(y)):r(y)}).catch(g=>(N("get request",[g]),e?.loader?.instance&&e?.loader?.instance?.setState({[e?.loader?.state||`${t}_loading`]:!1}),o({errors:[g]})))}):Promise.resolve()}catch(r){n("get request",r)}};var hr=async(t={})=>{try{let e=await t.text();return Q(e)}catch(e){n("api.set.handleParseResponse",e)}},wr=(t={})=>{try{let e={...t};return e?.loader&&delete e.loader,JSON.stringify(e)}catch(e){n("api.set.getBody",e)}},xt=(t="",e={})=>{try{return typeof window.fetch!="undefined"?new Promise((r,o)=>{let i=`${window.location.origin}/api/_setters/${t}`,s=wr(e),c=document.querySelector('[name="csrf"]')?.getAttribute("content"),a={...e?.headers||{},"Content-Type":"application/json","x-joystick-csrf":c};return window?.__joystick_test__&&(a.Cookie=generateCookieHeader({joystickLoginToken:window?.__joystick_test_login_token__,joystickLoginTokenExpiresAt:window.__joystick_test_login_token_expirs_at__})),e?.loader?.instance&&e?.loader?.instance?.setState({[e?.loader?.state||`${t}_loading`]:!0}),fetch(i,{method:"POST",mode:"cors",headers:a,body:s,credentials:"include"}).then(async m=>{let g=await hr(m);return e?.loader?.instance&&e?.loader?.instance?.setState({[e?.loader?.state||`${t}_loading`]:!1}),g?.errors?(N("set request",g.errors),o(g)):r(g)}).catch(m=>(N("set request",[m]),e?.loader?.instance&&e?.loader?.instance?.setState({[e?.loader?.state||`${t}_loading`]:!1}),o({errors:[m]})))}):Promise.resolve()}catch(r){n("set request",r)}};var bt={get:gt,set:xt};var yr=(t="")=>{try{let[e,r]=t?.split(".");return r?window?.joystick?._internal?.queues[e][r]:window?.joystick?._internal?.queues[e]}catch(e){n("addToQueue.getQueue",e)}},H=(t="",e=null)=>{try{C()||(yr(t)||{}).array.push({callback:e})}catch(r){n("addToQueue",r)}};var Y=async(t={},e={},r={},o={})=>{try{if(o?.options?.data&&l(o.options.data)){let i=await o.options.data(t,e,r,o);return Promise.resolve(i)}return Promise.resolve()}catch(i){n("component.data.fetch",i)}};var $t=(t={},e={},r={})=>{try{return{...t,refetch:async(o={})=>{b(`ui.${r?.options?.test?.name||h()}.data.refetch`,[o]);let i=await Y(bt,e,o,r);return r.data=$t(i,e,r),window.__joystick_data__[r?.id]&&(window.__joystick_data__[r?.id]=i),window?.__joystick_test__||r.render({afterRefetchDataRender:()=>{r?.lifecycle?.onRefetchData&&r?.lifecycle?.onRefetchData(r)}}),r.data}}}catch(o){n("component.data.compile",o)}},Ft=$t;var kt=(t={})=>{try{if(!C()){let e=window.__joystick_data__&&window.__joystick_data__[t?.id]||{},r=window.__joystick_req__||{};return Ft(e,r,t)}return t?.data||{}}catch(e){n("component.loadDataFromWindow",e)}};var Tt=cr(Et());var Mt=(t={},e="",r="id")=>{try{let o=t&&t.id;if(u(t)&&o){let i=Object.keys(t);for(let s=0;s<i.length;s+=1){let c=i[s],a=t[c];if(c===r&&a===e)return t;if(c==="children"&&Array.isArray(a))for(let m=0;m<a.length;m+=1){let g=a[m],y=Mt(g,e,r);if(y!==null)return y}}}return null}catch(o){n("component.findComponentInTreeByField",o)}},A=Mt;var St=(t="",e={},r=null)=>{let o=A(r||window.joystick._internal.tree,t,"instanceId");o&&(o.children=[...o.children||[],e])};var gr=(t={},e={},r=null)=>{try{let o=U(t,{includeActual:!0,existingChildren:r});return t.dom=o,t.setDOMNodeOnInstance(),e.renderedComponent=t,o.html.wrapped}catch(o){n("component.renderMethods.component.renderForClient",o)}},xr=(t={})=>{try{return t.renderToHTML({ssrTree:t.parent.ssrTree,translations:t.parent.translations,walkingTreeForSSR:t?.parent?.walkingTreeForSSR,dataFromSSR:t.parent?.dataFromSSR}).wrapped}catch(e){n("component.renderMethods.component.renderToHTMLForSSR",e)}},br=(t={})=>{try{return t.parent.ssrTree.dataFunctions.push(async()=>{try{let e=await t.options.data(t.parent.options.api,t.parent.options.req);return t.data=e||{},{componentId:t.id,ssrId:t.ssrId,data:e}}catch(e){return{componentId:t.id,ssrId:t.ssrId,data:null,error:e}}}),t.renderToHTML({ssrTree:t?.parent?.ssrTree,translations:t?.parent?.translations,walkingTreeForSSR:t?.parent?.walkingTreeForSSR,dataFromSSR:t?.parent?.dataFromSSR})}catch(e){n("component.renderMethods.component.collectDataFunctionsForSSR",e)}},$r=(t={})=>{try{let e={id:t.id,instanceId:t.instanceId,instance:t,children:[]};St(t.parent.instanceId,e,t.parent&&t.parent.ssrTree||null)}catch(e){n("component.renderMethods.component.handleAddComponentToParent",e)}},Fr=(t={},e={})=>{try{!t.renderedComponent&&e.options&&e.options.lifecycle&&(e.options.lifecycle.onBeforeMount&&H("lifecycle.onBeforeMount",()=>{e.options.lifecycle.onBeforeMount(e),b(`ui.${e?.options?.test?.name||h()}.lifecycle.onBeforeMount`,[e])}),!t.renderedComponent&&e.options.lifecycle.onMount&&H("lifecycle.onMount",()=>{e.options.lifecycle.onMount(e),b(`ui.${e?.options?.test?.name||h()}.lifecycle.onMount`,[e])}))}catch(r){n("component.renderMethods.component.handleLifecycle",r)}},kr=(t={},e={},r={})=>{try{!e.walkingTreeForSSR&&t?.options?.lifecycle?.onUpdateProps&&(0,Tt.diff)(e?.existingPropsMap,r)?.length>0&&H("lifecycle.onUpdateProps",()=>{let i=e?.existingPropsMap&&e?.existingPropsMap[t.id];t.options.lifecycle.onUpdateProps(i||{},r,t),b(`ui.${t?.options?.test?.name||h()}.lifecycle.onBeforeMount`,[i||{},r,t])})}catch(o){n("component.renderMethods.component.handleOnChangeProps",o)}},Er=function(){return function(e=null,r={},o={}){let i=e({props:r,url:o.url,translations:o.translations,api:o.options.api,req:o.options.req,dataFromSSR:o?.dataFromSSR,parent:o}),s=o?.existingStateMap[i.id]||{},c=o.children[i.id]||[],a=s[c?.length];return i.state=a?.state||i.state,o.children[i.id]=[...o.children[i.id]||[],i],i.parent=o,kr(i,o,r),H("lifecycle.onMount",()=>{i.setDOMNodeOnInstance()}),Fr(this,i),i.parent&&$r(i),i.options.data&&i.parent.walkingTreeForSSR&&i.parent.ssrTree.dataFunctions?br(i):i.parent&&i.parent.ssrTree?xr(i):gr(i,this,a?.children)}},Mr=function(e,r){try{let o=this;return new Er().bind({})(e,r,o)}catch(o){n("component.renderMethods.component",o)}},ae=Mr;var Sr=function(e=[],r=null){try{return l(r)&&e&&Array.isArray(e)?e.map((o,i)=>r(o,i)).join(""):""}catch(o){n("component.renderMethods.each",o)}},de=Sr;var Tr=(t="",e=[])=>{try{return e.reduce((r,[o,i])=>r.replace(`{{${o}}}`,i),t)}catch(r){n("component.renderMethods.i18n.replacePlaceholdersInString",r)}},ce=(t="",e=[])=>{try{let r=typeof t=="string",o=Array.isArray(t),i=typeof t=="object"&&!o;if(r)return Tr(t,e);if(o)return t?.map(s=>ce(s,e));if(i)return Object.entries(t)?.reduce((s={},[c,a])=>(s[c]=ce(a,e),s),{})}catch(r){n("component.renderMethods.i18n.handleTranslationReplacement",r)}},Or=(t="",e={})=>{try{return t?.split(".").reduce((r,o)=>r[o],e)}catch(r){n("component.renderMethods.i18n.getTranslationAtPath",r)}},Cr=function(t="",e={}){try{let r=C()?this.translations:window.__joystick_i18n__,i=t?.includes(".")?Or(t,r):r[t];if(!r||!i)return"";let s=Object.entries(e);return ce(i,s)}catch(r){n("component.renderMethods.i18n",r)}},le=Cr;var vr=function(e=!1,r=""){try{return this?.renderingHTMLWithDataForSSR||e?`<when>${r.trim()}</when>`:"<when> </when>"}catch(o){n("component.renderMethods.when",o)}},ue=vr;var Ot={c:ae,component:ae,e:de,each:de,i:le,i18n:le,w:ue,when:ue};var Ct=(t={},e={})=>{try{return Object.entries(Ot).reduce((r,[o,i])=>(r[o]=i.bind({...t,...e}),r),{})}catch(r){n("component.renderMethods.compile",r)}};var vt=(t={})=>{try{return Object.entries(t)?.reduce((e={},[r,o]={})=>(e[r]=o?.map((i={})=>({state:i?.state,children:vt(i?.children)})),e),{})}catch(e){n("component.render.getExistingStateMap.buildMapForChildren",e)}},_t=(t={})=>{try{return vt(t)}catch(e){n("component.render.getExistingStateMap",e)}};var jt=new RegExp(/\<\!\-\-(?:.|\n|\r)*?-->/g),_r=new RegExp(/\n/g);var jr=(t="")=>{try{return(t.match(jt)||[]).forEach(r=>{t=t.replace(r,"")}),t}catch(e){n("component.render.sanitizeHTML.removeCommentedCode",e)}},Rt=(t="")=>{try{let e=`${t}`;return e=jr(e),e}catch(e){n("component.render.sanitizeHTML",e)}};var At=(t={},e="")=>{try{let{wrapper:r=null,id:o=null,instanceId:i=null}=t;return`<div ${r?.id?`id="${r.id}" `:""}${r?.classList?`class="${r.classList?.join(" ")}" `:""} js-c="${o}" js-i="${i}">${e}</div>`}catch(r){n("component.render.wrapHTML",r)}};var Lt=(t={},e=[])=>{try{let r=[...e],o=Object.entries(t);for(let i=0;i<o?.length;i+=1){let[s,c]=o[i];for(let a=0;a<c?.length;a+=1){let m=c[a];Object.entries(m?.timers)?.length>0&&r.push(...Object.values(m?.timers)),Object.entries(m?.children)?.length>0&&Lt(m?.children,r)}}if(r?.length>0)for(let i=0;i<r?.length;i+=1)clearTimeout(r[i])}catch(r){n("component.render.clearTimersOnChildren",r)}},Dt=Lt;var ee=(t={},e={})=>{try{e?.dataFromSSR&&(t.data=K(e.dataFromSSR,t.id)||{}),Dt(t?.children);let r=_t(e?.existingChildren||t?.children)||{};t.children={},t.renderMethods=Ct({...t,existingStateMap:r,translations:e?.translations||t.translations||{},ssrTree:e?.ssrTree,walkingTreeForSSR:e?.walkingTreeForSSR,renderingHTMLWithDataForSSR:e?.renderingHTMLWithDataForSSR,dataFromSSR:e?.dataFromSSR}),t.methods=W(t,t.options.methods);let o=t.options.render({...t||{},setState:t.setState.bind(t),...t.renderMethods||{}}),i=Rt(o),s=At(t,i);return{unwrapped:i,wrapped:s}}catch(r){n("component.render.toHTML",r)}};var Rr=(t={})=>{try{return Object.values(t).reduce((e={},r)=>(e[r.name]=r.value,e),{})}catch(e){n("component.virtualDOM.build.parseAttributeMap",e)}},Pt=(t={})=>{try{return t.tagName==="WHEN"?[].flatMap.call(t?.childNodes,e=>e?.tagName==="WHEN"?Pt(e):me(e)):me(t)}catch(e){n("component.virtualDOM.build.flattenWhenTags",e)}},me=(t={})=>{try{let e=t&&t.tagName&&t.tagName.toLowerCase()||"text",r={tagName:e,attributes:Rr(t.attributes),children:[].flatMap.call(t.childNodes,o=>Pt(o))};return e==="text"&&(r=t.textContent),r}catch(e){n("component.virtualDOM.build",e)}},Z=me;var Ar=(t="")=>{try{let e=document.createElement("div");return e.innerHTML=t,e?.childNodes[0]}catch(e){n("component.virtualDOM.build.convertHTMLToDOM",e)}},It=(t="")=>{try{let e=Ar(t);return Z(e)}catch(e){n("component.virtualDOM.build",e)}};var Vt=(t="")=>{try{return document.createElement("div").setAttribute(t,"Test"),!0}catch{return!1}};var Lr=(t={})=>{try{let e=document.createElement(t.tagName),r=Object.entries(t.attributes);for(let o=0;o<r.length;o+=1){let[i,s]=r[o];Vt(i)&&e.setAttribute(i,s)}for(let o=0;o<t?.children?.length;o+=1){let i=t?.children[o];if(i){let s=Nt(i);e.appendChild(s)}}return e}catch(e){n("component.virtualDOM.renderTreeToDOM.renderElement",e)}},Nt=(t=null)=>{try{return O(t)?document.createTextNode(t):Lr(t)}catch(e){n("component.virtualDOM.renderTreeToDOM",e)}},q=Nt;var U=(t={},e={})=>{try{let r=ee(t,{existingChildren:e?.existingChildren}),o=It(r.wrapped,t),i=e.includeActual&&o?q(o):null;return{html:r,virtual:o,actual:i}}catch(r){n("component.render.getUpdatedDOM",r)}};var Ut=(t={},e={})=>{try{let r=U(t,{includeActual:!0,existingChildren:e?.existingChildren});return t.dom=r,r.actual}catch(r){n("component.render.forMount",r)}};var Dr=(t={},e={})=>{let r=[];for(let[o,i]of Object.entries(e))r.push(s=>(s&&s.setAttribute&&s.setAttribute(o,i),s));for(let o in t)o in e||r.push(i=>(i&&i.removeAttribute&&i.removeAttribute(o),i));return o=>{for(let i of r)i&&typeof i=="function"&&i(o)}},te=Dr;var Pr=(t=[],e=[])=>{let r=[],o=Math.max(t.length,e.length);for(let i=0;i<o;i+=1){let s=t[i],c=e[i];r.push([s,c])}return r},qt=Pr;var Ir=(t=[],e)=>{t.forEach(r=>{r&&typeof r=="function"&&r(e)})},Vr=(t=[])=>{t.forEach(([e,r])=>{e&&typeof e=="function"&&e(r)})},Nr=(t=[],e=[])=>{let r=[];return e.slice(t.length).forEach(i=>{let s=c=>{let a=q(i);return c.appendChild(a),c};r.push(s)}),r},Ur=(t=[],e=[])=>{let r=[];return t.forEach((o,i)=>{let s=oe(o,e[i]);r.push(s)}),r},qr=(t=[],e=[])=>{let r=Ur(t,e),o=Nr(t,e);return i=>{if(i){let s=qt(r,i.childNodes);Vr(s),Ir(o,i)}return i}},re=qr;var zt={select:(t,e)=>r=>{let o=r.value;r.replaceChildren(),te(t.attributes,e.attributes)(r),re([],e.children)(r);let i=r.querySelector(`option[value="${o}"]`);if(i&&(r.value=o),!i){let s=r.querySelector("option");r.value=s?.value||""}return r}};var pe=(t,e)=>r=>{let o=t?q(t):null;return r&&r.replaceWith(o),o},zr=()=>t=>{t&&t.remove()},Hr=(t=void 0,e=void 0)=>t===void 0||e===void 0?zr():typeof t=="string"||typeof e=="string"?pe(e,t):t.tagName!==e.tagName?pe(e):e.tagName==="select"?zt.select(t,e):["pre","code"].includes(e.tagName)?pe(e,t):i=>(te(t.attributes,e.attributes)(i),re(t.children,e.children)(i),i),oe=Hr;var Zr=(t="")=>{try{let[e,r]=t?.split(".");return r?window?.joystick?._internal?.queues[e][r]:window?.joystick?._internal?.queues[e]}catch(e){n("processQueue.getQueue",e)}},B=(t="",e=null)=>{try{C()||(Zr(t)||{}).process(e)}catch(r){n("processQueue",r)}};var Ht=(t="",e=null)=>{let r=A(e||window.joystick._internal.tree,t,"instanceId");r&&(r.children=[])};var Zt=(t="",e={},r=null)=>{let o=A(r||window.joystick._internal.tree,t,"instanceId");o&&(o.instanceId=e?.instanceId,o.instance=e)};var Bt=(t={},e="",r={})=>{for(let o=0;o<t?.children?.length;o+=1){let i=t?.children[o];if(u(i)&&i.attributes&&i.attributes["js-i"]&&i.attributes["js-i"]===e){t.children[o]=r;break}u(i)&&Bt(i,e,r)}},Gt=Bt;var Kt=(t={})=>{try{return Object.entries(t).map(([e,r])=>{let[o,...i]=e.split(" ");return{type:o.toLowerCase(),selector:i.join(" "),handler:r}})}catch(e){n("component.events.serialize",e)}};var Wt=(t={},e={},r=[])=>{try{let o=Object.keys(t?.events||{})?.length>0?Kt(t?.events):[];for(let i=0;i<o?.length;i+=1){let s=o[i];r.push({...s,instance:t,elements:document.querySelectorAll(`body [js-i="${t.instanceId}"] ${s?.selector}`),handler:function(a){s.handler(a,{...t||{},setState:t?.setState.bind(t),...e||{}}),b(`ui.${t?.options?.test?.name||h()}.events.${s.type}.selector_${s?.selector}`,[a,{...t||{},setState:t?.setState.bind(t),...e||{}}])}})}if(t?.children){let i=Object.entries(t?.children)?.flatMap(([s,c])=>c);for(let s=0;s<i?.length;s+=1){let c=i[s];Wt(c,e,r)}}return r}catch(o){n("component.eve!nts.registerListenersFix.getListeners",o)}},Br=(t={},e={})=>{try{let o=Wt(t,e,[])?.flatMap((i={})=>[].flatMap.call(i?.elements||[],s=>{let{elements:c=[],...a}=i||{};return{...a,element:s}}));for(let i=0;i<o?.length;i+=1){let{instance:s,element:c,elementSelector:a,type:m,handler:g}=o[i];c.addEventListener(m,g),s._eventListeners=[...s?._eventListeners||[],{instance:s,element:c,elementSelector:a,type:m,handler:g}]}}catch(r){n("component.events.registerListenersFix",r)}},Jt=Br;var Qt=(t={})=>{try{let e=t?._eventListeners||[];if(t?.children){let o=(Object.values(t?.children||{})?.reduce((i=[],s=[])=>[...i,...s],[])).flatMap((i={})=>Qt(i));e=[...e,...o]}return e}catch(e){n("component.events.unregisterListenersFix.getListeners",e)}},Gr=(t={})=>{try{let e=Qt(t);for(let r=0;r<e?.length;r+=1){let{instance:o,element:i,type:s,handler:c}=e[r];i.removeEventListener(s,c),o._eventListeners=o._eventListeners?.splice(r,1)}}catch(e){n("component.events.unregisterListenersFix",e)}},Yt=Gr;var Xt=class{constructor(e={}){this.parent=e?.parent||null,this.onUpdateChildComponent=this.handleUpdateChildComponentInVDOM,this.updateVirtualDOM=this.handleUpdateVirtualDOM,this.timers={},this.children={},_e(e),wt(this,e),this.data=kt(this)}setDOMNodeOnInstance(){this.DOMNode=document.querySelector(`body [js-i="${this.instanceId}"]`)}async handleFetchData(e={},r={},o={},i=this){let s=await Y(e,r,o,i);return this.data=s,s}handleGetInstance(){return this}handleUpdateVirtualDOM(){if(this.DOMNode){let r=Z(this.DOMNode);this.dom.virtual=r}let e=this.parent?A(window.joystick._internal.tree,this.parent?.instanceId,"instanceId"):null;e?.instance&&e.instance.updateVirtualDOM()}onBeforeRender(){if(!C())return{instanceId:this.instanceId}}render(e={}){if(b(`ui.${this?.options?.test?.name||h()}.render`,[e]),e?.mounting)return Ut(this,e);let r=this.onBeforeRender();Yt(this),Ht(this.instanceId);let o=U(this,{}),i=oe(this.dom.virtual,o.virtual);i&&l(i)&&B("lifecycle.onBeforeMount",()=>{let s=i(this.DOMNode);this.dom.actual=s,this.dom.virtual=o.virtual,Jt(this,this.renderMethods),this.setDOMNodeOnInstance(),B("domNodes",()=>{B("lifecycle.onMount",()=>{this.onAfterRender(r,e)})})})}renderToHTML(e={}){return ee(this,e)}onAfterRender(e={},r={}){C()||(Zt(e.instanceId,this),window.joystick._internal.css.update(),B("lifecycle.onUpdateProps"),r?.afterSetStateRender&&l(r.afterSetStateRender)&&r.afterSetStateRender(),r?.afterRefetchDataRender&&l(r.afterRefetchDataRender)&&r.afterRefetchDataRender(),this.parent&&this.parent.onUpdateChildComponent(this.id,this.instanceId))}setState(e={},r=null){b(`ui.${this?.options?.test?.name||h()}.setState`,[e,r]),this.state=z(this,{...this.state||{},...e}),this.render({afterSetStateRender:()=>{r&&l(r)&&r()}})}setValue(e={},r=null){b(`ui.${this?.options?.test?.name||h()}.setValue`,[e,r]),this.values=z(this,{...this.values||{},...e})}setTimeout(e=null,r=0){e&&(this.timers[h()]=window.setTimeout(e,r))}setInterval(e=null,r=0){e&&(this.timers[h()]=window.setInterval(e,r))}handleUpdateChildComponentInVDOM(e="",r=""){let o=A(window.joystick._internal.tree,this.instanceId,"instanceId"),i=A(window.joystick._internal.tree,r,"instanceId");if(i?.instance?.DOMNode){let s=Z(i?.instance?.DOMNode);Gt(o?.instance?.dom?.virtual,i?.instanceId,s)}}},jd=Xt;export{jd as default};
21
+ `}}return r}return""}catch(r){n("component.css.compileCSS",r)}};var ur=(t={},e=null)=>{try{let r=e(t);return r&&u(r)&&!R(r)?Object.assign({},r):{}}catch(r){n("component.state.compile.compileState",r)}},z=(t={},e={})=>{try{return l(e)?ur(t,e):Object.assign({},e)}catch(r){n("component.state.compile",r)}};var mr=(t={},e=null)=>{try{let r=e(t);return r&&u(r)&&!R(r)?Object.assign({},r):{}}catch(r){n("component.values.compile.compileValues",r)}},ut=(t={},e={})=>{try{return l(e)?mr(t,e):Object.assign({},e)}catch(r){n("component.values.compile",r)}};var ne={onBeforeMount:()=>null,onMount:()=>null,onBeforeUnmount:()=>null,onUpdateProps:()=>null,onRefetchData:()=>null};var mt=(t={},e={})=>{try{return e?Object.entries({...ne,...e||{}}).reduce((r={},[o,i])=>(r[o]=()=>i({...t,setState:t.setState.bind(t),...t.renderMethods||{}}),r),{}):ne}catch(r){n("component.lifecycle.compile",r)}};var b=(t="",e=[])=>{typeof window!="undefined"&&!!window.__joystick_test__&&(window.test={...window.test||{},functionCalls:{...window?.test?.functionCalls||{},[t]:[...window?.test?.functionCalls&&window?.test?.functionCalls[t]||[],{calledAt:new Date().toISOString(),args:e}]}})};var W=(t={},e={})=>{try{return Object.entries(e).reduce((r={},[o,i])=>(r[o]=(...s)=>(b(`ui.${t?.options?.test?.name||h()}.methods.${o}`,[...s,{...t,setState:t.setState.bind(t),...t.renderMethods||{}}]),i(...s,{...t,setState:t.setState.bind(t),...t.renderMethods||{}})),r),{})}catch{n("component.methods.compile")}};var se=(t={})=>{try{return{...t,query:{...t?.query||{},set:(e="",r="")=>{if(typeof window!="undefined"){let o=new URL(window.location);o.searchParams.append(e,r),window.history.pushState({},"",o)}},unset:(e="")=>{if(typeof window!="undefined"){let r=new URL(window.location);r.searchParams.delete(e),window.history.pushState({},"",r)}}},isActive:(e="")=>O(e)&&t?.route!=="*"?e===(typeof location!="undefined"?location.pathname:t.path):!1}}catch(e){n("component.url.compile",e)}};var v=()=>typeof window=="undefined";var V=null,J=0,pt=(t={},e=null)=>{try{if(window?.__joystick_test__)return e();let r=t?.url;t?.query&&(r=`${r}?${new URLSearchParams(t.query).toString()}`);let o=new WebSocket(r);V&&(clearInterval(V),V=null);let i={client:o,send:(s={})=>(b(`ui.websockets.${t?.test?.name||h()}.send`,[s]),o.send(JSON.stringify(s)))};return o.addEventListener("open",()=>{t?.options?.logging&&console.log(`[joystick.websockets] Connected to ${t?.url}`),t?.events?.onOpen&&(t.events.onOpen(i),b(`ui.websockets.${t?.test?.name||h()}.onOpen`,[i])),J=0}),o.addEventListener("message",s=>{s?.data&&t?.events?.onMessage&&(t.events.onMessage(JSON.parse(s.data||{}),i),b(`ui.websockets.${t?.test?.name||h()}.onMessage`,[s.data||{},i]))}),o.addEventListener("close",s=>{t?.options?.logging&&console.log(`[joystick.websockets] Disconnected from ${t?.url}`),t?.events?.onClose&&(t.events.onClose(s?.code,s?.reason,i),b(`ui.websockets.${t?.test?.name||h()}.onClose`,[s.data||{},i])),o=null;let c=[1e3,1001].includes(s?.code);t?.options?.autoReconnect&&!V&&!c&&(V=setInterval(()=>{o=null,J<(t?.options?.reconnectAttempts||12)?(pt(t,e),t?.options?.logging&&console.log(`[joystick.websockets] Attempting to reconnect (${J+1}/12)...`),J+=1):clearInterval(V)},t?.options?.reconnectDelayInSeconds*1e3||5e3))}),e&&e(i),i}catch(r){n("websockets.client",r)}},ft=pt;var pr=(t={},e=null)=>{try{let r=e(t);return r&&u(r)&&!R(r)?Object.assign({},r):{}}catch(r){n("component.props.compileDefaultProps.compile",r)}},ht=(t={},e={})=>{try{return l(e)?pr(t,e):Object.assign({},e)}catch(r){n("component.props.compileDefaultProps",r)}};var wt=(t={},e={})=>{try{t.options=e||{},t.id=e?._componentId||null,t.instanceId=h(8),t.ssrId=e?._ssrId||null,t.css=lt(),t.data=K(e?.dataFromSSR,e?._componentId),t.defaultProps=ht(t,e?.defaultProps),t.props=ct(t?.defaultProps,e?.props),t.state=z(t,e?.state),t.values=ut(t,e?.values),t.events=e?.events||{},t.lifecycle=mt(t,e?.lifecycle),t.methods=W(t,e?.methods),t.wrapper=e?.wrapper||{},t.translations=e?.translations||{},t.validateForm=dt,t.DOMNode=null,t.dom={},t.dom.virtual={},t.dom.actual={};let r=!v();if(r||(t.url=se(e?.url)),r&&window.__joystick_url__&&(t.url=se(window.__joystick_url__)),r&&window.__joystick_user__&&(t.user=window.__joystick_user__),r&&e?.websockets&&l(e?.websockets)){let o=e.websockets(t),i=u(o)&&Object.entries(o);for(let s=0;s<i?.length;s+=1){let[c,a]=i[s];ft({test:t?.test,url:`${window?.process?.env.NODE_ENV==="development"?"ws":"wss"}://${location.host}/api/_websockets/${c}`,options:a?.options||{},query:a?.query||{},events:a?.events||{}},(m={})=>{t.websockets={...t.websockets||{},[c]:m}})}}}catch(r){n("component.registerOptions",r)}};var N=(t="",e=[])=>{try{console.error(`${t} failed with the following errors:`),e.forEach(r=>{console.log(r.message),r.stack&&console.log(r.stack)})}catch(r){n(t,r)}};var Q=(t="{}")=>{try{return JSON.parse(t)}catch{return t}};var yt=(t={})=>Object.entries(t).map(([e,r])=>`${e}=${r}`)?.join("; ");var fr=async(t={})=>{try{let e=await t.text();return Q(e)}catch(e){n("api.get.handleParseResponse",e)}},gt=(t="",e={})=>{try{return typeof window.fetch!="undefined"&&!e?.skip?new Promise((r,o)=>{let i=e.input?JSON.stringify(e.input):null,s=e.output?JSON.stringify(e.output):null,c=`${window.location.origin}/api/_getters/${t}?input=${i}&output=${s}`,a=document.querySelector('[name="csrf"]')?.getAttribute("content"),m={...e?.headers||{},"x-joystick-csrf":a};return window?.__joystick_test__&&(m.Cookie=yt({joystickLoginToken:window.__joystick_test_login_token__,joystickLoginTokenExpiresAt:window.__joystick_test_login_token_expires_at__})),e?.loader?.instance&&e?.loader?.instance?.setState({[e?.loader?.state||`${t}_loading`]:!0}),fetch(c,{method:"GET",mode:"cors",headers:m,credentials:"include"}).then(async g=>{let y=await fr(g);return e?.loader?.instance&&e?.loader?.instance?.setState({[e?.loader?.state||`${t}_loading`]:!1}),y?.errors?(N("get request",y.errors),o(y)):r(y)}).catch(g=>(N("get request",[g]),e?.loader?.instance&&e?.loader?.instance?.setState({[e?.loader?.state||`${t}_loading`]:!1}),o({errors:[g]})))}):Promise.resolve()}catch(r){n("get request",r)}};var hr=async(t={})=>{try{let e=await t.text();return Q(e)}catch(e){n("api.set.handleParseResponse",e)}},wr=(t={})=>{try{let e={...t};return e?.loader&&delete e.loader,JSON.stringify(e)}catch(e){n("api.set.getBody",e)}},xt=(t="",e={})=>{try{return typeof window.fetch!="undefined"?new Promise((r,o)=>{let i=`${window.location.origin}/api/_setters/${t}`,s=wr(e),c=document.querySelector('[name="csrf"]')?.getAttribute("content"),a={...e?.headers||{},"Content-Type":"application/json","x-joystick-csrf":c};return window?.__joystick_test__&&(a.Cookie=generateCookieHeader({joystickLoginToken:window?.__joystick_test_login_token__,joystickLoginTokenExpiresAt:window.__joystick_test_login_token_expirs_at__})),e?.loader?.instance&&e?.loader?.instance?.setState({[e?.loader?.state||`${t}_loading`]:!0}),fetch(i,{method:"POST",mode:"cors",headers:a,body:s,credentials:"include"}).then(async m=>{let g=await hr(m);return e?.loader?.instance&&e?.loader?.instance?.setState({[e?.loader?.state||`${t}_loading`]:!1}),g?.errors?(N("set request",g.errors),o(g)):r(g)}).catch(m=>(N("set request",[m]),e?.loader?.instance&&e?.loader?.instance?.setState({[e?.loader?.state||`${t}_loading`]:!1}),o({errors:[m]})))}):Promise.resolve()}catch(r){n("set request",r)}};var bt={get:gt,set:xt};var yr=(t="")=>{try{let[e,r]=t?.split(".");return r?window?.joystick?._internal?.queues[e][r]:window?.joystick?._internal?.queues[e]}catch(e){n("addToQueue.getQueue",e)}},H=(t="",e=null)=>{try{v()||(yr(t)||{}).array.push({callback:e})}catch(r){n("addToQueue",r)}};var Y=async(t={},e={},r={},o={})=>{try{if(o?.options?.data&&l(o.options.data)){let i=await o.options.data(t,e,r,o);return Promise.resolve(i)}return Promise.resolve()}catch(i){n("component.data.fetch",i)}};var $t=(t={},e={},r={})=>{try{return{...t,refetch:async(o={})=>{b(`ui.${r?.options?.test?.name||h()}.data.refetch`,[o]);let i=await Y(bt,e,o,r);return r.data=$t(i,e,r),window.__joystick_data__[r?.id]&&(window.__joystick_data__[r?.id]=i),window?.__joystick_test__||r.render({afterRefetchDataRender:()=>{r?.lifecycle?.onRefetchData&&r?.lifecycle?.onRefetchData(r)}}),r.data}}}catch(o){n("component.data.compile",o)}},Ft=$t;var kt=(t={})=>{try{if(!v()){let e=window.__joystick_data__&&window.__joystick_data__[t?.id]||{},r=window.__joystick_req__||{};return Ft(e,r,t)}return t?.data||{}}catch(e){n("component.loadDataFromWindow",e)}};var Tt=cr(Et());var Mt=(t={},e="",r="id")=>{try{let o=t&&t.id;if(u(t)&&o){let i=Object.keys(t);for(let s=0;s<i.length;s+=1){let c=i[s],a=t[c];if(c===r&&a===e)return t;if(c==="children"&&Array.isArray(a))for(let m=0;m<a.length;m+=1){let g=a[m],y=Mt(g,e,r);if(y!==null)return y}}}return null}catch(o){n("component.findComponentInTreeByField",o)}},A=Mt;var St=(t="",e={},r=null)=>{let o=A(r||window.joystick._internal.tree,t,"instanceId");o&&(o.children=[...o.children||[],e])};var gr=(t={},e={},r=null)=>{try{let o=U(t,{includeActual:!0,existingChildren:r});return t.dom=o,t.setDOMNodeOnInstance(),e.renderedComponent=t,o.html.wrapped}catch(o){n("component.renderMethods.component.renderForClient",o)}},xr=(t={})=>{try{return t.renderToHTML({ssrTree:t.parent.ssrTree,translations:t.parent.translations,walkingTreeForSSR:t?.parent?.walkingTreeForSSR,dataFromSSR:t.parent?.dataFromSSR}).wrapped}catch(e){n("component.renderMethods.component.renderToHTMLForSSR",e)}},br=(t={})=>{try{return t.parent.ssrTree.dataFunctions.push(async()=>{try{let e=await t.options.data(t.parent.options.api,t.parent.options.req);return t.data=e||{},{componentId:t.id,ssrId:t.ssrId,data:e}}catch(e){return{componentId:t.id,ssrId:t.ssrId,data:null,error:e}}}),t.renderToHTML({ssrTree:t?.parent?.ssrTree,translations:t?.parent?.translations,walkingTreeForSSR:t?.parent?.walkingTreeForSSR,dataFromSSR:t?.parent?.dataFromSSR})}catch(e){n("component.renderMethods.component.collectDataFunctionsForSSR",e)}},$r=(t={})=>{try{let e={id:t.id,instanceId:t.instanceId,instance:t,children:[]};St(t.parent.instanceId,e,t.parent&&t.parent.ssrTree||null)}catch(e){n("component.renderMethods.component.handleAddComponentToParent",e)}},Fr=(t={},e={})=>{try{!t.renderedComponent&&e.options&&e.options.lifecycle&&(e.options.lifecycle.onBeforeMount&&H("lifecycle.onBeforeMount",()=>{e.options.lifecycle.onBeforeMount(e),b(`ui.${e?.options?.test?.name||h()}.lifecycle.onBeforeMount`,[e])}),!t.renderedComponent&&e.options.lifecycle.onMount&&H("lifecycle.onMount",()=>{e.options.lifecycle.onMount(e),b(`ui.${e?.options?.test?.name||h()}.lifecycle.onMount`,[e])}))}catch(r){n("component.renderMethods.component.handleLifecycle",r)}},kr=(t={},e={},r={})=>{try{!e.walkingTreeForSSR&&t?.options?.lifecycle?.onUpdateProps&&(0,Tt.diff)(e?.existingPropsMap,r)?.length>0&&H("lifecycle.onUpdateProps",()=>{let i=e?.existingPropsMap&&e?.existingPropsMap[t.id];t.options.lifecycle.onUpdateProps(i||{},r,t),b(`ui.${t?.options?.test?.name||h()}.lifecycle.onBeforeMount`,[i||{},r,t])})}catch(o){n("component.renderMethods.component.handleOnChangeProps",o)}},Er=function(){return function(e=null,r={},o={}){let i=e({props:r,url:o.url,translations:o.translations,api:o.options.api,req:o.options.req,dataFromSSR:o?.dataFromSSR,parent:o}),s=o?.existingStateMap[i.id]||{},c=o.children[i.id]||[],a=s[c?.length];return i.state=a?.state||i.state,i.values=a?.values||i.values,o.children[i.id]=[...o.children[i.id]||[],i],i.parent=o,kr(i,o,r),H("lifecycle.onMount",()=>{i.setDOMNodeOnInstance()}),Fr(this,i),i.parent&&$r(i),i.options.data&&i.parent.walkingTreeForSSR&&i.parent.ssrTree.dataFunctions?br(i):i.parent&&i.parent.ssrTree?xr(i):gr(i,this,a?.children)}},Mr=function(e,r){try{let o=this;return new Er().bind({})(e,r,o)}catch(o){n("component.renderMethods.component",o)}},ae=Mr;var Sr=function(e=[],r=null){try{return l(r)&&e&&Array.isArray(e)?e.map((o,i)=>r(o,i)).join(""):""}catch(o){n("component.renderMethods.each",o)}},de=Sr;var Tr=(t="",e=[])=>{try{return e.reduce((r,[o,i])=>r.replace(`{{${o}}}`,i),t)}catch(r){n("component.renderMethods.i18n.replacePlaceholdersInString",r)}},ce=(t="",e=[])=>{try{let r=typeof t=="string",o=Array.isArray(t),i=typeof t=="object"&&!o;if(r)return Tr(t,e);if(o)return t?.map(s=>ce(s,e));if(i)return Object.entries(t)?.reduce((s={},[c,a])=>(s[c]=ce(a,e),s),{})}catch(r){n("component.renderMethods.i18n.handleTranslationReplacement",r)}},Or=(t="",e={})=>{try{return t?.split(".").reduce((r,o)=>r[o],e)}catch(r){n("component.renderMethods.i18n.getTranslationAtPath",r)}},vr=function(t="",e={}){try{let r=v()?this.translations:window.__joystick_i18n__,i=t?.includes(".")?Or(t,r):r[t];if(!r||!i)return"";let s=Object.entries(e);return ce(i,s)}catch(r){n("component.renderMethods.i18n",r)}},le=vr;var Cr=function(e=!1,r=""){try{return this?.renderingHTMLWithDataForSSR||e?`<when>${r.trim()}</when>`:"<when> </when>"}catch(o){n("component.renderMethods.when",o)}},ue=Cr;var Ot={c:ae,component:ae,e:de,each:de,i:le,i18n:le,w:ue,when:ue};var vt=(t={},e={})=>{try{return Object.entries(Ot).reduce((r,[o,i])=>(r[o]=i.bind({...t,...e}),r),{})}catch(r){n("component.renderMethods.compile",r)}};var Ct=(t={})=>{try{return Object.entries(t)?.reduce((e={},[r,o]={})=>(e[r]=o?.map((i={})=>({state:i?.state,values:i?.values,children:Ct(i?.children)})),e),{})}catch(e){n("component.render.getExistingStateMap.buildMapForChildren",e)}},_t=(t={})=>{try{return Ct(t)}catch(e){n("component.render.getExistingStateMap",e)}};var jt=new RegExp(/\<\!\-\-(?:.|\n|\r)*?-->/g),_r=new RegExp(/\n/g);var jr=(t="")=>{try{return(t.match(jt)||[]).forEach(r=>{t=t.replace(r,"")}),t}catch(e){n("component.render.sanitizeHTML.removeCommentedCode",e)}},Rt=(t="")=>{try{let e=`${t}`;return e=jr(e),e}catch(e){n("component.render.sanitizeHTML",e)}};var At=(t={},e="")=>{try{let{wrapper:r=null,id:o=null,instanceId:i=null}=t;return`<div ${r?.id?`id="${r.id}" `:""}${r?.classList?`class="${r.classList?.join(" ")}" `:""} js-c="${o}" js-i="${i}">${e}</div>`}catch(r){n("component.render.wrapHTML",r)}};var Lt=(t={},e=[])=>{try{let r=[...e],o=Object.entries(t);for(let i=0;i<o?.length;i+=1){let[s,c]=o[i];for(let a=0;a<c?.length;a+=1){let m=c[a];Object.entries(m?.timers)?.length>0&&r.push(...Object.values(m?.timers)),Object.entries(m?.children)?.length>0&&Lt(m?.children,r)}}if(r?.length>0)for(let i=0;i<r?.length;i+=1)clearTimeout(r[i])}catch(r){n("component.render.clearTimersOnChildren",r)}},Dt=Lt;var ee=(t={},e={})=>{try{e?.dataFromSSR&&(t.data=K(e.dataFromSSR,t.id)||{}),Dt(t?.children);let r=_t(e?.existingChildren||t?.children)||{};t.children={},t.renderMethods=vt({...t,existingStateMap:r,translations:e?.translations||t.translations||{},ssrTree:e?.ssrTree,walkingTreeForSSR:e?.walkingTreeForSSR,renderingHTMLWithDataForSSR:e?.renderingHTMLWithDataForSSR,dataFromSSR:e?.dataFromSSR}),t.methods=W(t,t.options.methods);let o=t.options.render({...t||{},setState:t.setState.bind(t),...t.renderMethods||{}}),i=Rt(o),s=At(t,i);return{unwrapped:i,wrapped:s}}catch(r){n("component.render.toHTML",r)}};var Rr=(t={})=>{try{return Object.values(t).reduce((e={},r)=>(e[r.name]=r.value,e),{})}catch(e){n("component.virtualDOM.build.parseAttributeMap",e)}},Pt=(t={})=>{try{return t.tagName==="WHEN"?[].flatMap.call(t?.childNodes,e=>e?.tagName==="WHEN"?Pt(e):me(e)):me(t)}catch(e){n("component.virtualDOM.build.flattenWhenTags",e)}},me=(t={})=>{try{let e=t&&t.tagName&&t.tagName.toLowerCase()||"text",r={tagName:e,attributes:Rr(t.attributes),children:[].flatMap.call(t.childNodes,o=>Pt(o))};return e==="text"&&(r=t.textContent),r}catch(e){n("component.virtualDOM.build",e)}},Z=me;var Ar=(t="")=>{try{let e=document.createElement("div");return e.innerHTML=t,e?.childNodes[0]}catch(e){n("component.virtualDOM.build.convertHTMLToDOM",e)}},It=(t="")=>{try{let e=Ar(t);return Z(e)}catch(e){n("component.virtualDOM.build",e)}};var Vt=(t="")=>{try{return document.createElement("div").setAttribute(t,"Test"),!0}catch{return!1}};var Lr=(t={})=>{try{let e=document.createElement(t.tagName),r=Object.entries(t.attributes);for(let o=0;o<r.length;o+=1){let[i,s]=r[o];Vt(i)&&e.setAttribute(i,s)}for(let o=0;o<t?.children?.length;o+=1){let i=t?.children[o];if(i){let s=Nt(i);e.appendChild(s)}}return e}catch(e){n("component.virtualDOM.renderTreeToDOM.renderElement",e)}},Nt=(t=null)=>{try{return O(t)?document.createTextNode(t):Lr(t)}catch(e){n("component.virtualDOM.renderTreeToDOM",e)}},q=Nt;var U=(t={},e={})=>{try{let r=ee(t,{existingChildren:e?.existingChildren}),o=It(r.wrapped,t),i=e.includeActual&&o?q(o):null;return{html:r,virtual:o,actual:i}}catch(r){n("component.render.getUpdatedDOM",r)}};var Ut=(t={},e={})=>{try{let r=U(t,{includeActual:!0,existingChildren:e?.existingChildren});return t.dom=r,r.actual}catch(r){n("component.render.forMount",r)}};var Dr=(t={},e={})=>{let r=[];for(let[o,i]of Object.entries(e))r.push(s=>(s&&s.setAttribute&&s.setAttribute(o,i),s));for(let o in t)o in e||r.push(i=>(i&&i.removeAttribute&&i.removeAttribute(o),i));return o=>{for(let i of r)i&&typeof i=="function"&&i(o)}},te=Dr;var Pr=(t=[],e=[])=>{let r=[],o=Math.max(t.length,e.length);for(let i=0;i<o;i+=1){let s=t[i],c=e[i];r.push([s,c])}return r},qt=Pr;var Ir=(t=[],e)=>{t.forEach(r=>{r&&typeof r=="function"&&r(e)})},Vr=(t=[])=>{t.forEach(([e,r])=>{e&&typeof e=="function"&&e(r)})},Nr=(t=[],e=[])=>{let r=[];return e.slice(t.length).forEach(i=>{let s=c=>{let a=q(i);return c.appendChild(a),c};r.push(s)}),r},Ur=(t=[],e=[])=>{let r=[];return t.forEach((o,i)=>{let s=oe(o,e[i]);r.push(s)}),r},qr=(t=[],e=[])=>{let r=Ur(t,e),o=Nr(t,e);return i=>{if(i){let s=qt(r,i.childNodes);Vr(s),Ir(o,i)}return i}},re=qr;var zt={select:(t,e)=>r=>{let o=r.value;r.replaceChildren(),te(t.attributes,e.attributes)(r),re([],e.children)(r);let i=r.querySelector(`option[value="${o}"]`);if(i&&(r.value=o),!i){let s=r.querySelector("option");r.value=s?.value||""}return r}};var pe=(t,e)=>r=>{let o=t?q(t):null;return r&&r.replaceWith(o),o},zr=()=>t=>{t&&t.remove()},Hr=(t=void 0,e=void 0)=>t===void 0||e===void 0?zr():typeof t=="string"||typeof e=="string"?pe(e,t):t.tagName!==e.tagName?pe(e):e.tagName==="select"?zt.select(t,e):["pre","code"].includes(e.tagName)?pe(e,t):i=>(te(t.attributes,e.attributes)(i),re(t.children,e.children)(i),i),oe=Hr;var Zr=(t="")=>{try{let[e,r]=t?.split(".");return r?window?.joystick?._internal?.queues[e][r]:window?.joystick?._internal?.queues[e]}catch(e){n("processQueue.getQueue",e)}},B=(t="",e=null)=>{try{v()||(Zr(t)||{}).process(e)}catch(r){n("processQueue",r)}};var Ht=(t="",e=null)=>{let r=A(e||window.joystick._internal.tree,t,"instanceId");r&&(r.children=[])};var Zt=(t="",e={},r=null)=>{let o=A(r||window.joystick._internal.tree,t,"instanceId");o&&(o.instanceId=e?.instanceId,o.instance=e)};var Bt=(t={},e="",r={})=>{for(let o=0;o<t?.children?.length;o+=1){let i=t?.children[o];if(u(i)&&i.attributes&&i.attributes["js-i"]&&i.attributes["js-i"]===e){t.children[o]=r;break}u(i)&&Bt(i,e,r)}},Gt=Bt;var Kt=(t={})=>{try{return Object.entries(t).map(([e,r])=>{let[o,...i]=e.split(" ");return{type:o.toLowerCase(),selector:i.join(" "),handler:r}})}catch(e){n("component.events.serialize",e)}};var Wt=(t={},e={},r=[])=>{try{let o=Object.keys(t?.events||{})?.length>0?Kt(t?.events):[];for(let i=0;i<o?.length;i+=1){let s=o[i];r.push({...s,instance:t,elements:document.querySelectorAll(`body [js-i="${t.instanceId}"] ${s?.selector}`),handler:function(a){s.handler(a,{...t||{},setState:t?.setState.bind(t),...e||{}}),b(`ui.${t?.options?.test?.name||h()}.events.${s.type}.selector_${s?.selector}`,[a,{...t||{},setState:t?.setState.bind(t),...e||{}}])}})}if(t?.children){let i=Object.entries(t?.children)?.flatMap(([s,c])=>c);for(let s=0;s<i?.length;s+=1){let c=i[s];Wt(c,e,r)}}return r}catch(o){n("component.eve!nts.registerListenersFix.getListeners",o)}},Br=(t={},e={})=>{try{let o=Wt(t,e,[])?.flatMap((i={})=>[].flatMap.call(i?.elements||[],s=>{let{elements:c=[],...a}=i||{};return{...a,element:s}}));for(let i=0;i<o?.length;i+=1){let{instance:s,element:c,elementSelector:a,type:m,handler:g}=o[i];c.addEventListener(m,g),s._eventListeners=[...s?._eventListeners||[],{instance:s,element:c,elementSelector:a,type:m,handler:g}]}}catch(r){n("component.events.registerListenersFix",r)}},Jt=Br;var Qt=(t={})=>{try{let e=t?._eventListeners||[];if(t?.children){let o=(Object.values(t?.children||{})?.reduce((i=[],s=[])=>[...i,...s],[])).flatMap((i={})=>Qt(i));e=[...e,...o]}return e}catch(e){n("component.events.unregisterListenersFix.getListeners",e)}},Gr=(t={})=>{try{let e=Qt(t);for(let r=0;r<e?.length;r+=1){let{instance:o,element:i,type:s,handler:c}=e[r];i.removeEventListener(s,c),o._eventListeners=o._eventListeners?.splice(r,1)}}catch(e){n("component.events.unregisterListenersFix",e)}},Yt=Gr;var Xt=class{constructor(e={}){this.parent=e?.parent||null,this.onUpdateChildComponent=this.handleUpdateChildComponentInVDOM,this.updateVirtualDOM=this.handleUpdateVirtualDOM,this.timers={},this.children={},_e(e),wt(this,e),this.data=kt(this)}setDOMNodeOnInstance(){this.DOMNode=document.querySelector(`body [js-i="${this.instanceId}"]`)}async handleFetchData(e={},r={},o={},i=this){let s=await Y(e,r,o,i);return this.data=s,s}handleGetInstance(){return this}handleUpdateVirtualDOM(){if(this.DOMNode){let r=Z(this.DOMNode);this.dom.virtual=r}let e=this.parent?A(window.joystick._internal.tree,this.parent?.instanceId,"instanceId"):null;e?.instance&&e.instance.updateVirtualDOM()}onBeforeRender(){if(!v())return{instanceId:this.instanceId}}render(e={}){if(b(`ui.${this?.options?.test?.name||h()}.render`,[e]),e?.mounting)return Ut(this,e);let r=this.onBeforeRender();Yt(this),Ht(this.instanceId);let o=U(this,{}),i=oe(this.dom.virtual,o.virtual);i&&l(i)&&B("lifecycle.onBeforeMount",()=>{let s=i(this.DOMNode);this.dom.actual=s,this.dom.virtual=o.virtual,Jt(this,this.renderMethods),this.setDOMNodeOnInstance(),B("domNodes",()=>{B("lifecycle.onMount",()=>{this.onAfterRender(r,e)})})})}renderToHTML(e={}){return ee(this,e)}onAfterRender(e={},r={}){v()||(Zt(e.instanceId,this),window.joystick._internal.css.update(),B("lifecycle.onUpdateProps"),r?.afterSetStateRender&&l(r.afterSetStateRender)&&r.afterSetStateRender(),r?.afterRefetchDataRender&&l(r.afterRefetchDataRender)&&r.afterRefetchDataRender(),this.parent&&this.parent.onUpdateChildComponent(this.id,this.instanceId))}setState(e={},r=null){b(`ui.${this?.options?.test?.name||h()}.setState`,[e,r]),this.state=z(this,{...this.state||{},...e}),this.render({afterSetStateRender:()=>{r&&l(r)&&r()}})}setValue(e={},r=null){b(`ui.${this?.options?.test?.name||h()}.setValue`,[e,r]),this.values=z(this,{...this.values||{},...e})}setTimeout(e=null,r=0){e&&(this.timers[h()]=window.setTimeout(e,r))}setInterval(e=null,r=0){e&&(this.timers[h()]=window.setInterval(e,r))}handleUpdateChildComponentInVDOM(e="",r=""){let o=A(window.joystick._internal.tree,this.instanceId,"instanceId"),i=A(window.joystick._internal.tree,r,"instanceId");if(i?.instance?.DOMNode){let s=Z(i?.instance?.DOMNode);Gt(o?.instance?.dom?.virtual,i?.instanceId,s)}}},jd=Xt;export{jd as default};
@@ -1 +1 @@
1
- var e=["_componentId","_ssrId","api","dataFromSSR","existingProps","existingState","instanceId","parent","req","css","data","defaultProps","events","id","lifecycle","methods","name","props","render","state","test","translations","url","websockets","wrapper"];export{e as default};
1
+ var e=["_componentId","_ssrId","api","dataFromSSR","existingProps","existingState","instanceId","parent","req","css","data","defaultProps","events","id","lifecycle","methods","name","props","render","state","test","translations","url","values","websockets","wrapper"];export{e as default};
@@ -1 +1 @@
1
- var o=(e="",t={})=>{throw new Error(`[joystick${e?`.${e}`:""}] ${t.message||t.reason||t}`)};var p=["render"];var c=(e={})=>{try{return p.every(t=>Object.keys(e).includes(t))}catch(t){o("component.hasAllRequiredOptions",t)}};var m=["_componentId","_ssrId","api","dataFromSSR","existingProps","existingState","instanceId","parent","req","css","data","defaultProps","events","id","lifecycle","methods","name","props","render","state","test","translations","url","websockets","wrapper"];var l=e=>{try{return!!Array.isArray(e)}catch(t){o("types.isArray",t)}};var r=e=>{try{return typeof e=="function"}catch(t){o("types.isFunction",t)}};var i=e=>{try{return!!(e&&typeof e=="object"&&!Array.isArray(e))}catch(t){o("types.isObject",t)}};var s=e=>{try{return typeof e=="string"}catch(t){o("types.isString",t)}};var d=(e=null)=>{try{!s(e)&&!r(e)&&!i(e)&&o("component.optionValidators.css","options.css must be a string, function returning a string, or an object returning breakpoints.")}catch(t){o("component.optionValidators.css",t)}};var u=["readystatechange","pointerlockchange","pointerlockerror","beforecopy","beforecut","beforepaste","freeze","resume","search","securitypolicyviolation","visibilitychange","fullscreenchange","fullscreenerror","webkitfullscreenchange","webkitfullscreenerror","beforexrselect","abort","blur","cancel","canplay","canplaythrough","change","click","close","contextmenu","cuechange","dblclick","drag","dragend","dragenter","dragleave","dragover","dragstart","drop","durationchange","emptied","ended","error","focus","formdata","input","invalid","keydown","keypress","keyup","load","loadeddata","loadedmetadata","loadstart","mousedown","mouseenter","mouseleave","mousemove","mouseout","mouseover","mouseup","mousewheel","pause","play","playing","progress","ratechange","reset","resize","scroll","seeked","seeking","select","stalled","submit","suspend","timeupdate","toggle","volumechange","waiting","webkitanimationend","webkitanimationiteration","webkitanimationstart","webkittransitionend","wheel","auxclick","gotpointercapture","lostpointercapture","pointerdown","pointermove","pointerup","pointercancel","pointerover","pointerout","pointerenter","pointerleave","selectstart","selectionchange","animationend","animationiteration","animationstart","transitionrun","transitionstart","transitionend","transitioncancel","copy","cut","paste","pointerrawupdate"];var f=(e=null)=>{try{i(e)||o("component.optionValidators.events","options.events must be an object.");for(let t of Object.keys(e)){let[n]=t.split(" ");u.includes(n)||o("component.optionValidators.events",`${n} is not a supported JavaScript event type.`)}for(let[t,n]of Object.entries(e))r(n)||o("component.optionValidators.events",`options.events.${t} must be assigned a function.`)}catch(t){o("component.optionValidators.events",t)}};var y=["onBeforeMount","onMount","onUpdateProps","onBeforeUnmount","onRefetchData"];var b=(e=null)=>{try{i(e)||o("component.optionValidators.lifecycle","options.lifecycle must be an object.");for(let[t,n]of Object.entries(e))y.includes(t)||o("component.optionValidators.lifecycle",`options.lifecycle.${t} is not supported.`),r(n)||o("component.optionValidators.lifecycle",`options.lifecycle.${t} must be assigned a function.`)}catch(t){o("component.optionValidators.lifecycle",t)}};var w=(e=null)=>{try{i(e)||o("component.optionValidators.methods","options.methods must be an object.");for(let[t,n]of Object.entries(e))r(n)||o("component.optionValidators.methods",`options.methods.${t} must be assigned a function.`)}catch(t){o("component.optionValidators.methods",t)}};var h=(e=null)=>{typeof e!="string"&&o("component.optionValidators.name","options.name must be a string.")};var g=(e=null)=>{try{r(e)||o("component.optionValidators.render","options.render must be a function returning a string.")}catch(t){o("component.optionValidators.render",t)}};var x=(e=null)=>{try{i(e)||o("component.optionValidators.test","options.test must be an object."),e?.name&&!s(e.name)&&o("component.optionValidators.test","options.test.name must be assigned a string.")}catch(t){o("component.optionValidators.test",t)}};var k=(e=null)=>{try{r(e)||o("component.optionValidators.websockets","options.websockets must be a function returning an object.")}catch(t){o("component.optionValidators.websockets",t)}};var F=(e=null)=>{try{i(e)||o("component.optionValidators.wrapper","options.wrapper must be an object.");for(let[t,n]of Object.entries(e))t==="id"&&!s(n)&&o("component.optionValidators.wrapper",`options.wrapper.${t} must be assigned a string.`),t==="classList"&&!l(n)&&o("component.optionValidators.wrapper",`options.wrapper.${t} must be assigned an array of strings.`)}catch(t){o("component.optionValidators.wrapper",t)}};var V={css:d,events:f,lifecycle:b,methods:w,name:h,render:g,test:x,websockets:k,wrapper:F};var Ot=(e={})=>{try{c(e)||o("component.validateOptions",`component options must include ${required.options.join(",")}.`);for(let[t,n]of Object.entries(e)){m.includes(t)||o("component.validateOptions",`${t} is not supported by joystick.component.`);let a=V[t];a&&r(a)&&a(n)}}catch(t){o("component.validateOptions",t)}};export{Ot as default};
1
+ var o=(e="",t={})=>{throw new Error(`[joystick${e?`.${e}`:""}] ${t.message||t.reason||t}`)};var p=["render"];var c=(e={})=>{try{return p.every(t=>Object.keys(e).includes(t))}catch(t){o("component.hasAllRequiredOptions",t)}};var m=["_componentId","_ssrId","api","dataFromSSR","existingProps","existingState","instanceId","parent","req","css","data","defaultProps","events","id","lifecycle","methods","name","props","render","state","test","translations","url","values","websockets","wrapper"];var l=e=>{try{return!!Array.isArray(e)}catch(t){o("types.isArray",t)}};var r=e=>{try{return typeof e=="function"}catch(t){o("types.isFunction",t)}};var i=e=>{try{return!!(e&&typeof e=="object"&&!Array.isArray(e))}catch(t){o("types.isObject",t)}};var s=e=>{try{return typeof e=="string"}catch(t){o("types.isString",t)}};var d=(e=null)=>{try{!s(e)&&!r(e)&&!i(e)&&o("component.optionValidators.css","options.css must be a string, function returning a string, or an object returning breakpoints.")}catch(t){o("component.optionValidators.css",t)}};var u=["readystatechange","pointerlockchange","pointerlockerror","beforecopy","beforecut","beforepaste","freeze","resume","search","securitypolicyviolation","visibilitychange","fullscreenchange","fullscreenerror","webkitfullscreenchange","webkitfullscreenerror","beforexrselect","abort","blur","cancel","canplay","canplaythrough","change","click","close","contextmenu","cuechange","dblclick","drag","dragend","dragenter","dragleave","dragover","dragstart","drop","durationchange","emptied","ended","error","focus","formdata","input","invalid","keydown","keypress","keyup","load","loadeddata","loadedmetadata","loadstart","mousedown","mouseenter","mouseleave","mousemove","mouseout","mouseover","mouseup","mousewheel","pause","play","playing","progress","ratechange","reset","resize","scroll","seeked","seeking","select","stalled","submit","suspend","timeupdate","toggle","volumechange","waiting","webkitanimationend","webkitanimationiteration","webkitanimationstart","webkittransitionend","wheel","auxclick","gotpointercapture","lostpointercapture","pointerdown","pointermove","pointerup","pointercancel","pointerover","pointerout","pointerenter","pointerleave","selectstart","selectionchange","animationend","animationiteration","animationstart","transitionrun","transitionstart","transitionend","transitioncancel","copy","cut","paste","pointerrawupdate"];var f=(e=null)=>{try{i(e)||o("component.optionValidators.events","options.events must be an object.");for(let t of Object.keys(e)){let[n]=t.split(" ");u.includes(n)||o("component.optionValidators.events",`${n} is not a supported JavaScript event type.`)}for(let[t,n]of Object.entries(e))r(n)||o("component.optionValidators.events",`options.events.${t} must be assigned a function.`)}catch(t){o("component.optionValidators.events",t)}};var y=["onBeforeMount","onMount","onUpdateProps","onBeforeUnmount","onRefetchData"];var b=(e=null)=>{try{i(e)||o("component.optionValidators.lifecycle","options.lifecycle must be an object.");for(let[t,n]of Object.entries(e))y.includes(t)||o("component.optionValidators.lifecycle",`options.lifecycle.${t} is not supported.`),r(n)||o("component.optionValidators.lifecycle",`options.lifecycle.${t} must be assigned a function.`)}catch(t){o("component.optionValidators.lifecycle",t)}};var w=(e=null)=>{try{i(e)||o("component.optionValidators.methods","options.methods must be an object.");for(let[t,n]of Object.entries(e))r(n)||o("component.optionValidators.methods",`options.methods.${t} must be assigned a function.`)}catch(t){o("component.optionValidators.methods",t)}};var h=(e=null)=>{typeof e!="string"&&o("component.optionValidators.name","options.name must be a string.")};var g=(e=null)=>{try{r(e)||o("component.optionValidators.render","options.render must be a function returning a string.")}catch(t){o("component.optionValidators.render",t)}};var x=(e=null)=>{try{i(e)||o("component.optionValidators.test","options.test must be an object."),e?.name&&!s(e.name)&&o("component.optionValidators.test","options.test.name must be assigned a string.")}catch(t){o("component.optionValidators.test",t)}};var k=(e=null)=>{try{r(e)||o("component.optionValidators.websockets","options.websockets must be a function returning an object.")}catch(t){o("component.optionValidators.websockets",t)}};var F=(e=null)=>{try{i(e)||o("component.optionValidators.wrapper","options.wrapper must be an object.");for(let[t,n]of Object.entries(e))t==="id"&&!s(n)&&o("component.optionValidators.wrapper",`options.wrapper.${t} must be assigned a string.`),t==="classList"&&!l(n)&&o("component.optionValidators.wrapper",`options.wrapper.${t} must be assigned an array of strings.`)}catch(t){o("component.optionValidators.wrapper",t)}};var V={css:d,events:f,lifecycle:b,methods:w,name:h,render:g,test:x,websockets:k,wrapper:F};var Ot=(e={})=>{try{c(e)||o("component.validateOptions",`component options must include ${required.options.join(",")}.`);for(let[t,n]of Object.entries(e)){m.includes(t)||o("component.validateOptions",`${t} is not supported by joystick.component.`);let a=V[t];a&&r(a)&&a(n)}}catch(t){o("component.validateOptions",t)}};export{Ot as default};
@@ -1 +1 @@
1
- var Mr=Object.create;var H=Object.defineProperty;var gr=Object.getOwnPropertyDescriptor;var Tr=Object.getOwnPropertyNames;var Fr=Object.getPrototypeOf,Sr=Object.prototype.hasOwnProperty;var Or=r=>H(r,"__esModule",{value:!0});var br=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var Er=(r,e,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Tr(e))!Sr.call(r,o)&&o!=="default"&&H(r,o,{get:()=>e[o],enumerable:!(t=gr(e,o))||t.enumerable});return r},kr=r=>Er(Or(H(r!=null?Mr(Fr(r)):{},"default",r&&r.__esModule&&"default"in r?{get:()=>r.default,enumerable:!0}:{value:r,enumerable:!0})),r);var K=br(L=>{(function(r,e){if(typeof define=="function"&&define.amd)define(["exports"],e);else if(typeof L!="undefined")e(L);else{var t={exports:{}};e(t.exports),r.index=t.exports}})(L,function(r){"use strict";function e(a){return e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(c){return typeof c}:function(c){return c&&typeof Symbol=="function"&&c.constructor===Symbol&&c!==Symbol.prototype?"symbol":typeof c},e(a)}function t(a,c){return c&&(e(c)==="object"||typeof c=="function")?c:o(a)}function o(a){if(a===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function n(a){return n=Object.setPrototypeOf?Object.getPrototypeOf:function(c){return c.__proto__||Object.getPrototypeOf(c)},n(a)}function s(a,c){if(typeof c!="function"&&c!==null)throw new TypeError("Super expression must either be null or a function");a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),c&&m(a,c)}function m(a,c){return m=Object.setPrototypeOf||function(p,g){return p.__proto__=g,p},m(a,c)}function l(a,c){if(!(a instanceof c))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0}),r.diff=void 0;var M=function a(c,p){l(this,a),this.type=c,this.path=p?p.toString():""},j=function(a){function c(p,g,d){var F;return l(this,c),F=t(this,n(c).call(this,"E",p)),F.lhs=g,F.rhs=d,F}return s(c,a),c}(M),D=function(a){function c(p,g,d,F){var f;return l(this,c),f=t(this,n(c).call(this,"M",p)),f.item=g,f.lhsIndex=d,f.rhsIndex=F,f}return s(c,a),c}(M),N=function(a){function c(p,g){var d;return l(this,c),d=t(this,n(c).call(this,"D",p)),d.lhs=g,d}return s(c,a),c}(M),P=function(a){function c(p,g){var d;return l(this,c),d=t(this,n(c).call(this,"A",p)),d.rhs=g,d}return s(c,a),c}(M),O=function(a,c){return a?"".concat(a,".").concat(c):c};r.diff=function(c,p){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{},d=[],F=g.matchKey,f=g.types||["E","A","D","M"],xr=function(h,u,w,b){h.forEach(function(S,y){var T=u.findIndex(function(x){return x[b]===S[b]});-1<T?(-1<f.indexOf("M")&&y!==T&&d.push(new D(w,S,y,T)),R(S,u[T],O(w,T))):-1<f.indexOf("D")&&d.push(new N(w,S))}),u.forEach(function(S,y){var T=h.findIndex(function(x){return S[b]===x[b]});-1<f.indexOf("A")&&T===-1&&d.push(new P(O(w,y),S))})},R=function(h,u,w){var b=Object.prototype.toString.call(h),S=Object.prototype.toString.call(u);if(-1<f.indexOf("E")&&b!==S)return d.push(new j(w,h,u)),!1;if(b==="[object Object]")Object.getOwnPropertyNames(h).forEach(function(x){Object.prototype.hasOwnProperty.call(u,x)?R(h[x],u[x],O(w,x)):-1<f.indexOf("D")&&d.push(new N(O(w,x),h[x]))}),Object.getOwnPropertyNames(u).forEach(function(x){-1<f.indexOf("A")&&!Object.prototype.hasOwnProperty.call(h,x)&&d.push(new P(O(w,x),u[x]))});else if(b!=="[object Array]")-1<f.indexOf("E")&&h!==u&&d.push(new j(w,h,u));else if(F)xr(h,u,w,F);else{var y=h.length-1,T=u.length-1;if(-1<f.indexOf("D"))for(;y>T;)d.push(new N(O(w,y),h[y--]));if(-1<f.indexOf("A"))for(;T>y;)d.push(new P(O(w,T),u[T--]));for(;0<=y;--y)R(h[y],u[y],O(w,y))}};return R(c,p),d}})});var i=(r="",e={})=>{throw new Error(`[joystick${r?`.${r}`:""}] ${e.message||e.reason||e}`)};var W=r=>{try{return!!Array.isArray(r)}catch(e){i("types.isArray",e)}};var z=r=>{try{return typeof r=="function"}catch(e){i("types.isFunction",e)}};var G=r=>{try{return!!(r&&typeof r=="object"&&!Array.isArray(r))}catch(e){i("types.isObject",e)}};var Q=r=>{try{return typeof r=="string"}catch(e){i("types.isString",e)}};var V=(r=[],e="")=>{try{return(W(r)&&r.find(o=>o?.componentId===e))?.data||{}}catch(t){i("findComponentDataFromSSR",t)}};var rr=kr(K());var A=()=>typeof window=="undefined";var Cr=(r="")=>{try{let[e,t]=r?.split(".");return t?window?.joystick?._internal?.queues[e][t]:window?.joystick?._internal?.queues[e]}catch(e){i("addToQueue.getQueue",e)}},C=(r="",e=null)=>{try{A()||(Cr(r)||{}).array.push({callback:e})}catch(t){i("addToQueue",t)}};var X=(r={},e="",t="id")=>{try{let o=r&&r.id;if(G(r)&&o){let n=Object.keys(r);for(let s=0;s<n.length;s+=1){let m=n[s],l=r[m];if(m===t&&l===e)return r;if(m==="children"&&Array.isArray(l))for(let M=0;M<l.length;M+=1){let j=l[M],D=X(j,e,t);if(D!==null)return D}}}return null}catch(o){i("component.findComponentInTreeByField",o)}},J=X;var Y=(r="",e={},t=null)=>{let o=J(t||window.joystick._internal.tree,r,"instanceId");o&&(o.children=[...o.children||[],e])};var E=(r="",e=[])=>{typeof window!="undefined"&&!!window.__joystick_test__&&(window.test={...window.test||{},functionCalls:{...window?.test?.functionCalls||{},[r]:[...window?.test?.functionCalls&&window?.test?.functionCalls[r]||[],{calledAt:new Date().toISOString(),args:e}]}})};var Z="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890".split(""),k=(r=16)=>{let e="",t=0;for(;t<r;)e+=Z[Math.floor(Math.random()*(Z.length-1))],t+=1;return e};var jr=(r={},e={},t=null)=>{try{let o=v(r,{includeActual:!0,existingChildren:t});return r.dom=o,r.setDOMNodeOnInstance(),e.renderedComponent=r,o.html.wrapped}catch(o){i("component.renderMethods.component.renderForClient",o)}},Dr=(r={})=>{try{return r.renderToHTML({ssrTree:r.parent.ssrTree,translations:r.parent.translations,walkingTreeForSSR:r?.parent?.walkingTreeForSSR,dataFromSSR:r.parent?.dataFromSSR}).wrapped}catch(e){i("component.renderMethods.component.renderToHTMLForSSR",e)}},Rr=(r={})=>{try{return r.parent.ssrTree.dataFunctions.push(async()=>{try{let e=await r.options.data(r.parent.options.api,r.parent.options.req);return r.data=e||{},{componentId:r.id,ssrId:r.ssrId,data:e}}catch(e){return{componentId:r.id,ssrId:r.ssrId,data:null,error:e}}}),r.renderToHTML({ssrTree:r?.parent?.ssrTree,translations:r?.parent?.translations,walkingTreeForSSR:r?.parent?.walkingTreeForSSR,dataFromSSR:r?.parent?.dataFromSSR})}catch(e){i("component.renderMethods.component.collectDataFunctionsForSSR",e)}},Lr=(r={})=>{try{let e={id:r.id,instanceId:r.instanceId,instance:r,children:[]};Y(r.parent.instanceId,e,r.parent&&r.parent.ssrTree||null)}catch(e){i("component.renderMethods.component.handleAddComponentToParent",e)}},Ar=(r={},e={})=>{try{!r.renderedComponent&&e.options&&e.options.lifecycle&&(e.options.lifecycle.onBeforeMount&&C("lifecycle.onBeforeMount",()=>{e.options.lifecycle.onBeforeMount(e),E(`ui.${e?.options?.test?.name||k()}.lifecycle.onBeforeMount`,[e])}),!r.renderedComponent&&e.options.lifecycle.onMount&&C("lifecycle.onMount",()=>{e.options.lifecycle.onMount(e),E(`ui.${e?.options?.test?.name||k()}.lifecycle.onMount`,[e])}))}catch(t){i("component.renderMethods.component.handleLifecycle",t)}},vr=(r={},e={},t={})=>{try{!e.walkingTreeForSSR&&r?.options?.lifecycle?.onUpdateProps&&(0,rr.diff)(e?.existingPropsMap,t)?.length>0&&C("lifecycle.onUpdateProps",()=>{let n=e?.existingPropsMap&&e?.existingPropsMap[r.id];r.options.lifecycle.onUpdateProps(n||{},t,r),E(`ui.${r?.options?.test?.name||k()}.lifecycle.onBeforeMount`,[n||{},t,r])})}catch(o){i("component.renderMethods.component.handleOnChangeProps",o)}},Nr=function(){return function(e=null,t={},o={}){let n=e({props:t,url:o.url,translations:o.translations,api:o.options.api,req:o.options.req,dataFromSSR:o?.dataFromSSR,parent:o}),s=o?.existingStateMap[n.id]||{},m=o.children[n.id]||[],l=s[m?.length];return n.state=l?.state||n.state,o.children[n.id]=[...o.children[n.id]||[],n],n.parent=o,vr(n,o,t),C("lifecycle.onMount",()=>{n.setDOMNodeOnInstance()}),Ar(this,n),n.parent&&Lr(n),n.options.data&&n.parent.walkingTreeForSSR&&n.parent.ssrTree.dataFunctions?Rr(n):n.parent&&n.parent.ssrTree?Dr(n):jr(n,this,l?.children)}},Pr=function(e,t){try{let o=this;return new Nr().bind({})(e,t,o)}catch(o){i("component.renderMethods.component",o)}},_=Pr;var Hr=function(e=[],t=null){try{return z(t)&&e&&Array.isArray(e)?e.map((o,n)=>t(o,n)).join(""):""}catch(o){i("component.renderMethods.each",o)}},I=Hr;var _r=(r="",e=[])=>{try{return e.reduce((t,[o,n])=>t.replace(`{{${o}}}`,n),r)}catch(t){i("component.renderMethods.i18n.replacePlaceholdersInString",t)}},$=(r="",e=[])=>{try{let t=typeof r=="string",o=Array.isArray(r),n=typeof r=="object"&&!o;if(t)return _r(r,e);if(o)return r?.map(s=>$(s,e));if(n)return Object.entries(r)?.reduce((s={},[m,l])=>(s[m]=$(l,e),s),{})}catch(t){i("component.renderMethods.i18n.handleTranslationReplacement",t)}},Ir=(r="",e={})=>{try{return r?.split(".").reduce((t,o)=>t[o],e)}catch(t){i("component.renderMethods.i18n.getTranslationAtPath",t)}},$r=function(r="",e={}){try{let t=A()?this.translations:window.__joystick_i18n__,n=r?.includes(".")?Ir(r,t):t[r];if(!t||!n)return"";let s=Object.entries(e);return $(n,s)}catch(t){i("component.renderMethods.i18n",t)}},U=$r;var Ur=function(e=!1,t=""){try{return this?.renderingHTMLWithDataForSSR||e?`<when>${t.trim()}</when>`:"<when> </when>"}catch(o){i("component.renderMethods.when",o)}},q=Ur;var er={c:_,component:_,e:I,each:I,i:U,i18n:U,w:q,when:q};var tr=(r={},e={})=>{try{return Object.entries(er).reduce((t,[o,n])=>(t[o]=n.bind({...r,...e}),t),{})}catch(t){i("component.renderMethods.compile",t)}};var or=(r={},e={})=>{try{return Object.entries(e).reduce((t={},[o,n])=>(t[o]=(...s)=>(E(`ui.${r?.options?.test?.name||k()}.methods.${o}`,[...s,{...r,setState:r.setState.bind(r),...r.renderMethods||{}}]),n(...s,{...r,setState:r.setState.bind(r),...r.renderMethods||{}})),t),{})}catch{i("component.methods.compile")}};var nr=(r={})=>{try{return Object.entries(r)?.reduce((e={},[t,o]={})=>(e[t]=o?.map((n={})=>({state:n?.state,children:nr(n?.children)})),e),{})}catch(e){i("component.render.getExistingStateMap.buildMapForChildren",e)}},ir=(r={})=>{try{return nr(r)}catch(e){i("component.render.getExistingStateMap",e)}};var cr=new RegExp(/\<\!\-\-(?:.|\n|\r)*?-->/g),qr=new RegExp(/\n/g);var Br=(r="")=>{try{return(r.match(cr)||[]).forEach(t=>{r=r.replace(t,"")}),r}catch(e){i("component.render.sanitizeHTML.removeCommentedCode",e)}},ar=(r="")=>{try{let e=`${r}`;return e=Br(e),e}catch(e){i("component.render.sanitizeHTML",e)}};var sr=(r={},e="")=>{try{let{wrapper:t=null,id:o=null,instanceId:n=null}=r;return`<div ${t?.id?`id="${t.id}" `:""}${t?.classList?`class="${t.classList?.join(" ")}" `:""} js-c="${o}" js-i="${n}">${e}</div>`}catch(t){i("component.render.wrapHTML",t)}};var dr=(r={},e=[])=>{try{let t=[...e],o=Object.entries(r);for(let n=0;n<o?.length;n+=1){let[s,m]=o[n];for(let l=0;l<m?.length;l+=1){let M=m[l];Object.entries(M?.timers)?.length>0&&t.push(...Object.values(M?.timers)),Object.entries(M?.children)?.length>0&&dr(M?.children,t)}}if(t?.length>0)for(let n=0;n<t?.length;n+=1)clearTimeout(t[n])}catch(t){i("component.render.clearTimersOnChildren",t)}},lr=dr;var ur=(r={},e={})=>{try{e?.dataFromSSR&&(r.data=V(e.dataFromSSR,r.id)||{}),lr(r?.children);let t=ir(e?.existingChildren||r?.children)||{};r.children={},r.renderMethods=tr({...r,existingStateMap:t,translations:e?.translations||r.translations||{},ssrTree:e?.ssrTree,walkingTreeForSSR:e?.walkingTreeForSSR,renderingHTMLWithDataForSSR:e?.renderingHTMLWithDataForSSR,dataFromSSR:e?.dataFromSSR}),r.methods=or(r,r.options.methods);let o=r.options.render({...r||{},setState:r.setState.bind(r),...r.renderMethods||{}}),n=ar(o),s=sr(r,n);return{unwrapped:n,wrapped:s}}catch(t){i("component.render.toHTML",t)}};var Wr=(r={})=>{try{return Object.values(r).reduce((e={},t)=>(e[t.name]=t.value,e),{})}catch(e){i("component.virtualDOM.build.parseAttributeMap",e)}},pr=(r={})=>{try{return r.tagName==="WHEN"?[].flatMap.call(r?.childNodes,e=>e?.tagName==="WHEN"?pr(e):B(e)):B(r)}catch(e){i("component.virtualDOM.build.flattenWhenTags",e)}},B=(r={})=>{try{let e=r&&r.tagName&&r.tagName.toLowerCase()||"text",t={tagName:e,attributes:Wr(r.attributes),children:[].flatMap.call(r.childNodes,o=>pr(o))};return e==="text"&&(t=r.textContent),t}catch(e){i("component.virtualDOM.build",e)}},fr=B;var zr=(r="")=>{try{let e=document.createElement("div");return e.innerHTML=r,e?.childNodes[0]}catch(e){i("component.virtualDOM.build.convertHTMLToDOM",e)}},hr=(r="")=>{try{let e=zr(r);return fr(e)}catch(e){i("component.virtualDOM.build",e)}};var mr=(r="")=>{try{return document.createElement("div").setAttribute(r,"Test"),!0}catch{return!1}};var Gr=(r={})=>{try{let e=document.createElement(r.tagName),t=Object.entries(r.attributes);for(let o=0;o<t.length;o+=1){let[n,s]=t[o];mr(n)&&e.setAttribute(n,s)}for(let o=0;o<r?.children?.length;o+=1){let n=r?.children[o];if(n){let s=wr(n);e.appendChild(s)}}return e}catch(e){i("component.virtualDOM.renderTreeToDOM.renderElement",e)}},wr=(r=null)=>{try{return Q(r)?document.createTextNode(r):Gr(r)}catch(e){i("component.virtualDOM.renderTreeToDOM",e)}},yr=wr;var v=(r={},e={})=>{try{let t=ur(r,{existingChildren:e?.existingChildren}),o=hr(t.wrapped,r),n=e.includeActual&&o?yr(o):null;return{html:t,virtual:o,actual:n}}catch(t){i("component.render.getUpdatedDOM",t)}};var bt=(r={},e={})=>{try{let t=v(r,{includeActual:!0,existingChildren:e?.existingChildren});return r.dom=t,t.actual}catch(t){i("component.render.forMount",t)}};export{bt as default};
1
+ var Mr=Object.create;var H=Object.defineProperty;var gr=Object.getOwnPropertyDescriptor;var Tr=Object.getOwnPropertyNames;var Fr=Object.getPrototypeOf,Sr=Object.prototype.hasOwnProperty;var Or=r=>H(r,"__esModule",{value:!0});var br=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var Er=(r,e,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Tr(e))!Sr.call(r,o)&&o!=="default"&&H(r,o,{get:()=>e[o],enumerable:!(t=gr(e,o))||t.enumerable});return r},kr=r=>Er(Or(H(r!=null?Mr(Fr(r)):{},"default",r&&r.__esModule&&"default"in r?{get:()=>r.default,enumerable:!0}:{value:r,enumerable:!0})),r);var K=br(v=>{(function(r,e){if(typeof define=="function"&&define.amd)define(["exports"],e);else if(typeof v!="undefined")e(v);else{var t={exports:{}};e(t.exports),r.index=t.exports}})(v,function(r){"use strict";function e(c){return e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(a){return typeof a}:function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},e(c)}function t(c,a){return a&&(e(a)==="object"||typeof a=="function")?a:o(c)}function o(c){if(c===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return c}function n(c){return n=Object.setPrototypeOf?Object.getPrototypeOf:function(a){return a.__proto__||Object.getPrototypeOf(a)},n(c)}function s(c,a){if(typeof a!="function"&&a!==null)throw new TypeError("Super expression must either be null or a function");c.prototype=Object.create(a&&a.prototype,{constructor:{value:c,writable:!0,configurable:!0}}),a&&m(c,a)}function m(c,a){return m=Object.setPrototypeOf||function(p,g){return p.__proto__=g,p},m(c,a)}function l(c,a){if(!(c instanceof a))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0}),r.diff=void 0;var M=function c(a,p){l(this,c),this.type=a,this.path=p?p.toString():""},j=function(c){function a(p,g,d){var F;return l(this,a),F=t(this,n(a).call(this,"E",p)),F.lhs=g,F.rhs=d,F}return s(a,c),a}(M),D=function(c){function a(p,g,d,F){var f;return l(this,a),f=t(this,n(a).call(this,"M",p)),f.item=g,f.lhsIndex=d,f.rhsIndex=F,f}return s(a,c),a}(M),N=function(c){function a(p,g){var d;return l(this,a),d=t(this,n(a).call(this,"D",p)),d.lhs=g,d}return s(a,c),a}(M),P=function(c){function a(p,g){var d;return l(this,a),d=t(this,n(a).call(this,"A",p)),d.rhs=g,d}return s(a,c),a}(M),O=function(c,a){return c?"".concat(c,".").concat(a):a};r.diff=function(a,p){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{},d=[],F=g.matchKey,f=g.types||["E","A","D","M"],xr=function(h,u,w,b){h.forEach(function(S,y){var T=u.findIndex(function(x){return x[b]===S[b]});-1<T?(-1<f.indexOf("M")&&y!==T&&d.push(new D(w,S,y,T)),R(S,u[T],O(w,T))):-1<f.indexOf("D")&&d.push(new N(w,S))}),u.forEach(function(S,y){var T=h.findIndex(function(x){return S[b]===x[b]});-1<f.indexOf("A")&&T===-1&&d.push(new P(O(w,y),S))})},R=function(h,u,w){var b=Object.prototype.toString.call(h),S=Object.prototype.toString.call(u);if(-1<f.indexOf("E")&&b!==S)return d.push(new j(w,h,u)),!1;if(b==="[object Object]")Object.getOwnPropertyNames(h).forEach(function(x){Object.prototype.hasOwnProperty.call(u,x)?R(h[x],u[x],O(w,x)):-1<f.indexOf("D")&&d.push(new N(O(w,x),h[x]))}),Object.getOwnPropertyNames(u).forEach(function(x){-1<f.indexOf("A")&&!Object.prototype.hasOwnProperty.call(h,x)&&d.push(new P(O(w,x),u[x]))});else if(b!=="[object Array]")-1<f.indexOf("E")&&h!==u&&d.push(new j(w,h,u));else if(F)xr(h,u,w,F);else{var y=h.length-1,T=u.length-1;if(-1<f.indexOf("D"))for(;y>T;)d.push(new N(O(w,y),h[y--]));if(-1<f.indexOf("A"))for(;T>y;)d.push(new P(O(w,T),u[T--]));for(;0<=y;--y)R(h[y],u[y],O(w,y))}};return R(a,p),d}})});var i=(r="",e={})=>{throw new Error(`[joystick${r?`.${r}`:""}] ${e.message||e.reason||e}`)};var W=r=>{try{return!!Array.isArray(r)}catch(e){i("types.isArray",e)}};var z=r=>{try{return typeof r=="function"}catch(e){i("types.isFunction",e)}};var G=r=>{try{return!!(r&&typeof r=="object"&&!Array.isArray(r))}catch(e){i("types.isObject",e)}};var Q=r=>{try{return typeof r=="string"}catch(e){i("types.isString",e)}};var V=(r=[],e="")=>{try{return(W(r)&&r.find(o=>o?.componentId===e))?.data||{}}catch(t){i("findComponentDataFromSSR",t)}};var rr=kr(K());var L=()=>typeof window=="undefined";var Cr=(r="")=>{try{let[e,t]=r?.split(".");return t?window?.joystick?._internal?.queues[e][t]:window?.joystick?._internal?.queues[e]}catch(e){i("addToQueue.getQueue",e)}},C=(r="",e=null)=>{try{L()||(Cr(r)||{}).array.push({callback:e})}catch(t){i("addToQueue",t)}};var X=(r={},e="",t="id")=>{try{let o=r&&r.id;if(G(r)&&o){let n=Object.keys(r);for(let s=0;s<n.length;s+=1){let m=n[s],l=r[m];if(m===t&&l===e)return r;if(m==="children"&&Array.isArray(l))for(let M=0;M<l.length;M+=1){let j=l[M],D=X(j,e,t);if(D!==null)return D}}}return null}catch(o){i("component.findComponentInTreeByField",o)}},J=X;var Y=(r="",e={},t=null)=>{let o=J(t||window.joystick._internal.tree,r,"instanceId");o&&(o.children=[...o.children||[],e])};var E=(r="",e=[])=>{typeof window!="undefined"&&!!window.__joystick_test__&&(window.test={...window.test||{},functionCalls:{...window?.test?.functionCalls||{},[r]:[...window?.test?.functionCalls&&window?.test?.functionCalls[r]||[],{calledAt:new Date().toISOString(),args:e}]}})};var Z="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890".split(""),k=(r=16)=>{let e="",t=0;for(;t<r;)e+=Z[Math.floor(Math.random()*(Z.length-1))],t+=1;return e};var jr=(r={},e={},t=null)=>{try{let o=A(r,{includeActual:!0,existingChildren:t});return r.dom=o,r.setDOMNodeOnInstance(),e.renderedComponent=r,o.html.wrapped}catch(o){i("component.renderMethods.component.renderForClient",o)}},Dr=(r={})=>{try{return r.renderToHTML({ssrTree:r.parent.ssrTree,translations:r.parent.translations,walkingTreeForSSR:r?.parent?.walkingTreeForSSR,dataFromSSR:r.parent?.dataFromSSR}).wrapped}catch(e){i("component.renderMethods.component.renderToHTMLForSSR",e)}},Rr=(r={})=>{try{return r.parent.ssrTree.dataFunctions.push(async()=>{try{let e=await r.options.data(r.parent.options.api,r.parent.options.req);return r.data=e||{},{componentId:r.id,ssrId:r.ssrId,data:e}}catch(e){return{componentId:r.id,ssrId:r.ssrId,data:null,error:e}}}),r.renderToHTML({ssrTree:r?.parent?.ssrTree,translations:r?.parent?.translations,walkingTreeForSSR:r?.parent?.walkingTreeForSSR,dataFromSSR:r?.parent?.dataFromSSR})}catch(e){i("component.renderMethods.component.collectDataFunctionsForSSR",e)}},vr=(r={})=>{try{let e={id:r.id,instanceId:r.instanceId,instance:r,children:[]};Y(r.parent.instanceId,e,r.parent&&r.parent.ssrTree||null)}catch(e){i("component.renderMethods.component.handleAddComponentToParent",e)}},Lr=(r={},e={})=>{try{!r.renderedComponent&&e.options&&e.options.lifecycle&&(e.options.lifecycle.onBeforeMount&&C("lifecycle.onBeforeMount",()=>{e.options.lifecycle.onBeforeMount(e),E(`ui.${e?.options?.test?.name||k()}.lifecycle.onBeforeMount`,[e])}),!r.renderedComponent&&e.options.lifecycle.onMount&&C("lifecycle.onMount",()=>{e.options.lifecycle.onMount(e),E(`ui.${e?.options?.test?.name||k()}.lifecycle.onMount`,[e])}))}catch(t){i("component.renderMethods.component.handleLifecycle",t)}},Ar=(r={},e={},t={})=>{try{!e.walkingTreeForSSR&&r?.options?.lifecycle?.onUpdateProps&&(0,rr.diff)(e?.existingPropsMap,t)?.length>0&&C("lifecycle.onUpdateProps",()=>{let n=e?.existingPropsMap&&e?.existingPropsMap[r.id];r.options.lifecycle.onUpdateProps(n||{},t,r),E(`ui.${r?.options?.test?.name||k()}.lifecycle.onBeforeMount`,[n||{},t,r])})}catch(o){i("component.renderMethods.component.handleOnChangeProps",o)}},Nr=function(){return function(e=null,t={},o={}){let n=e({props:t,url:o.url,translations:o.translations,api:o.options.api,req:o.options.req,dataFromSSR:o?.dataFromSSR,parent:o}),s=o?.existingStateMap[n.id]||{},m=o.children[n.id]||[],l=s[m?.length];return n.state=l?.state||n.state,n.values=l?.values||n.values,o.children[n.id]=[...o.children[n.id]||[],n],n.parent=o,Ar(n,o,t),C("lifecycle.onMount",()=>{n.setDOMNodeOnInstance()}),Lr(this,n),n.parent&&vr(n),n.options.data&&n.parent.walkingTreeForSSR&&n.parent.ssrTree.dataFunctions?Rr(n):n.parent&&n.parent.ssrTree?Dr(n):jr(n,this,l?.children)}},Pr=function(e,t){try{let o=this;return new Nr().bind({})(e,t,o)}catch(o){i("component.renderMethods.component",o)}},_=Pr;var Hr=function(e=[],t=null){try{return z(t)&&e&&Array.isArray(e)?e.map((o,n)=>t(o,n)).join(""):""}catch(o){i("component.renderMethods.each",o)}},I=Hr;var _r=(r="",e=[])=>{try{return e.reduce((t,[o,n])=>t.replace(`{{${o}}}`,n),r)}catch(t){i("component.renderMethods.i18n.replacePlaceholdersInString",t)}},$=(r="",e=[])=>{try{let t=typeof r=="string",o=Array.isArray(r),n=typeof r=="object"&&!o;if(t)return _r(r,e);if(o)return r?.map(s=>$(s,e));if(n)return Object.entries(r)?.reduce((s={},[m,l])=>(s[m]=$(l,e),s),{})}catch(t){i("component.renderMethods.i18n.handleTranslationReplacement",t)}},Ir=(r="",e={})=>{try{return r?.split(".").reduce((t,o)=>t[o],e)}catch(t){i("component.renderMethods.i18n.getTranslationAtPath",t)}},$r=function(r="",e={}){try{let t=L()?this.translations:window.__joystick_i18n__,n=r?.includes(".")?Ir(r,t):t[r];if(!t||!n)return"";let s=Object.entries(e);return $(n,s)}catch(t){i("component.renderMethods.i18n",t)}},U=$r;var Ur=function(e=!1,t=""){try{return this?.renderingHTMLWithDataForSSR||e?`<when>${t.trim()}</when>`:"<when> </when>"}catch(o){i("component.renderMethods.when",o)}},q=Ur;var er={c:_,component:_,e:I,each:I,i:U,i18n:U,w:q,when:q};var tr=(r={},e={})=>{try{return Object.entries(er).reduce((t,[o,n])=>(t[o]=n.bind({...r,...e}),t),{})}catch(t){i("component.renderMethods.compile",t)}};var or=(r={},e={})=>{try{return Object.entries(e).reduce((t={},[o,n])=>(t[o]=(...s)=>(E(`ui.${r?.options?.test?.name||k()}.methods.${o}`,[...s,{...r,setState:r.setState.bind(r),...r.renderMethods||{}}]),n(...s,{...r,setState:r.setState.bind(r),...r.renderMethods||{}})),t),{})}catch{i("component.methods.compile")}};var nr=(r={})=>{try{return Object.entries(r)?.reduce((e={},[t,o]={})=>(e[t]=o?.map((n={})=>({state:n?.state,values:n?.values,children:nr(n?.children)})),e),{})}catch(e){i("component.render.getExistingStateMap.buildMapForChildren",e)}},ir=(r={})=>{try{return nr(r)}catch(e){i("component.render.getExistingStateMap",e)}};var ar=new RegExp(/\<\!\-\-(?:.|\n|\r)*?-->/g),qr=new RegExp(/\n/g);var Br=(r="")=>{try{return(r.match(ar)||[]).forEach(t=>{r=r.replace(t,"")}),r}catch(e){i("component.render.sanitizeHTML.removeCommentedCode",e)}},cr=(r="")=>{try{let e=`${r}`;return e=Br(e),e}catch(e){i("component.render.sanitizeHTML",e)}};var sr=(r={},e="")=>{try{let{wrapper:t=null,id:o=null,instanceId:n=null}=r;return`<div ${t?.id?`id="${t.id}" `:""}${t?.classList?`class="${t.classList?.join(" ")}" `:""} js-c="${o}" js-i="${n}">${e}</div>`}catch(t){i("component.render.wrapHTML",t)}};var dr=(r={},e=[])=>{try{let t=[...e],o=Object.entries(r);for(let n=0;n<o?.length;n+=1){let[s,m]=o[n];for(let l=0;l<m?.length;l+=1){let M=m[l];Object.entries(M?.timers)?.length>0&&t.push(...Object.values(M?.timers)),Object.entries(M?.children)?.length>0&&dr(M?.children,t)}}if(t?.length>0)for(let n=0;n<t?.length;n+=1)clearTimeout(t[n])}catch(t){i("component.render.clearTimersOnChildren",t)}},lr=dr;var ur=(r={},e={})=>{try{e?.dataFromSSR&&(r.data=V(e.dataFromSSR,r.id)||{}),lr(r?.children);let t=ir(e?.existingChildren||r?.children)||{};r.children={},r.renderMethods=tr({...r,existingStateMap:t,translations:e?.translations||r.translations||{},ssrTree:e?.ssrTree,walkingTreeForSSR:e?.walkingTreeForSSR,renderingHTMLWithDataForSSR:e?.renderingHTMLWithDataForSSR,dataFromSSR:e?.dataFromSSR}),r.methods=or(r,r.options.methods);let o=r.options.render({...r||{},setState:r.setState.bind(r),...r.renderMethods||{}}),n=cr(o),s=sr(r,n);return{unwrapped:n,wrapped:s}}catch(t){i("component.render.toHTML",t)}};var Wr=(r={})=>{try{return Object.values(r).reduce((e={},t)=>(e[t.name]=t.value,e),{})}catch(e){i("component.virtualDOM.build.parseAttributeMap",e)}},pr=(r={})=>{try{return r.tagName==="WHEN"?[].flatMap.call(r?.childNodes,e=>e?.tagName==="WHEN"?pr(e):B(e)):B(r)}catch(e){i("component.virtualDOM.build.flattenWhenTags",e)}},B=(r={})=>{try{let e=r&&r.tagName&&r.tagName.toLowerCase()||"text",t={tagName:e,attributes:Wr(r.attributes),children:[].flatMap.call(r.childNodes,o=>pr(o))};return e==="text"&&(t=r.textContent),t}catch(e){i("component.virtualDOM.build",e)}},fr=B;var zr=(r="")=>{try{let e=document.createElement("div");return e.innerHTML=r,e?.childNodes[0]}catch(e){i("component.virtualDOM.build.convertHTMLToDOM",e)}},hr=(r="")=>{try{let e=zr(r);return fr(e)}catch(e){i("component.virtualDOM.build",e)}};var mr=(r="")=>{try{return document.createElement("div").setAttribute(r,"Test"),!0}catch{return!1}};var Gr=(r={})=>{try{let e=document.createElement(r.tagName),t=Object.entries(r.attributes);for(let o=0;o<t.length;o+=1){let[n,s]=t[o];mr(n)&&e.setAttribute(n,s)}for(let o=0;o<r?.children?.length;o+=1){let n=r?.children[o];if(n){let s=wr(n);e.appendChild(s)}}return e}catch(e){i("component.virtualDOM.renderTreeToDOM.renderElement",e)}},wr=(r=null)=>{try{return Q(r)?document.createTextNode(r):Gr(r)}catch(e){i("component.virtualDOM.renderTreeToDOM",e)}},yr=wr;var A=(r={},e={})=>{try{let t=ur(r,{existingChildren:e?.existingChildren}),o=hr(t.wrapped,r),n=e.includeActual&&o?yr(o):null;return{html:t,virtual:o,actual:n}}catch(t){i("component.render.getUpdatedDOM",t)}};var bt=(r={},e={})=>{try{let t=A(r,{includeActual:!0,existingChildren:e?.existingChildren});return r.dom=t,t.actual}catch(t){i("component.render.forMount",t)}};export{bt as default};
@@ -1 +1 @@
1
- var t=(e="",r={})=>{throw new Error(`[joystick${e?`.${e}`:""}] ${r.message||r.reason||r}`)};var n=(e={})=>{try{return Object.entries(e)?.reduce((r={},[a,i]={})=>(r[a]=i?.map((o={})=>({state:o?.state,children:n(o?.children)})),r),{})}catch(r){t("component.render.getExistingStateMap.buildMapForChildren",r)}},u=(e={})=>{try{return n(e)}catch(r){t("component.render.getExistingStateMap",r)}};export{u as default};
1
+ var o=(e="",r={})=>{throw new Error(`[joystick${e?`.${e}`:""}] ${r.message||r.reason||r}`)};var n=(e={})=>{try{return Object.entries(e)?.reduce((r={},[a,i]={})=>(r[a]=i?.map((t={})=>({state:t?.state,values:t?.values,children:n(t?.children)})),r),{})}catch(r){o("component.render.getExistingStateMap.buildMapForChildren",r)}},l=(e={})=>{try{return n(e)}catch(r){o("component.render.getExistingStateMap",r)}};export{l as default};
@@ -1 +1 @@
1
- var Mr=Object.create;var P=Object.defineProperty;var gr=Object.getOwnPropertyDescriptor;var Tr=Object.getOwnPropertyNames;var Fr=Object.getPrototypeOf,Sr=Object.prototype.hasOwnProperty;var br=r=>P(r,"__esModule",{value:!0});var Or=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var Er=(r,e,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Tr(e))!Sr.call(r,n)&&n!=="default"&&P(r,n,{get:()=>e[n],enumerable:!(t=gr(e,n))||t.enumerable});return r},kr=r=>Er(br(P(r!=null?Mr(Fr(r)):{},"default",r&&r.__esModule&&"default"in r?{get:()=>r.default,enumerable:!0}:{value:r,enumerable:!0})),r);var V=Or(L=>{(function(r,e){if(typeof define=="function"&&define.amd)define(["exports"],e);else if(typeof L!="undefined")e(L);else{var t={exports:{}};e(t.exports),r.index=t.exports}})(L,function(r){"use strict";function e(a){return e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(c){return typeof c}:function(c){return c&&typeof Symbol=="function"&&c.constructor===Symbol&&c!==Symbol.prototype?"symbol":typeof c},e(a)}function t(a,c){return c&&(e(c)==="object"||typeof c=="function")?c:n(a)}function n(a){if(a===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function o(a){return o=Object.setPrototypeOf?Object.getPrototypeOf:function(c){return c.__proto__||Object.getPrototypeOf(c)},o(a)}function s(a,c){if(typeof c!="function"&&c!==null)throw new TypeError("Super expression must either be null or a function");a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),c&&m(a,c)}function m(a,c){return m=Object.setPrototypeOf||function(p,g){return p.__proto__=g,p},m(a,c)}function l(a,c){if(!(a instanceof c))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0}),r.diff=void 0;var M=function a(c,p){l(this,a),this.type=c,this.path=p?p.toString():""},j=function(a){function c(p,g,d){var F;return l(this,c),F=t(this,o(c).call(this,"E",p)),F.lhs=g,F.rhs=d,F}return s(c,a),c}(M),R=function(a){function c(p,g,d,F){var f;return l(this,c),f=t(this,o(c).call(this,"M",p)),f.item=g,f.lhsIndex=d,f.rhsIndex=F,f}return s(c,a),c}(M),v=function(a){function c(p,g){var d;return l(this,c),d=t(this,o(c).call(this,"D",p)),d.lhs=g,d}return s(c,a),c}(M),N=function(a){function c(p,g){var d;return l(this,c),d=t(this,o(c).call(this,"A",p)),d.rhs=g,d}return s(c,a),c}(M),b=function(a,c){return a?"".concat(a,".").concat(c):c};r.diff=function(c,p){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{},d=[],F=g.matchKey,f=g.types||["E","A","D","M"],xr=function(h,u,w,O){h.forEach(function(S,y){var T=u.findIndex(function(x){return x[O]===S[O]});-1<T?(-1<f.indexOf("M")&&y!==T&&d.push(new R(w,S,y,T)),D(S,u[T],b(w,T))):-1<f.indexOf("D")&&d.push(new v(w,S))}),u.forEach(function(S,y){var T=h.findIndex(function(x){return S[O]===x[O]});-1<f.indexOf("A")&&T===-1&&d.push(new N(b(w,y),S))})},D=function(h,u,w){var O=Object.prototype.toString.call(h),S=Object.prototype.toString.call(u);if(-1<f.indexOf("E")&&O!==S)return d.push(new j(w,h,u)),!1;if(O==="[object Object]")Object.getOwnPropertyNames(h).forEach(function(x){Object.prototype.hasOwnProperty.call(u,x)?D(h[x],u[x],b(w,x)):-1<f.indexOf("D")&&d.push(new v(b(w,x),h[x]))}),Object.getOwnPropertyNames(u).forEach(function(x){-1<f.indexOf("A")&&!Object.prototype.hasOwnProperty.call(h,x)&&d.push(new N(b(w,x),u[x]))});else if(O!=="[object Array]")-1<f.indexOf("E")&&h!==u&&d.push(new j(w,h,u));else if(F)xr(h,u,w,F);else{var y=h.length-1,T=u.length-1;if(-1<f.indexOf("D"))for(;y>T;)d.push(new v(b(w,y),h[y--]));if(-1<f.indexOf("A"))for(;T>y;)d.push(new N(b(w,T),u[T--]));for(;0<=y;--y)D(h[y],u[y],b(w,y))}};return D(c,p),d}})});var i=(r="",e={})=>{throw new Error(`[joystick${r?`.${r}`:""}] ${e.message||e.reason||e}`)};var B=r=>{try{return!!Array.isArray(r)}catch(e){i("types.isArray",e)}};var W=r=>{try{return typeof r=="function"}catch(e){i("types.isFunction",e)}};var z=r=>{try{return!!(r&&typeof r=="object"&&!Array.isArray(r))}catch(e){i("types.isObject",e)}};var G=r=>{try{return typeof r=="string"}catch(e){i("types.isString",e)}};var Q=(r=[],e="")=>{try{return(B(r)&&r.find(n=>n?.componentId===e))?.data||{}}catch(t){i("findComponentDataFromSSR",t)}};var Z=kr(V());var A=()=>typeof window=="undefined";var Cr=(r="")=>{try{let[e,t]=r?.split(".");return t?window?.joystick?._internal?.queues[e][t]:window?.joystick?._internal?.queues[e]}catch(e){i("addToQueue.getQueue",e)}},C=(r="",e=null)=>{try{A()||(Cr(r)||{}).array.push({callback:e})}catch(t){i("addToQueue",t)}};var K=(r={},e="",t="id")=>{try{let n=r&&r.id;if(z(r)&&n){let o=Object.keys(r);for(let s=0;s<o.length;s+=1){let m=o[s],l=r[m];if(m===t&&l===e)return r;if(m==="children"&&Array.isArray(l))for(let M=0;M<l.length;M+=1){let j=l[M],R=K(j,e,t);if(R!==null)return R}}}return null}catch(n){i("component.findComponentInTreeByField",n)}},X=K;var J=(r="",e={},t=null)=>{let n=X(t||window.joystick._internal.tree,r,"instanceId");n&&(n.children=[...n.children||[],e])};var E=(r="",e=[])=>{typeof window!="undefined"&&!!window.__joystick_test__&&(window.test={...window.test||{},functionCalls:{...window?.test?.functionCalls||{},[r]:[...window?.test?.functionCalls&&window?.test?.functionCalls[r]||[],{calledAt:new Date().toISOString(),args:e}]}})};var Y="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890".split(""),k=(r=16)=>{let e="",t=0;for(;t<r;)e+=Y[Math.floor(Math.random()*(Y.length-1))],t+=1;return e};var jr=(r={},e={},t=null)=>{try{let n=rr(r,{includeActual:!0,existingChildren:t});return r.dom=n,r.setDOMNodeOnInstance(),e.renderedComponent=r,n.html.wrapped}catch(n){i("component.renderMethods.component.renderForClient",n)}},Rr=(r={})=>{try{return r.renderToHTML({ssrTree:r.parent.ssrTree,translations:r.parent.translations,walkingTreeForSSR:r?.parent?.walkingTreeForSSR,dataFromSSR:r.parent?.dataFromSSR}).wrapped}catch(e){i("component.renderMethods.component.renderToHTMLForSSR",e)}},Dr=(r={})=>{try{return r.parent.ssrTree.dataFunctions.push(async()=>{try{let e=await r.options.data(r.parent.options.api,r.parent.options.req);return r.data=e||{},{componentId:r.id,ssrId:r.ssrId,data:e}}catch(e){return{componentId:r.id,ssrId:r.ssrId,data:null,error:e}}}),r.renderToHTML({ssrTree:r?.parent?.ssrTree,translations:r?.parent?.translations,walkingTreeForSSR:r?.parent?.walkingTreeForSSR,dataFromSSR:r?.parent?.dataFromSSR})}catch(e){i("component.renderMethods.component.collectDataFunctionsForSSR",e)}},Lr=(r={})=>{try{let e={id:r.id,instanceId:r.instanceId,instance:r,children:[]};J(r.parent.instanceId,e,r.parent&&r.parent.ssrTree||null)}catch(e){i("component.renderMethods.component.handleAddComponentToParent",e)}},Ar=(r={},e={})=>{try{!r.renderedComponent&&e.options&&e.options.lifecycle&&(e.options.lifecycle.onBeforeMount&&C("lifecycle.onBeforeMount",()=>{e.options.lifecycle.onBeforeMount(e),E(`ui.${e?.options?.test?.name||k()}.lifecycle.onBeforeMount`,[e])}),!r.renderedComponent&&e.options.lifecycle.onMount&&C("lifecycle.onMount",()=>{e.options.lifecycle.onMount(e),E(`ui.${e?.options?.test?.name||k()}.lifecycle.onMount`,[e])}))}catch(t){i("component.renderMethods.component.handleLifecycle",t)}},vr=(r={},e={},t={})=>{try{!e.walkingTreeForSSR&&r?.options?.lifecycle?.onUpdateProps&&(0,Z.diff)(e?.existingPropsMap,t)?.length>0&&C("lifecycle.onUpdateProps",()=>{let o=e?.existingPropsMap&&e?.existingPropsMap[r.id];r.options.lifecycle.onUpdateProps(o||{},t,r),E(`ui.${r?.options?.test?.name||k()}.lifecycle.onBeforeMount`,[o||{},t,r])})}catch(n){i("component.renderMethods.component.handleOnChangeProps",n)}},Nr=function(){return function(e=null,t={},n={}){let o=e({props:t,url:n.url,translations:n.translations,api:n.options.api,req:n.options.req,dataFromSSR:n?.dataFromSSR,parent:n}),s=n?.existingStateMap[o.id]||{},m=n.children[o.id]||[],l=s[m?.length];return o.state=l?.state||o.state,n.children[o.id]=[...n.children[o.id]||[],o],o.parent=n,vr(o,n,t),C("lifecycle.onMount",()=>{o.setDOMNodeOnInstance()}),Ar(this,o),o.parent&&Lr(o),o.options.data&&o.parent.walkingTreeForSSR&&o.parent.ssrTree.dataFunctions?Dr(o):o.parent&&o.parent.ssrTree?Rr(o):jr(o,this,l?.children)}},Pr=function(e,t){try{let n=this;return new Nr().bind({})(e,t,n)}catch(n){i("component.renderMethods.component",n)}},H=Pr;var Hr=function(e=[],t=null){try{return W(t)&&e&&Array.isArray(e)?e.map((n,o)=>t(n,o)).join(""):""}catch(n){i("component.renderMethods.each",n)}},_=Hr;var _r=(r="",e=[])=>{try{return e.reduce((t,[n,o])=>t.replace(`{{${n}}}`,o),r)}catch(t){i("component.renderMethods.i18n.replacePlaceholdersInString",t)}},I=(r="",e=[])=>{try{let t=typeof r=="string",n=Array.isArray(r),o=typeof r=="object"&&!n;if(t)return _r(r,e);if(n)return r?.map(s=>I(s,e));if(o)return Object.entries(r)?.reduce((s={},[m,l])=>(s[m]=I(l,e),s),{})}catch(t){i("component.renderMethods.i18n.handleTranslationReplacement",t)}},Ir=(r="",e={})=>{try{return r?.split(".").reduce((t,n)=>t[n],e)}catch(t){i("component.renderMethods.i18n.getTranslationAtPath",t)}},$r=function(r="",e={}){try{let t=A()?this.translations:window.__joystick_i18n__,o=r?.includes(".")?Ir(r,t):t[r];if(!t||!o)return"";let s=Object.entries(e);return I(o,s)}catch(t){i("component.renderMethods.i18n",t)}},$=$r;var Ur=function(e=!1,t=""){try{return this?.renderingHTMLWithDataForSSR||e?`<when>${t.trim()}</when>`:"<when> </when>"}catch(n){i("component.renderMethods.when",n)}},U=Ur;var er={c:H,component:H,e:_,each:_,i:$,i18n:$,w:U,when:U};var tr=(r={},e={})=>{try{return Object.entries(er).reduce((t,[n,o])=>(t[n]=o.bind({...r,...e}),t),{})}catch(t){i("component.renderMethods.compile",t)}};var nr=(r={},e={})=>{try{return Object.entries(e).reduce((t={},[n,o])=>(t[n]=(...s)=>(E(`ui.${r?.options?.test?.name||k()}.methods.${n}`,[...s,{...r,setState:r.setState.bind(r),...r.renderMethods||{}}]),o(...s,{...r,setState:r.setState.bind(r),...r.renderMethods||{}})),t),{})}catch{i("component.methods.compile")}};var or=(r={})=>{try{return Object.entries(r)?.reduce((e={},[t,n]={})=>(e[t]=n?.map((o={})=>({state:o?.state,children:or(o?.children)})),e),{})}catch(e){i("component.render.getExistingStateMap.buildMapForChildren",e)}},ir=(r={})=>{try{return or(r)}catch(e){i("component.render.getExistingStateMap",e)}};var cr=new RegExp(/\<\!\-\-(?:.|\n|\r)*?-->/g),qr=new RegExp(/\n/g);var Br=(r="")=>{try{return(r.match(cr)||[]).forEach(t=>{r=r.replace(t,"")}),r}catch(e){i("component.render.sanitizeHTML.removeCommentedCode",e)}},ar=(r="")=>{try{let e=`${r}`;return e=Br(e),e}catch(e){i("component.render.sanitizeHTML",e)}};var sr=(r={},e="")=>{try{let{wrapper:t=null,id:n=null,instanceId:o=null}=r;return`<div ${t?.id?`id="${t.id}" `:""}${t?.classList?`class="${t.classList?.join(" ")}" `:""} js-c="${n}" js-i="${o}">${e}</div>`}catch(t){i("component.render.wrapHTML",t)}};var dr=(r={},e=[])=>{try{let t=[...e],n=Object.entries(r);for(let o=0;o<n?.length;o+=1){let[s,m]=n[o];for(let l=0;l<m?.length;l+=1){let M=m[l];Object.entries(M?.timers)?.length>0&&t.push(...Object.values(M?.timers)),Object.entries(M?.children)?.length>0&&dr(M?.children,t)}}if(t?.length>0)for(let o=0;o<t?.length;o+=1)clearTimeout(t[o])}catch(t){i("component.render.clearTimersOnChildren",t)}},lr=dr;var ur=(r={},e={})=>{try{e?.dataFromSSR&&(r.data=Q(e.dataFromSSR,r.id)||{}),lr(r?.children);let t=ir(e?.existingChildren||r?.children)||{};r.children={},r.renderMethods=tr({...r,existingStateMap:t,translations:e?.translations||r.translations||{},ssrTree:e?.ssrTree,walkingTreeForSSR:e?.walkingTreeForSSR,renderingHTMLWithDataForSSR:e?.renderingHTMLWithDataForSSR,dataFromSSR:e?.dataFromSSR}),r.methods=nr(r,r.options.methods);let n=r.options.render({...r||{},setState:r.setState.bind(r),...r.renderMethods||{}}),o=ar(n),s=sr(r,o);return{unwrapped:o,wrapped:s}}catch(t){i("component.render.toHTML",t)}};var Wr=(r={})=>{try{return Object.values(r).reduce((e={},t)=>(e[t.name]=t.value,e),{})}catch(e){i("component.virtualDOM.build.parseAttributeMap",e)}},pr=(r={})=>{try{return r.tagName==="WHEN"?[].flatMap.call(r?.childNodes,e=>e?.tagName==="WHEN"?pr(e):q(e)):q(r)}catch(e){i("component.virtualDOM.build.flattenWhenTags",e)}},q=(r={})=>{try{let e=r&&r.tagName&&r.tagName.toLowerCase()||"text",t={tagName:e,attributes:Wr(r.attributes),children:[].flatMap.call(r.childNodes,n=>pr(n))};return e==="text"&&(t=r.textContent),t}catch(e){i("component.virtualDOM.build",e)}},fr=q;var zr=(r="")=>{try{let e=document.createElement("div");return e.innerHTML=r,e?.childNodes[0]}catch(e){i("component.virtualDOM.build.convertHTMLToDOM",e)}},hr=(r="")=>{try{let e=zr(r);return fr(e)}catch(e){i("component.virtualDOM.build",e)}};var mr=(r="")=>{try{return document.createElement("div").setAttribute(r,"Test"),!0}catch{return!1}};var Gr=(r={})=>{try{let e=document.createElement(r.tagName),t=Object.entries(r.attributes);for(let n=0;n<t.length;n+=1){let[o,s]=t[n];mr(o)&&e.setAttribute(o,s)}for(let n=0;n<r?.children?.length;n+=1){let o=r?.children[n];if(o){let s=wr(o);e.appendChild(s)}}return e}catch(e){i("component.virtualDOM.renderTreeToDOM.renderElement",e)}},wr=(r=null)=>{try{return G(r)?document.createTextNode(r):Gr(r)}catch(e){i("component.virtualDOM.renderTreeToDOM",e)}},yr=wr;var rr=(r={},e={})=>{try{let t=ur(r,{existingChildren:e?.existingChildren}),n=hr(t.wrapped,r),o=e.includeActual&&n?yr(n):null;return{html:t,virtual:n,actual:o}}catch(t){i("component.render.getUpdatedDOM",t)}};export{rr as default};
1
+ var Mr=Object.create;var P=Object.defineProperty;var gr=Object.getOwnPropertyDescriptor;var Tr=Object.getOwnPropertyNames;var Fr=Object.getPrototypeOf,Sr=Object.prototype.hasOwnProperty;var br=r=>P(r,"__esModule",{value:!0});var Or=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var Er=(r,e,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Tr(e))!Sr.call(r,n)&&n!=="default"&&P(r,n,{get:()=>e[n],enumerable:!(t=gr(e,n))||t.enumerable});return r},kr=r=>Er(br(P(r!=null?Mr(Fr(r)):{},"default",r&&r.__esModule&&"default"in r?{get:()=>r.default,enumerable:!0}:{value:r,enumerable:!0})),r);var V=Or(v=>{(function(r,e){if(typeof define=="function"&&define.amd)define(["exports"],e);else if(typeof v!="undefined")e(v);else{var t={exports:{}};e(t.exports),r.index=t.exports}})(v,function(r){"use strict";function e(c){return e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(a){return typeof a}:function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},e(c)}function t(c,a){return a&&(e(a)==="object"||typeof a=="function")?a:n(c)}function n(c){if(c===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return c}function o(c){return o=Object.setPrototypeOf?Object.getPrototypeOf:function(a){return a.__proto__||Object.getPrototypeOf(a)},o(c)}function s(c,a){if(typeof a!="function"&&a!==null)throw new TypeError("Super expression must either be null or a function");c.prototype=Object.create(a&&a.prototype,{constructor:{value:c,writable:!0,configurable:!0}}),a&&m(c,a)}function m(c,a){return m=Object.setPrototypeOf||function(p,g){return p.__proto__=g,p},m(c,a)}function l(c,a){if(!(c instanceof a))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0}),r.diff=void 0;var M=function c(a,p){l(this,c),this.type=a,this.path=p?p.toString():""},j=function(c){function a(p,g,d){var F;return l(this,a),F=t(this,o(a).call(this,"E",p)),F.lhs=g,F.rhs=d,F}return s(a,c),a}(M),R=function(c){function a(p,g,d,F){var f;return l(this,a),f=t(this,o(a).call(this,"M",p)),f.item=g,f.lhsIndex=d,f.rhsIndex=F,f}return s(a,c),a}(M),A=function(c){function a(p,g){var d;return l(this,a),d=t(this,o(a).call(this,"D",p)),d.lhs=g,d}return s(a,c),a}(M),N=function(c){function a(p,g){var d;return l(this,a),d=t(this,o(a).call(this,"A",p)),d.rhs=g,d}return s(a,c),a}(M),b=function(c,a){return c?"".concat(c,".").concat(a):a};r.diff=function(a,p){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{},d=[],F=g.matchKey,f=g.types||["E","A","D","M"],xr=function(h,u,w,O){h.forEach(function(S,y){var T=u.findIndex(function(x){return x[O]===S[O]});-1<T?(-1<f.indexOf("M")&&y!==T&&d.push(new R(w,S,y,T)),D(S,u[T],b(w,T))):-1<f.indexOf("D")&&d.push(new A(w,S))}),u.forEach(function(S,y){var T=h.findIndex(function(x){return S[O]===x[O]});-1<f.indexOf("A")&&T===-1&&d.push(new N(b(w,y),S))})},D=function(h,u,w){var O=Object.prototype.toString.call(h),S=Object.prototype.toString.call(u);if(-1<f.indexOf("E")&&O!==S)return d.push(new j(w,h,u)),!1;if(O==="[object Object]")Object.getOwnPropertyNames(h).forEach(function(x){Object.prototype.hasOwnProperty.call(u,x)?D(h[x],u[x],b(w,x)):-1<f.indexOf("D")&&d.push(new A(b(w,x),h[x]))}),Object.getOwnPropertyNames(u).forEach(function(x){-1<f.indexOf("A")&&!Object.prototype.hasOwnProperty.call(h,x)&&d.push(new N(b(w,x),u[x]))});else if(O!=="[object Array]")-1<f.indexOf("E")&&h!==u&&d.push(new j(w,h,u));else if(F)xr(h,u,w,F);else{var y=h.length-1,T=u.length-1;if(-1<f.indexOf("D"))for(;y>T;)d.push(new A(b(w,y),h[y--]));if(-1<f.indexOf("A"))for(;T>y;)d.push(new N(b(w,T),u[T--]));for(;0<=y;--y)D(h[y],u[y],b(w,y))}};return D(a,p),d}})});var i=(r="",e={})=>{throw new Error(`[joystick${r?`.${r}`:""}] ${e.message||e.reason||e}`)};var B=r=>{try{return!!Array.isArray(r)}catch(e){i("types.isArray",e)}};var W=r=>{try{return typeof r=="function"}catch(e){i("types.isFunction",e)}};var z=r=>{try{return!!(r&&typeof r=="object"&&!Array.isArray(r))}catch(e){i("types.isObject",e)}};var G=r=>{try{return typeof r=="string"}catch(e){i("types.isString",e)}};var Q=(r=[],e="")=>{try{return(B(r)&&r.find(n=>n?.componentId===e))?.data||{}}catch(t){i("findComponentDataFromSSR",t)}};var Z=kr(V());var L=()=>typeof window=="undefined";var Cr=(r="")=>{try{let[e,t]=r?.split(".");return t?window?.joystick?._internal?.queues[e][t]:window?.joystick?._internal?.queues[e]}catch(e){i("addToQueue.getQueue",e)}},C=(r="",e=null)=>{try{L()||(Cr(r)||{}).array.push({callback:e})}catch(t){i("addToQueue",t)}};var K=(r={},e="",t="id")=>{try{let n=r&&r.id;if(z(r)&&n){let o=Object.keys(r);for(let s=0;s<o.length;s+=1){let m=o[s],l=r[m];if(m===t&&l===e)return r;if(m==="children"&&Array.isArray(l))for(let M=0;M<l.length;M+=1){let j=l[M],R=K(j,e,t);if(R!==null)return R}}}return null}catch(n){i("component.findComponentInTreeByField",n)}},X=K;var J=(r="",e={},t=null)=>{let n=X(t||window.joystick._internal.tree,r,"instanceId");n&&(n.children=[...n.children||[],e])};var E=(r="",e=[])=>{typeof window!="undefined"&&!!window.__joystick_test__&&(window.test={...window.test||{},functionCalls:{...window?.test?.functionCalls||{},[r]:[...window?.test?.functionCalls&&window?.test?.functionCalls[r]||[],{calledAt:new Date().toISOString(),args:e}]}})};var Y="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890".split(""),k=(r=16)=>{let e="",t=0;for(;t<r;)e+=Y[Math.floor(Math.random()*(Y.length-1))],t+=1;return e};var jr=(r={},e={},t=null)=>{try{let n=rr(r,{includeActual:!0,existingChildren:t});return r.dom=n,r.setDOMNodeOnInstance(),e.renderedComponent=r,n.html.wrapped}catch(n){i("component.renderMethods.component.renderForClient",n)}},Rr=(r={})=>{try{return r.renderToHTML({ssrTree:r.parent.ssrTree,translations:r.parent.translations,walkingTreeForSSR:r?.parent?.walkingTreeForSSR,dataFromSSR:r.parent?.dataFromSSR}).wrapped}catch(e){i("component.renderMethods.component.renderToHTMLForSSR",e)}},Dr=(r={})=>{try{return r.parent.ssrTree.dataFunctions.push(async()=>{try{let e=await r.options.data(r.parent.options.api,r.parent.options.req);return r.data=e||{},{componentId:r.id,ssrId:r.ssrId,data:e}}catch(e){return{componentId:r.id,ssrId:r.ssrId,data:null,error:e}}}),r.renderToHTML({ssrTree:r?.parent?.ssrTree,translations:r?.parent?.translations,walkingTreeForSSR:r?.parent?.walkingTreeForSSR,dataFromSSR:r?.parent?.dataFromSSR})}catch(e){i("component.renderMethods.component.collectDataFunctionsForSSR",e)}},vr=(r={})=>{try{let e={id:r.id,instanceId:r.instanceId,instance:r,children:[]};J(r.parent.instanceId,e,r.parent&&r.parent.ssrTree||null)}catch(e){i("component.renderMethods.component.handleAddComponentToParent",e)}},Lr=(r={},e={})=>{try{!r.renderedComponent&&e.options&&e.options.lifecycle&&(e.options.lifecycle.onBeforeMount&&C("lifecycle.onBeforeMount",()=>{e.options.lifecycle.onBeforeMount(e),E(`ui.${e?.options?.test?.name||k()}.lifecycle.onBeforeMount`,[e])}),!r.renderedComponent&&e.options.lifecycle.onMount&&C("lifecycle.onMount",()=>{e.options.lifecycle.onMount(e),E(`ui.${e?.options?.test?.name||k()}.lifecycle.onMount`,[e])}))}catch(t){i("component.renderMethods.component.handleLifecycle",t)}},Ar=(r={},e={},t={})=>{try{!e.walkingTreeForSSR&&r?.options?.lifecycle?.onUpdateProps&&(0,Z.diff)(e?.existingPropsMap,t)?.length>0&&C("lifecycle.onUpdateProps",()=>{let o=e?.existingPropsMap&&e?.existingPropsMap[r.id];r.options.lifecycle.onUpdateProps(o||{},t,r),E(`ui.${r?.options?.test?.name||k()}.lifecycle.onBeforeMount`,[o||{},t,r])})}catch(n){i("component.renderMethods.component.handleOnChangeProps",n)}},Nr=function(){return function(e=null,t={},n={}){let o=e({props:t,url:n.url,translations:n.translations,api:n.options.api,req:n.options.req,dataFromSSR:n?.dataFromSSR,parent:n}),s=n?.existingStateMap[o.id]||{},m=n.children[o.id]||[],l=s[m?.length];return o.state=l?.state||o.state,o.values=l?.values||o.values,n.children[o.id]=[...n.children[o.id]||[],o],o.parent=n,Ar(o,n,t),C("lifecycle.onMount",()=>{o.setDOMNodeOnInstance()}),Lr(this,o),o.parent&&vr(o),o.options.data&&o.parent.walkingTreeForSSR&&o.parent.ssrTree.dataFunctions?Dr(o):o.parent&&o.parent.ssrTree?Rr(o):jr(o,this,l?.children)}},Pr=function(e,t){try{let n=this;return new Nr().bind({})(e,t,n)}catch(n){i("component.renderMethods.component",n)}},H=Pr;var Hr=function(e=[],t=null){try{return W(t)&&e&&Array.isArray(e)?e.map((n,o)=>t(n,o)).join(""):""}catch(n){i("component.renderMethods.each",n)}},_=Hr;var _r=(r="",e=[])=>{try{return e.reduce((t,[n,o])=>t.replace(`{{${n}}}`,o),r)}catch(t){i("component.renderMethods.i18n.replacePlaceholdersInString",t)}},I=(r="",e=[])=>{try{let t=typeof r=="string",n=Array.isArray(r),o=typeof r=="object"&&!n;if(t)return _r(r,e);if(n)return r?.map(s=>I(s,e));if(o)return Object.entries(r)?.reduce((s={},[m,l])=>(s[m]=I(l,e),s),{})}catch(t){i("component.renderMethods.i18n.handleTranslationReplacement",t)}},Ir=(r="",e={})=>{try{return r?.split(".").reduce((t,n)=>t[n],e)}catch(t){i("component.renderMethods.i18n.getTranslationAtPath",t)}},$r=function(r="",e={}){try{let t=L()?this.translations:window.__joystick_i18n__,o=r?.includes(".")?Ir(r,t):t[r];if(!t||!o)return"";let s=Object.entries(e);return I(o,s)}catch(t){i("component.renderMethods.i18n",t)}},$=$r;var Ur=function(e=!1,t=""){try{return this?.renderingHTMLWithDataForSSR||e?`<when>${t.trim()}</when>`:"<when> </when>"}catch(n){i("component.renderMethods.when",n)}},U=Ur;var er={c:H,component:H,e:_,each:_,i:$,i18n:$,w:U,when:U};var tr=(r={},e={})=>{try{return Object.entries(er).reduce((t,[n,o])=>(t[n]=o.bind({...r,...e}),t),{})}catch(t){i("component.renderMethods.compile",t)}};var nr=(r={},e={})=>{try{return Object.entries(e).reduce((t={},[n,o])=>(t[n]=(...s)=>(E(`ui.${r?.options?.test?.name||k()}.methods.${n}`,[...s,{...r,setState:r.setState.bind(r),...r.renderMethods||{}}]),o(...s,{...r,setState:r.setState.bind(r),...r.renderMethods||{}})),t),{})}catch{i("component.methods.compile")}};var or=(r={})=>{try{return Object.entries(r)?.reduce((e={},[t,n]={})=>(e[t]=n?.map((o={})=>({state:o?.state,values:o?.values,children:or(o?.children)})),e),{})}catch(e){i("component.render.getExistingStateMap.buildMapForChildren",e)}},ir=(r={})=>{try{return or(r)}catch(e){i("component.render.getExistingStateMap",e)}};var ar=new RegExp(/\<\!\-\-(?:.|\n|\r)*?-->/g),qr=new RegExp(/\n/g);var Br=(r="")=>{try{return(r.match(ar)||[]).forEach(t=>{r=r.replace(t,"")}),r}catch(e){i("component.render.sanitizeHTML.removeCommentedCode",e)}},cr=(r="")=>{try{let e=`${r}`;return e=Br(e),e}catch(e){i("component.render.sanitizeHTML",e)}};var sr=(r={},e="")=>{try{let{wrapper:t=null,id:n=null,instanceId:o=null}=r;return`<div ${t?.id?`id="${t.id}" `:""}${t?.classList?`class="${t.classList?.join(" ")}" `:""} js-c="${n}" js-i="${o}">${e}</div>`}catch(t){i("component.render.wrapHTML",t)}};var dr=(r={},e=[])=>{try{let t=[...e],n=Object.entries(r);for(let o=0;o<n?.length;o+=1){let[s,m]=n[o];for(let l=0;l<m?.length;l+=1){let M=m[l];Object.entries(M?.timers)?.length>0&&t.push(...Object.values(M?.timers)),Object.entries(M?.children)?.length>0&&dr(M?.children,t)}}if(t?.length>0)for(let o=0;o<t?.length;o+=1)clearTimeout(t[o])}catch(t){i("component.render.clearTimersOnChildren",t)}},lr=dr;var ur=(r={},e={})=>{try{e?.dataFromSSR&&(r.data=Q(e.dataFromSSR,r.id)||{}),lr(r?.children);let t=ir(e?.existingChildren||r?.children)||{};r.children={},r.renderMethods=tr({...r,existingStateMap:t,translations:e?.translations||r.translations||{},ssrTree:e?.ssrTree,walkingTreeForSSR:e?.walkingTreeForSSR,renderingHTMLWithDataForSSR:e?.renderingHTMLWithDataForSSR,dataFromSSR:e?.dataFromSSR}),r.methods=nr(r,r.options.methods);let n=r.options.render({...r||{},setState:r.setState.bind(r),...r.renderMethods||{}}),o=cr(n),s=sr(r,o);return{unwrapped:o,wrapped:s}}catch(t){i("component.render.toHTML",t)}};var Wr=(r={})=>{try{return Object.values(r).reduce((e={},t)=>(e[t.name]=t.value,e),{})}catch(e){i("component.virtualDOM.build.parseAttributeMap",e)}},pr=(r={})=>{try{return r.tagName==="WHEN"?[].flatMap.call(r?.childNodes,e=>e?.tagName==="WHEN"?pr(e):q(e)):q(r)}catch(e){i("component.virtualDOM.build.flattenWhenTags",e)}},q=(r={})=>{try{let e=r&&r.tagName&&r.tagName.toLowerCase()||"text",t={tagName:e,attributes:Wr(r.attributes),children:[].flatMap.call(r.childNodes,n=>pr(n))};return e==="text"&&(t=r.textContent),t}catch(e){i("component.virtualDOM.build",e)}},fr=q;var zr=(r="")=>{try{let e=document.createElement("div");return e.innerHTML=r,e?.childNodes[0]}catch(e){i("component.virtualDOM.build.convertHTMLToDOM",e)}},hr=(r="")=>{try{let e=zr(r);return fr(e)}catch(e){i("component.virtualDOM.build",e)}};var mr=(r="")=>{try{return document.createElement("div").setAttribute(r,"Test"),!0}catch{return!1}};var Gr=(r={})=>{try{let e=document.createElement(r.tagName),t=Object.entries(r.attributes);for(let n=0;n<t.length;n+=1){let[o,s]=t[n];mr(o)&&e.setAttribute(o,s)}for(let n=0;n<r?.children?.length;n+=1){let o=r?.children[n];if(o){let s=wr(o);e.appendChild(s)}}return e}catch(e){i("component.virtualDOM.renderTreeToDOM.renderElement",e)}},wr=(r=null)=>{try{return G(r)?document.createTextNode(r):Gr(r)}catch(e){i("component.virtualDOM.renderTreeToDOM",e)}},yr=wr;var rr=(r={},e={})=>{try{let t=ur(r,{existingChildren:e?.existingChildren}),n=hr(t.wrapped,r),o=e.includeActual&&n?yr(n):null;return{html:t,virtual:n,actual:o}}catch(t){i("component.render.getUpdatedDOM",t)}};export{rr as default};
@@ -1 +1 @@
1
- var Mr=Object.create;var P=Object.defineProperty;var gr=Object.getOwnPropertyDescriptor;var Tr=Object.getOwnPropertyNames;var Fr=Object.getPrototypeOf,Sr=Object.prototype.hasOwnProperty;var br=r=>P(r,"__esModule",{value:!0});var Or=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var Er=(r,e,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Tr(e))!Sr.call(r,n)&&n!=="default"&&P(r,n,{get:()=>e[n],enumerable:!(t=gr(e,n))||t.enumerable});return r},kr=r=>Er(br(P(r!=null?Mr(Fr(r)):{},"default",r&&r.__esModule&&"default"in r?{get:()=>r.default,enumerable:!0}:{value:r,enumerable:!0})),r);var V=Or(L=>{(function(r,e){if(typeof define=="function"&&define.amd)define(["exports"],e);else if(typeof L!="undefined")e(L);else{var t={exports:{}};e(t.exports),r.index=t.exports}})(L,function(r){"use strict";function e(a){return e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(c){return typeof c}:function(c){return c&&typeof Symbol=="function"&&c.constructor===Symbol&&c!==Symbol.prototype?"symbol":typeof c},e(a)}function t(a,c){return c&&(e(c)==="object"||typeof c=="function")?c:n(a)}function n(a){if(a===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function o(a){return o=Object.setPrototypeOf?Object.getPrototypeOf:function(c){return c.__proto__||Object.getPrototypeOf(c)},o(a)}function s(a,c){if(typeof c!="function"&&c!==null)throw new TypeError("Super expression must either be null or a function");a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),c&&m(a,c)}function m(a,c){return m=Object.setPrototypeOf||function(p,g){return p.__proto__=g,p},m(a,c)}function l(a,c){if(!(a instanceof c))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0}),r.diff=void 0;var M=function a(c,p){l(this,a),this.type=c,this.path=p?p.toString():""},j=function(a){function c(p,g,d){var F;return l(this,c),F=t(this,o(c).call(this,"E",p)),F.lhs=g,F.rhs=d,F}return s(c,a),c}(M),R=function(a){function c(p,g,d,F){var f;return l(this,c),f=t(this,o(c).call(this,"M",p)),f.item=g,f.lhsIndex=d,f.rhsIndex=F,f}return s(c,a),c}(M),v=function(a){function c(p,g){var d;return l(this,c),d=t(this,o(c).call(this,"D",p)),d.lhs=g,d}return s(c,a),c}(M),N=function(a){function c(p,g){var d;return l(this,c),d=t(this,o(c).call(this,"A",p)),d.rhs=g,d}return s(c,a),c}(M),b=function(a,c){return a?"".concat(a,".").concat(c):c};r.diff=function(c,p){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{},d=[],F=g.matchKey,f=g.types||["E","A","D","M"],xr=function(h,u,w,O){h.forEach(function(S,y){var T=u.findIndex(function(x){return x[O]===S[O]});-1<T?(-1<f.indexOf("M")&&y!==T&&d.push(new R(w,S,y,T)),D(S,u[T],b(w,T))):-1<f.indexOf("D")&&d.push(new v(w,S))}),u.forEach(function(S,y){var T=h.findIndex(function(x){return S[O]===x[O]});-1<f.indexOf("A")&&T===-1&&d.push(new N(b(w,y),S))})},D=function(h,u,w){var O=Object.prototype.toString.call(h),S=Object.prototype.toString.call(u);if(-1<f.indexOf("E")&&O!==S)return d.push(new j(w,h,u)),!1;if(O==="[object Object]")Object.getOwnPropertyNames(h).forEach(function(x){Object.prototype.hasOwnProperty.call(u,x)?D(h[x],u[x],b(w,x)):-1<f.indexOf("D")&&d.push(new v(b(w,x),h[x]))}),Object.getOwnPropertyNames(u).forEach(function(x){-1<f.indexOf("A")&&!Object.prototype.hasOwnProperty.call(h,x)&&d.push(new N(b(w,x),u[x]))});else if(O!=="[object Array]")-1<f.indexOf("E")&&h!==u&&d.push(new j(w,h,u));else if(F)xr(h,u,w,F);else{var y=h.length-1,T=u.length-1;if(-1<f.indexOf("D"))for(;y>T;)d.push(new v(b(w,y),h[y--]));if(-1<f.indexOf("A"))for(;T>y;)d.push(new N(b(w,T),u[T--]));for(;0<=y;--y)D(h[y],u[y],b(w,y))}};return D(c,p),d}})});var i=(r="",e={})=>{throw new Error(`[joystick${r?`.${r}`:""}] ${e.message||e.reason||e}`)};var B=r=>{try{return!!Array.isArray(r)}catch(e){i("types.isArray",e)}};var W=r=>{try{return typeof r=="function"}catch(e){i("types.isFunction",e)}};var z=r=>{try{return!!(r&&typeof r=="object"&&!Array.isArray(r))}catch(e){i("types.isObject",e)}};var G=r=>{try{return typeof r=="string"}catch(e){i("types.isString",e)}};var Q=(r=[],e="")=>{try{return(B(r)&&r.find(n=>n?.componentId===e))?.data||{}}catch(t){i("findComponentDataFromSSR",t)}};var ar=kr(V());var A=()=>typeof window=="undefined";var Cr=(r="")=>{try{let[e,t]=r?.split(".");return t?window?.joystick?._internal?.queues[e][t]:window?.joystick?._internal?.queues[e]}catch(e){i("addToQueue.getQueue",e)}},C=(r="",e=null)=>{try{A()||(Cr(r)||{}).array.push({callback:e})}catch(t){i("addToQueue",t)}};var jr=(r={})=>{try{return Object.values(r).reduce((e={},t)=>(e[t.name]=t.value,e),{})}catch(e){i("component.virtualDOM.build.parseAttributeMap",e)}},K=(r={})=>{try{return r.tagName==="WHEN"?[].flatMap.call(r?.childNodes,e=>e?.tagName==="WHEN"?K(e):H(e)):H(r)}catch(e){i("component.virtualDOM.build.flattenWhenTags",e)}},H=(r={})=>{try{let e=r&&r.tagName&&r.tagName.toLowerCase()||"text",t={tagName:e,attributes:jr(r.attributes),children:[].flatMap.call(r.childNodes,n=>K(n))};return e==="text"&&(t=r.textContent),t}catch(e){i("component.virtualDOM.build",e)}},X=H;var Rr=(r="")=>{try{let e=document.createElement("div");return e.innerHTML=r,e?.childNodes[0]}catch(e){i("component.virtualDOM.build.convertHTMLToDOM",e)}},J=(r="")=>{try{let e=Rr(r);return X(e)}catch(e){i("component.virtualDOM.build",e)}};var Y=(r="")=>{try{return document.createElement("div").setAttribute(r,"Test"),!0}catch{return!1}};var Dr=(r={})=>{try{let e=document.createElement(r.tagName),t=Object.entries(r.attributes);for(let n=0;n<t.length;n+=1){let[o,s]=t[n];Y(o)&&e.setAttribute(o,s)}for(let n=0;n<r?.children?.length;n+=1){let o=r?.children[n];if(o){let s=Z(o);e.appendChild(s)}}return e}catch(e){i("component.virtualDOM.renderTreeToDOM.renderElement",e)}},Z=(r=null)=>{try{return G(r)?document.createTextNode(r):Dr(r)}catch(e){i("component.virtualDOM.renderTreeToDOM",e)}},rr=Z;var er=(r={},e={})=>{try{let t=tr(r,{existingChildren:e?.existingChildren}),n=J(t.wrapped,r),o=e.includeActual&&n?rr(n):null;return{html:t,virtual:n,actual:o}}catch(t){i("component.render.getUpdatedDOM",t)}};var nr=(r={},e="",t="id")=>{try{let n=r&&r.id;if(z(r)&&n){let o=Object.keys(r);for(let s=0;s<o.length;s+=1){let m=o[s],l=r[m];if(m===t&&l===e)return r;if(m==="children"&&Array.isArray(l))for(let M=0;M<l.length;M+=1){let j=l[M],R=nr(j,e,t);if(R!==null)return R}}}return null}catch(n){i("component.findComponentInTreeByField",n)}},or=nr;var ir=(r="",e={},t=null)=>{let n=or(t||window.joystick._internal.tree,r,"instanceId");n&&(n.children=[...n.children||[],e])};var E=(r="",e=[])=>{typeof window!="undefined"&&!!window.__joystick_test__&&(window.test={...window.test||{},functionCalls:{...window?.test?.functionCalls||{},[r]:[...window?.test?.functionCalls&&window?.test?.functionCalls[r]||[],{calledAt:new Date().toISOString(),args:e}]}})};var cr="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890".split(""),k=(r=16)=>{let e="",t=0;for(;t<r;)e+=cr[Math.floor(Math.random()*(cr.length-1))],t+=1;return e};var Lr=(r={},e={},t=null)=>{try{let n=er(r,{includeActual:!0,existingChildren:t});return r.dom=n,r.setDOMNodeOnInstance(),e.renderedComponent=r,n.html.wrapped}catch(n){i("component.renderMethods.component.renderForClient",n)}},Ar=(r={})=>{try{return r.renderToHTML({ssrTree:r.parent.ssrTree,translations:r.parent.translations,walkingTreeForSSR:r?.parent?.walkingTreeForSSR,dataFromSSR:r.parent?.dataFromSSR}).wrapped}catch(e){i("component.renderMethods.component.renderToHTMLForSSR",e)}},vr=(r={})=>{try{return r.parent.ssrTree.dataFunctions.push(async()=>{try{let e=await r.options.data(r.parent.options.api,r.parent.options.req);return r.data=e||{},{componentId:r.id,ssrId:r.ssrId,data:e}}catch(e){return{componentId:r.id,ssrId:r.ssrId,data:null,error:e}}}),r.renderToHTML({ssrTree:r?.parent?.ssrTree,translations:r?.parent?.translations,walkingTreeForSSR:r?.parent?.walkingTreeForSSR,dataFromSSR:r?.parent?.dataFromSSR})}catch(e){i("component.renderMethods.component.collectDataFunctionsForSSR",e)}},Nr=(r={})=>{try{let e={id:r.id,instanceId:r.instanceId,instance:r,children:[]};ir(r.parent.instanceId,e,r.parent&&r.parent.ssrTree||null)}catch(e){i("component.renderMethods.component.handleAddComponentToParent",e)}},Pr=(r={},e={})=>{try{!r.renderedComponent&&e.options&&e.options.lifecycle&&(e.options.lifecycle.onBeforeMount&&C("lifecycle.onBeforeMount",()=>{e.options.lifecycle.onBeforeMount(e),E(`ui.${e?.options?.test?.name||k()}.lifecycle.onBeforeMount`,[e])}),!r.renderedComponent&&e.options.lifecycle.onMount&&C("lifecycle.onMount",()=>{e.options.lifecycle.onMount(e),E(`ui.${e?.options?.test?.name||k()}.lifecycle.onMount`,[e])}))}catch(t){i("component.renderMethods.component.handleLifecycle",t)}},Hr=(r={},e={},t={})=>{try{!e.walkingTreeForSSR&&r?.options?.lifecycle?.onUpdateProps&&(0,ar.diff)(e?.existingPropsMap,t)?.length>0&&C("lifecycle.onUpdateProps",()=>{let o=e?.existingPropsMap&&e?.existingPropsMap[r.id];r.options.lifecycle.onUpdateProps(o||{},t,r),E(`ui.${r?.options?.test?.name||k()}.lifecycle.onBeforeMount`,[o||{},t,r])})}catch(n){i("component.renderMethods.component.handleOnChangeProps",n)}},_r=function(){return function(e=null,t={},n={}){let o=e({props:t,url:n.url,translations:n.translations,api:n.options.api,req:n.options.req,dataFromSSR:n?.dataFromSSR,parent:n}),s=n?.existingStateMap[o.id]||{},m=n.children[o.id]||[],l=s[m?.length];return o.state=l?.state||o.state,n.children[o.id]=[...n.children[o.id]||[],o],o.parent=n,Hr(o,n,t),C("lifecycle.onMount",()=>{o.setDOMNodeOnInstance()}),Pr(this,o),o.parent&&Nr(o),o.options.data&&o.parent.walkingTreeForSSR&&o.parent.ssrTree.dataFunctions?vr(o):o.parent&&o.parent.ssrTree?Ar(o):Lr(o,this,l?.children)}},Ir=function(e,t){try{let n=this;return new _r().bind({})(e,t,n)}catch(n){i("component.renderMethods.component",n)}},_=Ir;var $r=function(e=[],t=null){try{return W(t)&&e&&Array.isArray(e)?e.map((n,o)=>t(n,o)).join(""):""}catch(n){i("component.renderMethods.each",n)}},I=$r;var Ur=(r="",e=[])=>{try{return e.reduce((t,[n,o])=>t.replace(`{{${n}}}`,o),r)}catch(t){i("component.renderMethods.i18n.replacePlaceholdersInString",t)}},$=(r="",e=[])=>{try{let t=typeof r=="string",n=Array.isArray(r),o=typeof r=="object"&&!n;if(t)return Ur(r,e);if(n)return r?.map(s=>$(s,e));if(o)return Object.entries(r)?.reduce((s={},[m,l])=>(s[m]=$(l,e),s),{})}catch(t){i("component.renderMethods.i18n.handleTranslationReplacement",t)}},qr=(r="",e={})=>{try{return r?.split(".").reduce((t,n)=>t[n],e)}catch(t){i("component.renderMethods.i18n.getTranslationAtPath",t)}},Br=function(r="",e={}){try{let t=A()?this.translations:window.__joystick_i18n__,o=r?.includes(".")?qr(r,t):t[r];if(!t||!o)return"";let s=Object.entries(e);return $(o,s)}catch(t){i("component.renderMethods.i18n",t)}},U=Br;var Wr=function(e=!1,t=""){try{return this?.renderingHTMLWithDataForSSR||e?`<when>${t.trim()}</when>`:"<when> </when>"}catch(n){i("component.renderMethods.when",n)}},q=Wr;var sr={c:_,component:_,e:I,each:I,i:U,i18n:U,w:q,when:q};var dr=(r={},e={})=>{try{return Object.entries(sr).reduce((t,[n,o])=>(t[n]=o.bind({...r,...e}),t),{})}catch(t){i("component.renderMethods.compile",t)}};var lr=(r={},e={})=>{try{return Object.entries(e).reduce((t={},[n,o])=>(t[n]=(...s)=>(E(`ui.${r?.options?.test?.name||k()}.methods.${n}`,[...s,{...r,setState:r.setState.bind(r),...r.renderMethods||{}}]),o(...s,{...r,setState:r.setState.bind(r),...r.renderMethods||{}})),t),{})}catch{i("component.methods.compile")}};var ur=(r={})=>{try{return Object.entries(r)?.reduce((e={},[t,n]={})=>(e[t]=n?.map((o={})=>({state:o?.state,children:ur(o?.children)})),e),{})}catch(e){i("component.render.getExistingStateMap.buildMapForChildren",e)}},pr=(r={})=>{try{return ur(r)}catch(e){i("component.render.getExistingStateMap",e)}};var fr=new RegExp(/\<\!\-\-(?:.|\n|\r)*?-->/g),zr=new RegExp(/\n/g);var Gr=(r="")=>{try{return(r.match(fr)||[]).forEach(t=>{r=r.replace(t,"")}),r}catch(e){i("component.render.sanitizeHTML.removeCommentedCode",e)}},hr=(r="")=>{try{let e=`${r}`;return e=Gr(e),e}catch(e){i("component.render.sanitizeHTML",e)}};var mr=(r={},e="")=>{try{let{wrapper:t=null,id:n=null,instanceId:o=null}=r;return`<div ${t?.id?`id="${t.id}" `:""}${t?.classList?`class="${t.classList?.join(" ")}" `:""} js-c="${n}" js-i="${o}">${e}</div>`}catch(t){i("component.render.wrapHTML",t)}};var wr=(r={},e=[])=>{try{let t=[...e],n=Object.entries(r);for(let o=0;o<n?.length;o+=1){let[s,m]=n[o];for(let l=0;l<m?.length;l+=1){let M=m[l];Object.entries(M?.timers)?.length>0&&t.push(...Object.values(M?.timers)),Object.entries(M?.children)?.length>0&&wr(M?.children,t)}}if(t?.length>0)for(let o=0;o<t?.length;o+=1)clearTimeout(t[o])}catch(t){i("component.render.clearTimersOnChildren",t)}},yr=wr;var tr=(r={},e={})=>{try{e?.dataFromSSR&&(r.data=Q(e.dataFromSSR,r.id)||{}),yr(r?.children);let t=pr(e?.existingChildren||r?.children)||{};r.children={},r.renderMethods=dr({...r,existingStateMap:t,translations:e?.translations||r.translations||{},ssrTree:e?.ssrTree,walkingTreeForSSR:e?.walkingTreeForSSR,renderingHTMLWithDataForSSR:e?.renderingHTMLWithDataForSSR,dataFromSSR:e?.dataFromSSR}),r.methods=lr(r,r.options.methods);let n=r.options.render({...r||{},setState:r.setState.bind(r),...r.renderMethods||{}}),o=hr(n),s=mr(r,o);return{unwrapped:o,wrapped:s}}catch(t){i("component.render.toHTML",t)}};export{tr as default};
1
+ var Mr=Object.create;var P=Object.defineProperty;var gr=Object.getOwnPropertyDescriptor;var Tr=Object.getOwnPropertyNames;var Fr=Object.getPrototypeOf,Sr=Object.prototype.hasOwnProperty;var br=r=>P(r,"__esModule",{value:!0});var Or=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var Er=(r,e,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Tr(e))!Sr.call(r,n)&&n!=="default"&&P(r,n,{get:()=>e[n],enumerable:!(t=gr(e,n))||t.enumerable});return r},kr=r=>Er(br(P(r!=null?Mr(Fr(r)):{},"default",r&&r.__esModule&&"default"in r?{get:()=>r.default,enumerable:!0}:{value:r,enumerable:!0})),r);var V=Or(v=>{(function(r,e){if(typeof define=="function"&&define.amd)define(["exports"],e);else if(typeof v!="undefined")e(v);else{var t={exports:{}};e(t.exports),r.index=t.exports}})(v,function(r){"use strict";function e(c){return e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(a){return typeof a}:function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},e(c)}function t(c,a){return a&&(e(a)==="object"||typeof a=="function")?a:n(c)}function n(c){if(c===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return c}function o(c){return o=Object.setPrototypeOf?Object.getPrototypeOf:function(a){return a.__proto__||Object.getPrototypeOf(a)},o(c)}function s(c,a){if(typeof a!="function"&&a!==null)throw new TypeError("Super expression must either be null or a function");c.prototype=Object.create(a&&a.prototype,{constructor:{value:c,writable:!0,configurable:!0}}),a&&m(c,a)}function m(c,a){return m=Object.setPrototypeOf||function(p,g){return p.__proto__=g,p},m(c,a)}function l(c,a){if(!(c instanceof a))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0}),r.diff=void 0;var M=function c(a,p){l(this,c),this.type=a,this.path=p?p.toString():""},j=function(c){function a(p,g,d){var F;return l(this,a),F=t(this,o(a).call(this,"E",p)),F.lhs=g,F.rhs=d,F}return s(a,c),a}(M),R=function(c){function a(p,g,d,F){var f;return l(this,a),f=t(this,o(a).call(this,"M",p)),f.item=g,f.lhsIndex=d,f.rhsIndex=F,f}return s(a,c),a}(M),A=function(c){function a(p,g){var d;return l(this,a),d=t(this,o(a).call(this,"D",p)),d.lhs=g,d}return s(a,c),a}(M),N=function(c){function a(p,g){var d;return l(this,a),d=t(this,o(a).call(this,"A",p)),d.rhs=g,d}return s(a,c),a}(M),b=function(c,a){return c?"".concat(c,".").concat(a):a};r.diff=function(a,p){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{},d=[],F=g.matchKey,f=g.types||["E","A","D","M"],xr=function(h,u,w,O){h.forEach(function(S,y){var T=u.findIndex(function(x){return x[O]===S[O]});-1<T?(-1<f.indexOf("M")&&y!==T&&d.push(new R(w,S,y,T)),D(S,u[T],b(w,T))):-1<f.indexOf("D")&&d.push(new A(w,S))}),u.forEach(function(S,y){var T=h.findIndex(function(x){return S[O]===x[O]});-1<f.indexOf("A")&&T===-1&&d.push(new N(b(w,y),S))})},D=function(h,u,w){var O=Object.prototype.toString.call(h),S=Object.prototype.toString.call(u);if(-1<f.indexOf("E")&&O!==S)return d.push(new j(w,h,u)),!1;if(O==="[object Object]")Object.getOwnPropertyNames(h).forEach(function(x){Object.prototype.hasOwnProperty.call(u,x)?D(h[x],u[x],b(w,x)):-1<f.indexOf("D")&&d.push(new A(b(w,x),h[x]))}),Object.getOwnPropertyNames(u).forEach(function(x){-1<f.indexOf("A")&&!Object.prototype.hasOwnProperty.call(h,x)&&d.push(new N(b(w,x),u[x]))});else if(O!=="[object Array]")-1<f.indexOf("E")&&h!==u&&d.push(new j(w,h,u));else if(F)xr(h,u,w,F);else{var y=h.length-1,T=u.length-1;if(-1<f.indexOf("D"))for(;y>T;)d.push(new A(b(w,y),h[y--]));if(-1<f.indexOf("A"))for(;T>y;)d.push(new N(b(w,T),u[T--]));for(;0<=y;--y)D(h[y],u[y],b(w,y))}};return D(a,p),d}})});var i=(r="",e={})=>{throw new Error(`[joystick${r?`.${r}`:""}] ${e.message||e.reason||e}`)};var B=r=>{try{return!!Array.isArray(r)}catch(e){i("types.isArray",e)}};var W=r=>{try{return typeof r=="function"}catch(e){i("types.isFunction",e)}};var z=r=>{try{return!!(r&&typeof r=="object"&&!Array.isArray(r))}catch(e){i("types.isObject",e)}};var G=r=>{try{return typeof r=="string"}catch(e){i("types.isString",e)}};var Q=(r=[],e="")=>{try{return(B(r)&&r.find(n=>n?.componentId===e))?.data||{}}catch(t){i("findComponentDataFromSSR",t)}};var cr=kr(V());var L=()=>typeof window=="undefined";var Cr=(r="")=>{try{let[e,t]=r?.split(".");return t?window?.joystick?._internal?.queues[e][t]:window?.joystick?._internal?.queues[e]}catch(e){i("addToQueue.getQueue",e)}},C=(r="",e=null)=>{try{L()||(Cr(r)||{}).array.push({callback:e})}catch(t){i("addToQueue",t)}};var jr=(r={})=>{try{return Object.values(r).reduce((e={},t)=>(e[t.name]=t.value,e),{})}catch(e){i("component.virtualDOM.build.parseAttributeMap",e)}},K=(r={})=>{try{return r.tagName==="WHEN"?[].flatMap.call(r?.childNodes,e=>e?.tagName==="WHEN"?K(e):H(e)):H(r)}catch(e){i("component.virtualDOM.build.flattenWhenTags",e)}},H=(r={})=>{try{let e=r&&r.tagName&&r.tagName.toLowerCase()||"text",t={tagName:e,attributes:jr(r.attributes),children:[].flatMap.call(r.childNodes,n=>K(n))};return e==="text"&&(t=r.textContent),t}catch(e){i("component.virtualDOM.build",e)}},X=H;var Rr=(r="")=>{try{let e=document.createElement("div");return e.innerHTML=r,e?.childNodes[0]}catch(e){i("component.virtualDOM.build.convertHTMLToDOM",e)}},J=(r="")=>{try{let e=Rr(r);return X(e)}catch(e){i("component.virtualDOM.build",e)}};var Y=(r="")=>{try{return document.createElement("div").setAttribute(r,"Test"),!0}catch{return!1}};var Dr=(r={})=>{try{let e=document.createElement(r.tagName),t=Object.entries(r.attributes);for(let n=0;n<t.length;n+=1){let[o,s]=t[n];Y(o)&&e.setAttribute(o,s)}for(let n=0;n<r?.children?.length;n+=1){let o=r?.children[n];if(o){let s=Z(o);e.appendChild(s)}}return e}catch(e){i("component.virtualDOM.renderTreeToDOM.renderElement",e)}},Z=(r=null)=>{try{return G(r)?document.createTextNode(r):Dr(r)}catch(e){i("component.virtualDOM.renderTreeToDOM",e)}},rr=Z;var er=(r={},e={})=>{try{let t=tr(r,{existingChildren:e?.existingChildren}),n=J(t.wrapped,r),o=e.includeActual&&n?rr(n):null;return{html:t,virtual:n,actual:o}}catch(t){i("component.render.getUpdatedDOM",t)}};var nr=(r={},e="",t="id")=>{try{let n=r&&r.id;if(z(r)&&n){let o=Object.keys(r);for(let s=0;s<o.length;s+=1){let m=o[s],l=r[m];if(m===t&&l===e)return r;if(m==="children"&&Array.isArray(l))for(let M=0;M<l.length;M+=1){let j=l[M],R=nr(j,e,t);if(R!==null)return R}}}return null}catch(n){i("component.findComponentInTreeByField",n)}},or=nr;var ir=(r="",e={},t=null)=>{let n=or(t||window.joystick._internal.tree,r,"instanceId");n&&(n.children=[...n.children||[],e])};var E=(r="",e=[])=>{typeof window!="undefined"&&!!window.__joystick_test__&&(window.test={...window.test||{},functionCalls:{...window?.test?.functionCalls||{},[r]:[...window?.test?.functionCalls&&window?.test?.functionCalls[r]||[],{calledAt:new Date().toISOString(),args:e}]}})};var ar="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890".split(""),k=(r=16)=>{let e="",t=0;for(;t<r;)e+=ar[Math.floor(Math.random()*(ar.length-1))],t+=1;return e};var vr=(r={},e={},t=null)=>{try{let n=er(r,{includeActual:!0,existingChildren:t});return r.dom=n,r.setDOMNodeOnInstance(),e.renderedComponent=r,n.html.wrapped}catch(n){i("component.renderMethods.component.renderForClient",n)}},Lr=(r={})=>{try{return r.renderToHTML({ssrTree:r.parent.ssrTree,translations:r.parent.translations,walkingTreeForSSR:r?.parent?.walkingTreeForSSR,dataFromSSR:r.parent?.dataFromSSR}).wrapped}catch(e){i("component.renderMethods.component.renderToHTMLForSSR",e)}},Ar=(r={})=>{try{return r.parent.ssrTree.dataFunctions.push(async()=>{try{let e=await r.options.data(r.parent.options.api,r.parent.options.req);return r.data=e||{},{componentId:r.id,ssrId:r.ssrId,data:e}}catch(e){return{componentId:r.id,ssrId:r.ssrId,data:null,error:e}}}),r.renderToHTML({ssrTree:r?.parent?.ssrTree,translations:r?.parent?.translations,walkingTreeForSSR:r?.parent?.walkingTreeForSSR,dataFromSSR:r?.parent?.dataFromSSR})}catch(e){i("component.renderMethods.component.collectDataFunctionsForSSR",e)}},Nr=(r={})=>{try{let e={id:r.id,instanceId:r.instanceId,instance:r,children:[]};ir(r.parent.instanceId,e,r.parent&&r.parent.ssrTree||null)}catch(e){i("component.renderMethods.component.handleAddComponentToParent",e)}},Pr=(r={},e={})=>{try{!r.renderedComponent&&e.options&&e.options.lifecycle&&(e.options.lifecycle.onBeforeMount&&C("lifecycle.onBeforeMount",()=>{e.options.lifecycle.onBeforeMount(e),E(`ui.${e?.options?.test?.name||k()}.lifecycle.onBeforeMount`,[e])}),!r.renderedComponent&&e.options.lifecycle.onMount&&C("lifecycle.onMount",()=>{e.options.lifecycle.onMount(e),E(`ui.${e?.options?.test?.name||k()}.lifecycle.onMount`,[e])}))}catch(t){i("component.renderMethods.component.handleLifecycle",t)}},Hr=(r={},e={},t={})=>{try{!e.walkingTreeForSSR&&r?.options?.lifecycle?.onUpdateProps&&(0,cr.diff)(e?.existingPropsMap,t)?.length>0&&C("lifecycle.onUpdateProps",()=>{let o=e?.existingPropsMap&&e?.existingPropsMap[r.id];r.options.lifecycle.onUpdateProps(o||{},t,r),E(`ui.${r?.options?.test?.name||k()}.lifecycle.onBeforeMount`,[o||{},t,r])})}catch(n){i("component.renderMethods.component.handleOnChangeProps",n)}},_r=function(){return function(e=null,t={},n={}){let o=e({props:t,url:n.url,translations:n.translations,api:n.options.api,req:n.options.req,dataFromSSR:n?.dataFromSSR,parent:n}),s=n?.existingStateMap[o.id]||{},m=n.children[o.id]||[],l=s[m?.length];return o.state=l?.state||o.state,o.values=l?.values||o.values,n.children[o.id]=[...n.children[o.id]||[],o],o.parent=n,Hr(o,n,t),C("lifecycle.onMount",()=>{o.setDOMNodeOnInstance()}),Pr(this,o),o.parent&&Nr(o),o.options.data&&o.parent.walkingTreeForSSR&&o.parent.ssrTree.dataFunctions?Ar(o):o.parent&&o.parent.ssrTree?Lr(o):vr(o,this,l?.children)}},Ir=function(e,t){try{let n=this;return new _r().bind({})(e,t,n)}catch(n){i("component.renderMethods.component",n)}},_=Ir;var $r=function(e=[],t=null){try{return W(t)&&e&&Array.isArray(e)?e.map((n,o)=>t(n,o)).join(""):""}catch(n){i("component.renderMethods.each",n)}},I=$r;var Ur=(r="",e=[])=>{try{return e.reduce((t,[n,o])=>t.replace(`{{${n}}}`,o),r)}catch(t){i("component.renderMethods.i18n.replacePlaceholdersInString",t)}},$=(r="",e=[])=>{try{let t=typeof r=="string",n=Array.isArray(r),o=typeof r=="object"&&!n;if(t)return Ur(r,e);if(n)return r?.map(s=>$(s,e));if(o)return Object.entries(r)?.reduce((s={},[m,l])=>(s[m]=$(l,e),s),{})}catch(t){i("component.renderMethods.i18n.handleTranslationReplacement",t)}},qr=(r="",e={})=>{try{return r?.split(".").reduce((t,n)=>t[n],e)}catch(t){i("component.renderMethods.i18n.getTranslationAtPath",t)}},Br=function(r="",e={}){try{let t=L()?this.translations:window.__joystick_i18n__,o=r?.includes(".")?qr(r,t):t[r];if(!t||!o)return"";let s=Object.entries(e);return $(o,s)}catch(t){i("component.renderMethods.i18n",t)}},U=Br;var Wr=function(e=!1,t=""){try{return this?.renderingHTMLWithDataForSSR||e?`<when>${t.trim()}</when>`:"<when> </when>"}catch(n){i("component.renderMethods.when",n)}},q=Wr;var sr={c:_,component:_,e:I,each:I,i:U,i18n:U,w:q,when:q};var dr=(r={},e={})=>{try{return Object.entries(sr).reduce((t,[n,o])=>(t[n]=o.bind({...r,...e}),t),{})}catch(t){i("component.renderMethods.compile",t)}};var lr=(r={},e={})=>{try{return Object.entries(e).reduce((t={},[n,o])=>(t[n]=(...s)=>(E(`ui.${r?.options?.test?.name||k()}.methods.${n}`,[...s,{...r,setState:r.setState.bind(r),...r.renderMethods||{}}]),o(...s,{...r,setState:r.setState.bind(r),...r.renderMethods||{}})),t),{})}catch{i("component.methods.compile")}};var ur=(r={})=>{try{return Object.entries(r)?.reduce((e={},[t,n]={})=>(e[t]=n?.map((o={})=>({state:o?.state,values:o?.values,children:ur(o?.children)})),e),{})}catch(e){i("component.render.getExistingStateMap.buildMapForChildren",e)}},pr=(r={})=>{try{return ur(r)}catch(e){i("component.render.getExistingStateMap",e)}};var fr=new RegExp(/\<\!\-\-(?:.|\n|\r)*?-->/g),zr=new RegExp(/\n/g);var Gr=(r="")=>{try{return(r.match(fr)||[]).forEach(t=>{r=r.replace(t,"")}),r}catch(e){i("component.render.sanitizeHTML.removeCommentedCode",e)}},hr=(r="")=>{try{let e=`${r}`;return e=Gr(e),e}catch(e){i("component.render.sanitizeHTML",e)}};var mr=(r={},e="")=>{try{let{wrapper:t=null,id:n=null,instanceId:o=null}=r;return`<div ${t?.id?`id="${t.id}" `:""}${t?.classList?`class="${t.classList?.join(" ")}" `:""} js-c="${n}" js-i="${o}">${e}</div>`}catch(t){i("component.render.wrapHTML",t)}};var wr=(r={},e=[])=>{try{let t=[...e],n=Object.entries(r);for(let o=0;o<n?.length;o+=1){let[s,m]=n[o];for(let l=0;l<m?.length;l+=1){let M=m[l];Object.entries(M?.timers)?.length>0&&t.push(...Object.values(M?.timers)),Object.entries(M?.children)?.length>0&&wr(M?.children,t)}}if(t?.length>0)for(let o=0;o<t?.length;o+=1)clearTimeout(t[o])}catch(t){i("component.render.clearTimersOnChildren",t)}},yr=wr;var tr=(r={},e={})=>{try{e?.dataFromSSR&&(r.data=Q(e.dataFromSSR,r.id)||{}),yr(r?.children);let t=pr(e?.existingChildren||r?.children)||{};r.children={},r.renderMethods=dr({...r,existingStateMap:t,translations:e?.translations||r.translations||{},ssrTree:e?.ssrTree,walkingTreeForSSR:e?.walkingTreeForSSR,renderingHTMLWithDataForSSR:e?.renderingHTMLWithDataForSSR,dataFromSSR:e?.dataFromSSR}),r.methods=lr(r,r.options.methods);let n=r.options.render({...r||{},setState:r.setState.bind(r),...r.renderMethods||{}}),o=hr(n),s=mr(r,o);return{unwrapped:o,wrapped:s}}catch(t){i("component.render.toHTML",t)}};export{tr as default};