{"version":3,"file":"isDifferentTree.cjs","names":["propsDiffer"],"sources":["../../../src/Slots/utils/isDifferentTree.ts"],"sourcesContent":["import { isValidElement, type ReactNode, type ReactElement } from 'react';\nimport { propsDiffer } from './propsDiffer';\n\n/**\n * Recursively checks if two ReactNode trees are structurally different.\n *\n * - Primitives: strict equality\n * - Arrays: length + recursive item diff\n * - Elements: type + key + props (shallow, ignoring children) + recursive children diff\n *\n * @param a - Previous React node tree.\n * @param b - Next React node tree.\n * @returns `true` when the trees differ, otherwise `false`.\n */\nexport function isDifferentTree(a: ReactNode, b: ReactNode): boolean {\n  if (a === b) return false;\n\n  // Type mismatch\n  if (typeof a !== typeof b) return true;\n\n  // Array case\n  if (Array.isArray(a) && Array.isArray(b)) {\n    if (a.length !== b.length) return true;\n    for (let i = 0; i < a.length; i++) {\n      if (isDifferentTree(a[i], b[i])) return true;\n    }\n    return false;\n  }\n\n  // Primitive / non-element (text, number, etc.)\n  if (!isValidElement(a) || !isValidElement(b)) {\n    return a !== b;\n  }\n\n  // Element case: check type, key, props (ignoring children)\n  if (a.type !== b.type || a.key !== b.key) return true;\n\n  if (propsDiffer(a.props, b.props)) return true;\n\n  // Recurse on children (the subtree)\n  return isDifferentTree((a as ReactElement<any>).props.children, (b as ReactElement<any>).props.children);\n}\n"],"mappings":";;;;;;;;;;;;;;;AAcA,SAAgB,gBAAgB,GAAc,GAAuB;CACnE,IAAI,MAAM,GAAG,OAAO;CAGpB,IAAI,OAAO,MAAM,OAAO,GAAG,OAAO;CAGlC,IAAI,MAAM,QAAQ,CAAC,KAAK,MAAM,QAAQ,CAAC,GAAG;EACxC,IAAI,EAAE,WAAW,EAAE,QAAQ,OAAO;EAClC,KAAK,IAAI,IAAI,GAAG,IAAI,EAAE,QAAQ,KAC5B,IAAI,gBAAgB,EAAE,IAAI,EAAE,EAAE,GAAG,OAAO;EAE1C,OAAO;CACT;CAGA,IAAI,EAAA,GAAA,MAAA,eAAA,CAAgB,CAAC,KAAK,EAAA,GAAA,MAAA,eAAA,CAAgB,CAAC,GACzC,OAAO,MAAM;CAIf,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,OAAO;CAEjD,IAAIA,gCAAAA,YAAY,EAAE,OAAO,EAAE,KAAK,GAAG,OAAO;CAG1C,OAAO,gBAAiB,EAAwB,MAAM,UAAW,EAAwB,MAAM,QAAQ;AACzG"}