potatejs 0.16.1 → 0.17.0

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/README.md CHANGED
@@ -205,18 +205,20 @@ root.render(<App/>)
205
205
 
206
206
  ## Idea
207
207
 
208
- It is inspired by the rendering patterns used on hyperHTML and lit-html.
208
+ Excerpt from [brahmosjs/brahmos](https://github.com/brahmosjs/brahmos):
209
209
 
210
- It has the same declarative API like React, but instead of working with VDOM, it uses tagged template literals and HTML's template tag for faster rendering and updates.
210
+ > It is inspired by the rendering patterns used on hyperHTML and lit-html.
211
+ >
212
+ > It has the same declarative API like React, but instead of working with VDOM, it uses tagged template literals and HTML's template tag for faster rendering and updates.
211
213
  It divides the HTML to be rendered into static and dynamic parts, and in next render, it has to compare the values of only dynamic parts and apply the changes optimally to the connected DOM.
212
214
  It's unlike the VDOM which compares the whole last rendered VDOM to the new VDOM (which has both static and dynamic parts) to derive the optimal changes that are required on the actual DOM.
213
-
214
- Even though tagged template literals are the key to static and dynamic part separation, the developer has to code on well adopted JSX.
215
-
216
- Using the babel-plugin-brahmos it transforms JSX into tagged template literals which are optimized for render/updates and the output size.
217
-
218
- Consider this example,
219
-
215
+ >
216
+ > Even though tagged template literals are the key to static and dynamic part separation, the developer has to code on well adopted JSX.
217
+ >
218
+ > Using the babel-plugin-brahmos it transforms JSX into tagged template literals which are optimized for render/updates and the output size.
219
+ >
220
+ > Consider this example,
221
+ >
220
222
  ```jsx
221
223
  class TodoList extends Component {
222
224
  state = { todos: [], text: '' };
@@ -246,9 +248,9 @@ class TodoList extends Component {
246
248
  }
247
249
  }
248
250
  ```
249
-
250
- It will be transformed to
251
-
251
+ >
252
+ > It will be transformed to
253
+ >
252
254
  ```js
253
255
  class TodoList extends Component {
254
256
  state = { todos: [], text: '' };
@@ -280,13 +282,13 @@ class TodoList extends Component {
280
282
  }
281
283
  }
282
284
  ```
283
-
284
- With the tagged template literal we get a clear separating of the static and dynamic part. And on updates it needs to apply changes only on the changed dynamic parts.
285
-
286
- Tagged template literals also have a unique property where the reference of the literal part (array of static strings) remain the same for every call of that tag with a given template.
285
+ >
286
+ > With the tagged template literal we get a clear separating of the static and dynamic part. And on updates it needs to apply changes only on the changed dynamic parts.
287
+ >
288
+ > Tagged template literals also have a unique property where the reference of the literal part (array of static strings) remain the same for every call of that tag with a given template.
287
289
  Taking advantage of this behavior Brahmos uses literal parts as a cache key to keep the intermediate states to avoid the work done to process a template literal again.
288
-
289
- Tagged template is natively supported by the browser, unlike the React's JSX which has to be transformed to React.createElement calls. So the output generated to run Brahmos has a smaller footprint than the output generated for the react.
290
+ >
291
+ > Tagged template is natively supported by the browser, unlike the React's JSX which has to be transformed to React.createElement calls. So the output generated to run Brahmos has a smaller footprint than the output generated for the react.
290
292
  For the above example, the Brahmos output is 685 bytes, compared to 824 bytes from the React output. More the static part of an HTML, greater the difference will be.
291
293
 
292
294
 
@@ -315,11 +317,11 @@ For the above example, the Brahmos output is 685 bytes, compared to 824 bytes fr
315
317
  - [x] ⭐⭐⭐ [watch(resource) API](docs/API.md)
316
318
  - [x] ⭐ React 19 style root management
317
319
  - [x] Allow using class instead of className
320
+ - [x] ⭐ [`<Context>` as a provider](https://react.dev/blog/2024/12/05/react-19#context-as-a-provider)
318
321
  - [x] ⭐ [ref as a prop](https://react.dev/blog/2024/12/05/react-19#ref-as-a-prop)
319
322
  - [ ] ⭐ `use(context)` API
320
323
  - [ ] ⭐ [use(store) API](https://react.dev/blog/2025/04/23/react-labs-view-transitions-activity-and-more#concurrent-stores)
321
324
  - [ ] ⭐ [Cleanup functions for refs](https://react.dev/blog/2024/12/05/react-19#cleanup-functions-for-refs)
322
- - [ ] ⭐ [`<Context>` as a provider](https://react.dev/blog/2024/12/05/react-19#context-as-a-provider)
323
325
  - [ ] ⭐ [startTransition(action) for POST request](https://react.dev/blog/2024/12/05/react-19#actions)
324
326
  - [ ] ⭐ [useEffectEvent hook](https://react.dev/reference/react/useEffectEvent)
325
327
  - [ ] ⭐ `useImperativeHandle` hook
@@ -13078,6 +13078,12 @@ var t = {
13078
13078
  },
13079
13079
  isJSXSpreadAttribute(node) {
13080
13080
  return node && node.type === "JSXSpreadAttribute";
13081
+ },
13082
+ isJSXIdentifier(node) {
13083
+ return node && node.type === "JSXIdentifier";
13084
+ },
13085
+ isJSXMemberExpression(node) {
13086
+ return node && node.type === "JSXMemberExpression";
13081
13087
  }
13082
13088
  };
13083
13089
  function createPath(node, parentPath = null) {
@@ -13251,15 +13257,9 @@ function isEmptyLiteralWrap(strings) {
13251
13257
  function getPropValue(value) {
13252
13258
  return t.isJSXExpressionContainer(value) ? value.expression : value;
13253
13259
  }
13254
- function getAttributeName(nameNode) {
13255
- if (nameNode.type === "JSXNamespacedName") {
13256
- return `${nameNode.namespace.name}:${nameNode.name.name}`;
13257
- }
13258
- return nameNode.name;
13259
- }
13260
13260
  function createAttributeProperty(name, value) {
13261
13261
  value = value || t.booleanLiteral(true);
13262
- const attrNameStr = getAttributeName(name);
13262
+ const attrNameStr = name.name;
13263
13263
  const propName = attrNameStr.match("-|:") ? t.stringLiteral(attrNameStr) : t.identifier(attrNameStr);
13264
13264
  const propValue = getPropValue(value);
13265
13265
  const isShorthand = propName.type === "Identifier" && propValue.type === "Identifier" && propName.name === propValue.name;
@@ -13452,18 +13452,14 @@ function isSvgHasDynamicPart(part) {
13452
13452
  }
13453
13453
 
13454
13454
  // src/plugin/taggedTemplate.js
13455
- function jsxNameToExpression(node) {
13456
- if (node.type === "JSXIdentifier") {
13457
- return { type: "Identifier", name: node.name };
13458
- } else if (node.type === "JSXMemberExpression") {
13459
- return {
13460
- type: "MemberExpression",
13461
- object: jsxNameToExpression(node.object),
13462
- property: jsxNameToExpression(node.property),
13463
- computed: false
13464
- };
13455
+ function jsxToObject(node) {
13456
+ if (t.isJSXIdentifier(node)) {
13457
+ return t.identifier(node.name);
13458
+ } else if (t.isJSXMemberExpression(node)) {
13459
+ const objectNode = jsxToObject(node.object);
13460
+ const property = jsxToObject(node.property);
13461
+ return t.memberExpression(objectNode, property);
13465
13462
  }
13466
- throw new Error(`Unsupported JSX name type: ${node.type}`);
13467
13463
  }
13468
13464
  function needsToBeJSXCall(path) {
13469
13465
  const { node } = path;
@@ -13544,12 +13540,11 @@ function getLiteralParts(rootPath) {
13544
13540
  lastExpression = pushAttributeToExpressions(attr.argument, lastExpression, createPath(attr, path));
13545
13541
  } else {
13546
13542
  const { name, value } = attr;
13547
- const attrNameStr = getAttributeName(name);
13548
- if (needsToBeExpression(tagName, attrNameStr) || value && value.type === "JSXExpressionContainer") {
13543
+ if (needsToBeExpression(tagName, name.name) || value && value.type === "JSXExpressionContainer") {
13549
13544
  const expr = createAttributeExpression(name, value);
13550
13545
  lastExpression = pushAttributeToExpressions(expr, lastExpression, createPath(attr, path));
13551
13546
  } else {
13552
- const attrName = PROPERTY_ATTRIBUTE_MAP[attrNameStr] || attrNameStr;
13547
+ const attrName = PROPERTY_ATTRIBUTE_MAP[name.name] || name.name;
13553
13548
  let attrString = ` ${attrName}`;
13554
13549
  if (value) {
13555
13550
  const attrValue = value.value;
@@ -13566,38 +13561,36 @@ function getLiteralParts(rootPath) {
13566
13561
  path.get("children").forEach(recursePath);
13567
13562
  if (!SELF_CLOSING_TAGS.includes(tagName)) stringPart.push(`</${tagName}>`);
13568
13563
  } else {
13564
+ const componentName = isHTMLElement(nameNode.name) ? t.stringLiteral(nameNode.name) : jsxToObject(nameNode);
13569
13565
  const propsProperties = [];
13570
13566
  let keyValue = null;
13571
13567
  openingElement.attributes.forEach((attr) => {
13572
13568
  if (attr.type === "JSXAttribute") {
13573
- const attrName = attr.name.name;
13574
- const valNode = getAttrValue(attr.value);
13575
- if (attrName === "key") {
13576
- keyValue = valNode;
13569
+ if (attr.name.name === "key") {
13570
+ keyValue = getAttrValue(attr.value);
13577
13571
  } else {
13578
- propsProperties.push({ type: "Property", key: { type: "Identifier", name: attrName }, value: valNode, kind: "init" });
13572
+ propsProperties.push(createAttributeProperty(attr.name, attr.value));
13579
13573
  }
13580
13574
  } else if (attr.type === "JSXSpreadAttribute") {
13581
- propsProperties.push({ type: "SpreadElement", argument: attr.argument });
13575
+ propsProperties.push(t.spreadElement(attr.argument));
13582
13576
  }
13583
13577
  });
13578
+ const jsxArguments = [componentName, t.objectExpression(propsProperties)];
13584
13579
  const childrenPaths = path.get("children");
13585
13580
  if (childrenPaths && childrenPaths.length) {
13586
- propsProperties.push({
13587
- type: "Property",
13588
- key: { type: "Identifier", name: "children" },
13589
- value: transformToAstNode(getTaggedTemplate(childrenPaths)),
13590
- kind: "init"
13591
- });
13592
- }
13593
- pushToExpressions({
13594
- type: "CallExpression",
13595
- callee: {
13596
- type: "Identifier",
13597
- name: "_brahmosJSX"
13598
- },
13599
- arguments: keyValue ? [jsxNameToExpression(nameNode), { type: "ObjectExpression", properties: propsProperties }, keyValue] : [jsxNameToExpression(nameNode), { type: "ObjectExpression", properties: propsProperties }]
13600
- }, path, false);
13581
+ propsProperties.push(
13582
+ createAttributeProperty(
13583
+ t.identifier("children"),
13584
+ transformToAstNode(getTaggedTemplate(childrenPaths))
13585
+ )
13586
+ );
13587
+ }
13588
+ if (keyValue) {
13589
+ jsxArguments.push(keyValue);
13590
+ }
13591
+ const brahmosJSXFunction = t.identifier("_brahmosJSX");
13592
+ const expression = t.callExpression(brahmosJSXFunction, jsxArguments);
13593
+ pushToExpressions(expression, path, false);
13601
13594
  }
13602
13595
  } else if (node.type === "JSXFragment") {
13603
13596
  path.get("children").forEach(recursePath);
@@ -13075,6 +13075,12 @@ var t = {
13075
13075
  },
13076
13076
  isJSXSpreadAttribute(node) {
13077
13077
  return node && node.type === "JSXSpreadAttribute";
13078
+ },
13079
+ isJSXIdentifier(node) {
13080
+ return node && node.type === "JSXIdentifier";
13081
+ },
13082
+ isJSXMemberExpression(node) {
13083
+ return node && node.type === "JSXMemberExpression";
13078
13084
  }
13079
13085
  };
13080
13086
  function createPath(node, parentPath = null) {
@@ -13248,15 +13254,9 @@ function isEmptyLiteralWrap(strings) {
13248
13254
  function getPropValue(value) {
13249
13255
  return t.isJSXExpressionContainer(value) ? value.expression : value;
13250
13256
  }
13251
- function getAttributeName(nameNode) {
13252
- if (nameNode.type === "JSXNamespacedName") {
13253
- return `${nameNode.namespace.name}:${nameNode.name.name}`;
13254
- }
13255
- return nameNode.name;
13256
- }
13257
13257
  function createAttributeProperty(name, value) {
13258
13258
  value = value || t.booleanLiteral(true);
13259
- const attrNameStr = getAttributeName(name);
13259
+ const attrNameStr = name.name;
13260
13260
  const propName = attrNameStr.match("-|:") ? t.stringLiteral(attrNameStr) : t.identifier(attrNameStr);
13261
13261
  const propValue = getPropValue(value);
13262
13262
  const isShorthand = propName.type === "Identifier" && propValue.type === "Identifier" && propName.name === propValue.name;
@@ -13449,18 +13449,14 @@ function isSvgHasDynamicPart(part) {
13449
13449
  }
13450
13450
 
13451
13451
  // src/plugin/taggedTemplate.js
13452
- function jsxNameToExpression(node) {
13453
- if (node.type === "JSXIdentifier") {
13454
- return { type: "Identifier", name: node.name };
13455
- } else if (node.type === "JSXMemberExpression") {
13456
- return {
13457
- type: "MemberExpression",
13458
- object: jsxNameToExpression(node.object),
13459
- property: jsxNameToExpression(node.property),
13460
- computed: false
13461
- };
13452
+ function jsxToObject(node) {
13453
+ if (t.isJSXIdentifier(node)) {
13454
+ return t.identifier(node.name);
13455
+ } else if (t.isJSXMemberExpression(node)) {
13456
+ const objectNode = jsxToObject(node.object);
13457
+ const property = jsxToObject(node.property);
13458
+ return t.memberExpression(objectNode, property);
13462
13459
  }
13463
- throw new Error(`Unsupported JSX name type: ${node.type}`);
13464
13460
  }
13465
13461
  function needsToBeJSXCall(path) {
13466
13462
  const { node } = path;
@@ -13541,12 +13537,11 @@ function getLiteralParts(rootPath) {
13541
13537
  lastExpression = pushAttributeToExpressions(attr.argument, lastExpression, createPath(attr, path));
13542
13538
  } else {
13543
13539
  const { name, value } = attr;
13544
- const attrNameStr = getAttributeName(name);
13545
- if (needsToBeExpression(tagName, attrNameStr) || value && value.type === "JSXExpressionContainer") {
13540
+ if (needsToBeExpression(tagName, name.name) || value && value.type === "JSXExpressionContainer") {
13546
13541
  const expr = createAttributeExpression(name, value);
13547
13542
  lastExpression = pushAttributeToExpressions(expr, lastExpression, createPath(attr, path));
13548
13543
  } else {
13549
- const attrName = PROPERTY_ATTRIBUTE_MAP[attrNameStr] || attrNameStr;
13544
+ const attrName = PROPERTY_ATTRIBUTE_MAP[name.name] || name.name;
13550
13545
  let attrString = ` ${attrName}`;
13551
13546
  if (value) {
13552
13547
  const attrValue = value.value;
@@ -13563,38 +13558,36 @@ function getLiteralParts(rootPath) {
13563
13558
  path.get("children").forEach(recursePath);
13564
13559
  if (!SELF_CLOSING_TAGS.includes(tagName)) stringPart.push(`</${tagName}>`);
13565
13560
  } else {
13561
+ const componentName = isHTMLElement(nameNode.name) ? t.stringLiteral(nameNode.name) : jsxToObject(nameNode);
13566
13562
  const propsProperties = [];
13567
13563
  let keyValue = null;
13568
13564
  openingElement.attributes.forEach((attr) => {
13569
13565
  if (attr.type === "JSXAttribute") {
13570
- const attrName = attr.name.name;
13571
- const valNode = getAttrValue(attr.value);
13572
- if (attrName === "key") {
13573
- keyValue = valNode;
13566
+ if (attr.name.name === "key") {
13567
+ keyValue = getAttrValue(attr.value);
13574
13568
  } else {
13575
- propsProperties.push({ type: "Property", key: { type: "Identifier", name: attrName }, value: valNode, kind: "init" });
13569
+ propsProperties.push(createAttributeProperty(attr.name, attr.value));
13576
13570
  }
13577
13571
  } else if (attr.type === "JSXSpreadAttribute") {
13578
- propsProperties.push({ type: "SpreadElement", argument: attr.argument });
13572
+ propsProperties.push(t.spreadElement(attr.argument));
13579
13573
  }
13580
13574
  });
13575
+ const jsxArguments = [componentName, t.objectExpression(propsProperties)];
13581
13576
  const childrenPaths = path.get("children");
13582
13577
  if (childrenPaths && childrenPaths.length) {
13583
- propsProperties.push({
13584
- type: "Property",
13585
- key: { type: "Identifier", name: "children" },
13586
- value: transformToAstNode(getTaggedTemplate(childrenPaths)),
13587
- kind: "init"
13588
- });
13589
- }
13590
- pushToExpressions({
13591
- type: "CallExpression",
13592
- callee: {
13593
- type: "Identifier",
13594
- name: "_brahmosJSX"
13595
- },
13596
- arguments: keyValue ? [jsxNameToExpression(nameNode), { type: "ObjectExpression", properties: propsProperties }, keyValue] : [jsxNameToExpression(nameNode), { type: "ObjectExpression", properties: propsProperties }]
13597
- }, path, false);
13578
+ propsProperties.push(
13579
+ createAttributeProperty(
13580
+ t.identifier("children"),
13581
+ transformToAstNode(getTaggedTemplate(childrenPaths))
13582
+ )
13583
+ );
13584
+ }
13585
+ if (keyValue) {
13586
+ jsxArguments.push(keyValue);
13587
+ }
13588
+ const brahmosJSXFunction = t.identifier("_brahmosJSX");
13589
+ const expression = t.callExpression(brahmosJSXFunction, jsxArguments);
13590
+ pushToExpressions(expression, path, false);
13598
13591
  }
13599
13592
  } else if (node.type === "JSXFragment") {
13600
13593
  path.get("children").forEach(recursePath);
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- var Do=Object.defineProperty;var Po=(e,t)=>{for(var n in t)Do(e,n,{get:t[n],enumerable:!0})};var Zt={};Po(Zt,{Children:()=>_o,Component:()=>R,Fragment:()=>Mr,PureComponent:()=>ie,StrictMode:()=>vr,Suspense:()=>De,SuspenseList:()=>V,cloneElement:()=>Xt,createContext:()=>xt,createElement:()=>uo,createPortal:()=>yo,createRef:()=>Zn,createRoot:()=>xo,forwardRef:()=>st,html:()=>Eo,isValidElement:()=>Ao,jsx:()=>Lr,jsxDev:()=>Hr,jsxs:()=>kr,lazy:()=>To,memo:()=>qt,render:()=>Wt,startTransition:()=>xe,unmountComponentAtNode:()=>go,unstable_batchedUpdates:()=>wr,unstable_deferredUpdates:()=>Je,unstable_syncUpdates:()=>fe,use:()=>Fo,useCallback:()=>Ln,useContext:()=>Bn,useDebugValue:()=>Hn,useDeferredValue:()=>Kn,useEffect:()=>It,useLayoutEffect:()=>Dt,useMemo:()=>bt,useReducer:()=>wn,useRef:()=>Mn,useState:()=>Rt,useTransition:()=>Yn,watch:()=>pt});var we=Symbol.for("react.element"),rn=Symbol.for("react.forward_ref"),sn="{{brahmos}}",an={key:1,ref:1},cn={className:"class",htmlFor:"for",acceptCharset:"accept-charset",httpEquiv:"http-equiv",tabIndex:"tabindex"},dt={doubleclick:"dblclick"},pn=typeof Symbol!="undefined"?/fil|che|rad/i:/fil|che|ra/i,ln=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|fill|flood|font|glyph(?!R)|horiz|marker(?!H|W|U)|overline|paint|stop|strikethrough|stroke|text(?!L)|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,un=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|^--/i,ft="http://www.w3.org/1999/xlink",dn=100,d="__brahmosData",Le="__brahmosLastArrayDom",ke="__rootFiber",S="sync",y="deferred",he="js",O="immediate_action",C="transition",He=0,mt=1,x=2,fn="initial",X="start",ae="suspended",Ee="resolved",Tt="completed",K="timedOut";function mn(e){return e[0]==="o"&&e[1]==="n"}function Be(e){let t=ln.test(e)?e.replace(/[A-Z0-9]/,"-$&").toLowerCase():e;return cn[e]||t}function ht(e){return e.nodeName.toLowerCase()}function Tn(e,t){return t&&(e=e.replace(/Capture$/,"")),e.replace("on","").toLowerCase()}function q(e){return e==null}var Oo=0;function j(){return Oo++}function hn(){return Date.now()}function Ye(e){e.__brahmosData={events:{}}}function ce(e,t){if(!("key"in e||"ref"in e&&!t))return e;let n={},o;for(o in e)o!=="key"&&(o!=="ref"||t)&&(n[o]=e[o]);return n}function ye(e,t){let n=Object.keys(e);for(let o=0,r=n.length;o<r;o++){let s=n[o],a=e[s];t(s,a)}}function ge(e){Array.isArray(e)||(e=[e]);for(let t=e.length-1;t>=0;t--)e[t].remove()}function $(e,t){return t=t||0,Array.prototype.slice.call(e,t)}function Uo(e){let t=e instanceof NodeList;if(e instanceof Node)return e;if(Array.isArray(e)||t){let n=document.createDocumentFragment(),o=0;for(;e[o];)n.appendChild(e[o]),t||(o+=1);return n}return document.createTextNode(e)}function Ke(e,t,n){let o=Uo(n),r;return Array.isArray(n)?r=n:o instanceof DocumentFragment?r=$(o.childNodes):r=n,e.insertBefore(o,t),r}function pe(e,t){return t?t.nextSibling:e.firstChild}function w(e,t,n){if(e[t])return e[t].apply(e,n)}function En(e,t){let n=t===0?e.firstChild:e.childNodes[t],o=document.createTextNode("");return e.insertBefore(o,n),o}var je=Promise.resolve();function Ce(e){return je.then(e)}function Se(){return j()+"-"+Math.random()*1e6}function yn(e){let t="pending",n,o=e.then(r=>{t="success",n=r},r=>{t="error",n=r});return{read(){if(t==="pending")throw o;if(t==="error")throw n;if(t==="success")return n}}}function $e(e){return e[d].mounted}function Et(e){return e.displayName||e.name}function le({children:e}){return e}var ze={transitionId:"",tryCount:0,transitionState:K},U={transitionId:Se(),tryCount:0,transitionState:K};function vo(e){let{transitionState:t}=e;return t===X||t===Ee||t===K}function Ne(e){let{transitionState:t}=e;return t===Tt||t===K}function gn(e){let{transitionState:t}=e;t!==K&&t!==ae&&(e.isPending?(e.clearTimeout(),e.updatePendingState(!1,C)):e.transitionState=Tt)}function Q(e,t){return t=t||ze,e.root.currentTransition||t}function yt(e){let{pendingTransitions:t}=e;return t.find(vo)}var gt=Symbol.for("tag"),Z=Symbol.for("tag-element"),D=Symbol.for("class-component"),Ct=Symbol.for("functional-component"),z=Symbol.for("attribute");function G({nodeType:e}){return e===Z}function J({nodeType:e}){return e===gt}function B(e){return G(e)||J(e)}function A({nodeType:e}){return e===D||e===Ct}function Y(e){return typeof e=="string"||typeof e=="number"}function Ge(e){return!(q(e)||typeof e=="boolean")}function St(e,t){let n=e&&e.key;return n===void 0?t:n}function Ve(e,t,n){return{$$typeof:we,nodeType:null,key:n,ref:null,portalContainer:null,type:null,props:e,values:t,template:null}}var Sn;function Nt(e){Sn=e}function N(){return Sn}function _e(e){return e===y?"lastDeferredCompleteTime":"lastCompleteTime"}function ee(e){return e===y?"deferredUpdateTime":"updateTime"}function L(e,t){let n=ee(t),o=j();for(;e;)e[n]=o,e=e.parent}function Nn(e,t,n){t===n?n.child=e:t.sibling=e,e.parent=n}function F(e,t){e.hasUncommittedEffect=t,e.root.hasUncommittedEffect=!0}function We(e,t,n,o){let{root:r,node:s,part:a,nodeInstance:i,child:c}=e,p=ee(r.updateType);return t?(t.node=s,t.part=a,t.createdAt=j()):(t=ue(r,s,a),Mo(e,t)),e.shouldTearDown=!1,t.nodeInstance=i,t.child=c,t[p]=o[p],Nn(t,n,o),t}function _n(e,t){return e===t?e.child:e.sibling}function te(e){let{child:t,root:n}=e;if(n.updateType===S)return;let o;for(;t;){let{alternate:r}=t;o=We(t,r,o||e,e),t=t.sibling}}function Xe(e){let t=[];return{updateType:y,updateSource:he,cancelSchedule:null,domNode:e,forcedUpdateWith:null,current:null,wip:null,child:null,retryFiber:null,currentTransition:null,hasUncommittedEffect:!1,pendingTransitions:[],tearDownFibers:[],postCommitEffects:[],batchUpdates:{},lastDeferredCompleteTime:0,lastCompleteTime:0,deferredUpdateTime:0,updateTime:0,afterRender(n){t.includes(n)||t.push(n)},callRenderCallbacks(){for(let n=0,o=t.length;n<o;n++)t[n]()},resetRenderCallbacks(){t=[]}}}function ue(e,t,n){return t&&t.portalContainer&&(n.parentNode=t.portalContainer),{node:t,nodeInstance:null,root:e,parent:null,child:null,sibling:null,part:n,alternate:null,context:null,childFiberError:null,isSvgPart:!1,deferredUpdateTime:0,updateTime:0,processedTime:0,createdAt:j(),shouldTearDown:!1,hasUncommittedEffect:He}}function Mo(e,t){e&&(e.alternate=t),t.alternate=e}function ne(e,t,n,o,r){let{root:s}=o,a=ee(s.updateType),i;return n&&!q(n.node)&&!q(e)&&wo(e,n.node)?(i=We(n,n.alternate,o,r),i.node=e,i.part=t):(i=ue(s,e,t),n&&oe(n)),Nn(i,o,r),i.processedTime=0,i[a]=r[a],i.context=r.context,i.isSvgPart=r.isSvgPart,i}function wo(e,t){return Y(e)&&Y(t)||e.nodeType===z||Array.isArray(e)&&Array.isArray(t)||(A(e)||G(e))&&e.type===t.type||J(e)&&e.template===t.template}function Lo(e,t,n){return e&&e[n]>=t}function Cn(e,t,n){if(e){for(;e&&!Lo(e,t,n);)e=e.sibling;return e}}function An(e,t,n,o){let r=Cn(e.child,n,o);if(r)return r;let s;for(;!(s=Cn(e.sibling,n,o));)if(e=e.parent,e===t)return e;return s}function v(e){return e[d].fiber}function xn(e){let{root:t,child:n}=e;n&&n.createdAt>t.lastCompleteTime&&(e.child=n.alternate)}function oe(e){e.shouldTearDown=!0,e.root.tearDownFibers.push(e)}var Qe=he,qe=ze;function re(){return Qe}function _t(){return qe}function b(e,t){Qe=e,t(),Qe=he}function se(e,t){let n=qe;qe=e,b(C,t),qe=n}function Fn(e){return e.updateSource===O}function ko(){return Qe===C}function Ae(){return ko()?y:S}function Ze(e){return e===y?"pendingDeferredUpdates":"pendingSyncUpdates"}function de(e){let{root:{updateType:t},nodeInstance:n}=e,o=n[d],r=Ze(t);if(t===S)return o[r];let s=Q(e,null).transitionId;return o[r].filter(a=>a.transitionId===s)}function Je(e){se(U,e)}function fe(e){b(O,e)}function Ho(e,t){let{root:n}=e;for(;e.nodeInstance!==t;)if(e=e.parent,e===n)return null;return e}function et(e,t){let n,o,r=!0,s=e[d],a=N();if(a){let{renderCount:p}=s;if(p>50)throw new Error("Too many rerender. Check your setState call, this may cause an infinite loop.");let{root:l}=a;l.retryFiber=Ho(a,e),n=l.updateType,o=l.currentTransition||ze,r=!1}else s.renderCount=0,n=Ae(),o=_t();let i=Ze(n),c=t(o.transitionId);return s[i].push(c),r}var Bo=1;function At(e){return function(t){let n=v(e),{updateType:o}=n.root;e.context!==t&&(e[d].isDirty=!0,L(n,o))}}function xt(e){let t=`cC${Bo++}`;class n extends R{constructor(a){super(a),this.subs=[]}shouldComponentUpdate(a){let{value:i}=this.props;return i!==a.value&&this.subs.forEach(c=>c(a.value)),!0}sub(a){let{subs:i}=this,c=At(a);i.push(c);let{componentWillUnmount:p}=a;a.componentWillUnmount=()=>{i.splice(i.indexOf(c),1),p&&p()}}render(){return this.props.children}}n.__ccId=t;class o extends R{render(){return this.props.children(this.context)}}let r={id:t,defaultValue:e,Provider:n,Consumer:o};return o.contextType=r,r}function bn(){return N().nodeInstance}function In(e){let{renderCount:t}=e[d];e.deferredHooks=e.syncHooks.map((n,o)=>Array.isArray(n)?[...n]:n.transitionId?n:n.hasOwnProperty("current")&&t>1?e.deferredHooks[o]||n:{...n})}function Dn(e,t){let{syncHooks:n,deferredHooks:o}=t;return e===S?n:o}function tt(e){let{nodeInstance:t,root:{updateType:n}}=e;return Dn(n,t)}function Rn(e,t,n){return e===y&&!n.deferredHooks.length&&In(n),Dn(e,n)[t]}function Pn(e,t){if(!e||!t||e.length!==t.length)return!0;for(let n=0,o=e.length;n<o;n++)if(e[n]!==t[n])return!0;return!1}function Yo(e,t,n){(re()===O||!Object.is(t,n))&&M(e)}function Ft(e){return!1}function On(e){return e}function nt(e,t,n){let o=N(),{nodeInstance:r}=o,{pointer:s}=r,a=tt(o),i=a[s];return(!i||t(i))&&(i=e(),a[s]=i),r.pointer+=1,n(i)}function Un(){let e=N(),{nodeInstance:t,root:{updateType:n}}=e;t.pointer=0,n===y&&In(t),de(e).forEach(r=>r.updater())}function vn(e,t){let n=bn(),{pointer:o}=n;return nt(()=>(typeof e=="function"&&(e=e()),[e,s=>{let a=Ae(),i=Rn(S,o,n),c=i[0],p=t(s,c);et(n,f=>({transitionId:f,updater(){let m=Rn(a,o,n);m[0]=t(s,i[0])}}))&&Yo(n,p,c)}]),Ft,On)}function Rt(e){return vn(e,(t,n)=>(typeof t=="function"&&(t=t(n)),t))}function Mn(e){return nt(()=>({current:e}),Ft,On)}function wn(e,t,n){return vn(n?()=>n(t):t,(r,s)=>e(s,r))}function bt(e,t){return nt(()=>({value:e(),dependencies:t}),s=>Pn(t,s.dependencies),s=>s.value)}function Ln(e,t){return bt(()=>e,t)}function kn(e,t){let n=N(),{nodeInstance:o}=n,{pointer:r}=o,s=tt(n),a=s[r]||{animationFrame:null,cleanEffect:null},i={...a,isDependenciesChanged:Pn(t,a.dependencies),dependencies:t,effect(){i.isDependenciesChanged&&e(i)}};s[r]=i,o.pointer+=1}function It(e,t){kn(n=>{cancelAnimationFrame(n.animationFrame),n.animationFrame=requestAnimationFrame(()=>{setTimeout(()=>{n.cleanEffect=e()})})},t)}function Dt(e,t){kn(n=>{n.cleanEffect=e()},t)}function Hn(){}function Bn(e){let{nodeInstance:t,context:n}=N(),{id:o,defaultValue:r}=e,s=n[o],a=s?s.props.value:r;return Dt(()=>{if(s){let{subs:i}=s,c=At(t);return i.push(c),()=>{i.splice(i.indexOf(c),1)}}},[]),t.context=a,a}function xe(e){let t={transitionId:Se(),transitionState:X,pendingSuspense:[],tryCount:0};se(t,e)}function Yn(){let e=bn();return nt(()=>{let t={transitionId:Se(),tryCount:0,isPending:!1,transitionTimeout:null,pendingSuspense:[],transitionState:fn,clearTimeout(){clearTimeout(t.transitionTimeout)},updatePendingState(n,o){t.isPending=n,e[d].isDirty=!0;let r=()=>{M(e)};o===C?se(t,r):b(o,r)},startTransition(n){let o=re(),{root:r}=v(e);t.transitionState=X,t.pendingSuspense=[],t.clearTimeout(),se(t,n),r.lastDeferredCompleteTime<r.deferredUpdateTime&&t.updatePendingState(!0,o)}};return t},Ft,({startTransition:t,isPending:n})=>[n,t])}function Kn(e,t){let[n,o]=Rt(t!==void 0?t:e);return It(()=>{xe(()=>{o(e)})},[e]),n}function jn(e){let t=tt(e);for(let n=0,o=t.length;n<o;n++){let r=t[n];r.effect&&r.effect()}}function ot(e,t){let n=tt(e);for(let o=0,r=n.length;o<r;o++){let s=n[o];s.cleanEffect&&(s.isDependenciesChanged||t)&&s.cleanEffect(),s.clearTimeout&&t&&s.clearTimeout()}}function Pt(e){return{syncHooks:[],deferredHooks:[],context:void 0,pointer:0,__render(t){Un();let n=e(t);return this[d].nodes=n,n},__unmount:new Map,[d]:{pendingSyncUpdates:[],pendingDeferredUpdates:[],fiber:null,nodes:null,isDirty:!1,mounted:!1,renderCount:0}}}function Ko(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;let n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;for(let r=0;r<n.length;r++)if(!hasOwnProperty.call(t,n[r])||!Object.is(e[n[r]],t[n[r]]))return!1;return!0}var Ot=Ko;function jo(e){let{root:t}=e;for(;(e=e.parent)&&!(e.nodeInstance instanceof R&&(e.nodeInstance.componentDidCatch||e.node.type.getDerivedStateFromError));)if(e===t)return null;return e}function $o(e){let t="";for(;e;){let{node:n}=e;n&&A(n)&&n.type!==le&&(t+=` at ${Et(n.type)}
1
+ var Do=Object.defineProperty;var Po=(e,t)=>{for(var n in t)Do(e,n,{get:t[n],enumerable:!0})};var Zt={};Po(Zt,{Children:()=>_o,Component:()=>R,Fragment:()=>Mr,PureComponent:()=>ie,StrictMode:()=>vr,Suspense:()=>De,SuspenseList:()=>V,cloneElement:()=>Xt,createContext:()=>xt,createElement:()=>uo,createPortal:()=>yo,createRef:()=>Zn,createRoot:()=>xo,forwardRef:()=>st,html:()=>Eo,isValidElement:()=>Ao,jsx:()=>Lr,jsxDev:()=>Hr,jsxs:()=>kr,lazy:()=>To,memo:()=>qt,render:()=>Wt,startTransition:()=>xe,unmountComponentAtNode:()=>go,unstable_batchedUpdates:()=>wr,unstable_deferredUpdates:()=>Je,unstable_syncUpdates:()=>fe,use:()=>Fo,useCallback:()=>Ln,useContext:()=>Bn,useDebugValue:()=>Hn,useDeferredValue:()=>Kn,useEffect:()=>It,useLayoutEffect:()=>Dt,useMemo:()=>bt,useReducer:()=>wn,useRef:()=>Mn,useState:()=>Rt,useTransition:()=>Yn,watch:()=>pt});var we=Symbol.for("react.element"),rn=Symbol.for("react.forward_ref"),sn="{{brahmos}}",an={key:1,ref:1},cn={className:"class",htmlFor:"for",acceptCharset:"accept-charset",httpEquiv:"http-equiv",tabIndex:"tabindex"},dt={doubleclick:"dblclick"},pn=typeof Symbol!="undefined"?/fil|che|rad/i:/fil|che|ra/i,ln=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|fill|flood|font|glyph(?!R)|horiz|marker(?!H|W|U)|overline|paint|stop|strikethrough|stroke|text(?!L)|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,un=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|^--/i,ft="http://www.w3.org/1999/xlink",dn=100,d="__brahmosData",Le="__brahmosLastArrayDom",ke="__rootFiber",S="sync",y="deferred",he="js",O="immediate_action",C="transition",He=0,mt=1,x=2,fn="initial",X="start",ae="suspended",Ee="resolved",Tt="completed",K="timedOut";function mn(e){return e[0]==="o"&&e[1]==="n"}function Be(e){let t=ln.test(e)?e.replace(/[A-Z0-9]/,"-$&").toLowerCase():e;return cn[e]||t}function ht(e){return e.nodeName.toLowerCase()}function Tn(e,t){return t&&(e=e.replace(/Capture$/,"")),e.replace("on","").toLowerCase()}function q(e){return e==null}var Oo=0;function j(){return Oo++}function hn(){return Date.now()}function Ye(e){e.__brahmosData={events:{}}}function ce(e,t){if(!("key"in e||"ref"in e&&!t))return e;let n={},o;for(o in e)o!=="key"&&(o!=="ref"||t)&&(n[o]=e[o]);return n}function ye(e,t){let n=Object.keys(e);for(let o=0,r=n.length;o<r;o++){let s=n[o],a=e[s];t(s,a)}}function ge(e){Array.isArray(e)||(e=[e]);for(let t=e.length-1;t>=0;t--)e[t].remove()}function $(e,t){return t=t||0,Array.prototype.slice.call(e,t)}function Uo(e){let t=e instanceof NodeList;if(e instanceof Node)return e;if(Array.isArray(e)||t){let n=document.createDocumentFragment(),o=0;for(;e[o];)n.appendChild(e[o]),t||(o+=1);return n}return document.createTextNode(e)}function Ke(e,t,n){let o=Uo(n),r;return Array.isArray(n)?r=n:o instanceof DocumentFragment?r=$(o.childNodes):r=n,e.insertBefore(o,t),r}function pe(e,t){return t?t.nextSibling:e.firstChild}function w(e,t,n){if(e[t])return e[t].apply(e,n)}function En(e,t){let n=t===0?e.firstChild:e.childNodes[t],o=document.createTextNode("");return e.insertBefore(o,n),o}var je=Promise.resolve();function Ce(e){return je.then(e)}function Se(){return j()+"-"+Math.random()*1e6}function yn(e){let t="pending",n,o=e.then(r=>{t="success",n=r},r=>{t="error",n=r});return{read(){if(t==="pending")throw o;if(t==="error")throw n;if(t==="success")return n}}}function $e(e){return e[d].mounted}function Et(e){return e.displayName||e.name}function le({children:e}){return e}var ze={transitionId:"",tryCount:0,transitionState:K},U={transitionId:Se(),tryCount:0,transitionState:K};function vo(e){let{transitionState:t}=e;return t===X||t===Ee||t===K}function Ne(e){let{transitionState:t}=e;return t===Tt||t===K}function gn(e){let{transitionState:t}=e;t!==K&&t!==ae&&(e.isPending?(e.clearTimeout(),e.updatePendingState(!1,C)):e.transitionState=Tt)}function Q(e,t){return t=t||ze,e.root.currentTransition||t}function yt(e){let{pendingTransitions:t}=e;return t.find(vo)}var gt=Symbol.for("tag"),Z=Symbol.for("tag-element"),D=Symbol.for("class-component"),Ct=Symbol.for("functional-component"),z=Symbol.for("attribute");function G({nodeType:e}){return e===Z}function J({nodeType:e}){return e===gt}function B(e){return G(e)||J(e)}function A({nodeType:e}){return e===D||e===Ct}function Y(e){return typeof e=="string"||typeof e=="number"}function Ge(e){return!(q(e)||typeof e=="boolean")}function St(e,t){let n=e&&e.key;return n===void 0?t:n}function Ve(e,t,n){return{$$typeof:we,nodeType:null,key:n,ref:null,portalContainer:null,type:null,props:e,values:t,template:null}}var Sn;function Nt(e){Sn=e}function N(){return Sn}function _e(e){return e===y?"lastDeferredCompleteTime":"lastCompleteTime"}function ee(e){return e===y?"deferredUpdateTime":"updateTime"}function L(e,t){let n=ee(t),o=j();for(;e;)e[n]=o,e=e.parent}function Nn(e,t,n){t===n?n.child=e:t.sibling=e,e.parent=n}function F(e,t){e.hasUncommittedEffect=t,e.root.hasUncommittedEffect=!0}function We(e,t,n,o){let{root:r,node:s,part:a,nodeInstance:i,child:c}=e,p=ee(r.updateType);return t?(t.node=s,t.part=a,t.createdAt=j()):(t=ue(r,s,a),Mo(e,t)),e.shouldTearDown=!1,t.nodeInstance=i,t.child=c,t[p]=o[p],Nn(t,n,o),t}function _n(e,t){return e===t?e.child:e.sibling}function te(e){let{child:t,root:n}=e;if(n.updateType===S)return;let o;for(;t;){let{alternate:r}=t;o=We(t,r,o||e,e),t=t.sibling}}function Xe(e){let t=[];return{updateType:y,updateSource:he,cancelSchedule:null,domNode:e,forcedUpdateWith:null,current:null,wip:null,child:null,retryFiber:null,currentTransition:null,hasUncommittedEffect:!1,pendingTransitions:[],tearDownFibers:[],postCommitEffects:[],batchUpdates:{},lastDeferredCompleteTime:0,lastCompleteTime:0,deferredUpdateTime:0,updateTime:0,afterRender(n){t.includes(n)||t.push(n)},callRenderCallbacks(){for(let n=0,o=t.length;n<o;n++)t[n]()},resetRenderCallbacks(){t=[]}}}function ue(e,t,n){return t&&t.portalContainer&&(n.parentNode=t.portalContainer),{node:t,nodeInstance:null,root:e,parent:null,child:null,sibling:null,part:n,alternate:null,context:null,childFiberError:null,isSvgPart:!1,deferredUpdateTime:0,updateTime:0,processedTime:0,createdAt:j(),shouldTearDown:!1,hasUncommittedEffect:He}}function Mo(e,t){e&&(e.alternate=t),t.alternate=e}function ne(e,t,n,o,r){let{root:s}=o,a=ee(s.updateType),i;return n&&!q(n.node)&&!q(e)&&wo(e,n.node)?(i=We(n,n.alternate,o,r),i.node=e,i.part=t):(i=ue(s,e,t),n&&oe(n)),Nn(i,o,r),i.processedTime=0,i[a]=r[a],i.context=r.context,i.isSvgPart=r.isSvgPart,i}function wo(e,t){return Y(e)&&Y(t)||e.nodeType===z||Array.isArray(e)&&Array.isArray(t)||(A(e)||G(e))&&e.type===t.type||J(e)&&e.template===t.template}function Lo(e,t,n){return e&&e[n]>=t}function Cn(e,t,n){if(e){for(;e&&!Lo(e,t,n);)e=e.sibling;return e}}function An(e,t,n,o){let r=Cn(e.child,n,o);if(r)return r;let s;for(;!(s=Cn(e.sibling,n,o));)if(e=e.parent,e===t)return e;return s}function v(e){return e[d].fiber}function xn(e){let{root:t,child:n}=e;n&&n.createdAt>t.lastCompleteTime&&(e.child=n.alternate)}function oe(e){e.shouldTearDown=!0,e.root.tearDownFibers.push(e)}var Qe=he,qe=ze;function re(){return Qe}function _t(){return qe}function b(e,t){Qe=e,t(),Qe=he}function se(e,t){let n=qe;qe=e,b(C,t),qe=n}function Fn(e){return e.updateSource===O}function ko(){return Qe===C}function Ae(){return ko()?y:S}function Ze(e){return e===y?"pendingDeferredUpdates":"pendingSyncUpdates"}function de(e){let{root:{updateType:t},nodeInstance:n}=e,o=n[d],r=Ze(t);if(t===S)return o[r];let s=Q(e,null).transitionId;return o[r].filter(a=>a.transitionId===s)}function Je(e){se(U,e)}function fe(e){b(O,e)}function Ho(e,t){let{root:n}=e;for(;e.nodeInstance!==t;)if(e=e.parent,e===n)return null;return e}function et(e,t){let n,o,r=!0,s=e[d],a=N();if(a){let{renderCount:p}=s;if(p>50)throw new Error("Too many rerender. Check your setState call, this may cause an infinite loop.");let{root:l}=a;l.retryFiber=Ho(a,e),n=l.updateType,o=l.currentTransition||ze,r=!1}else s.renderCount=0,n=Ae(),o=_t();let i=Ze(n),c=t(o.transitionId);return s[i].push(c),r}var Bo=1;function At(e){return function(t){let n=v(e),{updateType:o}=n.root;e.context!==t&&(e[d].isDirty=!0,L(n,o))}}function xt(e){let t=`cC${Bo++}`;class n extends R{constructor(s){super(s),this.subs=[]}shouldComponentUpdate(s){let{value:a}=this.props;return a!==s.value&&this.subs.forEach(i=>i(s.value)),!0}sub(s){let{subs:a}=this,i=At(s);a.push(i);let{componentWillUnmount:c}=s;s.componentWillUnmount=()=>{a.splice(a.indexOf(i),1),c&&c()}}render(){return this.props.children}}n.__ccId=t;class o extends R{render(){return this.props.children(this.context)}}return n.id=t,n.defaultValue=e,n.Provider=n,n.Consumer=o,o.contextType=n,n}function bn(){return N().nodeInstance}function In(e){let{renderCount:t}=e[d];e.deferredHooks=e.syncHooks.map((n,o)=>Array.isArray(n)?[...n]:n.transitionId?n:n.hasOwnProperty("current")&&t>1?e.deferredHooks[o]||n:{...n})}function Dn(e,t){let{syncHooks:n,deferredHooks:o}=t;return e===S?n:o}function tt(e){let{nodeInstance:t,root:{updateType:n}}=e;return Dn(n,t)}function Rn(e,t,n){return e===y&&!n.deferredHooks.length&&In(n),Dn(e,n)[t]}function Pn(e,t){if(!e||!t||e.length!==t.length)return!0;for(let n=0,o=e.length;n<o;n++)if(e[n]!==t[n])return!0;return!1}function Yo(e,t,n){(re()===O||!Object.is(t,n))&&M(e)}function Ft(e){return!1}function On(e){return e}function nt(e,t,n){let o=N(),{nodeInstance:r}=o,{pointer:s}=r,a=tt(o),i=a[s];return(!i||t(i))&&(i=e(),a[s]=i),r.pointer+=1,n(i)}function Un(){let e=N(),{nodeInstance:t,root:{updateType:n}}=e;t.pointer=0,n===y&&In(t),de(e).forEach(r=>r.updater())}function vn(e,t){let n=bn(),{pointer:o}=n;return nt(()=>(typeof e=="function"&&(e=e()),[e,s=>{let a=Ae(),i=Rn(S,o,n),c=i[0],p=t(s,c);et(n,f=>({transitionId:f,updater(){let m=Rn(a,o,n);m[0]=t(s,i[0])}}))&&Yo(n,p,c)}]),Ft,On)}function Rt(e){return vn(e,(t,n)=>(typeof t=="function"&&(t=t(n)),t))}function Mn(e){return nt(()=>({current:e}),Ft,On)}function wn(e,t,n){return vn(n?()=>n(t):t,(r,s)=>e(s,r))}function bt(e,t){return nt(()=>({value:e(),dependencies:t}),s=>Pn(t,s.dependencies),s=>s.value)}function Ln(e,t){return bt(()=>e,t)}function kn(e,t){let n=N(),{nodeInstance:o}=n,{pointer:r}=o,s=tt(n),a=s[r]||{animationFrame:null,cleanEffect:null},i={...a,isDependenciesChanged:Pn(t,a.dependencies),dependencies:t,effect(){i.isDependenciesChanged&&e(i)}};s[r]=i,o.pointer+=1}function It(e,t){kn(n=>{cancelAnimationFrame(n.animationFrame),n.animationFrame=requestAnimationFrame(()=>{setTimeout(()=>{n.cleanEffect=e()})})},t)}function Dt(e,t){kn(n=>{n.cleanEffect=e()},t)}function Hn(){}function Bn(e){let{nodeInstance:t,context:n}=N(),{id:o,defaultValue:r}=e,s=n[o],a=s?s.props.value:r;return Dt(()=>{if(s){let{subs:i}=s,c=At(t);return i.push(c),()=>{i.splice(i.indexOf(c),1)}}},[]),t.context=a,a}function xe(e){let t={transitionId:Se(),transitionState:X,pendingSuspense:[],tryCount:0};se(t,e)}function Yn(){let e=bn();return nt(()=>{let t={transitionId:Se(),tryCount:0,isPending:!1,transitionTimeout:null,pendingSuspense:[],transitionState:fn,clearTimeout(){clearTimeout(t.transitionTimeout)},updatePendingState(n,o){t.isPending=n,e[d].isDirty=!0;let r=()=>{M(e)};o===C?se(t,r):b(o,r)},startTransition(n){let o=re(),{root:r}=v(e);t.transitionState=X,t.pendingSuspense=[],t.clearTimeout(),se(t,n),r.lastDeferredCompleteTime<r.deferredUpdateTime&&t.updatePendingState(!0,o)}};return t},Ft,({startTransition:t,isPending:n})=>[n,t])}function Kn(e,t){let[n,o]=Rt(t!==void 0?t:e);return It(()=>{xe(()=>{o(e)})},[e]),n}function jn(e){let t=tt(e);for(let n=0,o=t.length;n<o;n++){let r=t[n];r.effect&&r.effect()}}function ot(e,t){let n=tt(e);for(let o=0,r=n.length;o<r;o++){let s=n[o];s.cleanEffect&&(s.isDependenciesChanged||t)&&s.cleanEffect(),s.clearTimeout&&t&&s.clearTimeout()}}function Pt(e){return{syncHooks:[],deferredHooks:[],context:void 0,pointer:0,__render(t){Un();let n=e(t);return this[d].nodes=n,n},__unmount:new Map,[d]:{pendingSyncUpdates:[],pendingDeferredUpdates:[],fiber:null,nodes:null,isDirty:!1,mounted:!1,renderCount:0}}}function Ko(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;let n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;for(let r=0;r<n.length;r++)if(!hasOwnProperty.call(t,n[r])||!Object.is(e[n[r]],t[n[r]]))return!1;return!0}var Ot=Ko;function jo(e){let{root:t}=e;for(;(e=e.parent)&&!(e.nodeInstance instanceof R&&(e.nodeInstance.componentDidCatch||e.node.type.getDerivedStateFromError));)if(e===t)return null;return e}function $o(e){let t="";for(;e;){let{node:n}=e;n&&A(n)&&n.type!==le&&(t+=` at ${Et(n.type)}
2
2
  `),e=e.parent}return{componentStack:t}}function zo(e){let{node:{type:t},nodeInstance:n,parent:o}=e,{__ccId:r}=t,s=o.context||{};if(!r)return s;let a=Object.create(s);return a[r]=n,a}function Go(e,t){return t.reduce((n,{state:o})=>(typeof o=="function"&&(o=o(n)),{...n,...o}),e)}function $n(e){let{root:t,nodeInstance:n}=e;n[d].isDirty=!0,t.retryFiber=e}function Ut(e){let{node:t,part:n,root:o,childFiberError:r}=e,{type:s,nodeType:a,props:i={}}=t,{currentTransition:c}=o,p=o.updateType===y,l=!0,f=!1,m=a===D;xn(e);let{nodeInstance:u}=e,T=!1;u||(u=m?new s(i):Pt(s),e.nodeInstance=u,T=!0);let _=u[d],E=zo(e);if(e.context=E,m){let h=u,g=_,{committedValues:k,memoizedValues:P}=g;T&&(k.state=h.state);let{props:W,state:Te}=k;P&&c&&c.transitionId===P.transitionId&&({props:W,state:Te}=P,f=!0),h.props=W,h.state=Te;let{shouldComponentUpdate:Jt}=h,H=Te,lt=de(e);lt.length&&(H=Go(Te,lt));let en=!T&&o.forcedUpdateWith!==u,tn=w(s,"getDerivedStateFromProps",[i,H]),nn=r?w(s,"getDerivedStateFromError",[r.error]):void 0;(tn||nn)&&(H={...H,...tn,...nn}),h.isPureReactComponent&&en&&(l=!Ot(H,Te)||!Ot(i,W)),Jt&&l&&en&&(l=Jt.call(h,i,H));let{contextType:on}=s;if(on){let{id:ve,defaultValue:ut}=on,Me=E[ve],Io=Me?Me.props.value:ut;Me&&T&&Me.sub(h),h.context=Io}h.state=H,h.props=i,lt.forEach(({callback:ve})=>{if(ve){let{updateSource:ut}=o;Ce(()=>{b(ut,()=>ve(H))})}}),c&&(g.memoizedValues={state:H,props:i,transitionId:c.transitionId})}if(l){Nt(e),_.renderCount+=1;let h=r&&!s.getDerivedStateFromError;try{h?_.nodes=null:u.__render(i)}catch(g){let k=jo(e);if(typeof g.then=="function"){let P=rt(e);if(!P)throw new Error("Rendering which got suspended can't be used outside of suspense.");P.nodeInstance.handleSuspender(g,P);let W=zn(P);$n(W)}else if(k&&!k.childFiberError){let P=$o(e);console.error(g);let W=`The above error occurred in the <${Et(t.type)}> component:
3
3
  ${P.componentStack}`;console.error(W),k.childFiberError={error:g,errorInfo:P},$n(k)}else throw g;return}finally{Nt(null);let g=u[d];if(m&&p){let{committedValues:k}=g;Object.assign(u,k)}}}if(f||l){let{child:h}=e,{nodes:g}=_;!h||h.node!==g?(ne(g,n,h,e,e),F(e,x)):f||te(e)}else te(e)}function Gn(e){let{node:t,alternate:n}=e,o=n&&n.node;t!==o&&F(e,x)}function vt(e,t){let{type:n}=e,o=t?document.createElementNS("http://www.w3.org/2000/svg",n):document.createElement(n);return Ye(o),{fragment:[o],domNodes:[o],parts:[{previousSibling:null,parentNode:o,isNode:!0}]}}function Vo(e){return!!e&&e.nodeType===8&&e.textContent===sn}var Fe=class{constructor(t,n){this.templateResult=t,t.create(n),this.fragment=this.createNode(n),this.parts=this.getParts(),this.domNodes=$(this.fragment.childNodes),this.patched=!1}createNode(t){let{template:n,svgTemplate:o}=this.templateResult,r=t?o:n;return document.importNode(r.content,!0)}getParts(){let{fragment:t,templateResult:n}=this,{partsMeta:o}=n,r=[],s=t.querySelectorAll("*");for(let a=0,i=o.length;a<i;a++){let c=o[a],{isAttribute:p,attrIndex:l,refNodeIndex:f,prevChildIndex:m,hasExpressionSibling:u}=c,T=s[f];if(p)c.tagAttrs||(c.tagAttrs=$(T.attributes)),r.push({isAttribute:!0,tagAttrs:c.tagAttrs,domNode:T,attrIndex:l}),Ye(T);else{T=T||t;let _=m!==-1,E,h=T.childNodes[m+1];_&&Vo(h)&&ge(h),_?u?E=En(T,m):E=T.childNodes[m]:E=null,r.push({isNode:!0,parentNode:T,previousSibling:E})}}return r}patchParts(t){let{parts:n}=this,{parentNode:o,previousSibling:r}=t;if(!this.patched){for(let s=0,a=n.length;s<a;s++){let i=n[s];i.isNode&&i.parentNode instanceof DocumentFragment&&(i.parentNode=o,i.previousSibling=i.previousSibling||r)}this.patched=!0}}};function Wo(e,t,n){let o=e.lastIndexOf(t);return n<=o}function Xo(e,t){return{nodeType:z,props:e,ref:t}}function qo(e,t,n){let o=n,r=n.child;for(let s=0,a=e.length;s<a;s++){let i=e[s],c=t[s],p;if(i.isAttribute){let{domNode:l}=i,f={},m;for(;i&&l===i.domNode;)ye(t[s],(u,T)=>{let _=i,E=Be(u);!Wo(_.tagAttrs,E,_.attrIndex)&&!an[u]?f[u]=T:u==="ref"&&(m=T)}),i=e[++s];s--,i=e[s],p=Xo(f,m)}else i.isNode&&(p=c);o=ne(p,i,r,o,n),r=r&&r.sibling}}function Mt(e){let{node:t}=e,{part:n,alternate:o,parent:{context:r}}=e,s=o&&o.node,{values:a,nodeType:i}=t,c=i===Z,p=e.isSvgPart||t.type==="svg";e.isSvgPart=p;let{nodeInstance:l}=e;l||(l=c?vt(t,p):new Fe(t.template,p),e.nodeInstance=l),c||l.patchParts(n),t!==s?c?ne(t.props.children,l.parts[0],e.child,e,e):qo(l.parts,a,e):te(e),F(e,x),e.context=r}function Vn(e,t){let{type:n}=t,o=ht(t);return dt[e]?dt[e]:/^change(textarea|input)/i.test(e+o)&&!pn.test(n)?"input":e}function wt(e){let{type:t}=e,n=ht(e);if(n==="input"&&(t==="radio"||t==="checkbox"))return"checked";if(n==="input"||n==="select"||n==="textarea")return"value"}function Wn(e){let t=wt(e);if(!t)return;let n=e[`${t}Prop`],o=e[t];n!==void 0&&n!==o&&(e[t]=n)}function Xn(e,t,n,o){e==="checked"?n==="checked"?(t.checked=o,t.checkedProp=o):n==="defaultChecked"&&t.checkedProp===void 0?t.checked=o:t[n]=o:e==="value"&&(n==="value"?(t.value=o,t.valueProp=o):n==="defaultValue"&&t.valueProp===void 0?t.value=o:t[n]=o)}function qn(e,t,n){let o=e.__brahmosData.events,r=o[t];return r?(r.handler=n,r.patched):(r=o[t]={handler:n,patched:null},r.patched=function(s){r.handler&&fe(()=>{r.handler.call(this,s)})},r.patched)}function Qn(e,t,n,o){t=t||{},ye(e,(r,s)=>{let a=t[r];s!==a&&o(r,s,a)}),ye(t,(r,s)=>{e[r]===void 0&&s!==void 0&&o(r,n,s)})}function Qo(e,t,n,o,r){if(t==="children")return;if(mn(t)){let a=t.substr(-7)==="Capture"&&t.substr(-14,7)==="Pointer",i=Tn(t,a);i=Vn(i,e);let c=qn(e,t,n);o&&!n?e.removeEventListener(i,c,a):!o&&n&&e.addEventListener(i,c,a)}else if(t==="style"){let{style:a}=e;Qn(n||{},o,"",(i,c)=>{i[0]==="-"?a.setProperty(i,c):a[i]=typeof c=="number"&&un.test(i)===!1?c+"px":c})}else if(t==="dangerouslySetInnerHTML"){let a=o&&o.__html,i=n&&n.__html;i!==a&&(e.innerHTML=i==null?"":i)}else if(t in e&&!r){let a=wt(e);a?Xn(a,e,t,n):e[t]=n==null?"":n}else{t=Be(t);let a=t.replace(/^xlink:?/,""),i=n==null||n===!1;t!==a?(a=a.toLowerCase(),i?e.removeAttributeNS(ft,a):e.setAttributeNS(ft,a,n)):i?e.removeAttribute(t):e.setAttribute(t,n)}}function Lt(e,t,n,o){Qn(t,n,null,(r,s,a)=>{Qo(e,r,s,a,o)}),Wn(e)}function st(e){function t(n){return e(ce(n,!1),n.ref)}return t.__isForwardRef=!0,t.$$typeof=rn,t}function Zn(){return{current:null}}function Re(e,t){typeof e=="function"?e(t):typeof e=="object"&&(e.current=t)}function Zo(e){let{node:t,alternate:n}=e,o=e.part,{parentNode:r,previousSibling:s}=o,a=pe(r,s);n&&a?a.nodeValue=t:Ke(r,a,t)}function Jo(e){for(;e.child&&e.node&&!B(e.node);)e=e.child;return e}function Jn(e,t){let{domNodes:n}=t;e[Le]=n[n.length-1]}function eo(e,t){if(e.isArrayNode&&e.nodeIndex===0)for(;e=e.parentArrayPart;)e.firstDOMNode=t}function to(e){let{previousSibling:t}=e;if(e.isArrayNode){let{firstDOMNode:n,nodeIndex:o}=e;o>0?t=e.parentNode[Le]:e.parentArrayPart&&(t=n?n.previousSibling:e.parentNode[Le])}return t}function no(e,t){let{part:n}=e;if(!n.isArrayNode)return;let{nodeIndex:o,parentNode:r}=n,s=t.part.nodeIndex,a=Jo(e),{nodeInstance:i}=a,c=a!==e&&a.hasUncommittedEffect;if(!(!i||c)){if(o!==s){let{domNodes:p}=i,l=to(n),f=pe(r,l),m=p[0];m&&m.previousSibling!==l&&m!==f&&Ke(r,f,p),eo(n,m)}Jn(r,i)}}function er(e){let{nodeInstance:t,alternate:n,node:o}=e,r=e.part,{parentNode:s}=r,a=G(o);if(a&&oo(e,t.domNodes[0]),n)no(e,n);else{let i=to(r),c=pe(s,i),p=Ke(s,c,t.fragment);a||(t.domNodes=p),eo(r,p[0]),Jn(s,t)}}function tr(e){let{node:t,nodeInstance:n,root:o}=e,{updateType:r}=o,{nodeType:s}=t,a=n[d],i=r===y;if(s===D){i&&Object.assign(n,a.memoizedValues);let{props:l,state:f}=a.committedValues;a.lastSnapshot=w(n,"getSnapshotBeforeUpdate",[l,f])}else ot(e,!1);let{transitionId:c}=Q(e,null),p=Ze(r);a[p]=i?a[p].filter(l=>l.transitionId!==c):[],a.isDirty=!1,a.renderCount=0,o.postCommitEffects.push(e)}function nr(e){let{node:t,nodeInstance:n,root:o,childFiberError:r}=e,{updateType:s}=o,{nodeType:a,ref:i}=t,c=n[d];if(a===D){let{props:p,state:l}=n,{committedValues:f,lastSnapshot:m}=c,{props:u,state:T}=f;u?w(n,"componentDidUpdate",[u,T,m]):w(n,"componentDidMount"),r&&(w(n,"componentDidCatch",[r.error,r.errorInfo]),e.childFiberError=null),i&&Re(i,n),f.props=p,f.state=l,c.memoizedValues=null}else if(jn(e),s===y){let{syncHooks:p,deferredHooks:l}=n;n.deferredHooks=p,n.syncHooks=l}c.mounted=!0,c.fiber=e}function oo(e,t){let{node:n,alternate:o,isSvgPart:r}=e,{props:s,ref:a}=n,i=o&&o.node.props;Lt(t,s,i,r),a&&Re(a,t)}function it(e){e.tearDownFibers=[],e.postCommitEffects=[],e.hasUncommittedEffect=!1,e.retryFiber=null,e.resetRenderCallbacks()}function or(e){e.node=null,e.nodeInstance=null,e.child=null,e.sibling=null}function kt(e){let{currentTransition:t,pendingTransitions:n}=e,o=n.indexOf(t);o!==-1&&n.splice(o,1)}function rr(e){let{node:t,alternate:n}=e,o=t&&A(t);o&&n&&no(e,n),e.hasUncommittedEffect===x&&(Y(t)?Zo(e):B(t)?er(e):o?tr(e):t.nodeType===z&&oo(e,e.part.domNode),e.hasUncommittedEffect=He),n&&or(n)}function ro(e){let{updateType:t,wip:n,current:o}=e,r=ee(t),s=e[_e(t)],a=[],i=t===S?o:n;for(;i;){let{createdAt:c,node:p,child:l,hasUncommittedEffect:f}=i,m=i[r],u=c>s,T=f||m>s;if(f&&a.push(i),u&&(l&&l.parent!==i&&(l.parent=i),p&&A(p)&&(i.nodeInstance[d].fiber=i)),l&&T)i=l;else{for(;i!==e&&!i.sibling;)i=i.parent;i=i.sibling}}return a}function Ht(e,t){for(let o=0,r=t.length;o<r;o++)rr(t[o]);let{postCommitEffects:n}=e;for(let o=n.length-1;o>=0;o--)nr(n[o]);kt(e),it(e),e.forcedUpdateWith=null}function Bt(e){let{node:t,part:n}=e,o=e,{parentNode:r,previousSibling:s,firstDOMNode:a}=n,i=new Map,c=0,p=e;for(;p=_n(p,e);){let l=St(p.node,c);i.set(l,p),c++}e.child=null,t.forEach((l,f)=>{let m=St(l,f),u=i.get(m);u&&i.delete(m);let T=o;o=ne(l,{parentNode:r,previousSibling:s,a:void 0,firstDOMNode:a,isArrayNode:!0,nodeIndex:f,parentArrayPart:n.isArrayNode?n:null},u,T,e),o.sibling=null,u&&u.part.nodeIndex!==f&&(F(o,mt),f!==0&&F(T,mt))}),i.forEach(l=>{oe(l)}),F(e,x)}function so(e,t,n,o){let r=e.part.parentNode!==t.parentNode&&n?!1:o,{node:s}=e;s&&s.portalContainer&&(r=!0),io(e,r)}function io(e,t){let{node:n,part:o,nodeInstance:r}=e;if(e.shouldTearDown=!1,!Ge(n))return;let s=B(n),{child:a}=e;if(a)for(so(a,o,s,t);a.sibling;)a=a.sibling,so(a,o,s,t);if(Y(n)&&t){let c=pe(o.parentNode,o.previousSibling);c&&ge(c);return}let{ref:i}=n;if(i&&Re(i,null),!!r)if(s){let{domNodes:c}=r;t&&ge(c)}else A(n)&&$e(r)&&(r.__unmount.forEach(c=>c()),r.__unmount.clear(),n.nodeType===D?w(r,"componentWillUnmount"):ot(e,!0))}function me(e){let{tearDownFibers:t}=e;t.forEach(n=>{n.shouldTearDown&&io(n,!0)}),e.tearDownFibers=[]}var ao=5,sr=30,Yt=16,ir=300,ar=600,po;requestAnimationFrame(e=>{po=e});var Kt=()=>performance.now(),co=()=>!0,lo=(e,t)=>(t=t||Yt,t-(e-po)%t),jt,be;if(typeof MessageChannel!="undefined"){be=[];let e=new MessageChannel;e.port1.onmessage=function(){be.forEach(t=>t())},jt=e.port2}function cr(e){if(!jt||lo(Kt())<1){let t=()=>{r(),e()},n=setTimeout(t,1),o=requestIdleCallback(t),r=()=>{clearTimeout(n),cancelIdleCallback(o)};return r}return be.push(e),jt.postMessage(null),()=>{let t=be.indexOf(e);t!==-1&&be.splice(t,1)}}function $t(e,t,n){let{cancelSchedule:o}=e;if(o&&(o(),e.cancelSchedule=null),t){e.cancelSchedule=cr(()=>{let{currentTransition:r}=e,s=r?r.tryCount:0,a=r===U?ir:ar,i=Kt(),c=Math.min(sr,ao+s),p=Math.floor(c/Yt)*Yt,l=()=>{let u=Kt(),T=lo(u,p),_=i+Math.min(ao,T);return u<_},m=s>a?co:l;n(m)});return}n(co)}function pr(e){let{node:t,nodeInstance:n}=e;return A(t)&&n?!!de(e).length||n[d].isDirty:!1}function lr(e){let{node:t,alternate:n}=e;if(!Ge(t)){n&&oe(n);return}let o=pr(e);if(e.processedTime&&!o){te(e);return}Y(t)?Gn(e):Array.isArray(t)?Bt(e):B(t)?Mt(e):A(t)?Ut(e):t.nodeType===z&&F(e,x),e.processedTime=j()}function ur(e){return e.updateType===S?!0:e.currentTransition?e.lastCompleteTime>=e.updateTime&&e.hasUncommittedEffect&&Ne(e.currentTransition):!1}var dr={fn:e=>{let{updateType:t,current:n}=e,o=_e(t);me(e);let r=ro(e);e[o]=e.lastCompleteTime=j(),t===y&&(e.current=e.wip,e.wip=n),b(O,()=>Ht(e,r))}};function at(e,t){let{root:n}=e,{updateType:o,currentTransition:r}=n,s=_e(o),a=ee(o),i=n[s],c=!Fn(n);$t(n,c,p=>{for(;e!==t;)if(p()){lr(e);let{retryFiber:f}=n;f?(e=f,t=n,n.retryFiber=null):e=An(e,t,i,a)}else{at(e,t);return}if(n.callRenderCallbacks(),r){let f=e===t&&!n.retryFiber,m=r.transitionState!==ae;f&&m&&(gn(r),r.tryCount=0),!n.hasUncommittedEffect&&Ne(r)&&kt(n)}ur(n)&&dr.fn(n),yt(n)&&b(C,()=>{n.updateSource=C,Ie(n)})})}function Ie(e){let t=yt(e);t&&(e.updateType=y,it(e),e.currentTransition=t,t.tryCount+=1,e.wip=We(e.current,e.wip,e,e),at(e.wip,e))}function ct(e){let{root:t,parent:n}=e;t.updateType=S,t.currentTransition=null,it(t),at(e,n)}function M(e){let t=v(e),{root:n}=t,{pendingTransitions:o,batchUpdates:r}=n,s=re(),a=_t(),i=Ae();if(L(t,i),s===C&&!o.includes(a)&&(a===U?o.unshift(a):o.push(a)),r[s]){r[s]+=1;return}r[s]=1,Ce(()=>{let c=r[s];r[s]=0;let p=s===C;if(!(p&&n.lastCompleteTime<n.updateTime))if(n.updateSource=s,p)Ie(n);else{let l=n.updateType===S&&n.cancelSchedule;ct(s===O&&!l&&c===1?t:n.current)}})}var R=class{constructor(t){this.props=t,this.state=void 0,this.context=void 0,this[d]={lastSnapshot:null,pendingSyncUpdates:[],pendingDeferredUpdates:[],fiber:null,nodes:null,mounted:!1,committedValues:{},memoizedValues:null,isDirty:!1,renderCount:0}}setState(t,n){et(this,r=>({state:t,transitionId:r,callback:n}))&&M(this)}forceUpdate(t){let n=this[d],{fiber:o}=n;o&&(o.root.forcedUpdateWith=this,this[d].isDirty=!0,M(this),t&&t(this.state))}render(){}__render(){let t=this.render();return this[d].nodes=t,t}};R.prototype.isReactComponent=!0;var ie=class extends R{};ie.prototype.isPureReactComponent=!0;function I(e,t,n){if(!e||typeof e!="string"&&typeof e!="function"){let c="Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: "+(e===null?"null":typeof e)+".";throw(typeof e=="undefined"||typeof e=="object"&&e!==null)&&(c+=`
4
4
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "potatejs",
3
- "version": "0.16.1",
3
+ "version": "0.17.0",
4
4
  "description": "Super charged UI library with modern React API and native templates.",
5
5
  "author": "uniho",
6
6
  "license": "MIT",