@joystick.js/ui-canary 0.0.0-canary.57 → 0.0.0-canary.58

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,21 +1,21 @@
1
- var Jt=Object.create;var oe=Object.defineProperty;var Qt=Object.getOwnPropertyDescriptor;var Yt=Object.getOwnPropertyNames;var Xt=Object.getPrototypeOf,er=Object.prototype.hasOwnProperty;var tr=t=>oe(t,"__esModule",{value:!0});var rr=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var or=(t,e,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Yt(e))!er.call(t,o)&&o!=="default"&&oe(t,o,{get:()=>e[o],enumerable:!(r=Qt(e,o))||r.enumerable});return t},ir=t=>or(tr(oe(t!=null?Jt(Xt(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var xt=rr(Y=>{(function(t,e){if(typeof define=="function"&&define.amd)define(["exports"],e);else if(typeof Y!="undefined")e(Y);else{var r={exports:{}};e(r.exports),t.index=r.exports}})(Y,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(b,O){return b.__proto__=O,b},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,b){a(this,p),this.type=d,this.path=b?b.toString():""},y=function(p){function d(b,O,h){var A;return a(this,d),A=r(this,i(d).call(this,"E",b)),A.lhs=O,A.rhs=h,A}return s(d,p),d}(m),w=function(p){function d(b,O,h,A){var $;return a(this,d),$=r(this,i(d).call(this,"M",b)),$.item=O,$.lhsIndex=h,$.rhsIndex=A,$}return s(d,p),d}(m),g=function(p){function d(b,O){var h;return a(this,d),h=r(this,i(d).call(this,"D",b)),h.lhs=O,h}return s(d,p),d}(m),v=function(p){function d(b,O){var h;return a(this,d),h=r(this,i(d).call(this,"A",b)),h.rhs=O,h}return s(d,p),d}(m),f=function(p,d){return p?"".concat(p,".").concat(d):d};t.diff=function(d,b){var O=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{},h=[],A=O.matchKey,$=O.types||["E","A","D","M"],Wt=function(F,x,E,D){F.forEach(function(L,M){var T=x.findIndex(function(k){return k[D]===L[D]});-1<T?(-1<$.indexOf("M")&&M!==T&&h.push(new w(E,L,M,T)),Z(L,x[T],f(E,T))):-1<$.indexOf("D")&&h.push(new g(E,L))}),x.forEach(function(L,M){var T=F.findIndex(function(k){return L[D]===k[D]});-1<$.indexOf("A")&&T===-1&&h.push(new v(f(E,M),L))})},Z=function(F,x,E){var D=Object.prototype.toString.call(F),L=Object.prototype.toString.call(x);if(-1<$.indexOf("E")&&D!==L)return h.push(new y(E,F,x)),!1;if(D==="[object Object]")Object.getOwnPropertyNames(F).forEach(function(k){Object.prototype.hasOwnProperty.call(x,k)?Z(F[k],x[k],f(E,k)):-1<$.indexOf("D")&&h.push(new g(f(E,k),F[k]))}),Object.getOwnPropertyNames(x).forEach(function(k){-1<$.indexOf("A")&&!Object.prototype.hasOwnProperty.call(F,k)&&h.push(new v(f(E,k),x[k]))});else if(D!=="[object Array]")-1<$.indexOf("E")&&F!==x&&h.push(new y(E,F,x));else if(A)Wt(F,x,E,A);else{var M=F.length-1,T=x.length-1;if(-1<$.indexOf("D"))for(;M>T;)h.push(new g(f(E,M),F[M--]));if(-1<$.indexOf("A"))for(;T>M;)h.push(new v(f(E,T),x[T--]));for(;0<=M;--M)Z(F[M],x[M],f(E,M))}};return Z(d,b),h}})});var n=(t="",e={})=>{throw new Error(`[joystick${t?`.${t}`:""}] ${e.message||e.reason||e}`)};var ue=["render"];var fe=(t={})=>{try{return ue.every(e=>Object.keys(t).includes(e))}catch(e){n("component.hasAllRequiredOptions",e)}};var he=["_componentId","_ssrId","api","dataFromSSR","existingProps","existingState","instanceId","parent","req","css","data","defaultProps","events","id","lifecycle","methods","name","props","render","state","translations","url","websockets","wrapper"];var we=t=>{try{return typeof t=="undefined"}catch(e){n("types.isUndefined",e)}},ye=t=>{try{return t===null}catch(e){n("types.isNull",e)}};var _=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 C=t=>{try{return typeof t=="string"}catch(e){n("types.isString",e)}};var ge=(t=null)=>{try{!C(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 xe=["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 be=(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(" ");xe.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 $e=["onBeforeMount","onMount","onUpdateProps","onBeforeUnmount","onRefetchData"];var Fe=(t=null)=>{try{u(t)||n("component.optionValidators.lifecycle","options.lifecycle must be an object.");for(let[e,r]of Object.entries(t))$e.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 ke=(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 Se=(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 Oe=(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"&&!C(r)&&n("component.optionValidators.wrapper",`options.wrapper.${e} must be assigned a string.`),e==="classList"&&!_(r)&&n("component.optionValidators.wrapper",`options.wrapper.${e} must be assigned an array of strings.`)}catch(e){n("component.optionValidators.wrapper",e)}};var Te={css:ge,events:be,lifecycle:Fe,methods:Ee,name:Me,render:ke,websockets:Se,wrapper:Oe};var ve=(t={})=>{try{fe(t)||n("component.validateOptions",`component options must include ${required.options.join(",")}.`);for(let[e,r]of Object.entries(t)){he.includes(e)||n("component.validateOptions",`${e} is not supported by joystick.component.`);let o=Te[e];o&&l(o)&&o(r)}}catch(e){n("component.validateOptions",e)}};var Ce="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890".split(""),U=(t=16)=>{let e="",r=0;for(;r<t;)e+=Ce[Math.floor(Math.random()*(Ce.length-1))],r+=1;return e};var B=(t=[],e="")=>{try{return(_(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 j=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 _e=/^((?:[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])+)\]))$/,je=(t,e="")=>t===!0?!!e.match(_e):!e.match(_e);var Pe=(t,e="")=>t===e;var Ie=(t,e="")=>t===e;var Ne=(t,e="")=>e.length<=t;var Ve=(t,e="")=>e.length>=t;var Ue=/^[\+]?[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]{4,6}$/,qe=(t,e="")=>t===!0?!!e.match(Ue):!e.match(Ue);var He={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}$/},ze=(t,e="")=>{let r=j(t)&&t.iso?He[t.iso||"US"]:He.US;return j(t)?t.rule===!0?!!e.match(r):!e.match(r):t===!0?!!e.match(r):!e.match(r)};var Ze=(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 Be=/^(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-]+)*))?$/,Ge=(t,e="")=>t===!0?!!e.match(Be):!e.match(Be);var Ke=/^[a-z0-9]+(?:-[a-z0-9]+)*$/,We=(t,e="")=>t===!0?!!e.match(Ke):!e.match(Ke);var Je=/^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$ %^&*-]).{8,}$/,Qe=(t,e="")=>t===!0?!!e.match(Je):!e.match(Je);var Ye=/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()!@:%_\+.~#?&\/\/=]*)/,Xe=(t,e="")=>t===!0?!!e.match(Ye):!e.match(Ye);var et={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},tt=(t,e="")=>{let r=j(t)&&t.iso?et[t.iso||"EU"]:et.EU;return j(t)?t.rule===!0?!!e.match(r):!e.match(r):t===!0?!!e.match(r):!e.match(r)};var rt={creditCard:De,email:je,equals:Pe,matches:Ie,maxLength:Ne,minLength:Ve,phone:qe,postalCode:ze,required:Ze,semVer:Ge,slug:We,strongPassword:Qe,url:Xe,vat:tt};var ot=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={required:()=>"This field is required.",email:()=>"Must be a valid email.",creditCard:()=>"Must be a valid credit card number.",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.",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.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]):{}}})}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){this.clearExistingErrors();let r=this.fields.find(o=>o.name===e);return 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=rt[o.name];return i?i(o.rule,r,{isChecked:e}):!0}clearExistingErrors(){this.form&&this.form.querySelectorAll(".input-hint.error").forEach(e=>e.remove())}clearExistingError(e=""){let r=document.getElementById(`error-${e}`);r&&r.remove()}renderError(e,r=""){if(e){this.clearExistingError(e.name);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)}}},nr=(t,e)=>new Promise((r,o)=>{try{new ot(t,e).validate()?r():o()}catch(i){console.warn(i)}}),it=nr;var nt=(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=!we(s)&&!ye(s);return o[i]=a?s:c,o},{})}catch(r){n("component.props.compile",r)}};var st=(t="",e={})=>{try{let r="";if(t&&C(t))return r=t,r;if(t&&l(t))return r=t(e),r;if(t&&u(t)){let o=t?.print&&(C(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),y=t?.max?.height&&u(t?.max?.height);if(o&&(r+=`
1
+ var Jt=Object.create;var oe=Object.defineProperty;var Qt=Object.getOwnPropertyDescriptor;var Yt=Object.getOwnPropertyNames;var Xt=Object.getPrototypeOf,er=Object.prototype.hasOwnProperty;var tr=t=>oe(t,"__esModule",{value:!0});var rr=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var or=(t,e,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Yt(e))!er.call(t,o)&&o!=="default"&&oe(t,o,{get:()=>e[o],enumerable:!(r=Qt(e,o))||r.enumerable});return t},ir=t=>or(tr(oe(t!=null?Jt(Xt(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var gt=rr(Y=>{(function(t,e){if(typeof define=="function"&&define.amd)define(["exports"],e);else if(typeof Y!="undefined")e(Y);else{var r={exports:{}};e(r.exports),t.index=r.exports}})(Y,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(b,O){return b.__proto__=O,b},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,b){a(this,p),this.type=d,this.path=b?b.toString():""},y=function(p){function d(b,O,h){var A;return a(this,d),A=r(this,i(d).call(this,"E",b)),A.lhs=O,A.rhs=h,A}return s(d,p),d}(m),w=function(p){function d(b,O,h,A){var $;return a(this,d),$=r(this,i(d).call(this,"M",b)),$.item=O,$.lhsIndex=h,$.rhsIndex=A,$}return s(d,p),d}(m),x=function(p){function d(b,O){var h;return a(this,d),h=r(this,i(d).call(this,"D",b)),h.lhs=O,h}return s(d,p),d}(m),v=function(p){function d(b,O){var h;return a(this,d),h=r(this,i(d).call(this,"A",b)),h.rhs=O,h}return s(d,p),d}(m),f=function(p,d){return p?"".concat(p,".").concat(d):d};t.diff=function(d,b){var O=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{},h=[],A=O.matchKey,$=O.types||["E","A","D","M"],Wt=function(F,g,E,j){F.forEach(function(L,k){var T=g.findIndex(function(M){return M[j]===L[j]});-1<T?(-1<$.indexOf("M")&&k!==T&&h.push(new w(E,L,k,T)),Z(L,g[T],f(E,T))):-1<$.indexOf("D")&&h.push(new x(E,L))}),g.forEach(function(L,k){var T=F.findIndex(function(M){return L[j]===M[j]});-1<$.indexOf("A")&&T===-1&&h.push(new v(f(E,k),L))})},Z=function(F,g,E){var j=Object.prototype.toString.call(F),L=Object.prototype.toString.call(g);if(-1<$.indexOf("E")&&j!==L)return h.push(new y(E,F,g)),!1;if(j==="[object Object]")Object.getOwnPropertyNames(F).forEach(function(M){Object.prototype.hasOwnProperty.call(g,M)?Z(F[M],g[M],f(E,M)):-1<$.indexOf("D")&&h.push(new x(f(E,M),F[M]))}),Object.getOwnPropertyNames(g).forEach(function(M){-1<$.indexOf("A")&&!Object.prototype.hasOwnProperty.call(F,M)&&h.push(new v(f(E,M),g[M]))});else if(j!=="[object Array]")-1<$.indexOf("E")&&F!==g&&h.push(new y(E,F,g));else if(A)Wt(F,g,E,A);else{var k=F.length-1,T=g.length-1;if(-1<$.indexOf("D"))for(;k>T;)h.push(new x(f(E,k),F[k--]));if(-1<$.indexOf("A"))for(;T>k;)h.push(new v(f(E,T),g[T--]));for(;0<=k;--k)Z(F[k],g[k],f(E,k))}};return Z(d,b),h}})});var n=(t="",e={})=>{throw new Error(`[joystick${t?`.${t}`:""}] ${e.message||e.reason||e}`)};var ue=["render"];var fe=(t={})=>{try{return ue.every(e=>Object.keys(t).includes(e))}catch(e){n("component.hasAllRequiredOptions",e)}};var he=["_componentId","_ssrId","api","dataFromSSR","existingProps","existingState","instanceId","parent","req","css","data","defaultProps","events","id","lifecycle","methods","name","props","render","state","translations","url","websockets","wrapper"];var we=t=>{try{return typeof t=="undefined"}catch(e){n("types.isUndefined",e)}},ye=t=>{try{return t===null}catch(e){n("types.isNull",e)}};var D=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 C=t=>{try{return typeof t=="string"}catch(e){n("types.isString",e)}};var xe=(t=null)=>{try{!C(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 ge=["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 be=(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(" ");ge.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 $e=["onBeforeMount","onMount","onUpdateProps","onBeforeUnmount","onRefetchData"];var Fe=(t=null)=>{try{u(t)||n("component.optionValidators.lifecycle","options.lifecycle must be an object.");for(let[e,r]of Object.entries(t))$e.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 ke=(t=null)=>{typeof t!="string"&&n("component.optionValidators.name","options.name must be a string.")};var Me=(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 Se=(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 Oe=(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"&&!C(r)&&n("component.optionValidators.wrapper",`options.wrapper.${e} must be assigned a string.`),e==="classList"&&!D(r)&&n("component.optionValidators.wrapper",`options.wrapper.${e} must be assigned an array of strings.`)}catch(e){n("component.optionValidators.wrapper",e)}};var Te={css:xe,events:be,lifecycle:Fe,methods:Ee,name:ke,render:Me,websockets:Se,wrapper:Oe};var ve=(t={})=>{try{fe(t)||n("component.validateOptions",`component options must include ${required.options.join(",")}.`);for(let[e,r]of Object.entries(t)){he.includes(e)||n("component.validateOptions",`${e} is not supported by joystick.component.`);let o=Te[e];o&&l(o)&&o(r)}}catch(e){n("component.validateOptions",e)}};var Ce="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890".split(""),U=(t=16)=>{let e="",r=0;for(;r<t;)e+=Ce[Math.floor(Math.random()*(Ce.length-1))],r+=1;return e};var B=(t=[],e="")=>{try{return(D(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 _=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}))$/,je=(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 De=/^((?:[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])+)\]))$/,_e=(t,e="")=>t===!0?!!e.match(De):!e.match(De);var Pe=(t,e="")=>t===e;var Ie=(t,e="")=>t===e;var Ne=(t,e="")=>e.length<=t;var Ve=(t,e="")=>e.length>=t;var Ue=/^[\+]?[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]{4,6}$/,qe=(t,e="")=>t===!0?!!e.match(Ue):!e.match(Ue);var He={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}$/},ze=(t,e="")=>{let r=_(t)&&t.iso?He[t.iso||"US"]:He.US;return _(t)?t.rule===!0?!!e.match(r):!e.match(r):t===!0?!!e.match(r):!e.match(r)};var Ze=(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 Be=/^(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-]+)*))?$/,Ge=(t,e="")=>t===!0?!!e.match(Be):!e.match(Be);var Ke=/^[a-z0-9]+(?:-[a-z0-9]+)*$/,We=(t,e="")=>t===!0?!!e.match(Ke):!e.match(Ke);var Je=/^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$ %^&*-]).{8,}$/,Qe=(t,e="")=>t===!0?!!e.match(Je):!e.match(Je);var Ye=/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()!@:%_\+.~#?&\/\/=]*)/,Xe=(t,e="")=>t===!0?!!e.match(Ye):!e.match(Ye);var et={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},tt=(t,e="")=>{let r=_(t)&&t.iso?et[t.iso||"EU"]:et.EU;return _(t)?t.rule===!0?!!e.match(r):!e.match(r):t===!0?!!e.match(r):!e.match(r)};var rt={creditCard:je,email:_e,equals:Pe,matches:Ie,maxLength:Ne,minLength:Ve,phone:qe,postalCode:ze,required:Ze,semVer:Ge,slug:We,strongPassword:Qe,url:Xe,vat:tt};var ot=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={required:()=>"This field is required.",email:()=>"Must be a valid email.",creditCard:()=>"Must be a valid credit card number.",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.",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.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]):{}}})}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){this.clearExistingErrors();let r=this.fields.find(o=>o.name===e);return 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=rt[o.name];return i?i(o.rule,r,{isChecked:e}):!0}clearExistingErrors(){this.form&&this.form.querySelectorAll(".input-hint.error").forEach(e=>e.remove())}clearExistingError(e=""){let r=document.getElementById(`error-${e}`);r&&r.remove()}renderError(e,r=""){if(e){this.clearExistingError(e.name);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)}}},nr=(t,e)=>new Promise((r,o)=>{try{new ot(t,e).validate()?r():o()}catch(i){console.warn(i)}}),it=nr;var nt=(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=!we(s)&&!ye(s);return o[i]=a?s:c,o},{})}catch(r){n("component.props.compile",r)}};var st=(t="",e={})=>{try{let r="";if(t&&C(t))return r=t,r;if(t&&l(t))return r=t(e),r;if(t&&u(t)){let o=t?.print&&(C(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),y=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
  }
5
- `),i&&s){let w=Object.entries(t?.min?.width);for(let g=0;g<w.length;g+=1){let[v,f]=w[g];r+=`
5
+ `),i&&s){let w=Object.entries(t?.min?.width);for(let x=0;x<w.length;x+=1){let[v,f]=w[x];r+=`
6
6
  @media screen and (min-width: ${v}px) {
7
7
  ${typeof f=="function"?f(e):f}
8
8
  }
9
- `}}if(i&&c){let w=Object.entries(t?.min?.height);for(let g=0;g<w.length;g+=1){let[v,f]=w[g];r+=`
9
+ `}}if(i&&c){let w=Object.entries(t?.min?.height);for(let x=0;x<w.length;x+=1){let[v,f]=w[x];r+=`
10
10
  @media screen and (min-height: ${v}px) {
11
11
  ${typeof f=="function"?f(e):f}
12
12
  }
13
- `}}if(a&&m){let w=Object.entries(t?.max?.width);for(let g=0;g<w.length;g+=1){let[v,f]=w[g];r+=`
13
+ `}}if(a&&m){let w=Object.entries(t?.max?.width);for(let x=0;x<w.length;x+=1){let[v,f]=w[x];r+=`
14
14
  @media screen and (max-width: ${v}px) {
15
15
  ${typeof f=="function"?f(e):f}
16
16
  }
17
- `}}if(a&&y){let w=Object.entries(t?.max?.height);for(let g=0;g<w.length;g+=1){let[v,f]=w[g];r+=`
17
+ `}}if(a&&y){let w=Object.entries(t?.max?.height);for(let x=0;x<w.length;x+=1){let[v,f]=w[x];r+=`
18
18
  @media screen and (max-height: ${v}px) {
19
19
  ${typeof f=="function"?f(e):f}
20
20
  }
