@lodado/sdui-template 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/client/index.cjs +1 -1
- package/dist/es/client/src/__tests__/utils/dev-utils.mjs +1 -1
- package/dist/es/client/src/react-wrapper/components/SduiLayoutRenderer.mjs +1 -1
- package/dist/es/client/src/react-wrapper/components/SduiLayoutRendererInner.mjs +2 -0
- package/dist/types/src/react-wrapper/components/SduiLayoutRenderer.d.ts +1 -12
- package/dist/types/src/react-wrapper/components/SduiLayoutRendererInner.d.ts +14 -0
- package/dist/types/src/react-wrapper/components/index.d.ts +2 -1
- package/package.json +3 -3
- package/src/__tests__/utils/dev-utils.tsx +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("react/jsx-runtime"),t=require("react"),n=require("react-dom/test-utils"),r=require("react-dom"),o=require("react-dom/client"),i=require("pretty-format"),a=require("aria-query"),s=require("lz-string"),l=require("lodash-es"),u=require("normalizr");function c(e){var t=Object.create(null);return e&&Object.keys(e).forEach(function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,Object.freeze(t)}var d=c(t),b=c(n),p=c(o),f=c(i),h=Object.prototype.toString;var y=Math.pow(2,53)-1;function m(e){var t=function(e){var t=Number(e);return isNaN(t)?0:0!==t&&isFinite(t)?(t>0?1:-1)*Math.floor(Math.abs(t)):t}(e);return Math.min(Math.max(t,0),y)}function v(e,t){var n=Array,r=Object(e);if(null==e)throw new TypeError("Array.from requires an array-like object - not null or undefined");for(var o,i,a=m(r.length),s="function"==typeof(o=n)||"[object Function]"===h.call(o)?Object(new n(a)):new Array(a),l=0;l<a;)i=r[l],s[l]=i,l+=1;return s.length=a,s}function g(e){return g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},g(e)}function E(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,w(r.key),r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function w(e){var t=function(e,t){if("object"!==g(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t);if("object"!==g(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===g(t)?t:String(t)}var T="undefined"==typeof Set?Set:function(){function e(){var t,n,r,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),t=this,r=void 0,(n=w(n="items"))in t?Object.defineProperty(t,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[n]=r,this.items=o}return E(e,[{key:"add",value:function(e){return!1===this.has(e)&&this.items.push(e),this}},{key:"clear",value:function(){this.items=[]}},{key:"delete",value:function(e){var t=this.items.length;return this.items=this.items.filter(function(t){return t!==e}),t!==this.items.length}},{key:"forEach",value:function(e){var t=this;this.items.forEach(function(n){e(n,n,t)})}},{key:"has",value:function(e){return-1!==this.items.indexOf(e)}},{key:"size",get:function(){return this.items.length}}]),e}();function I(e){var t;return null!==(t=e.localName)&&void 0!==t?t:e.tagName.toLowerCase()}var S={article:"article",aside:"complementary",button:"button",datalist:"listbox",dd:"definition",details:"group",dialog:"dialog",dt:"term",fieldset:"group",figure:"figure",form:"form",footer:"contentinfo",h1:"heading",h2:"heading",h3:"heading",h4:"heading",h5:"heading",h6:"heading",header:"banner",hr:"separator",html:"document",legend:"legend",li:"listitem",math:"math",main:"main",menu:"list",nav:"navigation",ol:"list",optgroup:"group",option:"option",output:"status",progress:"progressbar",section:"region",summary:"button",table:"table",tbody:"rowgroup",textarea:"textbox",tfoot:"rowgroup",td:"cell",th:"columnheader",thead:"rowgroup",tr:"row",ul:"list"},A={caption:new Set(["aria-label","aria-labelledby"]),code:new Set(["aria-label","aria-labelledby"]),deletion:new Set(["aria-label","aria-labelledby"]),emphasis:new Set(["aria-label","aria-labelledby"]),generic:new Set(["aria-label","aria-labelledby","aria-roledescription"]),insertion:new Set(["aria-label","aria-labelledby"]),paragraph:new Set(["aria-label","aria-labelledby"]),presentation:new Set(["aria-label","aria-labelledby"]),strong:new Set(["aria-label","aria-labelledby"]),subscript:new Set(["aria-label","aria-labelledby"]),superscript:new Set(["aria-label","aria-labelledby"])};function _(e,t){return function(e,t){return["aria-atomic","aria-busy","aria-controls","aria-current","aria-describedby","aria-details","aria-dropeffect","aria-flowto","aria-grabbed","aria-hidden","aria-keyshortcuts","aria-label","aria-labelledby","aria-live","aria-owns","aria-relevant","aria-roledescription"].some(function(n){var r;return e.hasAttribute(n)&&!(null!==(r=A[t])&&void 0!==r&&r.has(n))})}(e,t)}function O(e){var t=function(e){var t=e.getAttribute("role");if(null!==t){var n=t.trim().split(" ")[0];if(n.length>0)return n}return null}(e);if(null===t||"presentation"===t){var n=function(e){var t=S[I(e)];if(void 0!==t)return t;switch(I(e)){case"a":case"area":case"link":if(e.hasAttribute("href"))return"link";break;case"img":return""!==e.getAttribute("alt")||_(e,"img")?"img":"presentation";case"input":var n=e.type;switch(n){case"button":case"image":case"reset":case"submit":return"button";case"checkbox":case"radio":return n;case"range":return"slider";case"email":case"tel":case"text":case"url":return e.hasAttribute("list")?"combobox":"textbox";case"search":return e.hasAttribute("list")?"combobox":"searchbox";case"number":return"spinbutton";default:return null}case"select":return e.hasAttribute("multiple")||e.size>1?"listbox":"combobox"}return null}(e);if("presentation"!==t||_(e,n||""))return n}return t}function x(e){return null!==e&&e.nodeType===e.ELEMENT_NODE}function j(e){return x(e)&&"caption"===I(e)}function N(e){return x(e)&&"input"===I(e)}function M(e){return x(e)&&"legend"===I(e)}function C(e){return function(e){return x(e)&&void 0!==e.ownerSVGElement}(e)&&"title"===I(e)}function D(e,t){if(x(e)&&e.hasAttribute(t)){var n=e.getAttribute(t).split(" "),r=e.getRootNode?e.getRootNode():e.ownerDocument;return n.map(function(e){return r.getElementById(e)}).filter(function(e){return null!==e})}return[]}function k(e,t){return!!x(e)&&-1!==t.indexOf(O(e))}function P(e,t){if(!x(e))return!1;if("range"===t)return k(e,["meter","progressbar","scrollbar","slider","spinbutton"]);throw new TypeError("No knowledge about abstract role '".concat(t,"'. This is likely a bug :("))}function B(e,t){var n=v(e.querySelectorAll(t));return D(e,"aria-owns").forEach(function(e){n.push.apply(n,v(e.querySelectorAll(t)))}),n}function L(e){return x(t=e)&&"select"===I(t)?e.selectedOptions||B(e,"[selected]"):B(e,'[aria-selected="true"]');var t}function R(e){return N(e)||x(t=e)&&"textarea"===I(t)?e.value:e.textContent||"";var t}function q(e){var t=e.getPropertyValue("content");return/^["'].*["']$/.test(t)?t.slice(1,-1):""}function V(e){var t=I(e);return"button"===t||"input"===t&&"hidden"!==e.getAttribute("type")||"meter"===t||"output"===t||"progress"===t||"select"===t||"textarea"===t}function F(e){if(V(e))return e;var t=null;return e.childNodes.forEach(function(e){if(null===t&&x(e)){var n=F(e);null!==n&&(t=n)}}),t}function W(e){if(void 0!==e.control)return e.control;var t=e.getAttribute("for");return null!==t?e.ownerDocument.getElementById(t):F(e)}function z(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=new T,r=function(e){var t=(null===e.ownerDocument?e:e.ownerDocument).defaultView;if(null===t)throw new TypeError("no window available");return t}(e),o=t.compute,i=void 0===o?"name":o,a=t.computedStyleSupportsPseudoElements,s=void 0===a?void 0!==t.getComputedStyle:a,l=t.getComputedStyle,u=void 0===l?r.getComputedStyle.bind(r):l,c=t.hidden,d=void 0!==c&&c;function b(e,t){var n,r,o="";if(x(e)&&s){var i=q(u(e,"::before"));o="".concat(i," ").concat(o)}if((function(e){return x(e)&&"slot"===I(e)}(e)?0===(r=(n=e).assignedNodes()).length?v(n.childNodes):r:v(e.childNodes).concat(D(e,"aria-owns"))).forEach(function(e){var n=h(e,{isEmbeddedInLabel:t.isEmbeddedInLabel,isReferenced:!1,recursion:!0}),r="inline"!==(x(e)?u(e).getPropertyValue("display"):"inline")?" ":"";o+="".concat(r).concat(n).concat(r)}),x(e)&&s){var a=q(u(e,"::after"));o="".concat(o," ").concat(a)}return o.trim()}function p(e,t){var r=e.getAttributeNode(t);return null===r||n.has(r)||""===r.value.trim()?null:(n.add(r),r.value)}function f(e){if(!x(e))return null;if(function(e){return x(e)&&"fieldset"===I(e)}(e)){n.add(e);for(var t=v(e.childNodes),r=0;r<t.length;r+=1){var o=t[r];if(M(o))return h(o,{isEmbeddedInLabel:!1,isReferenced:!1,recursion:!1})}}else if(function(e){return x(e)&&"table"===I(e)}(e)){n.add(e);for(var i=v(e.childNodes),a=0;a<i.length;a+=1){var s=i[a];if(j(s))return h(s,{isEmbeddedInLabel:!1,isReferenced:!1,recursion:!1})}}else{if(function(e){return x(e)&&"svg"===I(e)}(e)){n.add(e);for(var l=v(e.childNodes),u=0;u<l.length;u+=1){var c=l[u];if(C(c))return c.textContent}return null}if("img"===I(e)||"area"===I(e)){var d=p(e,"alt");if(null!==d)return d}else if(function(e){return x(e)&&"optgroup"===I(e)}(e)){var f=p(e,"label");if(null!==f)return f}}if(N(e)&&("button"===e.type||"submit"===e.type||"reset"===e.type)){var y=p(e,"value");if(null!==y)return y;if("submit"===e.type)return"Submit";if("reset"===e.type)return"Reset"}var m,g,E=null===(g=(m=e).labels)?g:void 0!==g?v(g):V(m)?v(m.ownerDocument.querySelectorAll("label")).filter(function(e){return W(e)===m}):null;if(null!==E&&0!==E.length)return n.add(e),v(E).map(function(e){return h(e,{isEmbeddedInLabel:!0,isReferenced:!1,recursion:!0})}).filter(function(e){return e.length>0}).join(" ");if(N(e)&&"image"===e.type){var w=p(e,"alt");if(null!==w)return w;var T=p(e,"title");return null!==T?T:"Submit Query"}if(k(e,["button"])){var S=b(e,{isEmbeddedInLabel:!1});if(""!==S)return S}return null}function h(e,t){if(n.has(e))return"";if(!d&&function(e,t){if(!x(e))return!1;if(e.hasAttribute("hidden")||"true"===e.getAttribute("aria-hidden"))return!0;var n=t(e);return"none"===n.getPropertyValue("display")||"hidden"===n.getPropertyValue("visibility")}(e,u)&&!t.isReferenced)return n.add(e),"";var r=x(e)?e.getAttributeNode("aria-labelledby"):null,o=null===r||n.has(r)?[]:D(e,"aria-labelledby");if("name"===i&&!t.isReferenced&&o.length>0)return n.add(r),o.map(function(e){return h(e,{isEmbeddedInLabel:t.isEmbeddedInLabel,isReferenced:!0,recursion:!1})}).join(" ");var a,s=t.recursion&&(k(a=e,["button","combobox","listbox","textbox"])||P(a,"range"))&&"name"===i;if(!s){var l=(x(e)&&e.getAttribute("aria-label")||"").trim();if(""!==l&&"name"===i)return n.add(e),l;if(!function(e){return k(e,["none","presentation"])}(e)){var c=f(e);if(null!==c)return n.add(e),c}}if(k(e,["menu"]))return n.add(e),"";if(s||t.isEmbeddedInLabel||t.isReferenced){if(k(e,["combobox","listbox"])){n.add(e);var y=L(e);return 0===y.length?N(e)?e.value:"":v(y).map(function(e){return h(e,{isEmbeddedInLabel:t.isEmbeddedInLabel,isReferenced:!1,recursion:!0})}).join(" ")}if(P(e,"range"))return n.add(e),e.hasAttribute("aria-valuetext")?e.getAttribute("aria-valuetext"):e.hasAttribute("aria-valuenow")?e.getAttribute("aria-valuenow"):e.getAttribute("value")||"";if(k(e,["textbox"]))return n.add(e),R(e)}if(function(e){return k(e,["button","cell","checkbox","columnheader","gridcell","heading","label","legend","link","menuitem","menuitemcheckbox","menuitemradio","option","radio","row","rowheader","switch","tab","tooltip","treeitem"])}(e)||x(e)&&t.isReferenced||function(e){return j(e)}(e)){var m=b(e,{isEmbeddedInLabel:t.isEmbeddedInLabel});if(""!==m)return n.add(e),m}if(e.nodeType===e.TEXT_NODE)return n.add(e),e.textContent||"";if(t.recursion)return n.add(e),b(e,{isEmbeddedInLabel:t.isEmbeddedInLabel});var g=function(e){return x(e)?p(e,"title"):null}(e);return null!==g?(n.add(e),g):(n.add(e),"")}return h(e,{isEmbeddedInLabel:!1,isReferenced:"description"===i,recursion:!1}).trim().replace(/\s\s+/g," ")}function U(e){return U="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},U(e)}function H(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function $(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?H(Object(n),!0).forEach(function(t){G(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):H(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function G(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==U(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t);if("object"!==U(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===U(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function K(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=D(e,"aria-describedby").map(function(e){return z(e,$($({},t),{},{compute:"description"}))}).join(" ");if(""===n){var r=e.getAttribute("title");n=null===r?"":r}return n}function X(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return k(e,["caption","code","deletion","emphasis","generic","insertion","paragraph","presentation","strong","subscript","superscript"])?"":z(e,t)}function J(e){return e.replace(/</g,"<").replace(/>/g,">")}const Q=(e,t)=>{const n=t.colors.content;return n.open+J(e)+n.close},Y=/^((HTML|SVG)\w*)?Element$/,Z=e=>{const{tagName:t}=e;return Boolean("string"==typeof t&&t.includes("-")||"function"==typeof e.hasAttribute&&e.hasAttribute("is"))};function ee(e){return 11===e.nodeType}function te(e){return{test:e=>{var t;return((null==e||null==(t=e.constructor)?void 0:t.name)||Z(e))&&(e=>{const t=e.constructor.name,{nodeType:n}=e;return 1===n&&(Y.test(t)||Z(e))||3===n&&"Text"===t||8===n&&"Comment"===t||11===n&&"DocumentFragment"===t})(e)},serialize:(t,n,r,o,i,a)=>{if(function(e){return 3===e.nodeType}(t))return Q(t.data,n);if(function(e){return 8===e.nodeType}(t))return((e,t)=>{const n=t.colors.comment;return n.open+"\x3c!--"+J(e)+"--\x3e"+n.close})(t.data,n);const s=ee(t)?"DocumentFragment":t.tagName.toLowerCase();return++o>n.maxDepth?((e,t)=>{const n=t.colors.tag;return n.open+"<"+e+n.close+" …"+n.open+" />"+n.close})(s,n):((e,t,n,r,o)=>{const i=r.colors.tag;return i.open+"<"+e+(t&&i.close+t+r.spacingOuter+o+i.open)+(n?">"+i.close+n+r.spacingOuter+o+i.open+"</"+e:(t&&!r.min?"":" ")+"/")+">"+i.close})(s,((e,t,n,r,o,i,a)=>{const s=r+n.indent,l=n.colors;return e.map(e=>{const u=t[e];let c=a(u,n,s,o,i);return"string"!=typeof u&&(-1!==c.indexOf("\n")&&(c=n.spacingOuter+s+c+n.spacingOuter+r),c="{"+c+"}"),n.spacingInner+r+l.prop.open+e+l.prop.close+"="+l.value.open+c+l.value.close}).join("")})(ee(t)?[]:Array.from(t.attributes).map(e=>e.name).sort(),ee(t)?{}:Array.from(t.attributes).reduce((e,t)=>(e[t.name]=t.value,e),{}),n,r+n.indent,o,i,a),((e,t,n,r,o,i)=>e.map(e=>{const a="string"==typeof e?Q(e,t):i(e,t,n,r,o);return""===a&&"object"==typeof e&&null!==e&&3!==e.nodeType?"":t.spacingOuter+n+a}).join(""))(Array.prototype.slice.call(t.childNodes||t.children).filter(e),n,r+n.indent,o,i,a),n,r)}}}let ne=null,re=null,oe=null;try{const e=module&&module.require;re=e.call(module,"fs").readFileSync,oe=e.call(module,"@babel/code-frame").codeFrameColumns,ne=e.call(module,"picocolors")}catch{}function ie(){if(!re||!oe)return"";return function(e){const t=e.indexOf("(")+1,n=e.indexOf(")"),r=e.slice(t,n),o=r.split(":"),[i,a,s]=[o[0],parseInt(o[1],10),parseInt(o[2],10)];let l="";try{l=re(i,"utf-8")}catch{return""}const u=oe(l,{start:{line:a,column:s}},{highlightCode:!0,linesBelow:0});return ne.dim(r)+"\n"+u+"\n"}((new Error).stack.split("\n").slice(1).find(e=>!e.includes("node_modules/")))}function ae(){return"undefined"!=typeof jest&&null!==jest&&(!0===setTimeout._isMockFunction||Object.prototype.hasOwnProperty.call(setTimeout,"clock"))}function se(){if("undefined"==typeof window)throw new Error("Could not find default container");return window.document}function le(e){if(e.defaultView)return e.defaultView;if(e.ownerDocument&&e.ownerDocument.defaultView)return e.ownerDocument.defaultView;if(e.window)return e.window;throw e.ownerDocument&&null===e.ownerDocument.defaultView?new Error("It looks like the window object is not available for the provided node."):e.then instanceof Function?new Error("It looks like you passed a Promise object instead of a DOM node. Did you do something like `fireEvent.click(screen.findBy...` when you meant to use a `getBy` query `fireEvent.click(screen.getBy...`, or await the findBy query `fireEvent.click(await screen.findBy...`?"):Array.isArray(e)?new Error("It looks like you passed an Array instead of a DOM node. Did you do something like `fireEvent.click(screen.getAllBy...` when you meant to use a `getBy` query `fireEvent.click(screen.getBy...`?"):"function"==typeof e.debug&&"function"==typeof e.logTestingPlaygroundURL?new Error("It looks like you passed a `screen` object. Did you do something like `fireEvent.click(screen, ...` when you meant to use a query, e.g. `fireEvent.click(screen.getBy..., `?"):new Error("The given node is not an Element, the node type is: "+typeof e+".")}function ue(e){if(!e||"function"!=typeof e.querySelector||"function"!=typeof e.querySelectorAll)throw new TypeError("Expected container to be an Element, a Document or a DocumentFragment but got "+function(e){if("object"==typeof e)return null===e?"null":e.constructor.name;return typeof e}(e)+".")}const ce=()=>{if("undefined"==typeof process)return!1;let e;try{var t;const n=null==(t=process.env)?void 0:t.COLORS;n&&(e=JSON.parse(n))}catch{}return"boolean"==typeof e?e:void 0!==process.versions&&void 0!==process.versions.node},{DOMCollection:de}=f.plugins;function be(e){return 8!==e.nodeType&&(1!==e.nodeType||!e.matches(ye().defaultIgnore))}function pe(e,t,n){if(void 0===n&&(n={}),e||(e=se().body),"number"!=typeof t&&(t="undefined"!=typeof process&&void 0!==process.env&&process.env.DEBUG_PRINT_LIMIT||7e3),0===t)return"";e.documentElement&&(e=e.documentElement);let r=typeof e;if("object"===r?r=e.constructor.name:e={},!("outerHTML"in e))throw new TypeError("Expected an element or document but got "+r);const{filterNode:o=be,...i}=n,a=f.format(e,{plugins:[te(o),de],printFunctionName:!1,highlight:ce(),...i});return void 0!==t&&e.outerHTML.length>t?a.slice(0,t)+"...":a}const fe=function(){const e=ie();e?console.log(pe(...arguments)+"\n\n"+e):console.log(pe(...arguments))};let he={testIdAttribute:"data-testid",asyncUtilTimeout:1e3,asyncWrapper:e=>e(),unstable_advanceTimersWrapper:e=>e(),eventWrapper:e=>e(),defaultHidden:!1,defaultIgnore:"script, style",showOriginalStackTrace:!1,throwSuggestions:!1,getElementError(e,t){const n=pe(t),r=new Error([e,"Ignored nodes: comments, "+he.defaultIgnore+"\n"+n].filter(Boolean).join("\n\n"));return r.name="TestingLibraryElementError",r},_disableExpensiveErrorDiagnostics:!1,computedStyleSupportsPseudoElements:!1};function ye(){return he}const me=["button","meter","output","progress","select","textarea","input"];function ve(e){return me.includes(e.nodeName.toLowerCase())?"":3===e.nodeType?e.textContent:Array.from(e.childNodes).map(e=>ve(e)).join("")}function ge(e){let t;return t="label"===e.tagName.toLowerCase()?ve(e):e.value||e.textContent,t}function Ee(e){var t;if(void 0!==e.labels)return null!=(t=e.labels)?t:[];if(!function(e){return/BUTTON|METER|OUTPUT|PROGRESS|SELECT|TEXTAREA/.test(e.tagName)||"INPUT"===e.tagName&&"hidden"!==e.getAttribute("type")}(e))return[];const n=e.ownerDocument.querySelectorAll("label");return Array.from(n).filter(t=>t.control===e)}function we(e,t,n){let{selector:r="*"}=void 0===n?{}:n;const o=t.getAttribute("aria-labelledby"),i=o?o.split(" "):[];return i.length?i.map(t=>{const n=e.querySelector('[id="'+t+'"]');return n?{content:ge(n),formControl:null}:{content:"",formControl:null}}):Array.from(Ee(t)).map(e=>({content:ge(e),formControl:Array.from(e.querySelectorAll("button, input, meter, output, progress, select, textarea")).filter(e=>e.matches(r))[0]}))}function Te(e){if(null==e)throw new Error("It looks like "+e+" was passed instead of a matcher. Did you do something like getByText("+e+")?")}function Ie(e,t,n,r){if("string"!=typeof e)return!1;Te(n);const o=r(e);return"string"==typeof n||"number"==typeof n?o.toLowerCase().includes(n.toString().toLowerCase()):"function"==typeof n?n(o,t):Oe(n,o)}function Se(e,t,n,r){if("string"!=typeof e)return!1;Te(n);const o=r(e);return n instanceof Function?n(o,t):n instanceof RegExp?Oe(n,o):o===String(n)}function Ae(e){let{trim:t=!0,collapseWhitespace:n=!0}=void 0===e?{}:e;return e=>{let r=e;return r=t?r.trim():r,r=n?r.replace(/\s+/g," "):r,r}}function _e(e){let{trim:t,collapseWhitespace:n,normalizer:r}=e;if(!r)return Ae({trim:t,collapseWhitespace:n});if(void 0!==t||void 0!==n)throw new Error('trim and collapseWhitespace are not supported with a normalizer. If you want to use the default trim and collapseWhitespace logic in your normalizer, use "getDefaultNormalizer({trim, collapseWhitespace})" and compose that into your normalizer');return r}function Oe(e,t){const n=e.test(t);return e.global&&0!==e.lastIndex&&(console.warn("To match all elements we had to reset the lastIndex of the RegExp because the global flag is enabled. We encourage to remove the global flag from the RegExp."),e.lastIndex=0),n}function xe(e){return e.matches("input[type=submit], input[type=button], input[type=reset]")?e.value:Array.from(e.childNodes).filter(e=>3===e.nodeType&&Boolean(e.textContent)).map(e=>e.textContent).join("")}const je=function(e){function t(e){let{attributes:t=[]}=e;return t.length}function n(e){let{attributes:t=[]}=e;const n=t.findIndex(e=>e.value&&"type"===e.name&&"text"===e.value);n>=0&&(t=[...t.slice(0,n),...t.slice(n+1)]);const r=function(e){let{name:t,attributes:n}=e;return""+t+n.map(e=>{let{name:t,value:n,constraints:r=[]}=e;const o=-1!==r.indexOf("undefined"),i=-1!==r.indexOf("set");return void 0!==n?"["+t+'="'+n+'"]':o?":not(["+t+"])":i?"["+t+"]:not(["+t+'=""])':"["+t+"]"}).join("")}({...e,attributes:t});return e=>!(n>=0&&"text"!==e.type)&&e.matches(r)}let r=[];for(const[o,i]of e.entries())r=[...r,{match:n(o),roles:Array.from(i),specificity:t(o)}];return r.sort(function(e,t){let{specificity:n}=e,{specificity:r}=t;return r-n})}(a.elementRoles);function Ne(e){if(!0===e.hidden)return!0;if("true"===e.getAttribute("aria-hidden"))return!0;return"none"===e.ownerDocument.defaultView.getComputedStyle(e).display}function Me(e,t){void 0===t&&(t={});const{isSubtreeInaccessible:n=Ne}=t;if("hidden"===e.ownerDocument.defaultView.getComputedStyle(e).visibility)return!0;let r=e;for(;r;){if(n(r))return!0;r=r.parentElement}return!1}function Ce(e){for(const{match:t,roles:n}of je)if(t(e))return[...n];return[]}function De(e,t){let{hidden:n,includeDescription:r}=t;const o=function(e,t){let{hidden:n=!1}=void 0===t?{}:t;return function e(t){return[t,...Array.from(t.children).reduce((t,n)=>[...t,...e(n)],[])]}(e).filter(e=>!1!==n||!1===Me(e)).reduce((e,t)=>{let n=[];return n=t.hasAttribute("role")?t.getAttribute("role").split(" ").slice(0,1):Ce(t),n.reduce((e,n)=>Array.isArray(e[n])?{...e,[n]:[...e[n],t]}:{...e,[n]:[t]},e)},{})}(e,{hidden:n});return Object.entries(o).filter(e=>{let[t]=e;return"generic"!==t}).map(e=>{let[t,n]=e;const o="-".repeat(50);return t+":\n\n"+n.map(e=>{const t='Name "'+X(e,{computedStyleSupportsPseudoElements:ye().computedStyleSupportsPseudoElements})+'":\n',n=pe(e.cloneNode(!1));if(r){return""+t+('Description "'+K(e,{computedStyleSupportsPseudoElements:ye().computedStyleSupportsPseudoElements})+'":\n')+n}return""+t+n}).join("\n\n")+"\n\n"+o}).join("\n")}function ke(e,t){const n=e.getAttribute(t);return"true"===n||"false"!==n&&void 0}const Pe=Ae();function Be(e){return new RegExp(function(e){return e.replace(/[.*+\-?^${}()|[\]\\]/g,"\\$&")}(e.toLowerCase()),"i")}function Le(e,t,n,r){let{variant:o,name:i}=r,a="";const s={},l=[["Role","TestId"].includes(e)?n:Be(n)];i&&(s.name=Be(i)),"Role"===e&&Me(t)&&(s.hidden=!0,a="Element is inaccessible. This means that the element and all its children are invisible to screen readers.\n If you are using the aria-hidden prop, make sure this is the right choice for your case.\n "),Object.keys(s).length>0&&l.push(s);const u=o+"By"+e;return{queryName:e,queryMethod:u,queryArgs:l,variant:o,warning:a,toString(){a&&console.warn(a);let[e,t]=l;return e="string"==typeof e?"'"+e+"'":e,t=t?", { "+Object.entries(t).map(e=>{let[t,n]=e;return t+": "+n}).join(", ")+" }":"",u+"("+e+t+")"}}}function Re(e,t,n){return n&&!0}function qe(e,t,n){var r,o;if(void 0===t&&(t="get"),e.matches(ye().defaultIgnore))return;const i=null!=(r=e.getAttribute("role"))?r:null==(o=Ce(e))?void 0:o[0];if("generic"!==i&&Re(0,0,i))return Le("Role",e,i,{variant:t,name:X(e,{computedStyleSupportsPseudoElements:ye().computedStyleSupportsPseudoElements})});const a=we(document,e).map(e=>e.content).join(" ");if(Re(0,0,a))return Le("LabelText",e,a,{variant:t});const s=e.getAttribute("placeholder");if(Re(0,0,s))return Le("PlaceholderText",e,s,{variant:t});const l=Pe(xe(e));if(Re(0,0,l))return Le("Text",e,l,{variant:t});if(Re(0,0,e.value))return Le("DisplayValue",e,Pe(e.value),{variant:t});const u=e.getAttribute("alt");if(Re(0,0,u))return Le("AltText",e,u,{variant:t});const c=e.getAttribute("title");if(Re(0,0,c))return Le("Title",e,c,{variant:t});const d=e.getAttribute(ye().testIdAttribute);return Re(0,0,d)?Le("TestId",e,d,{variant:t}):void 0}function Ve(e,t){e.stack=t.stack.replace(t.message,e.message)}function Fe(e,t){let{container:n=se(),timeout:r=ye().asyncUtilTimeout,showOriginalStackTrace:o=ye().showOriginalStackTrace,stackTraceError:i,interval:a=50,onTimeout:s=e=>(Object.defineProperty(e,"message",{value:ye().getElementError(e.message,n).message}),e),mutationObserverOptions:l={subtree:!0,childList:!0,attributes:!0,characterData:!0}}=t;if("function"!=typeof e)throw new TypeError("Received `callback` arg must be a function");return new Promise(async(t,u)=>{let c,d,b,p=!1,f="idle";const h=setTimeout(function(){let e;c?(e=c,o||"TestingLibraryElementError"!==e.name||Ve(e,i)):(e=new Error("Timed out in waitFor."),o||Ve(e,i));m(s(e),null)},r),y=ae();if(y){const{unstable_advanceTimersWrapper:e}=ye();for(g();!p;){if(!ae()){const e=new Error("Changed from using fake timers to real timers while using waitFor. This is not allowed and will result in very strange behavior. Please ensure you're awaiting all async things your test is doing before changing to real timers. For more info, please go to https://github.com/testing-library/dom-testing-library/issues/830");return o||Ve(e,i),void u(e)}if(await e(async()=>{jest.advanceTimersByTime(a)}),p)break;g()}}else{try{ue(n)}catch(e){return void u(e)}d=setInterval(v,a);const{MutationObserver:e}=le(n);b=new e(v),b.observe(n,l),g()}function m(e,n){p=!0,clearTimeout(h),y||(clearInterval(d),b.disconnect()),e?u(e):t(n)}function v(){if(ae()){const e=new Error("Changed from using real timers to fake timers while using waitFor. This is not allowed and will result in very strange behavior. Please ensure you're awaiting all async things your test is doing before changing to fake timers. For more info, please go to https://github.com/testing-library/dom-testing-library/issues/830");return o||Ve(e,i),u(e)}return g()}function g(){if("pending"!==f)try{const t=function(e){try{return he._disableExpensiveErrorDiagnostics=!0,e()}finally{he._disableExpensiveErrorDiagnostics=!1}}(e);"function"==typeof(null==t?void 0:t.then)?(f="pending",t.then(e=>{f="resolved",m(null,e)},e=>{f="rejected",c=e})):m(null,t)}catch(e){c=e}}})}function We(e,t){return ye().getElementError(e,t)}function ze(e,t,n,r){let{exact:o=!0,collapseWhitespace:i,trim:a,normalizer:s}=void 0===r?{}:r;const l=o?Se:Ie,u=_e({collapseWhitespace:i,trim:a,normalizer:s});return Array.from(t.querySelectorAll("["+e+"]")).filter(t=>l(t.getAttribute(e),t,n,u))}function Ue(e,t){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];const a=e(n,...o);if(a.length>1){const e=a.map(e=>We(null,e).message).join("\n\n");throw function(e,t){return We(e+"\n\n(If this is intentional, then use the `*AllBy*` variant of the query (like `queryAllByText`, `getAllByText`, or `findAllByText`)).",t)}(t(n,...o)+"\n\nHere are the matching elements:\n\n"+e,n)}return a[0]||null}}function He(e,t){return ye().getElementError("A better query is available, try this:\n"+e.toString()+"\n",t)}function $e(e){return(t,n,r,o)=>function(e,t){const n=new Error("STACK_TRACE_MESSAGE");return ye().asyncWrapper(()=>Fe(e,{stackTraceError:n,...t}))}(()=>e(t,n,r),{container:t,...o})}const Ge=(e,t,n)=>function(r){for(var o=arguments.length,i=new Array(o>1?o-1:0),a=1;a<o;a++)i[a-1]=arguments[a];const s=e(r,...i),[{suggest:l=ye().throwSuggestions}={}]=i.slice(-1);if(s&&l){const e=qe(s,n);if(e&&!t.endsWith(e.queryName))throw He(e.toString(),r)}return s},Ke=(e,t,n)=>function(r){for(var o=arguments.length,i=new Array(o>1?o-1:0),a=1;a<o;a++)i[a-1]=arguments[a];const s=e(r,...i),[{suggest:l=ye().throwSuggestions}={}]=i.slice(-1);if(s.length&&l){const e=[...new Set(s.map(e=>{var t;return null==(t=qe(e,n))?void 0:t.toString()}))];if(1===e.length&&!t.endsWith(qe(s[0],n).queryName))throw He(e[0],r)}return s};function Xe(e,t,n){const r=Ge(Ue(e,t),e.name,"query"),o=function(e,t){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];const a=e(n,...o);if(!a.length)throw ye().getElementError(t(n,...o),n);return a}}(e,n),i=Ue(o,t),a=Ge(i,e.name,"get");return[r,Ke(o,e.name.replace("query","get"),"getAll"),a,$e(Ke(o,e.name,"findAll")),$e(Ge(i,e.name,"find"))]}const Je=function(e,t,n){let{exact:r=!0,trim:o,collapseWhitespace:i,normalizer:a}=void 0===n?{}:n;const s=r?Se:Ie,l=_e({collapseWhitespace:i,trim:o,normalizer:a}),u=function(e){return Array.from(e.querySelectorAll("label,input")).map(e=>({node:e,textToMatch:ge(e)})).filter(e=>{let{textToMatch:t}=e;return null!==t})}(e);return u.filter(e=>{let{node:n,textToMatch:r}=e;return s(r,n,t,l)}).map(e=>{let{node:t}=e;return t})},Qe=function(e,t,n){let{selector:r="*",exact:o=!0,collapseWhitespace:i,trim:a,normalizer:s}=void 0===n?{}:n;ue(e);const l=o?Se:Ie,u=_e({collapseWhitespace:i,trim:a,normalizer:s}),c=Array.from(e.querySelectorAll("*")).filter(e=>Ee(e).length||e.hasAttribute("aria-labelledby")).reduce((n,o)=>{const i=we(e,o,{selector:r});i.filter(e=>Boolean(e.formControl)).forEach(e=>{l(e.content,e.formControl,t,u)&&e.formControl&&n.push(e.formControl)});const a=i.filter(e=>Boolean(e.content)).map(e=>e.content);return l(a.join(" "),o,t,u)&&n.push(o),a.length>1&&a.forEach((e,r)=>{l(e,o,t,u)&&n.push(o);const i=[...a];i.splice(r,1),i.length>1&&l(i.join(" "),o,t,u)&&n.push(o)}),n},[]).concat(ze("aria-label",e,t,{exact:o,normalizer:u}));return Array.from(new Set(c)).filter(e=>e.matches(r))},Ye=function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];const i=Qe(e,t,...r);if(!i.length){const n=Je(e,t,...r);if(n.length){const r=n.map(t=>function(e,t){const n=t.getAttribute("for");if(!n)return null;const r=e.querySelector('[id="'+n+'"]');return r?r.tagName.toLowerCase():null}(e,t)).filter(e=>!!e);throw r.length?ye().getElementError(r.map(e=>"Found a label with the text of: "+t+", however the element associated with this label (<"+e+" />) is non-labellable [https://html.spec.whatwg.org/multipage/forms.html#category-label]. If you really need to label a <"+e+" />, you can use aria-label or aria-labelledby instead.").join("\n\n"),e):ye().getElementError("Found a label with the text of: "+t+', however no form control was found associated to that label. Make sure you\'re using the "for" attribute or "aria-labelledby" attribute correctly.',e)}throw ye().getElementError("Unable to find a label with the text of: "+t,e)}return i};const Ze=(e,t)=>"Found multiple elements with the text of: "+t,et=Ge(Ue(Qe,Ze),Qe.name,"query"),tt=Ue(Ye,Ze),nt=$e(Ke(Ye,Ye.name,"findAll")),rt=$e(Ge(tt,Ye.name,"find")),ot=Ke(Ye,Ye.name,"getAll"),it=Ge(tt,Ye.name,"get"),at=Ke(Qe,Qe.name,"queryAll"),st=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return ue(t[0]),ze("placeholder",...t)},lt=Ke(st,st.name,"queryAll"),[ut,ct,dt,bt,pt]=Xe(st,(e,t)=>"Found multiple elements with the placeholder text of: "+t,(e,t)=>"Unable to find an element with the placeholder text of: "+t),ft=function(e,t,n){let{selector:r="*",exact:o=!0,collapseWhitespace:i,trim:a,ignore:s=ye().defaultIgnore,normalizer:l}=void 0===n?{}:n;ue(e);const u=o?Se:Ie,c=_e({collapseWhitespace:i,trim:a,normalizer:l});let d=[];return"function"==typeof e.matches&&e.matches(r)&&(d=[e]),[...d,...Array.from(e.querySelectorAll(r))].filter(e=>!s||!e.matches(s)).filter(e=>u(xe(e),e,t,c))},ht=Ke(ft,ft.name,"queryAll"),[yt,mt,vt,gt,Et]=Xe(ft,(e,t)=>"Found multiple elements with the text: "+t,function(e,t,n){void 0===n&&(n={});const{collapseWhitespace:r,trim:o,normalizer:i,selector:a}=n,s=_e({collapseWhitespace:r,trim:o,normalizer:i})(t.toString());return"Unable to find an element with the text: "+(s!==t.toString()?s+" (normalized from '"+t+"')":t)+("*"!==(null!=a?a:"*")?", which matches selector '"+a+"'":"")+". This could be because the text is broken up by multiple elements. In this case, you can provide a function for your text matcher to make your matcher more flexible."}),wt=function(e,t,n){let{exact:r=!0,collapseWhitespace:o,trim:i,normalizer:a}=void 0===n?{}:n;ue(e);const s=r?Se:Ie,l=_e({collapseWhitespace:o,trim:i,normalizer:a});return Array.from(e.querySelectorAll("input,textarea,select")).filter(e=>{if("SELECT"===e.tagName){return Array.from(e.options).filter(e=>e.selected).some(e=>s(xe(e),e,t,l))}return s(e.value,e,t,l)})},Tt=Ke(wt,wt.name,"queryAll"),[It,St,At,_t,Ot]=Xe(wt,(e,t)=>"Found multiple elements with the display value: "+t+".",(e,t)=>"Unable to find an element with the display value: "+t+"."),xt=/^(img|input|area|.+-.+)$/i,jt=function(e,t,n){return void 0===n&&(n={}),ue(e),ze("alt",e,t,n).filter(e=>xt.test(e.tagName))},Nt=Ke(jt,jt.name,"queryAll"),[Mt,Ct,Dt,kt,Pt]=Xe(jt,(e,t)=>"Found multiple elements with the alt text: "+t,(e,t)=>"Unable to find an element with the alt text: "+t),Bt=function(e,t,n){let{exact:r=!0,collapseWhitespace:o,trim:i,normalizer:a}=void 0===n?{}:n;ue(e);const s=r?Se:Ie,l=_e({collapseWhitespace:o,trim:i,normalizer:a});return Array.from(e.querySelectorAll("[title], svg > title")).filter(e=>s(e.getAttribute("title"),e,t,l)||(e=>{var t;return"title"===e.tagName.toLowerCase()&&"svg"===(null==(t=e.parentElement)?void 0:t.tagName.toLowerCase())})(e)&&s(xe(e),e,t,l))},Lt=Ke(Bt,Bt.name,"queryAll"),[Rt,qt,Vt,Ft,Wt]=Xe(Bt,(e,t)=>"Found multiple elements with the title: "+t+".",(e,t)=>"Unable to find an element with the title: "+t+"."),zt=function(e,t,n){let{hidden:r=ye().defaultHidden,name:o,description:i,queryFallbacks:s=!1,selected:l,busy:u,checked:c,pressed:d,current:b,level:p,expanded:f,value:{now:h,min:y,max:m,text:v}={}}=void 0===n?{}:n;var g,E,w,T,I,S,A,_,O,x;if((ue(e),void 0!==l)&&void 0===(null==(g=a.roles.get(t))?void 0:g.props["aria-selected"]))throw new Error('"aria-selected" is not supported on role "'+t+'".');if(void 0!==u&&void 0===(null==(E=a.roles.get(t))?void 0:E.props["aria-busy"]))throw new Error('"aria-busy" is not supported on role "'+t+'".');if(void 0!==c&&void 0===(null==(w=a.roles.get(t))?void 0:w.props["aria-checked"]))throw new Error('"aria-checked" is not supported on role "'+t+'".');if(void 0!==d&&void 0===(null==(T=a.roles.get(t))?void 0:T.props["aria-pressed"]))throw new Error('"aria-pressed" is not supported on role "'+t+'".');if(void 0!==b&&void 0===(null==(I=a.roles.get(t))?void 0:I.props["aria-current"]))throw new Error('"aria-current" is not supported on role "'+t+'".');if(void 0!==p&&"heading"!==t)throw new Error('Role "'+t+'" cannot have "level" property.');if(void 0!==h&&void 0===(null==(S=a.roles.get(t))?void 0:S.props["aria-valuenow"]))throw new Error('"aria-valuenow" is not supported on role "'+t+'".');if(void 0!==m&&void 0===(null==(A=a.roles.get(t))?void 0:A.props["aria-valuemax"]))throw new Error('"aria-valuemax" is not supported on role "'+t+'".');if(void 0!==y&&void 0===(null==(_=a.roles.get(t))?void 0:_.props["aria-valuemin"]))throw new Error('"aria-valuemin" is not supported on role "'+t+'".');if(void 0!==v&&void 0===(null==(O=a.roles.get(t))?void 0:O.props["aria-valuetext"]))throw new Error('"aria-valuetext" is not supported on role "'+t+'".');if(void 0!==f&&void 0===(null==(x=a.roles.get(t))?void 0:x.props["aria-expanded"]))throw new Error('"aria-expanded" is not supported on role "'+t+'".');const j=new WeakMap;function N(e){return j.has(e)||j.set(e,Ne(e)),j.get(e)}return Array.from(e.querySelectorAll(function(e){var t;const n='*[role~="'+e+'"]',r=null!=(t=a.roleElements.get(e))?t:new Set,o=new Set(Array.from(r).map(e=>{let{name:t}=e;return t}));return[n].concat(Array.from(o)).join(",")}(t))).filter(e=>{if(e.hasAttribute("role")){const n=e.getAttribute("role");if(s)return n.split(" ").filter(Boolean).some(e=>e===t);const[r]=n.split(" ");return r===t}return Ce(e).some(e=>e===t)}).filter(e=>{if(void 0!==l)return l===function(e){return"OPTION"===e.tagName?e.selected:ke(e,"aria-selected")}(e);if(void 0!==u)return u===function(e){return"true"===e.getAttribute("aria-busy")}(e);if(void 0!==c)return c===function(e){if(!("indeterminate"in e)||!e.indeterminate)return"checked"in e?e.checked:ke(e,"aria-checked")}(e);if(void 0!==d)return d===function(e){return ke(e,"aria-pressed")}(e);if(void 0!==b)return b===function(e){var t,n;return null!=(t=null!=(n=ke(e,"aria-current"))?n:e.getAttribute("aria-current"))&&t}(e);if(void 0!==f)return f===function(e){return ke(e,"aria-expanded")}(e);if(void 0!==p)return p===function(e){return e.getAttribute("aria-level")&&Number(e.getAttribute("aria-level"))||{H1:1,H2:2,H3:3,H4:4,H5:5,H6:6}[e.tagName]}(e);if(void 0!==h||void 0!==m||void 0!==y||void 0!==v){let n=!0;var t;if(void 0!==h&&n&&(n=h===function(e){const t=e.getAttribute("aria-valuenow");return null===t?void 0:+t}(e)),void 0!==m&&n&&(n=m===function(e){const t=e.getAttribute("aria-valuemax");return null===t?void 0:+t}(e)),void 0!==y&&n&&(n=y===function(e){const t=e.getAttribute("aria-valuemin");return null===t?void 0:+t}(e)),void 0!==v)n&&(n=Se(null!=(t=function(e){const t=e.getAttribute("aria-valuetext");return null===t?void 0:t}(e))?t:null,e,v,e=>e));return n}return!0}).filter(e=>void 0===o||Se(X(e,{computedStyleSupportsPseudoElements:ye().computedStyleSupportsPseudoElements}),e,o,e=>e)).filter(e=>void 0===i||Se(K(e,{computedStyleSupportsPseudoElements:ye().computedStyleSupportsPseudoElements}),e,i,e=>e)).filter(e=>!1!==r||!1===Me(e,{isSubtreeInaccessible:N}))};const Ut=e=>{let t="";return t=void 0===e?"":"string"==typeof e?' and name "'+e+'"':" and name `"+e+"`",t},Ht=Ke(zt,zt.name,"queryAll"),[$t,Gt,Kt,Xt,Jt]=Xe(zt,function(e,t,n){let{name:r}=void 0===n?{}:n;return'Found multiple elements with the role "'+t+'"'+Ut(r)},function(e,t,n){let{hidden:r=ye().defaultHidden,name:o,description:i}=void 0===n?{}:n;if(ye()._disableExpensiveErrorDiagnostics)return'Unable to find role="'+t+'"'+Ut(o);let a,s="";Array.from(e.children).forEach(e=>{s+=De(e,{hidden:r,includeDescription:void 0!==i})}),a=0===s.length?!1===r?"There are no accessible roles. But there might be some inaccessible roles. If you wish to access them, then set the `hidden` option to `true`. Learn more about this here: https://testing-library.com/docs/dom-testing-library/api-queries#byrole":"There are no available roles.":("\nHere are the "+(!1===r?"accessible":"available")+" roles:\n\n "+s.replace(/\n/g,"\n ").replace(/\n\s\s\n/g,"\n\n")+"\n").trim();let l="";l=void 0===o?"":"string"==typeof o?' and name "'+o+'"':" and name `"+o+"`";let u="";return u=void 0===i?"":"string"==typeof i?' and description "'+i+'"':" and description `"+i+"`",("\nUnable to find an "+(!1===r?"accessible ":"")+'element with the role "'+t+'"'+l+u+"\n\n"+a).trim()}),Qt=()=>ye().testIdAttribute,Yt=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return ue(t[0]),ze(Qt(),...t)},Zt=Ke(Yt,Yt.name,"queryAll"),[en,tn,nn,rn,on]=Xe(Yt,(e,t)=>"Found multiple elements by: ["+Qt()+'="'+t+'"]',(e,t)=>"Unable to find an element by: ["+Qt()+'="'+t+'"]');var an=Object.freeze({__proto__:null,queryAllByLabelText:at,queryByLabelText:et,getAllByLabelText:ot,getByLabelText:it,findAllByLabelText:nt,findByLabelText:rt,queryByPlaceholderText:ut,queryAllByPlaceholderText:lt,getByPlaceholderText:dt,getAllByPlaceholderText:ct,findAllByPlaceholderText:bt,findByPlaceholderText:pt,queryByText:yt,queryAllByText:ht,getByText:vt,getAllByText:mt,findAllByText:gt,findByText:Et,queryByDisplayValue:It,queryAllByDisplayValue:Tt,getByDisplayValue:At,getAllByDisplayValue:St,findAllByDisplayValue:_t,findByDisplayValue:Ot,queryByAltText:Mt,queryAllByAltText:Nt,getByAltText:Dt,getAllByAltText:Ct,findAllByAltText:kt,findByAltText:Pt,queryByTitle:Rt,queryAllByTitle:Lt,getByTitle:Vt,getAllByTitle:qt,findAllByTitle:Ft,findByTitle:Wt,queryByRole:$t,queryAllByRole:Ht,getAllByRole:Gt,getByRole:Kt,findAllByRole:Xt,findByRole:Jt,queryByTestId:en,queryAllByTestId:Zt,getByTestId:nn,getAllByTestId:tn,findAllByTestId:rn,findByTestId:on});function sn(e,t,n){return void 0===t&&(t=an),void 0===n&&(n={}),Object.keys(t).reduce((n,r)=>{const o=t[r];return n[r]=o.bind(null,e),n},n)}const ln={copy:{EventType:"ClipboardEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},cut:{EventType:"ClipboardEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},paste:{EventType:"ClipboardEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},compositionEnd:{EventType:"CompositionEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},compositionStart:{EventType:"CompositionEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},compositionUpdate:{EventType:"CompositionEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},keyDown:{EventType:"KeyboardEvent",defaultInit:{bubbles:!0,cancelable:!0,charCode:0,composed:!0}},keyPress:{EventType:"KeyboardEvent",defaultInit:{bubbles:!0,cancelable:!0,charCode:0,composed:!0}},keyUp:{EventType:"KeyboardEvent",defaultInit:{bubbles:!0,cancelable:!0,charCode:0,composed:!0}},focus:{EventType:"FocusEvent",defaultInit:{bubbles:!1,cancelable:!1,composed:!0}},blur:{EventType:"FocusEvent",defaultInit:{bubbles:!1,cancelable:!1,composed:!0}},focusIn:{EventType:"FocusEvent",defaultInit:{bubbles:!0,cancelable:!1,composed:!0}},focusOut:{EventType:"FocusEvent",defaultInit:{bubbles:!0,cancelable:!1,composed:!0}},change:{EventType:"Event",defaultInit:{bubbles:!0,cancelable:!1}},input:{EventType:"InputEvent",defaultInit:{bubbles:!0,cancelable:!1,composed:!0}},invalid:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!0}},submit:{EventType:"Event",defaultInit:{bubbles:!0,cancelable:!0}},reset:{EventType:"Event",defaultInit:{bubbles:!0,cancelable:!0}},click:{EventType:"MouseEvent",defaultInit:{bubbles:!0,cancelable:!0,button:0,composed:!0}},contextMenu:{EventType:"MouseEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},dblClick:{EventType:"MouseEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},drag:{EventType:"DragEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},dragEnd:{EventType:"DragEvent",defaultInit:{bubbles:!0,cancelable:!1,composed:!0}},dragEnter:{EventType:"DragEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},dragExit:{EventType:"DragEvent",defaultInit:{bubbles:!0,cancelable:!1,composed:!0}},dragLeave:{EventType:"DragEvent",defaultInit:{bubbles:!0,cancelable:!1,composed:!0}},dragOver:{EventType:"DragEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},dragStart:{EventType:"DragEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},drop:{EventType:"DragEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},mouseDown:{EventType:"MouseEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},mouseEnter:{EventType:"MouseEvent",defaultInit:{bubbles:!1,cancelable:!1,composed:!0}},mouseLeave:{EventType:"MouseEvent",defaultInit:{bubbles:!1,cancelable:!1,composed:!0}},mouseMove:{EventType:"MouseEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},mouseOut:{EventType:"MouseEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},mouseOver:{EventType:"MouseEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},mouseUp:{EventType:"MouseEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},select:{EventType:"Event",defaultInit:{bubbles:!0,cancelable:!1}},touchCancel:{EventType:"TouchEvent",defaultInit:{bubbles:!0,cancelable:!1,composed:!0}},touchEnd:{EventType:"TouchEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},touchMove:{EventType:"TouchEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},touchStart:{EventType:"TouchEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},resize:{EventType:"UIEvent",defaultInit:{bubbles:!1,cancelable:!1}},scroll:{EventType:"UIEvent",defaultInit:{bubbles:!1,cancelable:!1}},wheel:{EventType:"WheelEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},abort:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},canPlay:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},canPlayThrough:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},durationChange:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},emptied:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},encrypted:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},ended:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},loadedData:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},loadedMetadata:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},loadStart:{EventType:"ProgressEvent",defaultInit:{bubbles:!1,cancelable:!1}},pause:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},play:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},playing:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},progress:{EventType:"ProgressEvent",defaultInit:{bubbles:!1,cancelable:!1}},rateChange:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},seeked:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},seeking:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},stalled:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},suspend:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},timeUpdate:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},volumeChange:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},waiting:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},load:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},error:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},animationStart:{EventType:"AnimationEvent",defaultInit:{bubbles:!0,cancelable:!1}},animationEnd:{EventType:"AnimationEvent",defaultInit:{bubbles:!0,cancelable:!1}},animationIteration:{EventType:"AnimationEvent",defaultInit:{bubbles:!0,cancelable:!1}},transitionCancel:{EventType:"TransitionEvent",defaultInit:{bubbles:!0,cancelable:!1}},transitionEnd:{EventType:"TransitionEvent",defaultInit:{bubbles:!0,cancelable:!0}},transitionRun:{EventType:"TransitionEvent",defaultInit:{bubbles:!0,cancelable:!1}},transitionStart:{EventType:"TransitionEvent",defaultInit:{bubbles:!0,cancelable:!1}},pointerOver:{EventType:"PointerEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},pointerEnter:{EventType:"PointerEvent",defaultInit:{bubbles:!1,cancelable:!1}},pointerDown:{EventType:"PointerEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},pointerMove:{EventType:"PointerEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},pointerUp:{EventType:"PointerEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},pointerCancel:{EventType:"PointerEvent",defaultInit:{bubbles:!0,cancelable:!1,composed:!0}},pointerOut:{EventType:"PointerEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},pointerLeave:{EventType:"PointerEvent",defaultInit:{bubbles:!1,cancelable:!1}},gotPointerCapture:{EventType:"PointerEvent",defaultInit:{bubbles:!0,cancelable:!1,composed:!0}},lostPointerCapture:{EventType:"PointerEvent",defaultInit:{bubbles:!0,cancelable:!1,composed:!0}},popState:{EventType:"PopStateEvent",defaultInit:{bubbles:!0,cancelable:!1}},offline:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},online:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},pageHide:{EventType:"PageTransitionEvent",defaultInit:{bubbles:!0,cancelable:!0}},pageShow:{EventType:"PageTransitionEvent",defaultInit:{bubbles:!0,cancelable:!0}}},un={doubleClick:"dblClick"};function cn(e,t){return ye().eventWrapper(()=>{if(!t)throw new Error("Unable to fire an event - please provide an event object.");if(!e)throw new Error('Unable to fire a "'+t.type+'" event - please provide a DOM element.');return e.dispatchEvent(t)})}function dn(e,t,n,r){let{EventType:o="Event",defaultInit:i={}}=void 0===r?{}:r;if(!t)throw new Error('Unable to fire a "'+e+'" event - please provide a DOM element.');const a={...i,...n},{target:{value:s,files:l,...u}={}}=a;void 0!==s&&function(e,t){const{set:n}=Object.getOwnPropertyDescriptor(e,"value")||{},r=Object.getPrototypeOf(e),{set:o}=Object.getOwnPropertyDescriptor(r,"value")||{};if(o&&n!==o)o.call(e,t);else{if(!n)throw new Error("The given element does not have a value setter");n.call(e,t)}}(t,s),void 0!==l&&Object.defineProperty(t,"files",{configurable:!0,enumerable:!0,writable:!0,value:l}),Object.assign(t,u);const c=le(t),d=c[o]||c.Event;let b;if("function"==typeof d)b=new d(e,a);else{b=c.document.createEvent(o);const{bubbles:t,cancelable:n,detail:r,...i}=a;b.initEvent(e,t,n,r),Object.keys(i).forEach(e=>{b[e]=i[e]})}return["dataTransfer","clipboardData"].forEach(e=>{const t=a[e];"object"==typeof t&&("function"==typeof c.DataTransfer?Object.defineProperty(b,e,{value:Object.getOwnPropertyNames(t).reduce((e,n)=>(Object.defineProperty(e,n,{value:t[n]}),e),new c.DataTransfer)}):Object.defineProperty(b,e,{value:t}))}),b}function bn(e){return"https://testing-playground.com/#markup="+(t=e,s.compressToEncodedURIComponent(t.replace(/[ \t]*[\n][ \t]*/g,"\n")));var t}Object.keys(ln).forEach(e=>{const{EventType:t,defaultInit:n}=ln[e],r=e.toLowerCase();dn[e]=(e,o)=>dn(r,e,o,{EventType:t,defaultInit:n}),cn[e]=(t,n)=>cn(t,dn[e](t,n))}),Object.keys(un).forEach(e=>{const t=un[e];cn[e]=function(){return cn[t](...arguments)}});const pn={debug:(e,t,n)=>Array.isArray(e)?e.forEach(e=>fe(e,t,n)):fe(e,t,n),logTestingPlaygroundURL:function(e){if(void 0===e&&(e=se().body),!e||!("innerHTML"in e))return void console.log("The element you're providing isn't a valid DOM element.");if(!e.innerHTML)return void console.log("The provided element doesn't have any children.");const t=bn(e.innerHTML);return console.log("Open this URL in your browser\n\n"+t),t}};"undefined"!=typeof document&&document.body?sn(document.body,an,pn):Object.keys(an).reduce((e,t)=>(e[t]=()=>{throw new TypeError("For queries bound to document.body a global document has to be available... Learn more: https://testing-library.com/s/screen-global-error")},e),pn);const fn="function"==typeof d.act?d.act:b.act;function hn(){if("undefined"!=typeof globalThis)return globalThis;if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("unable to locate global object")}function yn(e){hn().IS_REACT_ACT_ENVIRONMENT=e}function mn(){return hn().IS_REACT_ACT_ENVIRONMENT}const vn=(gn=fn,e=>{const t=mn();yn(!0);try{let n=!1;const r=gn(()=>{const t=e();return null!==t&&"object"==typeof t&&"function"==typeof t.then&&(n=!0),t});if(n){const e=r;return{then:(n,r)=>{e.then(e=>{yn(t),n(e)},e=>{yn(t),r(e)})}}}return yn(t),r}catch(e){throw yn(t),e}});var gn;Object.keys(cn).forEach(e=>{});let En={reactStrictMode:!1};var wn;"function"==typeof(wn={unstable_advanceTimersWrapper:e=>vn(e),asyncWrapper:async e=>{const t=mn();yn(!1);try{const t=await e();return await new Promise(e=>{setTimeout(()=>{e()},0),"undefined"==typeof jest||null===jest||!0!==setTimeout._isMockFunction&&!Object.prototype.hasOwnProperty.call(setTimeout,"clock")||jest.advanceTimersByTime(0)}),t}finally{yn(t)}},eventWrapper:e=>{let t;return vn(()=>{t=e()}),t}})&&(wn=wn(he)),he={...he,...wn};const Tn=new Set,In=[];function Sn(e,t){return t??{...ye(),...En}.reactStrictMode?d.createElement(d.StrictMode,null,e):e}function An(e,t){return t?d.createElement(t,null,e):e}function _n(e,{hydrate:t,onCaughtError:n,onRecoverableError:r,ui:o,wrapper:i,reactStrictMode:a}){let s;return t?vn(()=>{s=p.hydrateRoot(e,Sn(An(o,i),a),{onCaughtError:n,onRecoverableError:r})}):s=p.createRoot(e,{onCaughtError:n,onRecoverableError:r}),{hydrate(){if(!t)throw new Error("Attempted to hydrate a non-hydrateable root. This is a bug in `@testing-library/react`.")},render(e){s.render(e)},unmount(){s.unmount()}}}function On(e){return{hydrate(t){r.hydrate(t,e)},render(t){r.render(t,e)},unmount(){r.unmountComponentAtNode(e)}}}function xn(e,{baseElement:t,container:n,hydrate:r,queries:o,root:i,wrapper:a,reactStrictMode:s}){return vn(()=>{r?i.hydrate(Sn(An(e,a),s),n):i.render(Sn(An(e,a),s),n)}),{container:n,baseElement:t,debug:(e=t,n,r)=>Array.isArray(e)?e.forEach(e=>console.log(pe(e,n,r))):console.log(pe(e,n,r)),unmount:()=>{vn(()=>{i.unmount()})},rerender:e=>{xn(e,{container:n,baseElement:t,root:i,wrapper:a,reactStrictMode:s})},asFragment:()=>{if("function"==typeof document.createRange)return document.createRange().createContextualFragment(n.innerHTML);{const e=document.createElement("template");return e.innerHTML=n.innerHTML,e.content}},...sn(t,o)}}function jn(e,{container:t,baseElement:n=t,legacyRoot:o=!1,onCaughtError:i,onUncaughtError:a,onRecoverableError:s,queries:l,hydrate:u=!1,wrapper:c,reactStrictMode:d}={}){if(void 0!==a)throw new Error("onUncaughtError is not supported. The `render` call will already throw on uncaught errors.");if(o&&"function"!=typeof r.render){const e=new Error("`legacyRoot: true` is not supported in this version of React. If your app runs React 19 or later, you should remove this flag. If your app runs React 18 or earlier, visit https://react.dev/blog/2022/03/08/react-18-upgrade-guide for upgrade instructions.");throw Error.captureStackTrace(e,jn),e}let b;if(n||(n=document.body),t||(t=n.appendChild(document.createElement("div"))),Tn.has(t))In.forEach(e=>{e.container===t&&(b=e.root)});else{b=(o?On:_n)(t,{hydrate:u,onCaughtError:i,onRecoverableError:s,ui:e,wrapper:c,reactStrictMode:d}),In.push({container:t,root:b}),Tn.add(t)}return xn(e,{container:t,baseElement:n,queries:l,hydrate:u,wrapper:c,root:b,reactStrictMode:d})}function Nn(){In.forEach(({root:e,container:t})=>{vn(()=>{e.unmount()}),t.parentNode===document.body&&document.body.removeChild(t)}),In.length=0,Tn.clear()}if(("undefined"==typeof process||!process.env?.RTL_SKIP_AUTO_CLEANUP)&&("function"==typeof afterEach?afterEach(()=>{Nn()}):"function"==typeof teardown&&teardown(()=>{Nn()}),"function"==typeof beforeAll&&"function"==typeof afterAll)){let e=mn();beforeAll(()=>{e=mn(),yn(!0)}),afterAll(()=>{yn(e)})}class Mn extends Error{constructor(e){super(`Node not found: "${e}"`),this.name="NodeNotFoundError",Error.captureStackTrace&&Error.captureStackTrace(this,Mn)}}class Cn extends Error{constructor(){super("Root node ID not found"),this.name="RootNotFoundError",Error.captureStackTrace&&Error.captureStackTrace(this,Cn)}}class Dn extends Error{constructor(){super("Metadata not found"),this.name="MetadataNotFoundError",Error.captureStackTrace&&Error.captureStackTrace(this,Dn)}}function kn(e,t){var n;const r=null===(n=t.nodes)||void 0===n?void 0:n[e];if(!r)return null;const o=[];r.childrenIds&&o.push(...r.childrenIds);const i=o.map(e=>kn(e,t)).filter(e=>null!==e);return Object.assign(Object.assign({id:r.id,type:r.type,state:r.state||{},attributes:r.attributes||{}},void 0!==r.reference&&{reference:r.reference}),i.length>0&&{children:i})}const Pn=new u.schema.Entity("nodes",{},{idAttribute:"id",processStrategy:e=>Object.assign({id:e.id,type:e.type,state:e.state||{},attributes:e.attributes||{}},void 0!==e.reference&&{reference:e.reference})});function Bn(e){const{result:t,entities:n}=function(e){const t=e.children||[],n=t.length>0?u.normalize(t,[Pn]):{entities:{nodes:{}}},r=Object.assign({id:e.id,type:e.type,state:e.state||{},attributes:e.attributes||{}},void 0!==e.reference&&{reference:e.reference}),o=u.normalize(r,Pn),i={nodes:Object.assign(Object.assign({},o.entities.nodes),n.entities.nodes)},a=(e,t)=>{var n,r;i.nodes&&i.nodes[e.id]?i.nodes[e.id]=Object.assign(Object.assign({},i.nodes[e.id]),{childrenIds:(null===(n=e.children)||void 0===n?void 0:n.map(e=>e.id))||[],parentId:t}):i.nodes&&(i.nodes[e.id]=Object.assign(Object.assign({id:e.id,type:e.type,state:e.state||{},attributes:e.attributes||{}},void 0!==e.reference&&{reference:e.reference}),{childrenIds:(null===(r=e.children)||void 0===r?void 0:r.map(e=>e.id))||[],parentId:t})),e.children&&e.children.forEach(t=>a(t,e.id))};return a(e,void 0),{result:o.result,entities:i}}(e.root);return{result:t,entities:n}}Pn.define({children:[Pn]});class Ln{constructor(){this._cached={},this._originalCached={}}cacheDocument(e){var t;const n=(null===(t=e.metadata)||void 0===t?void 0:t.id)||e.root.id;this._cached[n]=e,this._originalCached[n]||(this._originalCached[n]=l.cloneDeep(e))}setMetadata(e){this._metadata=e}getMetadata(){return this._metadata}getOriginalDocument(e){return this._originalCached[e]}getDocumentId(e){var t;return(null===(t=this._metadata)||void 0===t?void 0:t.id)||e}getDocument(e){const t=e.getRootId();if(!t)return null;const n=kn(t,{nodes:e.nodes});return n?{version:"1.0.0",metadata:this._metadata,root:n}:null}clearCache(){this._cached={},this._originalCached={}}reset(){this._metadata=void 0,this.clearCache()}}function Rn(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}"function"==typeof SuppressedError&&SuppressedError;class qn{constructor(){this._state={version:0,rootId:void 0,nodes:{},selectedNodeId:void 0,isEdited:!1,variables:{},lastModified:{}}}get state(){return this._state}get nodes(){return this._state.nodes}getNodeById(e){return this._state.nodes[e]}getNodeTypeById(e){var t;return null===(t=this._state.nodes[e])||void 0===t?void 0:t.type}getChildrenIdsById(e){var t;return(null===(t=this._state.nodes[e])||void 0===t?void 0:t.childrenIds)||[]}getRootId(){return this._state.rootId}getLastModified(e){return this._state.lastModified[e]}initializeState(e){this._state=Object.assign({version:0,rootId:void 0,nodes:{},selectedNodeId:void 0,isEdited:!1,variables:{},lastModified:{}},e)}updateNodes(e){this._state.nodes=e;const t=(new Date).toISOString(),n={};Object.keys(e).forEach(e=>{n[e]=t}),this._state.lastModified=n}deleteNode(e){const t=this._state.nodes,n=e;t[n];const r=Rn(t,["symbol"==typeof n?n:n+""]);this._state.nodes=r;const o=this._state.lastModified,i=e;o[i];const a=Rn(o,["symbol"==typeof i?i:i+""]);this._state.lastModified=a}deleteNodes(e){if(0===e.length)return;const t={},n=new Set(e);Object.keys(this._state.nodes).forEach(e=>{n.has(e)||(t[e]=this._state.nodes[e])}),this._state.nodes=t;const r={};Object.keys(this._state.lastModified).forEach(e=>{n.has(e)||(r[e]=this._state.lastModified[e])}),this._state.lastModified=r}mergeNodes(e){const t=new Set(Object.keys(this._state.nodes)),n=new Set(Object.keys(e)),r=[...t].filter(e=>!n.has(e)),o=(new Date).toISOString(),i={},{lastModified:a}=this._state,s=Object.assign({},a),l=new Set;return Object.keys(e).forEach(t=>{const n=this._state.nodes[t],r=e[t],{parentId:a}=r;n?i[t]=Object.assign(Object.assign({},r),{state:n.state||r.state||{}}):(i[t]=r,s[t]=o),a&&l.add(a)}),l.forEach(e=>{(i[e]||this._state.nodes[e])&&(s[e]=o)}),this._state.nodes=i,this._state.lastModified=s,r}updateNodeState(e,t){const n=this._state.nodes[e];n&&(this._state.nodes[e]=Object.assign(Object.assign({},n),{state:t}),this._state.lastModified=Object.assign(Object.assign({},this._state.lastModified),{[e]:(new Date).toISOString()}))}updateNodeAttributes(e,t){const n=this._state.nodes[e];n&&(this._state.nodes[e]=Object.assign(Object.assign({},n),{attributes:t}),this._state.lastModified=Object.assign(Object.assign({},this._state.lastModified),{[e]:(new Date).toISOString()}))}updateNodeReference(e,t){const n=this._state.nodes[e];n&&(this._state.nodes[e]=Object.assign(Object.assign({},n),{reference:t}),this._state.lastModified=Object.assign(Object.assign({},this._state.lastModified),{[e]:(new Date).toISOString()}))}setRootId(e){this._state.rootId=e}setSelectedNodeId(e){const t=this._state.selectedNodeId;return this._state.selectedNodeId=e,t}setEdited(e){this._state.isEdited=e}updateVariables(e){this._state.variables=e}incrementVersion(){this._state.version+=1}reset(){this._state.nodes={},this._state.rootId=void 0,this._state.isEdited=!1,this._state.selectedNodeId=void 0,this._state.variables={},this._state.lastModified={},this._state.version+=1}}class Vn{constructor(){this._nodeListeners=new Map,this._versionListeners=new Set}subscribeNode(e,t){return this._nodeListeners.has(e)||this._nodeListeners.set(e,new Set),this._nodeListeners.get(e).add(t),()=>{var n,r;null===(n=this._nodeListeners.get(e))||void 0===n||n.delete(t),0===(null===(r=this._nodeListeners.get(e))||void 0===r?void 0:r.size)&&this._nodeListeners.delete(e)}}subscribeVersion(e){return this._versionListeners.add(e),()=>{this._versionListeners.delete(e)}}notifyNode(e){var t;null===(t=this._nodeListeners.get(e))||void 0===t||t.forEach(e=>e())}notifyNodes(e){[...new Set(e)].forEach(e=>this.notifyNode(e))}notifyVersion(){this._versionListeners.forEach(e=>e())}cleanupNode(e){this._nodeListeners.delete(e)}cleanupNodes(e){e.forEach(e=>{this._nodeListeners.delete(e)})}}class Fn{constructor(e,t){this.repository=e,this.subscriptionManager=t}updateVariables(e){this.repository.updateVariables(l.cloneDeep(e)),this.repository.setEdited(!0),this.repository.incrementVersion(),this.subscriptionManager.notifyVersion()}updateVariable(e,t){const n=this.repository.state.variables;this.repository.updateVariables(Object.assign(Object.assign({},l.cloneDeep(n)),{[e]:l.cloneDeep(t)})),this.repository.setEdited(!0),this.repository.incrementVersion(),this.subscriptionManager.notifyVersion()}deleteVariable(e){const t=l.cloneDeep(this.repository.state.variables);delete t[e],this.repository.updateVariables(t),this.repository.setEdited(!0),this.repository.incrementVersion(),this.subscriptionManager.notifyVersion()}}class Wn{constructor(e,t){this._subscriptionManager=new Vn,this._repository=new qn,this._documentManager=new Ln,this._componentOverrides={},this._repository.initializeState(e),this._variablesManager=new Fn(this._repository,this._subscriptionManager),this._componentOverrides=(null==t?void 0:t.componentOverrides)||{}}subscribeNode(e,t){return this._subscriptionManager.subscribeNode(e,t)}subscribeVersion(e){return this._subscriptionManager.subscribeVersion(e)}get state(){return this._repository.state}getSnapshot(){return this._repository.state.lastModified}getServerSnapshot(){return this.getSnapshot()}get nodes(){return this._repository.nodes}get metadata(){const e=this._documentManager.getMetadata();if(!e)throw new Dn;return e}getComponentOverrides(){return this._componentOverrides}getNodeById(e){const t=this._repository.getNodeById(e);if(!t)throw new Mn(e);return t}getNodeTypeById(e){const t=this._repository.getNodeTypeById(e);if(!t)throw new Mn(e);return t}getChildrenIdsById(e){if(!this._repository.getNodeById(e))throw new Mn(e);return this._repository.getChildrenIdsById(e)}getLayoutStateById(e){return this.getNodeById(e).state||{}}getAttributesById(e){return this.getNodeById(e).attributes||{}}getReferenceById(e){return this.getNodeById(e).reference}getRootId(){const e=this._repository.getRootId();if(!e)throw new Cn;return e}updateLayout(e){const{entities:t}=Bn(e);this._repository.updateNodes(t.nodes||{}),this._repository.setRootId(e.root.id),this._repository.setEdited(!1),this._repository.updateVariables(e.variables?l.cloneDeep(e.variables):{}),this._repository.incrementVersion(),this._documentManager.setMetadata(e.metadata),this._documentManager.cacheDocument(e),this._subscriptionManager.notifyVersion()}mergeLayout(e){const{entities:t}=Bn(e),n=t.nodes||{},r=this._repository.mergeNodes(n),o=this._repository.state.selectedNodeId;o&&r.includes(o)&&this._repository.setSelectedNodeId(void 0),r.length>0&&this._subscriptionManager.cleanupNodes(r),this._repository.setRootId(e.root.id),this._repository.updateVariables(e.variables?l.cloneDeep(e.variables):{}),this._repository.setEdited(!1),this._documentManager.setMetadata(e.metadata),this._documentManager.cacheDocument(e),this._repository.incrementVersion(),this._subscriptionManager.notifyVersion()}cancelEdit(e){const t=this._repository.getRootId(),n=e||(t?this._documentManager.getDocumentId(t):void 0);if(!n)return;const r=this._documentManager.getOriginalDocument(n);r&&this.updateLayout(r)}updateNodeState(e,t){const n=this.getNodeById(e);this._repository.updateNodeState(e,Object.assign(Object.assign({},n.state||{}),t)),this._repository.setEdited(!0),this._subscriptionManager.notifyNode(e)}updateNodeAttributes(e,t){const n=this.getNodeById(e);this._repository.updateNodeAttributes(e,Object.assign(Object.assign({},n.attributes||{}),t)),this._repository.setEdited(!0),this._subscriptionManager.notifyNode(e)}updateNodeReference(e,t){this.getNodeById(e),this._repository.updateNodeReference(e,t),this._repository.setEdited(!0),this._subscriptionManager.notifyNode(e)}updateVariables(e){this._variablesManager.updateVariables(e)}updateVariable(e,t){this._variablesManager.updateVariable(e,t)}deleteVariable(e){this._variablesManager.deleteVariable(e)}setSelectedNodeId(e){const t=this._repository.setSelectedNodeId(e);t&&this._subscriptionManager.notifyNode(t),e&&this._subscriptionManager.notifyNode(e)}getDocument(){return this._documentManager.getDocument(this._repository)}reset(){this._documentManager.reset(),this._repository.reset(),this._subscriptionManager.notifyVersion()}resetToInitial(){const e=this._repository.getRootId();if(!e)throw new Error("Root ID is not available. Cannot reset to initial state.");const t=this._documentManager.getDocumentId(e);if(!t)throw new Error("Document ID is not available. Cannot reset to initial state.");const n=this._documentManager.getOriginalDocument(t);if(!n)throw new Error("Initial document is not available. Cannot reset to initial state.");this.updateLayout(n)}}const zn=t.createContext(null),Un=({store:n,children:r})=>{const o=t.useMemo(()=>({store:n}),[n]);return e.jsx(zn.Provider,{value:o,children:r})},Hn=()=>{const e=t.useContext(zn);if(!e)throw new Error("useSduiLayoutContext must be used within SduiLayoutProvider");return e};const $n="none";function Gn(e){const{nodeId:n,schema:r}=e,o=(()=>{const{store:e}=Hn();return e})();return function(e,n){const r=t.useRef(null),o=t.useRef(null);t.useSyncExternalStore(t=>{const r=e.subscribeNode(n,t),o=e.subscribeVersion(t);return()=>{r(),o()}},()=>{var t;const o=null!==(t=e.getSnapshot()[n])&&void 0!==t?t:$n;return r.current===o?r.current:(r.current=o,o)},()=>{var t;return null===o.current&&(o.current=null!==(t=e.getServerSnapshot()[n])&&void 0!==t?t:$n),o.current})}(o,n),function(e,t,n){var r;const{nodes:o}=e.state,i=o[t],a=null!==(r=null==i?void 0:i.childrenIds)&&void 0!==r?r:[],s=null==i?void 0:i.state,l=null==i?void 0:i.attributes,u=null==i?void 0:i.reference;let c;if(n)if(i&&void 0!==s){const e=n.safeParse(s);if(!e.success)throw new Error(`State validation failed for node "${t}": ${e.error.message}`);c=e.data}else c={};else c=null!=s?s:{};return{node:i,type:null==i?void 0:i.type,state:c,childrenIds:a,attributes:l,reference:u,exists:!!i}}(o,n,r)}function Kn(e){return Gn(e)}const Xn=({nodeId:t,parentPath:n=[]})=>{const{type:r}=Kn({nodeId:t});return r?e.jsxs("div",{"data-sdui-node-id":t,"data-sdui-node-type":r,children:[e.jsxs("div",{children:["Type: ",r]}),e.jsxs("div",{children:["ID: ",t]})]}):null};Xn.displayName="DefaultNodeComponent";const Jn=(t,n)=>e.jsx(Xn,{nodeId:t,parentPath:n});function Qn(e,t){return[...e,t]}const Yn=({nodeId:e,componentMap:n,parentPath:r=[]})=>{const{store:o}=Hn(),{nodes:i}=o.state,a=t.useMemo(()=>Qn(r,e),[r,e]),s=t.useMemo(()=>function(e,t,n=" > "){return function(e,t=" > "){return e.join(t)}(Qn(e,t),n)}(r,e),[r,e]),l=t.useCallback((e,t=[])=>{const r=i[e];if(!r)return null;const a=o.getComponentOverrides(),s=n||{};return(a[e]||a[r.type]||s[r.type]||Jn)(e,t)},[i,o,n]),u=t.useCallback(e=>e.map(e=>{const n=l(e,a);return t.isValidElement(n)?t.cloneElement(n,{key:e}):n}),[l,a]);return{renderNode:l,renderChildren:u,currentPath:a,pathString:s,nodeId:e,parentPath:r}},Zn=({id:e,componentMap:t})=>{const{renderNode:n}=Yn({nodeId:e,componentMap:t,parentPath:[]});return n(e,[])},er=({nodeId:t,parentPath:n=[]})=>{const{type:r,childrenIds:o}=Kn({nodeId:t}),{renderNode:i,currentPath:a}=Yn({nodeId:t,parentPath:n});return r?e.jsxs("div",{"data-sdui-node-id":t,"data-sdui-node-type":r,children:[e.jsxs("div",{children:["Type: ",r]}),e.jsxs("div",{children:["ID: ",t]}),o&&o.length>0&&e.jsx("div",{children:o.map(t=>e.jsx("div",{children:i(t,a)},t))})]}):null};exports.TestDefaultNodeComponent=er,exports.createNestedTestDocument=function(){return{version:"1.0.0",metadata:{id:"nested-doc",name:"Nested Document"},root:{id:"root",type:"Container",children:[{id:"child-1",type:"Card",children:[{id:"grandchild-1",type:"Panel"}]},{id:"child-2",type:"Card"}]}}},exports.createTestDocument=function(e){const t={id:"root",type:"Container",children:[]},n=(null==e?void 0:e.root)?Object.assign(Object.assign({},t),e.root):t;return Object.assign(Object.assign({version:"1.0.0",metadata:{id:"test-doc",name:"Test Document"}},e),{root:n})},exports.defaultTestComponentFactory=(t,n)=>e.jsx(er,{nodeId:t,parentPath:n}),exports.renderWithSduiLayout=function(t,n,r){var o;const{components:i,componentOverrides:a,onError:s}=n||{},l={componentOverrides:Object.assign(Object.assign({},i),a)},u=new Wn(void 0,l);try{u.updateLayout(t)}catch(e){s&&s(e instanceof Error?e:new Error(String(e)))}const c=i||{},d=null===(o=null==t?void 0:t.root)||void 0===o?void 0:o.id;return jn(d?e.jsxs(Un,{store:u,children:[e.jsx(Zn,{id:d,componentMap:c}),r]}):e.jsx("div",{children:"Invalid document: missing root.id"}))};
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),t=require("react"),n=require("react-dom/test-utils"),r=require("react-dom"),o=require("react-dom/client"),i=require("pretty-format"),a=require("aria-query"),s=require("lz-string"),l=require("lodash-es"),u=require("normalizr");function c(e){var t=Object.create(null);return e&&Object.keys(e).forEach(function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,Object.freeze(t)}var d=c(t),b=c(n),p=c(o),f=c(i),h=Object.prototype.toString;var y=Math.pow(2,53)-1;function m(e){var t=function(e){var t=Number(e);return isNaN(t)?0:0!==t&&isFinite(t)?(t>0?1:-1)*Math.floor(Math.abs(t)):t}(e);return Math.min(Math.max(t,0),y)}function v(e,t){var n=Array,r=Object(e);if(null==e)throw new TypeError("Array.from requires an array-like object - not null or undefined");for(var o,i,a=m(r.length),s="function"==typeof(o=n)||"[object Function]"===h.call(o)?Object(new n(a)):new Array(a),l=0;l<a;)i=r[l],s[l]=i,l+=1;return s.length=a,s}function g(e){return g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},g(e)}function E(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,w(r.key),r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function w(e){var t=function(e,t){if("object"!==g(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t);if("object"!==g(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===g(t)?t:String(t)}var T="undefined"==typeof Set?Set:function(){function e(){var t,n,r,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),t=this,r=void 0,(n=w(n="items"))in t?Object.defineProperty(t,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[n]=r,this.items=o}return E(e,[{key:"add",value:function(e){return!1===this.has(e)&&this.items.push(e),this}},{key:"clear",value:function(){this.items=[]}},{key:"delete",value:function(e){var t=this.items.length;return this.items=this.items.filter(function(t){return t!==e}),t!==this.items.length}},{key:"forEach",value:function(e){var t=this;this.items.forEach(function(n){e(n,n,t)})}},{key:"has",value:function(e){return-1!==this.items.indexOf(e)}},{key:"size",get:function(){return this.items.length}}]),e}();function I(e){var t;return null!==(t=e.localName)&&void 0!==t?t:e.tagName.toLowerCase()}var S={article:"article",aside:"complementary",button:"button",datalist:"listbox",dd:"definition",details:"group",dialog:"dialog",dt:"term",fieldset:"group",figure:"figure",form:"form",footer:"contentinfo",h1:"heading",h2:"heading",h3:"heading",h4:"heading",h5:"heading",h6:"heading",header:"banner",hr:"separator",html:"document",legend:"legend",li:"listitem",math:"math",main:"main",menu:"list",nav:"navigation",ol:"list",optgroup:"group",option:"option",output:"status",progress:"progressbar",section:"region",summary:"button",table:"table",tbody:"rowgroup",textarea:"textbox",tfoot:"rowgroup",td:"cell",th:"columnheader",thead:"rowgroup",tr:"row",ul:"list"},A={caption:new Set(["aria-label","aria-labelledby"]),code:new Set(["aria-label","aria-labelledby"]),deletion:new Set(["aria-label","aria-labelledby"]),emphasis:new Set(["aria-label","aria-labelledby"]),generic:new Set(["aria-label","aria-labelledby","aria-roledescription"]),insertion:new Set(["aria-label","aria-labelledby"]),paragraph:new Set(["aria-label","aria-labelledby"]),presentation:new Set(["aria-label","aria-labelledby"]),strong:new Set(["aria-label","aria-labelledby"]),subscript:new Set(["aria-label","aria-labelledby"]),superscript:new Set(["aria-label","aria-labelledby"])};function _(e,t){return function(e,t){return["aria-atomic","aria-busy","aria-controls","aria-current","aria-describedby","aria-details","aria-dropeffect","aria-flowto","aria-grabbed","aria-hidden","aria-keyshortcuts","aria-label","aria-labelledby","aria-live","aria-owns","aria-relevant","aria-roledescription"].some(function(n){var r;return e.hasAttribute(n)&&!(null!==(r=A[t])&&void 0!==r&&r.has(n))})}(e,t)}function O(e){var t=function(e){var t=e.getAttribute("role");if(null!==t){var n=t.trim().split(" ")[0];if(n.length>0)return n}return null}(e);if(null===t||"presentation"===t){var n=function(e){var t=S[I(e)];if(void 0!==t)return t;switch(I(e)){case"a":case"area":case"link":if(e.hasAttribute("href"))return"link";break;case"img":return""!==e.getAttribute("alt")||_(e,"img")?"img":"presentation";case"input":var n=e.type;switch(n){case"button":case"image":case"reset":case"submit":return"button";case"checkbox":case"radio":return n;case"range":return"slider";case"email":case"tel":case"text":case"url":return e.hasAttribute("list")?"combobox":"textbox";case"search":return e.hasAttribute("list")?"combobox":"searchbox";case"number":return"spinbutton";default:return null}case"select":return e.hasAttribute("multiple")||e.size>1?"listbox":"combobox"}return null}(e);if("presentation"!==t||_(e,n||""))return n}return t}function x(e){return null!==e&&e.nodeType===e.ELEMENT_NODE}function j(e){return x(e)&&"caption"===I(e)}function N(e){return x(e)&&"input"===I(e)}function M(e){return x(e)&&"legend"===I(e)}function C(e){return function(e){return x(e)&&void 0!==e.ownerSVGElement}(e)&&"title"===I(e)}function D(e,t){if(x(e)&&e.hasAttribute(t)){var n=e.getAttribute(t).split(" "),r=e.getRootNode?e.getRootNode():e.ownerDocument;return n.map(function(e){return r.getElementById(e)}).filter(function(e){return null!==e})}return[]}function k(e,t){return!!x(e)&&-1!==t.indexOf(O(e))}function P(e,t){if(!x(e))return!1;if("range"===t)return k(e,["meter","progressbar","scrollbar","slider","spinbutton"]);throw new TypeError("No knowledge about abstract role '".concat(t,"'. This is likely a bug :("))}function B(e,t){var n=v(e.querySelectorAll(t));return D(e,"aria-owns").forEach(function(e){n.push.apply(n,v(e.querySelectorAll(t)))}),n}function L(e){return x(t=e)&&"select"===I(t)?e.selectedOptions||B(e,"[selected]"):B(e,'[aria-selected="true"]');var t}function R(e){return N(e)||x(t=e)&&"textarea"===I(t)?e.value:e.textContent||"";var t}function q(e){var t=e.getPropertyValue("content");return/^["'].*["']$/.test(t)?t.slice(1,-1):""}function V(e){var t=I(e);return"button"===t||"input"===t&&"hidden"!==e.getAttribute("type")||"meter"===t||"output"===t||"progress"===t||"select"===t||"textarea"===t}function F(e){if(V(e))return e;var t=null;return e.childNodes.forEach(function(e){if(null===t&&x(e)){var n=F(e);null!==n&&(t=n)}}),t}function W(e){if(void 0!==e.control)return e.control;var t=e.getAttribute("for");return null!==t?e.ownerDocument.getElementById(t):F(e)}function z(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=new T,r=function(e){var t=(null===e.ownerDocument?e:e.ownerDocument).defaultView;if(null===t)throw new TypeError("no window available");return t}(e),o=t.compute,i=void 0===o?"name":o,a=t.computedStyleSupportsPseudoElements,s=void 0===a?void 0!==t.getComputedStyle:a,l=t.getComputedStyle,u=void 0===l?r.getComputedStyle.bind(r):l,c=t.hidden,d=void 0!==c&&c;function b(e,t){var n,r,o="";if(x(e)&&s){var i=q(u(e,"::before"));o="".concat(i," ").concat(o)}if((function(e){return x(e)&&"slot"===I(e)}(e)?0===(r=(n=e).assignedNodes()).length?v(n.childNodes):r:v(e.childNodes).concat(D(e,"aria-owns"))).forEach(function(e){var n=h(e,{isEmbeddedInLabel:t.isEmbeddedInLabel,isReferenced:!1,recursion:!0}),r="inline"!==(x(e)?u(e).getPropertyValue("display"):"inline")?" ":"";o+="".concat(r).concat(n).concat(r)}),x(e)&&s){var a=q(u(e,"::after"));o="".concat(o," ").concat(a)}return o.trim()}function p(e,t){var r=e.getAttributeNode(t);return null===r||n.has(r)||""===r.value.trim()?null:(n.add(r),r.value)}function f(e){if(!x(e))return null;if(function(e){return x(e)&&"fieldset"===I(e)}(e)){n.add(e);for(var t=v(e.childNodes),r=0;r<t.length;r+=1){var o=t[r];if(M(o))return h(o,{isEmbeddedInLabel:!1,isReferenced:!1,recursion:!1})}}else if(function(e){return x(e)&&"table"===I(e)}(e)){n.add(e);for(var i=v(e.childNodes),a=0;a<i.length;a+=1){var s=i[a];if(j(s))return h(s,{isEmbeddedInLabel:!1,isReferenced:!1,recursion:!1})}}else{if(function(e){return x(e)&&"svg"===I(e)}(e)){n.add(e);for(var l=v(e.childNodes),u=0;u<l.length;u+=1){var c=l[u];if(C(c))return c.textContent}return null}if("img"===I(e)||"area"===I(e)){var d=p(e,"alt");if(null!==d)return d}else if(function(e){return x(e)&&"optgroup"===I(e)}(e)){var f=p(e,"label");if(null!==f)return f}}if(N(e)&&("button"===e.type||"submit"===e.type||"reset"===e.type)){var y=p(e,"value");if(null!==y)return y;if("submit"===e.type)return"Submit";if("reset"===e.type)return"Reset"}var m,g,E=null===(g=(m=e).labels)?g:void 0!==g?v(g):V(m)?v(m.ownerDocument.querySelectorAll("label")).filter(function(e){return W(e)===m}):null;if(null!==E&&0!==E.length)return n.add(e),v(E).map(function(e){return h(e,{isEmbeddedInLabel:!0,isReferenced:!1,recursion:!0})}).filter(function(e){return e.length>0}).join(" ");if(N(e)&&"image"===e.type){var w=p(e,"alt");if(null!==w)return w;var T=p(e,"title");return null!==T?T:"Submit Query"}if(k(e,["button"])){var S=b(e,{isEmbeddedInLabel:!1});if(""!==S)return S}return null}function h(e,t){if(n.has(e))return"";if(!d&&function(e,t){if(!x(e))return!1;if(e.hasAttribute("hidden")||"true"===e.getAttribute("aria-hidden"))return!0;var n=t(e);return"none"===n.getPropertyValue("display")||"hidden"===n.getPropertyValue("visibility")}(e,u)&&!t.isReferenced)return n.add(e),"";var r=x(e)?e.getAttributeNode("aria-labelledby"):null,o=null===r||n.has(r)?[]:D(e,"aria-labelledby");if("name"===i&&!t.isReferenced&&o.length>0)return n.add(r),o.map(function(e){return h(e,{isEmbeddedInLabel:t.isEmbeddedInLabel,isReferenced:!0,recursion:!1})}).join(" ");var a,s=t.recursion&&(k(a=e,["button","combobox","listbox","textbox"])||P(a,"range"))&&"name"===i;if(!s){var l=(x(e)&&e.getAttribute("aria-label")||"").trim();if(""!==l&&"name"===i)return n.add(e),l;if(!function(e){return k(e,["none","presentation"])}(e)){var c=f(e);if(null!==c)return n.add(e),c}}if(k(e,["menu"]))return n.add(e),"";if(s||t.isEmbeddedInLabel||t.isReferenced){if(k(e,["combobox","listbox"])){n.add(e);var y=L(e);return 0===y.length?N(e)?e.value:"":v(y).map(function(e){return h(e,{isEmbeddedInLabel:t.isEmbeddedInLabel,isReferenced:!1,recursion:!0})}).join(" ")}if(P(e,"range"))return n.add(e),e.hasAttribute("aria-valuetext")?e.getAttribute("aria-valuetext"):e.hasAttribute("aria-valuenow")?e.getAttribute("aria-valuenow"):e.getAttribute("value")||"";if(k(e,["textbox"]))return n.add(e),R(e)}if(function(e){return k(e,["button","cell","checkbox","columnheader","gridcell","heading","label","legend","link","menuitem","menuitemcheckbox","menuitemradio","option","radio","row","rowheader","switch","tab","tooltip","treeitem"])}(e)||x(e)&&t.isReferenced||function(e){return j(e)}(e)){var m=b(e,{isEmbeddedInLabel:t.isEmbeddedInLabel});if(""!==m)return n.add(e),m}if(e.nodeType===e.TEXT_NODE)return n.add(e),e.textContent||"";if(t.recursion)return n.add(e),b(e,{isEmbeddedInLabel:t.isEmbeddedInLabel});var g=function(e){return x(e)?p(e,"title"):null}(e);return null!==g?(n.add(e),g):(n.add(e),"")}return h(e,{isEmbeddedInLabel:!1,isReferenced:"description"===i,recursion:!1}).trim().replace(/\s\s+/g," ")}function U(e){return U="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},U(e)}function H(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function $(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?H(Object(n),!0).forEach(function(t){G(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):H(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function G(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==U(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t);if("object"!==U(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===U(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function K(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=D(e,"aria-describedby").map(function(e){return z(e,$($({},t),{},{compute:"description"}))}).join(" ");if(""===n){var r=e.getAttribute("title");n=null===r?"":r}return n}function X(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return k(e,["caption","code","deletion","emphasis","generic","insertion","paragraph","presentation","strong","subscript","superscript"])?"":z(e,t)}function J(e){return e.replace(/</g,"<").replace(/>/g,">")}const Q=(e,t)=>{const n=t.colors.content;return n.open+J(e)+n.close},Y=/^((HTML|SVG)\w*)?Element$/,Z=e=>{const{tagName:t}=e;return Boolean("string"==typeof t&&t.includes("-")||"function"==typeof e.hasAttribute&&e.hasAttribute("is"))};function ee(e){return 11===e.nodeType}function te(e){return{test:e=>{var t;return((null==e||null==(t=e.constructor)?void 0:t.name)||Z(e))&&(e=>{const t=e.constructor.name,{nodeType:n}=e;return 1===n&&(Y.test(t)||Z(e))||3===n&&"Text"===t||8===n&&"Comment"===t||11===n&&"DocumentFragment"===t})(e)},serialize:(t,n,r,o,i,a)=>{if(function(e){return 3===e.nodeType}(t))return Q(t.data,n);if(function(e){return 8===e.nodeType}(t))return((e,t)=>{const n=t.colors.comment;return n.open+"\x3c!--"+J(e)+"--\x3e"+n.close})(t.data,n);const s=ee(t)?"DocumentFragment":t.tagName.toLowerCase();return++o>n.maxDepth?((e,t)=>{const n=t.colors.tag;return n.open+"<"+e+n.close+" …"+n.open+" />"+n.close})(s,n):((e,t,n,r,o)=>{const i=r.colors.tag;return i.open+"<"+e+(t&&i.close+t+r.spacingOuter+o+i.open)+(n?">"+i.close+n+r.spacingOuter+o+i.open+"</"+e:(t&&!r.min?"":" ")+"/")+">"+i.close})(s,((e,t,n,r,o,i,a)=>{const s=r+n.indent,l=n.colors;return e.map(e=>{const u=t[e];let c=a(u,n,s,o,i);return"string"!=typeof u&&(-1!==c.indexOf("\n")&&(c=n.spacingOuter+s+c+n.spacingOuter+r),c="{"+c+"}"),n.spacingInner+r+l.prop.open+e+l.prop.close+"="+l.value.open+c+l.value.close}).join("")})(ee(t)?[]:Array.from(t.attributes).map(e=>e.name).sort(),ee(t)?{}:Array.from(t.attributes).reduce((e,t)=>(e[t.name]=t.value,e),{}),n,r+n.indent,o,i,a),((e,t,n,r,o,i)=>e.map(e=>{const a="string"==typeof e?Q(e,t):i(e,t,n,r,o);return""===a&&"object"==typeof e&&null!==e&&3!==e.nodeType?"":t.spacingOuter+n+a}).join(""))(Array.prototype.slice.call(t.childNodes||t.children).filter(e),n,r+n.indent,o,i,a),n,r)}}}let ne=null,re=null,oe=null;try{const e=module&&module.require;re=e.call(module,"fs").readFileSync,oe=e.call(module,"@babel/code-frame").codeFrameColumns,ne=e.call(module,"picocolors")}catch{}function ie(){if(!re||!oe)return"";return function(e){const t=e.indexOf("(")+1,n=e.indexOf(")"),r=e.slice(t,n),o=r.split(":"),[i,a,s]=[o[0],parseInt(o[1],10),parseInt(o[2],10)];let l="";try{l=re(i,"utf-8")}catch{return""}const u=oe(l,{start:{line:a,column:s}},{highlightCode:!0,linesBelow:0});return ne.dim(r)+"\n"+u+"\n"}((new Error).stack.split("\n").slice(1).find(e=>!e.includes("node_modules/")))}function ae(){return"undefined"!=typeof jest&&null!==jest&&(!0===setTimeout._isMockFunction||Object.prototype.hasOwnProperty.call(setTimeout,"clock"))}function se(){if("undefined"==typeof window)throw new Error("Could not find default container");return window.document}function le(e){if(e.defaultView)return e.defaultView;if(e.ownerDocument&&e.ownerDocument.defaultView)return e.ownerDocument.defaultView;if(e.window)return e.window;throw e.ownerDocument&&null===e.ownerDocument.defaultView?new Error("It looks like the window object is not available for the provided node."):e.then instanceof Function?new Error("It looks like you passed a Promise object instead of a DOM node. Did you do something like `fireEvent.click(screen.findBy...` when you meant to use a `getBy` query `fireEvent.click(screen.getBy...`, or await the findBy query `fireEvent.click(await screen.findBy...`?"):Array.isArray(e)?new Error("It looks like you passed an Array instead of a DOM node. Did you do something like `fireEvent.click(screen.getAllBy...` when you meant to use a `getBy` query `fireEvent.click(screen.getBy...`?"):"function"==typeof e.debug&&"function"==typeof e.logTestingPlaygroundURL?new Error("It looks like you passed a `screen` object. Did you do something like `fireEvent.click(screen, ...` when you meant to use a query, e.g. `fireEvent.click(screen.getBy..., `?"):new Error("The given node is not an Element, the node type is: "+typeof e+".")}function ue(e){if(!e||"function"!=typeof e.querySelector||"function"!=typeof e.querySelectorAll)throw new TypeError("Expected container to be an Element, a Document or a DocumentFragment but got "+function(e){if("object"==typeof e)return null===e?"null":e.constructor.name;return typeof e}(e)+".")}const ce=()=>{if("undefined"==typeof process)return!1;let e;try{var t;const n=null==(t=process.env)?void 0:t.COLORS;n&&(e=JSON.parse(n))}catch{}return"boolean"==typeof e?e:void 0!==process.versions&&void 0!==process.versions.node},{DOMCollection:de}=f.plugins;function be(e){return 8!==e.nodeType&&(1!==e.nodeType||!e.matches(ye().defaultIgnore))}function pe(e,t,n){if(void 0===n&&(n={}),e||(e=se().body),"number"!=typeof t&&(t="undefined"!=typeof process&&void 0!==process.env&&process.env.DEBUG_PRINT_LIMIT||7e3),0===t)return"";e.documentElement&&(e=e.documentElement);let r=typeof e;if("object"===r?r=e.constructor.name:e={},!("outerHTML"in e))throw new TypeError("Expected an element or document but got "+r);const{filterNode:o=be,...i}=n,a=f.format(e,{plugins:[te(o),de],printFunctionName:!1,highlight:ce(),...i});return void 0!==t&&e.outerHTML.length>t?a.slice(0,t)+"...":a}const fe=function(){const e=ie();e?console.log(pe(...arguments)+"\n\n"+e):console.log(pe(...arguments))};let he={testIdAttribute:"data-testid",asyncUtilTimeout:1e3,asyncWrapper:e=>e(),unstable_advanceTimersWrapper:e=>e(),eventWrapper:e=>e(),defaultHidden:!1,defaultIgnore:"script, style",showOriginalStackTrace:!1,throwSuggestions:!1,getElementError(e,t){const n=pe(t),r=new Error([e,"Ignored nodes: comments, "+he.defaultIgnore+"\n"+n].filter(Boolean).join("\n\n"));return r.name="TestingLibraryElementError",r},_disableExpensiveErrorDiagnostics:!1,computedStyleSupportsPseudoElements:!1};function ye(){return he}const me=["button","meter","output","progress","select","textarea","input"];function ve(e){return me.includes(e.nodeName.toLowerCase())?"":3===e.nodeType?e.textContent:Array.from(e.childNodes).map(e=>ve(e)).join("")}function ge(e){let t;return t="label"===e.tagName.toLowerCase()?ve(e):e.value||e.textContent,t}function Ee(e){var t;if(void 0!==e.labels)return null!=(t=e.labels)?t:[];if(!function(e){return/BUTTON|METER|OUTPUT|PROGRESS|SELECT|TEXTAREA/.test(e.tagName)||"INPUT"===e.tagName&&"hidden"!==e.getAttribute("type")}(e))return[];const n=e.ownerDocument.querySelectorAll("label");return Array.from(n).filter(t=>t.control===e)}function we(e,t,n){let{selector:r="*"}=void 0===n?{}:n;const o=t.getAttribute("aria-labelledby"),i=o?o.split(" "):[];return i.length?i.map(t=>{const n=e.querySelector('[id="'+t+'"]');return n?{content:ge(n),formControl:null}:{content:"",formControl:null}}):Array.from(Ee(t)).map(e=>({content:ge(e),formControl:Array.from(e.querySelectorAll("button, input, meter, output, progress, select, textarea")).filter(e=>e.matches(r))[0]}))}function Te(e){if(null==e)throw new Error("It looks like "+e+" was passed instead of a matcher. Did you do something like getByText("+e+")?")}function Ie(e,t,n,r){if("string"!=typeof e)return!1;Te(n);const o=r(e);return"string"==typeof n||"number"==typeof n?o.toLowerCase().includes(n.toString().toLowerCase()):"function"==typeof n?n(o,t):Oe(n,o)}function Se(e,t,n,r){if("string"!=typeof e)return!1;Te(n);const o=r(e);return n instanceof Function?n(o,t):n instanceof RegExp?Oe(n,o):o===String(n)}function Ae(e){let{trim:t=!0,collapseWhitespace:n=!0}=void 0===e?{}:e;return e=>{let r=e;return r=t?r.trim():r,r=n?r.replace(/\s+/g," "):r,r}}function _e(e){let{trim:t,collapseWhitespace:n,normalizer:r}=e;if(!r)return Ae({trim:t,collapseWhitespace:n});if(void 0!==t||void 0!==n)throw new Error('trim and collapseWhitespace are not supported with a normalizer. If you want to use the default trim and collapseWhitespace logic in your normalizer, use "getDefaultNormalizer({trim, collapseWhitespace})" and compose that into your normalizer');return r}function Oe(e,t){const n=e.test(t);return e.global&&0!==e.lastIndex&&(console.warn("To match all elements we had to reset the lastIndex of the RegExp because the global flag is enabled. We encourage to remove the global flag from the RegExp."),e.lastIndex=0),n}function xe(e){return e.matches("input[type=submit], input[type=button], input[type=reset]")?e.value:Array.from(e.childNodes).filter(e=>3===e.nodeType&&Boolean(e.textContent)).map(e=>e.textContent).join("")}const je=function(e){function t(e){let{attributes:t=[]}=e;return t.length}function n(e){let{attributes:t=[]}=e;const n=t.findIndex(e=>e.value&&"type"===e.name&&"text"===e.value);n>=0&&(t=[...t.slice(0,n),...t.slice(n+1)]);const r=function(e){let{name:t,attributes:n}=e;return""+t+n.map(e=>{let{name:t,value:n,constraints:r=[]}=e;const o=-1!==r.indexOf("undefined"),i=-1!==r.indexOf("set");return void 0!==n?"["+t+'="'+n+'"]':o?":not(["+t+"])":i?"["+t+"]:not(["+t+'=""])':"["+t+"]"}).join("")}({...e,attributes:t});return e=>!(n>=0&&"text"!==e.type)&&e.matches(r)}let r=[];for(const[o,i]of e.entries())r=[...r,{match:n(o),roles:Array.from(i),specificity:t(o)}];return r.sort(function(e,t){let{specificity:n}=e,{specificity:r}=t;return r-n})}(a.elementRoles);function Ne(e){if(!0===e.hidden)return!0;if("true"===e.getAttribute("aria-hidden"))return!0;return"none"===e.ownerDocument.defaultView.getComputedStyle(e).display}function Me(e,t){void 0===t&&(t={});const{isSubtreeInaccessible:n=Ne}=t;if("hidden"===e.ownerDocument.defaultView.getComputedStyle(e).visibility)return!0;let r=e;for(;r;){if(n(r))return!0;r=r.parentElement}return!1}function Ce(e){for(const{match:t,roles:n}of je)if(t(e))return[...n];return[]}function De(e,t){let{hidden:n,includeDescription:r}=t;const o=function(e,t){let{hidden:n=!1}=void 0===t?{}:t;return function e(t){return[t,...Array.from(t.children).reduce((t,n)=>[...t,...e(n)],[])]}(e).filter(e=>!1!==n||!1===Me(e)).reduce((e,t)=>{let n=[];return n=t.hasAttribute("role")?t.getAttribute("role").split(" ").slice(0,1):Ce(t),n.reduce((e,n)=>Array.isArray(e[n])?{...e,[n]:[...e[n],t]}:{...e,[n]:[t]},e)},{})}(e,{hidden:n});return Object.entries(o).filter(e=>{let[t]=e;return"generic"!==t}).map(e=>{let[t,n]=e;const o="-".repeat(50);return t+":\n\n"+n.map(e=>{const t='Name "'+X(e,{computedStyleSupportsPseudoElements:ye().computedStyleSupportsPseudoElements})+'":\n',n=pe(e.cloneNode(!1));if(r){return""+t+('Description "'+K(e,{computedStyleSupportsPseudoElements:ye().computedStyleSupportsPseudoElements})+'":\n')+n}return""+t+n}).join("\n\n")+"\n\n"+o}).join("\n")}function ke(e,t){const n=e.getAttribute(t);return"true"===n||"false"!==n&&void 0}const Pe=Ae();function Be(e){return new RegExp(function(e){return e.replace(/[.*+\-?^${}()|[\]\\]/g,"\\$&")}(e.toLowerCase()),"i")}function Le(e,t,n,r){let{variant:o,name:i}=r,a="";const s={},l=[["Role","TestId"].includes(e)?n:Be(n)];i&&(s.name=Be(i)),"Role"===e&&Me(t)&&(s.hidden=!0,a="Element is inaccessible. This means that the element and all its children are invisible to screen readers.\n If you are using the aria-hidden prop, make sure this is the right choice for your case.\n "),Object.keys(s).length>0&&l.push(s);const u=o+"By"+e;return{queryName:e,queryMethod:u,queryArgs:l,variant:o,warning:a,toString(){a&&console.warn(a);let[e,t]=l;return e="string"==typeof e?"'"+e+"'":e,t=t?", { "+Object.entries(t).map(e=>{let[t,n]=e;return t+": "+n}).join(", ")+" }":"",u+"("+e+t+")"}}}function Re(e,t,n){return n&&!0}function qe(e,t,n){var r,o;if(void 0===t&&(t="get"),e.matches(ye().defaultIgnore))return;const i=null!=(r=e.getAttribute("role"))?r:null==(o=Ce(e))?void 0:o[0];if("generic"!==i&&Re(0,0,i))return Le("Role",e,i,{variant:t,name:X(e,{computedStyleSupportsPseudoElements:ye().computedStyleSupportsPseudoElements})});const a=we(document,e).map(e=>e.content).join(" ");if(Re(0,0,a))return Le("LabelText",e,a,{variant:t});const s=e.getAttribute("placeholder");if(Re(0,0,s))return Le("PlaceholderText",e,s,{variant:t});const l=Pe(xe(e));if(Re(0,0,l))return Le("Text",e,l,{variant:t});if(Re(0,0,e.value))return Le("DisplayValue",e,Pe(e.value),{variant:t});const u=e.getAttribute("alt");if(Re(0,0,u))return Le("AltText",e,u,{variant:t});const c=e.getAttribute("title");if(Re(0,0,c))return Le("Title",e,c,{variant:t});const d=e.getAttribute(ye().testIdAttribute);return Re(0,0,d)?Le("TestId",e,d,{variant:t}):void 0}function Ve(e,t){e.stack=t.stack.replace(t.message,e.message)}function Fe(e,t){let{container:n=se(),timeout:r=ye().asyncUtilTimeout,showOriginalStackTrace:o=ye().showOriginalStackTrace,stackTraceError:i,interval:a=50,onTimeout:s=e=>(Object.defineProperty(e,"message",{value:ye().getElementError(e.message,n).message}),e),mutationObserverOptions:l={subtree:!0,childList:!0,attributes:!0,characterData:!0}}=t;if("function"!=typeof e)throw new TypeError("Received `callback` arg must be a function");return new Promise(async(t,u)=>{let c,d,b,p=!1,f="idle";const h=setTimeout(function(){let e;c?(e=c,o||"TestingLibraryElementError"!==e.name||Ve(e,i)):(e=new Error("Timed out in waitFor."),o||Ve(e,i));m(s(e),null)},r),y=ae();if(y){const{unstable_advanceTimersWrapper:e}=ye();for(g();!p;){if(!ae()){const e=new Error("Changed from using fake timers to real timers while using waitFor. This is not allowed and will result in very strange behavior. Please ensure you're awaiting all async things your test is doing before changing to real timers. For more info, please go to https://github.com/testing-library/dom-testing-library/issues/830");return o||Ve(e,i),void u(e)}if(await e(async()=>{jest.advanceTimersByTime(a)}),p)break;g()}}else{try{ue(n)}catch(e){return void u(e)}d=setInterval(v,a);const{MutationObserver:e}=le(n);b=new e(v),b.observe(n,l),g()}function m(e,n){p=!0,clearTimeout(h),y||(clearInterval(d),b.disconnect()),e?u(e):t(n)}function v(){if(ae()){const e=new Error("Changed from using real timers to fake timers while using waitFor. This is not allowed and will result in very strange behavior. Please ensure you're awaiting all async things your test is doing before changing to fake timers. For more info, please go to https://github.com/testing-library/dom-testing-library/issues/830");return o||Ve(e,i),u(e)}return g()}function g(){if("pending"!==f)try{const t=function(e){try{return he._disableExpensiveErrorDiagnostics=!0,e()}finally{he._disableExpensiveErrorDiagnostics=!1}}(e);"function"==typeof(null==t?void 0:t.then)?(f="pending",t.then(e=>{f="resolved",m(null,e)},e=>{f="rejected",c=e})):m(null,t)}catch(e){c=e}}})}function We(e,t){return ye().getElementError(e,t)}function ze(e,t,n,r){let{exact:o=!0,collapseWhitespace:i,trim:a,normalizer:s}=void 0===r?{}:r;const l=o?Se:Ie,u=_e({collapseWhitespace:i,trim:a,normalizer:s});return Array.from(t.querySelectorAll("["+e+"]")).filter(t=>l(t.getAttribute(e),t,n,u))}function Ue(e,t){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];const a=e(n,...o);if(a.length>1){const e=a.map(e=>We(null,e).message).join("\n\n");throw function(e,t){return We(e+"\n\n(If this is intentional, then use the `*AllBy*` variant of the query (like `queryAllByText`, `getAllByText`, or `findAllByText`)).",t)}(t(n,...o)+"\n\nHere are the matching elements:\n\n"+e,n)}return a[0]||null}}function He(e,t){return ye().getElementError("A better query is available, try this:\n"+e.toString()+"\n",t)}function $e(e){return(t,n,r,o)=>function(e,t){const n=new Error("STACK_TRACE_MESSAGE");return ye().asyncWrapper(()=>Fe(e,{stackTraceError:n,...t}))}(()=>e(t,n,r),{container:t,...o})}const Ge=(e,t,n)=>function(r){for(var o=arguments.length,i=new Array(o>1?o-1:0),a=1;a<o;a++)i[a-1]=arguments[a];const s=e(r,...i),[{suggest:l=ye().throwSuggestions}={}]=i.slice(-1);if(s&&l){const e=qe(s,n);if(e&&!t.endsWith(e.queryName))throw He(e.toString(),r)}return s},Ke=(e,t,n)=>function(r){for(var o=arguments.length,i=new Array(o>1?o-1:0),a=1;a<o;a++)i[a-1]=arguments[a];const s=e(r,...i),[{suggest:l=ye().throwSuggestions}={}]=i.slice(-1);if(s.length&&l){const e=[...new Set(s.map(e=>{var t;return null==(t=qe(e,n))?void 0:t.toString()}))];if(1===e.length&&!t.endsWith(qe(s[0],n).queryName))throw He(e[0],r)}return s};function Xe(e,t,n){const r=Ge(Ue(e,t),e.name,"query"),o=function(e,t){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];const a=e(n,...o);if(!a.length)throw ye().getElementError(t(n,...o),n);return a}}(e,n),i=Ue(o,t),a=Ge(i,e.name,"get");return[r,Ke(o,e.name.replace("query","get"),"getAll"),a,$e(Ke(o,e.name,"findAll")),$e(Ge(i,e.name,"find"))]}const Je=function(e,t,n){let{exact:r=!0,trim:o,collapseWhitespace:i,normalizer:a}=void 0===n?{}:n;const s=r?Se:Ie,l=_e({collapseWhitespace:i,trim:o,normalizer:a}),u=function(e){return Array.from(e.querySelectorAll("label,input")).map(e=>({node:e,textToMatch:ge(e)})).filter(e=>{let{textToMatch:t}=e;return null!==t})}(e);return u.filter(e=>{let{node:n,textToMatch:r}=e;return s(r,n,t,l)}).map(e=>{let{node:t}=e;return t})},Qe=function(e,t,n){let{selector:r="*",exact:o=!0,collapseWhitespace:i,trim:a,normalizer:s}=void 0===n?{}:n;ue(e);const l=o?Se:Ie,u=_e({collapseWhitespace:i,trim:a,normalizer:s}),c=Array.from(e.querySelectorAll("*")).filter(e=>Ee(e).length||e.hasAttribute("aria-labelledby")).reduce((n,o)=>{const i=we(e,o,{selector:r});i.filter(e=>Boolean(e.formControl)).forEach(e=>{l(e.content,e.formControl,t,u)&&e.formControl&&n.push(e.formControl)});const a=i.filter(e=>Boolean(e.content)).map(e=>e.content);return l(a.join(" "),o,t,u)&&n.push(o),a.length>1&&a.forEach((e,r)=>{l(e,o,t,u)&&n.push(o);const i=[...a];i.splice(r,1),i.length>1&&l(i.join(" "),o,t,u)&&n.push(o)}),n},[]).concat(ze("aria-label",e,t,{exact:o,normalizer:u}));return Array.from(new Set(c)).filter(e=>e.matches(r))},Ye=function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];const i=Qe(e,t,...r);if(!i.length){const n=Je(e,t,...r);if(n.length){const r=n.map(t=>function(e,t){const n=t.getAttribute("for");if(!n)return null;const r=e.querySelector('[id="'+n+'"]');return r?r.tagName.toLowerCase():null}(e,t)).filter(e=>!!e);throw r.length?ye().getElementError(r.map(e=>"Found a label with the text of: "+t+", however the element associated with this label (<"+e+" />) is non-labellable [https://html.spec.whatwg.org/multipage/forms.html#category-label]. If you really need to label a <"+e+" />, you can use aria-label or aria-labelledby instead.").join("\n\n"),e):ye().getElementError("Found a label with the text of: "+t+', however no form control was found associated to that label. Make sure you\'re using the "for" attribute or "aria-labelledby" attribute correctly.',e)}throw ye().getElementError("Unable to find a label with the text of: "+t,e)}return i};const Ze=(e,t)=>"Found multiple elements with the text of: "+t,et=Ge(Ue(Qe,Ze),Qe.name,"query"),tt=Ue(Ye,Ze),nt=$e(Ke(Ye,Ye.name,"findAll")),rt=$e(Ge(tt,Ye.name,"find")),ot=Ke(Ye,Ye.name,"getAll"),it=Ge(tt,Ye.name,"get"),at=Ke(Qe,Qe.name,"queryAll"),st=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return ue(t[0]),ze("placeholder",...t)},lt=Ke(st,st.name,"queryAll"),[ut,ct,dt,bt,pt]=Xe(st,(e,t)=>"Found multiple elements with the placeholder text of: "+t,(e,t)=>"Unable to find an element with the placeholder text of: "+t),ft=function(e,t,n){let{selector:r="*",exact:o=!0,collapseWhitespace:i,trim:a,ignore:s=ye().defaultIgnore,normalizer:l}=void 0===n?{}:n;ue(e);const u=o?Se:Ie,c=_e({collapseWhitespace:i,trim:a,normalizer:l});let d=[];return"function"==typeof e.matches&&e.matches(r)&&(d=[e]),[...d,...Array.from(e.querySelectorAll(r))].filter(e=>!s||!e.matches(s)).filter(e=>u(xe(e),e,t,c))},ht=Ke(ft,ft.name,"queryAll"),[yt,mt,vt,gt,Et]=Xe(ft,(e,t)=>"Found multiple elements with the text: "+t,function(e,t,n){void 0===n&&(n={});const{collapseWhitespace:r,trim:o,normalizer:i,selector:a}=n,s=_e({collapseWhitespace:r,trim:o,normalizer:i})(t.toString());return"Unable to find an element with the text: "+(s!==t.toString()?s+" (normalized from '"+t+"')":t)+("*"!==(null!=a?a:"*")?", which matches selector '"+a+"'":"")+". This could be because the text is broken up by multiple elements. In this case, you can provide a function for your text matcher to make your matcher more flexible."}),wt=function(e,t,n){let{exact:r=!0,collapseWhitespace:o,trim:i,normalizer:a}=void 0===n?{}:n;ue(e);const s=r?Se:Ie,l=_e({collapseWhitespace:o,trim:i,normalizer:a});return Array.from(e.querySelectorAll("input,textarea,select")).filter(e=>{if("SELECT"===e.tagName){return Array.from(e.options).filter(e=>e.selected).some(e=>s(xe(e),e,t,l))}return s(e.value,e,t,l)})},Tt=Ke(wt,wt.name,"queryAll"),[It,St,At,_t,Ot]=Xe(wt,(e,t)=>"Found multiple elements with the display value: "+t+".",(e,t)=>"Unable to find an element with the display value: "+t+"."),xt=/^(img|input|area|.+-.+)$/i,jt=function(e,t,n){return void 0===n&&(n={}),ue(e),ze("alt",e,t,n).filter(e=>xt.test(e.tagName))},Nt=Ke(jt,jt.name,"queryAll"),[Mt,Ct,Dt,kt,Pt]=Xe(jt,(e,t)=>"Found multiple elements with the alt text: "+t,(e,t)=>"Unable to find an element with the alt text: "+t),Bt=function(e,t,n){let{exact:r=!0,collapseWhitespace:o,trim:i,normalizer:a}=void 0===n?{}:n;ue(e);const s=r?Se:Ie,l=_e({collapseWhitespace:o,trim:i,normalizer:a});return Array.from(e.querySelectorAll("[title], svg > title")).filter(e=>s(e.getAttribute("title"),e,t,l)||(e=>{var t;return"title"===e.tagName.toLowerCase()&&"svg"===(null==(t=e.parentElement)?void 0:t.tagName.toLowerCase())})(e)&&s(xe(e),e,t,l))},Lt=Ke(Bt,Bt.name,"queryAll"),[Rt,qt,Vt,Ft,Wt]=Xe(Bt,(e,t)=>"Found multiple elements with the title: "+t+".",(e,t)=>"Unable to find an element with the title: "+t+"."),zt=function(e,t,n){let{hidden:r=ye().defaultHidden,name:o,description:i,queryFallbacks:s=!1,selected:l,busy:u,checked:c,pressed:d,current:b,level:p,expanded:f,value:{now:h,min:y,max:m,text:v}={}}=void 0===n?{}:n;var g,E,w,T,I,S,A,_,O,x;if((ue(e),void 0!==l)&&void 0===(null==(g=a.roles.get(t))?void 0:g.props["aria-selected"]))throw new Error('"aria-selected" is not supported on role "'+t+'".');if(void 0!==u&&void 0===(null==(E=a.roles.get(t))?void 0:E.props["aria-busy"]))throw new Error('"aria-busy" is not supported on role "'+t+'".');if(void 0!==c&&void 0===(null==(w=a.roles.get(t))?void 0:w.props["aria-checked"]))throw new Error('"aria-checked" is not supported on role "'+t+'".');if(void 0!==d&&void 0===(null==(T=a.roles.get(t))?void 0:T.props["aria-pressed"]))throw new Error('"aria-pressed" is not supported on role "'+t+'".');if(void 0!==b&&void 0===(null==(I=a.roles.get(t))?void 0:I.props["aria-current"]))throw new Error('"aria-current" is not supported on role "'+t+'".');if(void 0!==p&&"heading"!==t)throw new Error('Role "'+t+'" cannot have "level" property.');if(void 0!==h&&void 0===(null==(S=a.roles.get(t))?void 0:S.props["aria-valuenow"]))throw new Error('"aria-valuenow" is not supported on role "'+t+'".');if(void 0!==m&&void 0===(null==(A=a.roles.get(t))?void 0:A.props["aria-valuemax"]))throw new Error('"aria-valuemax" is not supported on role "'+t+'".');if(void 0!==y&&void 0===(null==(_=a.roles.get(t))?void 0:_.props["aria-valuemin"]))throw new Error('"aria-valuemin" is not supported on role "'+t+'".');if(void 0!==v&&void 0===(null==(O=a.roles.get(t))?void 0:O.props["aria-valuetext"]))throw new Error('"aria-valuetext" is not supported on role "'+t+'".');if(void 0!==f&&void 0===(null==(x=a.roles.get(t))?void 0:x.props["aria-expanded"]))throw new Error('"aria-expanded" is not supported on role "'+t+'".');const j=new WeakMap;function N(e){return j.has(e)||j.set(e,Ne(e)),j.get(e)}return Array.from(e.querySelectorAll(function(e){var t;const n='*[role~="'+e+'"]',r=null!=(t=a.roleElements.get(e))?t:new Set,o=new Set(Array.from(r).map(e=>{let{name:t}=e;return t}));return[n].concat(Array.from(o)).join(",")}(t))).filter(e=>{if(e.hasAttribute("role")){const n=e.getAttribute("role");if(s)return n.split(" ").filter(Boolean).some(e=>e===t);const[r]=n.split(" ");return r===t}return Ce(e).some(e=>e===t)}).filter(e=>{if(void 0!==l)return l===function(e){return"OPTION"===e.tagName?e.selected:ke(e,"aria-selected")}(e);if(void 0!==u)return u===function(e){return"true"===e.getAttribute("aria-busy")}(e);if(void 0!==c)return c===function(e){if(!("indeterminate"in e)||!e.indeterminate)return"checked"in e?e.checked:ke(e,"aria-checked")}(e);if(void 0!==d)return d===function(e){return ke(e,"aria-pressed")}(e);if(void 0!==b)return b===function(e){var t,n;return null!=(t=null!=(n=ke(e,"aria-current"))?n:e.getAttribute("aria-current"))&&t}(e);if(void 0!==f)return f===function(e){return ke(e,"aria-expanded")}(e);if(void 0!==p)return p===function(e){return e.getAttribute("aria-level")&&Number(e.getAttribute("aria-level"))||{H1:1,H2:2,H3:3,H4:4,H5:5,H6:6}[e.tagName]}(e);if(void 0!==h||void 0!==m||void 0!==y||void 0!==v){let n=!0;var t;if(void 0!==h&&n&&(n=h===function(e){const t=e.getAttribute("aria-valuenow");return null===t?void 0:+t}(e)),void 0!==m&&n&&(n=m===function(e){const t=e.getAttribute("aria-valuemax");return null===t?void 0:+t}(e)),void 0!==y&&n&&(n=y===function(e){const t=e.getAttribute("aria-valuemin");return null===t?void 0:+t}(e)),void 0!==v)n&&(n=Se(null!=(t=function(e){const t=e.getAttribute("aria-valuetext");return null===t?void 0:t}(e))?t:null,e,v,e=>e));return n}return!0}).filter(e=>void 0===o||Se(X(e,{computedStyleSupportsPseudoElements:ye().computedStyleSupportsPseudoElements}),e,o,e=>e)).filter(e=>void 0===i||Se(K(e,{computedStyleSupportsPseudoElements:ye().computedStyleSupportsPseudoElements}),e,i,e=>e)).filter(e=>!1!==r||!1===Me(e,{isSubtreeInaccessible:N}))};const Ut=e=>{let t="";return t=void 0===e?"":"string"==typeof e?' and name "'+e+'"':" and name `"+e+"`",t},Ht=Ke(zt,zt.name,"queryAll"),[$t,Gt,Kt,Xt,Jt]=Xe(zt,function(e,t,n){let{name:r}=void 0===n?{}:n;return'Found multiple elements with the role "'+t+'"'+Ut(r)},function(e,t,n){let{hidden:r=ye().defaultHidden,name:o,description:i}=void 0===n?{}:n;if(ye()._disableExpensiveErrorDiagnostics)return'Unable to find role="'+t+'"'+Ut(o);let a,s="";Array.from(e.children).forEach(e=>{s+=De(e,{hidden:r,includeDescription:void 0!==i})}),a=0===s.length?!1===r?"There are no accessible roles. But there might be some inaccessible roles. If you wish to access them, then set the `hidden` option to `true`. Learn more about this here: https://testing-library.com/docs/dom-testing-library/api-queries#byrole":"There are no available roles.":("\nHere are the "+(!1===r?"accessible":"available")+" roles:\n\n "+s.replace(/\n/g,"\n ").replace(/\n\s\s\n/g,"\n\n")+"\n").trim();let l="";l=void 0===o?"":"string"==typeof o?' and name "'+o+'"':" and name `"+o+"`";let u="";return u=void 0===i?"":"string"==typeof i?' and description "'+i+'"':" and description `"+i+"`",("\nUnable to find an "+(!1===r?"accessible ":"")+'element with the role "'+t+'"'+l+u+"\n\n"+a).trim()}),Qt=()=>ye().testIdAttribute,Yt=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return ue(t[0]),ze(Qt(),...t)},Zt=Ke(Yt,Yt.name,"queryAll"),[en,tn,nn,rn,on]=Xe(Yt,(e,t)=>"Found multiple elements by: ["+Qt()+'="'+t+'"]',(e,t)=>"Unable to find an element by: ["+Qt()+'="'+t+'"]');var an=Object.freeze({__proto__:null,queryAllByLabelText:at,queryByLabelText:et,getAllByLabelText:ot,getByLabelText:it,findAllByLabelText:nt,findByLabelText:rt,queryByPlaceholderText:ut,queryAllByPlaceholderText:lt,getByPlaceholderText:dt,getAllByPlaceholderText:ct,findAllByPlaceholderText:bt,findByPlaceholderText:pt,queryByText:yt,queryAllByText:ht,getByText:vt,getAllByText:mt,findAllByText:gt,findByText:Et,queryByDisplayValue:It,queryAllByDisplayValue:Tt,getByDisplayValue:At,getAllByDisplayValue:St,findAllByDisplayValue:_t,findByDisplayValue:Ot,queryByAltText:Mt,queryAllByAltText:Nt,getByAltText:Dt,getAllByAltText:Ct,findAllByAltText:kt,findByAltText:Pt,queryByTitle:Rt,queryAllByTitle:Lt,getByTitle:Vt,getAllByTitle:qt,findAllByTitle:Ft,findByTitle:Wt,queryByRole:$t,queryAllByRole:Ht,getAllByRole:Gt,getByRole:Kt,findAllByRole:Xt,findByRole:Jt,queryByTestId:en,queryAllByTestId:Zt,getByTestId:nn,getAllByTestId:tn,findAllByTestId:rn,findByTestId:on});function sn(e,t,n){return void 0===t&&(t=an),void 0===n&&(n={}),Object.keys(t).reduce((n,r)=>{const o=t[r];return n[r]=o.bind(null,e),n},n)}const ln={copy:{EventType:"ClipboardEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},cut:{EventType:"ClipboardEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},paste:{EventType:"ClipboardEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},compositionEnd:{EventType:"CompositionEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},compositionStart:{EventType:"CompositionEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},compositionUpdate:{EventType:"CompositionEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},keyDown:{EventType:"KeyboardEvent",defaultInit:{bubbles:!0,cancelable:!0,charCode:0,composed:!0}},keyPress:{EventType:"KeyboardEvent",defaultInit:{bubbles:!0,cancelable:!0,charCode:0,composed:!0}},keyUp:{EventType:"KeyboardEvent",defaultInit:{bubbles:!0,cancelable:!0,charCode:0,composed:!0}},focus:{EventType:"FocusEvent",defaultInit:{bubbles:!1,cancelable:!1,composed:!0}},blur:{EventType:"FocusEvent",defaultInit:{bubbles:!1,cancelable:!1,composed:!0}},focusIn:{EventType:"FocusEvent",defaultInit:{bubbles:!0,cancelable:!1,composed:!0}},focusOut:{EventType:"FocusEvent",defaultInit:{bubbles:!0,cancelable:!1,composed:!0}},change:{EventType:"Event",defaultInit:{bubbles:!0,cancelable:!1}},input:{EventType:"InputEvent",defaultInit:{bubbles:!0,cancelable:!1,composed:!0}},invalid:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!0}},submit:{EventType:"Event",defaultInit:{bubbles:!0,cancelable:!0}},reset:{EventType:"Event",defaultInit:{bubbles:!0,cancelable:!0}},click:{EventType:"MouseEvent",defaultInit:{bubbles:!0,cancelable:!0,button:0,composed:!0}},contextMenu:{EventType:"MouseEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},dblClick:{EventType:"MouseEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},drag:{EventType:"DragEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},dragEnd:{EventType:"DragEvent",defaultInit:{bubbles:!0,cancelable:!1,composed:!0}},dragEnter:{EventType:"DragEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},dragExit:{EventType:"DragEvent",defaultInit:{bubbles:!0,cancelable:!1,composed:!0}},dragLeave:{EventType:"DragEvent",defaultInit:{bubbles:!0,cancelable:!1,composed:!0}},dragOver:{EventType:"DragEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},dragStart:{EventType:"DragEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},drop:{EventType:"DragEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},mouseDown:{EventType:"MouseEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},mouseEnter:{EventType:"MouseEvent",defaultInit:{bubbles:!1,cancelable:!1,composed:!0}},mouseLeave:{EventType:"MouseEvent",defaultInit:{bubbles:!1,cancelable:!1,composed:!0}},mouseMove:{EventType:"MouseEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},mouseOut:{EventType:"MouseEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},mouseOver:{EventType:"MouseEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},mouseUp:{EventType:"MouseEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},select:{EventType:"Event",defaultInit:{bubbles:!0,cancelable:!1}},touchCancel:{EventType:"TouchEvent",defaultInit:{bubbles:!0,cancelable:!1,composed:!0}},touchEnd:{EventType:"TouchEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},touchMove:{EventType:"TouchEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},touchStart:{EventType:"TouchEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},resize:{EventType:"UIEvent",defaultInit:{bubbles:!1,cancelable:!1}},scroll:{EventType:"UIEvent",defaultInit:{bubbles:!1,cancelable:!1}},wheel:{EventType:"WheelEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},abort:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},canPlay:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},canPlayThrough:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},durationChange:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},emptied:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},encrypted:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},ended:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},loadedData:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},loadedMetadata:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},loadStart:{EventType:"ProgressEvent",defaultInit:{bubbles:!1,cancelable:!1}},pause:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},play:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},playing:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},progress:{EventType:"ProgressEvent",defaultInit:{bubbles:!1,cancelable:!1}},rateChange:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},seeked:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},seeking:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},stalled:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},suspend:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},timeUpdate:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},volumeChange:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},waiting:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},load:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},error:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},animationStart:{EventType:"AnimationEvent",defaultInit:{bubbles:!0,cancelable:!1}},animationEnd:{EventType:"AnimationEvent",defaultInit:{bubbles:!0,cancelable:!1}},animationIteration:{EventType:"AnimationEvent",defaultInit:{bubbles:!0,cancelable:!1}},transitionCancel:{EventType:"TransitionEvent",defaultInit:{bubbles:!0,cancelable:!1}},transitionEnd:{EventType:"TransitionEvent",defaultInit:{bubbles:!0,cancelable:!0}},transitionRun:{EventType:"TransitionEvent",defaultInit:{bubbles:!0,cancelable:!1}},transitionStart:{EventType:"TransitionEvent",defaultInit:{bubbles:!0,cancelable:!1}},pointerOver:{EventType:"PointerEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},pointerEnter:{EventType:"PointerEvent",defaultInit:{bubbles:!1,cancelable:!1}},pointerDown:{EventType:"PointerEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},pointerMove:{EventType:"PointerEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},pointerUp:{EventType:"PointerEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},pointerCancel:{EventType:"PointerEvent",defaultInit:{bubbles:!0,cancelable:!1,composed:!0}},pointerOut:{EventType:"PointerEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},pointerLeave:{EventType:"PointerEvent",defaultInit:{bubbles:!1,cancelable:!1}},gotPointerCapture:{EventType:"PointerEvent",defaultInit:{bubbles:!0,cancelable:!1,composed:!0}},lostPointerCapture:{EventType:"PointerEvent",defaultInit:{bubbles:!0,cancelable:!1,composed:!0}},popState:{EventType:"PopStateEvent",defaultInit:{bubbles:!0,cancelable:!1}},offline:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},online:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},pageHide:{EventType:"PageTransitionEvent",defaultInit:{bubbles:!0,cancelable:!0}},pageShow:{EventType:"PageTransitionEvent",defaultInit:{bubbles:!0,cancelable:!0}}},un={doubleClick:"dblClick"};function cn(e,t){return ye().eventWrapper(()=>{if(!t)throw new Error("Unable to fire an event - please provide an event object.");if(!e)throw new Error('Unable to fire a "'+t.type+'" event - please provide a DOM element.');return e.dispatchEvent(t)})}function dn(e,t,n,r){let{EventType:o="Event",defaultInit:i={}}=void 0===r?{}:r;if(!t)throw new Error('Unable to fire a "'+e+'" event - please provide a DOM element.');const a={...i,...n},{target:{value:s,files:l,...u}={}}=a;void 0!==s&&function(e,t){const{set:n}=Object.getOwnPropertyDescriptor(e,"value")||{},r=Object.getPrototypeOf(e),{set:o}=Object.getOwnPropertyDescriptor(r,"value")||{};if(o&&n!==o)o.call(e,t);else{if(!n)throw new Error("The given element does not have a value setter");n.call(e,t)}}(t,s),void 0!==l&&Object.defineProperty(t,"files",{configurable:!0,enumerable:!0,writable:!0,value:l}),Object.assign(t,u);const c=le(t),d=c[o]||c.Event;let b;if("function"==typeof d)b=new d(e,a);else{b=c.document.createEvent(o);const{bubbles:t,cancelable:n,detail:r,...i}=a;b.initEvent(e,t,n,r),Object.keys(i).forEach(e=>{b[e]=i[e]})}return["dataTransfer","clipboardData"].forEach(e=>{const t=a[e];"object"==typeof t&&("function"==typeof c.DataTransfer?Object.defineProperty(b,e,{value:Object.getOwnPropertyNames(t).reduce((e,n)=>(Object.defineProperty(e,n,{value:t[n]}),e),new c.DataTransfer)}):Object.defineProperty(b,e,{value:t}))}),b}function bn(e){return"https://testing-playground.com/#markup="+(t=e,s.compressToEncodedURIComponent(t.replace(/[ \t]*[\n][ \t]*/g,"\n")));var t}Object.keys(ln).forEach(e=>{const{EventType:t,defaultInit:n}=ln[e],r=e.toLowerCase();dn[e]=(e,o)=>dn(r,e,o,{EventType:t,defaultInit:n}),cn[e]=(t,n)=>cn(t,dn[e](t,n))}),Object.keys(un).forEach(e=>{const t=un[e];cn[e]=function(){return cn[t](...arguments)}});const pn={debug:(e,t,n)=>Array.isArray(e)?e.forEach(e=>fe(e,t,n)):fe(e,t,n),logTestingPlaygroundURL:function(e){if(void 0===e&&(e=se().body),!e||!("innerHTML"in e))return void console.log("The element you're providing isn't a valid DOM element.");if(!e.innerHTML)return void console.log("The provided element doesn't have any children.");const t=bn(e.innerHTML);return console.log("Open this URL in your browser\n\n"+t),t}};"undefined"!=typeof document&&document.body?sn(document.body,an,pn):Object.keys(an).reduce((e,t)=>(e[t]=()=>{throw new TypeError("For queries bound to document.body a global document has to be available... Learn more: https://testing-library.com/s/screen-global-error")},e),pn);const fn="function"==typeof d.act?d.act:b.act;function hn(){if("undefined"!=typeof globalThis)return globalThis;if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("unable to locate global object")}function yn(e){hn().IS_REACT_ACT_ENVIRONMENT=e}function mn(){return hn().IS_REACT_ACT_ENVIRONMENT}const vn=(gn=fn,e=>{const t=mn();yn(!0);try{let n=!1;const r=gn(()=>{const t=e();return null!==t&&"object"==typeof t&&"function"==typeof t.then&&(n=!0),t});if(n){const e=r;return{then:(n,r)=>{e.then(e=>{yn(t),n(e)},e=>{yn(t),r(e)})}}}return yn(t),r}catch(e){throw yn(t),e}});var gn;Object.keys(cn).forEach(e=>{});let En={reactStrictMode:!1};var wn;"function"==typeof(wn={unstable_advanceTimersWrapper:e=>vn(e),asyncWrapper:async e=>{const t=mn();yn(!1);try{const t=await e();return await new Promise(e=>{setTimeout(()=>{e()},0),"undefined"==typeof jest||null===jest||!0!==setTimeout._isMockFunction&&!Object.prototype.hasOwnProperty.call(setTimeout,"clock")||jest.advanceTimersByTime(0)}),t}finally{yn(t)}},eventWrapper:e=>{let t;return vn(()=>{t=e()}),t}})&&(wn=wn(he)),he={...he,...wn};const Tn=new Set,In=[];function Sn(e,t){return t??{...ye(),...En}.reactStrictMode?d.createElement(d.StrictMode,null,e):e}function An(e,t){return t?d.createElement(t,null,e):e}function _n(e,{hydrate:t,onCaughtError:n,onRecoverableError:r,ui:o,wrapper:i,reactStrictMode:a}){let s;return t?vn(()=>{s=p.hydrateRoot(e,Sn(An(o,i),a),{onCaughtError:n,onRecoverableError:r})}):s=p.createRoot(e,{onCaughtError:n,onRecoverableError:r}),{hydrate(){if(!t)throw new Error("Attempted to hydrate a non-hydrateable root. This is a bug in `@testing-library/react`.")},render(e){s.render(e)},unmount(){s.unmount()}}}function On(e){return{hydrate(t){r.hydrate(t,e)},render(t){r.render(t,e)},unmount(){r.unmountComponentAtNode(e)}}}function xn(e,{baseElement:t,container:n,hydrate:r,queries:o,root:i,wrapper:a,reactStrictMode:s}){return vn(()=>{r?i.hydrate(Sn(An(e,a),s),n):i.render(Sn(An(e,a),s),n)}),{container:n,baseElement:t,debug:(e=t,n,r)=>Array.isArray(e)?e.forEach(e=>console.log(pe(e,n,r))):console.log(pe(e,n,r)),unmount:()=>{vn(()=>{i.unmount()})},rerender:e=>{xn(e,{container:n,baseElement:t,root:i,wrapper:a,reactStrictMode:s})},asFragment:()=>{if("function"==typeof document.createRange)return document.createRange().createContextualFragment(n.innerHTML);{const e=document.createElement("template");return e.innerHTML=n.innerHTML,e.content}},...sn(t,o)}}function jn(e,{container:t,baseElement:n=t,legacyRoot:o=!1,onCaughtError:i,onUncaughtError:a,onRecoverableError:s,queries:l,hydrate:u=!1,wrapper:c,reactStrictMode:d}={}){if(void 0!==a)throw new Error("onUncaughtError is not supported. The `render` call will already throw on uncaught errors.");if(o&&"function"!=typeof r.render){const e=new Error("`legacyRoot: true` is not supported in this version of React. If your app runs React 19 or later, you should remove this flag. If your app runs React 18 or earlier, visit https://react.dev/blog/2022/03/08/react-18-upgrade-guide for upgrade instructions.");throw Error.captureStackTrace(e,jn),e}let b;if(n||(n=document.body),t||(t=n.appendChild(document.createElement("div"))),Tn.has(t))In.forEach(e=>{e.container===t&&(b=e.root)});else{b=(o?On:_n)(t,{hydrate:u,onCaughtError:i,onRecoverableError:s,ui:e,wrapper:c,reactStrictMode:d}),In.push({container:t,root:b}),Tn.add(t)}return xn(e,{container:t,baseElement:n,queries:l,hydrate:u,wrapper:c,root:b,reactStrictMode:d})}function Nn(){In.forEach(({root:e,container:t})=>{vn(()=>{e.unmount()}),t.parentNode===document.body&&document.body.removeChild(t)}),In.length=0,Tn.clear()}if(("undefined"==typeof process||!process.env?.RTL_SKIP_AUTO_CLEANUP)&&("function"==typeof afterEach?afterEach(()=>{Nn()}):"function"==typeof teardown&&teardown(()=>{Nn()}),"function"==typeof beforeAll&&"function"==typeof afterAll)){let e=mn();beforeAll(()=>{e=mn(),yn(!0)}),afterAll(()=>{yn(e)})}const Mn=t.createContext(null),Cn=({store:n,children:r})=>{const o=t.useMemo(()=>({store:n}),[n]);return e.jsx(Mn.Provider,{value:o,children:r})},Dn=()=>{const e=t.useContext(Mn);if(!e)throw new Error("useSduiLayoutContext must be used within SduiLayoutProvider");return e};const kn="none";function Pn(e){const{nodeId:n,schema:r}=e,o=(()=>{const{store:e}=Dn();return e})();return function(e,n){const r=t.useRef(null),o=t.useRef(null);t.useSyncExternalStore(t=>{const r=e.subscribeNode(n,t),o=e.subscribeVersion(t);return()=>{r(),o()}},()=>{var t;const o=null!==(t=e.getSnapshot()[n])&&void 0!==t?t:kn;return r.current===o?r.current:(r.current=o,o)},()=>{var t;return null===o.current&&(o.current=null!==(t=e.getServerSnapshot()[n])&&void 0!==t?t:kn),o.current})}(o,n),function(e,t,n){var r;const{nodes:o}=e.state,i=o[t],a=null!==(r=null==i?void 0:i.childrenIds)&&void 0!==r?r:[],s=null==i?void 0:i.state,l=null==i?void 0:i.attributes,u=null==i?void 0:i.reference;let c;if(n)if(i&&void 0!==s){const e=n.safeParse(s);if(!e.success)throw new Error(`State validation failed for node "${t}": ${e.error.message}`);c=e.data}else c={};else c=null!=s?s:{};return{node:i,type:null==i?void 0:i.type,state:c,childrenIds:a,attributes:l,reference:u,exists:!!i}}(o,n,r)}function Bn(e){return Pn(e)}const Ln=({nodeId:t,parentPath:n=[]})=>{const{type:r}=Bn({nodeId:t});return r?e.jsxs("div",{"data-sdui-node-id":t,"data-sdui-node-type":r,children:[e.jsxs("div",{children:["Type: ",r]}),e.jsxs("div",{children:["ID: ",t]})]}):null};Ln.displayName="DefaultNodeComponent";const Rn=(t,n)=>e.jsx(Ln,{nodeId:t,parentPath:n});function qn(e,t){return[...e,t]}const Vn=({nodeId:e,componentMap:n,parentPath:r=[]})=>{const{store:o}=Dn(),{nodes:i}=o.state,a=t.useMemo(()=>qn(r,e),[r,e]),s=t.useMemo(()=>function(e,t,n=" > "){return function(e,t=" > "){return e.join(t)}(qn(e,t),n)}(r,e),[r,e]),l=t.useCallback((e,t=[])=>{const r=i[e];if(!r)return null;const a=o.getComponentOverrides(),s=n||{};return(a[e]||a[r.type]||s[r.type]||Rn)(e,t)},[i,o,n]),u=t.useCallback(e=>e.map(e=>{const n=l(e,a);return t.isValidElement(n)?t.cloneElement(n,{key:e}):n}),[l,a]);return{renderNode:l,renderChildren:u,currentPath:a,pathString:s,nodeId:e,parentPath:r}},Fn=({id:e,componentMap:t})=>{const{renderNode:n}=Vn({nodeId:e,componentMap:t,parentPath:[]});return n(e,[])};class Wn extends Error{constructor(e){super(`Node not found: "${e}"`),this.name="NodeNotFoundError",Error.captureStackTrace&&Error.captureStackTrace(this,Wn)}}class zn extends Error{constructor(){super("Root node ID not found"),this.name="RootNotFoundError",Error.captureStackTrace&&Error.captureStackTrace(this,zn)}}class Un extends Error{constructor(){super("Metadata not found"),this.name="MetadataNotFoundError",Error.captureStackTrace&&Error.captureStackTrace(this,Un)}}function Hn(e,t){var n;const r=null===(n=t.nodes)||void 0===n?void 0:n[e];if(!r)return null;const o=[];r.childrenIds&&o.push(...r.childrenIds);const i=o.map(e=>Hn(e,t)).filter(e=>null!==e);return Object.assign(Object.assign({id:r.id,type:r.type,state:r.state||{},attributes:r.attributes||{}},void 0!==r.reference&&{reference:r.reference}),i.length>0&&{children:i})}const $n=new u.schema.Entity("nodes",{},{idAttribute:"id",processStrategy:e=>Object.assign({id:e.id,type:e.type,state:e.state||{},attributes:e.attributes||{}},void 0!==e.reference&&{reference:e.reference})});function Gn(e){const{result:t,entities:n}=function(e){const t=e.children||[],n=t.length>0?u.normalize(t,[$n]):{entities:{nodes:{}}},r=Object.assign({id:e.id,type:e.type,state:e.state||{},attributes:e.attributes||{}},void 0!==e.reference&&{reference:e.reference}),o=u.normalize(r,$n),i={nodes:Object.assign(Object.assign({},o.entities.nodes),n.entities.nodes)},a=(e,t)=>{var n,r;i.nodes&&i.nodes[e.id]?i.nodes[e.id]=Object.assign(Object.assign({},i.nodes[e.id]),{childrenIds:(null===(n=e.children)||void 0===n?void 0:n.map(e=>e.id))||[],parentId:t}):i.nodes&&(i.nodes[e.id]=Object.assign(Object.assign({id:e.id,type:e.type,state:e.state||{},attributes:e.attributes||{}},void 0!==e.reference&&{reference:e.reference}),{childrenIds:(null===(r=e.children)||void 0===r?void 0:r.map(e=>e.id))||[],parentId:t})),e.children&&e.children.forEach(t=>a(t,e.id))};return a(e,void 0),{result:o.result,entities:i}}(e.root);return{result:t,entities:n}}$n.define({children:[$n]});class Kn{constructor(){this._cached={},this._originalCached={}}cacheDocument(e){var t;const n=(null===(t=e.metadata)||void 0===t?void 0:t.id)||e.root.id;this._cached[n]=e,this._originalCached[n]||(this._originalCached[n]=l.cloneDeep(e))}setMetadata(e){this._metadata=e}getMetadata(){return this._metadata}getOriginalDocument(e){return this._originalCached[e]}getDocumentId(e){var t;return(null===(t=this._metadata)||void 0===t?void 0:t.id)||e}getDocument(e){const t=e.getRootId();if(!t)return null;const n=Hn(t,{nodes:e.nodes});return n?{version:"1.0.0",metadata:this._metadata,root:n}:null}clearCache(){this._cached={},this._originalCached={}}reset(){this._metadata=void 0,this.clearCache()}}function Xn(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}"function"==typeof SuppressedError&&SuppressedError;class Jn{constructor(){this._state={version:0,rootId:void 0,nodes:{},selectedNodeId:void 0,isEdited:!1,variables:{},lastModified:{}}}get state(){return this._state}get nodes(){return this._state.nodes}getNodeById(e){return this._state.nodes[e]}getNodeTypeById(e){var t;return null===(t=this._state.nodes[e])||void 0===t?void 0:t.type}getChildrenIdsById(e){var t;return(null===(t=this._state.nodes[e])||void 0===t?void 0:t.childrenIds)||[]}getRootId(){return this._state.rootId}getLastModified(e){return this._state.lastModified[e]}initializeState(e){this._state=Object.assign({version:0,rootId:void 0,nodes:{},selectedNodeId:void 0,isEdited:!1,variables:{},lastModified:{}},e)}updateNodes(e){this._state.nodes=e;const t=(new Date).toISOString(),n={};Object.keys(e).forEach(e=>{n[e]=t}),this._state.lastModified=n}deleteNode(e){const t=this._state.nodes,n=e;t[n];const r=Xn(t,["symbol"==typeof n?n:n+""]);this._state.nodes=r;const o=this._state.lastModified,i=e;o[i];const a=Xn(o,["symbol"==typeof i?i:i+""]);this._state.lastModified=a}deleteNodes(e){if(0===e.length)return;const t={},n=new Set(e);Object.keys(this._state.nodes).forEach(e=>{n.has(e)||(t[e]=this._state.nodes[e])}),this._state.nodes=t;const r={};Object.keys(this._state.lastModified).forEach(e=>{n.has(e)||(r[e]=this._state.lastModified[e])}),this._state.lastModified=r}mergeNodes(e){const t=new Set(Object.keys(this._state.nodes)),n=new Set(Object.keys(e)),r=[...t].filter(e=>!n.has(e)),o=(new Date).toISOString(),i={},{lastModified:a}=this._state,s=Object.assign({},a),l=new Set;return Object.keys(e).forEach(t=>{const n=this._state.nodes[t],r=e[t],{parentId:a}=r;n?i[t]=Object.assign(Object.assign({},r),{state:n.state||r.state||{}}):(i[t]=r,s[t]=o),a&&l.add(a)}),l.forEach(e=>{(i[e]||this._state.nodes[e])&&(s[e]=o)}),this._state.nodes=i,this._state.lastModified=s,r}updateNodeState(e,t){const n=this._state.nodes[e];n&&(this._state.nodes[e]=Object.assign(Object.assign({},n),{state:t}),this._state.lastModified=Object.assign(Object.assign({},this._state.lastModified),{[e]:(new Date).toISOString()}))}updateNodeAttributes(e,t){const n=this._state.nodes[e];n&&(this._state.nodes[e]=Object.assign(Object.assign({},n),{attributes:t}),this._state.lastModified=Object.assign(Object.assign({},this._state.lastModified),{[e]:(new Date).toISOString()}))}updateNodeReference(e,t){const n=this._state.nodes[e];n&&(this._state.nodes[e]=Object.assign(Object.assign({},n),{reference:t}),this._state.lastModified=Object.assign(Object.assign({},this._state.lastModified),{[e]:(new Date).toISOString()}))}setRootId(e){this._state.rootId=e}setSelectedNodeId(e){const t=this._state.selectedNodeId;return this._state.selectedNodeId=e,t}setEdited(e){this._state.isEdited=e}updateVariables(e){this._state.variables=e}incrementVersion(){this._state.version+=1}reset(){this._state.nodes={},this._state.rootId=void 0,this._state.isEdited=!1,this._state.selectedNodeId=void 0,this._state.variables={},this._state.lastModified={},this._state.version+=1}}class Qn{constructor(){this._nodeListeners=new Map,this._versionListeners=new Set}subscribeNode(e,t){return this._nodeListeners.has(e)||this._nodeListeners.set(e,new Set),this._nodeListeners.get(e).add(t),()=>{var n,r;null===(n=this._nodeListeners.get(e))||void 0===n||n.delete(t),0===(null===(r=this._nodeListeners.get(e))||void 0===r?void 0:r.size)&&this._nodeListeners.delete(e)}}subscribeVersion(e){return this._versionListeners.add(e),()=>{this._versionListeners.delete(e)}}notifyNode(e){var t;null===(t=this._nodeListeners.get(e))||void 0===t||t.forEach(e=>e())}notifyNodes(e){[...new Set(e)].forEach(e=>this.notifyNode(e))}notifyVersion(){this._versionListeners.forEach(e=>e())}cleanupNode(e){this._nodeListeners.delete(e)}cleanupNodes(e){e.forEach(e=>{this._nodeListeners.delete(e)})}}class Yn{constructor(e,t){this.repository=e,this.subscriptionManager=t}updateVariables(e){this.repository.updateVariables(l.cloneDeep(e)),this.repository.setEdited(!0),this.repository.incrementVersion(),this.subscriptionManager.notifyVersion()}updateVariable(e,t){const n=this.repository.state.variables;this.repository.updateVariables(Object.assign(Object.assign({},l.cloneDeep(n)),{[e]:l.cloneDeep(t)})),this.repository.setEdited(!0),this.repository.incrementVersion(),this.subscriptionManager.notifyVersion()}deleteVariable(e){const t=l.cloneDeep(this.repository.state.variables);delete t[e],this.repository.updateVariables(t),this.repository.setEdited(!0),this.repository.incrementVersion(),this.subscriptionManager.notifyVersion()}}class Zn{constructor(e,t){this._subscriptionManager=new Qn,this._repository=new Jn,this._documentManager=new Kn,this._componentOverrides={},this._repository.initializeState(e),this._variablesManager=new Yn(this._repository,this._subscriptionManager),this._componentOverrides=(null==t?void 0:t.componentOverrides)||{}}subscribeNode(e,t){return this._subscriptionManager.subscribeNode(e,t)}subscribeVersion(e){return this._subscriptionManager.subscribeVersion(e)}get state(){return this._repository.state}getSnapshot(){return this._repository.state.lastModified}getServerSnapshot(){return this.getSnapshot()}get nodes(){return this._repository.nodes}get metadata(){const e=this._documentManager.getMetadata();if(!e)throw new Un;return e}getComponentOverrides(){return this._componentOverrides}getNodeById(e){const t=this._repository.getNodeById(e);if(!t)throw new Wn(e);return t}getNodeTypeById(e){const t=this._repository.getNodeTypeById(e);if(!t)throw new Wn(e);return t}getChildrenIdsById(e){if(!this._repository.getNodeById(e))throw new Wn(e);return this._repository.getChildrenIdsById(e)}getLayoutStateById(e){return this.getNodeById(e).state||{}}getAttributesById(e){return this.getNodeById(e).attributes||{}}getReferenceById(e){return this.getNodeById(e).reference}getRootId(){const e=this._repository.getRootId();if(!e)throw new zn;return e}updateLayout(e){const{entities:t}=Gn(e);this._repository.updateNodes(t.nodes||{}),this._repository.setRootId(e.root.id),this._repository.setEdited(!1),this._repository.updateVariables(e.variables?l.cloneDeep(e.variables):{}),this._repository.incrementVersion(),this._documentManager.setMetadata(e.metadata),this._documentManager.cacheDocument(e),this._subscriptionManager.notifyVersion()}mergeLayout(e){const{entities:t}=Gn(e),n=t.nodes||{},r=this._repository.mergeNodes(n),o=this._repository.state.selectedNodeId;o&&r.includes(o)&&this._repository.setSelectedNodeId(void 0),r.length>0&&this._subscriptionManager.cleanupNodes(r),this._repository.setRootId(e.root.id),this._repository.updateVariables(e.variables?l.cloneDeep(e.variables):{}),this._repository.setEdited(!1),this._documentManager.setMetadata(e.metadata),this._documentManager.cacheDocument(e),this._repository.incrementVersion(),this._subscriptionManager.notifyVersion()}cancelEdit(e){const t=this._repository.getRootId(),n=e||(t?this._documentManager.getDocumentId(t):void 0);if(!n)return;const r=this._documentManager.getOriginalDocument(n);r&&this.updateLayout(r)}updateNodeState(e,t){const n=this.getNodeById(e);this._repository.updateNodeState(e,Object.assign(Object.assign({},n.state||{}),t)),this._repository.setEdited(!0),this._subscriptionManager.notifyNode(e)}updateNodeAttributes(e,t){const n=this.getNodeById(e);this._repository.updateNodeAttributes(e,Object.assign(Object.assign({},n.attributes||{}),t)),this._repository.setEdited(!0),this._subscriptionManager.notifyNode(e)}updateNodeReference(e,t){this.getNodeById(e),this._repository.updateNodeReference(e,t),this._repository.setEdited(!0),this._subscriptionManager.notifyNode(e)}updateVariables(e){this._variablesManager.updateVariables(e)}updateVariable(e,t){this._variablesManager.updateVariable(e,t)}deleteVariable(e){this._variablesManager.deleteVariable(e)}setSelectedNodeId(e){const t=this._repository.setSelectedNodeId(e);t&&this._subscriptionManager.notifyNode(t),e&&this._subscriptionManager.notifyNode(e)}getDocument(){return this._documentManager.getDocument(this._repository)}reset(){this._documentManager.reset(),this._repository.reset(),this._subscriptionManager.notifyVersion()}resetToInitial(){const e=this._repository.getRootId();if(!e)throw new Error("Root ID is not available. Cannot reset to initial state.");const t=this._documentManager.getDocumentId(e);if(!t)throw new Error("Document ID is not available. Cannot reset to initial state.");const n=this._documentManager.getOriginalDocument(t);if(!n)throw new Error("Initial document is not available. Cannot reset to initial state.");this.updateLayout(n)}}const er=({nodeId:t,parentPath:n=[]})=>{const{type:r,childrenIds:o}=Bn({nodeId:t}),{renderNode:i,currentPath:a}=Vn({nodeId:t,parentPath:n});return r?e.jsxs("div",{"data-sdui-node-id":t,"data-sdui-node-type":r,children:[e.jsxs("div",{children:["Type: ",r]}),e.jsxs("div",{children:["ID: ",t]}),o&&o.length>0&&e.jsx("div",{children:o.map(t=>e.jsx("div",{children:i(t,a)},t))})]}):null};exports.TestDefaultNodeComponent=er,exports.createNestedTestDocument=function(){return{version:"1.0.0",metadata:{id:"nested-doc",name:"Nested Document"},root:{id:"root",type:"Container",children:[{id:"child-1",type:"Card",children:[{id:"grandchild-1",type:"Panel"}]},{id:"child-2",type:"Card"}]}}},exports.createTestDocument=function(e){const t={id:"root",type:"Container",children:[]},n=(null==e?void 0:e.root)?Object.assign(Object.assign({},t),e.root):t;return Object.assign(Object.assign({version:"1.0.0",metadata:{id:"test-doc",name:"Test Document"}},e),{root:n})},exports.defaultTestComponentFactory=(t,n)=>e.jsx(er,{nodeId:t,parentPath:n}),exports.renderWithSduiLayout=function(t,n,r){var o;const{components:i,componentOverrides:a,onError:s}=n||{},l={componentOverrides:Object.assign(Object.assign({},i),a)},u=new Zn(void 0,l);try{u.updateLayout(t)}catch(e){s&&s(e instanceof Error?e:new Error(String(e)))}const c=i||{},d=null===(o=null==t?void 0:t.root)||void 0===o?void 0:o.id;return jn(d?e.jsxs(Cn,{store:u,children:[e.jsx(Fn,{id:d,componentMap:c}),r]}):e.jsx("div",{children:"Invalid document: missing root.id"}))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t}from"react/jsx-runtime";import{render as r}from"../../../node_modules/.pnpm/@testing-library_react@16.3.1_@testing-library_dom@10.4.1_@types_react-dom@18.3.7_@types_reac_bxcobvx7qxffu3uqpqwx2mjx3m/node_modules/@testing-library/react/dist/@testing-library/react.esm.mjs";import{SduiLayoutRendererInner as o}from"../../react-wrapper/components/
|
|
1
|
+
import{jsx as e,jsxs as t}from"react/jsx-runtime";import{render as r}from"../../../node_modules/.pnpm/@testing-library_react@16.3.1_@testing-library_dom@10.4.1_@types_react-dom@18.3.7_@types_reac_bxcobvx7qxffu3uqpqwx2mjx3m/node_modules/@testing-library/react/dist/@testing-library/react.esm.mjs";import{SduiLayoutRendererInner as o}from"../../react-wrapper/components/SduiLayoutRendererInner.mjs";import{SduiLayoutProvider as n}from"../../react-wrapper/context/SduiLayoutContext.mjs";import{useRenderNode as d}from"../../react-wrapper/hooks/useRenderNode.mjs";import{useSduiNodeSubscription as i}from"../../react-wrapper/hooks/useSduiNodeSubscription.mjs";import{SduiLayoutStore as a}from"../../store/SduiLayoutStore.mjs";const s=({nodeId:r,parentPath:o=[]})=>{const{type:n,childrenIds:a}=i({nodeId:r}),{renderNode:s,currentPath:c}=d({nodeId:r,parentPath:o});return n?t("div",{"data-sdui-node-id":r,"data-sdui-node-type":n,children:[t("div",{children:["Type: ",n]}),t("div",{children:["ID: ",r]}),a&&a.length>0&&e("div",{children:a.map(t=>e("div",{children:s(t,c)},t))})]}):null},c=(t,r)=>e(s,{nodeId:t,parentPath:r});function m(e){const t={id:"root",type:"Container",children:[]},r=(null==e?void 0:e.root)?Object.assign(Object.assign({},t),e.root):t;return Object.assign(Object.assign({version:"1.0.0",metadata:{id:"test-doc",name:"Test Document"}},e),{root:r})}function p(){return{version:"1.0.0",metadata:{id:"nested-doc",name:"Nested Document"},root:{id:"root",type:"Container",children:[{id:"child-1",type:"Card",children:[{id:"grandchild-1",type:"Panel"}]},{id:"child-2",type:"Card"}]}}}function u(d,i,s){var c;const{components:m,componentOverrides:p,onError:u}=i||{},l={componentOverrides:Object.assign(Object.assign({},m),p)},h=new a(void 0,l);try{h.updateLayout(d)}catch(e){u&&u(e instanceof Error?e:new Error(String(e)))}const y=m||{},v=null===(c=null==d?void 0:d.root)||void 0===c?void 0:c.id;return r(v?t(n,{store:h,children:[e(o,{id:v,componentMap:y}),s]}):e("div",{children:"Invalid document: missing root.id"}))}export{s as TestDefaultNodeComponent,p as createNestedTestDocument,m as createTestDocument,c as defaultTestComponentFactory,u as renderWithSduiLayout};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import"react/jsx-runtime";import"react";import"
|
|
2
|
+
import{jsx as r}from"react/jsx-runtime";import{useRef as o,useMemo as t}from"react";import{componentMap as n}from"../../components/componentMap.mjs";import{SduiLayoutStore as e}from"../../store/SduiLayoutStore.mjs";import{SduiLayoutProvider as i}from"../context/SduiLayoutContext.mjs";import{SduiLayoutRendererInner as u}from"./SduiLayoutRendererInner.mjs";const c=({document:c,components:m,componentOverrides:s,onLayoutChange:d,onError:a})=>{var l;const p=o(null),v=t(()=>{try{if(!c||!c.root)throw new Error("Invalid document: missing root");if(!c.root.id)throw new Error("Invalid document: root.id is required");const r={componentOverrides:Object.assign(Object.assign(Object.assign({},m),null==s?void 0:s.byNodeType),null==s?void 0:s.byNodeId)};return p.current?p.current.mergeLayout(c):(p.current=new e(void 0,r),p.current.updateLayout(c)),p.current}catch(r){return a&&a(r instanceof Error?r:new Error(String(r))),null===p.current&&(p.current=new e),p.current}},[c,m,s]),j=t(()=>Object.assign(Object.assign({},n),m),[m]),y=null===(l=null==c?void 0:c.root)||void 0===l?void 0:l.id;return y?r(i,{store:v,children:r(u,{id:y,componentMap:j})}):null};export{c as SduiLayoutRenderer};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{useRenderNode as o}from"../hooks/useRenderNode.mjs";import"../context/SduiLayoutContext.mjs";import"react";const t=({id:t,componentMap:e})=>{const{renderNode:n}=o({nodeId:t,componentMap:e,parentPath:[]});return n(t,[])};export{t as SduiLayoutRendererInner};
|
|
@@ -42,21 +42,10 @@ interface SduiLayoutRendererProps {
|
|
|
42
42
|
/** Error callback */
|
|
43
43
|
onError?: (error: Error) => void;
|
|
44
44
|
}
|
|
45
|
-
/**
|
|
46
|
-
* SduiLayoutRenderer internal component.
|
|
47
|
-
*
|
|
48
|
-
* Uses the useRenderNode hook to create the renderNode function and
|
|
49
|
-
* injects it into child components.
|
|
50
|
-
* Each component renders its children through this function.
|
|
51
|
-
*/
|
|
52
|
-
declare const SduiLayoutRendererInner: ({ id, componentMap: customComponentMap, }: {
|
|
53
|
-
id: string;
|
|
54
|
-
componentMap?: Record<string, ComponentFactory>;
|
|
55
|
-
}) => React.ReactNode;
|
|
56
45
|
/**
|
|
57
46
|
* SduiLayoutRenderer
|
|
58
47
|
*
|
|
59
48
|
* Top-level component that renders an SDUI Layout Document.
|
|
60
49
|
*/
|
|
61
50
|
export declare const SduiLayoutRenderer: React.FC<SduiLayoutRendererProps>;
|
|
62
|
-
export {
|
|
51
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SduiLayoutRenderer internal component.
|
|
3
|
+
*
|
|
4
|
+
* Uses the useRenderNode hook to create the renderNode function and
|
|
5
|
+
* injects it into child components.
|
|
6
|
+
* Each component renders its children through this function.
|
|
7
|
+
*
|
|
8
|
+
* @internal Exported for testing only. Use SduiLayoutRenderer for public API.
|
|
9
|
+
*/
|
|
10
|
+
import type { ComponentFactory } from '../../components/types';
|
|
11
|
+
export declare const SduiLayoutRendererInner: ({ id, componentMap: customComponentMap, }: {
|
|
12
|
+
id: string;
|
|
13
|
+
componentMap?: Record<string, ComponentFactory>;
|
|
14
|
+
}) => import("react").ReactNode;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lodado/sdui-template",
|
|
3
3
|
"description": "SDUI (Server-Driven UI) template library for React. A flexible and powerful template system for building server-driven user interfaces with dynamic layouts and components.",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.3",
|
|
5
5
|
"sideEffects": [
|
|
6
6
|
"**/SduiLayoutRenderer*",
|
|
7
7
|
"**/SduiLayoutContext*"
|
|
@@ -52,8 +52,8 @@
|
|
|
52
52
|
"ts-jest": "29.0.5",
|
|
53
53
|
"eslint-config-sdui-template": "0.0.0",
|
|
54
54
|
"jest-config": "0.0.0",
|
|
55
|
-
"
|
|
56
|
-
"
|
|
55
|
+
"rollup-config": "0.0.1",
|
|
56
|
+
"tsconfig": "0.0.0"
|
|
57
57
|
},
|
|
58
58
|
"exports": {
|
|
59
59
|
".": {
|
|
@@ -8,7 +8,7 @@ import { render, RenderResult } from '@testing-library/react'
|
|
|
8
8
|
import React from 'react'
|
|
9
9
|
|
|
10
10
|
import type { ComponentFactory, SduiComponentProps } from '../../components/types'
|
|
11
|
-
import { SduiLayoutRendererInner } from '../../react-wrapper/components/
|
|
11
|
+
import { SduiLayoutRendererInner } from '../../react-wrapper/components/SduiLayoutRendererInner'
|
|
12
12
|
import { SduiLayoutProvider } from '../../react-wrapper/context'
|
|
13
13
|
import { useRenderNode } from '../../react-wrapper/hooks/useRenderNode'
|
|
14
14
|
import { useSduiNodeSubscription } from '../../react-wrapper/hooks/useSduiNodeSubscription'
|