reblendjs
Version:
ReblendJs uses Reactjs pradigm to build UI components, with isolated state for each components.
1 lines • 68.4 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Reblend={})}(this,function(e){"use strict";class t extends Error{constructor(e){super(e??"Null object not accepted")}}class n{static instance;static getInstance(){return new n}defaultConfigs={noDefering:!1,deferTimeout:0,noPreloader:!1,preloaderDeferTimeout:1e3,placeholderDeferTimeout:100,lazyComponentDeferTimeout:500,diffConfig:{keyThreshold:50,depthThreshold:3,treatInstancesAsEqual:[Node],excludeKeys:["ref"]}};configs=this.defaultConfigs;constructor(){if(n.instance)return n.instance;n.instance=this}update(e){return e&&Object.assign(this.configs,e),this.configs}reset(){this.configs=this.defaultConfigs}}function o(e,t){const n=[...t];if(n.length<=0||!e)return e;const r=n.shift();return r?o(e[r],n):e}const r=e=>e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`).substring(1),i=e=>{let t="";for(const[n,o]of Object.entries(e))t+=`${n}: ${void 0===o?"initial":o}; \n`;return t.trim()},a=e=>{const t=/([a-zA-Z-]+)\s*:\s*([^;]+)/g,n={};let o;for(;null!==(o=t.exec(e));){const e=o[1].trim(),t=o[2].trim();n[e]=t}return n};function s(e){return e.charAt(0).toUpperCase()+e.slice(1)}const c=(e=1234,t=9876)=>Math.floor(Math.random()*(t-e+1))+e,l=e=>{if("function"!=typeof e)return!1;try{if(Function.prototype.toString.call(e).startsWith("class"))return!1}catch(e){return!1}return!0},d=(e,t,n)=>{if(!e)return null;const o=Array.from(e),r=o.indexOf(t);return-1!==r?o.splice(r,1,n):o.push(n),e instanceof Set?new Set(o):o},p=()=>n.getInstance().configs,u=()=>p().noDefering,h="reblendcomponent",f="reblendwrapperforreactcomponent",m="reblendchildrenwrapperforreactcomponent";var y=Object.freeze({__proto__:null,CUSTOM_TAGNAME:"customTagName",REBLEND_CHILDREN_WRAPPER_FOR_REACT_COMPONENT:m,REBLEND_COMPONENT:h,REBLEND_WRAPPER_FOR_REACT_COMPONENT:f,appendChildren:(e,...n)=>{if(!e)throw new t;for(const t of n)e.appendChild(t);return e},capitalize:s,cssObjectFromString:a,cssString:i,donotDeffer:u,escapeRegExp:function(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")},getConfig:p,getDefinedValuesFrom:function(e){const t={};for(const n in e){const o=e[n];null!=o&&null!=o&&(t[n]=o)}return t},getObjectField:o,isCallable:l,objectEquals:function e(t,n){if(t===n)return!0;if("object"!=typeof t||null==t||"object"!=typeof n||null==n)return!1;const o=Object.keys(t),r=Object.keys(n);if(o.length!==r.length)return!1;for(const i of o)if(!r.includes(i)||!e(t[i],n[i]))return!1;return!0},rand:c,registerElement:function(e,t){if(!t)throw new Error("Element to register is null");const n=r(e);if(!customElements.get(n))try{customElements.define(n,t)}catch(e){console.warn(e.message)}return t},removeLastChild:e=>{if(!e)throw new t;return e.removeChild(e.lastChild)},replaceOrAddItemToList:d,shallowRemoveDuplicates:e=>{const t=new Set,n=e?.filter(e=>!(!e||t.has(e))&&(t.add(e),!0));return n},snakeCase:r,spreadTo:(e,t)=>{if(!t||!e)return e;const n=Object.keys(t),o=Object.values(t);for(let t=0;t<n.length;t++){const r=n[t],i=o[t];e[r]=i}return e},sumField:function(e,...t){if(!e||Array.isArray(e)&&e.length<=0)return 0;let n=0;for(const r of e){let e=o(r,t);e&&("string"==typeof e&&(e=parseInt(e)),"number"==typeof e&&(n+=e))}return n}});class g{static instance;elementStyles={[`[${h}], [${f}], [${m}]`]:{display:"contents !important"}};styleElement;constructor(){if(g.instance)return g.instance;this.init(),g.instance=this}init(){this.styleElement=document.createElement("style"),document.head.appendChild(this.styleElement),this.refresh()}update(e,t){if(!e)throw new Error("Invalid query selector or style");const n="string"==typeof t?a(t):t;this.elementStyles[e]={...this.elementStyles[e],...n},this.refresh()}remove(e,t){this.elementStyles[e]&&delete this.elementStyles[e][t],this.refresh()}refresh(){const e=[];for(const[t,n]of Object.entries(this.elementStyles))e.push(`${t} {${i(n)}}\n\n`);this.styleElement.textContent=e.join("")}}const E={accept:"accept",acceptCharset:"accept-charset",accessKey:"accesskey",action:"action",allowFullScreen:"allowfullscreen",allowTransparency:"allowtransparency",alt:"alt",async:"async",autoComplete:"autocomplete",autoFocus:"autofocus",autoPlay:"autoplay",capture:"capture",cellPadding:"cellpadding",cellSpacing:"cellspacing",charSet:"charset",checked:"checked",cite:"cite",class:"class",classID:"classid",cols:"cols",colSpan:"colspan",contentEditable:"contenteditable",contextMenu:"contextmenu",controls:"controls",coords:"coords",crossOrigin:"crossorigin",data:"data",dateTime:"datetime",default:"default",defer:"defer",dir:"dir",disabled:"disabled",download:"download",draggable:"draggable",encType:"enctype",form:"form",formAction:"formaction",formEncType:"formenctype",formMethod:"formmethod",formNoValidate:"formnovalidate",formTarget:"formtarget",frameBorder:"frameborder",headers:"headers",height:"height",hidden:"hidden",high:"high",href:"href",hrefLang:"hreflang",htmlFor:"for",httpEquiv:"http-equiv",id:"id",inputMode:"inputmode",integrity:"integrity",is:"is",keyParams:"keyparams",keyType:"keytype",kind:"kind",label:"label",lang:"lang",list:"list",loop:"loop",low:"low",manifest:"manifest",marginHeight:"marginheight",marginWidth:"marginwidth",max:"max",maxLength:"maxlength",media:"media",mediaGroup:"mediagroup",method:"method",min:"min",minLength:"minlength",multiple:"multiple",muted:"muted",name:"name",nonce:"nonce",noValidate:"novalidate",open:"open",optimum:"optimum",pattern:"pattern",placeholder:"placeholder",playsInline:"playsinline",poster:"poster",preload:"preload",radioGroup:"radiogroup",readOnly:"readonly",rel:"rel",required:"required",reversed:"reversed",role:"role",rows:"rows",rowSpan:"rowspan",sandbox:"sandbox",scope:"scope",scoped:"scoped",scrolling:"scrolling",seamless:"seamless",selected:"selected",shape:"shape",size:"size",sizes:"sizes",slot:"slot",span:"span",spellCheck:"spellcheck",src:"src",srcDoc:"srcdoc",srcLang:"srclang",srcSet:"srcset",start:"start",step:"step",style:"style",summary:"summary",tabIndex:"tabindex",target:"target",title:"title",translate:"translate",type:"type",useMap:"usemap",value:"value",width:"width",wmode:"wmode",wrap:"wrap",referrerPolicy:"referrerpolicy",defaultChecked:"checked",defaultValue:"value",suppressContentEditableWarning:"suppresscontenteditablewarning",suppressHydrationWarning:"suppresshydrationwarning",about:"about",datatype:"datatype",inlist:"inlist",prefix:"prefix",property:"property",resource:"resource",typeof:"typeof",vocab:"vocab",itemProp:"itemprop",itemScope:"itemscope",itemType:"itemtype",itemID:"itemid",itemRef:"itemref",autoCapitalize:"autocapitalize",autoCorrect:"autocorrect",autoSave:"autosave",color:"color",results:"results",security:"security",unselectable:"unselectable",className:"class",dangerouslySetInnerHTML:{name:"innerHTML"},children:null,onCopy:"oncopy",oncopy:"oncopy",onCut:"oncut",oncut:"oncut",onPaste:"onpaste",onpaste:"onpaste",onCompositionEnd:"oncompositionend",oncompositionend:"oncompositionend",onCompositionStart:"oncompositionstart",oncompositionstart:"oncompositionstart",onCompositionUpdate:"oncompositionupdate",oncompositionupdate:"oncompositionupdate",onFocus:"onfocus",onfocus:"onfocus",onBlur:"onblur",onblur:"onblur",onChange:"onchange",onchange:"onchange",onInput:"oninput",oninput:"oninput",onReset:"onreset",onreset:"onreset",onSubmit:"onsubmit",onsubmit:"onsubmit",onInvalid:"oninvalid",oninvalid:"oninvalid",onLoad:"onload",onload:"onload",onError:"onerror",onerror:"onerror",onKeyDown:"onkeydown",onkeydown:"onkeydown",onKeyPress:"onkeypress",onkeypress:"onkeypress",onKeyUp:"onkeyup",onkeyup:"onkeyup",onAbort:"onabort",onabort:"onabort",onCanPlay:"oncanplay",oncanplay:"oncanplay",onCanPlayThrough:"oncanplaythrough",oncanplaythrough:"oncanplaythrough",onDurationChange:"ondurationchange",ondurationchange:"ondurationchange",onEmptied:"onemptied",onemptied:"onemptied",onEncrypted:"onencrypted",onencrypted:"onencrypted",onEnded:"onended",onended:"onended",onLoadedData:"onloadeddata",onloadeddata:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onloadedmetadata:"onloadedmetadata",onLoadStart:"onloadstart",onloadstart:"onloadstart",onPause:"onpause",onpause:"onpause",onPlay:"onplay",onplay:"onplay",onPlaying:"onplaying",onplaying:"onplaying",onProgress:"onprogress",onprogress:"onprogress",onRateChange:"onratechange",onratechange:"onratechange",onSeeked:"onseeked",onseeked:"onseeked",onSeeking:"onseeking",onseeking:"onseeking",onStalled:"onstalled",onstalled:"onstalled",onSuspend:"onsuspend",onsuspend:"onsuspend",onTimeUpdate:"ontimeupdate",ontimeupdate:"ontimeupdate",onVolumeChange:"onvolumechange",onvolumechange:"onvolumechange",onWaiting:"onwaiting",onwaiting:"onwaiting",onAuxClick:"onauxclick",onauxclick:"onauxclick",onClick:"onclick",onclick:"onclick",onContextMenu:"oncontextmenu",oncontextmenu:"oncontextmenu",onDoubleClick:"ondoubleclick",ondoubleclick:"ondoubleclick",onDrag:"ondrag",ondrag:"ondrag",onDragEnd:"ondragend",ondragend:"ondragend",onDragEnter:"ondragenter",ondragenter:"ondragenter",onDragExit:"ondragexit",ondragexit:"ondragexit",onDragLeave:"ondragleave",ondragleave:"ondragleave",onDragOver:"ondragover",ondragover:"ondragover",onDragStart:"ondragstart",ondragstart:"ondragstart",onDrop:"ondrop",ondrop:"ondrop",onMouseDown:"onmousedown",onmousedown:"onmousedown",onMouseEnter:"onmouseenter",onmouseenter:"onmouseenter",onMouseLeave:"onmouseleave",onmouseleave:"onmouseleave",onMouseMove:"onmousemove",onmousemove:"onmousemove",onMouseOut:"onmouseout",onmouseout:"onmouseout",onMouseOver:"onmouseover",onmouseover:"onmouseover",onMouseUp:"onmouseup",onmouseup:"onmouseup",onSelect:"onselect",onselect:"onselect",onTouchCancel:"ontouchcancel",ontouchcancel:"ontouchcancel",onTouchEnd:"ontouchend",ontouchend:"ontouchend",onTouchMove:"ontouchmove",ontouchmove:"ontouchmove",onTouchStart:"ontouchstart",ontouchstart:"ontouchstart",onPointerDown:"onpointerdown",onpointerdown:"onpointerdown",onPointerMove:"onpointermove",onpointermove:"onpointermove",onPointerUp:"onpointerup",onpointerup:"onpointerup",onPointerCancel:"onpointercancel",onpointercancel:"onpointercancel",onPointerEnter:"onpointerenter",onpointerenter:"onpointerenter",onPointerLeave:"onpointerleave",onpointerleave:"onpointerleave",onPointerOver:"onpointerover",onpointerover:"onpointerover",onPointerOut:"onpointerout",onpointerout:"onpointerout",onGotPointerCapture:"ongotpointercapture",ongotpointercapture:"ongotpointercapture",onLostPointerCapture:"onlostpointercapture",onlostpointercapture:"onlostpointercapture",onScroll:"onscroll",onscroll:"onscroll",onWheel:"onwheel",onwheel:"onwheel",onAnimationStart:"onanimationstart",onanimationstart:"onanimationstart",onAnimationEnd:"onanimationend",onanimationend:"onanimationend",onAnimationIteration:"onanimationiteration",onanimationiteration:"onanimationiteration",onTransitionEnd:"ontransitionend",ontransitionend:"ontransitionend",onAbortCapture:"onabortcapture",onCanPlayCapture:"oncanplaycapture",onCanPlayThroughCapture:"oncanplaythroughcapture",onDurationChangeCapture:"ondurationchangecapture",onEmptiedCapture:"onemptiedcapture",onEncryptedCapture:"onencryptedcapture",onEndedCapture:"onendedcapture",onLoadedDataCapture:"onloadeddatacapture",onLoadedMetadataCapture:"onloadedmetadatacapture",onLoadStartCapture:"onloadstartcapture",onPauseCapture:"onpausecapture",onPlayCapture:"onplaycapture",onPlayingCapture:"onplayingcapture",onProgressCapture:"onprogresscapture",onRateChangeCapture:"onratechangecapture",onSeekedCapture:"onseekedcapture",onSeekingCapture:"onseekingcapture",onStalledCapture:"onstalledcapture",onSuspendCapture:"onsuspendcapture",onTimeUpdateCapture:"ontimeupdatecapture",onVolumeChangeCapture:"onvolumechangecapture",onWaitingCapture:"onwaitingcapture",onAuxClickCapture:"onauxclickcapture",onClickCapture:"onclickcapture",onContextMenuCapture:"oncontextmenucapture",onDoubleClickCapture:"ondoubleclickcapture",onDragCapture:"ondragcapture",onDragEndCapture:"ondragendcapture",onDragEnterCapture:"ondragentercapture",onDragExitCapture:"ondragexitcapture",onDragLeaveCapture:"ondragleavecapture",onDragOverCapture:"ondragovercapture",onDragStartCapture:"ondragstartcapture",onDropCapture:"ondropcapture",onMouseDownCapture:"onmousedowncapture",onMouseEnterCapture:"onmouseentercapture",onMouseLeaveCapture:"onmouseleavecapture",onMouseMoveCapture:"onmousemovecapture",onMouseOutCapture:"onmouseoutcapture",onMouseOverCapture:"onmouseovercapture",onMouseUpCapture:"onmouseupcapture",onSelectCapture:"onselectcapture",onTouchCancelCapture:"ontouchcancelcapture",onTouchEndCapture:"ontouchendcapture",onTouchMoveCapture:"ontouchmovecapture",onTouchStartCapture:"ontouchstartcapture",onPointerDownCapture:"onpointerdowncapture",onPointerMoveCapture:"onpointermovecapture",onPointerUpCapture:"onpointerupcapture",onPointerCancelCapture:"onpointercancelcapture",onPointerEnterCapture:"onpointerentercapture",onPointerLeaveCapture:"onpointerleavecapture",onPointerOverCapture:"onpointerovercapture",onPointerOutCapture:"onpointeroutcapture",onGotPointerCaptureCapture:"ongotpointercapturecapture",onLostPointerCaptureCapture:"onlostpointercapturecapture",onScrollCapture:"onscrollcapture",onWheelCapture:"onwheelcapture",onAnimationStartCapture:"onanimationstartcapture",onAnimationEndCapture:"onanimationendcapture",onAnimationIterationCapture:"onanimationiterationcapture",onTransitionEndCapture:"ontransitionendcapture",accentHeight:"accent-height",accumulate:"accumulate",additive:"additive",alignmentBaseline:"alignment-baseline",allowReorder:"allowReorder",alphabetic:"alphabetic",amplitude:"amplitude",arabicForm:"arabic-form",ascent:"ascent",attributeName:"attributeName",attributeType:"attributeType",autoReverse:"autoReverse",azimuth:"azimuth",baseFrequency:"baseFrequency",baselineShift:"baseline-shift",baseProfile:"baseProfile",bbox:"bbox",begin:"begin",bias:"bias",by:"by",calcMode:"calcMode",capHeight:"cap-height",clip:"clip",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",contentScriptType:"contentScriptType",contentStyleType:"contentStyleType",cursor:"cursor",cx:"cx",cy:"cy",d:"d",decelerate:"decelerate",descent:"descent",diffuseConstant:"diffuseConstant",direction:"direction",display:"display",divisor:"divisor",dominantBaseline:"dominant-baseline",dur:"dur",dx:"dx",dy:"dy",edgeMode:"edgeMode",elevation:"elevation",enableBackground:"enable-background",end:"end",exponent:"exponent",externalResourcesRequired:"externalResourcesRequired",fill:"fill",fillOpacity:"fill-opacity",fillRule:"fill-rule",filter:"filter",filterRes:"filterRes",filterUnits:"filterUnits",floodColor:"flood-color",floodOpacity:"flood-opacity",focusable:"focusable",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",format:"format",from:"from",fx:"fx",fy:"fy",g1:"g1",g2:"g2",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",glyphRef:"glyphRef",gradientTransform:"gradientTransform",gradientUnits:"gradientUnits",hanging:"hanging",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",ideographic:"ideographic",imageRendering:"image-rendering",in2:"in2",in:"in",intercept:"intercept",k1:"k1",k2:"k2",k3:"k3",k4:"k4",k:"k",kernelMatrix:"kernelMatrix",kernelUnitLength:"kernelUnitLength",kerning:"kerning",keyPoints:"keyPoints",keySplines:"keySplines",keyTimes:"keyTimes",lengthAdjust:"lengthAdjust",letterSpacing:"letter-spacing",lightingColor:"lighting-color",limitingConeAngle:"limitingConeAngle",local:"local",markerEnd:"marker-end",markerHeight:"markerHeight",markerMid:"marker-mid",markerStart:"marker-start",markerUnits:"markerUnits",markerWidth:"markerWidth",mask:"mask",maskContentUnits:"maskContentUnits",maskUnits:"maskUnits",mathematical:"mathematical",mode:"mode",numOctaves:"numOctaves",offset:"offset",opacity:"opacity",operator:"operator",order:"order",orient:"orient",orientation:"orientation",origin:"origin",overflow:"overflow",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pathLength:"pathLength",patternContentUnits:"patternContentUnits",patternTransform:"patternTransform",patternUnits:"patternUnits",pointerEvents:"pointer-events",points:"points",pointsAtX:"pointsAtX",pointsAtY:"pointsAtY",pointsAtZ:"pointsAtZ",preserveAlpha:"preserveAlpha",preserveAspectRatio:"preserveAspectRatio",primitiveUnits:"primitiveUnits",r:"r",radius:"radius",refX:"refX",refY:"refY",renderingIntent:"rendering-intent",repeatCount:"repeatCount",repeatDur:"repeatDur",requiredExtensions:"requiredExtensions",requiredFeatures:"requiredFeatures",restart:"restart",result:"result",rotate:"rotate",rx:"rx",ry:"ry",scale:"scale",seed:"seed",shapeRendering:"shape-rendering",slope:"slope",spacing:"spacing",specularConstant:"specularConstant",specularExponent:"specularExponent",speed:"speed",spreadMethod:"spreadMethod",startOffset:"startOffset",stdDeviation:"stdDeviation",stemh:"stemh",stemv:"stemv",stitchTiles:"stitchTiles",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",string:"string",stroke:"stroke",strokeDasharray:"stroke-dasharray",strokeDashoffset:"stroke-dashoffset",strokeLinecap:"stroke-linecap",strokeLinejoin:"stroke-linejoin",strokeMiterlimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",surfaceScale:"surfaceScale",systemLanguage:"systemLanguage",tableValues:"tableValues",targetX:"targetX",targetY:"targetY",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",textLength:"textLength",to:"to",transform:"transform",u1:"u1",u2:"u2",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicode:"unicode",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",values:"values",vectorEffect:"vector-effect",version:"version",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",vHanging:"v-hanging",vIdeographic:"v-ideographic",viewBox:"viewBox",viewTarget:"viewTarget",visibility:"visibility",vMathematical:"v-mathematical",widths:"widths",wordSpacing:"word-spacing",writingMode:"writing-mode",x:"x",xHeight:"x-height",x1:"x1",x2:"x2",xChannelSelector:"xChannelSelector",xlinkActuate:"xlink:actuate",xlinkArcrole:"xlink:arcrole",xlinkHref:"xlink:href",xlinkRole:"xlink:role",xlinkShow:"xlink:show",xlinkTitle:"xlink:title",xlinkType:"xlink:type",xmlBase:"xml:base",xmlLang:"xml:lang",xmlns:"xmlns",xmlnsXlink:"xmlns:xlink",xmlSpace:"xml:space",y:"y",y1:"y1",y2:"y2",yChannelSelector:"yChannelSelector",z:"z",zoomAndPan:"zoomAndPan"},b=["value","checked","selected","disabled"],C=e=>{if(!e)return!1;if(e.includes("aria-")||e.includes(":")||e.includes("data-"))return!0;const t=E[e];return!(!t||t instanceof Object||t.startsWith("on")||b.includes(e))},S=e=>{const t=E[e];return void 0===t?e:t instanceof Object?t?.name||e:null===t||t.startsWith("aria-")?e:t.startsWith("on")?e.toLowerCase():t};var w,R,v;e.ChildrenPropsUpdateType=void 0,(w=e.ChildrenPropsUpdateType||(e.ChildrenPropsUpdateType={}))[w.NON_CHILDREN=0]="NON_CHILDREN",w[w.CHILDREN=1]="CHILDREN",e.PatchTypeAndOrder=void 0,(R=e.PatchTypeAndOrder||(e.PatchTypeAndOrder={}))[R.NONE=0]="NONE",R[R.REMOVE=1]="REMOVE",R[R.TEXT=2]="TEXT",R[R.CREATE=3]="CREATE",R[R.REPLACE=4]="REPLACE",R[R.UPDATE=5]="UPDATE",e.EffectType=void 0,(v=e.EffectType||(e.EffectType={})).BEFORE="BEFORE",v.AFTER="AFTER";const A="ReblendPrimitive",T={ReblendNode:Symbol("Reblend.Node"),ReblendVNode:Symbol("Reblend.VNode"),ReblendLazyNode:Symbol("Reblend.Lazy.Node"),ReblendLazyVNode:Symbol("Reblend.Lazy.VNode"),ReactToReblendNode:Symbol("React.Reblend.Node"),ReactToReblendVNode:Symbol("React.Reblend.VNode"),ReblendNodeStandard:Symbol("Reblend.Node.Standard"),ReblendVNodeStandard:Symbol("Reblend.VNode.Standard")};var O;function N(e,t){const n=T[e];return!(!t||!n)&&(t[n]=!0,t[n])}function k(e){return e&&"object"==typeof e&&e[T.ReblendNode]}function P(e){return e&&"object"==typeof e&&e[T.ReblendVNode]}function _(e){return e&&"object"==typeof e&&e[T.ReblendLazyVNode]}function M(e){return e&&"object"==typeof e&&e[T.ReblendNodeStandard]}function L(e){return e&&"object"==typeof e&&e[T.ReblendVNodeStandard]}function D(e){return e&&"object"==typeof e&&e[T.ReactToReblendNode]}function x(e){return e&&"object"==typeof e&&e[T.ReactToReblendVNode]}function I(e){return e&&"object"==typeof e&&e[T.ReblendVNodeStandard]}function j(e){return!z(e)&&e.displayName===A}function z(e){const t=typeof e;return["string","number","boolean","bigint","null","undefined","symbol"].some(n=>n===(null===e?"null":t))}function F(e){return e&&("object"==typeof e||"function"==typeof e)&&!("construct"in e&&"mountOn"in e&&"createInnerHtmlElements"in e.prototype)&&("$$typeof"in e||e.prototype&&e.prototype.isReactComponent)}function U(e){return e&&"object"==typeof e&&e instanceof Promise}function V(e){return!!e&&(M(e)||j(e))}function H(e){return e?.nodeType===Node.TEXT_NODE}function G(e){return null==e}function q(e,t){const n=Object.getPrototypeOf(t);n&&n!==Object.prototype&&q(e,n);const o=Object.getOwnPropertyDescriptors(t);for(const t in o)if(Object.prototype.hasOwnProperty.call(o,t)){if("constructor"===t)continue;const n=o[t];Object.defineProperty(e,t,n)}}function W(e){if(!e)return[];e instanceof Set||Array.isArray(e)||(e=[e]);const t=[];for(const n of e)n instanceof Set||Array.isArray(n)?t.push(...W(n)):t.push(n);return t}function B(e,t=[]){if(!e)return[];if(Array.isArray(e)||(e=[e]),(e.length||e.size)<1)return[];for(const n of e)n instanceof Set||Array.isArray(n)?B(n,t):t.push(n);return t}!function(e){e.ReblendNode="ReblendNode",e.ReblendVNode="ReblendVNode",e.ReblendLazyNode="ReblendLazyNode",e.ReblendLazyVNode="ReblendLazyVNode",e.ReactToReblendNode="ReactToReblendNode",e.ReactToReblendVNode="ReactToReblendVNode",e.ReblendNodeStandard="ReblendNodeStandard",e.ReblendVNodeStandard="ReblendVNodeStandard"}(O||(O={}));const K={ReblendPlaceholder:!0,defaultReblendPlaceholderStyle:!0};function Y(e,t){const n=[],o=["displaystyle","scriptlevel","mathvariant","mathsize","lspace","rspace"];for(const[r,i]of Object.entries(t))r.startsWith("xmlns:")?e.setAttributeNS("http://www.w3.org/2000/xmlns/",r,i):"xmlns"===r?e.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns",i):e instanceof SVGElement&&n.includes(r)?e.setAttributeNS("http://www.w3.org/2000/svg",r,i):e instanceof Element&&o.includes(r)?e.setAttributeNS("http://www.w3.org/1998/Math/MathML",r,i):r.startsWith("xlink:")?e.setAttributeNS("http://www.w3.org/1999/xlink",r,i):e.setAttribute(r,i)}async function X(e,t=[]){if(!e)return t;e instanceof Set||Array.isArray(e)||(e=[e]);for(const n of e instanceof Set?Array.from(e):e)if(Array.isArray(n))await X(n,t);else if(!z(n)&&"construct"in n&&"mountOn"in n&&"createInnerHtmlElements"in n.prototype)await X(Ee.construct(n,{}),t);else{if(!(l(n)||n instanceof be||n instanceof Node||z(n)||x(n)||U(n)||_(n)||P(n)||I(n)))throw new TypeError("Invalid child node in children");{const e=W(await $(n));e&&t.push(...e)}}return t}async function $(e){if(e instanceof be||e instanceof Node)return e.displayName||(e.displayName=s(e.tagName),q(e,be.prototype),N(O.ReblendNodeStandard,e),e._constructor()),[e];if(Array.isArray(e))return await X(e);if(z(e))return[Z()?.setData(e)];if(l(e)&&(e=e({})),z(e))return[Z()?.setData(e)];if(e instanceof Promise)return await X(Ee.construct(e,{}));const t=e;if("construct"in t&&"mountOn"in t&&"createInnerHtmlElements"in t.prototype)return await X(Ee.construct(t,{}));let{displayName:n}=e;const o=e&&e.props&&e.props.reactcomponent;if(!o&&l(n)&&(n=await n(e.props)),"string"!=typeof n&&z(n))return[Z()?.setData(n)];const r=n;if(n instanceof be||n instanceof Node)return r.displayName||(r.displayName=s(r.tagName),q(r,be.prototype),N(O.ReblendNodeStandard,r),r._constructor()),e?.props&&(r.props||(r.props={}),r.props={...r.props,...e.props}),[r];if(L(r)||P(r)||x(r)||x(r)||_(r))return e?.props&&(r.props||(r.props={}),r.props={...r.props,...e.props}),await $(r);let i=n;const a="string"==typeof n,c=o||F(n),d=U(e)||U(n);let u;if(u=d?O.ReblendLazyNode:a?n:F(i)?i.displayName||i.name||"ReactComponent":"Fragment"===i?.ELEMENT_NAME?i.name:i?.ELEMENT_NAME||"Anonymous",!a&&!d&&!c){if("Reblend"===n?.ELEMENT_NAME&&"Reblend"===n?.name)return[...n?.children||[]];i.ELEMENT_NAME=u}c&&(i=me,i.ELEMENT_NAME=s(`${n.displayName}`));const m=["svg","path","circle","rect","line","text","use","g","defs","clipPath","polygon","polyline","image","symbol"].includes(y=a?n:"div")?document.createElementNS("http://www.w3.org/2000/svg",y):["math","mi","mn","mo","ms","mtext"].includes(y)?document.createElementNS("http://www.w3.org/1998/Math/MathML",y):["xml","xmlns"].includes(y)?document.createElementNS("http://www.w3.org/XML/1998/namespace",y):document.createElement(y);var y;let g;if(g=d?O.ReblendLazyNode:c?O.ReactToReblendNode:a?O.ReblendNodeStandard:O.ReblendNode,N(g,m),m.displayName=u,a||c)q(m,be.prototype);else{const t=d?e?.config:i.config;q(m,d?be.prototype:i.prototype),t&&Object.entries(t).forEach(([e,t])=>{K[e]?m[e]=t:console.warn(`Unsupported key \`${e}\` found in component configuration.`)})}if(d&&(m.initState=(async()=>await(n||e)).bind(m)),c&&(m.ReactClass=n,q(m,me.prototype)),m._constructor(),!a){const e=process.env.REBLEND_ENVIRONEMENT_PRODUCTION;c?m.setAttribute(f,e?"":u):m.setAttribute(h,e?"":u)}if(a&&"ref"in e.props&&e.props.ref){const t=e.props.ref;"function"==typeof t?(t(null),t(m)):(t.current=null,t.current=m),m.ref=t}if(e?.props?.isPlaceholder||m.isPlaceholder||V(m)||c)await Q(e.props,m,!0),await m.populateHtmlElements();else{const t=async()=>{const t=await Q(d?{}:e.props,m,!0);void 0!==t&&(m.html=async()=>Ee.construct(t,d?e.props:{})),m.awaitingInitState&&(m.awaitingInitState=!1,ce(m))},n=p();n.noDefering?await t():d?(m.initStateRunning=!0,setTimeout(()=>{t()},n.lazyComponentDeferTimeout)):t()}return[m]}function Z(){const e=document.createTextNode("");return q(e,be.prototype),e.displayName=A,e.setData=function(e){if(this.reblendPrimitiveData=e,void 0!==this.reblendPrimitiveData&&null!==this.reblendPrimitiveData){const e=`${this.reblendPrimitiveData}`;this.nodeValue=e}else this.nodeValue="";return this},e.getData=function(){return this.reblendPrimitiveData},e}function J(e,t){return n=>{if(t)if("function"==typeof t)t.call(e,n);else{if("string"!=typeof t)throw new Error("Event callback must be a function or a string, but received: "+typeof t);new Function("e",t).call(e,n)}}}async function Q(e,t,n){if(!t)return;if(n&&t.initProps?await t.initProps(e):t.props={...t.props||{},...e||{}},M(t))for(const n in e){const o=S(n),r=e[n];if("dangerouslySetInnerHTML"==n)t.innerHTML=r?.__html;else if(n.startsWith("on"))t[o]=J(t,r);else if("style"===o)t.addStyle(r);else{if("children"===o||null==r)continue;const e=C(o);try{e?Y(t,{[o]:r}):t[o]=r}catch{}}}let o;return n&&t.initState&&(t.initStateRunning=!0,o=await t.initState(),t.initStateRunning=!1),o}function ee(e,t){if(e&&t){t.props={...t.props,...e};for(const n in e){const o=S(n),r=C(n);try{r?(t.removeAttribute(o),delete t?.props[o]):(t[o]=e[n],delete t[o])}catch{}}}}function te(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ne,oe={};var re=function(){if(ne)return oe;function e(e){return null===e||"object"!=typeof e&&"function"!=typeof e}function t(n,o,r={}){if(n===o)return!0;if(e(n)||e(o))return n===o;if("function"==typeof n&&"function"==typeof o)return function(e,t,n){if(e===t)return!0;if(e.name&&t.name&&e.name!==t.name)return!1;if(e.toString()!==t.toString())return!1;if(!n(Object.getPrototypeOf(e),Object.getPrototypeOf(t)))return!1;const o=[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)];if(!n(o,[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)]))return!1;for(const r of o)if(!n(e[r],t[r]))return!1;return!0}(n,o,(e,n)=>t(e,n,r));if(n?.constructor!==o?.constructor)return!1;if(Object.getPrototypeOf(n)!==Object.getPrototypeOf(o))return!1;if(r.shouldTreatAsEqual){const e=r.shouldTreatAsEqual(n,o);if(!0===e)return!0;if(!1===e)return!1}if(r.treatInstancesAsEqual&&r.treatInstancesAsEqual.length)for(const e of r.treatInstancesAsEqual)if(n instanceof e&&o instanceof e)return!0;if(r.shouldIgnoreObject?.(n)||r.shouldIgnoreObject?.(o))return!0;const i=[{a:n,b:o,depth:0}],a=new WeakMap;for(;i.length;){const{a:t,b:n,depth:o}=i.pop();if(t===n)continue;if(e(t)||e(n)||t?.constructor!==n?.constructor)return!1;if(Object.getPrototypeOf(t)!==Object.getPrototypeOf(n))return!1;if(r.shouldTreatAsEqual){const e=r.shouldTreatAsEqual(t,n);if(!0===e)continue;if(!1===e)return!1}if(r.treatInstancesAsEqual&&r.treatInstancesAsEqual.length){let e=!1;for(const o of r.treatInstancesAsEqual)if(t instanceof o&&n instanceof o){e=!0;break}if(e)continue}if(r.shouldIgnoreObject?.(t)||r.shouldIgnoreObject?.(n))continue;if(a.has(t)){if(a.get(t)!==n)return!1;continue}a.set(t,n);const s=Object.keys(t).filter(e=>(!r.includeKeys||r.includeKeys.includes(e))&&(!r.excludeKeys||!r.excludeKeys.includes(e))&&!r.shouldIgnoreKey?.(e,t,n)),c=Object.keys(n).filter(e=>(!r.includeKeys||r.includeKeys.includes(e))&&(!r.excludeKeys||!r.excludeKeys.includes(e))&&!r.shouldIgnoreKey?.(e,t,n));if(s.length!==c.length)return!1;if(r.keyThreshold&&s.length>r.keyThreshold||r.keyThreshold&&c.length>r.keyThreshold||r.depthThreshold&&o>r.depthThreshold){if(t!==n)return!1;continue}const l=new Set(s);for(const e of c)if(!l.has(e))return!1;for(const e of s){if(!Object.prototype.hasOwnProperty.call(n,e))return!1;const r=t[e],a=n[e];r!==a&&i.push({a:r,b:a,depth:o+1})}}return!0}return ne=1,Object.defineProperty(oe,"__esModule",{value:!0}),oe.deepEqualIterative=t,oe.default=t,oe}(),ie=te(re);async function ae(e){z(e)||(e.disconnectedCallback?u()?await e.disconnectedCallback():e.disconnectedCallback():(e.parentElement&&(e.outerHTML=""),e.innerHTML="",e?.remove()))}async function se(e){if(!z(e))for(const t of new Set([...e.childNodes,...e.elementChildren?.values()||[]]))u()?await ae(t):ae(t)}async function ce(e){e&&e.connectedCallback&&await e.connectedCallback()}async function le(e,t){let n=t;Array.isArray(e)||(e=[e]);const o=document.createDocumentFragment();for(const r of e)t.directParent&&!t.directParent.elementChildren?.has(r)&&(t.directParent.elementChildren||(t.directParent.elementChildren=new Set),t.directParent.elementChildren=d(t.directParent.elementChildren,n,r)),o.appendChild(r),u()?await ce(r):ce(r),n=r;t.after(o),t.remove(),t.directParent?.elementChildren?.delete(t)}function de(t,n,o){const r=[];return!z(n)&&Object.hasOwn(n,"reblendPrimitiveData")&&n.reblendPrimitiveData==o?[]:(n?o||r.push({type:e.PatchTypeAndOrder.REMOVE,parent:t,oldNode:n}):r.push({type:e.PatchTypeAndOrder.CREATE,parent:t,newNode:o}),r)}async function pe(t,n,o,r,i){const a=[];if(!t.renderingSessionTracker.isCurrentSession(n))return a;if(l(i)&&(i=await i()),l(i))return a.push({type:e.PatchTypeAndOrder.REPLACE,parent:o,newNode:i,oldNode:r}),a;if(z(r)&&z(i))a.push({type:e.PatchTypeAndOrder.CREATE,parent:o,newNode:i});else if(z(r)&&!z(i))a.push({type:e.PatchTypeAndOrder.CREATE,parent:o,newNode:i});else if(j(r)&&z(i))r.getData()!==i&&r.setData(i);else if(j(r)&&!z(i))a.push({type:e.PatchTypeAndOrder.REPLACE,parent:o,newNode:i,oldNode:r});else if(H(r)&&z(i))r.textContent!==i&&a.push({type:e.PatchTypeAndOrder.TEXT,newNode:i,oldNode:r});else if(H(r)&&!z(i))a.push({type:e.PatchTypeAndOrder.REPLACE,parent:o,newNode:i,oldNode:r});else if(!j(r)&&z(i))a.push({type:e.PatchTypeAndOrder.REPLACE,parent:o,newNode:i,oldNode:r});else if(G(r)&&!G(i))a.push({type:e.PatchTypeAndOrder.CREATE,parent:o,newNode:i});else if(!G(r)&&G(i))a.push({type:e.PatchTypeAndOrder.REMOVE,parent:o,oldNode:r});else if(r?.props?.key!==i?.props?.key)a.push({type:e.PatchTypeAndOrder.REPLACE,parent:o,newNode:i,oldNode:r});else if("displayName"in r&&"displayName"in i){const s=r.displayName.toLowerCase();let c="";const d=i?.props?.reactcomponent;if(!d&&l(i.displayName)&&(i.displayName=await i.displayName()),z(i.displayName)?c=i.displayName:i.displayName.ELEMENT_NAME?c=i.displayName.ELEMENT_NAME:i.displayName.displayName?c=i.displayName.displayName:i.displayName.name?c=i.displayName.name:i.displayName&&(c=i.displayName),c="string"==typeof c?c?.toLowerCase():"",!d&&l(i.displayName)||s&&c&&s!==c)a.push({type:e.PatchTypeAndOrder.REPLACE,parent:o,newNode:i,oldNode:r});else{const o=function(e,t){const n=["key","children","ref"],o=[],r=t?.props||{},i={};t.initProps.call(i,e?.props||{});const a=i.props||{},s=k(t),c=p().diffConfig||void 0;for(const e in a)if(!n.includes(e)||"children"===e&&s){let n=r[e],i=a[e];(!ie(n,i,"children"===e?{...c,depthThreshold:void 0,keyThreshold:void 0}:c)||"select"===t.displayName&&"value"===e&&t.value!==i)&&(n=null,i=null,o.push({type:"UPDATE",node:t,key:e,propValue:a[e]}))}for(const e in r)(!n.includes(e)||"children"===e&&s)&&(e in a||o.push({type:"REMOVE",node:t,key:e,propValue:void 0}));return o}(i,r);if(o&&o.length>0&&a.push({type:e.PatchTypeAndOrder.UPDATE,patches:o}),!t.renderingSessionTracker.isCurrentSession(n))return a;r.childrenInitialize&&a.push(...await async function(e,t,n,o,r){if(!V(o)&&!D(o))return[];const i=[...o.elementChildren?.values()||[]],a=W(r?.props?.children||[]),s=[],c=Math.max(i.length,a.length);for(let o=0;o<c;o++){const r=i[o],c=a[o];void 0===r||void 0===c?s.push(...de(n,r,c)):s.push(...await pe(e,t,n,r,c))}o?.props&&(o.props.children=a);return s}(t,n,r,r,i))}}return a}async function ue(t){const n=Array.isArray(t)?t.flat():t||[],o=new Map,r=new Map,i=new Set,a=new Set,s=p();n.forEach(({type:t,node:n,key:s,propValue:c})=>{"UPDATE"===t?(o.has(n)||o.set(n,{}),o.get(n)[s]=c):"REMOVE"===t&&(r.has(n)||r.set(n,new Set),r.get(n).add(s)),D(n)?("children"===s?n.childrenPropsUpdate?.add(e.ChildrenPropsUpdateType.CHILDREN):n.childrenPropsUpdate?.add(e.ChildrenPropsUpdateType.NON_CHILDREN),i.add(n)):k(n)&&n.attached&&a.add(n)});for(const[e,t]of o.entries())Q(t,e,!1);for(const[e,t]of r.entries()){const n={};for(const e of t)n[e]=void 0;ee(n,e)}for(const e of i)e?.checkPropsChange();if(a.size>0)if(s.noDefering)for(const e of a)await e.onStateChange();else setTimeout(()=>{for(const e of a)e.onStateChange()},s.deferTimeout)}async function he(e,t,n){n&&(e.directParent?.elementChildren?.delete(e),e.remove()),u()?(await t(),await ae(e)):t().then(()=>requestIdleCallback(()=>{ae(e)}))}function fe(e){e.ref&&("function"==typeof e.ref?e.ref(null):e.ref.current&&(e.ref.current=null))}class me{static async getChildrenWrapperForReact(e){let t;try{t=require("react")}catch(e){throw new Error("React is not available. Please ensure React is properly installed.")}const n=Array.from(e).map(e=>{const n=D(e),o=k(e),r=j(e),i=n||o?"div":r?"span":e.displayName;return t.createElement(i,{[m]:e.displayName||"",...void 0!==e.props?.value?{value:e.props.value}:{},ref:async t=>{t?t.contains(e)||(t.appendChild(e),e.attached||ce(e)):e.remove()}},null)});return n?.length&&n.length<2?n.pop():n}html(){return this.props.children}async checkPropsChange(){for(const t of Array.from(this.childrenPropsUpdate||[]).sort())switch(this.childrenPropsUpdate?.delete(t),t){case e.ChildrenPropsUpdateType.CHILDREN:await this.onStateChange();break;case e.ChildrenPropsUpdateType.NON_CHILDREN:this.reactReblendMount();break;default:throw new Error("Invalid props update type provided")}}async initRoot(){try{const e=require("react-dom/client");this.reactDomCreateRoot_root&&Object.values(this.reactDomCreateRoot_root)[0]||(this.reactDomCreateRoot_root=e.createRoot(this))}catch(e){throw new Error("ReactDOM is not available. Please ensure React and ReactDOM are properly installed.")}}async reactReblendMount(){let e;try{e=require("react")}catch(e){throw new Error("React is not available. Please ensure React is properly installed.")}if(!this.ReactClass)return;const t=this.props?.children&&this.props?.children?.length?await me.getChildrenWrapperForReact(this.elementChildren):void 0;await this.initRoot();const n={...this.props};void 0!==n.children&&delete n.children,this.reactDomCreateRoot_root?.render(e.createElement(this.ReactClass,n,...Array.isArray(t)?t:t?[t]:[]))}cleanUp(){this.reactDomCreateRoot_root?.unmount(),this.reactDomCreateRoot_root=null}}class ye{cycles=[];generateId(){const e=c(1e4,999999);return this.cycles.includes(e)?this.generateId():e}hasASession(){return this.cycles.length>0}hasPreviousSession(){return this.cycles.length>1}isCurrentSession(e){return this.cycles[0]===e}completeCurrentCycle(e){return!!this.isCurrentSession(e)&&(this.cycles.shift(),!0)}startSession(){const e=this.generateId();return this.cycles.unshift(e),e}resetSession(){this.cycles=[]}}const ge=new Error("State Identifier/Key not specified");class Ee{static ELEMENT_NAME="BaseComponent";static props;static config;static async wrapChildrenToReact(e){const t=await $(e);return await me.getChildrenWrapperForReact(t)}static reactCompact(e,t){return Ee.construct(e,{...t||{},reactcomponent:!0})}static construct(e,t,...n){if(Array.isArray(e))return e;if(L(e)||P(e)||x(e)||x(e)||_(e)){const o={...e,props:{...e?.props||{},...t}};return(e?.props?.children||t?.children||n.length)&&(o.props.children=[...e?.props?.children||[],...t?.children||[],...n||[]]),o}if(k(e)||M(e)||D(e)||(o=e)&&"object"==typeof o&&o[T.ReblendLazyNode]){const o={...e?.props||{},...t};return(e?.props?.children||t?.children||n.length)&&(o.children=[...e?.props?.children||[],...t?.children||[],...n||[]]),e.props=o,e}var o;if(U(e)){const o={displayName:e,props:{...t}};return(t?.children||n.length)&&(o.props.children=[...e?.props?.children||[],...t?.children||[],...n||[]]),N(O.ReblendLazyVNode,o),o}const r=e,i="string"==typeof e;if(!i&&("Fragment"===r?.ELEMENT_NAME&&"Fragment"===r?.name||"Reblend"===r?.ELEMENT_NAME&&"Reblend"===r?.name))return n||[];if(r?.props?.children&&!Array.isArray(r?.props?.children)||t?.children&&!Array.isArray(t?.children))throw new Error("Children props must be an array of ReblendNode or HTMLElement");const a={...!i&&r?.props?r.props:{},...t};(r?.props?.children||t?.children||n.length)&&(a.children=[...r?.props?.children||[],...t?.children||[],...n||[]]);const s={displayName:r||e,props:a};let c;return c=i?O.ReblendVNodeStandard:F(r)?O.ReactToReblendVNode:U(r)?O.ReblendLazyVNode:O.ReblendVNode,N(c,s),s}static async renderToString(e,t){const n=(await $(Ee.construct("div",{},Ee.construct(e,t||{})))).pop();await ce(n);return n.innerHTML}static async mountOn(e,t,o){let r="string"==typeof e?document.getElementById(e):e;if(!r)throw new Error("Invalid root or root id");if(r=(await $(r)).pop(),!r)throw new Error("Invalid root or root id");let i=r.style.display||"initial";new g;const a=n.getInstance().update(o);let s;if(!a.noDefering&&!a.noPreloader){let e=document.createElement("div");e.setAttribute("preloaderParent","");const t=()=>{document.body.appendChild(e),r.style.display="none",e.style.display="initial"},n=async(e,t)=>{for(const n of t)e.appendChild(n),ce(n),await new Promise(e=>requestAnimationFrame(e))},c=o?.preloader;let l=c?Ee.construct(c,{}):Ee.construct((await Promise.resolve().then(function(){return ve})).Preloader,{}),d=await X(Array.isArray(l)?l:[l]);await n(e,d),t(),s=async()=>{r.style.display=i,e.style.display="none",e.remove(),d.forEach(e=>{ae(e)}),e=void 0,i=void 0,l=void 0,d=void 0},await new Promise(e=>{setTimeout(()=>requestAnimationFrame(e),a.preloaderDeferTimeout)})}return r.html=()=>t,r.attached?await r.onStateChange():(r.isRootComponent=!0,await r.populateHtmlElements(),await ce(r)),s&&s(),r.elementChildren||new Set}static createRef(e){return Ee.prototype.useRef.call(null,...arguments)}async createInnerHtmlElements(){let e=await this.html();l(e)&&(e=e(this.props)),Array.isArray(e)||(e=[e]),e=B(e);return await X(e)}async populateHtmlElements(){if(this.hasDisconnected)return[];const e=p();let t=[];try{const n=D(this);if(n&&(this.elementChildren?.size||this.reactElementChildrenWrapper))return[];if(t=await this.createInnerHtmlElements(),t.forEach(e=>e.directParent=this),this.elementChildren=new Set(t),this.removePlaceholder&&(await new Promise(t=>{setTimeout(t,e.placeholderDeferTimeout)}),this.removePlaceholder&&await this.removePlaceholder()),n)e.noDefering?this.reactReblendMount&&await this.reactReblendMount():this.reactReblendMount&&this.reactReblendMount();else{for(const n of t)this.appendChild(n),e.noDefering?await ce(n):ce(n);this.isPlaceholder&&this.directParent?.awaitingInitState&&!this.directParent?.initStateRunning&&(e.noDefering?(await ce(this.directParent),this.directParent.awaitingInitState=!1):setTimeout(()=>{ce(this.directParent),this.directParent.awaitingInitState=!1},e.deferTimeout))}this.childrenInitialize=!0,this.awaitingReRender&&(e.noDefering?await this.onStateChange():this.onStateChange())}catch(e){this.handleError(e)}return t}async connectedCallback(){if(this.initStateRunning){if(this.awaitingInitState=!0,this.isPlaceholder)return;if(this.ReblendPlaceholder){let e;e="function"==typeof this.ReblendPlaceholder?Ee.construct(this.ReblendPlaceholder,{}):this.ReblendPlaceholder;const t=await $(e);if(!this.childrenInitialize){if(this.placeholderAttached)return;this.placeholderAttached=!0,t.forEach(e=>{if(!this.initStateRunning)return requestIdleCallback(()=>ae(e));e.directParent=this,e.isPlaceholder=!0,this.appendChild(e),ce(e)}),this.initStateRunning&&(this.removePlaceholder=async()=>{t.forEach(e=>ae(e)),this.removePlaceholder=void 0})}}else{const e=p(),t=Ee.construct(e.placeholder||(await Promise.resolve().then(function(){return we})).Placeholder,{style:this.defaultReblendPlaceholderStyle}),n=await $(t);if(!this.childrenInitialize){if(this.placeholderAttached)return;this.placeholderAttached=!0,n.forEach(e=>{if(!this.initStateRunning)return requestIdleCallback(()=>ae(e));e.directParent=this,e.isPlaceholder=!0,this.appendChild(e),ce(e)}),this.initStateRunning&&(this.removePlaceholder=async()=>{n.forEach(e=>ae(e)),this.removePlaceholder=void 0})}}}else await async function(e){e.hasDisconnected||e.attached||(e.attached=!0,await e.componentDidMount(),await e.mountEffects())}(this)}addHookDisconnectedEffect(e){this.hookDisconnectedEffects?.add(e)}addStyle(e){if(e)if("string"==typeof e)this.setAttribute("style",e);else if(Array.isArray(e)){const t=e.join(";");this.setAttribute("style",t)}else for(const[t,n]of Object.entries(e))this.style[t]=n}async initState(){}async initProps(e){this.props=e||{}}componentDidMount(){}setState(e){this.state=e,this.onStateChange()}async applyEffects(e,t){if(!this.hasDisconnected)for(const n of this.effectsState.values()||[]){if(n.type!==t)continue;const o=n.effect&&await n.effect();if("function"==typeof o&&(n.disconnectEffect=o),!this.mountingEffects&&!this.mountingAfterEffects&&!this.renderingSessionTracker.isCurrentSession(e))break}}handleError(e){if(this.renderingErrorHandler)this.renderingErrorHandler((e.component=this,e));else if(this.state?.renderingErrorHandler&&"function"==typeof this.state.renderingErrorHandler)this.state.renderingErrorHandler(e);else{if(!this.directParent)throw e;this.directParent.handleError(e)}}async onStateChange(){if(!this.attached||this.hasDisconnected)return;if(V(this)&&!this.isRootComponent)return;if(this.mountingEffects||this.initStateRunning)return void(this.awaitingReRender=!0);const t=this.renderingSessionTracker.startSession();if(this.renderingSessionTracker.hasPreviousSession())return;const n=p(),o=async()=>{this.renderingSessionTracker.resetSession(),n.noDefering?await this.onStateChange():this.onStateChange()},r=[];let i;try{if(this.stateEffectRunning=!0,await this.applyEffects(t,e.EffectType.BEFORE),this.stateEffectRunning=!1,!this.renderingSessionTracker.isCurrentSession(t))return await o();if(this.forceEffects=!1,this.childrenInitialize){i=await this.html(),l(i)&&(i=i(this.props)),Array.isArray(i)||(i=[i]),i=B(i);const e=[...this.elementChildren?.values()||[]],n=Math.max(e.length||0,i.length);for(let a=0;a<n;a++){const n=i[a],s=e[a];if(!this.renderingSessionTracker.isCurrentSession(t))return await o();if(r.push(...await pe(this,t,this,s,n)),!this.renderingSessionTracker.isCurrentSession(t))return await o()}}else this.awaitingReRender=!0}catch(e){this.handleError(e)}return this.renderingSessionTracker.isCurrentSession(t)?(await async function(t){const n=new Set;t=Array.from(t||[]);const o=p(),r=new Map,i=[],a=[],s=[],c=[];for(const l of t)switch(l.type){case e.PatchTypeAndOrder.CREATE:{if(!l.parent)break;const e=await $(l.newNode);if(!e.length)break;if(e.forEach(e=>e.directParent=l.parent),l.parent.elementChildren)for(const t of e)l.parent.elementChildren.add(t);else l.parent.elementChildren=new Set(e);if(D(l.parent))n.add(l.parent);else{let t=r.get(l.parent);t||(t=document.createDocumentFragment(),r.set(l.parent,t));for(const n of e)t.appendChild(n),s.push(async()=>{o.noDefering?await ce(n):ce(n)})}break}case e.PatchTypeAndOrder.REMOVE:l.oldNode&&(fe(l.oldNode),i.push(l.oldNode));break;case e.PatchTypeAndOrder.REPLACE:if(l.oldNode){fe(l.oldNode);const e=await $(l.newNode);e.forEach(e=>e.directParent=l.oldNode?.directParent),a.push({oldNode:l.oldNode,newNodeElements:e})}break;case e.PatchTypeAndOrder.TEXT:l.oldNode&&(l.oldNode.textContent=l.newNode);break;case e.PatchTypeAndOrder.UPDATE:l.patches&&c.push(l.patches)}c.length>0&&(o.noDefering?await ue(c):ue(c));for(const[e,t]of r.entries())e.appendChild(t);for(const e of i)await he(e,async()=>{},!0);for(const{oldNode:e,newNodeElements:t}of a)await he(e,async()=>{for(const n of t)n.directParent=e.directParent;u()?await le(t,e):le(t,e)});for(const e of s)await e();for(const e of n)D(e)&&(o.noDefering?e.reactReblendMount&&await e.reactReblendMount():setTimeout(()=>{e.reactReblendMount&&e.reactReblendMount()},o.deferTimeout))}(r),this.renderingSessionTracker.isCurrentSession(t)?(await this.applyEffects(t,e.EffectType.AFTER),this.renderingSessionTracker.isCurrentSession(t)?(i=null,void this.renderingSessionTracker.resetSession()):await o()):await o()):await o()}async html(){return null}async mountEffects(){this.stateEffectRunning=!0,j(this)||(this.mountingEffects=!0,await this.applyEffects(0,e.EffectType.BEFORE),this.mountingEffects=!1),this.stateEffectRunning=!1,"Placeholder"===this.displayName||this.props?.isPlaceholder||this.isPlaceholder||V(this)||D(this)||(await this.populateHtmlElements(),this.mountingAfterEffects=!0,await this.applyEffects(0,e.EffectType.AFTER),this.mountingAfterEffects=!1)}async disconnectedCallback(e=!1){await async function(e,t=!1){if(e.hasDisconnected)return;const n=p();if(!t&&await e.cleanUp(),e.componentWillUnmount&&await e.componentWillUnmount(),!j(e))for(const t of e.effectsState?.values()||[])t.disconnectEffect&&await t.disconnectEffect(),t.cache=null,t.cacher=null,t.effect=null,t.disconnectEffect=null;e.hookDisconnectedEffects?.forEach(e=>{e()}),n.noDefering?await se(e):se(e);for(const t of e.elementChildren?.values()||[])n.noDefering?await ae(t):ae(t);if(e.directParent?.elementChildren?.delete(e),e.innerHTML="",e.parentElement){e.outerHTML="";try{HTMLElement.prototype.remove.call(e)}catch{e.parentElement.removeChild(e)}}n.noDefering?await(e.reactElementChildrenWrapper?.disconnectedCallback()):e.reactElementChildrenWrapper?.disconnectedCallback(),e.props=null,e.reactElementChildrenWrapper=null,e.elementChildren=null,e.effectsState=null,e.hookDisconnectedEffects=null,e.directParent=null,e.state=null,e.renderingError=null,e.renderingErrorHandler=null,e.nearestStandardParent=null,e.ReactClass=null,e.ref=null,e.childrenPropsUpdate=null,e.hasDisconnected=!0}(this,e)}cleanUp(){}componentWillUnmount(){}dependenciesChanged(e,t){return!ie(e,t,p().diffConfig||{})}generateId(){const e=c(1e4,999999)+"_effectId";return this.effectsState.get(e)?this.generateId():e}getCacher(e){return()=>{let t=e;for(;"function"==typeof t;)t=t();return t}}useState(e,t){if(!t)throw ge;"function"==typeof e&&(e=e.bind(this)()),e instanceof Promise?e.then(e=>this.state[t]=e):this.state[t]=e;return[e,(async(e,n=!1)=>{if("function"==typeof e?e=await e(this.state[t]):e instanceof Promise&&(e=await e),(n||this.state[t]!==e)&&(this.state[t]=e,this.attached)){n&&(this.forceEffects=!0);const e=p();e.noDefering?await this.onStateChange():setTimeout(()=>this.onStateChange(),e.deferTimeout)}}).bind(this)]}useEffect(t,n){t=t.bind(this);const o=this.generateId(),r=this.getCacher(n),i={cache:r(),cacher:r,type:e.EffectType.BEFORE};this.effectsState.set(o,i);const a=(async()=>{const e=r();if(this.forceEffects||!n||this.mountingEffects||this.dependenciesChanged(e,i.cache)){const n=await t({previous:i.cache,current:e,initial:this.mountingEffects});return i.cache=e,n}}).bind(this);i.effect=a}useEffectAfter(t,n){t=t.bind(this);const o=this.generateId(),r=this.getCacher(n),i={cache:r(),cacher:r,type:e.EffectType.AFTER};this.effectsState.set(o,i);const a=(async()=>{const e=r();if(this.forceEffects||!n||this.mountingAfterEffects||this.dependenciesChanged(e,i.cache)){const n=await t({previous:i.cache,current:e,initial:this.mountingEffects});return i.cache=e,n}}).bind(this);i.effect=a}useProps(t){t=t.bind(this);const n=this.generateId(),o=this.getCacher(()=>this.props),r={cache:o(),cacher:o,type:e.EffectType.BEFORE};this.effectsState.set(n,r);const i=(async()=>{const e=o();if(this.forceEffects||this.mountingEffects||this.dependenciesChanged(e,r.cache)){const n=await t({previous:r.cache,current:e,initial:this.mountingEffects});return r.cache=e,n}}).bind(this);r.effect=i}useReducer(e,t,n){if(e=e.bind(this),!n)throw ge;const[o,r]=this.useState(t,n);this.state[n]=o;const i=(async(t,o)=>{let i;i="function"==typeof t?await e(this.state[n],await t(this.state[n])):await e(this.state[n],t),await r(i,o)}).bind(this);return[this.state[n],i]}useMemo(t,n,o){