21
- `}}return r}return""}catch(r){n("component.css.compileCSS",r)}};var sr=(t={},e=null)=>{try{let r=e(t);return r&&u(r)&&!_(r)?Object.assign({},r):{}}catch(r){n("component.state.compile.compileState",r)}},G=(t={},e={})=>{try{return l(e)?sr(t,e):Object.assign({},e)}catch(r){n("component.state.compile",r)}};var ie={onBeforeMount:()=>null,onMount:()=>null,onBeforeUnmount:()=>null,onUpdateProps:()=>null,onRefetchData:()=>null};var at=(t={},e={})=>{try{return e?Object.entries({...ie,...e||{}}).reduce((r={},[o,i])=>(r[o]=()=>i({...t,setState:t.setState.bind(t),...t.renderMethods||{}}),r),{}):ie}catch(r){n("component.lifecycle.compile",r)}};var K=(t={},e={})=>{try{return Object.entries(e).reduce((r={},[o,i])=>(r[o]=(...s)=>i(...s,{...t,setState:t.setState.bind(t),...t.renderMethods||{}}),r),{})}catch{n("component.methods.compile")}};var ne=(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="")=>C(e)&&t?.route!=="*"?e===(typeof location!="undefined"?location.pathname:t.path):!1}}catch(e){n("component.url.compile",e)}};var S=()=>typeof window=="undefined";var P=null,W=0,dt=(t={},e=null)=>{try{let r=t?.url;t?.query&&(r=`${r}?${new URLSearchParams(t.query).toString()}`);let o=new WebSocket(r);P&&(clearInterval(P),P=null);let i={client:o,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),W=0}),o.addEventListener("message",s=>{s?.data&&t?.events?.onMessage&&t.events.onMessage(JSON.parse(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),o=null;let c=[1e3,1001].includes(s?.code);t?.options?.autoReconnect&&!P&&!c&&(P=setInterval(()=>{o=null,W<(t?.options?.reconnectAttempts||12)?(dt(t,e),t?.options?.logging&&console.log(`[joystick.websockets] Attempting to reconnect (${W+1}/12)...`),W+=1):clearInterval(P)},t?.options?.reconnectDelayInSeconds*1e3||5e3))}),e&&e(i),i}catch(r){n("websockets.client",r)}},ct=dt;var ar=(t={},e=null)=>{try{let r=e(t);return r&&u(r)&&!_(r)?Object.assign({},r):{}}catch(r){n("component.props.compileDefaultProps.compile",r)}},lt=(t={},e={})=>{try{return l(e)?ar(t,e):Object.assign({},e)}catch(r){n("component.props.compileDefaultProps",r)}};var mt=(t={},e={})=>{try{t.options=e||{},t.id=e?._componentId||null,t.instanceId=U(8),t.ssrId=e?._ssrId||null,t.css=st(),t.data=B(e?.dataFromSSR,e?._componentId),t.defaultProps=lt(t,e?.defaultProps),t.props=nt(t?.defaultProps,e?.props),t.state=G(t,e?.state),t.events=e?.events||{},t.lifecycle=at(t,e?.lifecycle),t.methods=K(t,e?.methods),t.wrapper=e?.wrapper||{},t.translations=e?.translations||{},t.validateForm=it,t.DOMNode=null,t.dom={},t.dom.virtual={},t.dom.actual={};let r=!S();if(r||(t.url=ne(e?.url)),r&&window.__joystick_url__&&(t.url=ne(window.__joystick_url__)),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];ct({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 I=(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 J=(t="{}")=>{try{return JSON.parse(t)}catch{return t}};var pt=(t={})=>Object.entries(t).map(([e,r])=>`${e}=${r}`)?.join("; ");var dr=async(t={})=>{try{let e=await t.text();return J(e)}catch(e){n("api.get.handleParseResponse",e)}},ut=(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=pt({joystickLoginToken:window.__joystick_test_login_token__,joystickLoginTokenExpiresAt:window.__joystick_test_login_token_expires_at__})),fetch(c,{method:"GET",mode:"cors",headers:m,credentials:"include"}).then(async y=>{let w=await dr(y);return w?.errors?(I("get request",w.errors),o(w)):r(w)}).catch(y=>(I("get request",[y]),o({errors:[y]})))}):Promise.resolve()}catch(r){n("get request",r)}};var cr=async(t={})=>{try{let e=await t.text();return J(e)}catch(e){n("api.set.handleParseResponse",e)}},lr=(t={})=>{try{return JSON.stringify(t)}catch(e){n("api.set.getBody",e)}},ft=(t="",e={})=>{try{return typeof window.fetch!="undefined"?new Promise((r,o)=>{let i=`${window.location.origin}/api/_setters/${t}`,s=lr(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__})),fetch(i,{method:"POST",mode:"cors",headers:a,body:s,credentials:"include"}).then(async m=>{let y=await cr(m);return y?.errors?(I("set request",y.errors),o(y)):r(y)}).catch(m=>(I("set request",[m]),o({errors:[m]})))}):Promise.resolve()}catch(r){n("set request",r)}};var ht={get:ut,set:ft};var mr=(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)}},q=(t="",e=null)=>{try{S()||(mr(t)||{}).array.push({callback:e})}catch(r){n("addToQueue",r)}};var Q=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 wt=(t={},e={},r={})=>{try{return{...t,refetch:async(o={})=>{let i=await Q(ht,e,o,r);return r.data=wt(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)}},yt=wt;var gt=(t={})=>{try{if(!S()){let e=window.__joystick_data__&&window.__joystick_data__[t?.id]||{},r=window.__joystick_req__||{};return yt(e,r,t)}return t?.data||{}}catch(e){n("component.loadDataFromWindow",e)}};var Ft=ir(xt());var bt=(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 y=a[m],w=bt(y,e,r);if(w!==null)return w}}}return null}catch(o){n("component.findComponentInTreeByField",o)}},R=bt;var $t=(t="",e={},r=null)=>{let o=R(r||window.joystick._internal.tree,t,"instanceId");o&&(o.children=[...o.children||[],e])};var pr=(t={},e={},r=null)=>{try{let o=N(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)}},ur=(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)}},fr=(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)}},hr=(t={})=>{try{let e={id:t.id,instanceId:t.instanceId,instance:t,children:[]};$t(t.parent.instanceId,e,t.parent&&t.parent.ssrTree||null)}catch(e){n("component.renderMethods.component.handleAddComponentToParent",e)}},wr=(t={},e={})=>{try{!t.renderedComponent&&e.options&&e.options.lifecycle&&(e.options.lifecycle.onBeforeMount&&q("lifecycle.onBeforeMount",()=>{e.options.lifecycle.onBeforeMount(e)}),!t.renderedComponent&&e.options.lifecycle.onMount&&q("lifecycle.onMount",()=>{e.options.lifecycle.onMount(e)}))}catch(r){n("component.renderMethods.component.handleLifecycle",r)}},yr=(t={},e={},r={})=>{try{!e.walkingTreeForSSR&&t?.options?.lifecycle?.onUpdateProps&&(0,Ft.diff)(e?.existingPropsMap,r)?.length>0&&q("lifecycle.onUpdateProps",()=>{let i=e?.existingPropsMap&&e?.existingPropsMap[t.id];t.options.lifecycle.onUpdateProps(i||{},r,t)})}catch(o){n("component.renderMethods.component.handleOnChangeProps",o)}},gr=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,yr(i,o,r),q("lifecycle.onMount",()=>{i.setDOMNodeOnInstance()}),wr(this,i),i.parent&&hr(i),i.options.data&&i.parent.walkingTreeForSSR&&i.parent.ssrTree.dataFunctions?fr(i):i.parent&&i.parent.ssrTree?ur(i):pr(i,this,a?.children)}},xr=function(e,r){try{let o=this;return new gr().bind({})(e,r,o)}catch(o){n("component.renderMethods.component",o)}},se=xr;var br=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)}},ae=br;var $r=(t="",e=[])=>{try{return e.reduce((r,[o,i])=>r.replace(`{{${o}}}`,i),t)}catch(r){n("component.renderMethods.i18n.replacePlaceholdersInString",r)}},de=(t="",e=[])=>{try{let r=typeof t=="string",o=Array.isArray(t),i=typeof t=="object"&&!o;if(r)return $r(t,e);if(o)return t?.map(s=>de(s,e));if(i)return Object.entries(t)?.reduce((s={},[c,a])=>(s[c]=de(a,e),s),{})}catch(r){n("component.renderMethods.i18n.handleTranslationReplacement",r)}},Fr=(t="",e={})=>{try{return t?.split(".").reduce((r,o)=>(console.log({key:t,objectToTraverse:r,keyToMatch:o}),r[o]),e)}catch(r){n("component.renderMethods.i18n.getTranslationAtPath",r)}},Er=function(t="",e={}){try{let r=S()?this.translations:window.__joystick_i18n__,i=t?.includes(".")?Fr(t,r):r[t];if(t?.includes("creatorDashboard")&&console.log({key:t,replacements:e,translation:i,translations:r}),!r||!i)return"";let s=Object.entries(e);return de(i,s)}catch(r){n("component.renderMethods.i18n",r)}},ce=Er;var Mr=function(e=!1,r=""){try{return this?.renderingHTMLWithDataForSSR||e?`<when>${r.trim()}</when>`:"<when> </when>"}catch(o){n("component.renderMethods.when",o)}},le=Mr;var Et={c:se,component:se,e:ae,each:ae,i:ce,i18n:ce,w:le,when:le};var Mt=(t={},e={})=>{try{return Object.entries(Et).reduce((r,[o,i])=>(r[o]=i.bind({...t,...e}),r),{})}catch(r){n("component.renderMethods.compile",r)}};var kt=(t={})=>{try{return Object.entries(t)?.reduce((e={},[r,o]={})=>(e[r]=o?.map((i={})=>({state:i?.state,children:kt(i?.children)})),e),{})}catch(e){n("component.render.getExistingStateMap.buildMapForChildren",e)}},St=(t={})=>{try{return kt(t)}catch(e){n("component.render.getExistingStateMap",e)}};var Ot=new RegExp(/\<\!\-\-(?:.|\n|\r)*?-->/g),kr=new RegExp(/\n/g);var Sr=(t="")=>{try{return(t.match(Ot)||[]).forEach(r=>{t=t.replace(r,"")}),t}catch(e){n("component.render.sanitizeHTML.removeCommentedCode",e)}},Tt=(t="")=>{try{let e=`${t}`;return e=Sr(e),e}catch(e){n("component.render.sanitizeHTML",e)}};var vt=(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 Ct=(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&&Ct(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)}},Rt=Ct;var X=(t={},e={})=>{try{e?.dataFromSSR&&(t.data=B(e.dataFromSSR,t.id)||{}),Rt(t?.children);let r=St(e?.existingChildren||t?.children)||{};t.children={},t.renderMethods=Mt({...t,existingStateMap:r,translations:e?.translations||t.translations||{},ssrTree:e?.ssrTree,walkingTreeForSSR:e?.walkingTreeForSSR,renderingHTMLWithDataForSSR:e?.renderingHTMLWithDataForSSR,dataFromSSR:e?.dataFromSSR}),t.methods=K(t,t.options.methods);let o=t.options.render({...t||{},setState:t.setState.bind(t),...t.renderMethods||{}}),i=Tt(o),s=vt(t,i);return{unwrapped:i,wrapped:s}}catch(r){n("component.render.toHTML",r)}};var Or=(t={})=>{try{return Object.values(t).reduce((e={},r)=>(e[r.name]=r.value,e),{})}catch(e){n("component.virtualDOM.build.parseAttributeMap",e)}},At=(t={})=>{try{return t.tagName==="WHEN"?[].flatMap.call(t?.childNodes,e=>e?.tagName==="WHEN"?At(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:Or(t.attributes),children:[].flatMap.call(t.childNodes,o=>At(o))};return e==="text"&&(r=t.textContent),r}catch(e){n("component.virtualDOM.build",e)}},H=me;var Tr=(t="")=>{try{let e=document.createElement("div");return e.innerHTML=t,e?.childNodes[0]}catch(e){n("component.virtualDOM.build.convertHTMLToDOM",e)}},Lt=(t="")=>{try{let e=Tr(t);return H(e)}catch(e){n("component.virtualDOM.build",e)}};var Dt=(t="")=>{try{return document.createElement("div").setAttribute(t,"Test"),!0}catch{return!1}};var vr=(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];Dt(i)&&e.setAttribute(i,s)}for(let o=0;o<t?.children?.length;o+=1){let i=t?.children[o];if(i){let s=_t(i);e.appendChild(s)}}return e}catch(e){n("component.virtualDOM.renderTreeToDOM.renderElement",e)}},_t=(t=null)=>{try{return C(t)?document.createTextNode(t):vr(t)}catch(e){n("component.virtualDOM.renderTreeToDOM",e)}},V=_t;var N=(t={},e={})=>{try{let r=X(t,{existingChildren:e?.existingChildren}),o=Lt(r.wrapped,t),i=e.includeActual&&o?V(o):null;return{html:r,virtual:o,actual:i}}catch(r){n("component.render.getUpdatedDOM",r)}};var jt=(t={},e={})=>{try{let r=N(t,{includeActual:!0,existingChildren:e?.existingChildren});return t.dom=r,r.actual}catch(r){n("component.render.forMount",r)}};var Cr=(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)}},ee=Cr;var Rr=(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},Pt=Rr;var Ar=(t=[],e)=>{t.forEach(r=>{r&&typeof r=="function"&&r(e)})},Lr=(t=[])=>{t.forEach(([e,r])=>{e&&typeof e=="function"&&e(r)})},Dr=(t=[],e=[])=>{let r=[];return e.slice(t.length).forEach(i=>{let s=c=>{let a=V(i);return c.appendChild(a),c};r.push(s)}),r},_r=(t=[],e=[])=>{let r=[];return t.forEach((o,i)=>{let s=re(o,e[i]);r.push(s)}),r},jr=(t=[],e=[])=>{let r=_r(t,e),o=Dr(t,e);return i=>{if(i){let s=Pt(r,i.childNodes);Lr(s),Ar(o,i)}return i}},te=jr;var It={select:(t,e)=>r=>{let o=r.value;r.replaceChildren(),ee(t.attributes,e.attributes)(r),te([],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?V(t):null;return r&&r.replaceWith(o),o},Pr=()=>t=>{t&&t.remove()},Ir=(t=void 0,e=void 0)=>t===void 0||e===void 0?Pr():typeof t=="string"||typeof e=="string"?pe(e,t):t.tagName!==e.tagName?pe(e):e.tagName==="select"?It.select(t,e):["pre","code"].includes(e.tagName)?pe(e,t):i=>(ee(t.attributes,e.attributes)(i),te(t.children,e.children)(i),i),re=Ir;var Nr=(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)}},z=(t="",e=null)=>{try{S()||(Nr(t)||{}).process(e)}catch(r){n("processQueue",r)}};var Nt=(t="",e=null)=>{let r=R(e||window.joystick._internal.tree,t,"instanceId");r&&(r.children=[])};var Vt=(t="",e={},r=null)=>{let o=R(r||window.joystick._internal.tree,t,"instanceId");o&&(o.instanceId=e?.instanceId,o.instance=e)};var Ut=(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)&&Ut(i,e,r)}},qt=Ut;var Ht=(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 zt=(t={},e={},r=[])=>{try{let o=Object.keys(t?.events||{})?.length>0?Ht(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||{}})}})}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];zt(c,e,r)}}return r}catch(o){n("component.eve!nts.registerListenersFix.getListeners",o)}},Vr=(t={},e={})=>{try{let o=zt(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:y}=o[i];c.addEventListener(m,y),s._eventListeners=[...s?._eventListeners||[],{instance:s,element:c,elementSelector:a,type:m,handler:y}]}}catch(r){n("component.events.registerListenersFix",r)}},Zt=Vr;var Bt=(t={})=>{try{let e=t?._eventListeners||[];if(t?.children){let o=(Object.values(t?.children||{})?.reduce((i=[],s=[])=>[...i,...s],[])).flatMap((i={})=>Bt(i));e=[...e,...o]}return e}catch(e){n("component.events.unregisterListenersFix.getListeners",e)}},Ur=(t={})=>{try{let e=Bt(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)}},Gt=Ur;var Kt=class{constructor(e={}){this.parent=e?.parent||null,this.onUpdateChildComponent=this.handleUpdateChildComponentInVDOM,this.updateVirtualDOM=this.handleUpdateVirtualDOM,this.timers={},this.children={},ve(e),mt(this,e),this.data=gt(this)}setDOMNodeOnInstance(){this.DOMNode=document.querySelector(`body [js-i="${this.instanceId}"]`)}async handleFetchData(e={},r={},o={},i=this){let s=await Q(e,r,o,i);return this.data=s,s}handleGetInstance(){return this}handleUpdateVirtualDOM(){if(this.DOMNode){let r=H(this.DOMNode);this.dom.virtual=r}let e=this.parent?R(window.joystick._internal.tree,this.parent?.instanceId,"instanceId"):null;e?.instance&&e.instance.updateVirtualDOM()}onBeforeRender(){if(!S())return{instanceId:this.instanceId}}render(e={}){if(e?.mounting)return jt(this,e);let r=this.onBeforeRender();Gt(this),Nt(this.instanceId);let o=N(this,{}),i=re(this.dom.virtual,o.virtual);i&&l(i)&&z("lifecycle.onBeforeMount",()=>{let s=i(this.DOMNode);this.dom.actual=s,this.dom.virtual=o.virtual,Zt(this,this.renderMethods),this.setDOMNodeOnInstance(),z("domNodes",()=>{z("lifecycle.onMount",()=>{this.onAfterRender(r,e)})})})}renderToHTML(e={}){return X(this,e)}onAfterRender(e={},r={}){S()||(Vt(e.instanceId,this),window.joystick._internal.css.update(),z("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){this.state=G(this,{...this.state||{},...e}),this.render({afterSetStateRender:()=>{r&&l(r)&&r()}})}setTimeout(e=null,r=0){e&&(this.timers[U()]=window.setTimeout(e,r))}setInterval(e=null,r=0){e&&(this.timers[U()]=window.setInterval(e,r))}handleUpdateChildComponentInVDOM(e="",r=""){let o=R(window.joystick._internal.tree,this.instanceId,"instanceId"),i=R(window.joystick._internal.tree,r,"instanceId");if(i?.instance?.DOMNode){let s=H(i?.instance?.DOMNode);qt(o?.instance?.dom?.virtual,i?.instanceId,s)}}},rd=Kt;export{rd as default};
21
+ `}}return r}return""}catch(r){n("component.css.compileCSS",r)}};var sr=(t={},e=null)=>{try{let r=e(t);return r&&u(r)&&!D(r)?Object.assign({},r):{}}catch(r){n("component.state.compile.compileState",r)}},G=(t={},e={})=>{try{return l(e)?sr(t,e):Object.assign({},e)}catch(r){n("component.state.compile",r)}};var ie={onBeforeMount:()=>null,onMount:()=>null,onBeforeUnmount:()=>null,onUpdateProps:()=>null,onRefetchData:()=>null};var at=(t={},e={})=>{try{return e?Object.entries({...ie,...e||{}}).reduce((r={},[o,i])=>(r[o]=()=>i({...t,setState:t.setState.bind(t),...t.renderMethods||{}}),r),{}):ie}catch(r){n("component.lifecycle.compile",r)}};var K=(t={},e={})=>{try{return Object.entries(e).reduce((r={},[o,i])=>(r[o]=(...s)=>i(...s,{...t,setState:t.setState.bind(t),...t.renderMethods||{}}),r),{})}catch{n("component.methods.compile")}};var ne=(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="")=>C(e)&&t?.route!=="*"?e===(typeof location!="undefined"?location.pathname:t.path):!1}}catch(e){n("component.url.compile",e)}};var S=()=>typeof window=="undefined";var P=null,W=0,dt=(t={},e=null)=>{try{let r=t?.url;t?.query&&(r=`${r}?${new URLSearchParams(t.query).toString()}`);let o=new WebSocket(r);P&&(clearInterval(P),P=null);let i={client:o,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),W=0}),o.addEventListener("message",s=>{s?.data&&t?.events?.onMessage&&t.events.onMessage(JSON.parse(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),o=null;let c=[1e3,1001].includes(s?.code);t?.options?.autoReconnect&&!P&&!c&&(P=setInterval(()=>{o=null,W<(t?.options?.reconnectAttempts||12)?(dt(t,e),t?.options?.logging&&console.log(`[joystick.websockets] Attempting to reconnect (${W+1}/12)...`),W+=1):clearInterval(P)},t?.options?.reconnectDelayInSeconds*1e3||5e3))}),e&&e(i),i}catch(r){n("websockets.client",r)}},ct=dt;var ar=(t={},e=null)=>{try{let r=e(t);return r&&u(r)&&!D(r)?Object.assign({},r):{}}catch(r){n("component.props.compileDefaultProps.compile",r)}},lt=(t={},e={})=>{try{return l(e)?ar(t,e):Object.assign({},e)}catch(r){n("component.props.compileDefaultProps",r)}};var mt=(t={},e={})=>{try{t.options=e||{},t.id=e?._componentId||null,t.instanceId=U(8),t.ssrId=e?._ssrId||null,t.css=st(),t.data=B(e?.dataFromSSR,e?._componentId),t.defaultProps=lt(t,e?.defaultProps),t.props=nt(t?.defaultProps,e?.props),t.state=G(t,e?.state),t.events=e?.events||{},t.lifecycle=at(t,e?.lifecycle),t.methods=K(t,e?.methods),t.wrapper=e?.wrapper||{},t.translations=e?.translations||{},t.validateForm=it,t.DOMNode=null,t.dom={},t.dom.virtual={},t.dom.actual={};let r=!S();if(r||(t.url=ne(e?.url)),r&&window.__joystick_url__&&(t.url=ne(window.__joystick_url__)),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];ct({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 I=(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 J=(t="{}")=>{try{return JSON.parse(t)}catch{return t}};var pt=(t={})=>Object.entries(t).map(([e,r])=>`${e}=${r}`)?.join("; ");var dr=async(t={})=>{try{let e=await t.text();return J(e)}catch(e){n("api.get.handleParseResponse",e)}},ut=(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=pt({joystickLoginToken:window.__joystick_test_login_token__,joystickLoginTokenExpiresAt:window.__joystick_test_login_token_expires_at__})),fetch(c,{method:"GET",mode:"cors",headers:m,credentials:"include"}).then(async y=>{let w=await dr(y);return w?.errors?(I("get request",w.errors),o(w)):r(w)}).catch(y=>(I("get request",[y]),o({errors:[y]})))}):Promise.resolve()}catch(r){n("get request",r)}};var cr=async(t={})=>{try{let e=await t.text();return J(e)}catch(e){n("api.set.handleParseResponse",e)}},lr=(t={})=>{try{return JSON.stringify(t)}catch(e){n("api.set.getBody",e)}},ft=(t="",e={})=>{try{return typeof window.fetch!="undefined"?new Promise((r,o)=>{let i=`${window.location.origin}/api/_setters/${t}`,s=lr(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__})),fetch(i,{method:"POST",mode:"cors",headers:a,body:s,credentials:"include"}).then(async m=>{let y=await cr(m);return y?.errors?(I("set request",y.errors),o(y)):r(y)}).catch(m=>(I("set request",[m]),o({errors:[m]})))}):Promise.resolve()}catch(r){n("set request",r)}};var ht={get:ut,set:ft};var mr=(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)}},q=(t="",e=null)=>{try{S()||(mr(t)||{}).array.push({callback:e})}catch(r){n("addToQueue",r)}};var Q=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 wt=(t={},e={},r={})=>{try{return{...t,refetch:async(o={})=>{let i=await Q(ht,e,o,r);return r.data=wt(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)}},yt=wt;var xt=(t={})=>{try{if(!S()){let e=window.__joystick_data__&&window.__joystick_data__[t?.id]||{},r=window.__joystick_req__||{};return yt(e,r,t)}return t?.data||{}}catch(e){n("component.loadDataFromWindow",e)}};var Ft=ir(gt());var bt=(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 y=a[m],w=bt(y,e,r);if(w!==null)return w}}}return null}catch(o){n("component.findComponentInTreeByField",o)}},R=bt;var $t=(t="",e={},r=null)=>{let o=R(r||window.joystick._internal.tree,t,"instanceId");o&&(o.children=[...o.children||[],e])};var pr=(t={},e={},r=null)=>{try{let o=N(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)}},ur=(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)}},fr=(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)}},hr=(t={})=>{try{let e={id:t.id,instanceId:t.instanceId,instance:t,children:[]};$t(t.parent.instanceId,e,t.parent&&t.parent.ssrTree||null)}catch(e){n("component.renderMethods.component.handleAddComponentToParent",e)}},wr=(t={},e={})=>{try{!t.renderedComponent&&e.options&&e.options.lifecycle&&(e.options.lifecycle.onBeforeMount&&q("lifecycle.onBeforeMount",()=>{e.options.lifecycle.onBeforeMount(e)}),!t.renderedComponent&&e.options.lifecycle.onMount&&q("lifecycle.onMount",()=>{e.options.lifecycle.onMount(e)}))}catch(r){n("component.renderMethods.component.handleLifecycle",r)}},yr=(t={},e={},r={})=>{try{!e.walkingTreeForSSR&&t?.options?.lifecycle?.onUpdateProps&&(0,Ft.diff)(e?.existingPropsMap,r)?.length>0&&q("lifecycle.onUpdateProps",()=>{let i=e?.existingPropsMap&&e?.existingPropsMap[t.id];t.options.lifecycle.onUpdateProps(i||{},r,t)})}catch(o){n("component.renderMethods.component.handleOnChangeProps",o)}},xr=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,yr(i,o,r),q("lifecycle.onMount",()=>{i.setDOMNodeOnInstance()}),wr(this,i),i.parent&&hr(i),i.options.data&&i.parent.walkingTreeForSSR&&i.parent.ssrTree.dataFunctions?fr(i):i.parent&&i.parent.ssrTree?ur(i):pr(i,this,a?.children)}},gr=function(e,r){try{let o=this;return new xr().bind({})(e,r,o)}catch(o){n("component.renderMethods.component",o)}},se=gr;var br=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)}},ae=br;var $r=(t="",e=[])=>{try{return e.reduce((r,[o,i])=>r.replace(`{{${o}}}`,i),t)}catch(r){n("component.renderMethods.i18n.replacePlaceholdersInString",r)}},de=(t="",e=[])=>{try{let r=typeof t=="string",o=Array.isArray(t),i=typeof t=="object"&&!o;if(r)return $r(t,e);if(o)return t?.map(s=>de(s,e));if(i)return Object.entries(t)?.reduce((s={},[c,a])=>(s[c]=de(a,e),s),{})}catch(r){n("component.renderMethods.i18n.handleTranslationReplacement",r)}},Fr=(t="",e={})=>{try{return t?.split(".").reduce((r,o)=>r[o],e)}catch(r){n("component.renderMethods.i18n.getTranslationAtPath",r)}},Er=function(t="",e={}){try{let r=S()?this.translations:window.__joystick_i18n__,i=t?.includes(".")?Fr(t,r):r[t];if(!r||!i)return"";let s=Object.entries(e);return de(i,s)}catch(r){n("component.renderMethods.i18n",r)}},ce=Er;var kr=function(e=!1,r=""){try{return this?.renderingHTMLWithDataForSSR||e?`<when>${r.trim()}</when>`:"<when> </when>"}catch(o){n("component.renderMethods.when",o)}},le=kr;var Et={c:se,component:se,e:ae,each:ae,i:ce,i18n:ce,w:le,when:le};var kt=(t={},e={})=>{try{return Object.entries(Et).reduce((r,[o,i])=>(r[o]=i.bind({...t,...e}),r),{})}catch(r){n("component.renderMethods.compile",r)}};var Mt=(t={})=>{try{return Object.entries(t)?.reduce((e={},[r,o]={})=>(e[r]=o?.map((i={})=>({state:i?.state,children:Mt(i?.children)})),e),{})}catch(e){n("component.render.getExistingStateMap.buildMapForChildren",e)}},St=(t={})=>{try{return Mt(t)}catch(e){n("component.render.getExistingStateMap",e)}};var Ot=new RegExp(/\<\!\-\-(?:.|\n|\r)*?-->/g),Mr=new RegExp(/\n/g);var Sr=(t="")=>{try{return(t.match(Ot)||[]).forEach(r=>{t=t.replace(r,"")}),t}catch(e){n("component.render.sanitizeHTML.removeCommentedCode",e)}},Tt=(t="")=>{try{let e=`${t}`;return e=Sr(e),e}catch(e){n("component.render.sanitizeHTML",e)}};var vt=(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 Ct=(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&&Ct(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)}},Rt=Ct;var X=(t={},e={})=>{try{e?.dataFromSSR&&(t.data=B(e.dataFromSSR,t.id)||{}),Rt(t?.children);let r=St(e?.existingChildren||t?.children)||{};t.children={},t.renderMethods=kt({...t,existingStateMap:r,translations:e?.translations||t.translations||{},ssrTree:e?.ssrTree,walkingTreeForSSR:e?.walkingTreeForSSR,renderingHTMLWithDataForSSR:e?.renderingHTMLWithDataForSSR,dataFromSSR:e?.dataFromSSR}),t.methods=K(t,t.options.methods);let o=t.options.render({...t||{},setState:t.setState.bind(t),...t.renderMethods||{}}),i=Tt(o),s=vt(t,i);return{unwrapped:i,wrapped:s}}catch(r){n("component.render.toHTML",r)}};var Or=(t={})=>{try{return Object.values(t).reduce((e={},r)=>(e[r.name]=r.value,e),{})}catch(e){n("component.virtualDOM.build.parseAttributeMap",e)}},At=(t={})=>{try{return t.tagName==="WHEN"?[].flatMap.call(t?.childNodes,e=>e?.tagName==="WHEN"?At(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:Or(t.attributes),children:[].flatMap.call(t.childNodes,o=>At(o))};return e==="text"&&(r=t.textContent),r}catch(e){n("component.virtualDOM.build",e)}},H=me;var Tr=(t="")=>{try{let e=document.createElement("div");return e.innerHTML=t,e?.childNodes[0]}catch(e){n("component.virtualDOM.build.convertHTMLToDOM",e)}},Lt=(t="")=>{try{let e=Tr(t);return H(e)}catch(e){n("component.virtualDOM.build",e)}};var jt=(t="")=>{try{return document.createElement("div").setAttribute(t,"Test"),!0}catch{return!1}};var vr=(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];jt(i)&&e.setAttribute(i,s)}for(let o=0;o<t?.children?.length;o+=1){let i=t?.children[o];if(i){let s=Dt(i);e.appendChild(s)}}return e}catch(e){n("component.virtualDOM.renderTreeToDOM.renderElement",e)}},Dt=(t=null)=>{try{return C(t)?document.createTextNode(t):vr(t)}catch(e){n("component.virtualDOM.renderTreeToDOM",e)}},V=Dt;var N=(t={},e={})=>{try{let r=X(t,{existingChildren:e?.existingChildren}),o=Lt(r.wrapped,t),i=e.includeActual&&o?V(o):null;return{html:r,virtual:o,actual:i}}catch(r){n("component.render.getUpdatedDOM",r)}};var _t=(t={},e={})=>{try{let r=N(t,{includeActual:!0,existingChildren:e?.existingChildren});return t.dom=r,r.actual}catch(r){n("component.render.forMount",r)}};var Cr=(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)}},ee=Cr;var Rr=(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},Pt=Rr;var Ar=(t=[],e)=>{t.forEach(r=>{r&&typeof r=="function"&&r(e)})},Lr=(t=[])=>{t.forEach(([e,r])=>{e&&typeof e=="function"&&e(r)})},jr=(t=[],e=[])=>{let r=[];return e.slice(t.length).forEach(i=>{let s=c=>{let a=V(i);return c.appendChild(a),c};r.push(s)}),r},Dr=(t=[],e=[])=>{let r=[];return t.forEach((o,i)=>{let s=re(o,e[i]);r.push(s)}),r},_r=(t=[],e=[])=>{let r=Dr(t,e),o=jr(t,e);return i=>{if(i){let s=Pt(r,i.childNodes);Lr(s),Ar(o,i)}return i}},te=_r;var It={select:(t,e)=>r=>{let o=r.value;r.replaceChildren(),ee(t.attributes,e.attributes)(r),te([],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?V(t):null;return r&&r.replaceWith(o),o},Pr=()=>t=>{t&&t.remove()},Ir=(t=void 0,e=void 0)=>t===void 0||e===void 0?Pr():typeof t=="string"||typeof e=="string"?pe(e,t):t.tagName!==e.tagName?pe(e):e.tagName==="select"?It.select(t,e):["pre","code"].includes(e.tagName)?pe(e,t):i=>(ee(t.attributes,e.attributes)(i),te(t.children,e.children)(i),i),re=Ir;var Nr=(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)}},z=(t="",e=null)=>{try{S()||(Nr(t)||{}).process(e)}catch(r){n("processQueue",r)}};var Nt=(t="",e=null)=>{let r=R(e||window.joystick._internal.tree,t,"instanceId");r&&(r.children=[])};var Vt=(t="",e={},r=null)=>{let o=R(r||window.joystick._internal.tree,t,"instanceId");o&&(o.instanceId=e?.instanceId,o.instance=e)};var Ut=(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)&&Ut(i,e,r)}},qt=Ut;var Ht=(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 zt=(t={},e={},r=[])=>{try{let o=Object.keys(t?.events||{})?.length>0?Ht(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||{}})}})}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];zt(c,e,r)}}return r}catch(o){n("component.eve!nts.registerListenersFix.getListeners",o)}},Vr=(t={},e={})=>{try{let o=zt(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:y}=o[i];c.addEventListener(m,y),s._eventListeners=[...s?._eventListeners||[],{instance:s,element:c,elementSelector:a,type:m,handler:y}]}}catch(r){n("component.events.registerListenersFix",r)}},Zt=Vr;var Bt=(t={})=>{try{let e=t?._eventListeners||[];if(t?.children){let o=(Object.values(t?.children||{})?.reduce((i=[],s=[])=>[...i,...s],[])).flatMap((i={})=>Bt(i));e=[...e,...o]}return e}catch(e){n("component.events.unregisterListenersFix.getListeners",e)}},Ur=(t={})=>{try{let e=Bt(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)}},Gt=Ur;var Kt=class{constructor(e={}){this.parent=e?.parent||null,this.onUpdateChildComponent=this.handleUpdateChildComponentInVDOM,this.updateVirtualDOM=this.handleUpdateVirtualDOM,this.timers={},this.children={},ve(e),mt(this,e),this.data=xt(this)}setDOMNodeOnInstance(){this.DOMNode=document.querySelector(`body [js-i="${this.instanceId}"]`)}async handleFetchData(e={},r={},o={},i=this){let s=await Q(e,r,o,i);return this.data=s,s}handleGetInstance(){return this}handleUpdateVirtualDOM(){if(this.DOMNode){let r=H(this.DOMNode);this.dom.virtual=r}let e=this.parent?R(window.joystick._internal.tree,this.parent?.instanceId,"instanceId"):null;e?.instance&&e.instance.updateVirtualDOM()}onBeforeRender(){if(!S())return{instanceId:this.instanceId}}render(e={}){if(e?.mounting)return _t(this,e);let r=this.onBeforeRender();Gt(this),Nt(this.instanceId);let o=N(this,{}),i=re(this.dom.virtual,o.virtual);i&&l(i)&&z("lifecycle.onBeforeMount",()=>{let s=i(this.DOMNode);this.dom.actual=s,this.dom.virtual=o.virtual,Zt(this,this.renderMethods),this.setDOMNodeOnInstance(),z("domNodes",()=>{z("lifecycle.onMount",()=>{this.onAfterRender(r,e)})})})}renderToHTML(e={}){return X(this,e)}onAfterRender(e={},r={}){S()||(Vt(e.instanceId,this),window.joystick._internal.css.update(),z("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){this.state=G(this,{...this.state||{},...e}),this.render({afterSetStateRender:()=>{r&&l(r)&&r()}})}setTimeout(e=null,r=0){e&&(this.timers[U()]=window.setTimeout(e,r))}setInterval(e=null,r=0){e&&(this.timers[U()]=window.setInterval(e,r))}handleUpdateChildComponentInVDOM(e="",r=""){let o=R(window.joystick._internal.tree,this.instanceId,"instanceId"),i=R(window.joystick._internal.tree,r,"instanceId");if(i?.instance?.DOMNode){let s=H(i?.instance?.DOMNode);qt(o?.instance?.dom?.virtual,i?.instanceId,s)}}},rd=Kt;export{rd as default};
@@ -1 +1 @@
1
- var wr=Object.create;var v=Object.defineProperty;var yr=Object.getOwnPropertyDescriptor;var xr=Object.getOwnPropertyNames;var Mr=Object.getPrototypeOf,gr=Object.prototype.hasOwnProperty;var Tr=r=>v(r,"__esModule",{value:!0});var Fr=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var Or=(r,e,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of xr(e))!gr.call(r,o)&&o!=="default"&&v(r,o,{get:()=>e[o],enumerable:!(t=yr(e,o))||t.enumerable});return r},Sr=r=>Or(Tr(v(r!=null?wr(Mr(r)):{},"default",r&&r.__esModule&&"default"in r?{get:()=>r.default,enumerable:!0}:{value:r,enumerable:!0})),r);var Q=Fr(R=>{(function(r,e){if(typeof define=="function"&&define.amd)define(["exports"],e);else if(typeof R!="undefined")e(R);else{var t={exports:{}};e(t.exports),r.index=t.exports}})(R,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():""},k=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),C=function(a){function c(p,g,d,F){var h;return l(this,c),h=t(this,n(c).call(this,"M",p)),h.item=g,h.lhsIndex=d,h.rhsIndex=F,h}return s(c,a),c}(M),A=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),N=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),S=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,h=g.types||["E","A","D","M"],mr=function(f,u,w,b){f.forEach(function(O,y){var T=u.findIndex(function(x){return x[b]===O[b]});-1<T?(-1<h.indexOf("M")&&y!==T&&d.push(new C(w,O,y,T)),D(O,u[T],S(w,T))):-1<h.indexOf("D")&&d.push(new A(w,O))}),u.forEach(function(O,y){var T=f.findIndex(function(x){return O[b]===x[b]});-1<h.indexOf("A")&&T===-1&&d.push(new N(S(w,y),O))})},D=function(f,u,w){var b=Object.prototype.toString.call(f),O=Object.prototype.toString.call(u);if(-1<h.indexOf("E")&&b!==O)return d.push(new k(w,f,u)),!1;if(b==="[object Object]")Object.getOwnPropertyNames(f).forEach(function(x){Object.prototype.hasOwnProperty.call(u,x)?D(f[x],u[x],S(w,x)):-1<h.indexOf("D")&&d.push(new A(S(w,x),f[x]))}),Object.getOwnPropertyNames(u).forEach(function(x){-1<h.indexOf("A")&&!Object.prototype.hasOwnProperty.call(f,x)&&d.push(new N(S(w,x),u[x]))});else if(b!=="[object Array]")-1<h.indexOf("E")&&f!==u&&d.push(new k(w,f,u));else if(F)mr(f,u,w,F);else{var y=f.length-1,T=u.length-1;if(-1<h.indexOf("D"))for(;y>T;)d.push(new A(S(w,y),f[y--]));if(-1<h.indexOf("A"))for(;T>y;)d.push(new N(S(w,T),u[T--]));for(;0<=y;--y)D(f[y],u[y],S(w,y))}};return D(c,p),d}})});var i=(r="",e={})=>{throw new Error(`[joystick${r?`.${r}`:""}] ${e.message||e.reason||e}`)};var q=r=>{try{return!!Array.isArray(r)}catch(e){i("types.isArray",e)}};var B=r=>{try{return typeof r=="function"}catch(e){i("types.isFunction",e)}};var W=r=>{try{return!!(r&&typeof r=="object"&&!Array.isArray(r))}catch(e){i("types.isObject",e)}};var z=r=>{try{return typeof r=="string"}catch(e){i("types.isString",e)}};var G=(r=[],e="")=>{try{return(q(r)&&r.find(o=>o?.componentId===e))?.data||{}}catch(t){i("findComponentDataFromSSR",t)}};var J=Sr(Q());var j=()=>typeof window=="undefined";var br=(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)}},E=(r="",e=null)=>{try{j()||(br(r)||{}).array.push({callback:e})}catch(t){i("addToQueue",t)}};var V=(r={},e="",t="id")=>{try{let o=r&&r.id;if(W(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 k=l[M],C=V(k,e,t);if(C!==null)return C}}}return null}catch(o){i("component.findComponentInTreeByField",o)}},K=V;var X=(r="",e={},t=null)=>{let o=K(t||window.joystick._internal.tree,r,"instanceId");o&&(o.children=[...o.children||[],e])};var Er=(r={},e={},t=null)=>{try{let o=L(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)}},kr=(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)}},Cr=(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)}},Dr=(r={})=>{try{let e={id:r.id,instanceId:r.instanceId,instance:r,children:[]};X(r.parent.instanceId,e,r.parent&&r.parent.ssrTree||null)}catch(e){i("component.renderMethods.component.handleAddComponentToParent",e)}},Rr=(r={},e={})=>{try{!r.renderedComponent&&e.options&&e.options.lifecycle&&(e.options.lifecycle.onBeforeMount&&E("lifecycle.onBeforeMount",()=>{e.options.lifecycle.onBeforeMount(e)}),!r.renderedComponent&&e.options.lifecycle.onMount&&E("lifecycle.onMount",()=>{e.options.lifecycle.onMount(e)}))}catch(t){i("component.renderMethods.component.handleLifecycle",t)}},jr=(r={},e={},t={})=>{try{!e.walkingTreeForSSR&&r?.options?.lifecycle?.onUpdateProps&&(0,J.diff)(e?.existingPropsMap,t)?.length>0&&E("lifecycle.onUpdateProps",()=>{let n=e?.existingPropsMap&&e?.existingPropsMap[r.id];r.options.lifecycle.onUpdateProps(n||{},t,r)})}catch(o){i("component.renderMethods.component.handleOnChangeProps",o)}},Lr=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,jr(n,o,t),E("lifecycle.onMount",()=>{n.setDOMNodeOnInstance()}),Rr(this,n),n.parent&&Dr(n),n.options.data&&n.parent.walkingTreeForSSR&&n.parent.ssrTree.dataFunctions?Cr(n):n.parent&&n.parent.ssrTree?kr(n):Er(n,this,l?.children)}},Ar=function(e,t){try{let o=this;return new Lr().bind({})(e,t,o)}catch(o){i("component.renderMethods.component",o)}},P=Ar;var Nr=function(e=[],t=null){try{return B(t)&&e&&Array.isArray(e)?e.map((o,n)=>t(o,n)).join(""):""}catch(o){i("component.renderMethods.each",o)}},H=Nr;var vr=(r="",e=[])=>{try{return e.reduce((t,[o,n])=>t.replace(`{{${o}}}`,n),r)}catch(t){i("component.renderMethods.i18n.replacePlaceholdersInString",t)}},I=(r="",e=[])=>{try{let t=typeof r=="string",o=Array.isArray(r),n=typeof r=="object"&&!o;if(t)return vr(r,e);if(o)return r?.map(s=>I(s,e));if(n)return Object.entries(r)?.reduce((s={},[m,l])=>(s[m]=I(l,e),s),{})}catch(t){i("component.renderMethods.i18n.handleTranslationReplacement",t)}},Pr=(r="",e={})=>{try{return r?.split(".").reduce((t,o)=>(console.log({key:r,objectToTraverse:t,keyToMatch:o}),t[o]),e)}catch(t){i("component.renderMethods.i18n.getTranslationAtPath",t)}},Hr=function(r="",e={}){try{let t=j()?this.translations:window.__joystick_i18n__,n=r?.includes(".")?Pr(r,t):t[r];if(r?.includes("creatorDashboard")&&console.log({key:r,replacements:e,translation:n,translations:t}),!t||!n)return"";let s=Object.entries(e);return I(n,s)}catch(t){i("component.renderMethods.i18n",t)}},_=Hr;var Ir=function(e=!1,t=""){try{return this?.renderingHTMLWithDataForSSR||e?`<when>${t.trim()}</when>`:"<when> </when>"}catch(o){i("component.renderMethods.when",o)}},U=Ir;var Y={c:P,component:P,e:H,each:H,i:_,i18n:_,w:U,when:U};var Z=(r={},e={})=>{try{return Object.entries(Y).reduce((t,[o,n])=>(t[o]=n.bind({...r,...e}),t),{})}catch(t){i("component.renderMethods.compile",t)}};var rr=(r={},e={})=>{try{return Object.entries(e).reduce((t={},[o,n])=>(t[o]=(...s)=>n(...s,{...r,setState:r.setState.bind(r),...r.renderMethods||{}}),t),{})}catch{i("component.methods.compile")}};var er=(r={})=>{try{return Object.entries(r)?.reduce((e={},[t,o]={})=>(e[t]=o?.map((n={})=>({state:n?.state,children:er(n?.children)})),e),{})}catch(e){i("component.render.getExistingStateMap.buildMapForChildren",e)}},tr=(r={})=>{try{return er(r)}catch(e){i("component.render.getExistingStateMap",e)}};var or=new RegExp(/\<\!\-\-(?:.|\n|\r)*?-->/g),_r=new RegExp(/\n/g);var Ur=(r="")=>{try{return(r.match(or)||[]).forEach(t=>{r=r.replace(t,"")}),r}catch(e){i("component.render.sanitizeHTML.removeCommentedCode",e)}},nr=(r="")=>{try{let e=`${r}`;return e=Ur(e),e}catch(e){i("component.render.sanitizeHTML",e)}};var ir=(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 cr=(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&&cr(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)}},ar=cr;var sr=(r={},e={})=>{try{e?.dataFromSSR&&(r.data=G(e.dataFromSSR,r.id)||{}),ar(r?.children);let t=tr(e?.existingChildren||r?.children)||{};r.children={},r.renderMethods=Z({...r,existingStateMap:t,translations:e?.translations||r.translations||{},ssrTree:e?.ssrTree,walkingTreeForSSR:e?.walkingTreeForSSR,renderingHTMLWithDataForSSR:e?.renderingHTMLWithDataForSSR,dataFromSSR:e?.dataFromSSR}),r.methods=rr(r,r.options.methods);let o=r.options.render({...r||{},setState:r.setState.bind(r),...r.renderMethods||{}}),n=nr(o),s=ir(r,n);return{unwrapped:n,wrapped:s}}catch(t){i("component.render.toHTML",t)}};var $r=(r={})=>{try{return Object.values(r).reduce((e={},t)=>(e[t.name]=t.value,e),{})}catch(e){i("component.virtualDOM.build.parseAttributeMap",e)}},dr=(r={})=>{try{return r.tagName==="WHEN"?[].flatMap.call(r?.childNodes,e=>e?.tagName==="WHEN"?dr(e):$(e)):$(r)}catch(e){i("component.virtualDOM.build.flattenWhenTags",e)}},$=(r={})=>{try{let e=r&&r.tagName&&r.tagName.toLowerCase()||"text",t={tagName:e,attributes:$r(r.attributes),children:[].flatMap.call(r.childNodes,o=>dr(o))};return e==="text"&&(t=r.textContent),t}catch(e){i("component.virtualDOM.build",e)}},lr=$;var qr=(r="")=>{try{let e=document.createElement("div");return e.innerHTML=r,e?.childNodes[0]}catch(e){i("component.virtualDOM.build.convertHTMLToDOM",e)}},ur=(r="")=>{try{let e=qr(r);return lr(e)}catch(e){i("component.virtualDOM.build",e)}};var pr=(r="")=>{try{return document.createElement("div").setAttribute(r,"Test"),!0}catch{return!1}};var Br=(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];pr(n)&&e.setAttribute(n,s)}for(let o=0;o<r?.children?.length;o+=1){let n=r?.children[o];if(n){let s=hr(n);e.appendChild(s)}}return e}catch(e){i("component.virtualDOM.renderTreeToDOM.renderElement",e)}},hr=(r=null)=>{try{return z(r)?document.createTextNode(r):Br(r)}catch(e){i("component.virtualDOM.renderTreeToDOM",e)}},fr=hr;var L=(r={},e={})=>{try{let t=sr(r,{existingChildren:e?.existingChildren}),o=ur(t.wrapped,r),n=e.includeActual&&o?fr(o):null;return{html:t,virtual:o,actual:n}}catch(t){i("component.render.getUpdatedDOM",t)}};var wt=(r={},e={})=>{try{let t=L(r,{includeActual:!0,existingChildren:e?.existingChildren});return r.dom=t,t.actual}catch(t){i("component.render.forMount",t)}};export{wt as default};
1
+ var wr=Object.create;var N=Object.defineProperty;var yr=Object.getOwnPropertyDescriptor;var xr=Object.getOwnPropertyNames;var Mr=Object.getPrototypeOf,gr=Object.prototype.hasOwnProperty;var Tr=r=>N(r,"__esModule",{value:!0});var Fr=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var Or=(r,e,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of xr(e))!gr.call(r,n)&&n!=="default"&&N(r,n,{get:()=>e[n],enumerable:!(t=yr(e,n))||t.enumerable});return r},Sr=r=>Or(Tr(N(r!=null?wr(Mr(r)):{},"default",r&&r.__esModule&&"default"in r?{get:()=>r.default,enumerable:!0}:{value:r,enumerable:!0})),r);var Q=Fr(D=>{(function(r,e){if(typeof define=="function"&&define.amd)define(["exports"],e);else if(typeof D!="undefined")e(D);else{var t={exports:{}};e(t.exports),r.index=t.exports}})(D,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():""},k=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),C=function(a){function c(p,g,d,F){var h;return l(this,c),h=t(this,o(c).call(this,"M",p)),h.item=g,h.lhsIndex=d,h.rhsIndex=F,h}return s(c,a),c}(M),A=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),v=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),S=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,h=g.types||["E","A","D","M"],mr=function(f,u,w,b){f.forEach(function(O,y){var T=u.findIndex(function(x){return x[b]===O[b]});-1<T?(-1<h.indexOf("M")&&y!==T&&d.push(new C(w,O,y,T)),j(O,u[T],S(w,T))):-1<h.indexOf("D")&&d.push(new A(w,O))}),u.forEach(function(O,y){var T=f.findIndex(function(x){return O[b]===x[b]});-1<h.indexOf("A")&&T===-1&&d.push(new v(S(w,y),O))})},j=function(f,u,w){var b=Object.prototype.toString.call(f),O=Object.prototype.toString.call(u);if(-1<h.indexOf("E")&&b!==O)return d.push(new k(w,f,u)),!1;if(b==="[object Object]")Object.getOwnPropertyNames(f).forEach(function(x){Object.prototype.hasOwnProperty.call(u,x)?j(f[x],u[x],S(w,x)):-1<h.indexOf("D")&&d.push(new A(S(w,x),f[x]))}),Object.getOwnPropertyNames(u).forEach(function(x){-1<h.indexOf("A")&&!Object.prototype.hasOwnProperty.call(f,x)&&d.push(new v(S(w,x),u[x]))});else if(b!=="[object Array]")-1<h.indexOf("E")&&f!==u&&d.push(new k(w,f,u));else if(F)mr(f,u,w,F);else{var y=f.length-1,T=u.length-1;if(-1<h.indexOf("D"))for(;y>T;)d.push(new A(S(w,y),f[y--]));if(-1<h.indexOf("A"))for(;T>y;)d.push(new v(S(w,T),u[T--]));for(;0<=y;--y)j(f[y],u[y],S(w,y))}};return j(c,p),d}})});var i=(r="",e={})=>{throw new Error(`[joystick${r?`.${r}`:""}] ${e.message||e.reason||e}`)};var q=r=>{try{return!!Array.isArray(r)}catch(e){i("types.isArray",e)}};var B=r=>{try{return typeof r=="function"}catch(e){i("types.isFunction",e)}};var W=r=>{try{return!!(r&&typeof r=="object"&&!Array.isArray(r))}catch(e){i("types.isObject",e)}};var z=r=>{try{return typeof r=="string"}catch(e){i("types.isString",e)}};var G=(r=[],e="")=>{try{return(q(r)&&r.find(n=>n?.componentId===e))?.data||{}}catch(t){i("findComponentDataFromSSR",t)}};var J=Sr(Q());var R=()=>typeof window=="undefined";var br=(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)}},E=(r="",e=null)=>{try{R()||(br(r)||{}).array.push({callback:e})}catch(t){i("addToQueue",t)}};var V=(r={},e="",t="id")=>{try{let n=r&&r.id;if(W(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 k=l[M],C=V(k,e,t);if(C!==null)return C}}}return null}catch(n){i("component.findComponentInTreeByField",n)}},K=V;var X=(r="",e={},t=null)=>{let n=K(t||window.joystick._internal.tree,r,"instanceId");n&&(n.children=[...n.children||[],e])};var Er=(r={},e={},t=null)=>{try{let n=L(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)}},kr=(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)}},Cr=(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)}},jr=(r={})=>{try{let e={id:r.id,instanceId:r.instanceId,instance:r,children:[]};X(r.parent.instanceId,e,r.parent&&r.parent.ssrTree||null)}catch(e){i("component.renderMethods.component.handleAddComponentToParent",e)}},Dr=(r={},e={})=>{try{!r.renderedComponent&&e.options&&e.options.lifecycle&&(e.options.lifecycle.onBeforeMount&&E("lifecycle.onBeforeMount",()=>{e.options.lifecycle.onBeforeMount(e)}),!r.renderedComponent&&e.options.lifecycle.onMount&&E("lifecycle.onMount",()=>{e.options.lifecycle.onMount(e)}))}catch(t){i("component.renderMethods.component.handleLifecycle",t)}},Rr=(r={},e={},t={})=>{try{!e.walkingTreeForSSR&&r?.options?.lifecycle?.onUpdateProps&&(0,J.diff)(e?.existingPropsMap,t)?.length>0&&E("lifecycle.onUpdateProps",()=>{let o=e?.existingPropsMap&&e?.existingPropsMap[r.id];r.options.lifecycle.onUpdateProps(o||{},t,r)})}catch(n){i("component.renderMethods.component.handleOnChangeProps",n)}},Lr=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,Rr(o,n,t),E("lifecycle.onMount",()=>{o.setDOMNodeOnInstance()}),Dr(this,o),o.parent&&jr(o),o.options.data&&o.parent.walkingTreeForSSR&&o.parent.ssrTree.dataFunctions?Cr(o):o.parent&&o.parent.ssrTree?kr(o):Er(o,this,l?.children)}},Ar=function(e,t){try{let n=this;return new Lr().bind({})(e,t,n)}catch(n){i("component.renderMethods.component",n)}},P=Ar;var vr=function(e=[],t=null){try{return B(t)&&e&&Array.isArray(e)?e.map((n,o)=>t(n,o)).join(""):""}catch(n){i("component.renderMethods.each",n)}},H=vr;var Nr=(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 Nr(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)}},Pr=(r="",e={})=>{try{return r?.split(".").reduce((t,n)=>t[n],e)}catch(t){i("component.renderMethods.i18n.getTranslationAtPath",t)}},Hr=function(r="",e={}){try{let t=R()?this.translations:window.__joystick_i18n__,o=r?.includes(".")?Pr(r,t):t[r];if(!t||!o)return"";let s=Object.entries(e);return I(o,s)}catch(t){i("component.renderMethods.i18n",t)}},_=Hr;var Ir=function(e=!1,t=""){try{return this?.renderingHTMLWithDataForSSR||e?`<when>${t.trim()}</when>`:"<when> </when>"}catch(n){i("component.renderMethods.when",n)}},U=Ir;var Y={c:P,component:P,e:H,each:H,i:_,i18n:_,w:U,when:U};var Z=(r={},e={})=>{try{return Object.entries(Y).reduce((t,[n,o])=>(t[n]=o.bind({...r,...e}),t),{})}catch(t){i("component.renderMethods.compile",t)}};var rr=(r={},e={})=>{try{return Object.entries(e).reduce((t={},[n,o])=>(t[n]=(...s)=>o(...s,{...r,setState:r.setState.bind(r),...r.renderMethods||{}}),t),{})}catch{i("component.methods.compile")}};var er=(r={})=>{try{return Object.entries(r)?.reduce((e={},[t,n]={})=>(e[t]=n?.map((o={})=>({state:o?.state,children:er(o?.children)})),e),{})}catch(e){i("component.render.getExistingStateMap.buildMapForChildren",e)}},tr=(r={})=>{try{return er(r)}catch(e){i("component.render.getExistingStateMap",e)}};var nr=new RegExp(/\<\!\-\-(?:.|\n|\r)*?-->/g),_r=new RegExp(/\n/g);var Ur=(r="")=>{try{return(r.match(nr)||[]).forEach(t=>{r=r.replace(t,"")}),r}catch(e){i("component.render.sanitizeHTML.removeCommentedCode",e)}},or=(r="")=>{try{let e=`${r}`;return e=Ur(e),e}catch(e){i("component.render.sanitizeHTML",e)}};var ir=(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 cr=(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&&cr(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)}},ar=cr;var sr=(r={},e={})=>{try{e?.dataFromSSR&&(r.data=G(e.dataFromSSR,r.id)||{}),ar(r?.children);let t=tr(e?.existingChildren||r?.children)||{};r.children={},r.renderMethods=Z({...r,existingStateMap:t,translations:e?.translations||r.translations||{},ssrTree:e?.ssrTree,walkingTreeForSSR:e?.walkingTreeForSSR,renderingHTMLWithDataForSSR:e?.renderingHTMLWithDataForSSR,dataFromSSR:e?.dataFromSSR}),r.methods=rr(r,r.options.methods);let n=r.options.render({...r||{},setState:r.setState.bind(r),...r.renderMethods||{}}),o=or(n),s=ir(r,o);return{unwrapped:o,wrapped:s}}catch(t){i("component.render.toHTML",t)}};var $r=(r={})=>{try{return Object.values(r).reduce((e={},t)=>(e[t.name]=t.value,e),{})}catch(e){i("component.virtualDOM.build.parseAttributeMap",e)}},dr=(r={})=>{try{return r.tagName==="WHEN"?[].flatMap.call(r?.childNodes,e=>e?.tagName==="WHEN"?dr(e):$(e)):$(r)}catch(e){i("component.virtualDOM.build.flattenWhenTags",e)}},$=(r={})=>{try{let e=r&&r.tagName&&r.tagName.toLowerCase()||"text",t={tagName:e,attributes:$r(r.attributes),children:[].flatMap.call(r.childNodes,n=>dr(n))};return e==="text"&&(t=r.textContent),t}catch(e){i("component.virtualDOM.build",e)}},lr=$;var qr=(r="")=>{try{let e=document.createElement("div");return e.innerHTML=r,e?.childNodes[0]}catch(e){i("component.virtualDOM.build.convertHTMLToDOM",e)}},ur=(r="")=>{try{let e=qr(r);return lr(e)}catch(e){i("component.virtualDOM.build",e)}};var pr=(r="")=>{try{return document.createElement("div").setAttribute(r,"Test"),!0}catch{return!1}};var Br=(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];pr(o)&&e.setAttribute(o,s)}for(let n=0;n<r?.children?.length;n+=1){let o=r?.children[n];if(o){let s=hr(o);e.appendChild(s)}}return e}catch(e){i("component.virtualDOM.renderTreeToDOM.renderElement",e)}},hr=(r=null)=>{try{return z(r)?document.createTextNode(r):Br(r)}catch(e){i("component.virtualDOM.renderTreeToDOM",e)}},fr=hr;var L=(r={},e={})=>{try{let t=sr(r,{existingChildren:e?.existingChildren}),n=ur(t.wrapped,r),o=e.includeActual&&n?fr(n):null;return{html:t,virtual:n,actual:o}}catch(t){i("component.render.getUpdatedDOM",t)}};var wt=(r={},e={})=>{try{let t=L(r,{includeActual:!0,existingChildren:e?.existingChildren});return r.dom=t,t.actual}catch(t){i("component.render.forMount",t)}};export{wt as default};
@@ -1 +1 @@
1
- var wr=Object.create;var N=Object.defineProperty;var yr=Object.getOwnPropertyDescriptor;var xr=Object.getOwnPropertyNames;var Mr=Object.getPrototypeOf,gr=Object.prototype.hasOwnProperty;var Tr=r=>N(r,"__esModule",{value:!0});var Fr=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var Sr=(r,e,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of xr(e))!gr.call(r,n)&&n!=="default"&&N(r,n,{get:()=>e[n],enumerable:!(t=yr(e,n))||t.enumerable});return r},Or=r=>Sr(Tr(N(r!=null?wr(Mr(r)):{},"default",r&&r.__esModule&&"default"in r?{get:()=>r.default,enumerable:!0}:{value:r,enumerable:!0})),r);var G=Fr(j=>{(function(r,e){if(typeof define=="function"&&define.amd)define(["exports"],e);else if(typeof j!="undefined")e(j);else{var t={exports:{}};e(t.exports),r.index=t.exports}})(j,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():""},k=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),C=function(a){function c(p,g,d,F){var h;return l(this,c),h=t(this,o(c).call(this,"M",p)),h.item=g,h.lhsIndex=d,h.rhsIndex=F,h}return s(c,a),c}(M),L=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),A=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),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,h=g.types||["E","A","D","M"],mr=function(f,u,w,b){f.forEach(function(S,y){var T=u.findIndex(function(x){return x[b]===S[b]});-1<T?(-1<h.indexOf("M")&&y!==T&&d.push(new C(w,S,y,T)),R(S,u[T],O(w,T))):-1<h.indexOf("D")&&d.push(new L(w,S))}),u.forEach(function(S,y){var T=f.findIndex(function(x){return S[b]===x[b]});-1<h.indexOf("A")&&T===-1&&d.push(new A(O(w,y),S))})},R=function(f,u,w){var b=Object.prototype.toString.call(f),S=Object.prototype.toString.call(u);if(-1<h.indexOf("E")&&b!==S)return d.push(new k(w,f,u)),!1;if(b==="[object Object]")Object.getOwnPropertyNames(f).forEach(function(x){Object.prototype.hasOwnProperty.call(u,x)?R(f[x],u[x],O(w,x)):-1<h.indexOf("D")&&d.push(new L(O(w,x),f[x]))}),Object.getOwnPropertyNames(u).forEach(function(x){-1<h.indexOf("A")&&!Object.prototype.hasOwnProperty.call(f,x)&&d.push(new A(O(w,x),u[x]))});else if(b!=="[object Array]")-1<h.indexOf("E")&&f!==u&&d.push(new k(w,f,u));else if(F)mr(f,u,w,F);else{var y=f.length-1,T=u.length-1;if(-1<h.indexOf("D"))for(;y>T;)d.push(new L(O(w,y),f[y--]));if(-1<h.indexOf("A"))for(;T>y;)d.push(new A(O(w,T),u[T--]));for(;0<=y;--y)R(f[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 U=r=>{try{return!!Array.isArray(r)}catch(e){i("types.isArray",e)}};var q=r=>{try{return typeof r=="function"}catch(e){i("types.isFunction",e)}};var B=r=>{try{return!!(r&&typeof r=="object"&&!Array.isArray(r))}catch(e){i("types.isObject",e)}};var W=r=>{try{return typeof r=="string"}catch(e){i("types.isString",e)}};var z=(r=[],e="")=>{try{return(U(r)&&r.find(n=>n?.componentId===e))?.data||{}}catch(t){i("findComponentDataFromSSR",t)}};var X=Or(G());var D=()=>typeof window=="undefined";var br=(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)}},E=(r="",e=null)=>{try{D()||(br(r)||{}).array.push({callback:e})}catch(t){i("addToQueue",t)}};var Q=(r={},e="",t="id")=>{try{let n=r&&r.id;if(B(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 k=l[M],C=Q(k,e,t);if(C!==null)return C}}}return null}catch(n){i("component.findComponentInTreeByField",n)}},V=Q;var K=(r="",e={},t=null)=>{let n=V(t||window.joystick._internal.tree,r,"instanceId");n&&(n.children=[...n.children||[],e])};var Er=(r={},e={},t=null)=>{try{let n=J(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)}},kr=(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)}},Cr=(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)}},Rr=(r={})=>{try{let e={id:r.id,instanceId:r.instanceId,instance:r,children:[]};K(r.parent.instanceId,e,r.parent&&r.parent.ssrTree||null)}catch(e){i("component.renderMethods.component.handleAddComponentToParent",e)}},jr=(r={},e={})=>{try{!r.renderedComponent&&e.options&&e.options.lifecycle&&(e.options.lifecycle.onBeforeMount&&E("lifecycle.onBeforeMount",()=>{e.options.lifecycle.onBeforeMount(e)}),!r.renderedComponent&&e.options.lifecycle.onMount&&E("lifecycle.onMount",()=>{e.options.lifecycle.onMount(e)}))}catch(t){i("component.renderMethods.component.handleLifecycle",t)}},Dr=(r={},e={},t={})=>{try{!e.walkingTreeForSSR&&r?.options?.lifecycle?.onUpdateProps&&(0,X.diff)(e?.existingPropsMap,t)?.length>0&&E("lifecycle.onUpdateProps",()=>{let o=e?.existingPropsMap&&e?.existingPropsMap[r.id];r.options.lifecycle.onUpdateProps(o||{},t,r)})}catch(n){i("component.renderMethods.component.handleOnChangeProps",n)}},Lr=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,Dr(o,n,t),E("lifecycle.onMount",()=>{o.setDOMNodeOnInstance()}),jr(this,o),o.parent&&Rr(o),o.options.data&&o.parent.walkingTreeForSSR&&o.parent.ssrTree.dataFunctions?Cr(o):o.parent&&o.parent.ssrTree?kr(o):Er(o,this,l?.children)}},Ar=function(e,t){try{let n=this;return new Lr().bind({})(e,t,n)}catch(n){i("component.renderMethods.component",n)}},v=Ar;var Nr=function(e=[],t=null){try{return q(t)&&e&&Array.isArray(e)?e.map((n,o)=>t(n,o)).join(""):""}catch(n){i("component.renderMethods.each",n)}},P=Nr;var vr=(r="",e=[])=>{try{return e.reduce((t,[n,o])=>t.replace(`{{${n}}}`,o),r)}catch(t){i("component.renderMethods.i18n.replacePlaceholdersInString",t)}},H=(r="",e=[])=>{try{let t=typeof r=="string",n=Array.isArray(r),o=typeof r=="object"&&!n;if(t)return vr(r,e);if(n)return r?.map(s=>H(s,e));if(o)return Object.entries(r)?.reduce((s={},[m,l])=>(s[m]=H(l,e),s),{})}catch(t){i("component.renderMethods.i18n.handleTranslationReplacement",t)}},Pr=(r="",e={})=>{try{return r?.split(".").reduce((t,n)=>(console.log({key:r,objectToTraverse:t,keyToMatch:n}),t[n]),e)}catch(t){i("component.renderMethods.i18n.getTranslationAtPath",t)}},Hr=function(r="",e={}){try{let t=D()?this.translations:window.__joystick_i18n__,o=r?.includes(".")?Pr(r,t):t[r];if(r?.includes("creatorDashboard")&&console.log({key:r,replacements:e,translation:o,translations:t}),!t||!o)return"";let s=Object.entries(e);return H(o,s)}catch(t){i("component.renderMethods.i18n",t)}},I=Hr;var Ir=function(e=!1,t=""){try{return this?.renderingHTMLWithDataForSSR||e?`<when>${t.trim()}</when>`:"<when> </when>"}catch(n){i("component.renderMethods.when",n)}},_=Ir;var Y={c:v,component:v,e:P,each:P,i:I,i18n:I,w:_,when:_};var Z=(r={},e={})=>{try{return Object.entries(Y).reduce((t,[n,o])=>(t[n]=o.bind({...r,...e}),t),{})}catch(t){i("component.renderMethods.compile",t)}};var rr=(r={},e={})=>{try{return Object.entries(e).reduce((t={},[n,o])=>(t[n]=(...s)=>o(...s,{...r,setState:r.setState.bind(r),...r.renderMethods||{}}),t),{})}catch{i("component.methods.compile")}};var er=(r={})=>{try{return Object.entries(r)?.reduce((e={},[t,n]={})=>(e[t]=n?.map((o={})=>({state:o?.state,children:er(o?.children)})),e),{})}catch(e){i("component.render.getExistingStateMap.buildMapForChildren",e)}},tr=(r={})=>{try{return er(r)}catch(e){i("component.render.getExistingStateMap",e)}};var nr=new RegExp(/\<\!\-\-(?:.|\n|\r)*?-->/g),_r=new RegExp(/\n/g);var $r=(r="")=>{try{return(r.match(nr)||[]).forEach(t=>{r=r.replace(t,"")}),r}catch(e){i("component.render.sanitizeHTML.removeCommentedCode",e)}},or=(r="")=>{try{let e=`${r}`;return e=$r(e),e}catch(e){i("component.render.sanitizeHTML",e)}};var ir=(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 cr=(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&&cr(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)}},ar=cr;var sr=(r={},e={})=>{try{e?.dataFromSSR&&(r.data=z(e.dataFromSSR,r.id)||{}),ar(r?.children);let t=tr(e?.existingChildren||r?.children)||{};r.children={},r.renderMethods=Z({...r,existingStateMap:t,translations:e?.translations||r.translations||{},ssrTree:e?.ssrTree,walkingTreeForSSR:e?.walkingTreeForSSR,renderingHTMLWithDataForSSR:e?.renderingHTMLWithDataForSSR,dataFromSSR:e?.dataFromSSR}),r.methods=rr(r,r.options.methods);let n=r.options.render({...r||{},setState:r.setState.bind(r),...r.renderMethods||{}}),o=or(n),s=ir(r,o);return{unwrapped:o,wrapped:s}}catch(t){i("component.render.toHTML",t)}};var Ur=(r={})=>{try{return Object.values(r).reduce((e={},t)=>(e[t.name]=t.value,e),{})}catch(e){i("component.virtualDOM.build.parseAttributeMap",e)}},dr=(r={})=>{try{return r.tagName==="WHEN"?[].flatMap.call(r?.childNodes,e=>e?.tagName==="WHEN"?dr(e):$(e)):$(r)}catch(e){i("component.virtualDOM.build.flattenWhenTags",e)}},$=(r={})=>{try{let e=r&&r.tagName&&r.tagName.toLowerCase()||"text",t={tagName:e,attributes:Ur(r.attributes),children:[].flatMap.call(r.childNodes,n=>dr(n))};return e==="text"&&(t=r.textContent),t}catch(e){i("component.virtualDOM.build",e)}},lr=$;var qr=(r="")=>{try{let e=document.createElement("div");return e.innerHTML=r,e?.childNodes[0]}catch(e){i("component.virtualDOM.build.convertHTMLToDOM",e)}},ur=(r="")=>{try{let e=qr(r);return lr(e)}catch(e){i("component.virtualDOM.build",e)}};var pr=(r="")=>{try{return document.createElement("div").setAttribute(r,"Test"),!0}catch{return!1}};var Br=(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];pr(o)&&e.setAttribute(o,s)}for(let n=0;n<r?.children?.length;n+=1){let o=r?.children[n];if(o){let s=hr(o);e.appendChild(s)}}return e}catch(e){i("component.virtualDOM.renderTreeToDOM.renderElement",e)}},hr=(r=null)=>{try{return W(r)?document.createTextNode(r):Br(r)}catch(e){i("component.virtualDOM.renderTreeToDOM",e)}},fr=hr;var J=(r={},e={})=>{try{let t=sr(r,{existingChildren:e?.existingChildren}),n=ur(t.wrapped,r),o=e.includeActual&&n?fr(n):null;return{html:t,virtual:n,actual:o}}catch(t){i("component.render.getUpdatedDOM",t)}};export{J as default};
1
+ var wr=Object.create;var v=Object.defineProperty;var yr=Object.getOwnPropertyDescriptor;var xr=Object.getOwnPropertyNames;var Mr=Object.getPrototypeOf,Tr=Object.prototype.hasOwnProperty;var gr=r=>v(r,"__esModule",{value:!0});var Fr=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var Sr=(r,e,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of xr(e))!Tr.call(r,n)&&n!=="default"&&v(r,n,{get:()=>e[n],enumerable:!(t=yr(e,n))||t.enumerable});return r},Or=r=>Sr(gr(v(r!=null?wr(Mr(r)):{},"default",r&&r.__esModule&&"default"in r?{get:()=>r.default,enumerable:!0}:{value:r,enumerable:!0})),r);var G=Fr(R=>{(function(r,e){if(typeof define=="function"&&define.amd)define(["exports"],e);else if(typeof R!="undefined")e(R);else{var t={exports:{}};e(t.exports),r.index=t.exports}})(R,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,T){return p.__proto__=T,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():""},k=function(a){function c(p,T,d){var F;return l(this,c),F=t(this,o(c).call(this,"E",p)),F.lhs=T,F.rhs=d,F}return s(c,a),c}(M),C=function(a){function c(p,T,d,F){var h;return l(this,c),h=t(this,o(c).call(this,"M",p)),h.item=T,h.lhsIndex=d,h.rhsIndex=F,h}return s(c,a),c}(M),L=function(a){function c(p,T){var d;return l(this,c),d=t(this,o(c).call(this,"D",p)),d.lhs=T,d}return s(c,a),c}(M),A=function(a){function c(p,T){var d;return l(this,c),d=t(this,o(c).call(this,"A",p)),d.rhs=T,d}return s(c,a),c}(M),O=function(a,c){return a?"".concat(a,".").concat(c):c};r.diff=function(c,p){var T=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{},d=[],F=T.matchKey,h=T.types||["E","A","D","M"],mr=function(f,u,w,b){f.forEach(function(S,y){var g=u.findIndex(function(x){return x[b]===S[b]});-1<g?(-1<h.indexOf("M")&&y!==g&&d.push(new C(w,S,y,g)),j(S,u[g],O(w,g))):-1<h.indexOf("D")&&d.push(new L(w,S))}),u.forEach(function(S,y){var g=f.findIndex(function(x){return S[b]===x[b]});-1<h.indexOf("A")&&g===-1&&d.push(new A(O(w,y),S))})},j=function(f,u,w){var b=Object.prototype.toString.call(f),S=Object.prototype.toString.call(u);if(-1<h.indexOf("E")&&b!==S)return d.push(new k(w,f,u)),!1;if(b==="[object Object]")Object.getOwnPropertyNames(f).forEach(function(x){Object.prototype.hasOwnProperty.call(u,x)?j(f[x],u[x],O(w,x)):-1<h.indexOf("D")&&d.push(new L(O(w,x),f[x]))}),Object.getOwnPropertyNames(u).forEach(function(x){-1<h.indexOf("A")&&!Object.prototype.hasOwnProperty.call(f,x)&&d.push(new A(O(w,x),u[x]))});else if(b!=="[object Array]")-1<h.indexOf("E")&&f!==u&&d.push(new k(w,f,u));else if(F)mr(f,u,w,F);else{var y=f.length-1,g=u.length-1;if(-1<h.indexOf("D"))for(;y>g;)d.push(new L(O(w,y),f[y--]));if(-1<h.indexOf("A"))for(;g>y;)d.push(new A(O(w,g),u[g--]));for(;0<=y;--y)j(f[y],u[y],O(w,y))}};return j(c,p),d}})});var i=(r="",e={})=>{throw new Error(`[joystick${r?`.${r}`:""}] ${e.message||e.reason||e}`)};var U=r=>{try{return!!Array.isArray(r)}catch(e){i("types.isArray",e)}};var q=r=>{try{return typeof r=="function"}catch(e){i("types.isFunction",e)}};var B=r=>{try{return!!(r&&typeof r=="object"&&!Array.isArray(r))}catch(e){i("types.isObject",e)}};var W=r=>{try{return typeof r=="string"}catch(e){i("types.isString",e)}};var z=(r=[],e="")=>{try{return(U(r)&&r.find(n=>n?.componentId===e))?.data||{}}catch(t){i("findComponentDataFromSSR",t)}};var X=Or(G());var D=()=>typeof window=="undefined";var br=(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)}},E=(r="",e=null)=>{try{D()||(br(r)||{}).array.push({callback:e})}catch(t){i("addToQueue",t)}};var Q=(r={},e="",t="id")=>{try{let n=r&&r.id;if(B(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 k=l[M],C=Q(k,e,t);if(C!==null)return C}}}return null}catch(n){i("component.findComponentInTreeByField",n)}},V=Q;var K=(r="",e={},t=null)=>{let n=V(t||window.joystick._internal.tree,r,"instanceId");n&&(n.children=[...n.children||[],e])};var Er=(r={},e={},t=null)=>{try{let n=J(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)}},kr=(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)}},Cr=(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)}},jr=(r={})=>{try{let e={id:r.id,instanceId:r.instanceId,instance:r,children:[]};K(r.parent.instanceId,e,r.parent&&r.parent.ssrTree||null)}catch(e){i("component.renderMethods.component.handleAddComponentToParent",e)}},Rr=(r={},e={})=>{try{!r.renderedComponent&&e.options&&e.options.lifecycle&&(e.options.lifecycle.onBeforeMount&&E("lifecycle.onBeforeMount",()=>{e.options.lifecycle.onBeforeMount(e)}),!r.renderedComponent&&e.options.lifecycle.onMount&&E("lifecycle.onMount",()=>{e.options.lifecycle.onMount(e)}))}catch(t){i("component.renderMethods.component.handleLifecycle",t)}},Dr=(r={},e={},t={})=>{try{!e.walkingTreeForSSR&&r?.options?.lifecycle?.onUpdateProps&&(0,X.diff)(e?.existingPropsMap,t)?.length>0&&E("lifecycle.onUpdateProps",()=>{let o=e?.existingPropsMap&&e?.existingPropsMap[r.id];r.options.lifecycle.onUpdateProps(o||{},t,r)})}catch(n){i("component.renderMethods.component.handleOnChangeProps",n)}},Lr=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,Dr(o,n,t),E("lifecycle.onMount",()=>{o.setDOMNodeOnInstance()}),Rr(this,o),o.parent&&jr(o),o.options.data&&o.parent.walkingTreeForSSR&&o.parent.ssrTree.dataFunctions?Cr(o):o.parent&&o.parent.ssrTree?kr(o):Er(o,this,l?.children)}},Ar=function(e,t){try{let n=this;return new Lr().bind({})(e,t,n)}catch(n){i("component.renderMethods.component",n)}},N=Ar;var vr=function(e=[],t=null){try{return q(t)&&e&&Array.isArray(e)?e.map((n,o)=>t(n,o)).join(""):""}catch(n){i("component.renderMethods.each",n)}},P=vr;var Nr=(r="",e=[])=>{try{return e.reduce((t,[n,o])=>t.replace(`{{${n}}}`,o),r)}catch(t){i("component.renderMethods.i18n.replacePlaceholdersInString",t)}},H=(r="",e=[])=>{try{let t=typeof r=="string",n=Array.isArray(r),o=typeof r=="object"&&!n;if(t)return Nr(r,e);if(n)return r?.map(s=>H(s,e));if(o)return Object.entries(r)?.reduce((s={},[m,l])=>(s[m]=H(l,e),s),{})}catch(t){i("component.renderMethods.i18n.handleTranslationReplacement",t)}},Pr=(r="",e={})=>{try{return r?.split(".").reduce((t,n)=>t[n],e)}catch(t){i("component.renderMethods.i18n.getTranslationAtPath",t)}},Hr=function(r="",e={}){try{let t=D()?this.translations:window.__joystick_i18n__,o=r?.includes(".")?Pr(r,t):t[r];if(!t||!o)return"";let s=Object.entries(e);return H(o,s)}catch(t){i("component.renderMethods.i18n",t)}},I=Hr;var Ir=function(e=!1,t=""){try{return this?.renderingHTMLWithDataForSSR||e?`<when>${t.trim()}</when>`:"<when> </when>"}catch(n){i("component.renderMethods.when",n)}},_=Ir;var Y={c:N,component:N,e:P,each:P,i:I,i18n:I,w:_,when:_};var Z=(r={},e={})=>{try{return Object.entries(Y).reduce((t,[n,o])=>(t[n]=o.bind({...r,...e}),t),{})}catch(t){i("component.renderMethods.compile",t)}};var rr=(r={},e={})=>{try{return Object.entries(e).reduce((t={},[n,o])=>(t[n]=(...s)=>o(...s,{...r,setState:r.setState.bind(r),...r.renderMethods||{}}),t),{})}catch{i("component.methods.compile")}};var er=(r={})=>{try{return Object.entries(r)?.reduce((e={},[t,n]={})=>(e[t]=n?.map((o={})=>({state:o?.state,children:er(o?.children)})),e),{})}catch(e){i("component.render.getExistingStateMap.buildMapForChildren",e)}},tr=(r={})=>{try{return er(r)}catch(e){i("component.render.getExistingStateMap",e)}};var nr=new RegExp(/\<\!\-\-(?:.|\n|\r)*?-->/g),_r=new RegExp(/\n/g);var $r=(r="")=>{try{return(r.match(nr)||[]).forEach(t=>{r=r.replace(t,"")}),r}catch(e){i("component.render.sanitizeHTML.removeCommentedCode",e)}},or=(r="")=>{try{let e=`${r}`;return e=$r(e),e}catch(e){i("component.render.sanitizeHTML",e)}};var ir=(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 cr=(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&&cr(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)}},ar=cr;var sr=(r={},e={})=>{try{e?.dataFromSSR&&(r.data=z(e.dataFromSSR,r.id)||{}),ar(r?.children);let t=tr(e?.existingChildren||r?.children)||{};r.children={},r.renderMethods=Z({...r,existingStateMap:t,translations:e?.translations||r.translations||{},ssrTree:e?.ssrTree,walkingTreeForSSR:e?.walkingTreeForSSR,renderingHTMLWithDataForSSR:e?.renderingHTMLWithDataForSSR,dataFromSSR:e?.dataFromSSR}),r.methods=rr(r,r.options.methods);let n=r.options.render({...r||{},setState:r.setState.bind(r),...r.renderMethods||{}}),o=or(n),s=ir(r,o);return{unwrapped:o,wrapped:s}}catch(t){i("component.render.toHTML",t)}};var Ur=(r={})=>{try{return Object.values(r).reduce((e={},t)=>(e[t.name]=t.value,e),{})}catch(e){i("component.virtualDOM.build.parseAttributeMap",e)}},dr=(r={})=>{try{return r.tagName==="WHEN"?[].flatMap.call(r?.childNodes,e=>e?.tagName==="WHEN"?dr(e):$(e)):$(r)}catch(e){i("component.virtualDOM.build.flattenWhenTags",e)}},$=(r={})=>{try{let e=r&&r.tagName&&r.tagName.toLowerCase()||"text",t={tagName:e,attributes:Ur(r.attributes),children:[].flatMap.call(r.childNodes,n=>dr(n))};return e==="text"&&(t=r.textContent),t}catch(e){i("component.virtualDOM.build",e)}},lr=$;var qr=(r="")=>{try{let e=document.createElement("div");return e.innerHTML=r,e?.childNodes[0]}catch(e){i("component.virtualDOM.build.convertHTMLToDOM",e)}},ur=(r="")=>{try{let e=qr(r);return lr(e)}catch(e){i("component.virtualDOM.build",e)}};var pr=(r="")=>{try{return document.createElement("div").setAttribute(r,"Test"),!0}catch{return!1}};var Br=(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];pr(o)&&e.setAttribute(o,s)}for(let n=0;n<r?.children?.length;n+=1){let o=r?.children[n];if(o){let s=hr(o);e.appendChild(s)}}return e}catch(e){i("component.virtualDOM.renderTreeToDOM.renderElement",e)}},hr=(r=null)=>{try{return W(r)?document.createTextNode(r):Br(r)}catch(e){i("component.virtualDOM.renderTreeToDOM",e)}},fr=hr;var J=(r={},e={})=>{try{let t=sr(r,{existingChildren:e?.existingChildren}),n=ur(t.wrapped,r),o=e.includeActual&&n?fr(n):null;return{html:t,virtual:n,actual:o}}catch(t){i("component.render.getUpdatedDOM",t)}};export{J as default};
@@ -1 +1 @@
1
- var wr=Object.create;var N=Object.defineProperty;var yr=Object.getOwnPropertyDescriptor;var xr=Object.getOwnPropertyNames;var Mr=Object.getPrototypeOf,gr=Object.prototype.hasOwnProperty;var Tr=r=>N(r,"__esModule",{value:!0});var Fr=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var Sr=(r,e,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of xr(e))!gr.call(r,n)&&n!=="default"&&N(r,n,{get:()=>e[n],enumerable:!(t=yr(e,n))||t.enumerable});return r},Or=r=>Sr(Tr(N(r!=null?wr(Mr(r)):{},"default",r&&r.__esModule&&"default"in r?{get:()=>r.default,enumerable:!0}:{value:r,enumerable:!0})),r);var G=Fr(j=>{(function(r,e){if(typeof define=="function"&&define.amd)define(["exports"],e);else if(typeof j!="undefined")e(j);else{var t={exports:{}};e(t.exports),r.index=t.exports}})(j,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():""},k=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),C=function(a){function c(p,g,d,F){var h;return l(this,c),h=t(this,o(c).call(this,"M",p)),h.item=g,h.lhsIndex=d,h.rhsIndex=F,h}return s(c,a),c}(M),L=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),A=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),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,h=g.types||["E","A","D","M"],mr=function(f,u,w,b){f.forEach(function(S,y){var T=u.findIndex(function(x){return x[b]===S[b]});-1<T?(-1<h.indexOf("M")&&y!==T&&d.push(new C(w,S,y,T)),R(S,u[T],O(w,T))):-1<h.indexOf("D")&&d.push(new L(w,S))}),u.forEach(function(S,y){var T=f.findIndex(function(x){return S[b]===x[b]});-1<h.indexOf("A")&&T===-1&&d.push(new A(O(w,y),S))})},R=function(f,u,w){var b=Object.prototype.toString.call(f),S=Object.prototype.toString.call(u);if(-1<h.indexOf("E")&&b!==S)return d.push(new k(w,f,u)),!1;if(b==="[object Object]")Object.getOwnPropertyNames(f).forEach(function(x){Object.prototype.hasOwnProperty.call(u,x)?R(f[x],u[x],O(w,x)):-1<h.indexOf("D")&&d.push(new L(O(w,x),f[x]))}),Object.getOwnPropertyNames(u).forEach(function(x){-1<h.indexOf("A")&&!Object.prototype.hasOwnProperty.call(f,x)&&d.push(new A(O(w,x),u[x]))});else if(b!=="[object Array]")-1<h.indexOf("E")&&f!==u&&d.push(new k(w,f,u));else if(F)mr(f,u,w,F);else{var y=f.length-1,T=u.length-1;if(-1<h.indexOf("D"))for(;y>T;)d.push(new L(O(w,y),f[y--]));if(-1<h.indexOf("A"))for(;T>y;)d.push(new A(O(w,T),u[T--]));for(;0<=y;--y)R(f[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 U=r=>{try{return!!Array.isArray(r)}catch(e){i("types.isArray",e)}};var q=r=>{try{return typeof r=="function"}catch(e){i("types.isFunction",e)}};var B=r=>{try{return!!(r&&typeof r=="object"&&!Array.isArray(r))}catch(e){i("types.isObject",e)}};var W=r=>{try{return typeof r=="string"}catch(e){i("types.isString",e)}};var z=(r=[],e="")=>{try{return(U(r)&&r.find(n=>n?.componentId===e))?.data||{}}catch(t){i("findComponentDataFromSSR",t)}};var or=Or(G());var D=()=>typeof window=="undefined";var br=(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)}},E=(r="",e=null)=>{try{D()||(br(r)||{}).array.push({callback:e})}catch(t){i("addToQueue",t)}};var Er=(r={})=>{try{return Object.values(r).reduce((e={},t)=>(e[t.name]=t.value,e),{})}catch(e){i("component.virtualDOM.build.parseAttributeMap",e)}},Q=(r={})=>{try{return r.tagName==="WHEN"?[].flatMap.call(r?.childNodes,e=>e?.tagName==="WHEN"?Q(e):v(e)):v(r)}catch(e){i("component.virtualDOM.build.flattenWhenTags",e)}},v=(r={})=>{try{let e=r&&r.tagName&&r.tagName.toLowerCase()||"text",t={tagName:e,attributes:Er(r.attributes),children:[].flatMap.call(r.childNodes,n=>Q(n))};return e==="text"&&(t=r.textContent),t}catch(e){i("component.virtualDOM.build",e)}},V=v;var kr=(r="")=>{try{let e=document.createElement("div");return e.innerHTML=r,e?.childNodes[0]}catch(e){i("component.virtualDOM.build.convertHTMLToDOM",e)}},K=(r="")=>{try{let e=kr(r);return V(e)}catch(e){i("component.virtualDOM.build",e)}};var X=(r="")=>{try{return document.createElement("div").setAttribute(r,"Test"),!0}catch{return!1}};var Cr=(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];X(o)&&e.setAttribute(o,s)}for(let n=0;n<r?.children?.length;n+=1){let o=r?.children[n];if(o){let s=J(o);e.appendChild(s)}}return e}catch(e){i("component.virtualDOM.renderTreeToDOM.renderElement",e)}},J=(r=null)=>{try{return W(r)?document.createTextNode(r):Cr(r)}catch(e){i("component.virtualDOM.renderTreeToDOM",e)}},Y=J;var Z=(r={},e={})=>{try{let t=rr(r,{existingChildren:e?.existingChildren}),n=K(t.wrapped,r),o=e.includeActual&&n?Y(n):null;return{html:t,virtual:n,actual:o}}catch(t){i("component.render.getUpdatedDOM",t)}};var er=(r={},e="",t="id")=>{try{let n=r&&r.id;if(B(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 k=l[M],C=er(k,e,t);if(C!==null)return C}}}return null}catch(n){i("component.findComponentInTreeByField",n)}},tr=er;var nr=(r="",e={},t=null)=>{let n=tr(t||window.joystick._internal.tree,r,"instanceId");n&&(n.children=[...n.children||[],e])};var Rr=(r={},e={},t=null)=>{try{let n=Z(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)}},jr=(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:[]};nr(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&&E("lifecycle.onBeforeMount",()=>{e.options.lifecycle.onBeforeMount(e)}),!r.renderedComponent&&e.options.lifecycle.onMount&&E("lifecycle.onMount",()=>{e.options.lifecycle.onMount(e)}))}catch(t){i("component.renderMethods.component.handleLifecycle",t)}},Nr=(r={},e={},t={})=>{try{!e.walkingTreeForSSR&&r?.options?.lifecycle?.onUpdateProps&&(0,or.diff)(e?.existingPropsMap,t)?.length>0&&E("lifecycle.onUpdateProps",()=>{let o=e?.existingPropsMap&&e?.existingPropsMap[r.id];r.options.lifecycle.onUpdateProps(o||{},t,r)})}catch(n){i("component.renderMethods.component.handleOnChangeProps",n)}},vr=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,Nr(o,n,t),E("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?jr(o):Rr(o,this,l?.children)}},Pr=function(e,t){try{let n=this;return new vr().bind({})(e,t,n)}catch(n){i("component.renderMethods.component",n)}},P=Pr;var Hr=function(e=[],t=null){try{return q(t)&&e&&Array.isArray(e)?e.map((n,o)=>t(n,o)).join(""):""}catch(n){i("component.renderMethods.each",n)}},H=Hr;var Ir=(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 Ir(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)}},_r=(r="",e={})=>{try{return r?.split(".").reduce((t,n)=>(console.log({key:r,objectToTraverse:t,keyToMatch:n}),t[n]),e)}catch(t){i("component.renderMethods.i18n.getTranslationAtPath",t)}},$r=function(r="",e={}){try{let t=D()?this.translations:window.__joystick_i18n__,o=r?.includes(".")?_r(r,t):t[r];if(r?.includes("creatorDashboard")&&console.log({key:r,replacements:e,translation:o,translations:t}),!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)}},$=Ur;var ir={c:P,component:P,e:H,each:H,i:_,i18n:_,w:$,when:$};var cr=(r={},e={})=>{try{return Object.entries(ir).reduce((t,[n,o])=>(t[n]=o.bind({...r,...e}),t),{})}catch(t){i("component.renderMethods.compile",t)}};var ar=(r={},e={})=>{try{return Object.entries(e).reduce((t={},[n,o])=>(t[n]=(...s)=>o(...s,{...r,setState:r.setState.bind(r),...r.renderMethods||{}}),t),{})}catch{i("component.methods.compile")}};var sr=(r={})=>{try{return Object.entries(r)?.reduce((e={},[t,n]={})=>(e[t]=n?.map((o={})=>({state:o?.state,children:sr(o?.children)})),e),{})}catch(e){i("component.render.getExistingStateMap.buildMapForChildren",e)}},dr=(r={})=>{try{return sr(r)}catch(e){i("component.render.getExistingStateMap",e)}};var lr=new RegExp(/\<\!\-\-(?:.|\n|\r)*?-->/g),qr=new RegExp(/\n/g);var Br=(r="")=>{try{return(r.match(lr)||[]).forEach(t=>{r=r.replace(t,"")}),r}catch(e){i("component.render.sanitizeHTML.removeCommentedCode",e)}},ur=(r="")=>{try{let e=`${r}`;return e=Br(e),e}catch(e){i("component.render.sanitizeHTML",e)}};var pr=(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 hr=(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&&hr(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)}},fr=hr;var rr=(r={},e={})=>{try{e?.dataFromSSR&&(r.data=z(e.dataFromSSR,r.id)||{}),fr(r?.children);let t=dr(e?.existingChildren||r?.children)||{};r.children={},r.renderMethods=cr({...r,existingStateMap:t,translations:e?.translations||r.translations||{},ssrTree:e?.ssrTree,walkingTreeForSSR:e?.walkingTreeForSSR,renderingHTMLWithDataForSSR:e?.renderingHTMLWithDataForSSR,dataFromSSR:e?.dataFromSSR}),r.methods=ar(r,r.options.methods);let n=r.options.render({...r||{},setState:r.setState.bind(r),...r.renderMethods||{}}),o=ur(n),s=pr(r,o);return{unwrapped:o,wrapped:s}}catch(t){i("component.render.toHTML",t)}};export{rr as default};
1
+ var wr=Object.create;var v=Object.defineProperty;var yr=Object.getOwnPropertyDescriptor;var xr=Object.getOwnPropertyNames;var Mr=Object.getPrototypeOf,Tr=Object.prototype.hasOwnProperty;var gr=r=>v(r,"__esModule",{value:!0});var Fr=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var Sr=(r,e,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of xr(e))!Tr.call(r,n)&&n!=="default"&&v(r,n,{get:()=>e[n],enumerable:!(t=yr(e,n))||t.enumerable});return r},Or=r=>Sr(gr(v(r!=null?wr(Mr(r)):{},"default",r&&r.__esModule&&"default"in r?{get:()=>r.default,enumerable:!0}:{value:r,enumerable:!0})),r);var G=Fr(R=>{(function(r,e){if(typeof define=="function"&&define.amd)define(["exports"],e);else if(typeof R!="undefined")e(R);else{var t={exports:{}};e(t.exports),r.index=t.exports}})(R,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,T){return p.__proto__=T,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():""},k=function(a){function c(p,T,d){var F;return l(this,c),F=t(this,o(c).call(this,"E",p)),F.lhs=T,F.rhs=d,F}return s(c,a),c}(M),C=function(a){function c(p,T,d,F){var h;return l(this,c),h=t(this,o(c).call(this,"M",p)),h.item=T,h.lhsIndex=d,h.rhsIndex=F,h}return s(c,a),c}(M),L=function(a){function c(p,T){var d;return l(this,c),d=t(this,o(c).call(this,"D",p)),d.lhs=T,d}return s(c,a),c}(M),A=function(a){function c(p,T){var d;return l(this,c),d=t(this,o(c).call(this,"A",p)),d.rhs=T,d}return s(c,a),c}(M),O=function(a,c){return a?"".concat(a,".").concat(c):c};r.diff=function(c,p){var T=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{},d=[],F=T.matchKey,h=T.types||["E","A","D","M"],mr=function(f,u,w,b){f.forEach(function(S,y){var g=u.findIndex(function(x){return x[b]===S[b]});-1<g?(-1<h.indexOf("M")&&y!==g&&d.push(new C(w,S,y,g)),j(S,u[g],O(w,g))):-1<h.indexOf("D")&&d.push(new L(w,S))}),u.forEach(function(S,y){var g=f.findIndex(function(x){return S[b]===x[b]});-1<h.indexOf("A")&&g===-1&&d.push(new A(O(w,y),S))})},j=function(f,u,w){var b=Object.prototype.toString.call(f),S=Object.prototype.toString.call(u);if(-1<h.indexOf("E")&&b!==S)return d.push(new k(w,f,u)),!1;if(b==="[object Object]")Object.getOwnPropertyNames(f).forEach(function(x){Object.prototype.hasOwnProperty.call(u,x)?j(f[x],u[x],O(w,x)):-1<h.indexOf("D")&&d.push(new L(O(w,x),f[x]))}),Object.getOwnPropertyNames(u).forEach(function(x){-1<h.indexOf("A")&&!Object.prototype.hasOwnProperty.call(f,x)&&d.push(new A(O(w,x),u[x]))});else if(b!=="[object Array]")-1<h.indexOf("E")&&f!==u&&d.push(new k(w,f,u));else if(F)mr(f,u,w,F);else{var y=f.length-1,g=u.length-1;if(-1<h.indexOf("D"))for(;y>g;)d.push(new L(O(w,y),f[y--]));if(-1<h.indexOf("A"))for(;g>y;)d.push(new A(O(w,g),u[g--]));for(;0<=y;--y)j(f[y],u[y],O(w,y))}};return j(c,p),d}})});var i=(r="",e={})=>{throw new Error(`[joystick${r?`.${r}`:""}] ${e.message||e.reason||e}`)};var U=r=>{try{return!!Array.isArray(r)}catch(e){i("types.isArray",e)}};var q=r=>{try{return typeof r=="function"}catch(e){i("types.isFunction",e)}};var B=r=>{try{return!!(r&&typeof r=="object"&&!Array.isArray(r))}catch(e){i("types.isObject",e)}};var W=r=>{try{return typeof r=="string"}catch(e){i("types.isString",e)}};var z=(r=[],e="")=>{try{return(U(r)&&r.find(n=>n?.componentId===e))?.data||{}}catch(t){i("findComponentDataFromSSR",t)}};var or=Or(G());var D=()=>typeof window=="undefined";var br=(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)}},E=(r="",e=null)=>{try{D()||(br(r)||{}).array.push({callback:e})}catch(t){i("addToQueue",t)}};var Er=(r={})=>{try{return Object.values(r).reduce((e={},t)=>(e[t.name]=t.value,e),{})}catch(e){i("component.virtualDOM.build.parseAttributeMap",e)}},Q=(r={})=>{try{return r.tagName==="WHEN"?[].flatMap.call(r?.childNodes,e=>e?.tagName==="WHEN"?Q(e):N(e)):N(r)}catch(e){i("component.virtualDOM.build.flattenWhenTags",e)}},N=(r={})=>{try{let e=r&&r.tagName&&r.tagName.toLowerCase()||"text",t={tagName:e,attributes:Er(r.attributes),children:[].flatMap.call(r.childNodes,n=>Q(n))};return e==="text"&&(t=r.textContent),t}catch(e){i("component.virtualDOM.build",e)}},V=N;var kr=(r="")=>{try{let e=document.createElement("div");return e.innerHTML=r,e?.childNodes[0]}catch(e){i("component.virtualDOM.build.convertHTMLToDOM",e)}},K=(r="")=>{try{let e=kr(r);return V(e)}catch(e){i("component.virtualDOM.build",e)}};var X=(r="")=>{try{return document.createElement("div").setAttribute(r,"Test"),!0}catch{return!1}};var Cr=(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];X(o)&&e.setAttribute(o,s)}for(let n=0;n<r?.children?.length;n+=1){let o=r?.children[n];if(o){let s=J(o);e.appendChild(s)}}return e}catch(e){i("component.virtualDOM.renderTreeToDOM.renderElement",e)}},J=(r=null)=>{try{return W(r)?document.createTextNode(r):Cr(r)}catch(e){i("component.virtualDOM.renderTreeToDOM",e)}},Y=J;var Z=(r={},e={})=>{try{let t=rr(r,{existingChildren:e?.existingChildren}),n=K(t.wrapped,r),o=e.includeActual&&n?Y(n):null;return{html:t,virtual:n,actual:o}}catch(t){i("component.render.getUpdatedDOM",t)}};var er=(r={},e="",t="id")=>{try{let n=r&&r.id;if(B(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 k=l[M],C=er(k,e,t);if(C!==null)return C}}}return null}catch(n){i("component.findComponentInTreeByField",n)}},tr=er;var nr=(r="",e={},t=null)=>{let n=tr(t||window.joystick._internal.tree,r,"instanceId");n&&(n.children=[...n.children||[],e])};var jr=(r={},e={},t=null)=>{try{let n=Z(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:[]};nr(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&&E("lifecycle.onBeforeMount",()=>{e.options.lifecycle.onBeforeMount(e)}),!r.renderedComponent&&e.options.lifecycle.onMount&&E("lifecycle.onMount",()=>{e.options.lifecycle.onMount(e)}))}catch(t){i("component.renderMethods.component.handleLifecycle",t)}},vr=(r={},e={},t={})=>{try{!e.walkingTreeForSSR&&r?.options?.lifecycle?.onUpdateProps&&(0,or.diff)(e?.existingPropsMap,t)?.length>0&&E("lifecycle.onUpdateProps",()=>{let o=e?.existingPropsMap&&e?.existingPropsMap[r.id];r.options.lifecycle.onUpdateProps(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),E("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)}},P=Pr;var Hr=function(e=[],t=null){try{return q(t)&&e&&Array.isArray(e)?e.map((n,o)=>t(n,o)).join(""):""}catch(n){i("component.renderMethods.each",n)}},H=Hr;var Ir=(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 Ir(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)}},_r=(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=D()?this.translations:window.__joystick_i18n__,o=r?.includes(".")?_r(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)}},$=Ur;var ir={c:P,component:P,e:H,each:H,i:_,i18n:_,w:$,when:$};var cr=(r={},e={})=>{try{return Object.entries(ir).reduce((t,[n,o])=>(t[n]=o.bind({...r,...e}),t),{})}catch(t){i("component.renderMethods.compile",t)}};var ar=(r={},e={})=>{try{return Object.entries(e).reduce((t={},[n,o])=>(t[n]=(...s)=>o(...s,{...r,setState:r.setState.bind(r),...r.renderMethods||{}}),t),{})}catch{i("component.methods.compile")}};var sr=(r={})=>{try{return Object.entries(r)?.reduce((e={},[t,n]={})=>(e[t]=n?.map((o={})=>({state:o?.state,children:sr(o?.children)})),e),{})}catch(e){i("component.render.getExistingStateMap.buildMapForChildren",e)}},dr=(r={})=>{try{return sr(r)}catch(e){i("component.render.getExistingStateMap",e)}};var lr=new RegExp(/\<\!\-\-(?:.|\n|\r)*?-->/g),qr=new RegExp(/\n/g);var Br=(r="")=>{try{return(r.match(lr)||[]).forEach(t=>{r=r.replace(t,"")}),r}catch(e){i("component.render.sanitizeHTML.removeCommentedCode",e)}},ur=(r="")=>{try{let e=`${r}`;return e=Br(e),e}catch(e){i("component.render.sanitizeHTML",e)}};var pr=(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 hr=(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&&hr(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)}},fr=hr;var rr=(r={},e={})=>{try{e?.dataFromSSR&&(r.data=z(e.dataFromSSR,r.id)||{}),fr(r?.children);let t=dr(e?.existingChildren||r?.children)||{};r.children={},r.renderMethods=cr({...r,existingStateMap:t,translations:e?.translations||r.translations||{},ssrTree:e?.ssrTree,walkingTreeForSSR:e?.walkingTreeForSSR,renderingHTMLWithDataForSSR:e?.renderingHTMLWithDataForSSR,dataFromSSR:e?.dataFromSSR}),r.methods=ar(r,r.options.methods);let n=r.options.render({...r||{},setState:r.setState.bind(r),...r.renderMethods||{}}),o=ur(n),s=pr(r,o);return{unwrapped:o,wrapped:s}}catch(t){i("component.render.toHTML",t)}};export{rr as default};
@@ -1 +1 @@
1
- var wr=Object.create;var N=Object.defineProperty;var yr=Object.getOwnPropertyDescriptor;var xr=Object.getOwnPropertyNames;var Mr=Object.getPrototypeOf,gr=Object.prototype.hasOwnProperty;var Tr=r=>N(r,"__esModule",{value:!0});var Fr=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var Sr=(r,e,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of xr(e))!gr.call(r,n)&&n!=="default"&&N(r,n,{get:()=>e[n],enumerable:!(t=yr(e,n))||t.enumerable});return r},Or=r=>Sr(Tr(N(r!=null?wr(Mr(r)):{},"default",r&&r.__esModule&&"default"in r?{get:()=>r.default,enumerable:!0}:{value:r,enumerable:!0})),r);var U=Fr(j=>{(function(r,e){if(typeof define=="function"&&define.amd)define(["exports"],e);else if(typeof j!="undefined")e(j);else{var t={exports:{}};e(t.exports),r.index=t.exports}})(j,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():""},k=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),C=function(a){function c(p,g,d,F){var h;return l(this,c),h=t(this,o(c).call(this,"M",p)),h.item=g,h.lhsIndex=d,h.rhsIndex=F,h}return s(c,a),c}(M),L=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),A=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),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,h=g.types||["E","A","D","M"],mr=function(f,u,w,b){f.forEach(function(S,y){var T=u.findIndex(function(x){return x[b]===S[b]});-1<T?(-1<h.indexOf("M")&&y!==T&&d.push(new C(w,S,y,T)),R(S,u[T],O(w,T))):-1<h.indexOf("D")&&d.push(new L(w,S))}),u.forEach(function(S,y){var T=f.findIndex(function(x){return S[b]===x[b]});-1<h.indexOf("A")&&T===-1&&d.push(new A(O(w,y),S))})},R=function(f,u,w){var b=Object.prototype.toString.call(f),S=Object.prototype.toString.call(u);if(-1<h.indexOf("E")&&b!==S)return d.push(new k(w,f,u)),!1;if(b==="[object Object]")Object.getOwnPropertyNames(f).forEach(function(x){Object.prototype.hasOwnProperty.call(u,x)?R(f[x],u[x],O(w,x)):-1<h.indexOf("D")&&d.push(new L(O(w,x),f[x]))}),Object.getOwnPropertyNames(u).forEach(function(x){-1<h.indexOf("A")&&!Object.prototype.hasOwnProperty.call(f,x)&&d.push(new A(O(w,x),u[x]))});else if(b!=="[object Array]")-1<h.indexOf("E")&&f!==u&&d.push(new k(w,f,u));else if(F)mr(f,u,w,F);else{var y=f.length-1,T=u.length-1;if(-1<h.indexOf("D"))for(;y>T;)d.push(new L(O(w,y),f[y--]));if(-1<h.indexOf("A"))for(;T>y;)d.push(new A(O(w,T),u[T--]));for(;0<=y;--y)R(f[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 hr=Or(U());var D=()=>typeof window=="undefined";var br=(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)}},E=(r="",e=null)=>{try{D()||(br(r)||{}).array.push({callback:e})}catch(t){i("addToQueue",t)}};var q=r=>{try{return!!Array.isArray(r)}catch(e){i("types.isArray",e)}};var B=r=>{try{return typeof r=="function"}catch(e){i("types.isFunction",e)}};var W=r=>{try{return!!(r&&typeof r=="object"&&!Array.isArray(r))}catch(e){i("types.isObject",e)}};var z=r=>{try{return typeof r=="string"}catch(e){i("types.isString",e)}};var G=(r=[],e="")=>{try{return(q(r)&&r.find(n=>n?.componentId===e))?.data||{}}catch(t){i("findComponentDataFromSSR",t)}};var Q=(r={},e={})=>{try{return Object.entries(e).reduce((t={},[n,o])=>(t[n]=(...s)=>o(...s,{...r,setState:r.setState.bind(r),...r.renderMethods||{}}),t),{})}catch{i("component.methods.compile")}};var V=(r={})=>{try{return Object.entries(r)?.reduce((e={},[t,n]={})=>(e[t]=n?.map((o={})=>({state:o?.state,children:V(o?.children)})),e),{})}catch(e){i("component.render.getExistingStateMap.buildMapForChildren",e)}},K=(r={})=>{try{return V(r)}catch(e){i("component.render.getExistingStateMap",e)}};var X=new RegExp(/\<\!\-\-(?:.|\n|\r)*?-->/g),Er=new RegExp(/\n/g);var kr=(r="")=>{try{return(r.match(X)||[]).forEach(t=>{r=r.replace(t,"")}),r}catch(e){i("component.render.sanitizeHTML.removeCommentedCode",e)}},J=(r="")=>{try{let e=`${r}`;return e=kr(e),e}catch(e){i("component.render.sanitizeHTML",e)}};var Y=(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 Z=(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&&Z(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)}},rr=Z;var er=(r={},e={})=>{try{e?.dataFromSSR&&(r.data=G(e.dataFromSSR,r.id)||{}),rr(r?.children);let t=K(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=Q(r,r.options.methods);let n=r.options.render({...r||{},setState:r.setState.bind(r),...r.renderMethods||{}}),o=J(n),s=Y(r,o);return{unwrapped:o,wrapped:s}}catch(t){i("component.render.toHTML",t)}};var Cr=(r={})=>{try{return Object.values(r).reduce((e={},t)=>(e[t.name]=t.value,e),{})}catch(e){i("component.virtualDOM.build.parseAttributeMap",e)}},nr=(r={})=>{try{return r.tagName==="WHEN"?[].flatMap.call(r?.childNodes,e=>e?.tagName==="WHEN"?nr(e):v(e)):v(r)}catch(e){i("component.virtualDOM.build.flattenWhenTags",e)}},v=(r={})=>{try{let e=r&&r.tagName&&r.tagName.toLowerCase()||"text",t={tagName:e,attributes:Cr(r.attributes),children:[].flatMap.call(r.childNodes,n=>nr(n))};return e==="text"&&(t=r.textContent),t}catch(e){i("component.virtualDOM.build",e)}},or=v;var Rr=(r="")=>{try{let e=document.createElement("div");return e.innerHTML=r,e?.childNodes[0]}catch(e){i("component.virtualDOM.build.convertHTMLToDOM",e)}},ir=(r="")=>{try{let e=Rr(r);return or(e)}catch(e){i("component.virtualDOM.build",e)}};var cr=(r="")=>{try{return document.createElement("div").setAttribute(r,"Test"),!0}catch{return!1}};var jr=(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];cr(o)&&e.setAttribute(o,s)}for(let n=0;n<r?.children?.length;n+=1){let o=r?.children[n];if(o){let s=ar(o);e.appendChild(s)}}return e}catch(e){i("component.virtualDOM.renderTreeToDOM.renderElement",e)}},ar=(r=null)=>{try{return z(r)?document.createTextNode(r):jr(r)}catch(e){i("component.virtualDOM.renderTreeToDOM",e)}},sr=ar;var dr=(r={},e={})=>{try{let t=er(r,{existingChildren:e?.existingChildren}),n=ir(t.wrapped,r),o=e.includeActual&&n?sr(n):null;return{html:t,virtual:n,actual:o}}catch(t){i("component.render.getUpdatedDOM",t)}};var lr=(r={},e="",t="id")=>{try{let n=r&&r.id;if(W(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 k=l[M],C=lr(k,e,t);if(C!==null)return C}}}return null}catch(n){i("component.findComponentInTreeByField",n)}},ur=lr;var pr=(r="",e={},t=null)=>{let n=ur(t||window.joystick._internal.tree,r,"instanceId");n&&(n.children=[...n.children||[],e])};var Dr=(r={},e={},t=null)=>{try{let n=dr(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:[]};pr(r.parent.instanceId,e,r.parent&&r.parent.ssrTree||null)}catch(e){i("component.renderMethods.component.handleAddComponentToParent",e)}},vr=(r={},e={})=>{try{!r.renderedComponent&&e.options&&e.options.lifecycle&&(e.options.lifecycle.onBeforeMount&&E("lifecycle.onBeforeMount",()=>{e.options.lifecycle.onBeforeMount(e)}),!r.renderedComponent&&e.options.lifecycle.onMount&&E("lifecycle.onMount",()=>{e.options.lifecycle.onMount(e)}))}catch(t){i("component.renderMethods.component.handleLifecycle",t)}},Pr=(r={},e={},t={})=>{try{!e.walkingTreeForSSR&&r?.options?.lifecycle?.onUpdateProps&&(0,hr.diff)(e?.existingPropsMap,t)?.length>0&&E("lifecycle.onUpdateProps",()=>{let o=e?.existingPropsMap&&e?.existingPropsMap[r.id];r.options.lifecycle.onUpdateProps(o||{},t,r)})}catch(n){i("component.renderMethods.component.handleOnChangeProps",n)}},Hr=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,Pr(o,n,t),E("lifecycle.onMount",()=>{o.setDOMNodeOnInstance()}),vr(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):Dr(o,this,l?.children)}},Ir=function(e,t){try{let n=this;return new Hr().bind({})(e,t,n)}catch(n){i("component.renderMethods.component",n)}},P=Ir;var _r=function(e=[],t=null){try{return B(t)&&e&&Array.isArray(e)?e.map((n,o)=>t(n,o)).join(""):""}catch(n){i("component.renderMethods.each",n)}},H=_r;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)}},Ur=(r="",e={})=>{try{return r?.split(".").reduce((t,n)=>(console.log({key:r,objectToTraverse:t,keyToMatch:n}),t[n]),e)}catch(t){i("component.renderMethods.i18n.getTranslationAtPath",t)}},qr=function(r="",e={}){try{let t=D()?this.translations:window.__joystick_i18n__,o=r?.includes(".")?Ur(r,t):t[r];if(r?.includes("creatorDashboard")&&console.log({key:r,replacements:e,translation:o,translations:t}),!t||!o)return"";let s=Object.entries(e);return I(o,s)}catch(t){i("component.renderMethods.i18n",t)}},_=qr;var Br=function(e=!1,t=""){try{return this?.renderingHTMLWithDataForSSR||e?`<when>${t.trim()}</when>`:"<when> </when>"}catch(n){i("component.renderMethods.when",n)}},$=Br;var fr={c:P,component:P,e:H,each:H,i:_,i18n:_,w:$,when:$};var tr=(r={},e={})=>{try{return Object.entries(fr).reduce((t,[n,o])=>(t[n]=o.bind({...r,...e}),t),{})}catch(t){i("component.renderMethods.compile",t)}};export{tr as default};
1
+ var wr=Object.create;var v=Object.defineProperty;var yr=Object.getOwnPropertyDescriptor;var xr=Object.getOwnPropertyNames;var Mr=Object.getPrototypeOf,Tr=Object.prototype.hasOwnProperty;var gr=r=>v(r,"__esModule",{value:!0});var Fr=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var Sr=(r,e,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of xr(e))!Tr.call(r,n)&&n!=="default"&&v(r,n,{get:()=>e[n],enumerable:!(t=yr(e,n))||t.enumerable});return r},Or=r=>Sr(gr(v(r!=null?wr(Mr(r)):{},"default",r&&r.__esModule&&"default"in r?{get:()=>r.default,enumerable:!0}:{value:r,enumerable:!0})),r);var U=Fr(R=>{(function(r,e){if(typeof define=="function"&&define.amd)define(["exports"],e);else if(typeof R!="undefined")e(R);else{var t={exports:{}};e(t.exports),r.index=t.exports}})(R,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,T){return p.__proto__=T,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():""},k=function(a){function c(p,T,d){var F;return l(this,c),F=t(this,o(c).call(this,"E",p)),F.lhs=T,F.rhs=d,F}return s(c,a),c}(M),C=function(a){function c(p,T,d,F){var h;return l(this,c),h=t(this,o(c).call(this,"M",p)),h.item=T,h.lhsIndex=d,h.rhsIndex=F,h}return s(c,a),c}(M),L=function(a){function c(p,T){var d;return l(this,c),d=t(this,o(c).call(this,"D",p)),d.lhs=T,d}return s(c,a),c}(M),A=function(a){function c(p,T){var d;return l(this,c),d=t(this,o(c).call(this,"A",p)),d.rhs=T,d}return s(c,a),c}(M),O=function(a,c){return a?"".concat(a,".").concat(c):c};r.diff=function(c,p){var T=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{},d=[],F=T.matchKey,h=T.types||["E","A","D","M"],mr=function(f,u,w,b){f.forEach(function(S,y){var g=u.findIndex(function(x){return x[b]===S[b]});-1<g?(-1<h.indexOf("M")&&y!==g&&d.push(new C(w,S,y,g)),j(S,u[g],O(w,g))):-1<h.indexOf("D")&&d.push(new L(w,S))}),u.forEach(function(S,y){var g=f.findIndex(function(x){return S[b]===x[b]});-1<h.indexOf("A")&&g===-1&&d.push(new A(O(w,y),S))})},j=function(f,u,w){var b=Object.prototype.toString.call(f),S=Object.prototype.toString.call(u);if(-1<h.indexOf("E")&&b!==S)return d.push(new k(w,f,u)),!1;if(b==="[object Object]")Object.getOwnPropertyNames(f).forEach(function(x){Object.prototype.hasOwnProperty.call(u,x)?j(f[x],u[x],O(w,x)):-1<h.indexOf("D")&&d.push(new L(O(w,x),f[x]))}),Object.getOwnPropertyNames(u).forEach(function(x){-1<h.indexOf("A")&&!Object.prototype.hasOwnProperty.call(f,x)&&d.push(new A(O(w,x),u[x]))});else if(b!=="[object Array]")-1<h.indexOf("E")&&f!==u&&d.push(new k(w,f,u));else if(F)mr(f,u,w,F);else{var y=f.length-1,g=u.length-1;if(-1<h.indexOf("D"))for(;y>g;)d.push(new L(O(w,y),f[y--]));if(-1<h.indexOf("A"))for(;g>y;)d.push(new A(O(w,g),u[g--]));for(;0<=y;--y)j(f[y],u[y],O(w,y))}};return j(c,p),d}})});var i=(r="",e={})=>{throw new Error(`[joystick${r?`.${r}`:""}] ${e.message||e.reason||e}`)};var hr=Or(U());var D=()=>typeof window=="undefined";var br=(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)}},E=(r="",e=null)=>{try{D()||(br(r)||{}).array.push({callback:e})}catch(t){i("addToQueue",t)}};var q=r=>{try{return!!Array.isArray(r)}catch(e){i("types.isArray",e)}};var B=r=>{try{return typeof r=="function"}catch(e){i("types.isFunction",e)}};var W=r=>{try{return!!(r&&typeof r=="object"&&!Array.isArray(r))}catch(e){i("types.isObject",e)}};var z=r=>{try{return typeof r=="string"}catch(e){i("types.isString",e)}};var G=(r=[],e="")=>{try{return(q(r)&&r.find(n=>n?.componentId===e))?.data||{}}catch(t){i("findComponentDataFromSSR",t)}};var Q=(r={},e={})=>{try{return Object.entries(e).reduce((t={},[n,o])=>(t[n]=(...s)=>o(...s,{...r,setState:r.setState.bind(r),...r.renderMethods||{}}),t),{})}catch{i("component.methods.compile")}};var V=(r={})=>{try{return Object.entries(r)?.reduce((e={},[t,n]={})=>(e[t]=n?.map((o={})=>({state:o?.state,children:V(o?.children)})),e),{})}catch(e){i("component.render.getExistingStateMap.buildMapForChildren",e)}},K=(r={})=>{try{return V(r)}catch(e){i("component.render.getExistingStateMap",e)}};var X=new RegExp(/\<\!\-\-(?:.|\n|\r)*?-->/g),Er=new RegExp(/\n/g);var kr=(r="")=>{try{return(r.match(X)||[]).forEach(t=>{r=r.replace(t,"")}),r}catch(e){i("component.render.sanitizeHTML.removeCommentedCode",e)}},J=(r="")=>{try{let e=`${r}`;return e=kr(e),e}catch(e){i("component.render.sanitizeHTML",e)}};var Y=(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 Z=(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&&Z(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)}},rr=Z;var er=(r={},e={})=>{try{e?.dataFromSSR&&(r.data=G(e.dataFromSSR,r.id)||{}),rr(r?.children);let t=K(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=Q(r,r.options.methods);let n=r.options.render({...r||{},setState:r.setState.bind(r),...r.renderMethods||{}}),o=J(n),s=Y(r,o);return{unwrapped:o,wrapped:s}}catch(t){i("component.render.toHTML",t)}};var Cr=(r={})=>{try{return Object.values(r).reduce((e={},t)=>(e[t.name]=t.value,e),{})}catch(e){i("component.virtualDOM.build.parseAttributeMap",e)}},nr=(r={})=>{try{return r.tagName==="WHEN"?[].flatMap.call(r?.childNodes,e=>e?.tagName==="WHEN"?nr(e):N(e)):N(r)}catch(e){i("component.virtualDOM.build.flattenWhenTags",e)}},N=(r={})=>{try{let e=r&&r.tagName&&r.tagName.toLowerCase()||"text",t={tagName:e,attributes:Cr(r.attributes),children:[].flatMap.call(r.childNodes,n=>nr(n))};return e==="text"&&(t=r.textContent),t}catch(e){i("component.virtualDOM.build",e)}},or=N;var jr=(r="")=>{try{let e=document.createElement("div");return e.innerHTML=r,e?.childNodes[0]}catch(e){i("component.virtualDOM.build.convertHTMLToDOM",e)}},ir=(r="")=>{try{let e=jr(r);return or(e)}catch(e){i("component.virtualDOM.build",e)}};var cr=(r="")=>{try{return document.createElement("div").setAttribute(r,"Test"),!0}catch{return!1}};var Rr=(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];cr(o)&&e.setAttribute(o,s)}for(let n=0;n<r?.children?.length;n+=1){let o=r?.children[n];if(o){let s=ar(o);e.appendChild(s)}}return e}catch(e){i("component.virtualDOM.renderTreeToDOM.renderElement",e)}},ar=(r=null)=>{try{return z(r)?document.createTextNode(r):Rr(r)}catch(e){i("component.virtualDOM.renderTreeToDOM",e)}},sr=ar;var dr=(r={},e={})=>{try{let t=er(r,{existingChildren:e?.existingChildren}),n=ir(t.wrapped,r),o=e.includeActual&&n?sr(n):null;return{html:t,virtual:n,actual:o}}catch(t){i("component.render.getUpdatedDOM",t)}};var lr=(r={},e="",t="id")=>{try{let n=r&&r.id;if(W(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 k=l[M],C=lr(k,e,t);if(C!==null)return C}}}return null}catch(n){i("component.findComponentInTreeByField",n)}},ur=lr;var pr=(r="",e={},t=null)=>{let n=ur(t||window.joystick._internal.tree,r,"instanceId");n&&(n.children=[...n.children||[],e])};var Dr=(r={},e={},t=null)=>{try{let n=dr(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)}},vr=(r={})=>{try{let e={id:r.id,instanceId:r.instanceId,instance:r,children:[]};pr(r.parent.instanceId,e,r.parent&&r.parent.ssrTree||null)}catch(e){i("component.renderMethods.component.handleAddComponentToParent",e)}},Nr=(r={},e={})=>{try{!r.renderedComponent&&e.options&&e.options.lifecycle&&(e.options.lifecycle.onBeforeMount&&E("lifecycle.onBeforeMount",()=>{e.options.lifecycle.onBeforeMount(e)}),!r.renderedComponent&&e.options.lifecycle.onMount&&E("lifecycle.onMount",()=>{e.options.lifecycle.onMount(e)}))}catch(t){i("component.renderMethods.component.handleLifecycle",t)}},Pr=(r={},e={},t={})=>{try{!e.walkingTreeForSSR&&r?.options?.lifecycle?.onUpdateProps&&(0,hr.diff)(e?.existingPropsMap,t)?.length>0&&E("lifecycle.onUpdateProps",()=>{let o=e?.existingPropsMap&&e?.existingPropsMap[r.id];r.options.lifecycle.onUpdateProps(o||{},t,r)})}catch(n){i("component.renderMethods.component.handleOnChangeProps",n)}},Hr=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,Pr(o,n,t),E("lifecycle.onMount",()=>{o.setDOMNodeOnInstance()}),Nr(this,o),o.parent&&vr(o),o.options.data&&o.parent.walkingTreeForSSR&&o.parent.ssrTree.dataFunctions?Ar(o):o.parent&&o.parent.ssrTree?Lr(o):Dr(o,this,l?.children)}},Ir=function(e,t){try{let n=this;return new Hr().bind({})(e,t,n)}catch(n){i("component.renderMethods.component",n)}},P=Ir;var _r=function(e=[],t=null){try{return B(t)&&e&&Array.isArray(e)?e.map((n,o)=>t(n,o)).join(""):""}catch(n){i("component.renderMethods.each",n)}},H=_r;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)}},Ur=(r="",e={})=>{try{return r?.split(".").reduce((t,n)=>t[n],e)}catch(t){i("component.renderMethods.i18n.getTranslationAtPath",t)}},qr=function(r="",e={}){try{let t=D()?this.translations:window.__joystick_i18n__,o=r?.includes(".")?Ur(r,t):t[r];if(!t||!o)return"";let s=Object.entries(e);return I(o,s)}catch(t){i("component.renderMethods.i18n",t)}},_=qr;var Br=function(e=!1,t=""){try{return this?.renderingHTMLWithDataForSSR||e?`<when>${t.trim()}</when>`:"<when> </when>"}catch(n){i("component.renderMethods.when",n)}},$=Br;var fr={c:P,component:P,e:H,each:H,i:_,i18n:_,w:$,when:$};var tr=(r={},e={})=>{try{return Object.entries(fr).reduce((t,[n,o])=>(t[n]=o.bind({...r,...e}),t),{})}catch(t){i("component.renderMethods.compile",t)}};export{tr as default};
@@ -1 +1 @@
1
- var wr=Object.create;var N=Object.defineProperty;var yr=Object.getOwnPropertyDescriptor;var xr=Object.getOwnPropertyNames;var Mr=Object.getPrototypeOf,gr=Object.prototype.hasOwnProperty;var Tr=r=>N(r,"__esModule",{value:!0});var Fr=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var Sr=(r,e,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of xr(e))!gr.call(r,n)&&n!=="default"&&N(r,n,{get:()=>e[n],enumerable:!(t=yr(e,n))||t.enumerable});return r},Or=r=>Sr(Tr(N(r!=null?wr(Mr(r)):{},"default",r&&r.__esModule&&"default"in r?{get:()=>r.default,enumerable:!0}:{value:r,enumerable:!0})),r);var U=Fr(j=>{(function(r,e){if(typeof define=="function"&&define.amd)define(["exports"],e);else if(typeof j!="undefined")e(j);else{var t={exports:{}};e(t.exports),r.index=t.exports}})(j,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():""},k=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),C=function(a){function c(p,g,d,F){var h;return l(this,c),h=t(this,o(c).call(this,"M",p)),h.item=g,h.lhsIndex=d,h.rhsIndex=F,h}return s(c,a),c}(M),L=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),A=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),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,h=g.types||["E","A","D","M"],mr=function(f,u,w,b){f.forEach(function(S,y){var T=u.findIndex(function(x){return x[b]===S[b]});-1<T?(-1<h.indexOf("M")&&y!==T&&d.push(new C(w,S,y,T)),R(S,u[T],O(w,T))):-1<h.indexOf("D")&&d.push(new L(w,S))}),u.forEach(function(S,y){var T=f.findIndex(function(x){return S[b]===x[b]});-1<h.indexOf("A")&&T===-1&&d.push(new A(O(w,y),S))})},R=function(f,u,w){var b=Object.prototype.toString.call(f),S=Object.prototype.toString.call(u);if(-1<h.indexOf("E")&&b!==S)return d.push(new k(w,f,u)),!1;if(b==="[object Object]")Object.getOwnPropertyNames(f).forEach(function(x){Object.prototype.hasOwnProperty.call(u,x)?R(f[x],u[x],O(w,x)):-1<h.indexOf("D")&&d.push(new L(O(w,x),f[x]))}),Object.getOwnPropertyNames(u).forEach(function(x){-1<h.indexOf("A")&&!Object.prototype.hasOwnProperty.call(f,x)&&d.push(new A(O(w,x),u[x]))});else if(b!=="[object Array]")-1<h.indexOf("E")&&f!==u&&d.push(new k(w,f,u));else if(F)mr(f,u,w,F);else{var y=f.length-1,T=u.length-1;if(-1<h.indexOf("D"))for(;y>T;)d.push(new L(O(w,y),f[y--]));if(-1<h.indexOf("A"))for(;T>y;)d.push(new A(O(w,T),u[T--]));for(;0<=y;--y)R(f[y],u[y],O(w,y))}};return R(c,p),d}})});var fr=Or(U());var i=(r="",e={})=>{throw new Error(`[joystick${r?`.${r}`:""}] ${e.message||e.reason||e}`)};var D=()=>typeof window=="undefined";var br=(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)}},E=(r="",e=null)=>{try{D()||(br(r)||{}).array.push({callback:e})}catch(t){i("addToQueue",t)}};var q=r=>{try{return!!Array.isArray(r)}catch(e){i("types.isArray",e)}};var B=r=>{try{return typeof r=="function"}catch(e){i("types.isFunction",e)}};var W=r=>{try{return!!(r&&typeof r=="object"&&!Array.isArray(r))}catch(e){i("types.isObject",e)}};var z=r=>{try{return typeof r=="string"}catch(e){i("types.isString",e)}};var G=(r=[],e="")=>{try{return(q(r)&&r.find(n=>n?.componentId===e))?.data||{}}catch(t){i("findComponentDataFromSSR",t)}};var Er=function(e=[],t=null){try{return B(t)&&e&&Array.isArray(e)?e.map((n,o)=>t(n,o)).join(""):""}catch(n){i("component.renderMethods.each",n)}},v=Er;var kr=(r="",e=[])=>{try{return e.reduce((t,[n,o])=>t.replace(`{{${n}}}`,o),r)}catch(t){i("component.renderMethods.i18n.replacePlaceholdersInString",t)}},P=(r="",e=[])=>{try{let t=typeof r=="string",n=Array.isArray(r),o=typeof r=="object"&&!n;if(t)return kr(r,e);if(n)return r?.map(s=>P(s,e));if(o)return Object.entries(r)?.reduce((s={},[m,l])=>(s[m]=P(l,e),s),{})}catch(t){i("component.renderMethods.i18n.handleTranslationReplacement",t)}},Cr=(r="",e={})=>{try{return r?.split(".").reduce((t,n)=>(console.log({key:r,objectToTraverse:t,keyToMatch:n}),t[n]),e)}catch(t){i("component.renderMethods.i18n.getTranslationAtPath",t)}},Rr=function(r="",e={}){try{let t=D()?this.translations:window.__joystick_i18n__,o=r?.includes(".")?Cr(r,t):t[r];if(r?.includes("creatorDashboard")&&console.log({key:r,replacements:e,translation:o,translations:t}),!t||!o)return"";let s=Object.entries(e);return P(o,s)}catch(t){i("component.renderMethods.i18n",t)}},H=Rr;var jr=function(e=!1,t=""){try{return this?.renderingHTMLWithDataForSSR||e?`<when>${t.trim()}</when>`:"<when> </when>"}catch(n){i("component.renderMethods.when",n)}},I=jr;var Q={c:_,component:_,e:v,each:v,i:H,i18n:H,w:I,when:I};var V=(r={},e={})=>{try{return Object.entries(Q).reduce((t,[n,o])=>(t[n]=o.bind({...r,...e}),t),{})}catch(t){i("component.renderMethods.compile",t)}};var K=(r={},e={})=>{try{return Object.entries(e).reduce((t={},[n,o])=>(t[n]=(...s)=>o(...s,{...r,setState:r.setState.bind(r),...r.renderMethods||{}}),t),{})}catch{i("component.methods.compile")}};var X=(r={})=>{try{return Object.entries(r)?.reduce((e={},[t,n]={})=>(e[t]=n?.map((o={})=>({state:o?.state,children:X(o?.children)})),e),{})}catch(e){i("component.render.getExistingStateMap.buildMapForChildren",e)}},J=(r={})=>{try{return X(r)}catch(e){i("component.render.getExistingStateMap",e)}};var Y=new RegExp(/\<\!\-\-(?:.|\n|\r)*?-->/g),Dr=new RegExp(/\n/g);var Lr=(r="")=>{try{return(r.match(Y)||[]).forEach(t=>{r=r.replace(t,"")}),r}catch(e){i("component.render.sanitizeHTML.removeCommentedCode",e)}},Z=(r="")=>{try{let e=`${r}`;return e=Lr(e),e}catch(e){i("component.render.sanitizeHTML",e)}};var rr=(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 er=(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&&er(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)}},tr=er;var nr=(r={},e={})=>{try{e?.dataFromSSR&&(r.data=G(e.dataFromSSR,r.id)||{}),tr(r?.children);let t=J(e?.existingChildren||r?.children)||{};r.children={},r.renderMethods=V({...r,existingStateMap:t,translations:e?.translations||r.translations||{},ssrTree:e?.ssrTree,walkingTreeForSSR:e?.walkingTreeForSSR,renderingHTMLWithDataForSSR:e?.renderingHTMLWithDataForSSR,dataFromSSR:e?.dataFromSSR}),r.methods=K(r,r.options.methods);let n=r.options.render({...r||{},setState:r.setState.bind(r),...r.renderMethods||{}}),o=Z(n),s=rr(r,o);return{unwrapped:o,wrapped:s}}catch(t){i("component.render.toHTML",t)}};var Ar=(r={})=>{try{return Object.values(r).reduce((e={},t)=>(e[t.name]=t.value,e),{})}catch(e){i("component.virtualDOM.build.parseAttributeMap",e)}},or=(r={})=>{try{return r.tagName==="WHEN"?[].flatMap.call(r?.childNodes,e=>e?.tagName==="WHEN"?or(e):$(e)):$(r)}catch(e){i("component.virtualDOM.build.flattenWhenTags",e)}},$=(r={})=>{try{let e=r&&r.tagName&&r.tagName.toLowerCase()||"text",t={tagName:e,attributes:Ar(r.attributes),children:[].flatMap.call(r.childNodes,n=>or(n))};return e==="text"&&(t=r.textContent),t}catch(e){i("component.virtualDOM.build",e)}},ir=$;var Nr=(r="")=>{try{let e=document.createElement("div");return e.innerHTML=r,e?.childNodes[0]}catch(e){i("component.virtualDOM.build.convertHTMLToDOM",e)}},cr=(r="")=>{try{let e=Nr(r);return ir(e)}catch(e){i("component.virtualDOM.build",e)}};var ar=(r="")=>{try{return document.createElement("div").setAttribute(r,"Test"),!0}catch{return!1}};var vr=(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];ar(o)&&e.setAttribute(o,s)}for(let n=0;n<r?.children?.length;n+=1){let o=r?.children[n];if(o){let s=sr(o);e.appendChild(s)}}return e}catch(e){i("component.virtualDOM.renderTreeToDOM.renderElement",e)}},sr=(r=null)=>{try{return z(r)?document.createTextNode(r):vr(r)}catch(e){i("component.virtualDOM.renderTreeToDOM",e)}},dr=sr;var lr=(r={},e={})=>{try{let t=nr(r,{existingChildren:e?.existingChildren}),n=cr(t.wrapped,r),o=e.includeActual&&n?dr(n):null;return{html:t,virtual:n,actual:o}}catch(t){i("component.render.getUpdatedDOM",t)}};var ur=(r={},e="",t="id")=>{try{let n=r&&r.id;if(W(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 k=l[M],C=ur(k,e,t);if(C!==null)return C}}}return null}catch(n){i("component.findComponentInTreeByField",n)}},pr=ur;var hr=(r="",e={},t=null)=>{let n=pr(t||window.joystick._internal.tree,r,"instanceId");n&&(n.children=[...n.children||[],e])};var Pr=(r={},e={},t=null)=>{try{let n=lr(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)}},Hr=(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)}},Ir=(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)}},_r=(r={})=>{try{let e={id:r.id,instanceId:r.instanceId,instance:r,children:[]};hr(r.parent.instanceId,e,r.parent&&r.parent.ssrTree||null)}catch(e){i("component.renderMethods.component.handleAddComponentToParent",e)}},$r=(r={},e={})=>{try{!r.renderedComponent&&e.options&&e.options.lifecycle&&(e.options.lifecycle.onBeforeMount&&E("lifecycle.onBeforeMount",()=>{e.options.lifecycle.onBeforeMount(e)}),!r.renderedComponent&&e.options.lifecycle.onMount&&E("lifecycle.onMount",()=>{e.options.lifecycle.onMount(e)}))}catch(t){i("component.renderMethods.component.handleLifecycle",t)}},Ur=(r={},e={},t={})=>{try{!e.walkingTreeForSSR&&r?.options?.lifecycle?.onUpdateProps&&(0,fr.diff)(e?.existingPropsMap,t)?.length>0&&E("lifecycle.onUpdateProps",()=>{let o=e?.existingPropsMap&&e?.existingPropsMap[r.id];r.options.lifecycle.onUpdateProps(o||{},t,r)})}catch(n){i("component.renderMethods.component.handleOnChangeProps",n)}},qr=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,Ur(o,n,t),E("lifecycle.onMount",()=>{o.setDOMNodeOnInstance()}),$r(this,o),o.parent&&_r(o),o.options.data&&o.parent.walkingTreeForSSR&&o.parent.ssrTree.dataFunctions?Ir(o):o.parent&&o.parent.ssrTree?Hr(o):Pr(o,this,l?.children)}},Br=function(e,t){try{let n=this;return new qr().bind({})(e,t,n)}catch(n){i("component.renderMethods.component",n)}},_=Br;export{_ as default};
1
+ var wr=Object.create;var v=Object.defineProperty;var yr=Object.getOwnPropertyDescriptor;var xr=Object.getOwnPropertyNames;var Mr=Object.getPrototypeOf,Tr=Object.prototype.hasOwnProperty;var gr=r=>v(r,"__esModule",{value:!0});var Fr=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var Sr=(r,e,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of xr(e))!Tr.call(r,n)&&n!=="default"&&v(r,n,{get:()=>e[n],enumerable:!(t=yr(e,n))||t.enumerable});return r},Or=r=>Sr(gr(v(r!=null?wr(Mr(r)):{},"default",r&&r.__esModule&&"default"in r?{get:()=>r.default,enumerable:!0}:{value:r,enumerable:!0})),r);var U=Fr(R=>{(function(r,e){if(typeof define=="function"&&define.amd)define(["exports"],e);else if(typeof R!="undefined")e(R);else{var t={exports:{}};e(t.exports),r.index=t.exports}})(R,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,T){return p.__proto__=T,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():""},k=function(a){function c(p,T,d){var F;return l(this,c),F=t(this,o(c).call(this,"E",p)),F.lhs=T,F.rhs=d,F}return s(c,a),c}(M),C=function(a){function c(p,T,d,F){var h;return l(this,c),h=t(this,o(c).call(this,"M",p)),h.item=T,h.lhsIndex=d,h.rhsIndex=F,h}return s(c,a),c}(M),L=function(a){function c(p,T){var d;return l(this,c),d=t(this,o(c).call(this,"D",p)),d.lhs=T,d}return s(c,a),c}(M),A=function(a){function c(p,T){var d;return l(this,c),d=t(this,o(c).call(this,"A",p)),d.rhs=T,d}return s(c,a),c}(M),O=function(a,c){return a?"".concat(a,".").concat(c):c};r.diff=function(c,p){var T=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{},d=[],F=T.matchKey,h=T.types||["E","A","D","M"],mr=function(f,u,w,b){f.forEach(function(S,y){var g=u.findIndex(function(x){return x[b]===S[b]});-1<g?(-1<h.indexOf("M")&&y!==g&&d.push(new C(w,S,y,g)),j(S,u[g],O(w,g))):-1<h.indexOf("D")&&d.push(new L(w,S))}),u.forEach(function(S,y){var g=f.findIndex(function(x){return S[b]===x[b]});-1<h.indexOf("A")&&g===-1&&d.push(new A(O(w,y),S))})},j=function(f,u,w){var b=Object.prototype.toString.call(f),S=Object.prototype.toString.call(u);if(-1<h.indexOf("E")&&b!==S)return d.push(new k(w,f,u)),!1;if(b==="[object Object]")Object.getOwnPropertyNames(f).forEach(function(x){Object.prototype.hasOwnProperty.call(u,x)?j(f[x],u[x],O(w,x)):-1<h.indexOf("D")&&d.push(new L(O(w,x),f[x]))}),Object.getOwnPropertyNames(u).forEach(function(x){-1<h.indexOf("A")&&!Object.prototype.hasOwnProperty.call(f,x)&&d.push(new A(O(w,x),u[x]))});else if(b!=="[object Array]")-1<h.indexOf("E")&&f!==u&&d.push(new k(w,f,u));else if(F)mr(f,u,w,F);else{var y=f.length-1,g=u.length-1;if(-1<h.indexOf("D"))for(;y>g;)d.push(new L(O(w,y),f[y--]));if(-1<h.indexOf("A"))for(;g>y;)d.push(new A(O(w,g),u[g--]));for(;0<=y;--y)j(f[y],u[y],O(w,y))}};return j(c,p),d}})});var fr=Or(U());var i=(r="",e={})=>{throw new Error(`[joystick${r?`.${r}`:""}] ${e.message||e.reason||e}`)};var D=()=>typeof window=="undefined";var br=(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)}},E=(r="",e=null)=>{try{D()||(br(r)||{}).array.push({callback:e})}catch(t){i("addToQueue",t)}};var q=r=>{try{return!!Array.isArray(r)}catch(e){i("types.isArray",e)}};var B=r=>{try{return typeof r=="function"}catch(e){i("types.isFunction",e)}};var W=r=>{try{return!!(r&&typeof r=="object"&&!Array.isArray(r))}catch(e){i("types.isObject",e)}};var z=r=>{try{return typeof r=="string"}catch(e){i("types.isString",e)}};var G=(r=[],e="")=>{try{return(q(r)&&r.find(n=>n?.componentId===e))?.data||{}}catch(t){i("findComponentDataFromSSR",t)}};var Er=function(e=[],t=null){try{return B(t)&&e&&Array.isArray(e)?e.map((n,o)=>t(n,o)).join(""):""}catch(n){i("component.renderMethods.each",n)}},N=Er;var kr=(r="",e=[])=>{try{return e.reduce((t,[n,o])=>t.replace(`{{${n}}}`,o),r)}catch(t){i("component.renderMethods.i18n.replacePlaceholdersInString",t)}},P=(r="",e=[])=>{try{let t=typeof r=="string",n=Array.isArray(r),o=typeof r=="object"&&!n;if(t)return kr(r,e);if(n)return r?.map(s=>P(s,e));if(o)return Object.entries(r)?.reduce((s={},[m,l])=>(s[m]=P(l,e),s),{})}catch(t){i("component.renderMethods.i18n.handleTranslationReplacement",t)}},Cr=(r="",e={})=>{try{return r?.split(".").reduce((t,n)=>t[n],e)}catch(t){i("component.renderMethods.i18n.getTranslationAtPath",t)}},jr=function(r="",e={}){try{let t=D()?this.translations:window.__joystick_i18n__,o=r?.includes(".")?Cr(r,t):t[r];if(!t||!o)return"";let s=Object.entries(e);return P(o,s)}catch(t){i("component.renderMethods.i18n",t)}},H=jr;var Rr=function(e=!1,t=""){try{return this?.renderingHTMLWithDataForSSR||e?`<when>${t.trim()}</when>`:"<when> </when>"}catch(n){i("component.renderMethods.when",n)}},I=Rr;var Q={c:_,component:_,e:N,each:N,i:H,i18n:H,w:I,when:I};var V=(r={},e={})=>{try{return Object.entries(Q).reduce((t,[n,o])=>(t[n]=o.bind({...r,...e}),t),{})}catch(t){i("component.renderMethods.compile",t)}};var K=(r={},e={})=>{try{return Object.entries(e).reduce((t={},[n,o])=>(t[n]=(...s)=>o(...s,{...r,setState:r.setState.bind(r),...r.renderMethods||{}}),t),{})}catch{i("component.methods.compile")}};var X=(r={})=>{try{return Object.entries(r)?.reduce((e={},[t,n]={})=>(e[t]=n?.map((o={})=>({state:o?.state,children:X(o?.children)})),e),{})}catch(e){i("component.render.getExistingStateMap.buildMapForChildren",e)}},J=(r={})=>{try{return X(r)}catch(e){i("component.render.getExistingStateMap",e)}};var Y=new RegExp(/\<\!\-\-(?:.|\n|\r)*?-->/g),Dr=new RegExp(/\n/g);var Lr=(r="")=>{try{return(r.match(Y)||[]).forEach(t=>{r=r.replace(t,"")}),r}catch(e){i("component.render.sanitizeHTML.removeCommentedCode",e)}},Z=(r="")=>{try{let e=`${r}`;return e=Lr(e),e}catch(e){i("component.render.sanitizeHTML",e)}};var rr=(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 er=(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&&er(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)}},tr=er;var nr=(r={},e={})=>{try{e?.dataFromSSR&&(r.data=G(e.dataFromSSR,r.id)||{}),tr(r?.children);let t=J(e?.existingChildren||r?.children)||{};r.children={},r.renderMethods=V({...r,existingStateMap:t,translations:e?.translations||r.translations||{},ssrTree:e?.ssrTree,walkingTreeForSSR:e?.walkingTreeForSSR,renderingHTMLWithDataForSSR:e?.renderingHTMLWithDataForSSR,dataFromSSR:e?.dataFromSSR}),r.methods=K(r,r.options.methods);let n=r.options.render({...r||{},setState:r.setState.bind(r),...r.renderMethods||{}}),o=Z(n),s=rr(r,o);return{unwrapped:o,wrapped:s}}catch(t){i("component.render.toHTML",t)}};var Ar=(r={})=>{try{return Object.values(r).reduce((e={},t)=>(e[t.name]=t.value,e),{})}catch(e){i("component.virtualDOM.build.parseAttributeMap",e)}},or=(r={})=>{try{return r.tagName==="WHEN"?[].flatMap.call(r?.childNodes,e=>e?.tagName==="WHEN"?or(e):$(e)):$(r)}catch(e){i("component.virtualDOM.build.flattenWhenTags",e)}},$=(r={})=>{try{let e=r&&r.tagName&&r.tagName.toLowerCase()||"text",t={tagName:e,attributes:Ar(r.attributes),children:[].flatMap.call(r.childNodes,n=>or(n))};return e==="text"&&(t=r.textContent),t}catch(e){i("component.virtualDOM.build",e)}},ir=$;var vr=(r="")=>{try{let e=document.createElement("div");return e.innerHTML=r,e?.childNodes[0]}catch(e){i("component.virtualDOM.build.convertHTMLToDOM",e)}},cr=(r="")=>{try{let e=vr(r);return ir(e)}catch(e){i("component.virtualDOM.build",e)}};var ar=(r="")=>{try{return document.createElement("div").setAttribute(r,"Test"),!0}catch{return!1}};var Nr=(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];ar(o)&&e.setAttribute(o,s)}for(let n=0;n<r?.children?.length;n+=1){let o=r?.children[n];if(o){let s=sr(o);e.appendChild(s)}}return e}catch(e){i("component.virtualDOM.renderTreeToDOM.renderElement",e)}},sr=(r=null)=>{try{return z(r)?document.createTextNode(r):Nr(r)}catch(e){i("component.virtualDOM.renderTreeToDOM",e)}},dr=sr;var lr=(r={},e={})=>{try{let t=nr(r,{existingChildren:e?.existingChildren}),n=cr(t.wrapped,r),o=e.includeActual&&n?dr(n):null;return{html:t,virtual:n,actual:o}}catch(t){i("component.render.getUpdatedDOM",t)}};var ur=(r={},e="",t="id")=>{try{let n=r&&r.id;if(W(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 k=l[M],C=ur(k,e,t);if(C!==null)return C}}}return null}catch(n){i("component.findComponentInTreeByField",n)}},pr=ur;var hr=(r="",e={},t=null)=>{let n=pr(t||window.joystick._internal.tree,r,"instanceId");n&&(n.children=[...n.children||[],e])};var Pr=(r={},e={},t=null)=>{try{let n=lr(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)}},Hr=(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)}},Ir=(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)}},_r=(r={})=>{try{let e={id:r.id,instanceId:r.instanceId,instance:r,children:[]};hr(r.parent.instanceId,e,r.parent&&r.parent.ssrTree||null)}catch(e){i("component.renderMethods.component.handleAddComponentToParent",e)}},$r=(r={},e={})=>{try{!r.renderedComponent&&e.options&&e.options.lifecycle&&(e.options.lifecycle.onBeforeMount&&E("lifecycle.onBeforeMount",()=>{e.options.lifecycle.onBeforeMount(e)}),!r.renderedComponent&&e.options.lifecycle.onMount&&E("lifecycle.onMount",()=>{e.options.lifecycle.onMount(e)}))}catch(t){i("component.renderMethods.component.handleLifecycle",t)}},Ur=(r={},e={},t={})=>{try{!e.walkingTreeForSSR&&r?.options?.lifecycle?.onUpdateProps&&(0,fr.diff)(e?.existingPropsMap,t)?.length>0&&E("lifecycle.onUpdateProps",()=>{let o=e?.existingPropsMap&&e?.existingPropsMap[r.id];r.options.lifecycle.onUpdateProps(o||{},t,r)})}catch(n){i("component.renderMethods.component.handleOnChangeProps",n)}},qr=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,Ur(o,n,t),E("lifecycle.onMount",()=>{o.setDOMNodeOnInstance()}),$r(this,o),o.parent&&_r(o),o.options.data&&o.parent.walkingTreeForSSR&&o.parent.ssrTree.dataFunctions?Ir(o):o.parent&&o.parent.ssrTree?Hr(o):Pr(o,this,l?.children)}},Br=function(e,t){try{let n=this;return new qr().bind({})(e,t,n)}catch(n){i("component.renderMethods.component",n)}},_=Br;export{_ as default};
@@ -1 +1 @@
1
- var s=(t="",r={})=>{throw new Error(`[joystick${t?`.${t}`:""}] ${r.message||r.reason||r}`)};var a=()=>typeof window=="undefined";var u=(t="",r=[])=>{try{return r.reduce((n,[e,o])=>n.replace(`{{${e}}}`,o),t)}catch(n){s("component.renderMethods.i18n.replacePlaceholdersInString",n)}},c=(t="",r=[])=>{try{let n=typeof t=="string",e=Array.isArray(t),o=typeof t=="object"&&!e;if(n)return u(t,r);if(e)return t?.map(i=>c(i,r));if(o)return Object.entries(t)?.reduce((i={},[d,l])=>(i[d]=c(l,r),i),{})}catch(n){s("component.renderMethods.i18n.handleTranslationReplacement",n)}},h=(t="",r={})=>{try{return t?.split(".").reduce((n,e)=>(console.log({key:t,objectToTraverse:n,keyToMatch:e}),n[e]),r)}catch(n){s("component.renderMethods.i18n.getTranslationAtPath",n)}},f=function(t="",r={}){try{let n=a()?this.translations:window.__joystick_i18n__,o=t?.includes(".")?h(t,n):n[t];if(t?.includes("creatorDashboard")&&console.log({key:t,replacements:r,translation:o,translations:n}),!n||!o)return"";let i=Object.entries(r);return c(o,i)}catch(n){s("component.renderMethods.i18n",n)}},I=f;export{I as default};
1
+ var c=(t="",n={})=>{throw new Error(`[joystick${t?`.${t}`:""}] ${n.message||n.reason||n}`)};var a=()=>typeof window=="undefined";var u=(t="",n=[])=>{try{return n.reduce((r,[e,o])=>r.replace(`{{${e}}}`,o),t)}catch(r){c("component.renderMethods.i18n.replacePlaceholdersInString",r)}},s=(t="",n=[])=>{try{let r=typeof t=="string",e=Array.isArray(t),o=typeof t=="object"&&!e;if(r)return u(t,n);if(e)return t?.map(i=>s(i,n));if(o)return Object.entries(t)?.reduce((i={},[d,l])=>(i[d]=s(l,n),i),{})}catch(r){c("component.renderMethods.i18n.handleTranslationReplacement",r)}},h=(t="",n={})=>{try{return t?.split(".").reduce((r,e)=>r[e],n)}catch(r){c("component.renderMethods.i18n.getTranslationAtPath",r)}},p=function(t="",n={}){try{let r=a()?this.translations:window.__joystick_i18n__,o=t?.includes(".")?h(t,r):r[t];if(!r||!o)return"";let i=Object.entries(n);return s(o,i)}catch(r){c("component.renderMethods.i18n",r)}},g=p;export{g as default};
@@ -1 +1 @@
1
- var wr=Object.create;var N=Object.defineProperty;var yr=Object.getOwnPropertyDescriptor;var xr=Object.getOwnPropertyNames;var Mr=Object.getPrototypeOf,gr=Object.prototype.hasOwnProperty;var Tr=r=>N(r,"__esModule",{value:!0});var Fr=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var Sr=(r,e,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of xr(e))!gr.call(r,n)&&n!=="default"&&N(r,n,{get:()=>e[n],enumerable:!(t=yr(e,n))||t.enumerable});return r},Or=r=>Sr(Tr(N(r!=null?wr(Mr(r)):{},"default",r&&r.__esModule&&"default"in r?{get:()=>r.default,enumerable:!0}:{value:r,enumerable:!0})),r);var U=Fr(j=>{(function(r,e){if(typeof define=="function"&&define.amd)define(["exports"],e);else if(typeof j!="undefined")e(j);else{var t={exports:{}};e(t.exports),r.index=t.exports}})(j,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():""},k=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),C=function(a){function c(p,g,d,F){var h;return l(this,c),h=t(this,o(c).call(this,"M",p)),h.item=g,h.lhsIndex=d,h.rhsIndex=F,h}return s(c,a),c}(M),L=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),A=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),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,h=g.types||["E","A","D","M"],mr=function(f,u,w,b){f.forEach(function(S,y){var T=u.findIndex(function(x){return x[b]===S[b]});-1<T?(-1<h.indexOf("M")&&y!==T&&d.push(new C(w,S,y,T)),R(S,u[T],O(w,T))):-1<h.indexOf("D")&&d.push(new L(w,S))}),u.forEach(function(S,y){var T=f.findIndex(function(x){return S[b]===x[b]});-1<h.indexOf("A")&&T===-1&&d.push(new A(O(w,y),S))})},R=function(f,u,w){var b=Object.prototype.toString.call(f),S=Object.prototype.toString.call(u);if(-1<h.indexOf("E")&&b!==S)return d.push(new k(w,f,u)),!1;if(b==="[object Object]")Object.getOwnPropertyNames(f).forEach(function(x){Object.prototype.hasOwnProperty.call(u,x)?R(f[x],u[x],O(w,x)):-1<h.indexOf("D")&&d.push(new L(O(w,x),f[x]))}),Object.getOwnPropertyNames(u).forEach(function(x){-1<h.indexOf("A")&&!Object.prototype.hasOwnProperty.call(f,x)&&d.push(new A(O(w,x),u[x]))});else if(b!=="[object Array]")-1<h.indexOf("E")&&f!==u&&d.push(new k(w,f,u));else if(F)mr(f,u,w,F);else{var y=f.length-1,T=u.length-1;if(-1<h.indexOf("D"))for(;y>T;)d.push(new L(O(w,y),f[y--]));if(-1<h.indexOf("A"))for(;T>y;)d.push(new A(O(w,T),u[T--]));for(;0<=y;--y)R(f[y],u[y],O(w,y))}};return R(c,p),d}})});var fr=Or(U());var i=(r="",e={})=>{throw new Error(`[joystick${r?`.${r}`:""}] ${e.message||e.reason||e}`)};var D=()=>typeof window=="undefined";var br=(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)}},E=(r="",e=null)=>{try{D()||(br(r)||{}).array.push({callback:e})}catch(t){i("addToQueue",t)}};var q=r=>{try{return!!Array.isArray(r)}catch(e){i("types.isArray",e)}};var B=r=>{try{return typeof r=="function"}catch(e){i("types.isFunction",e)}};var W=r=>{try{return!!(r&&typeof r=="object"&&!Array.isArray(r))}catch(e){i("types.isObject",e)}};var z=r=>{try{return typeof r=="string"}catch(e){i("types.isString",e)}};var G=(r=[],e="")=>{try{return(q(r)&&r.find(n=>n?.componentId===e))?.data||{}}catch(t){i("findComponentDataFromSSR",t)}};var Q=(r={},e={})=>{try{return Object.entries(V).reduce((t,[n,o])=>(t[n]=o.bind({...r,...e}),t),{})}catch(t){i("component.renderMethods.compile",t)}};var K=(r={},e={})=>{try{return Object.entries(e).reduce((t={},[n,o])=>(t[n]=(...s)=>o(...s,{...r,setState:r.setState.bind(r),...r.renderMethods||{}}),t),{})}catch{i("component.methods.compile")}};var X=(r={})=>{try{return Object.entries(r)?.reduce((e={},[t,n]={})=>(e[t]=n?.map((o={})=>({state:o?.state,children:X(o?.children)})),e),{})}catch(e){i("component.render.getExistingStateMap.buildMapForChildren",e)}},J=(r={})=>{try{return X(r)}catch(e){i("component.render.getExistingStateMap",e)}};var Y=new RegExp(/\<\!\-\-(?:.|\n|\r)*?-->/g),Er=new RegExp(/\n/g);var kr=(r="")=>{try{return(r.match(Y)||[]).forEach(t=>{r=r.replace(t,"")}),r}catch(e){i("component.render.sanitizeHTML.removeCommentedCode",e)}},Z=(r="")=>{try{let e=`${r}`;return e=kr(e),e}catch(e){i("component.render.sanitizeHTML",e)}};var rr=(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 er=(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&&er(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)}},tr=er;var nr=(r={},e={})=>{try{e?.dataFromSSR&&(r.data=G(e.dataFromSSR,r.id)||{}),tr(r?.children);let t=J(e?.existingChildren||r?.children)||{};r.children={},r.renderMethods=Q({...r,existingStateMap:t,translations:e?.translations||r.translations||{},ssrTree:e?.ssrTree,walkingTreeForSSR:e?.walkingTreeForSSR,renderingHTMLWithDataForSSR:e?.renderingHTMLWithDataForSSR,dataFromSSR:e?.dataFromSSR}),r.methods=K(r,r.options.methods);let n=r.options.render({...r||{},setState:r.setState.bind(r),...r.renderMethods||{}}),o=Z(n),s=rr(r,o);return{unwrapped:o,wrapped:s}}catch(t){i("component.render.toHTML",t)}};var Cr=(r={})=>{try{return Object.values(r).reduce((e={},t)=>(e[t.name]=t.value,e),{})}catch(e){i("component.virtualDOM.build.parseAttributeMap",e)}},or=(r={})=>{try{return r.tagName==="WHEN"?[].flatMap.call(r?.childNodes,e=>e?.tagName==="WHEN"?or(e):v(e)):v(r)}catch(e){i("component.virtualDOM.build.flattenWhenTags",e)}},v=(r={})=>{try{let e=r&&r.tagName&&r.tagName.toLowerCase()||"text",t={tagName:e,attributes:Cr(r.attributes),children:[].flatMap.call(r.childNodes,n=>or(n))};return e==="text"&&(t=r.textContent),t}catch(e){i("component.virtualDOM.build",e)}},ir=v;var Rr=(r="")=>{try{let e=document.createElement("div");return e.innerHTML=r,e?.childNodes[0]}catch(e){i("component.virtualDOM.build.convertHTMLToDOM",e)}},cr=(r="")=>{try{let e=Rr(r);return ir(e)}catch(e){i("component.virtualDOM.build",e)}};var ar=(r="")=>{try{return document.createElement("div").setAttribute(r,"Test"),!0}catch{return!1}};var jr=(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];ar(o)&&e.setAttribute(o,s)}for(let n=0;n<r?.children?.length;n+=1){let o=r?.children[n];if(o){let s=sr(o);e.appendChild(s)}}return e}catch(e){i("component.virtualDOM.renderTreeToDOM.renderElement",e)}},sr=(r=null)=>{try{return z(r)?document.createTextNode(r):jr(r)}catch(e){i("component.virtualDOM.renderTreeToDOM",e)}},dr=sr;var lr=(r={},e={})=>{try{let t=nr(r,{existingChildren:e?.existingChildren}),n=cr(t.wrapped,r),o=e.includeActual&&n?dr(n):null;return{html:t,virtual:n,actual:o}}catch(t){i("component.render.getUpdatedDOM",t)}};var ur=(r={},e="",t="id")=>{try{let n=r&&r.id;if(W(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 k=l[M],C=ur(k,e,t);if(C!==null)return C}}}return null}catch(n){i("component.findComponentInTreeByField",n)}},pr=ur;var hr=(r="",e={},t=null)=>{let n=pr(t||window.joystick._internal.tree,r,"instanceId");n&&(n.children=[...n.children||[],e])};var Dr=(r={},e={},t=null)=>{try{let n=lr(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:[]};hr(r.parent.instanceId,e,r.parent&&r.parent.ssrTree||null)}catch(e){i("component.renderMethods.component.handleAddComponentToParent",e)}},vr=(r={},e={})=>{try{!r.renderedComponent&&e.options&&e.options.lifecycle&&(e.options.lifecycle.onBeforeMount&&E("lifecycle.onBeforeMount",()=>{e.options.lifecycle.onBeforeMount(e)}),!r.renderedComponent&&e.options.lifecycle.onMount&&E("lifecycle.onMount",()=>{e.options.lifecycle.onMount(e)}))}catch(t){i("component.renderMethods.component.handleLifecycle",t)}},Pr=(r={},e={},t={})=>{try{!e.walkingTreeForSSR&&r?.options?.lifecycle?.onUpdateProps&&(0,fr.diff)(e?.existingPropsMap,t)?.length>0&&E("lifecycle.onUpdateProps",()=>{let o=e?.existingPropsMap&&e?.existingPropsMap[r.id];r.options.lifecycle.onUpdateProps(o||{},t,r)})}catch(n){i("component.renderMethods.component.handleOnChangeProps",n)}},Hr=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,Pr(o,n,t),E("lifecycle.onMount",()=>{o.setDOMNodeOnInstance()}),vr(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):Dr(o,this,l?.children)}},Ir=function(e,t){try{let n=this;return new Hr().bind({})(e,t,n)}catch(n){i("component.renderMethods.component",n)}},P=Ir;var _r=function(e=[],t=null){try{return B(t)&&e&&Array.isArray(e)?e.map((n,o)=>t(n,o)).join(""):""}catch(n){i("component.renderMethods.each",n)}},H=_r;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)}},Ur=(r="",e={})=>{try{return r?.split(".").reduce((t,n)=>(console.log({key:r,objectToTraverse:t,keyToMatch:n}),t[n]),e)}catch(t){i("component.renderMethods.i18n.getTranslationAtPath",t)}},qr=function(r="",e={}){try{let t=D()?this.translations:window.__joystick_i18n__,o=r?.includes(".")?Ur(r,t):t[r];if(r?.includes("creatorDashboard")&&console.log({key:r,replacements:e,translation:o,translations:t}),!t||!o)return"";let s=Object.entries(e);return I(o,s)}catch(t){i("component.renderMethods.i18n",t)}},_=qr;var Br=function(e=!1,t=""){try{return this?.renderingHTMLWithDataForSSR||e?`<when>${t.trim()}</when>`:"<when> </when>"}catch(n){i("component.renderMethods.when",n)}},$=Br;var V={c:P,component:P,e:H,each:H,i:_,i18n:_,w:$,when:$};export{V as default};
1
+ var wr=Object.create;var v=Object.defineProperty;var yr=Object.getOwnPropertyDescriptor;var xr=Object.getOwnPropertyNames;var Mr=Object.getPrototypeOf,Tr=Object.prototype.hasOwnProperty;var gr=r=>v(r,"__esModule",{value:!0});var Fr=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var Sr=(r,e,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of xr(e))!Tr.call(r,n)&&n!=="default"&&v(r,n,{get:()=>e[n],enumerable:!(t=yr(e,n))||t.enumerable});return r},Or=r=>Sr(gr(v(r!=null?wr(Mr(r)):{},"default",r&&r.__esModule&&"default"in r?{get:()=>r.default,enumerable:!0}:{value:r,enumerable:!0})),r);var U=Fr(R=>{(function(r,e){if(typeof define=="function"&&define.amd)define(["exports"],e);else if(typeof R!="undefined")e(R);else{var t={exports:{}};e(t.exports),r.index=t.exports}})(R,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,T){return p.__proto__=T,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():""},k=function(a){function c(p,T,d){var F;return l(this,c),F=t(this,o(c).call(this,"E",p)),F.lhs=T,F.rhs=d,F}return s(c,a),c}(M),C=function(a){function c(p,T,d,F){var h;return l(this,c),h=t(this,o(c).call(this,"M",p)),h.item=T,h.lhsIndex=d,h.rhsIndex=F,h}return s(c,a),c}(M),L=function(a){function c(p,T){var d;return l(this,c),d=t(this,o(c).call(this,"D",p)),d.lhs=T,d}return s(c,a),c}(M),A=function(a){function c(p,T){var d;return l(this,c),d=t(this,o(c).call(this,"A",p)),d.rhs=T,d}return s(c,a),c}(M),O=function(a,c){return a?"".concat(a,".").concat(c):c};r.diff=function(c,p){var T=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{},d=[],F=T.matchKey,h=T.types||["E","A","D","M"],mr=function(f,u,w,b){f.forEach(function(S,y){var g=u.findIndex(function(x){return x[b]===S[b]});-1<g?(-1<h.indexOf("M")&&y!==g&&d.push(new C(w,S,y,g)),j(S,u[g],O(w,g))):-1<h.indexOf("D")&&d.push(new L(w,S))}),u.forEach(function(S,y){var g=f.findIndex(function(x){return S[b]===x[b]});-1<h.indexOf("A")&&g===-1&&d.push(new A(O(w,y),S))})},j=function(f,u,w){var b=Object.prototype.toString.call(f),S=Object.prototype.toString.call(u);if(-1<h.indexOf("E")&&b!==S)return d.push(new k(w,f,u)),!1;if(b==="[object Object]")Object.getOwnPropertyNames(f).forEach(function(x){Object.prototype.hasOwnProperty.call(u,x)?j(f[x],u[x],O(w,x)):-1<h.indexOf("D")&&d.push(new L(O(w,x),f[x]))}),Object.getOwnPropertyNames(u).forEach(function(x){-1<h.indexOf("A")&&!Object.prototype.hasOwnProperty.call(f,x)&&d.push(new A(O(w,x),u[x]))});else if(b!=="[object Array]")-1<h.indexOf("E")&&f!==u&&d.push(new k(w,f,u));else if(F)mr(f,u,w,F);else{var y=f.length-1,g=u.length-1;if(-1<h.indexOf("D"))for(;y>g;)d.push(new L(O(w,y),f[y--]));if(-1<h.indexOf("A"))for(;g>y;)d.push(new A(O(w,g),u[g--]));for(;0<=y;--y)j(f[y],u[y],O(w,y))}};return j(c,p),d}})});var fr=Or(U());var i=(r="",e={})=>{throw new Error(`[joystick${r?`.${r}`:""}] ${e.message||e.reason||e}`)};var D=()=>typeof window=="undefined";var br=(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)}},E=(r="",e=null)=>{try{D()||(br(r)||{}).array.push({callback:e})}catch(t){i("addToQueue",t)}};var q=r=>{try{return!!Array.isArray(r)}catch(e){i("types.isArray",e)}};var B=r=>{try{return typeof r=="function"}catch(e){i("types.isFunction",e)}};var W=r=>{try{return!!(r&&typeof r=="object"&&!Array.isArray(r))}catch(e){i("types.isObject",e)}};var z=r=>{try{return typeof r=="string"}catch(e){i("types.isString",e)}};var G=(r=[],e="")=>{try{return(q(r)&&r.find(n=>n?.componentId===e))?.data||{}}catch(t){i("findComponentDataFromSSR",t)}};var Q=(r={},e={})=>{try{return Object.entries(V).reduce((t,[n,o])=>(t[n]=o.bind({...r,...e}),t),{})}catch(t){i("component.renderMethods.compile",t)}};var K=(r={},e={})=>{try{return Object.entries(e).reduce((t={},[n,o])=>(t[n]=(...s)=>o(...s,{...r,setState:r.setState.bind(r),...r.renderMethods||{}}),t),{})}catch{i("component.methods.compile")}};var X=(r={})=>{try{return Object.entries(r)?.reduce((e={},[t,n]={})=>(e[t]=n?.map((o={})=>({state:o?.state,children:X(o?.children)})),e),{})}catch(e){i("component.render.getExistingStateMap.buildMapForChildren",e)}},J=(r={})=>{try{return X(r)}catch(e){i("component.render.getExistingStateMap",e)}};var Y=new RegExp(/\<\!\-\-(?:.|\n|\r)*?-->/g),Er=new RegExp(/\n/g);var kr=(r="")=>{try{return(r.match(Y)||[]).forEach(t=>{r=r.replace(t,"")}),r}catch(e){i("component.render.sanitizeHTML.removeCommentedCode",e)}},Z=(r="")=>{try{let e=`${r}`;return e=kr(e),e}catch(e){i("component.render.sanitizeHTML",e)}};var rr=(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 er=(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&&er(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)}},tr=er;var nr=(r={},e={})=>{try{e?.dataFromSSR&&(r.data=G(e.dataFromSSR,r.id)||{}),tr(r?.children);let t=J(e?.existingChildren||r?.children)||{};r.children={},r.renderMethods=Q({...r,existingStateMap:t,translations:e?.translations||r.translations||{},ssrTree:e?.ssrTree,walkingTreeForSSR:e?.walkingTreeForSSR,renderingHTMLWithDataForSSR:e?.renderingHTMLWithDataForSSR,dataFromSSR:e?.dataFromSSR}),r.methods=K(r,r.options.methods);let n=r.options.render({...r||{},setState:r.setState.bind(r),...r.renderMethods||{}}),o=Z(n),s=rr(r,o);return{unwrapped:o,wrapped:s}}catch(t){i("component.render.toHTML",t)}};var Cr=(r={})=>{try{return Object.values(r).reduce((e={},t)=>(e[t.name]=t.value,e),{})}catch(e){i("component.virtualDOM.build.parseAttributeMap",e)}},or=(r={})=>{try{return r.tagName==="WHEN"?[].flatMap.call(r?.childNodes,e=>e?.tagName==="WHEN"?or(e):N(e)):N(r)}catch(e){i("component.virtualDOM.build.flattenWhenTags",e)}},N=(r={})=>{try{let e=r&&r.tagName&&r.tagName.toLowerCase()||"text",t={tagName:e,attributes:Cr(r.attributes),children:[].flatMap.call(r.childNodes,n=>or(n))};return e==="text"&&(t=r.textContent),t}catch(e){i("component.virtualDOM.build",e)}},ir=N;var jr=(r="")=>{try{let e=document.createElement("div");return e.innerHTML=r,e?.childNodes[0]}catch(e){i("component.virtualDOM.build.convertHTMLToDOM",e)}},cr=(r="")=>{try{let e=jr(r);return ir(e)}catch(e){i("component.virtualDOM.build",e)}};var ar=(r="")=>{try{return document.createElement("div").setAttribute(r,"Test"),!0}catch{return!1}};var Rr=(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];ar(o)&&e.setAttribute(o,s)}for(let n=0;n<r?.children?.length;n+=1){let o=r?.children[n];if(o){let s=sr(o);e.appendChild(s)}}return e}catch(e){i("component.virtualDOM.renderTreeToDOM.renderElement",e)}},sr=(r=null)=>{try{return z(r)?document.createTextNode(r):Rr(r)}catch(e){i("component.virtualDOM.renderTreeToDOM",e)}},dr=sr;var lr=(r={},e={})=>{try{let t=nr(r,{existingChildren:e?.existingChildren}),n=cr(t.wrapped,r),o=e.includeActual&&n?dr(n):null;return{html:t,virtual:n,actual:o}}catch(t){i("component.render.getUpdatedDOM",t)}};var ur=(r={},e="",t="id")=>{try{let n=r&&r.id;if(W(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 k=l[M],C=ur(k,e,t);if(C!==null)return C}}}return null}catch(n){i("component.findComponentInTreeByField",n)}},pr=ur;var hr=(r="",e={},t=null)=>{let n=pr(t||window.joystick._internal.tree,r,"instanceId");n&&(n.children=[...n.children||[],e])};var Dr=(r={},e={},t=null)=>{try{let n=lr(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)}},vr=(r={})=>{try{let e={id:r.id,instanceId:r.instanceId,instance:r,children:[]};hr(r.parent.instanceId,e,r.parent&&r.parent.ssrTree||null)}catch(e){i("component.renderMethods.component.handleAddComponentToParent",e)}},Nr=(r={},e={})=>{try{!r.renderedComponent&&e.options&&e.options.lifecycle&&(e.options.lifecycle.onBeforeMount&&E("lifecycle.onBeforeMount",()=>{e.options.lifecycle.onBeforeMount(e)}),!r.renderedComponent&&e.options.lifecycle.onMount&&E("lifecycle.onMount",()=>{e.options.lifecycle.onMount(e)}))}catch(t){i("component.renderMethods.component.handleLifecycle",t)}},Pr=(r={},e={},t={})=>{try{!e.walkingTreeForSSR&&r?.options?.lifecycle?.onUpdateProps&&(0,fr.diff)(e?.existingPropsMap,t)?.length>0&&E("lifecycle.onUpdateProps",()=>{let o=e?.existingPropsMap&&e?.existingPropsMap[r.id];r.options.lifecycle.onUpdateProps(o||{},t,r)})}catch(n){i("component.renderMethods.component.handleOnChangeProps",n)}},Hr=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,Pr(o,n,t),E("lifecycle.onMount",()=>{o.setDOMNodeOnInstance()}),Nr(this,o),o.parent&&vr(o),o.options.data&&o.parent.walkingTreeForSSR&&o.parent.ssrTree.dataFunctions?Ar(o):o.parent&&o.parent.ssrTree?Lr(o):Dr(o,this,l?.children)}},Ir=function(e,t){try{let n=this;return new Hr().bind({})(e,t,n)}catch(n){i("component.renderMethods.component",n)}},P=Ir;var _r=function(e=[],t=null){try{return B(t)&&e&&Array.isArray(e)?e.map((n,o)=>t(n,o)).join(""):""}catch(n){i("component.renderMethods.each",n)}},H=_r;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)}},Ur=(r="",e={})=>{try{return r?.split(".").reduce((t,n)=>t[n],e)}catch(t){i("component.renderMethods.i18n.getTranslationAtPath",t)}},qr=function(r="",e={}){try{let t=D()?this.translations:window.__joystick_i18n__,o=r?.includes(".")?Ur(r,t):t[r];if(!t||!o)return"";let s=Object.entries(e);return I(o,s)}catch(t){i("component.renderMethods.i18n",t)}},_=qr;var Br=function(e=!1,t=""){try{return this?.renderingHTMLWithDataForSSR||e?`<when>${t.trim()}</when>`:"<when> </when>"}catch(n){i("component.renderMethods.when",n)}},$=Br;var V={c:P,component:P,e:H,each:H,i:_,i18n:_,w:$,when:$};export{V as default};
@@ -1,4 +1,4 @@
1
- var Qt=Object.create;var oe=Object.defineProperty;var Yt=Object.getOwnPropertyDescriptor;var Xt=Object.getOwnPropertyNames;var er=Object.getPrototypeOf,tr=Object.prototype.hasOwnProperty;var rr=t=>oe(t,"__esModule",{value:!0});var or=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var ir=(t,e,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Xt(e))!tr.call(t,o)&&o!=="default"&&oe(t,o,{get:()=>e[o],enumerable:!(r=Yt(e,o))||r.enumerable});return t},nr=t=>ir(rr(oe(t!=null?Qt(er(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var gt=or(Y=>{(function(t,e){if(typeof define=="function"&&define.amd)define(["exports"],e);else if(typeof Y!="undefined")e(Y);else{var r={exports:{}};e(r.exports),t.index=r.exports}})(Y,function(t){"use strict";function e(m){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(m)}function r(m,d){return d&&(e(d)==="object"||typeof d=="function")?d:o(m)}function o(m){if(m===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m}function i(m){return i=Object.setPrototypeOf?Object.getPrototypeOf:function(d){return d.__proto__||Object.getPrototypeOf(d)},i(m)}function s(m,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function");m.prototype=Object.create(d&&d.prototype,{constructor:{value:m,writable:!0,configurable:!0}}),d&&c(m,d)}function c(m,d){return c=Object.setPrototypeOf||function(b,O){return b.__proto__=O,b},c(m,d)}function a(m,d){if(!(m instanceof d))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0}),t.diff=void 0;var p=function m(d,b){a(this,m),this.type=d,this.path=b?b.toString():""},y=function(m){function d(b,O,h){var A;return a(this,d),A=r(this,i(d).call(this,"E",b)),A.lhs=O,A.rhs=h,A}return s(d,m),d}(p),w=function(m){function d(b,O,h,A){var $;return a(this,d),$=r(this,i(d).call(this,"M",b)),$.item=O,$.lhsIndex=h,$.rhsIndex=A,$}return s(d,m),d}(p),x=function(m){function d(b,O){var h;return a(this,d),h=r(this,i(d).call(this,"D",b)),h.lhs=O,h}return s(d,m),d}(p),v=function(m){function d(b,O){var h;return a(this,d),h=r(this,i(d).call(this,"A",b)),h.rhs=O,h}return s(d,m),d}(p),f=function(m,d){return m?"".concat(m,".").concat(d):d};t.diff=function(d,b){var O=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{},h=[],A=O.matchKey,$=O.types||["E","A","D","M"],Jt=function(F,g,E,D){F.forEach(function(L,k){var T=g.findIndex(function(M){return M[D]===L[D]});-1<T?(-1<$.indexOf("M")&&k!==T&&h.push(new w(E,L,k,T)),Z(L,g[T],f(E,T))):-1<$.indexOf("D")&&h.push(new x(E,L))}),g.forEach(function(L,k){var T=F.findIndex(function(M){return L[D]===M[D]});-1<$.indexOf("A")&&T===-1&&h.push(new v(f(E,k),L))})},Z=function(F,g,E){var D=Object.prototype.toString.call(F),L=Object.prototype.toString.call(g);if(-1<$.indexOf("E")&&D!==L)return h.push(new y(E,F,g)),!1;if(D==="[object Object]")Object.getOwnPropertyNames(F).forEach(function(M){Object.prototype.hasOwnProperty.call(g,M)?Z(F[M],g[M],f(E,M)):-1<$.indexOf("D")&&h.push(new x(f(E,M),F[M]))}),Object.getOwnPropertyNames(g).forEach(function(M){-1<$.indexOf("A")&&!Object.prototype.hasOwnProperty.call(F,M)&&h.push(new v(f(E,M),g[M]))});else if(D!=="[object Array]")-1<$.indexOf("E")&&F!==g&&h.push(new y(E,F,g));else if(A)Jt(F,g,E,A);else{var k=F.length-1,T=g.length-1;if(-1<$.indexOf("D"))for(;k>T;)h.push(new x(f(E,k),F[k--]));if(-1<$.indexOf("A"))for(;T>k;)h.push(new v(f(E,T),g[T--]));for(;0<=k;--k)Z(F[k],g[k],f(E,k))}};return Z(d,b),h}})});var n=(t="",e={})=>{throw new Error(`[joystick${t?`.${t}`:""}] ${e.message||e.reason||e}`)};var ue=["render"];var fe=(t={})=>{try{return ue.every(e=>Object.keys(t).includes(e))}catch(e){n("component.hasAllRequiredOptions",e)}};var he=["_componentId","_ssrId","api","dataFromSSR","existingProps","existingState","instanceId","parent","req","css","data","defaultProps","events","id","lifecycle","methods","name","props","render","state","translations","url","websockets","wrapper"];var we=t=>{try{return typeof t=="undefined"}catch(e){n("types.isUndefined",e)}},ye=t=>{try{return t===null}catch(e){n("types.isNull",e)}};var _=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 C=t=>{try{return typeof t=="string"}catch(e){n("types.isString",e)}};var xe=(t=null)=>{try{!C(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 ge=["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 be=(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(" ");ge.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 $e=["onBeforeMount","onMount","onUpdateProps","onBeforeUnmount","onRefetchData"];var Fe=(t=null)=>{try{u(t)||n("component.optionValidators.lifecycle","options.lifecycle must be an object.");for(let[e,r]of Object.entries(t))$e.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 ke=(t=null)=>{typeof t!="string"&&n("component.optionValidators.name","options.name must be a string.")};var Me=(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 Se=(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 Oe=(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"&&!C(r)&&n("component.optionValidators.wrapper",`options.wrapper.${e} must be assigned a string.`),e==="classList"&&!_(r)&&n("component.optionValidators.wrapper",`options.wrapper.${e} must be assigned an array of strings.`)}catch(e){n("component.optionValidators.wrapper",e)}};var Te={css:xe,events:be,lifecycle:Fe,methods:Ee,name:ke,render:Me,websockets:Se,wrapper:Oe};var ve=(t={})=>{try{fe(t)||n("component.validateOptions",`component options must include ${required.options.join(",")}.`);for(let[e,r]of Object.entries(t)){he.includes(e)||n("component.validateOptions",`${e} is not supported by joystick.component.`);let o=Te[e];o&&l(o)&&o(r)}}catch(e){n("component.validateOptions",e)}};var Ce="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890".split(""),U=(t=16)=>{let e="",r=0;for(;r<t;)e+=Ce[Math.floor(Math.random()*(Ce.length-1))],r+=1;return e};var B=(t=[],e="")=>{try{return(_(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 j=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 _e=/^((?:[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])+)\]))$/,je=(t,e="")=>t===!0?!!e.match(_e):!e.match(_e);var Pe=(t,e="")=>t===e;var Ie=(t,e="")=>t===e;var Ne=(t,e="")=>e.length<=t;var Ve=(t,e="")=>e.length>=t;var Ue=/^[\+]?[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]{4,6}$/,qe=(t,e="")=>t===!0?!!e.match(Ue):!e.match(Ue);var He={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}$/},ze=(t,e="")=>{let r=j(t)&&t.iso?He[t.iso||"US"]:He.US;return j(t)?t.rule===!0?!!e.match(r):!e.match(r):t===!0?!!e.match(r):!e.match(r)};var Ze=(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 Be=/^(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-]+)*))?$/,Ge=(t,e="")=>t===!0?!!e.match(Be):!e.match(Be);var Ke=/^[a-z0-9]+(?:-[a-z0-9]+)*$/,We=(t,e="")=>t===!0?!!e.match(Ke):!e.match(Ke);var Je=/^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$ %^&*-]).{8,}$/,Qe=(t,e="")=>t===!0?!!e.match(Je):!e.match(Je);var Ye=/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()!@:%_\+.~#?&\/\/=]*)/,Xe=(t,e="")=>t===!0?!!e.match(Ye):!e.match(Ye);var et={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},tt=(t,e="")=>{let r=j(t)&&t.iso?et[t.iso||"EU"]:et.EU;return j(t)?t.rule===!0?!!e.match(r):!e.match(r):t===!0?!!e.match(r):!e.match(r)};var rt={creditCard:De,email:je,equals:Pe,matches:Ie,maxLength:Ne,minLength:Ve,phone:qe,postalCode:ze,required:Ze,semVer:Ge,slug:We,strongPassword:Qe,url:Xe,vat:tt};var ot=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={required:()=>"This field is required.",email:()=>"Must be a valid email.",creditCard:()=>"Must be a valid credit card number.",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.",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.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]):{}}})}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){this.clearExistingErrors();let r=this.fields.find(o=>o.name===e);return 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 p=this.messages[e.name]&&this.messages[e.name][a.name];this.markValidationAsInvalid(e,a.name),this.renderError(e.element,p||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=rt[o.name];return i?i(o.rule,r,{isChecked:e}):!0}clearExistingErrors(){this.form&&this.form.querySelectorAll(".input-hint.error").forEach(e=>e.remove())}clearExistingError(e=""){let r=document.getElementById(`error-${e}`);r&&r.remove()}renderError(e,r=""){if(e){this.clearExistingError(e.name);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)}}},sr=(t,e)=>new Promise((r,o)=>{try{new ot(t,e).validate()?r():o()}catch(i){console.warn(i)}}),it=sr;var nt=(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=!we(s)&&!ye(s);return o[i]=a?s:c,o},{})}catch(r){n("component.props.compile",r)}};var st=(t="",e={})=>{try{let r="";if(t&&C(t))return r=t,r;if(t&&l(t))return r=t(e),r;if(t&&u(t)){let o=t?.print&&(C(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),p=t?.max?.width&&u(t?.max?.width),y=t?.max?.height&&u(t?.max?.height);if(o&&(r+=`
1
+ var Qt=Object.create;var oe=Object.defineProperty;var Yt=Object.getOwnPropertyDescriptor;var Xt=Object.getOwnPropertyNames;var er=Object.getPrototypeOf,tr=Object.prototype.hasOwnProperty;var rr=t=>oe(t,"__esModule",{value:!0});var or=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var ir=(t,e,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Xt(e))!tr.call(t,o)&&o!=="default"&&oe(t,o,{get:()=>e[o],enumerable:!(r=Yt(e,o))||r.enumerable});return t},nr=t=>ir(rr(oe(t!=null?Qt(er(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var gt=or(Y=>{(function(t,e){if(typeof define=="function"&&define.amd)define(["exports"],e);else if(typeof Y!="undefined")e(Y);else{var r={exports:{}};e(r.exports),t.index=r.exports}})(Y,function(t){"use strict";function e(m){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(m)}function r(m,d){return d&&(e(d)==="object"||typeof d=="function")?d:o(m)}function o(m){if(m===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m}function i(m){return i=Object.setPrototypeOf?Object.getPrototypeOf:function(d){return d.__proto__||Object.getPrototypeOf(d)},i(m)}function s(m,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function");m.prototype=Object.create(d&&d.prototype,{constructor:{value:m,writable:!0,configurable:!0}}),d&&c(m,d)}function c(m,d){return c=Object.setPrototypeOf||function(b,T){return b.__proto__=T,b},c(m,d)}function a(m,d){if(!(m instanceof d))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0}),t.diff=void 0;var p=function m(d,b){a(this,m),this.type=d,this.path=b?b.toString():""},y=function(m){function d(b,T,h){var A;return a(this,d),A=r(this,i(d).call(this,"E",b)),A.lhs=T,A.rhs=h,A}return s(d,m),d}(p),w=function(m){function d(b,T,h,A){var $;return a(this,d),$=r(this,i(d).call(this,"M",b)),$.item=T,$.lhsIndex=h,$.rhsIndex=A,$}return s(d,m),d}(p),x=function(m){function d(b,T){var h;return a(this,d),h=r(this,i(d).call(this,"D",b)),h.lhs=T,h}return s(d,m),d}(p),v=function(m){function d(b,T){var h;return a(this,d),h=r(this,i(d).call(this,"A",b)),h.rhs=T,h}return s(d,m),d}(p),f=function(m,d){return m?"".concat(m,".").concat(d):d};t.diff=function(d,b){var T=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{},h=[],A=T.matchKey,$=T.types||["E","A","D","M"],Jt=function(F,g,E,j){F.forEach(function(L,k){var O=g.findIndex(function(M){return M[j]===L[j]});-1<O?(-1<$.indexOf("M")&&k!==O&&h.push(new w(E,L,k,O)),Z(L,g[O],f(E,O))):-1<$.indexOf("D")&&h.push(new x(E,L))}),g.forEach(function(L,k){var O=F.findIndex(function(M){return L[j]===M[j]});-1<$.indexOf("A")&&O===-1&&h.push(new v(f(E,k),L))})},Z=function(F,g,E){var j=Object.prototype.toString.call(F),L=Object.prototype.toString.call(g);if(-1<$.indexOf("E")&&j!==L)return h.push(new y(E,F,g)),!1;if(j==="[object Object]")Object.getOwnPropertyNames(F).forEach(function(M){Object.prototype.hasOwnProperty.call(g,M)?Z(F[M],g[M],f(E,M)):-1<$.indexOf("D")&&h.push(new x(f(E,M),F[M]))}),Object.getOwnPropertyNames(g).forEach(function(M){-1<$.indexOf("A")&&!Object.prototype.hasOwnProperty.call(F,M)&&h.push(new v(f(E,M),g[M]))});else if(j!=="[object Array]")-1<$.indexOf("E")&&F!==g&&h.push(new y(E,F,g));else if(A)Jt(F,g,E,A);else{var k=F.length-1,O=g.length-1;if(-1<$.indexOf("D"))for(;k>O;)h.push(new x(f(E,k),F[k--]));if(-1<$.indexOf("A"))for(;O>k;)h.push(new v(f(E,O),g[O--]));for(;0<=k;--k)Z(F[k],g[k],f(E,k))}};return Z(d,b),h}})});var n=(t="",e={})=>{throw new Error(`[joystick${t?`.${t}`:""}] ${e.message||e.reason||e}`)};var ue=["render"];var fe=(t={})=>{try{return ue.every(e=>Object.keys(t).includes(e))}catch(e){n("component.hasAllRequiredOptions",e)}};var he=["_componentId","_ssrId","api","dataFromSSR","existingProps","existingState","instanceId","parent","req","css","data","defaultProps","events","id","lifecycle","methods","name","props","render","state","translations","url","websockets","wrapper"];var we=t=>{try{return typeof t=="undefined"}catch(e){n("types.isUndefined",e)}},ye=t=>{try{return t===null}catch(e){n("types.isNull",e)}};var D=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 C=t=>{try{return typeof t=="string"}catch(e){n("types.isString",e)}};var xe=(t=null)=>{try{!C(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 ge=["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 be=(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(" ");ge.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 $e=["onBeforeMount","onMount","onUpdateProps","onBeforeUnmount","onRefetchData"];var Fe=(t=null)=>{try{u(t)||n("component.optionValidators.lifecycle","options.lifecycle must be an object.");for(let[e,r]of Object.entries(t))$e.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 ke=(t=null)=>{typeof t!="string"&&n("component.optionValidators.name","options.name must be a string.")};var Me=(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 Se=(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 Te=(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"&&!C(r)&&n("component.optionValidators.wrapper",`options.wrapper.${e} must be assigned a string.`),e==="classList"&&!D(r)&&n("component.optionValidators.wrapper",`options.wrapper.${e} must be assigned an array of strings.`)}catch(e){n("component.optionValidators.wrapper",e)}};var Oe={css:xe,events:be,lifecycle:Fe,methods:Ee,name:ke,render:Me,websockets:Se,wrapper:Te};var ve=(t={})=>{try{fe(t)||n("component.validateOptions",`component options must include ${required.options.join(",")}.`);for(let[e,r]of Object.entries(t)){he.includes(e)||n("component.validateOptions",`${e} is not supported by joystick.component.`);let o=Oe[e];o&&l(o)&&o(r)}}catch(e){n("component.validateOptions",e)}};var Ce="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890".split(""),U=(t=16)=>{let e="",r=0;for(;r<t;)e+=Ce[Math.floor(Math.random()*(Ce.length-1))],r+=1;return e};var B=(t=[],e="")=>{try{return(D(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 _=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}))$/,je=(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 De=/^((?:[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])+)\]))$/,_e=(t,e="")=>t===!0?!!e.match(De):!e.match(De);var Pe=(t,e="")=>t===e;var Ie=(t,e="")=>t===e;var Ne=(t,e="")=>e.length<=t;var Ve=(t,e="")=>e.length>=t;var Ue=/^[\+]?[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]{4,6}$/,qe=(t,e="")=>t===!0?!!e.match(Ue):!e.match(Ue);var He={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}$/},ze=(t,e="")=>{let r=_(t)&&t.iso?He[t.iso||"US"]:He.US;return _(t)?t.rule===!0?!!e.match(r):!e.match(r):t===!0?!!e.match(r):!e.match(r)};var Ze=(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 Be=/^(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-]+)*))?$/,Ge=(t,e="")=>t===!0?!!e.match(Be):!e.match(Be);var Ke=/^[a-z0-9]+(?:-[a-z0-9]+)*$/,We=(t,e="")=>t===!0?!!e.match(Ke):!e.match(Ke);var Je=/^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$ %^&*-]).{8,}$/,Qe=(t,e="")=>t===!0?!!e.match(Je):!e.match(Je);var Ye=/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()!@:%_\+.~#?&\/\/=]*)/,Xe=(t,e="")=>t===!0?!!e.match(Ye):!e.match(Ye);var et={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},tt=(t,e="")=>{let r=_(t)&&t.iso?et[t.iso||"EU"]:et.EU;return _(t)?t.rule===!0?!!e.match(r):!e.match(r):t===!0?!!e.match(r):!e.match(r)};var rt={creditCard:je,email:_e,equals:Pe,matches:Ie,maxLength:Ne,minLength:Ve,phone:qe,postalCode:ze,required:Ze,semVer:Ge,slug:We,strongPassword:Qe,url:Xe,vat:tt};var ot=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={required:()=>"This field is required.",email:()=>"Must be a valid email.",creditCard:()=>"Must be a valid credit card number.",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.",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.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]):{}}})}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){this.clearExistingErrors();let r=this.fields.find(o=>o.name===e);return 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 p=this.messages[e.name]&&this.messages[e.name][a.name];this.markValidationAsInvalid(e,a.name),this.renderError(e.element,p||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=rt[o.name];return i?i(o.rule,r,{isChecked:e}):!0}clearExistingErrors(){this.form&&this.form.querySelectorAll(".input-hint.error").forEach(e=>e.remove())}clearExistingError(e=""){let r=document.getElementById(`error-${e}`);r&&r.remove()}renderError(e,r=""){if(e){this.clearExistingError(e.name);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)}}},sr=(t,e)=>new Promise((r,o)=>{try{new ot(t,e).validate()?r():o()}catch(i){console.warn(i)}}),it=sr;var nt=(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=!we(s)&&!ye(s);return o[i]=a?s:c,o},{})}catch(r){n("component.props.compile",r)}};var st=(t="",e={})=>{try{let r="";if(t&&C(t))return r=t,r;if(t&&l(t))return r=t(e),r;if(t&&u(t)){let o=t?.print&&(C(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),p=t?.max?.width&&u(t?.max?.width),y=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 Qt=Object.create;var oe=Object.defineProperty;var Yt=Object.getOwnPropertyDe
18
18
  @media screen and (max-height: ${v}px) {
19
19
  ${typeof f=="function"?f(e):f}
20
20
  }
21
- `}}return r}return""}catch(r){n("component.css.compileCSS",r)}};var ar=(t={},e=null)=>{try{let r=e(t);return r&&u(r)&&!_(r)?Object.assign({},r):{}}catch(r){n("component.state.compile.compileState",r)}},G=(t={},e={})=>{try{return l(e)?ar(t,e):Object.assign({},e)}catch(r){n("component.state.compile",r)}};var ie={onBeforeMount:()=>null,onMount:()=>null,onBeforeUnmount:()=>null,onUpdateProps:()=>null,onRefetchData:()=>null};var at=(t={},e={})=>{try{return e?Object.entries({...ie,...e||{}}).reduce((r={},[o,i])=>(r[o]=()=>i({...t,setState:t.setState.bind(t),...t.renderMethods||{}}),r),{}):ie}catch(r){n("component.lifecycle.compile",r)}};var K=(t={},e={})=>{try{return Object.entries(e).reduce((r={},[o,i])=>(r[o]=(...s)=>i(...s,{...t,setState:t.setState.bind(t),...t.renderMethods||{}}),r),{})}catch{n("component.methods.compile")}};var ne=(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="")=>C(e)&&t?.route!=="*"?e===(typeof location!="undefined"?location.pathname:t.path):!1}}catch(e){n("component.url.compile",e)}};var S=()=>typeof window=="undefined";var P=null,W=0,dt=(t={},e=null)=>{try{let r=t?.url;t?.query&&(r=`${r}?${new URLSearchParams(t.query).toString()}`);let o=new WebSocket(r);P&&(clearInterval(P),P=null);let i={client:o,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),W=0}),o.addEventListener("message",s=>{s?.data&&t?.events?.onMessage&&t.events.onMessage(JSON.parse(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),o=null;let c=[1e3,1001].includes(s?.code);t?.options?.autoReconnect&&!P&&!c&&(P=setInterval(()=>{o=null,W<(t?.options?.reconnectAttempts||12)?(dt(t,e),t?.options?.logging&&console.log(`[joystick.websockets] Attempting to reconnect (${W+1}/12)...`),W+=1):clearInterval(P)},t?.options?.reconnectDelayInSeconds*1e3||5e3))}),e&&e(i),i}catch(r){n("websockets.client",r)}},ct=dt;var dr=(t={},e=null)=>{try{let r=e(t);return r&&u(r)&&!_(r)?Object.assign({},r):{}}catch(r){n("component.props.compileDefaultProps.compile",r)}},lt=(t={},e={})=>{try{return l(e)?dr(t,e):Object.assign({},e)}catch(r){n("component.props.compileDefaultProps",r)}};var pt=(t={},e={})=>{try{t.options=e||{},t.id=e?._componentId||null,t.instanceId=U(8),t.ssrId=e?._ssrId||null,t.css=st(),t.data=B(e?.dataFromSSR,e?._componentId),t.defaultProps=lt(t,e?.defaultProps),t.props=nt(t?.defaultProps,e?.props),t.state=G(t,e?.state),t.events=e?.events||{},t.lifecycle=at(t,e?.lifecycle),t.methods=K(t,e?.methods),t.wrapper=e?.wrapper||{},t.translations=e?.translations||{},t.validateForm=it,t.DOMNode=null,t.dom={},t.dom.virtual={},t.dom.actual={};let r=!S();if(r||(t.url=ne(e?.url)),r&&window.__joystick_url__&&(t.url=ne(window.__joystick_url__)),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];ct({url:`${window?.process?.env.NODE_ENV==="development"?"ws":"wss"}://${location.host}/api/_websockets/${c}`,options:a?.options||{},query:a?.query||{},events:a?.events||{}},(p={})=>{t.websockets={...t.websockets||{},[c]:p}})}}}catch(r){n("component.registerOptions",r)}};var I=(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 J=(t="{}")=>{try{return JSON.parse(t)}catch{return t}};var mt=(t={})=>Object.entries(t).map(([e,r])=>`${e}=${r}`)?.join("; ");var cr=async(t={})=>{try{let e=await t.text();return J(e)}catch(e){n("api.get.handleParseResponse",e)}},ut=(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"),p={...e?.headers||{},"x-joystick-csrf":a};return window?.__joystick_test__&&(p.Cookie=mt({joystickLoginToken:window.__joystick_test_login_token__,joystickLoginTokenExpiresAt:window.__joystick_test_login_token_expires_at__})),fetch(c,{method:"GET",mode:"cors",headers:p,credentials:"include"}).then(async y=>{let w=await cr(y);return w?.errors?(I("get request",w.errors),o(w)):r(w)}).catch(y=>(I("get request",[y]),o({errors:[y]})))}):Promise.resolve()}catch(r){n("get request",r)}};var lr=async(t={})=>{try{let e=await t.text();return J(e)}catch(e){n("api.set.handleParseResponse",e)}},pr=(t={})=>{try{return JSON.stringify(t)}catch(e){n("api.set.getBody",e)}},ft=(t="",e={})=>{try{return typeof window.fetch!="undefined"?new Promise((r,o)=>{let i=`${window.location.origin}/api/_setters/${t}`,s=pr(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__})),fetch(i,{method:"POST",mode:"cors",headers:a,body:s,credentials:"include"}).then(async p=>{let y=await lr(p);return y?.errors?(I("set request",y.errors),o(y)):r(y)}).catch(p=>(I("set request",[p]),o({errors:[p]})))}):Promise.resolve()}catch(r){n("set request",r)}};var ht={get:ut,set:ft};var mr=(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)}},q=(t="",e=null)=>{try{S()||(mr(t)||{}).array.push({callback:e})}catch(r){n("addToQueue",r)}};var Q=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 wt=(t={},e={},r={})=>{try{return{...t,refetch:async(o={})=>{let i=await Q(ht,e,o,r);return r.data=wt(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)}},yt=wt;var xt=(t={})=>{try{if(!S()){let e=window.__joystick_data__&&window.__joystick_data__[t?.id]||{},r=window.__joystick_req__||{};return yt(e,r,t)}return t?.data||{}}catch(e){n("component.loadDataFromWindow",e)}};var Ft=nr(gt());var bt=(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 p=0;p<a.length;p+=1){let y=a[p],w=bt(y,e,r);if(w!==null)return w}}}return null}catch(o){n("component.findComponentInTreeByField",o)}},R=bt;var $t=(t="",e={},r=null)=>{let o=R(r||window.joystick._internal.tree,t,"instanceId");o&&(o.children=[...o.children||[],e])};var ur=(t={},e={},r=null)=>{try{let o=N(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)}},fr=(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)}},hr=(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)}},wr=(t={})=>{try{let e={id:t.id,instanceId:t.instanceId,instance:t,children:[]};$t(t.parent.instanceId,e,t.parent&&t.parent.ssrTree||null)}catch(e){n("component.renderMethods.component.handleAddComponentToParent",e)}},yr=(t={},e={})=>{try{!t.renderedComponent&&e.options&&e.options.lifecycle&&(e.options.lifecycle.onBeforeMount&&q("lifecycle.onBeforeMount",()=>{e.options.lifecycle.onBeforeMount(e)}),!t.renderedComponent&&e.options.lifecycle.onMount&&q("lifecycle.onMount",()=>{e.options.lifecycle.onMount(e)}))}catch(r){n("component.renderMethods.component.handleLifecycle",r)}},xr=(t={},e={},r={})=>{try{!e.walkingTreeForSSR&&t?.options?.lifecycle?.onUpdateProps&&(0,Ft.diff)(e?.existingPropsMap,r)?.length>0&&q("lifecycle.onUpdateProps",()=>{let i=e?.existingPropsMap&&e?.existingPropsMap[t.id];t.options.lifecycle.onUpdateProps(i||{},r,t)})}catch(o){n("component.renderMethods.component.handleOnChangeProps",o)}},gr=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,xr(i,o,r),q("lifecycle.onMount",()=>{i.setDOMNodeOnInstance()}),yr(this,i),i.parent&&wr(i),i.options.data&&i.parent.walkingTreeForSSR&&i.parent.ssrTree.dataFunctions?hr(i):i.parent&&i.parent.ssrTree?fr(i):ur(i,this,a?.children)}},br=function(e,r){try{let o=this;return new gr().bind({})(e,r,o)}catch(o){n("component.renderMethods.component",o)}},se=br;var $r=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)}},ae=$r;var Fr=(t="",e=[])=>{try{return e.reduce((r,[o,i])=>r.replace(`{{${o}}}`,i),t)}catch(r){n("component.renderMethods.i18n.replacePlaceholdersInString",r)}},de=(t="",e=[])=>{try{let r=typeof t=="string",o=Array.isArray(t),i=typeof t=="object"&&!o;if(r)return Fr(t,e);if(o)return t?.map(s=>de(s,e));if(i)return Object.entries(t)?.reduce((s={},[c,a])=>(s[c]=de(a,e),s),{})}catch(r){n("component.renderMethods.i18n.handleTranslationReplacement",r)}},Er=(t="",e={})=>{try{return t?.split(".").reduce((r,o)=>(console.log({key:t,objectToTraverse:r,keyToMatch:o}),r[o]),e)}catch(r){n("component.renderMethods.i18n.getTranslationAtPath",r)}},kr=function(t="",e={}){try{let r=S()?this.translations:window.__joystick_i18n__,i=t?.includes(".")?Er(t,r):r[t];if(t?.includes("creatorDashboard")&&console.log({key:t,replacements:e,translation:i,translations:r}),!r||!i)return"";let s=Object.entries(e);return de(i,s)}catch(r){n("component.renderMethods.i18n",r)}},ce=kr;var Mr=function(e=!1,r=""){try{return this?.renderingHTMLWithDataForSSR||e?`<when>${r.trim()}</when>`:"<when> </when>"}catch(o){n("component.renderMethods.when",o)}},le=Mr;var Et={c:se,component:se,e:ae,each:ae,i:ce,i18n:ce,w:le,when:le};var kt=(t={},e={})=>{try{return Object.entries(Et).reduce((r,[o,i])=>(r[o]=i.bind({...t,...e}),r),{})}catch(r){n("component.renderMethods.compile",r)}};var Mt=(t={})=>{try{return Object.entries(t)?.reduce((e={},[r,o]={})=>(e[r]=o?.map((i={})=>({state:i?.state,children:Mt(i?.children)})),e),{})}catch(e){n("component.render.getExistingStateMap.buildMapForChildren",e)}},St=(t={})=>{try{return Mt(t)}catch(e){n("component.render.getExistingStateMap",e)}};var Ot=new RegExp(/\<\!\-\-(?:.|\n|\r)*?-->/g),Sr=new RegExp(/\n/g);var Or=(t="")=>{try{return(t.match(Ot)||[]).forEach(r=>{t=t.replace(r,"")}),t}catch(e){n("component.render.sanitizeHTML.removeCommentedCode",e)}},Tt=(t="")=>{try{let e=`${t}`;return e=Or(e),e}catch(e){n("component.render.sanitizeHTML",e)}};var vt=(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 Ct=(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 p=c[a];Object.entries(p?.timers)?.length>0&&r.push(...Object.values(p?.timers)),Object.entries(p?.children)?.length>0&&Ct(p?.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)}},Rt=Ct;var X=(t={},e={})=>{try{e?.dataFromSSR&&(t.data=B(e.dataFromSSR,t.id)||{}),Rt(t?.children);let r=St(e?.existingChildren||t?.children)||{};t.children={},t.renderMethods=kt({...t,existingStateMap:r,translations:e?.translations||t.translations||{},ssrTree:e?.ssrTree,walkingTreeForSSR:e?.walkingTreeForSSR,renderingHTMLWithDataForSSR:e?.renderingHTMLWithDataForSSR,dataFromSSR:e?.dataFromSSR}),t.methods=K(t,t.options.methods);let o=t.options.render({...t||{},setState:t.setState.bind(t),...t.renderMethods||{}}),i=Tt(o),s=vt(t,i);return{unwrapped:i,wrapped:s}}catch(r){n("component.render.toHTML",r)}};var Tr=(t={})=>{try{return Object.values(t).reduce((e={},r)=>(e[r.name]=r.value,e),{})}catch(e){n("component.virtualDOM.build.parseAttributeMap",e)}},At=(t={})=>{try{return t.tagName==="WHEN"?[].flatMap.call(t?.childNodes,e=>e?.tagName==="WHEN"?At(e):pe(e)):pe(t)}catch(e){n("component.virtualDOM.build.flattenWhenTags",e)}},pe=(t={})=>{try{let e=t&&t.tagName&&t.tagName.toLowerCase()||"text",r={tagName:e,attributes:Tr(t.attributes),children:[].flatMap.call(t.childNodes,o=>At(o))};return e==="text"&&(r=t.textContent),r}catch(e){n("component.virtualDOM.build",e)}},H=pe;var vr=(t="")=>{try{let e=document.createElement("div");return e.innerHTML=t,e?.childNodes[0]}catch(e){n("component.virtualDOM.build.convertHTMLToDOM",e)}},Lt=(t="")=>{try{let e=vr(t);return H(e)}catch(e){n("component.virtualDOM.build",e)}};var Dt=(t="")=>{try{return document.createElement("div").setAttribute(t,"Test"),!0}catch{return!1}};var Cr=(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];Dt(i)&&e.setAttribute(i,s)}for(let o=0;o<t?.children?.length;o+=1){let i=t?.children[o];if(i){let s=_t(i);e.appendChild(s)}}return e}catch(e){n("component.virtualDOM.renderTreeToDOM.renderElement",e)}},_t=(t=null)=>{try{return C(t)?document.createTextNode(t):Cr(t)}catch(e){n("component.virtualDOM.renderTreeToDOM",e)}},V=_t;var N=(t={},e={})=>{try{let r=X(t,{existingChildren:e?.existingChildren}),o=Lt(r.wrapped,t),i=e.includeActual&&o?V(o):null;return{html:r,virtual:o,actual:i}}catch(r){n("component.render.getUpdatedDOM",r)}};var jt=(t={},e={})=>{try{let r=N(t,{includeActual:!0,existingChildren:e?.existingChildren});return t.dom=r,r.actual}catch(r){n("component.render.forMount",r)}};var Rr=(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)}},ee=Rr;var Ar=(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},Pt=Ar;var Lr=(t=[],e)=>{t.forEach(r=>{r&&typeof r=="function"&&r(e)})},Dr=(t=[])=>{t.forEach(([e,r])=>{e&&typeof e=="function"&&e(r)})},_r=(t=[],e=[])=>{let r=[];return e.slice(t.length).forEach(i=>{let s=c=>{let a=V(i);return c.appendChild(a),c};r.push(s)}),r},jr=(t=[],e=[])=>{let r=[];return t.forEach((o,i)=>{let s=re(o,e[i]);r.push(s)}),r},Pr=(t=[],e=[])=>{let r=jr(t,e),o=_r(t,e);return i=>{if(i){let s=Pt(r,i.childNodes);Dr(s),Lr(o,i)}return i}},te=Pr;var It={select:(t,e)=>r=>{let o=r.value;r.replaceChildren(),ee(t.attributes,e.attributes)(r),te([],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 me=(t,e)=>r=>{let o=t?V(t):null;return r&&r.replaceWith(o),o},Ir=()=>t=>{t&&t.remove()},Nr=(t=void 0,e=void 0)=>t===void 0||e===void 0?Ir():typeof t=="string"||typeof e=="string"?me(e,t):t.tagName!==e.tagName?me(e):e.tagName==="select"?It.select(t,e):["pre","code"].includes(e.tagName)?me(e,t):i=>(ee(t.attributes,e.attributes)(i),te(t.children,e.children)(i),i),re=Nr;var Vr=(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)}},z=(t="",e=null)=>{try{S()||(Vr(t)||{}).process(e)}catch(r){n("processQueue",r)}};var Nt=(t="",e=null)=>{let r=R(e||window.joystick._internal.tree,t,"instanceId");r&&(r.children=[])};var Vt=(t="",e={},r=null)=>{let o=R(r||window.joystick._internal.tree,t,"instanceId");o&&(o.instanceId=e?.instanceId,o.instance=e)};var Ut=(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)&&Ut(i,e,r)}},qt=Ut;var Ht=(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 zt=(t={},e={},r=[])=>{try{let o=Object.keys(t?.events||{})?.length>0?Ht(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||{}})}})}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];zt(c,e,r)}}return r}catch(o){n("component.eve!nts.registerListenersFix.getListeners",o)}},Ur=(t={},e={})=>{try{let o=zt(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:p,handler:y}=o[i];c.addEventListener(p,y),s._eventListeners=[...s?._eventListeners||[],{instance:s,element:c,elementSelector:a,type:p,handler:y}]}}catch(r){n("component.events.registerListenersFix",r)}},Zt=Ur;var Bt=(t={})=>{try{let e=t?._eventListeners||[];if(t?.children){let o=(Object.values(t?.children||{})?.reduce((i=[],s=[])=>[...i,...s],[])).flatMap((i={})=>Bt(i));e=[...e,...o]}return e}catch(e){n("component.events.unregisterListenersFix.getListeners",e)}},qr=(t={})=>{try{let e=Bt(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)}},Gt=qr;var Kt=class{constructor(e={}){this.parent=e?.parent||null,this.onUpdateChildComponent=this.handleUpdateChildComponentInVDOM,this.updateVirtualDOM=this.handleUpdateVirtualDOM,this.timers={},this.children={},ve(e),pt(this,e),this.data=xt(this)}setDOMNodeOnInstance(){this.DOMNode=document.querySelector(`body [js-i="${this.instanceId}"]`)}async handleFetchData(e={},r={},o={},i=this){let s=await Q(e,r,o,i);return this.data=s,s}handleGetInstance(){return this}handleUpdateVirtualDOM(){if(this.DOMNode){let r=H(this.DOMNode);this.dom.virtual=r}let e=this.parent?R(window.joystick._internal.tree,this.parent?.instanceId,"instanceId"):null;e?.instance&&e.instance.updateVirtualDOM()}onBeforeRender(){if(!S())return{instanceId:this.instanceId}}render(e={}){if(e?.mounting)return jt(this,e);let r=this.onBeforeRender();Gt(this),Nt(this.instanceId);let o=N(this,{}),i=re(this.dom.virtual,o.virtual);i&&l(i)&&z("lifecycle.onBeforeMount",()=>{let s=i(this.DOMNode);this.dom.actual=s,this.dom.virtual=o.virtual,Zt(this,this.renderMethods),this.setDOMNodeOnInstance(),z("domNodes",()=>{z("lifecycle.onMount",()=>{this.onAfterRender(r,e)})})})}renderToHTML(e={}){return X(this,e)}onAfterRender(e={},r={}){S()||(Vt(e.instanceId,this),window.joystick._internal.css.update(),z("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){this.state=G(this,{...this.state||{},...e}),this.render({afterSetStateRender:()=>{r&&l(r)&&r()}})}setTimeout(e=null,r=0){e&&(this.timers[U()]=window.setTimeout(e,r))}setInterval(e=null,r=0){e&&(this.timers[U()]=window.setInterval(e,r))}handleUpdateChildComponentInVDOM(e="",r=""){let o=R(window.joystick._internal.tree,this.instanceId,"instanceId"),i=R(window.joystick._internal.tree,r,"instanceId");if(i?.instance?.DOMNode){let s=H(i?.instance?.DOMNode);qt(o?.instance?.dom?.virtual,i?.instanceId,s)}}},Wt=Kt;var sd=(t={})=>{try{return(e={})=>new Wt({...t,props:e?.props,url:e?.url,translations:e?.translations,api:e?.api,req:e?.req,parent:e?.parent})}catch(e){n("component",e)}};export{sd as default};
21
+ `}}return r}return""}catch(r){n("component.css.compileCSS",r)}};var ar=(t={},e=null)=>{try{let r=e(t);return r&&u(r)&&!D(r)?Object.assign({},r):{}}catch(r){n("component.state.compile.compileState",r)}},G=(t={},e={})=>{try{return l(e)?ar(t,e):Object.assign({},e)}catch(r){n("component.state.compile",r)}};var ie={onBeforeMount:()=>null,onMount:()=>null,onBeforeUnmount:()=>null,onUpdateProps:()=>null,onRefetchData:()=>null};var at=(t={},e={})=>{try{return e?Object.entries({...ie,...e||{}}).reduce((r={},[o,i])=>(r[o]=()=>i({...t,setState:t.setState.bind(t),...t.renderMethods||{}}),r),{}):ie}catch(r){n("component.lifecycle.compile",r)}};var K=(t={},e={})=>{try{return Object.entries(e).reduce((r={},[o,i])=>(r[o]=(...s)=>i(...s,{...t,setState:t.setState.bind(t),...t.renderMethods||{}}),r),{})}catch{n("component.methods.compile")}};var ne=(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="")=>C(e)&&t?.route!=="*"?e===(typeof location!="undefined"?location.pathname:t.path):!1}}catch(e){n("component.url.compile",e)}};var S=()=>typeof window=="undefined";var P=null,W=0,dt=(t={},e=null)=>{try{let r=t?.url;t?.query&&(r=`${r}?${new URLSearchParams(t.query).toString()}`);let o=new WebSocket(r);P&&(clearInterval(P),P=null);let i={client:o,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),W=0}),o.addEventListener("message",s=>{s?.data&&t?.events?.onMessage&&t.events.onMessage(JSON.parse(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),o=null;let c=[1e3,1001].includes(s?.code);t?.options?.autoReconnect&&!P&&!c&&(P=setInterval(()=>{o=null,W<(t?.options?.reconnectAttempts||12)?(dt(t,e),t?.options?.logging&&console.log(`[joystick.websockets] Attempting to reconnect (${W+1}/12)...`),W+=1):clearInterval(P)},t?.options?.reconnectDelayInSeconds*1e3||5e3))}),e&&e(i),i}catch(r){n("websockets.client",r)}},ct=dt;var dr=(t={},e=null)=>{try{let r=e(t);return r&&u(r)&&!D(r)?Object.assign({},r):{}}catch(r){n("component.props.compileDefaultProps.compile",r)}},lt=(t={},e={})=>{try{return l(e)?dr(t,e):Object.assign({},e)}catch(r){n("component.props.compileDefaultProps",r)}};var pt=(t={},e={})=>{try{t.options=e||{},t.id=e?._componentId||null,t.instanceId=U(8),t.ssrId=e?._ssrId||null,t.css=st(),t.data=B(e?.dataFromSSR,e?._componentId),t.defaultProps=lt(t,e?.defaultProps),t.props=nt(t?.defaultProps,e?.props),t.state=G(t,e?.state),t.events=e?.events||{},t.lifecycle=at(t,e?.lifecycle),t.methods=K(t,e?.methods),t.wrapper=e?.wrapper||{},t.translations=e?.translations||{},t.validateForm=it,t.DOMNode=null,t.dom={},t.dom.virtual={},t.dom.actual={};let r=!S();if(r||(t.url=ne(e?.url)),r&&window.__joystick_url__&&(t.url=ne(window.__joystick_url__)),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];ct({url:`${window?.process?.env.NODE_ENV==="development"?"ws":"wss"}://${location.host}/api/_websockets/${c}`,options:a?.options||{},query:a?.query||{},events:a?.events||{}},(p={})=>{t.websockets={...t.websockets||{},[c]:p}})}}}catch(r){n("component.registerOptions",r)}};var I=(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 J=(t="{}")=>{try{return JSON.parse(t)}catch{return t}};var mt=(t={})=>Object.entries(t).map(([e,r])=>`${e}=${r}`)?.join("; ");var cr=async(t={})=>{try{let e=await t.text();return J(e)}catch(e){n("api.get.handleParseResponse",e)}},ut=(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"),p={...e?.headers||{},"x-joystick-csrf":a};return window?.__joystick_test__&&(p.Cookie=mt({joystickLoginToken:window.__joystick_test_login_token__,joystickLoginTokenExpiresAt:window.__joystick_test_login_token_expires_at__})),fetch(c,{method:"GET",mode:"cors",headers:p,credentials:"include"}).then(async y=>{let w=await cr(y);return w?.errors?(I("get request",w.errors),o(w)):r(w)}).catch(y=>(I("get request",[y]),o({errors:[y]})))}):Promise.resolve()}catch(r){n("get request",r)}};var lr=async(t={})=>{try{let e=await t.text();return J(e)}catch(e){n("api.set.handleParseResponse",e)}},pr=(t={})=>{try{return JSON.stringify(t)}catch(e){n("api.set.getBody",e)}},ft=(t="",e={})=>{try{return typeof window.fetch!="undefined"?new Promise((r,o)=>{let i=`${window.location.origin}/api/_setters/${t}`,s=pr(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__})),fetch(i,{method:"POST",mode:"cors",headers:a,body:s,credentials:"include"}).then(async p=>{let y=await lr(p);return y?.errors?(I("set request",y.errors),o(y)):r(y)}).catch(p=>(I("set request",[p]),o({errors:[p]})))}):Promise.resolve()}catch(r){n("set request",r)}};var ht={get:ut,set:ft};var mr=(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)}},q=(t="",e=null)=>{try{S()||(mr(t)||{}).array.push({callback:e})}catch(r){n("addToQueue",r)}};var Q=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 wt=(t={},e={},r={})=>{try{return{...t,refetch:async(o={})=>{let i=await Q(ht,e,o,r);return r.data=wt(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)}},yt=wt;var xt=(t={})=>{try{if(!S()){let e=window.__joystick_data__&&window.__joystick_data__[t?.id]||{},r=window.__joystick_req__||{};return yt(e,r,t)}return t?.data||{}}catch(e){n("component.loadDataFromWindow",e)}};var Ft=nr(gt());var bt=(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 p=0;p<a.length;p+=1){let y=a[p],w=bt(y,e,r);if(w!==null)return w}}}return null}catch(o){n("component.findComponentInTreeByField",o)}},R=bt;var $t=(t="",e={},r=null)=>{let o=R(r||window.joystick._internal.tree,t,"instanceId");o&&(o.children=[...o.children||[],e])};var ur=(t={},e={},r=null)=>{try{let o=N(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)}},fr=(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)}},hr=(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)}},wr=(t={})=>{try{let e={id:t.id,instanceId:t.instanceId,instance:t,children:[]};$t(t.parent.instanceId,e,t.parent&&t.parent.ssrTree||null)}catch(e){n("component.renderMethods.component.handleAddComponentToParent",e)}},yr=(t={},e={})=>{try{!t.renderedComponent&&e.options&&e.options.lifecycle&&(e.options.lifecycle.onBeforeMount&&q("lifecycle.onBeforeMount",()=>{e.options.lifecycle.onBeforeMount(e)}),!t.renderedComponent&&e.options.lifecycle.onMount&&q("lifecycle.onMount",()=>{e.options.lifecycle.onMount(e)}))}catch(r){n("component.renderMethods.component.handleLifecycle",r)}},xr=(t={},e={},r={})=>{try{!e.walkingTreeForSSR&&t?.options?.lifecycle?.onUpdateProps&&(0,Ft.diff)(e?.existingPropsMap,r)?.length>0&&q("lifecycle.onUpdateProps",()=>{let i=e?.existingPropsMap&&e?.existingPropsMap[t.id];t.options.lifecycle.onUpdateProps(i||{},r,t)})}catch(o){n("component.renderMethods.component.handleOnChangeProps",o)}},gr=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,xr(i,o,r),q("lifecycle.onMount",()=>{i.setDOMNodeOnInstance()}),yr(this,i),i.parent&&wr(i),i.options.data&&i.parent.walkingTreeForSSR&&i.parent.ssrTree.dataFunctions?hr(i):i.parent&&i.parent.ssrTree?fr(i):ur(i,this,a?.children)}},br=function(e,r){try{let o=this;return new gr().bind({})(e,r,o)}catch(o){n("component.renderMethods.component",o)}},se=br;var $r=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)}},ae=$r;var Fr=(t="",e=[])=>{try{return e.reduce((r,[o,i])=>r.replace(`{{${o}}}`,i),t)}catch(r){n("component.renderMethods.i18n.replacePlaceholdersInString",r)}},de=(t="",e=[])=>{try{let r=typeof t=="string",o=Array.isArray(t),i=typeof t=="object"&&!o;if(r)return Fr(t,e);if(o)return t?.map(s=>de(s,e));if(i)return Object.entries(t)?.reduce((s={},[c,a])=>(s[c]=de(a,e),s),{})}catch(r){n("component.renderMethods.i18n.handleTranslationReplacement",r)}},Er=(t="",e={})=>{try{return t?.split(".").reduce((r,o)=>r[o],e)}catch(r){n("component.renderMethods.i18n.getTranslationAtPath",r)}},kr=function(t="",e={}){try{let r=S()?this.translations:window.__joystick_i18n__,i=t?.includes(".")?Er(t,r):r[t];if(!r||!i)return"";let s=Object.entries(e);return de(i,s)}catch(r){n("component.renderMethods.i18n",r)}},ce=kr;var Mr=function(e=!1,r=""){try{return this?.renderingHTMLWithDataForSSR||e?`<when>${r.trim()}</when>`:"<when> </when>"}catch(o){n("component.renderMethods.when",o)}},le=Mr;var Et={c:se,component:se,e:ae,each:ae,i:ce,i18n:ce,w:le,when:le};var kt=(t={},e={})=>{try{return Object.entries(Et).reduce((r,[o,i])=>(r[o]=i.bind({...t,...e}),r),{})}catch(r){n("component.renderMethods.compile",r)}};var Mt=(t={})=>{try{return Object.entries(t)?.reduce((e={},[r,o]={})=>(e[r]=o?.map((i={})=>({state:i?.state,children:Mt(i?.children)})),e),{})}catch(e){n("component.render.getExistingStateMap.buildMapForChildren",e)}},St=(t={})=>{try{return Mt(t)}catch(e){n("component.render.getExistingStateMap",e)}};var Tt=new RegExp(/\<\!\-\-(?:.|\n|\r)*?-->/g),Sr=new RegExp(/\n/g);var Tr=(t="")=>{try{return(t.match(Tt)||[]).forEach(r=>{t=t.replace(r,"")}),t}catch(e){n("component.render.sanitizeHTML.removeCommentedCode",e)}},Ot=(t="")=>{try{let e=`${t}`;return e=Tr(e),e}catch(e){n("component.render.sanitizeHTML",e)}};var vt=(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 Ct=(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 p=c[a];Object.entries(p?.timers)?.length>0&&r.push(...Object.values(p?.timers)),Object.entries(p?.children)?.length>0&&Ct(p?.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)}},Rt=Ct;var X=(t={},e={})=>{try{e?.dataFromSSR&&(t.data=B(e.dataFromSSR,t.id)||{}),Rt(t?.children);let r=St(e?.existingChildren||t?.children)||{};t.children={},t.renderMethods=kt({...t,existingStateMap:r,translations:e?.translations||t.translations||{},ssrTree:e?.ssrTree,walkingTreeForSSR:e?.walkingTreeForSSR,renderingHTMLWithDataForSSR:e?.renderingHTMLWithDataForSSR,dataFromSSR:e?.dataFromSSR}),t.methods=K(t,t.options.methods);let o=t.options.render({...t||{},setState:t.setState.bind(t),...t.renderMethods||{}}),i=Ot(o),s=vt(t,i);return{unwrapped:i,wrapped:s}}catch(r){n("component.render.toHTML",r)}};var Or=(t={})=>{try{return Object.values(t).reduce((e={},r)=>(e[r.name]=r.value,e),{})}catch(e){n("component.virtualDOM.build.parseAttributeMap",e)}},At=(t={})=>{try{return t.tagName==="WHEN"?[].flatMap.call(t?.childNodes,e=>e?.tagName==="WHEN"?At(e):pe(e)):pe(t)}catch(e){n("component.virtualDOM.build.flattenWhenTags",e)}},pe=(t={})=>{try{let e=t&&t.tagName&&t.tagName.toLowerCase()||"text",r={tagName:e,attributes:Or(t.attributes),children:[].flatMap.call(t.childNodes,o=>At(o))};return e==="text"&&(r=t.textContent),r}catch(e){n("component.virtualDOM.build",e)}},H=pe;var vr=(t="")=>{try{let e=document.createElement("div");return e.innerHTML=t,e?.childNodes[0]}catch(e){n("component.virtualDOM.build.convertHTMLToDOM",e)}},Lt=(t="")=>{try{let e=vr(t);return H(e)}catch(e){n("component.virtualDOM.build",e)}};var jt=(t="")=>{try{return document.createElement("div").setAttribute(t,"Test"),!0}catch{return!1}};var Cr=(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];jt(i)&&e.setAttribute(i,s)}for(let o=0;o<t?.children?.length;o+=1){let i=t?.children[o];if(i){let s=Dt(i);e.appendChild(s)}}return e}catch(e){n("component.virtualDOM.renderTreeToDOM.renderElement",e)}},Dt=(t=null)=>{try{return C(t)?document.createTextNode(t):Cr(t)}catch(e){n("component.virtualDOM.renderTreeToDOM",e)}},V=Dt;var N=(t={},e={})=>{try{let r=X(t,{existingChildren:e?.existingChildren}),o=Lt(r.wrapped,t),i=e.includeActual&&o?V(o):null;return{html:r,virtual:o,actual:i}}catch(r){n("component.render.getUpdatedDOM",r)}};var _t=(t={},e={})=>{try{let r=N(t,{includeActual:!0,existingChildren:e?.existingChildren});return t.dom=r,r.actual}catch(r){n("component.render.forMount",r)}};var Rr=(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)}},ee=Rr;var Ar=(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},Pt=Ar;var Lr=(t=[],e)=>{t.forEach(r=>{r&&typeof r=="function"&&r(e)})},jr=(t=[])=>{t.forEach(([e,r])=>{e&&typeof e=="function"&&e(r)})},Dr=(t=[],e=[])=>{let r=[];return e.slice(t.length).forEach(i=>{let s=c=>{let a=V(i);return c.appendChild(a),c};r.push(s)}),r},_r=(t=[],e=[])=>{let r=[];return t.forEach((o,i)=>{let s=re(o,e[i]);r.push(s)}),r},Pr=(t=[],e=[])=>{let r=_r(t,e),o=Dr(t,e);return i=>{if(i){let s=Pt(r,i.childNodes);jr(s),Lr(o,i)}return i}},te=Pr;var It={select:(t,e)=>r=>{let o=r.value;r.replaceChildren(),ee(t.attributes,e.attributes)(r),te([],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 me=(t,e)=>r=>{let o=t?V(t):null;return r&&r.replaceWith(o),o},Ir=()=>t=>{t&&t.remove()},Nr=(t=void 0,e=void 0)=>t===void 0||e===void 0?Ir():typeof t=="string"||typeof e=="string"?me(e,t):t.tagName!==e.tagName?me(e):e.tagName==="select"?It.select(t,e):["pre","code"].includes(e.tagName)?me(e,t):i=>(ee(t.attributes,e.attributes)(i),te(t.children,e.children)(i),i),re=Nr;var Vr=(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)}},z=(t="",e=null)=>{try{S()||(Vr(t)||{}).process(e)}catch(r){n("processQueue",r)}};var Nt=(t="",e=null)=>{let r=R(e||window.joystick._internal.tree,t,"instanceId");r&&(r.children=[])};var Vt=(t="",e={},r=null)=>{let o=R(r||window.joystick._internal.tree,t,"instanceId");o&&(o.instanceId=e?.instanceId,o.instance=e)};var Ut=(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)&&Ut(i,e,r)}},qt=Ut;var Ht=(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 zt=(t={},e={},r=[])=>{try{let o=Object.keys(t?.events||{})?.length>0?Ht(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||{}})}})}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];zt(c,e,r)}}return r}catch(o){n("component.eve!nts.registerListenersFix.getListeners",o)}},Ur=(t={},e={})=>{try{let o=zt(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:p,handler:y}=o[i];c.addEventListener(p,y),s._eventListeners=[...s?._eventListeners||[],{instance:s,element:c,elementSelector:a,type:p,handler:y}]}}catch(r){n("component.events.registerListenersFix",r)}},Zt=Ur;var Bt=(t={})=>{try{let e=t?._eventListeners||[];if(t?.children){let o=(Object.values(t?.children||{})?.reduce((i=[],s=[])=>[...i,...s],[])).flatMap((i={})=>Bt(i));e=[...e,...o]}return e}catch(e){n("component.events.unregisterListenersFix.getListeners",e)}},qr=(t={})=>{try{let e=Bt(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)}},Gt=qr;var Kt=class{constructor(e={}){this.parent=e?.parent||null,this.onUpdateChildComponent=this.handleUpdateChildComponentInVDOM,this.updateVirtualDOM=this.handleUpdateVirtualDOM,this.timers={},this.children={},ve(e),pt(this,e),this.data=xt(this)}setDOMNodeOnInstance(){this.DOMNode=document.querySelector(`body [js-i="${this.instanceId}"]`)}async handleFetchData(e={},r={},o={},i=this){let s=await Q(e,r,o,i);return this.data=s,s}handleGetInstance(){return this}handleUpdateVirtualDOM(){if(this.DOMNode){let r=H(this.DOMNode);this.dom.virtual=r}let e=this.parent?R(window.joystick._internal.tree,this.parent?.instanceId,"instanceId"):null;e?.instance&&e.instance.updateVirtualDOM()}onBeforeRender(){if(!S())return{instanceId:this.instanceId}}render(e={}){if(e?.mounting)return _t(this,e);let r=this.onBeforeRender();Gt(this),Nt(this.instanceId);let o=N(this,{}),i=re(this.dom.virtual,o.virtual);i&&l(i)&&z("lifecycle.onBeforeMount",()=>{let s=i(this.DOMNode);this.dom.actual=s,this.dom.virtual=o.virtual,Zt(this,this.renderMethods),this.setDOMNodeOnInstance(),z("domNodes",()=>{z("lifecycle.onMount",()=>{this.onAfterRender(r,e)})})})}renderToHTML(e={}){return X(this,e)}onAfterRender(e={},r={}){S()||(Vt(e.instanceId,this),window.joystick._internal.css.update(),z("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){this.state=G(this,{...this.state||{},...e}),this.render({afterSetStateRender:()=>{r&&l(r)&&r()}})}setTimeout(e=null,r=0){e&&(this.timers[U()]=window.setTimeout(e,r))}setInterval(e=null,r=0){e&&(this.timers[U()]=window.setInterval(e,r))}handleUpdateChildComponentInVDOM(e="",r=""){let o=R(window.joystick._internal.tree,this.instanceId,"instanceId"),i=R(window.joystick._internal.tree,r,"instanceId");if(i?.instance?.DOMNode){let s=H(i?.instance?.DOMNode);qt(o?.instance?.dom?.virtual,i?.instanceId,s)}}},Wt=Kt;var sd=(t={})=>{try{return(e={})=>new Wt({...t,props:e?.props,url:e?.url,translations:e?.translations,api:e?.api,req:e?.req,parent:e?.parent})}catch(e){n("component",e)}};export{sd as default};
package/dist/index.js CHANGED
@@ -18,4 +18,4 @@ var Mr=Object.create;var de=Object.defineProperty;var Sr=Object.getOwnPropertyDe
18
18
  @media screen and (max-height: ${_}px) {
19
19
  ${typeof f=="function"?f(e):f}
20
20
  }
21
- `}}return r}return""}catch(r){i("component.css.compileCSS",r)}};var Vr=(t={},e=null)=>{try{let r=e(t);return r&&p(r)&&!I(r)?Object.assign({},r):{}}catch(r){i("component.state.compile.compileState",r)}},ee=(t={},e={})=>{try{return u(e)?Vr(t,e):Object.assign({},e)}catch(r){i("component.state.compile",r)}};var le={onBeforeMount:()=>null,onMount:()=>null,onBeforeUnmount:()=>null,onUpdateProps:()=>null,onRefetchData:()=>null};var Rt=(t={},e={})=>{try{return e?Object.entries({...le,...e||{}}).reduce((r={},[o,n])=>(r[o]=()=>n({...t,setState:t.setState.bind(t),...t.renderMethods||{}}),r),{}):le}catch(r){i("component.lifecycle.compile",r)}};var te=(t={},e={})=>{try{return Object.entries(e).reduce((r={},[o,n])=>(r[o]=(...s)=>n(...s,{...t,setState:t.setState.bind(t),...t.renderMethods||{}}),r),{})}catch{i("component.methods.compile")}};var ue=(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){i("component.url.compile",e)}};var Hr=(t={},e=null)=>{try{let r=e(t);return r&&p(r)&&!I(r)?Object.assign({},r):{}}catch(r){i("component.props.compileDefaultProps.compile",r)}},jt=(t={},e={})=>{try{return u(e)?Hr(t,e):Object.assign({},e)}catch(r){i("component.props.compileDefaultProps",r)}};var At=(t={},e={})=>{try{t.options=e||{},t.id=e?._componentId||null,t.instanceId=L(8),t.ssrId=e?._ssrId||null,t.css=X(),t.data=Y(e?.dataFromSSR,e?._componentId),t.defaultProps=jt(t,e?.defaultProps),t.props=_t(t?.defaultProps,e?.props),t.state=ee(t,e?.state),t.events=e?.events||{},t.lifecycle=Rt(t,e?.lifecycle),t.methods=te(t,e?.methods),t.wrapper=e?.wrapper||{},t.translations=e?.translations||{},t.validateForm=Ct,t.DOMNode=null,t.dom={},t.dom.virtual={},t.dom.actual={};let r=!F();if(r||(t.url=ue(e?.url)),r&&window.__joystick_url__&&(t.url=ue(window.__joystick_url__)),r&&e?.websockets&&u(e?.websockets)){let o=e.websockets(t),n=p(o)&&Object.entries(o);for(let s=0;s<n?.length;s+=1){let[a,c]=n[s];Q({url:`${window?.process?.env.NODE_ENV==="development"?"ws":"wss"}://${location.host}/api/_websockets/${a}`,options:c?.options||{},query:c?.query||{},events:c?.events||{}},(l={})=>{t.websockets={...t.websockets||{},[a]:l}})}}}catch(r){i("component.registerOptions",r)}};var Ur=(t="")=>{try{let[e,r]=t?.split(".");return r?window?.joystick?._internal?.queues[e][r]:window?.joystick?._internal?.queues[e]}catch(e){i("addToQueue.getQueue",e)}},G=(t="",e=null)=>{try{F()||(Ur(t)||{}).array.push({callback:e})}catch(r){i("addToQueue",r)}};var re=async(t={},e={},r={},o={})=>{try{if(o?.options?.data&&u(o.options.data)){let n=await o.options.data(t,e,r,o);return Promise.resolve(n)}return Promise.resolve()}catch(n){i("component.data.fetch",n)}};var Dt=(t={},e={},r={})=>{try{return{...t,refetch:async(o={})=>{let n=await re(Z,e,o,r);return r.data=Dt(n,e,r),window.__joystick_data__[r?.id]&&(window.__joystick_data__[r?.id]=n),window?.__joystick_test__||r.render({afterRefetchDataRender:()=>{r?.lifecycle?.onRefetchData&&r?.lifecycle?.onRefetchData(r)}}),r.data}}}catch(o){i("component.data.compile",o)}},Lt=Dt;var Pt=(t={})=>{try{if(!F()){let e=window.__joystick_data__&&window.__joystick_data__[t?.id]||{},r=window.__joystick_req__||{};return Lt(e,r,t)}return t?.data||{}}catch(e){i("component.loadDataFromWindow",e)}};var Vt=jr(It());var qt=(t={},e="",r="id")=>{try{let o=t&&t.id;if(p(t)&&o){let n=Object.keys(t);for(let s=0;s<n.length;s+=1){let a=n[s],c=t[a];if(a===r&&c===e)return t;if(a==="children"&&Array.isArray(c))for(let l=0;l<c.length;l+=1){let y=c[l],w=qt(y,e,r);if(w!==null)return w}}}return null}catch(o){i("component.findComponentInTreeByField",o)}},j=qt;var Nt=(t="",e={},r=null)=>{let o=j(r||window.joystick._internal.tree,t,"instanceId");o&&(o.children=[...o.children||[],e])};var zr=(t={},e={},r=null)=>{try{let o=z(t,{includeActual:!0,existingChildren:r});return t.dom=o,t.setDOMNodeOnInstance(),e.renderedComponent=t,o.html.wrapped}catch(o){i("component.renderMethods.component.renderForClient",o)}},Br=(t={})=>{try{return t.renderToHTML({ssrTree:t.parent.ssrTree,translations:t.parent.translations,walkingTreeForSSR:t?.parent?.walkingTreeForSSR,dataFromSSR:t.parent?.dataFromSSR}).wrapped}catch(e){i("component.renderMethods.component.renderToHTMLForSSR",e)}},Zr=(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){i("component.renderMethods.component.collectDataFunctionsForSSR",e)}},Gr=(t={})=>{try{let e={id:t.id,instanceId:t.instanceId,instance:t,children:[]};Nt(t.parent.instanceId,e,t.parent&&t.parent.ssrTree||null)}catch(e){i("component.renderMethods.component.handleAddComponentToParent",e)}},Wr=(t={},e={})=>{try{!t.renderedComponent&&e.options&&e.options.lifecycle&&(e.options.lifecycle.onBeforeMount&&G("lifecycle.onBeforeMount",()=>{e.options.lifecycle.onBeforeMount(e)}),!t.renderedComponent&&e.options.lifecycle.onMount&&G("lifecycle.onMount",()=>{e.options.lifecycle.onMount(e)}))}catch(r){i("component.renderMethods.component.handleLifecycle",r)}},Kr=(t={},e={},r={})=>{try{!e.walkingTreeForSSR&&t?.options?.lifecycle?.onUpdateProps&&(0,Vt.diff)(e?.existingPropsMap,r)?.length>0&&G("lifecycle.onUpdateProps",()=>{let n=e?.existingPropsMap&&e?.existingPropsMap[t.id];t.options.lifecycle.onUpdateProps(n||{},r,t)})}catch(o){i("component.renderMethods.component.handleOnChangeProps",o)}},Jr=function(){return function(e=null,r={},o={}){let n=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[n.id]||{},a=o.children[n.id]||[],c=s[a?.length];return n.state=c?.state||n.state,o.children[n.id]=[...o.children[n.id]||[],n],n.parent=o,Kr(n,o,r),G("lifecycle.onMount",()=>{n.setDOMNodeOnInstance()}),Wr(this,n),n.parent&&Gr(n),n.options.data&&n.parent.walkingTreeForSSR&&n.parent.ssrTree.dataFunctions?Zr(n):n.parent&&n.parent.ssrTree?Br(n):zr(n,this,c?.children)}},Qr=function(e,r){try{let o=this;return new Jr().bind({})(e,r,o)}catch(o){i("component.renderMethods.component",o)}},pe=Qr;var Yr=function(e=[],r=null){try{return u(r)&&e&&Array.isArray(e)?e.map((o,n)=>r(o,n)).join(""):""}catch(o){i("component.renderMethods.each",o)}},me=Yr;var Xr=(t="",e=[])=>{try{return e.reduce((r,[o,n])=>r.replace(`{{${o}}}`,n),t)}catch(r){i("component.renderMethods.i18n.replacePlaceholdersInString",r)}},fe=(t="",e=[])=>{try{let r=typeof t=="string",o=Array.isArray(t),n=typeof t=="object"&&!o;if(r)return Xr(t,e);if(o)return t?.map(s=>fe(s,e));if(n)return Object.entries(t)?.reduce((s={},[a,c])=>(s[a]=fe(c,e),s),{})}catch(r){i("component.renderMethods.i18n.handleTranslationReplacement",r)}},eo=(t="",e={})=>{try{return t?.split(".").reduce((r,o)=>(console.log({key:t,objectToTraverse:r,keyToMatch:o}),r[o]),e)}catch(r){i("component.renderMethods.i18n.getTranslationAtPath",r)}},to=function(t="",e={}){try{let r=F()?this.translations:window.__joystick_i18n__,n=t?.includes(".")?eo(t,r):r[t];if(t?.includes("creatorDashboard")&&console.log({key:t,replacements:e,translation:n,translations:r}),!r||!n)return"";let s=Object.entries(e);return fe(n,s)}catch(r){i("component.renderMethods.i18n",r)}},he=to;var ro=function(e=!1,r=""){try{return this?.renderingHTMLWithDataForSSR||e?`<when>${r.trim()}</when>`:"<when> </when>"}catch(o){i("component.renderMethods.when",o)}},we=ro;var Ht={c:pe,component:pe,e:me,each:me,i:he,i18n:he,w:we,when:we};var Ut=(t={},e={})=>{try{return Object.entries(Ht).reduce((r,[o,n])=>(r[o]=n.bind({...t,...e}),r),{})}catch(r){i("component.renderMethods.compile",r)}};var zt=(t={})=>{try{return Object.entries(t)?.reduce((e={},[r,o]={})=>(e[r]=o?.map((n={})=>({state:n?.state,children:zt(n?.children)})),e),{})}catch(e){i("component.render.getExistingStateMap.buildMapForChildren",e)}},Bt=(t={})=>{try{return zt(t)}catch(e){i("component.render.getExistingStateMap",e)}};var Zt=new RegExp(/\<\!\-\-(?:.|\n|\r)*?-->/g),oo=new RegExp(/\n/g);var no=(t="")=>{try{return(t.match(Zt)||[]).forEach(r=>{t=t.replace(r,"")}),t}catch(e){i("component.render.sanitizeHTML.removeCommentedCode",e)}},Gt=(t="")=>{try{let e=`${t}`;return e=no(e),e}catch(e){i("component.render.sanitizeHTML",e)}};var Wt=(t={},e="")=>{try{let{wrapper:r=null,id:o=null,instanceId:n=null}=t;return`<div ${r?.id?`id="${r.id}" `:""}${r?.classList?`class="${r.classList?.join(" ")}" `:""} js-c="${o}" js-i="${n}">${e}</div>`}catch(r){i("component.render.wrapHTML",r)}};var Kt=(t={},e=[])=>{try{let r=[...e],o=Object.entries(t);for(let n=0;n<o?.length;n+=1){let[s,a]=o[n];for(let c=0;c<a?.length;c+=1){let l=a[c];Object.entries(l?.timers)?.length>0&&r.push(...Object.values(l?.timers)),Object.entries(l?.children)?.length>0&&Kt(l?.children,r)}}if(r?.length>0)for(let n=0;n<r?.length;n+=1)clearTimeout(r[n])}catch(r){i("component.render.clearTimersOnChildren",r)}},Jt=Kt;var ne=(t={},e={})=>{try{e?.dataFromSSR&&(t.data=Y(e.dataFromSSR,t.id)||{}),Jt(t?.children);let r=Bt(e?.existingChildren||t?.children)||{};t.children={},t.renderMethods=Ut({...t,existingStateMap:r,translations:e?.translations||t.translations||{},ssrTree:e?.ssrTree,walkingTreeForSSR:e?.walkingTreeForSSR,renderingHTMLWithDataForSSR:e?.renderingHTMLWithDataForSSR,dataFromSSR:e?.dataFromSSR}),t.methods=te(t,t.options.methods);let o=t.options.render({...t||{},setState:t.setState.bind(t),...t.renderMethods||{}}),n=Gt(o),s=Wt(t,n);return{unwrapped:n,wrapped:s}}catch(r){i("component.render.toHTML",r)}};var io=(t={})=>{try{return Object.values(t).reduce((e={},r)=>(e[r.name]=r.value,e),{})}catch(e){i("component.virtualDOM.build.parseAttributeMap",e)}},Qt=(t={})=>{try{return t.tagName==="WHEN"?[].flatMap.call(t?.childNodes,e=>e?.tagName==="WHEN"?Qt(e):ye(e)):ye(t)}catch(e){i("component.virtualDOM.build.flattenWhenTags",e)}},ye=(t={})=>{try{let e=t&&t.tagName&&t.tagName.toLowerCase()||"text",r={tagName:e,attributes:io(t.attributes),children:[].flatMap.call(t.childNodes,o=>Qt(o))};return e==="text"&&(r=t.textContent),r}catch(e){i("component.virtualDOM.build",e)}},W=ye;var so=(t="")=>{try{let e=document.createElement("div");return e.innerHTML=t,e?.childNodes[0]}catch(e){i("component.virtualDOM.build.convertHTMLToDOM",e)}},Yt=(t="")=>{try{let e=so(t);return W(e)}catch(e){i("component.virtualDOM.build",e)}};var Xt=(t="")=>{try{return document.createElement("div").setAttribute(t,"Test"),!0}catch{return!1}};var ao=(t={})=>{try{let e=document.createElement(t.tagName),r=Object.entries(t.attributes);for(let o=0;o<r.length;o+=1){let[n,s]=r[o];Xt(n)&&e.setAttribute(n,s)}for(let o=0;o<t?.children?.length;o+=1){let n=t?.children[o];if(n){let s=er(n);e.appendChild(s)}}return e}catch(e){i("component.virtualDOM.renderTreeToDOM.renderElement",e)}},er=(t=null)=>{try{return O(t)?document.createTextNode(t):ao(t)}catch(e){i("component.virtualDOM.renderTreeToDOM",e)}},B=er;var z=(t={},e={})=>{try{let r=ne(t,{existingChildren:e?.existingChildren}),o=Yt(r.wrapped,t),n=e.includeActual&&o?B(o):null;return{html:r,virtual:o,actual:n}}catch(r){i("component.render.getUpdatedDOM",r)}};var tr=(t={},e={})=>{try{let r=z(t,{includeActual:!0,existingChildren:e?.existingChildren});return t.dom=r,r.actual}catch(r){i("component.render.forMount",r)}};var co=(t={},e={})=>{let r=[];for(let[o,n]of Object.entries(e))r.push(s=>(s&&s.setAttribute&&s.setAttribute(o,n),s));for(let o in t)o in e||r.push(n=>(n&&n.removeAttribute&&n.removeAttribute(o),n));return o=>{for(let n of r)n&&typeof n=="function"&&n(o)}},ie=co;var lo=(t=[],e=[])=>{let r=[],o=Math.max(t.length,e.length);for(let n=0;n<o;n+=1){let s=t[n],a=e[n];r.push([s,a])}return r},rr=lo;var uo=(t=[],e)=>{t.forEach(r=>{r&&typeof r=="function"&&r(e)})},po=(t=[])=>{t.forEach(([e,r])=>{e&&typeof e=="function"&&e(r)})},mo=(t=[],e=[])=>{let r=[];return e.slice(t.length).forEach(n=>{let s=a=>{let c=B(n);return a.appendChild(c),a};r.push(s)}),r},fo=(t=[],e=[])=>{let r=[];return t.forEach((o,n)=>{let s=ae(o,e[n]);r.push(s)}),r},ho=(t=[],e=[])=>{let r=fo(t,e),o=mo(t,e);return n=>{if(n){let s=rr(r,n.childNodes);po(s),uo(o,n)}return n}},se=ho;var or={select:(t,e)=>r=>{let o=r.value;r.replaceChildren(),ie(t.attributes,e.attributes)(r),se([],e.children)(r);let n=r.querySelector(`option[value="${o}"]`);if(n&&(r.value=o),!n){let s=r.querySelector("option");r.value=s?.value||""}return r}};var ge=(t,e)=>r=>{let o=t?B(t):null;return r&&r.replaceWith(o),o},wo=()=>t=>{t&&t.remove()},yo=(t=void 0,e=void 0)=>t===void 0||e===void 0?wo():typeof t=="string"||typeof e=="string"?ge(e,t):t.tagName!==e.tagName?ge(e):e.tagName==="select"?or.select(t,e):["pre","code"].includes(e.tagName)?ge(e,t):n=>(ie(t.attributes,e.attributes)(n),se(t.children,e.children)(n),n),ae=yo;var go=(t="")=>{try{let[e,r]=t?.split(".");return r?window?.joystick?._internal?.queues[e][r]:window?.joystick?._internal?.queues[e]}catch(e){i("processQueue.getQueue",e)}},q=(t="",e=null)=>{try{F()||(go(t)||{}).process(e)}catch(r){i("processQueue",r)}};var nr=(t="",e=null)=>{let r=j(e||window.joystick._internal.tree,t,"instanceId");r&&(r.children=[])};var ir=(t="",e={},r=null)=>{let o=j(r||window.joystick._internal.tree,t,"instanceId");o&&(o.instanceId=e?.instanceId,o.instance=e)};var sr=(t={},e="",r={})=>{for(let o=0;o<t?.children?.length;o+=1){let n=t?.children[o];if(p(n)&&n.attributes&&n.attributes["js-i"]&&n.attributes["js-i"]===e){t.children[o]=r;break}p(n)&&sr(n,e,r)}},ar=sr;var cr=(t={})=>{try{return Object.entries(t).map(([e,r])=>{let[o,...n]=e.split(" ");return{type:o.toLowerCase(),selector:n.join(" "),handler:r}})}catch(e){i("component.events.serialize",e)}};var dr=(t={},e={},r=[])=>{try{let o=Object.keys(t?.events||{})?.length>0?cr(t?.events):[];for(let n=0;n<o?.length;n+=1){let s=o[n];r.push({...s,instance:t,elements:document.querySelectorAll(`body [js-i="${t.instanceId}"] ${s?.selector}`),handler:function(c){s.handler(c,{...t||{},setState:t?.setState.bind(t),...e||{}})}})}if(t?.children){let n=Object.entries(t?.children)?.flatMap(([s,a])=>a);for(let s=0;s<n?.length;s+=1){let a=n[s];dr(a,e,r)}}return r}catch(o){i("component.eve!nts.registerListenersFix.getListeners",o)}},xo=(t={},e={})=>{try{let o=dr(t,e,[])?.flatMap((n={})=>[].flatMap.call(n?.elements||[],s=>{let{elements:a=[],...c}=n||{};return{...c,element:s}}));for(let n=0;n<o?.length;n+=1){let{instance:s,element:a,elementSelector:c,type:l,handler:y}=o[n];a.addEventListener(l,y),s._eventListeners=[...s?._eventListeners||[],{instance:s,element:a,elementSelector:c,type:l,handler:y}]}}catch(r){i("component.events.registerListenersFix",r)}},ce=xo;var lr=(t={})=>{try{let e=t?._eventListeners||[];if(t?.children){let o=(Object.values(t?.children||{})?.reduce((n=[],s=[])=>[...n,...s],[])).flatMap((n={})=>lr(n));e=[...e,...o]}return e}catch(e){i("component.events.unregisterListenersFix.getListeners",e)}},bo=(t={})=>{try{let e=lr(t);for(let r=0;r<e?.length;r+=1){let{instance:o,element:n,type:s,handler:a}=e[r];n.removeEventListener(s,a),o._eventListeners=o._eventListeners?.splice(r,1)}}catch(e){i("component.events.unregisterListenersFix",e)}},ur=bo;var pr=class{constructor(e={}){this.parent=e?.parent||null,this.onUpdateChildComponent=this.handleUpdateChildComponentInVDOM,this.updateVirtualDOM=this.handleUpdateVirtualDOM,this.timers={},this.children={},rt(e),At(this,e),this.data=Pt(this)}setDOMNodeOnInstance(){this.DOMNode=document.querySelector(`body [js-i="${this.instanceId}"]`)}async handleFetchData(e={},r={},o={},n=this){let s=await re(e,r,o,n);return this.data=s,s}handleGetInstance(){return this}handleUpdateVirtualDOM(){if(this.DOMNode){let r=W(this.DOMNode);this.dom.virtual=r}let e=this.parent?j(window.joystick._internal.tree,this.parent?.instanceId,"instanceId"):null;e?.instance&&e.instance.updateVirtualDOM()}onBeforeRender(){if(!F())return{instanceId:this.instanceId}}render(e={}){if(e?.mounting)return tr(this,e);let r=this.onBeforeRender();ur(this),nr(this.instanceId);let o=z(this,{}),n=ae(this.dom.virtual,o.virtual);n&&u(n)&&q("lifecycle.onBeforeMount",()=>{let s=n(this.DOMNode);this.dom.actual=s,this.dom.virtual=o.virtual,ce(this,this.renderMethods),this.setDOMNodeOnInstance(),q("domNodes",()=>{q("lifecycle.onMount",()=>{this.onAfterRender(r,e)})})})}renderToHTML(e={}){return ne(this,e)}onAfterRender(e={},r={}){F()||(ir(e.instanceId,this),window.joystick._internal.css.update(),q("lifecycle.onUpdateProps"),r?.afterSetStateRender&&u(r.afterSetStateRender)&&r.afterSetStateRender(),r?.afterRefetchDataRender&&u(r.afterRefetchDataRender)&&r.afterRefetchDataRender(),this.parent&&this.parent.onUpdateChildComponent(this.id,this.instanceId))}setState(e={},r=null){this.state=ee(this,{...this.state||{},...e}),this.render({afterSetStateRender:()=>{r&&u(r)&&r()}})}setTimeout(e=null,r=0){e&&(this.timers[L()]=window.setTimeout(e,r))}setInterval(e=null,r=0){e&&(this.timers[L()]=window.setInterval(e,r))}handleUpdateChildComponentInVDOM(e="",r=""){let o=j(window.joystick._internal.tree,this.instanceId,"instanceId"),n=j(window.joystick._internal.tree,r,"instanceId");if(n?.instance?.DOMNode){let s=W(n?.instance?.DOMNode);ar(o?.instance?.dom?.virtual,n?.instanceId,s)}}},mr=pr;var fr=(t={})=>{try{return(e={})=>new mr({...t,props:e?.props,url:e?.url,translations:e?.translations,api:e?.api,req:e?.req,parent:e?.parent})}catch(e){i("component",e)}};var hr=(t={})=>{try{window.joystick._internal.tree={id:t?.id||null,instanceId:t?.instanceId||null,instance:t,children:[]}}catch(e){i("mount.initializeJoystickComponentTree",e)}};var wr=(t={},e=null)=>{try{return t.innerHTML="",t.appendChild(e),e}catch(r){i("mount.appendToDOM",r)}};var yr=(t=null,e={},r=null)=>{try{u(t)||i("mount","Component to mount must be a function."),p(e)||i("mount","props must be an object."),ve(r)||i("mount","target must be a DOM node.");let o=t({props:e});hr(o);let n=o.render({mounting:!0,existingChildren:window.__joystick_childrenBeforeHMRUpdate__||null});return n&&(n.setAttribute("js-c",o.id),n.setAttribute("js-i",o.instanceId)),o.lifecycle.onBeforeMount(),q("lifecycle.onBeforeMount"),wr(r,n),o.setDOMNodeOnInstance(),window.joystick._internal.css.update(),ce(o,o.renderMethods),o.lifecycle.onMount(),q("lifecycle.onMount"),o}catch(o){i("mount",o)}};var gr=class{constructor(e=[]){this.array=[...e],this.array.push=function(){Array.prototype.push.apply(this,arguments)}}async process(e=null){if(this.array.length>0){let r=this.array.shift();r&&r.callback&&(await r.callback(),this.process(e))}else e&&e()}},N=gr;var Eo=new RegExp(/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g),$o=new RegExp(/([^\r\n,{}]+)(,(?=[^}]*{)|\s*{)/g),Fo=(t,e)=>(e||"").replace(Eo,()=>"").replace($o,r=>["@",": "].some(o=>r?.includes(o))?r:`[js-c="${t}"] ${r.trim()}`)?.trim(),xr=(t={},e=[])=>{if(t.instance&&t.instance.options&&t.instance.options.css){let r=t.instance.id,o=t.instance.options.css,n=X(o,t.instance),s=Fo(r,n);e.push(s)}if(t.children&&t.children.length>0){let r=t?.children?.length||0;for(;r--;)xr(t.children[r],e)}return e},br=xr;var Er=()=>{try{let t=document.head.querySelector("style[js-styles]"),r=br(window.joystick?._internal?.tree).reverse().join("").trim();if(t?.innerText===r)return;if(t&&(t.innerHTML=r),!t){let o=document.createElement("style");o.setAttribute("js-styles",""),o.innerHTML=r,document.head.appendChild(o)}}catch(t){i("css.update",t)}};var ko=Se,Mo=Re,So=Z.get,To=je,Oo=Ae,vo=Z.set,Co=Pe,$r=()=>typeof window!="undefined"?window.__joystick_env__:typeof process!="undefined"?"production":null,Fr={_external:{},_internal:{css:{update:Er},queues:{domNodes:new N([]),eventListeners:new N([]),lifecycle:{onBeforeMount:new N([]),onMount:new N([]),onUpdateProps:new N([])},render:new N([])},tree:{},eventListeners:[]},accounts:ko,cache:Mo,component:fr,env:{development:$r()==="development",test:$r()==="test"},get:So,html:To,id:L,mount:yr,renderComponentToHTML:Oo,set:vo,upload:Co,timers:{}};Ie(Fr);var gl=Fr;export{ko as accounts,Mo as cache,gl as default,So as get,To as html,Oo as renderComponentToHTML,vo as set,Co as upload};
21
+ `}}return r}return""}catch(r){i("component.css.compileCSS",r)}};var Vr=(t={},e=null)=>{try{let r=e(t);return r&&p(r)&&!I(r)?Object.assign({},r):{}}catch(r){i("component.state.compile.compileState",r)}},ee=(t={},e={})=>{try{return u(e)?Vr(t,e):Object.assign({},e)}catch(r){i("component.state.compile",r)}};var le={onBeforeMount:()=>null,onMount:()=>null,onBeforeUnmount:()=>null,onUpdateProps:()=>null,onRefetchData:()=>null};var Rt=(t={},e={})=>{try{return e?Object.entries({...le,...e||{}}).reduce((r={},[o,n])=>(r[o]=()=>n({...t,setState:t.setState.bind(t),...t.renderMethods||{}}),r),{}):le}catch(r){i("component.lifecycle.compile",r)}};var te=(t={},e={})=>{try{return Object.entries(e).reduce((r={},[o,n])=>(r[o]=(...s)=>n(...s,{...t,setState:t.setState.bind(t),...t.renderMethods||{}}),r),{})}catch{i("component.methods.compile")}};var ue=(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){i("component.url.compile",e)}};var Hr=(t={},e=null)=>{try{let r=e(t);return r&&p(r)&&!I(r)?Object.assign({},r):{}}catch(r){i("component.props.compileDefaultProps.compile",r)}},jt=(t={},e={})=>{try{return u(e)?Hr(t,e):Object.assign({},e)}catch(r){i("component.props.compileDefaultProps",r)}};var At=(t={},e={})=>{try{t.options=e||{},t.id=e?._componentId||null,t.instanceId=L(8),t.ssrId=e?._ssrId||null,t.css=X(),t.data=Y(e?.dataFromSSR,e?._componentId),t.defaultProps=jt(t,e?.defaultProps),t.props=_t(t?.defaultProps,e?.props),t.state=ee(t,e?.state),t.events=e?.events||{},t.lifecycle=Rt(t,e?.lifecycle),t.methods=te(t,e?.methods),t.wrapper=e?.wrapper||{},t.translations=e?.translations||{},t.validateForm=Ct,t.DOMNode=null,t.dom={},t.dom.virtual={},t.dom.actual={};let r=!F();if(r||(t.url=ue(e?.url)),r&&window.__joystick_url__&&(t.url=ue(window.__joystick_url__)),r&&e?.websockets&&u(e?.websockets)){let o=e.websockets(t),n=p(o)&&Object.entries(o);for(let s=0;s<n?.length;s+=1){let[a,c]=n[s];Q({url:`${window?.process?.env.NODE_ENV==="development"?"ws":"wss"}://${location.host}/api/_websockets/${a}`,options:c?.options||{},query:c?.query||{},events:c?.events||{}},(l={})=>{t.websockets={...t.websockets||{},[a]:l}})}}}catch(r){i("component.registerOptions",r)}};var Ur=(t="")=>{try{let[e,r]=t?.split(".");return r?window?.joystick?._internal?.queues[e][r]:window?.joystick?._internal?.queues[e]}catch(e){i("addToQueue.getQueue",e)}},G=(t="",e=null)=>{try{F()||(Ur(t)||{}).array.push({callback:e})}catch(r){i("addToQueue",r)}};var re=async(t={},e={},r={},o={})=>{try{if(o?.options?.data&&u(o.options.data)){let n=await o.options.data(t,e,r,o);return Promise.resolve(n)}return Promise.resolve()}catch(n){i("component.data.fetch",n)}};var Dt=(t={},e={},r={})=>{try{return{...t,refetch:async(o={})=>{let n=await re(Z,e,o,r);return r.data=Dt(n,e,r),window.__joystick_data__[r?.id]&&(window.__joystick_data__[r?.id]=n),window?.__joystick_test__||r.render({afterRefetchDataRender:()=>{r?.lifecycle?.onRefetchData&&r?.lifecycle?.onRefetchData(r)}}),r.data}}}catch(o){i("component.data.compile",o)}},Lt=Dt;var Pt=(t={})=>{try{if(!F()){let e=window.__joystick_data__&&window.__joystick_data__[t?.id]||{},r=window.__joystick_req__||{};return Lt(e,r,t)}return t?.data||{}}catch(e){i("component.loadDataFromWindow",e)}};var Vt=jr(It());var qt=(t={},e="",r="id")=>{try{let o=t&&t.id;if(p(t)&&o){let n=Object.keys(t);for(let s=0;s<n.length;s+=1){let a=n[s],c=t[a];if(a===r&&c===e)return t;if(a==="children"&&Array.isArray(c))for(let l=0;l<c.length;l+=1){let y=c[l],w=qt(y,e,r);if(w!==null)return w}}}return null}catch(o){i("component.findComponentInTreeByField",o)}},j=qt;var Nt=(t="",e={},r=null)=>{let o=j(r||window.joystick._internal.tree,t,"instanceId");o&&(o.children=[...o.children||[],e])};var zr=(t={},e={},r=null)=>{try{let o=z(t,{includeActual:!0,existingChildren:r});return t.dom=o,t.setDOMNodeOnInstance(),e.renderedComponent=t,o.html.wrapped}catch(o){i("component.renderMethods.component.renderForClient",o)}},Br=(t={})=>{try{return t.renderToHTML({ssrTree:t.parent.ssrTree,translations:t.parent.translations,walkingTreeForSSR:t?.parent?.walkingTreeForSSR,dataFromSSR:t.parent?.dataFromSSR}).wrapped}catch(e){i("component.renderMethods.component.renderToHTMLForSSR",e)}},Zr=(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){i("component.renderMethods.component.collectDataFunctionsForSSR",e)}},Gr=(t={})=>{try{let e={id:t.id,instanceId:t.instanceId,instance:t,children:[]};Nt(t.parent.instanceId,e,t.parent&&t.parent.ssrTree||null)}catch(e){i("component.renderMethods.component.handleAddComponentToParent",e)}},Wr=(t={},e={})=>{try{!t.renderedComponent&&e.options&&e.options.lifecycle&&(e.options.lifecycle.onBeforeMount&&G("lifecycle.onBeforeMount",()=>{e.options.lifecycle.onBeforeMount(e)}),!t.renderedComponent&&e.options.lifecycle.onMount&&G("lifecycle.onMount",()=>{e.options.lifecycle.onMount(e)}))}catch(r){i("component.renderMethods.component.handleLifecycle",r)}},Kr=(t={},e={},r={})=>{try{!e.walkingTreeForSSR&&t?.options?.lifecycle?.onUpdateProps&&(0,Vt.diff)(e?.existingPropsMap,r)?.length>0&&G("lifecycle.onUpdateProps",()=>{let n=e?.existingPropsMap&&e?.existingPropsMap[t.id];t.options.lifecycle.onUpdateProps(n||{},r,t)})}catch(o){i("component.renderMethods.component.handleOnChangeProps",o)}},Jr=function(){return function(e=null,r={},o={}){let n=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[n.id]||{},a=o.children[n.id]||[],c=s[a?.length];return n.state=c?.state||n.state,o.children[n.id]=[...o.children[n.id]||[],n],n.parent=o,Kr(n,o,r),G("lifecycle.onMount",()=>{n.setDOMNodeOnInstance()}),Wr(this,n),n.parent&&Gr(n),n.options.data&&n.parent.walkingTreeForSSR&&n.parent.ssrTree.dataFunctions?Zr(n):n.parent&&n.parent.ssrTree?Br(n):zr(n,this,c?.children)}},Qr=function(e,r){try{let o=this;return new Jr().bind({})(e,r,o)}catch(o){i("component.renderMethods.component",o)}},pe=Qr;var Yr=function(e=[],r=null){try{return u(r)&&e&&Array.isArray(e)?e.map((o,n)=>r(o,n)).join(""):""}catch(o){i("component.renderMethods.each",o)}},me=Yr;var Xr=(t="",e=[])=>{try{return e.reduce((r,[o,n])=>r.replace(`{{${o}}}`,n),t)}catch(r){i("component.renderMethods.i18n.replacePlaceholdersInString",r)}},fe=(t="",e=[])=>{try{let r=typeof t=="string",o=Array.isArray(t),n=typeof t=="object"&&!o;if(r)return Xr(t,e);if(o)return t?.map(s=>fe(s,e));if(n)return Object.entries(t)?.reduce((s={},[a,c])=>(s[a]=fe(c,e),s),{})}catch(r){i("component.renderMethods.i18n.handleTranslationReplacement",r)}},eo=(t="",e={})=>{try{return t?.split(".").reduce((r,o)=>r[o],e)}catch(r){i("component.renderMethods.i18n.getTranslationAtPath",r)}},to=function(t="",e={}){try{let r=F()?this.translations:window.__joystick_i18n__,n=t?.includes(".")?eo(t,r):r[t];if(!r||!n)return"";let s=Object.entries(e);return fe(n,s)}catch(r){i("component.renderMethods.i18n",r)}},he=to;var ro=function(e=!1,r=""){try{return this?.renderingHTMLWithDataForSSR||e?`<when>${r.trim()}</when>`:"<when> </when>"}catch(o){i("component.renderMethods.when",o)}},we=ro;var Ht={c:pe,component:pe,e:me,each:me,i:he,i18n:he,w:we,when:we};var Ut=(t={},e={})=>{try{return Object.entries(Ht).reduce((r,[o,n])=>(r[o]=n.bind({...t,...e}),r),{})}catch(r){i("component.renderMethods.compile",r)}};var zt=(t={})=>{try{return Object.entries(t)?.reduce((e={},[r,o]={})=>(e[r]=o?.map((n={})=>({state:n?.state,children:zt(n?.children)})),e),{})}catch(e){i("component.render.getExistingStateMap.buildMapForChildren",e)}},Bt=(t={})=>{try{return zt(t)}catch(e){i("component.render.getExistingStateMap",e)}};var Zt=new RegExp(/\<\!\-\-(?:.|\n|\r)*?-->/g),oo=new RegExp(/\n/g);var no=(t="")=>{try{return(t.match(Zt)||[]).forEach(r=>{t=t.replace(r,"")}),t}catch(e){i("component.render.sanitizeHTML.removeCommentedCode",e)}},Gt=(t="")=>{try{let e=`${t}`;return e=no(e),e}catch(e){i("component.render.sanitizeHTML",e)}};var Wt=(t={},e="")=>{try{let{wrapper:r=null,id:o=null,instanceId:n=null}=t;return`<div ${r?.id?`id="${r.id}" `:""}${r?.classList?`class="${r.classList?.join(" ")}" `:""} js-c="${o}" js-i="${n}">${e}</div>`}catch(r){i("component.render.wrapHTML",r)}};var Kt=(t={},e=[])=>{try{let r=[...e],o=Object.entries(t);for(let n=0;n<o?.length;n+=1){let[s,a]=o[n];for(let c=0;c<a?.length;c+=1){let l=a[c];Object.entries(l?.timers)?.length>0&&r.push(...Object.values(l?.timers)),Object.entries(l?.children)?.length>0&&Kt(l?.children,r)}}if(r?.length>0)for(let n=0;n<r?.length;n+=1)clearTimeout(r[n])}catch(r){i("component.render.clearTimersOnChildren",r)}},Jt=Kt;var ne=(t={},e={})=>{try{e?.dataFromSSR&&(t.data=Y(e.dataFromSSR,t.id)||{}),Jt(t?.children);let r=Bt(e?.existingChildren||t?.children)||{};t.children={},t.renderMethods=Ut({...t,existingStateMap:r,translations:e?.translations||t.translations||{},ssrTree:e?.ssrTree,walkingTreeForSSR:e?.walkingTreeForSSR,renderingHTMLWithDataForSSR:e?.renderingHTMLWithDataForSSR,dataFromSSR:e?.dataFromSSR}),t.methods=te(t,t.options.methods);let o=t.options.render({...t||{},setState:t.setState.bind(t),...t.renderMethods||{}}),n=Gt(o),s=Wt(t,n);return{unwrapped:n,wrapped:s}}catch(r){i("component.render.toHTML",r)}};var io=(t={})=>{try{return Object.values(t).reduce((e={},r)=>(e[r.name]=r.value,e),{})}catch(e){i("component.virtualDOM.build.parseAttributeMap",e)}},Qt=(t={})=>{try{return t.tagName==="WHEN"?[].flatMap.call(t?.childNodes,e=>e?.tagName==="WHEN"?Qt(e):ye(e)):ye(t)}catch(e){i("component.virtualDOM.build.flattenWhenTags",e)}},ye=(t={})=>{try{let e=t&&t.tagName&&t.tagName.toLowerCase()||"text",r={tagName:e,attributes:io(t.attributes),children:[].flatMap.call(t.childNodes,o=>Qt(o))};return e==="text"&&(r=t.textContent),r}catch(e){i("component.virtualDOM.build",e)}},W=ye;var so=(t="")=>{try{let e=document.createElement("div");return e.innerHTML=t,e?.childNodes[0]}catch(e){i("component.virtualDOM.build.convertHTMLToDOM",e)}},Yt=(t="")=>{try{let e=so(t);return W(e)}catch(e){i("component.virtualDOM.build",e)}};var Xt=(t="")=>{try{return document.createElement("div").setAttribute(t,"Test"),!0}catch{return!1}};var ao=(t={})=>{try{let e=document.createElement(t.tagName),r=Object.entries(t.attributes);for(let o=0;o<r.length;o+=1){let[n,s]=r[o];Xt(n)&&e.setAttribute(n,s)}for(let o=0;o<t?.children?.length;o+=1){let n=t?.children[o];if(n){let s=er(n);e.appendChild(s)}}return e}catch(e){i("component.virtualDOM.renderTreeToDOM.renderElement",e)}},er=(t=null)=>{try{return O(t)?document.createTextNode(t):ao(t)}catch(e){i("component.virtualDOM.renderTreeToDOM",e)}},B=er;var z=(t={},e={})=>{try{let r=ne(t,{existingChildren:e?.existingChildren}),o=Yt(r.wrapped,t),n=e.includeActual&&o?B(o):null;return{html:r,virtual:o,actual:n}}catch(r){i("component.render.getUpdatedDOM",r)}};var tr=(t={},e={})=>{try{let r=z(t,{includeActual:!0,existingChildren:e?.existingChildren});return t.dom=r,r.actual}catch(r){i("component.render.forMount",r)}};var co=(t={},e={})=>{let r=[];for(let[o,n]of Object.entries(e))r.push(s=>(s&&s.setAttribute&&s.setAttribute(o,n),s));for(let o in t)o in e||r.push(n=>(n&&n.removeAttribute&&n.removeAttribute(o),n));return o=>{for(let n of r)n&&typeof n=="function"&&n(o)}},ie=co;var lo=(t=[],e=[])=>{let r=[],o=Math.max(t.length,e.length);for(let n=0;n<o;n+=1){let s=t[n],a=e[n];r.push([s,a])}return r},rr=lo;var uo=(t=[],e)=>{t.forEach(r=>{r&&typeof r=="function"&&r(e)})},po=(t=[])=>{t.forEach(([e,r])=>{e&&typeof e=="function"&&e(r)})},mo=(t=[],e=[])=>{let r=[];return e.slice(t.length).forEach(n=>{let s=a=>{let c=B(n);return a.appendChild(c),a};r.push(s)}),r},fo=(t=[],e=[])=>{let r=[];return t.forEach((o,n)=>{let s=ae(o,e[n]);r.push(s)}),r},ho=(t=[],e=[])=>{let r=fo(t,e),o=mo(t,e);return n=>{if(n){let s=rr(r,n.childNodes);po(s),uo(o,n)}return n}},se=ho;var or={select:(t,e)=>r=>{let o=r.value;r.replaceChildren(),ie(t.attributes,e.attributes)(r),se([],e.children)(r);let n=r.querySelector(`option[value="${o}"]`);if(n&&(r.value=o),!n){let s=r.querySelector("option");r.value=s?.value||""}return r}};var ge=(t,e)=>r=>{let o=t?B(t):null;return r&&r.replaceWith(o),o},wo=()=>t=>{t&&t.remove()},yo=(t=void 0,e=void 0)=>t===void 0||e===void 0?wo():typeof t=="string"||typeof e=="string"?ge(e,t):t.tagName!==e.tagName?ge(e):e.tagName==="select"?or.select(t,e):["pre","code"].includes(e.tagName)?ge(e,t):n=>(ie(t.attributes,e.attributes)(n),se(t.children,e.children)(n),n),ae=yo;var go=(t="")=>{try{let[e,r]=t?.split(".");return r?window?.joystick?._internal?.queues[e][r]:window?.joystick?._internal?.queues[e]}catch(e){i("processQueue.getQueue",e)}},q=(t="",e=null)=>{try{F()||(go(t)||{}).process(e)}catch(r){i("processQueue",r)}};var nr=(t="",e=null)=>{let r=j(e||window.joystick._internal.tree,t,"instanceId");r&&(r.children=[])};var ir=(t="",e={},r=null)=>{let o=j(r||window.joystick._internal.tree,t,"instanceId");o&&(o.instanceId=e?.instanceId,o.instance=e)};var sr=(t={},e="",r={})=>{for(let o=0;o<t?.children?.length;o+=1){let n=t?.children[o];if(p(n)&&n.attributes&&n.attributes["js-i"]&&n.attributes["js-i"]===e){t.children[o]=r;break}p(n)&&sr(n,e,r)}},ar=sr;var cr=(t={})=>{try{return Object.entries(t).map(([e,r])=>{let[o,...n]=e.split(" ");return{type:o.toLowerCase(),selector:n.join(" "),handler:r}})}catch(e){i("component.events.serialize",e)}};var dr=(t={},e={},r=[])=>{try{let o=Object.keys(t?.events||{})?.length>0?cr(t?.events):[];for(let n=0;n<o?.length;n+=1){let s=o[n];r.push({...s,instance:t,elements:document.querySelectorAll(`body [js-i="${t.instanceId}"] ${s?.selector}`),handler:function(c){s.handler(c,{...t||{},setState:t?.setState.bind(t),...e||{}})}})}if(t?.children){let n=Object.entries(t?.children)?.flatMap(([s,a])=>a);for(let s=0;s<n?.length;s+=1){let a=n[s];dr(a,e,r)}}return r}catch(o){i("component.eve!nts.registerListenersFix.getListeners",o)}},xo=(t={},e={})=>{try{let o=dr(t,e,[])?.flatMap((n={})=>[].flatMap.call(n?.elements||[],s=>{let{elements:a=[],...c}=n||{};return{...c,element:s}}));for(let n=0;n<o?.length;n+=1){let{instance:s,element:a,elementSelector:c,type:l,handler:y}=o[n];a.addEventListener(l,y),s._eventListeners=[...s?._eventListeners||[],{instance:s,element:a,elementSelector:c,type:l,handler:y}]}}catch(r){i("component.events.registerListenersFix",r)}},ce=xo;var lr=(t={})=>{try{let e=t?._eventListeners||[];if(t?.children){let o=(Object.values(t?.children||{})?.reduce((n=[],s=[])=>[...n,...s],[])).flatMap((n={})=>lr(n));e=[...e,...o]}return e}catch(e){i("component.events.unregisterListenersFix.getListeners",e)}},bo=(t={})=>{try{let e=lr(t);for(let r=0;r<e?.length;r+=1){let{instance:o,element:n,type:s,handler:a}=e[r];n.removeEventListener(s,a),o._eventListeners=o._eventListeners?.splice(r,1)}}catch(e){i("component.events.unregisterListenersFix",e)}},ur=bo;var pr=class{constructor(e={}){this.parent=e?.parent||null,this.onUpdateChildComponent=this.handleUpdateChildComponentInVDOM,this.updateVirtualDOM=this.handleUpdateVirtualDOM,this.timers={},this.children={},rt(e),At(this,e),this.data=Pt(this)}setDOMNodeOnInstance(){this.DOMNode=document.querySelector(`body [js-i="${this.instanceId}"]`)}async handleFetchData(e={},r={},o={},n=this){let s=await re(e,r,o,n);return this.data=s,s}handleGetInstance(){return this}handleUpdateVirtualDOM(){if(this.DOMNode){let r=W(this.DOMNode);this.dom.virtual=r}let e=this.parent?j(window.joystick._internal.tree,this.parent?.instanceId,"instanceId"):null;e?.instance&&e.instance.updateVirtualDOM()}onBeforeRender(){if(!F())return{instanceId:this.instanceId}}render(e={}){if(e?.mounting)return tr(this,e);let r=this.onBeforeRender();ur(this),nr(this.instanceId);let o=z(this,{}),n=ae(this.dom.virtual,o.virtual);n&&u(n)&&q("lifecycle.onBeforeMount",()=>{let s=n(this.DOMNode);this.dom.actual=s,this.dom.virtual=o.virtual,ce(this,this.renderMethods),this.setDOMNodeOnInstance(),q("domNodes",()=>{q("lifecycle.onMount",()=>{this.onAfterRender(r,e)})})})}renderToHTML(e={}){return ne(this,e)}onAfterRender(e={},r={}){F()||(ir(e.instanceId,this),window.joystick._internal.css.update(),q("lifecycle.onUpdateProps"),r?.afterSetStateRender&&u(r.afterSetStateRender)&&r.afterSetStateRender(),r?.afterRefetchDataRender&&u(r.afterRefetchDataRender)&&r.afterRefetchDataRender(),this.parent&&this.parent.onUpdateChildComponent(this.id,this.instanceId))}setState(e={},r=null){this.state=ee(this,{...this.state||{},...e}),this.render({afterSetStateRender:()=>{r&&u(r)&&r()}})}setTimeout(e=null,r=0){e&&(this.timers[L()]=window.setTimeout(e,r))}setInterval(e=null,r=0){e&&(this.timers[L()]=window.setInterval(e,r))}handleUpdateChildComponentInVDOM(e="",r=""){let o=j(window.joystick._internal.tree,this.instanceId,"instanceId"),n=j(window.joystick._internal.tree,r,"instanceId");if(n?.instance?.DOMNode){let s=W(n?.instance?.DOMNode);ar(o?.instance?.dom?.virtual,n?.instanceId,s)}}},mr=pr;var fr=(t={})=>{try{return(e={})=>new mr({...t,props:e?.props,url:e?.url,translations:e?.translations,api:e?.api,req:e?.req,parent:e?.parent})}catch(e){i("component",e)}};var hr=(t={})=>{try{window.joystick._internal.tree={id:t?.id||null,instanceId:t?.instanceId||null,instance:t,children:[]}}catch(e){i("mount.initializeJoystickComponentTree",e)}};var wr=(t={},e=null)=>{try{return t.innerHTML="",t.appendChild(e),e}catch(r){i("mount.appendToDOM",r)}};var yr=(t=null,e={},r=null)=>{try{u(t)||i("mount","Component to mount must be a function."),p(e)||i("mount","props must be an object."),ve(r)||i("mount","target must be a DOM node.");let o=t({props:e});hr(o);let n=o.render({mounting:!0,existingChildren:window.__joystick_childrenBeforeHMRUpdate__||null});return n&&(n.setAttribute("js-c",o.id),n.setAttribute("js-i",o.instanceId)),o.lifecycle.onBeforeMount(),q("lifecycle.onBeforeMount"),wr(r,n),o.setDOMNodeOnInstance(),window.joystick._internal.css.update(),ce(o,o.renderMethods),o.lifecycle.onMount(),q("lifecycle.onMount"),o}catch(o){i("mount",o)}};var gr=class{constructor(e=[]){this.array=[...e],this.array.push=function(){Array.prototype.push.apply(this,arguments)}}async process(e=null){if(this.array.length>0){let r=this.array.shift();r&&r.callback&&(await r.callback(),this.process(e))}else e&&e()}},N=gr;var Eo=new RegExp(/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g),$o=new RegExp(/([^\r\n,{}]+)(,(?=[^}]*{)|\s*{)/g),Fo=(t,e)=>(e||"").replace(Eo,()=>"").replace($o,r=>["@",": "].some(o=>r?.includes(o))?r:`[js-c="${t}"] ${r.trim()}`)?.trim(),xr=(t={},e=[])=>{if(t.instance&&t.instance.options&&t.instance.options.css){let r=t.instance.id,o=t.instance.options.css,n=X(o,t.instance),s=Fo(r,n);e.push(s)}if(t.children&&t.children.length>0){let r=t?.children?.length||0;for(;r--;)xr(t.children[r],e)}return e},br=xr;var Er=()=>{try{let t=document.head.querySelector("style[js-styles]"),r=br(window.joystick?._internal?.tree).reverse().join("").trim();if(t?.innerText===r)return;if(t&&(t.innerHTML=r),!t){let o=document.createElement("style");o.setAttribute("js-styles",""),o.innerHTML=r,document.head.appendChild(o)}}catch(t){i("css.update",t)}};var ko=Se,Mo=Re,So=Z.get,To=je,Oo=Ae,vo=Z.set,Co=Pe,$r=()=>typeof window!="undefined"?window.__joystick_env__:typeof process!="undefined"?"production":null,Fr={_external:{},_internal:{css:{update:Er},queues:{domNodes:new N([]),eventListeners:new N([]),lifecycle:{onBeforeMount:new N([]),onMount:new N([]),onUpdateProps:new N([])},render:new N([])},tree:{},eventListeners:[]},accounts:ko,cache:Mo,component:fr,env:{development:$r()==="development",test:$r()==="test"},get:So,html:To,id:L,mount:yr,renderComponentToHTML:Oo,set:vo,upload:Co,timers:{}};Ie(Fr);var gl=Fr;export{ko as accounts,Mo as cache,gl as default,So as get,To as html,Oo as renderComponentToHTML,vo as set,Co as upload};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@joystick.js/ui-canary",
3
3
  "type": "module",
4
- "version": "0.0.0-canary.57",
4
+ "version": "0.0.0-canary.58",
5
5
  "description": "A JavaScript framework for building user interfaces.",
6
6
  "main": "./dist/index.js",
7
7
  "scripts": {