UNPKG

reblendjs

Version:

ReblendJs uses Reactjs pradigm to build UI components, with isolated state for each components.

1 lines 68.6 kB
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});class e extends Error{constructor(e){super(e??"Null object not accepted")}}class t{static instance;static getInstance(){return new t}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(t.instance)return t.instance;t.instance=this}update(e){return e&&Object.assign(this.configs,e),this.configs}reset(){this.configs=this.defaultConfigs}}function n(e,t){const o=[...t];if(o.length<=0||!e)return e;const r=o.shift();return r?n(e[r],o):e}const o=e=>e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`).substring(1),r=e=>{let t="";for(const[n,o]of Object.entries(e))t+=`${n}: ${void 0===o?"initial":o}; \n`;return t.trim()},i=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 a(e){return e.charAt(0).toUpperCase()+e.slice(1)}const s=(e=1234,t=9876)=>Math.floor(Math.random()*(t-e+1))+e,c=e=>{if("function"!=typeof e)return!1;try{if(Function.prototype.toString.call(e).startsWith("class"))return!1}catch(e){return!1}return!0},l=(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},d=()=>t.getInstance().configs,p=()=>d().noDefering,u="reblendcomponent",h="reblendwrapperforreactcomponent",f="reblendchildrenwrapperforreactcomponent";var m=Object.freeze({__proto__:null,CUSTOM_TAGNAME:"customTagName",REBLEND_CHILDREN_WRAPPER_FOR_REACT_COMPONENT:f,REBLEND_COMPONENT:u,REBLEND_WRAPPER_FOR_REACT_COMPONENT:h,appendChildren:(t,...n)=>{if(!t)throw new e;for(const e of n)t.appendChild(e);return t},capitalize:a,cssObjectFromString:i,cssString:r,donotDeffer:p,escapeRegExp:function(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")},getConfig:d,getDefinedValuesFrom:function(e){const t={};for(const n in e){const o=e[n];null!=o&&null!=o&&(t[n]=o)}return t},getObjectField:n,isCallable:c,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:s,registerElement:function(e,t){if(!t)throw new Error("Element to register is null");const n=o(e);if(!customElements.get(n))try{customElements.define(n,t)}catch(e){console.warn(e.message)}return t},removeLastChild:t=>{if(!t)throw new e;return t.removeChild(t.lastChild)},replaceOrAddItemToList:l,shallowRemoveDuplicates:e=>{const t=new Set,n=e?.filter(e=>!(!e||t.has(e))&&(t.add(e),!0));return n},snakeCase:o,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 o=0;for(const r of e){let e=n(r,t);e&&("string"==typeof e&&(e=parseInt(e)),"number"==typeof e&&(o+=e))}return o}});class y{static instance;elementStyles={[`[${u}], [${h}], [${f}]`]:{display:"contents !important"}};styleElement;constructor(){if(y.instance)return y.instance;this.init(),y.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?i(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} {${r(n)}}\n\n`);this.styleElement.textContent=e.join("")}}const g={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"},E=["value","checked","selected","disabled"],b=e=>{if(!e)return!1;if(e.includes("aria-")||e.includes(":")||e.includes("data-"))return!0;const t=g[e];return!(!t||t instanceof Object||t.startsWith("on")||E.includes(e))},C=e=>{const t=g[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 S,w,R;exports.ChildrenPropsUpdateType=void 0,(S=exports.ChildrenPropsUpdateType||(exports.ChildrenPropsUpdateType={}))[S.NON_CHILDREN=0]="NON_CHILDREN",S[S.CHILDREN=1]="CHILDREN",exports.PatchTypeAndOrder=void 0,(w=exports.PatchTypeAndOrder||(exports.PatchTypeAndOrder={}))[w.NONE=0]="NONE",w[w.REMOVE=1]="REMOVE",w[w.TEXT=2]="TEXT",w[w.CREATE=3]="CREATE",w[w.REPLACE=4]="REPLACE",w[w.UPDATE=5]="UPDATE",exports.EffectType=void 0,(R=exports.EffectType||(exports.EffectType={})).BEFORE="BEFORE",R.AFTER="AFTER";const v="ReblendPrimitive",A={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 T;function O(e,t){const n=A[e];return!(!t||!n)&&(t[n]=!0,t[n])}function N(e){return e&&"object"==typeof e&&e[A.ReblendNode]}function k(e){return e&&"object"==typeof e&&e[A.ReblendVNode]}function P(e){return e&&"object"==typeof e&&e[A.ReblendLazyVNode]}function x(e){return e&&"object"==typeof e&&e[A.ReblendNodeStandard]}function _(e){return e&&"object"==typeof e&&e[A.ReblendVNodeStandard]}function M(e){return e&&"object"==typeof e&&e[A.ReactToReblendNode]}function L(e){return e&&"object"==typeof e&&e[A.ReactToReblendVNode]}function D(e){return e&&"object"==typeof e&&e[A.ReblendVNodeStandard]}function I(e){return!j(e)&&e.displayName===v}function j(e){const t=typeof e;return["string","number","boolean","bigint","null","undefined","symbol"].some(n=>n===(null===e?"null":t))}function z(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 F(e){return e&&"object"==typeof e&&e instanceof Promise}function U(e){return!!e&&(x(e)||I(e))}function V(e){return e?.nodeType===Node.TEXT_NODE}function H(e){return null==e}function G(e,t){const n=Object.getPrototypeOf(t);n&&n!==Object.prototype&&G(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 q(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(...q(n)):t.push(n);return t}function W(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)?W(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"}(T||(T={}));const B={ReblendPlaceholder:!0,defaultReblendPlaceholderStyle:!0};function K(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 Y(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 Y(n,t);else if(!j(n)&&"construct"in n&&"mountOn"in n&&"createInnerHtmlElements"in n.prototype)await Y(ge.construct(n,{}),t);else{if(!(c(n)||n instanceof Ee||n instanceof Node||j(n)||L(n)||F(n)||P(n)||k(n)||D(n)))throw new TypeError("Invalid child node in children");{const e=q(await X(n));e&&t.push(...e)}}return t}async function X(e){if(e instanceof Ee||e instanceof Node)return e.displayName||(e.displayName=a(e.tagName),G(e,Ee.prototype),O(T.ReblendNodeStandard,e),e._constructor()),[e];if(Array.isArray(e))return await Y(e);if(j(e))return[$()?.setData(e)];if(c(e)&&(e=e({})),j(e))return[$()?.setData(e)];if(e instanceof Promise)return await Y(ge.construct(e,{}));const t=e;if("construct"in t&&"mountOn"in t&&"createInnerHtmlElements"in t.prototype)return await Y(ge.construct(t,{}));let{displayName:n}=e;const o=e&&e.props&&e.props.reactcomponent;if(!o&&c(n)&&(n=await n(e.props)),"string"!=typeof n&&j(n))return[$()?.setData(n)];const r=n;if(n instanceof Ee||n instanceof Node)return r.displayName||(r.displayName=a(r.tagName),G(r,Ee.prototype),O(T.ReblendNodeStandard,r),r._constructor()),e?.props&&(r.props||(r.props={}),r.props={...r.props,...e.props}),[r];if(_(r)||k(r)||L(r)||L(r)||P(r))return e?.props&&(r.props||(r.props={}),r.props={...r.props,...e.props}),await X(r);let i=n;const s="string"==typeof n,l=o||z(n),p=F(e)||F(n);let f;if(f=p?T.ReblendLazyNode:s?n:z(i)?i.displayName||i.name||"ReactComponent":"Fragment"===i?.ELEMENT_NAME?i.name:i?.ELEMENT_NAME||"Anonymous",!s&&!p&&!l){if("Reblend"===n?.ELEMENT_NAME&&"Reblend"===n?.name)return[...n?.children||[]];i.ELEMENT_NAME=f}l&&(i=fe,i.ELEMENT_NAME=a(`${n.displayName}`));const m=["svg","path","circle","rect","line","text","use","g","defs","clipPath","polygon","polyline","image","symbol"].includes(y=s?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=p?T.ReblendLazyNode:l?T.ReactToReblendNode:s?T.ReblendNodeStandard:T.ReblendNode,O(g,m),m.displayName=f,s||l)G(m,Ee.prototype);else{const t=p?e?.config:i.config;G(m,p?Ee.prototype:i.prototype),t&&Object.entries(t).forEach(([e,t])=>{B[e]?m[e]=t:console.warn(`Unsupported key \`${e}\` found in component configuration.`)})}if(p&&(m.initState=(async()=>await(n||e)).bind(m)),l&&(m.ReactClass=n,G(m,fe.prototype)),m._constructor(),!s){const e=process.env.REBLEND_ENVIRONEMENT_PRODUCTION;l?m.setAttribute(h,e?"":f):m.setAttribute(u,e?"":f)}if(s&&"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||U(m)||l)await J(e.props,m,!0),await m.populateHtmlElements();else{const t=async()=>{const t=await J(p?{}:e.props,m,!0);void 0!==t&&(m.html=async()=>ge.construct(t,p?e.props:{})),m.awaitingInitState&&(m.awaitingInitState=!1,se(m))},n=d();n.noDefering?await t():p?(m.initStateRunning=!0,setTimeout(()=>{t()},n.lazyComponentDeferTimeout)):t()}return[m]}function $(){const e=document.createTextNode("");return G(e,Ee.prototype),e.displayName=v,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 Z(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 J(e,t,n){if(!t)return;if(n&&t.initProps?await t.initProps(e):t.props={...t.props||{},...e||{}},x(t))for(const n in e){const o=C(n),r=e[n];if("dangerouslySetInnerHTML"==n)t.innerHTML=r?.__html;else if(n.startsWith("on"))t[o]=Z(t,r);else if("style"===o)t.addStyle(r);else{if("children"===o||null==r)continue;const e=b(o);try{e?K(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 Q(e,t){if(e&&t){t.props={...t.props,...e};for(const n in e){const o=C(n),r=b(n);try{r?(t.removeAttribute(o),delete t?.props[o]):(t[o]=e[n],delete t[o])}catch{}}}}function ee(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var te,ne={};var oe=function(){if(te)return ne;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 te=1,Object.defineProperty(ne,"__esModule",{value:!0}),ne.deepEqualIterative=t,ne.default=t,ne}(),re=ee(oe);async function ie(e){j(e)||(e.disconnectedCallback?p()?await e.disconnectedCallback():e.disconnectedCallback():(e.parentElement&&(e.outerHTML=""),e.innerHTML="",e?.remove()))}async function ae(e){if(!j(e))for(const t of new Set([...e.childNodes,...e.elementChildren?.values()||[]]))p()?await ie(t):ie(t)}async function se(e){e&&e.connectedCallback&&await e.connectedCallback()}async function ce(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=l(t.directParent.elementChildren,n,r)),o.appendChild(r),p()?await se(r):se(r),n=r;t.after(o),t.remove(),t.directParent?.elementChildren?.delete(t)}function le(e,t,n){const o=[];return!j(t)&&Object.hasOwn(t,"reblendPrimitiveData")&&t.reblendPrimitiveData==n?[]:(t?n||o.push({type:exports.PatchTypeAndOrder.REMOVE,parent:e,oldNode:t}):o.push({type:exports.PatchTypeAndOrder.CREATE,parent:e,newNode:n}),o)}async function de(e,t,n,o,r){const i=[];if(!e.renderingSessionTracker.isCurrentSession(t))return i;if(c(r)&&(r=await r()),c(r))return i.push({type:exports.PatchTypeAndOrder.REPLACE,parent:n,newNode:r,oldNode:o}),i;if(j(o)&&j(r))i.push({type:exports.PatchTypeAndOrder.CREATE,parent:n,newNode:r});else if(j(o)&&!j(r))i.push({type:exports.PatchTypeAndOrder.CREATE,parent:n,newNode:r});else if(I(o)&&j(r))o.getData()!==r&&o.setData(r);else if(I(o)&&!j(r))i.push({type:exports.PatchTypeAndOrder.REPLACE,parent:n,newNode:r,oldNode:o});else if(V(o)&&j(r))o.textContent!==r&&i.push({type:exports.PatchTypeAndOrder.TEXT,newNode:r,oldNode:o});else if(V(o)&&!j(r))i.push({type:exports.PatchTypeAndOrder.REPLACE,parent:n,newNode:r,oldNode:o});else if(!I(o)&&j(r))i.push({type:exports.PatchTypeAndOrder.REPLACE,parent:n,newNode:r,oldNode:o});else if(H(o)&&!H(r))i.push({type:exports.PatchTypeAndOrder.CREATE,parent:n,newNode:r});else if(!H(o)&&H(r))i.push({type:exports.PatchTypeAndOrder.REMOVE,parent:n,oldNode:o});else if(o?.props?.key!==r?.props?.key)i.push({type:exports.PatchTypeAndOrder.REPLACE,parent:n,newNode:r,oldNode:o});else if("displayName"in o&&"displayName"in r){const a=o.displayName.toLowerCase();let s="";const l=r?.props?.reactcomponent;if(!l&&c(r.displayName)&&(r.displayName=await r.displayName()),j(r.displayName)?s=r.displayName:r.displayName.ELEMENT_NAME?s=r.displayName.ELEMENT_NAME:r.displayName.displayName?s=r.displayName.displayName:r.displayName.name?s=r.displayName.name:r.displayName&&(s=r.displayName),s="string"==typeof s?s?.toLowerCase():"",!l&&c(r.displayName)||a&&s&&a!==s)i.push({type:exports.PatchTypeAndOrder.REPLACE,parent:n,newNode:r,oldNode:o});else{const n=function(e,t){const n=["key","children","ref"],o=[],r=t?.props||{},i={};t.initProps.call(i,e?.props||{});const a=i.props||{},s=N(t),c=d().diffConfig||void 0;for(const e in a)if(!n.includes(e)||"children"===e&&s){let n=r[e],i=a[e];(!re(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}(r,o);if(n&&n.length>0&&i.push({type:exports.PatchTypeAndOrder.UPDATE,patches:n}),!e.renderingSessionTracker.isCurrentSession(t))return i;o.childrenInitialize&&i.push(...await async function(e,t,n,o,r){if(!U(o)&&!M(o))return[];const i=[...o.elementChildren?.values()||[]],a=q(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(...le(n,r,c)):s.push(...await de(e,t,n,r,c))}o?.props&&(o.props.children=a);return s}(e,t,o,o,r))}}return i}async function pe(e){const t=Array.isArray(e)?e.flat():e||[],n=new Map,o=new Map,r=new Set,i=new Set,a=d();t.forEach(({type:e,node:t,key:a,propValue:s})=>{"UPDATE"===e?(n.has(t)||n.set(t,{}),n.get(t)[a]=s):"REMOVE"===e&&(o.has(t)||o.set(t,new Set),o.get(t).add(a)),M(t)?("children"===a?t.childrenPropsUpdate?.add(exports.ChildrenPropsUpdateType.CHILDREN):t.childrenPropsUpdate?.add(exports.ChildrenPropsUpdateType.NON_CHILDREN),r.add(t)):N(t)&&t.attached&&i.add(t)});for(const[e,t]of n.entries())J(t,e,!1);for(const[e,t]of o.entries()){const n={};for(const e of t)n[e]=void 0;Q(n,e)}for(const e of r)e?.checkPropsChange();if(i.size>0)if(a.noDefering)for(const e of i)await e.onStateChange();else setTimeout(()=>{for(const e of i)e.onStateChange()},a.deferTimeout)}async function ue(e,t,n){n&&(e.directParent?.elementChildren?.delete(e),e.remove()),p()?(await t(),await ie(e)):t().then(()=>requestIdleCallback(()=>{ie(e)}))}function he(e){e.ref&&("function"==typeof e.ref?e.ref(null):e.ref.current&&(e.ref.current=null))}class fe{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=M(e),o=N(e),r=I(e),i=n||o?"div":r?"span":e.displayName;return t.createElement(i,{[f]:e.displayName||"",...void 0!==e.props?.value?{value:e.props.value}:{},ref:async t=>{t?t.contains(e)||(t.appendChild(e),e.attached||se(e)):e.remove()}},null)});return n?.length&&n.length<2?n.pop():n}html(){return this.props.children}async checkPropsChange(){for(const e of Array.from(this.childrenPropsUpdate||[]).sort())switch(this.childrenPropsUpdate?.delete(e),e){case exports.ChildrenPropsUpdateType.CHILDREN:await this.onStateChange();break;case exports.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 fe.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 me{cycles=[];generateId(){const e=s(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 ye=new Error("State Identifier/Key not specified");class ge{static ELEMENT_NAME="BaseComponent";static props;static config;static async wrapChildrenToReact(e){const t=await X(e);return await fe.getChildrenWrapperForReact(t)}static reactCompact(e,t){return ge.construct(e,{...t||{},reactcomponent:!0})}static construct(e,t,...n){if(Array.isArray(e))return e;if(_(e)||k(e)||L(e)||L(e)||P(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(N(e)||x(e)||M(e)||(o=e)&&"object"==typeof o&&o[A.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(F(e)){const o={displayName:e,props:{...t}};return(t?.children||n.length)&&(o.props.children=[...e?.props?.children||[],...t?.children||[],...n||[]]),O(T.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?T.ReblendVNodeStandard:z(r)?T.ReactToReblendVNode:F(r)?T.ReblendLazyVNode:T.ReblendVNode,O(c,s),s}static async renderToString(e,t){const n=(await X(ge.construct("div",{},ge.construct(e,t||{})))).pop();await se(n);return n.innerHTML}static async mountOn(e,n,o){let r="string"==typeof e?document.getElementById(e):e;if(!r)throw new Error("Invalid root or root id");if(r=(await X(r)).pop(),!r)throw new Error("Invalid root or root id");let i=r.style.display||"initial";new y;const a=t.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),se(n),await new Promise(e=>requestAnimationFrame(e))},c=o?.preloader;let l=c?ge.construct(c,{}):ge.construct((await Promise.resolve().then(function(){return Re})).Preloader,{}),d=await Y(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=>{ie(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=()=>n,r.attached?await r.onStateChange():(r.isRootComponent=!0,await r.populateHtmlElements(),await se(r)),s&&s(),r.elementChildren||new Set}static createRef(e){return ge.prototype.useRef.call(null,...arguments)}async createInnerHtmlElements(){let e=await this.html();c(e)&&(e=e(this.props)),Array.isArray(e)||(e=[e]),e=W(e);return await Y(e)}async populateHtmlElements(){if(this.hasDisconnected)return[];const e=d();let t=[];try{const n=M(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 se(n):se(n);this.isPlaceholder&&this.directParent?.awaitingInitState&&!this.directParent?.initStateRunning&&(e.noDefering?(await se(this.directParent),this.directParent.awaitingInitState=!1):setTimeout(()=>{se(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?ge.construct(this.ReblendPlaceholder,{}):this.ReblendPlaceholder;const t=await X(e);if(!this.childrenInitialize){if(this.placeholderAttached)return;this.placeholderAttached=!0,t.forEach(e=>{if(!this.initStateRunning)return requestIdleCallback(()=>ie(e));e.directParent=this,e.isPlaceholder=!0,this.appendChild(e),se(e)}),this.initStateRunning&&(this.removePlaceholder=async()=>{t.forEach(e=>ie(e)),this.removePlaceholder=void 0})}}else{const e=d(),t=ge.construct(e.placeholder||(await Promise.resolve().then(function(){return Se})).Placeholder,{style:this.defaultReblendPlaceholderStyle}),n=await X(t);if(!this.childrenInitialize){if(this.placeholderAttached)return;this.placeholderAttached=!0,n.forEach(e=>{if(!this.initStateRunning)return requestIdleCallback(()=>ie(e));e.directParent=this,e.isPlaceholder=!0,this.appendChild(e),se(e)}),this.initStateRunning&&(this.removePlaceholder=async()=>{n.forEach(e=>ie(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(U(this)&&!this.isRootComponent)return;if(this.mountingEffects||this.initStateRunning)return void(this.awaitingReRender=!0);const e=this.renderingSessionTracker.startSession();if(this.renderingSessionTracker.hasPreviousSession())return;const t=d(),n=async()=>{this.renderingSessionTracker.resetSession(),t.noDefering?await this.onStateChange():this.onStateChange()},o=[];let r;try{if(this.stateEffectRunning=!0,await this.applyEffects(e,exports.EffectType.BEFORE),this.stateEffectRunning=!1,!this.renderingSessionTracker.isCurrentSession(e))return await n();if(this.forceEffects=!1,this.childrenInitialize){r=await this.html(),c(r)&&(r=r(this.props)),Array.isArray(r)||(r=[r]),r=W(r);const t=[...this.elementChildren?.values()||[]],i=Math.max(t.length||0,r.length);for(let a=0;a<i;a++){const i=r[a],s=t[a];if(!this.renderingSessionTracker.isCurrentSession(e))return await n();if(o.push(...await de(this,e,this,s,i)),!this.renderingSessionTracker.isCurrentSession(e))return await n()}}else this.awaitingReRender=!0}catch(e){this.handleError(e)}return this.renderingSessionTracker.isCurrentSession(e)?(await async function(e){const t=new Set;e=Array.from(e||[]);const n=d(),o=new Map,r=[],i=[],a=[],s=[];for(const c of e)switch(c.type){case exports.PatchTypeAndOrder.CREATE:{if(!c.parent)break;const e=await X(c.newNode);if(!e.length)break;if(e.forEach(e=>e.directParent=c.parent),c.parent.elementChildren)for(const t of e)c.parent.elementChildren.add(t);else c.parent.elementChildren=new Set(e);if(M(c.parent))t.add(c.parent);else{let t=o.get(c.parent);t||(t=document.createDocumentFragment(),o.set(c.parent,t));for(const o of e)t.appendChild(o),a.push(async()=>{n.noDefering?await se(o):se(o)})}break}case exports.PatchTypeAndOrder.REMOVE:c.oldNode&&(he(c.oldNode),r.push(c.oldNode));break;case exports.PatchTypeAndOrder.REPLACE:if(c.oldNode){he(c.oldNode);const e=await X(c.newNode);e.forEach(e=>e.directParent=c.oldNode?.directParent),i.push({oldNode:c.oldNode,newNodeElements:e})}break;case exports.PatchTypeAndOrder.TEXT:c.oldNode&&(c.oldNode.textContent=c.newNode);break;case exports.PatchTypeAndOrder.UPDATE:c.patches&&s.push(c.patches)}s.length>0&&(n.noDefering?await pe(s):pe(s));for(const[e,t]of o.entries())e.appendChild(t);for(const e of r)await ue(e,async()=>{},!0);for(const{oldNode:e,newNodeElements:t}of i)await ue(e,async()=>{for(const n of t)n.directParent=e.directParent;p()?await ce(t,e):ce(t,e)});for(const e of a)await e();for(const e of t)M(e)&&(n.noDefering?e.reactReblendMount&&await e.reactReblendMount():setTimeout(()=>{e.reactReblendMount&&e.reactReblendMount()},n.deferTimeout))}(o),this.renderingSessionTracker.isCurrentSession(e)?(await this.applyEffects(e,exports.EffectType.AFTER),this.renderingSessionTracker.isCurrentSession(e)?(r=null,void this.renderingSessionTracker.resetSession()):await n()):await n()):await n()}async html(){return null}async mountEffects(){this.stateEffectRunning=!0,I(this)||(this.mountingEffects=!0,await this.applyEffects(0,exports.EffectType.BEFORE),this.mountingEffects=!1),this.stateEffectRunning=!1,"Placeholder"===this.displayName||this.props?.isPlaceholder||this.isPlaceholder||U(this)||M(this)||(await this.populateHtmlElements(),this.mountingAfterEffects=!0,await this.applyEffects(0,exports.EffectType.AFTER),this.mountingAfterEffects=!1)}async disconnectedCallback(e=!1){await async function(e,t=!1){if(e.hasDisconnected)return;const n=d();if(!t&&await e.cleanUp(),e.componentWillUnmount&&await e.componentWillUnmount(),!I(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 ae(e):ae(e);for(const t of e.elementChildren?.values()||[])n.noDefering?await ie(t):ie(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!re(e,t,d().diffConfig||{})}generateId(){const e=s(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 ye;"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=d();e.noDefering?await this.onStateChange():setTimeout(()=>this.onStateChange(),e.deferTimeout)}}).bind(this)]}useEffect(e,t){e=e.bind(this);const n=this.generateId(),o=this.getCacher(t),r={cache:o(),cacher:o,type:exports.EffectType.BEFORE};this.effectsState.set(n,r);const i=(async()=>{const n=o();if(this.forceEffects||!t||this.mountingEffects||this.dependenciesChanged(n,r.cache)){const t=await e({previous:r.cache,current:n,initial:this.mountingEffects});return r.cache=n,t}}).bind(this);r.effect=i}useEffectAfter(e,t){e=e.bind(this);const n=this.generateId(),o=this.getCacher(t),r={cache:o(),cacher:o,type:exports.EffectType.AFTER};this.effectsState.set(n,r);const i=(async()=>{const n=o();if(this.forceEffects||!t||this.mountingAfterEffects||this.dependenciesChanged(n,r.cache)){const t=await e({previous:r.cache,current:n,initial:this.mountingEffects});return r.cache=n,t}}).bind(this);r.effect=i}useProps(e){e=e.bind(this);const t=this.generateId(),n=this.getCacher(()=>this.props),o={cache:n(),cacher:n,type:exports.EffectType.BEFORE};this.effectsState.set(t,o);const r=(async()=>{const t=n();if(this.forceEffects||this.mountingEffects||this.dependenciesChanged(t,o.cache)){const n=await e({previous:o.cache,current:t,initial:this.mountingEffects});return o.cache=t,n}}).bind(this);o.effect=r}useReducer(e,t,n){if(e=e.bind(this),!n)throw ye;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),awa