unframer 2.11.2 → 2.12.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.
Files changed (47) hide show
  1. package/dist/exporter.d.ts +3 -0
  2. package/dist/exporter.d.ts.map +1 -1
  3. package/dist/exporter.js +54 -30
  4. package/dist/exporter.js.map +1 -1
  5. package/dist/exporter.test.js +3 -0
  6. package/dist/exporter.test.js.map +1 -1
  7. package/dist/framer.d.ts.map +1 -1
  8. package/dist/framer.js +840 -488
  9. package/dist/framer.js.map +1 -1
  10. package/dist/index.d.ts +3 -1
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +9 -5
  13. package/dist/index.js.map +1 -1
  14. package/dist/react.d.ts +15 -6
  15. package/dist/react.d.ts.map +1 -1
  16. package/dist/react.js +66 -3
  17. package/dist/react.js.map +1 -1
  18. package/dist/utils.d.ts +1 -1
  19. package/dist/utils.d.ts.map +1 -1
  20. package/dist/utils.js.map +1 -1
  21. package/esm/exporter.d.ts +3 -0
  22. package/esm/exporter.d.ts.map +1 -1
  23. package/esm/exporter.js +55 -32
  24. package/esm/exporter.js.map +1 -1
  25. package/esm/exporter.test.js +4 -1
  26. package/esm/exporter.test.js.map +1 -1
  27. package/esm/framer.d.ts.map +1 -1
  28. package/esm/framer.js +837 -488
  29. package/esm/framer.js.map +1 -1
  30. package/esm/index.d.ts +3 -1
  31. package/esm/index.d.ts.map +1 -1
  32. package/esm/index.js +3 -1
  33. package/esm/index.js.map +1 -1
  34. package/esm/react.d.ts +15 -6
  35. package/esm/react.d.ts.map +1 -1
  36. package/esm/react.js +65 -5
  37. package/esm/react.js.map +1 -1
  38. package/esm/utils.d.ts +1 -1
  39. package/esm/utils.d.ts.map +1 -1
  40. package/esm/utils.js.map +1 -1
  41. package/package.json +3 -3
  42. package/src/exporter.test.ts +6 -1
  43. package/src/exporter.ts +68 -33
  44. package/src/framer.js +891 -494
  45. package/src/index.ts +7 -1
  46. package/src/react.tsx +98 -16
  47. package/src/utils.ts +1 -1
package/src/framer.js CHANGED
@@ -15349,7 +15349,7 @@ function steps(numSteps, direction = 'end',) {
15349
15349
  };
15350
15350
  }
15351
15351
 
15352
- // https :https://app.framerstatic.com/framer.K3G2LCX5.mjs
15352
+ // https :https://app.framerstatic.com/framer.W2IMDDH5.mjs
15353
15353
  init_chunk_QLPHEVXG();
15354
15354
  import React4 from 'react';
15355
15355
  import { startTransition as startTransition2, } from 'react';
@@ -17009,8 +17009,8 @@ function renderPage(Page4, defaultPageStyle,) {
17009
17009
  return React4.isValidElement(Page4,) ? React4.cloneElement(Page4, style,) : React4.createElement(Page4, style,);
17010
17010
  }
17011
17011
  var NotFoundError = class extends Error {};
17012
- var ErrorBoundaryCaughtError = class extends Error {};
17013
- var ErrorBoundary = class extends Component {
17012
+ var NotFoundErrorBoundaryCaughtError = class extends Error {};
17013
+ var NotFoundErrorBoundary = class extends Component {
17014
17014
  constructor(props,) {
17015
17015
  super(props,);
17016
17016
  this.state = {
@@ -17041,7 +17041,7 @@ var ErrorBoundary = class extends Component {
17041
17041
  return this.props.children;
17042
17042
  }
17043
17043
  if (!(this.state.error instanceof NotFoundError)) {
17044
- const error = new ErrorBoundaryCaughtError();
17044
+ const error = new NotFoundErrorBoundaryCaughtError();
17045
17045
  error.cause = this.state.error;
17046
17046
  throw error;
17047
17047
  }
@@ -17055,6 +17055,157 @@ var ErrorBoundary = class extends Component {
17055
17055
  return renderPage(notFoundPage, defaultPageStyle,);
17056
17056
  }
17057
17057
  };
17058
+ function isObject(value,) {
17059
+ return typeof value === 'object' && value !== null && !Array.isArray(value,);
17060
+ }
17061
+ function isString(value,) {
17062
+ return typeof value === 'string';
17063
+ }
17064
+ var preloadKey = 'preload';
17065
+ function isLazyComponentType(componentType,) {
17066
+ return typeof componentType === 'object' && componentType !== null && !React4.isValidElement(componentType,) &&
17067
+ preloadKey in componentType;
17068
+ }
17069
+ function lazy(factory,) {
17070
+ const LazyComponent = React4.lazy(factory,);
17071
+ let factoryPromise;
17072
+ let LoadedComponent;
17073
+ const Component18 = React4.forwardRef(function LazyWithPreload(props, ref,) {
17074
+ return React4.createElement(
17075
+ LoadedComponent !== null && LoadedComponent !== void 0 ? LoadedComponent : LazyComponent,
17076
+ ref
17077
+ ? {
17078
+ ref,
17079
+ ...props,
17080
+ }
17081
+ : props,
17082
+ );
17083
+ },);
17084
+ Component18.preload = () => {
17085
+ if (!factoryPromise) {
17086
+ factoryPromise = factory().then((module) => {
17087
+ LoadedComponent = module.default;
17088
+ return LoadedComponent;
17089
+ },);
17090
+ }
17091
+ return factoryPromise;
17092
+ };
17093
+ return Component18;
17094
+ }
17095
+ function getRouteElementId(route, hash2,) {
17096
+ if (hash2 && route) {
17097
+ if (route.elements && hash2 in route.elements) {
17098
+ return route.elements[hash2];
17099
+ } else {
17100
+ return hash2;
17101
+ }
17102
+ }
17103
+ return void 0;
17104
+ }
17105
+ function isBot(userAgent,) {
17106
+ return /bot|-google|google-|yandex|ia_archiver/iu.test(userAgent,);
17107
+ }
17108
+ function yieldToMain(options,) {
17109
+ if ('scheduler' in window) {
17110
+ if ('yield' in scheduler) return scheduler.yield(options,);
17111
+ if ('postTask' in scheduler) return scheduler.postTask(() => {}, options,);
17112
+ }
17113
+ if ((options === null || options === void 0 ? void 0 : options.priority) === 'user-blocking') {
17114
+ return Promise.resolve();
17115
+ }
17116
+ return new Promise((resolve) => {
17117
+ setTimeout(resolve,);
17118
+ },);
17119
+ }
17120
+ async function yieldBefore(fn, options,) {
17121
+ await yieldToMain(options,);
17122
+ return fn();
17123
+ }
17124
+ function interactionResponse(options,) {
17125
+ return new Promise((resolve) => {
17126
+ setTimeout(resolve, 100,);
17127
+ requestAnimationFrame(() => {
17128
+ void yieldBefore(resolve, options,);
17129
+ },);
17130
+ },);
17131
+ }
17132
+ function useAfterPaintEffect(effectFn, deps, opts, useEffectFn = useLayoutEffect,) {
17133
+ useEffectFn(() => {
17134
+ const runAfterPaint = async (fn) => {
17135
+ await interactionResponse(opts,);
17136
+ return fn();
17137
+ };
17138
+ const runPromise = runAfterPaint(effectFn,);
17139
+ return () => {
17140
+ void (async () => {
17141
+ const cleanup = await runPromise;
17142
+ if (!cleanup) return;
17143
+ void runAfterPaint(cleanup,);
17144
+ })();
17145
+ };
17146
+ }, deps,);
17147
+ }
17148
+ var noop2 = () => {};
17149
+ var EMPTY_ARRAY = [];
17150
+ var ErrorBoundaryCaughtError = class extends NotFoundErrorBoundaryCaughtError {
17151
+ constructor() {
17152
+ super(...arguments,);
17153
+ this.caught = true;
17154
+ }
17155
+ };
17156
+ var GracefullyDegradingErrorBoundary = class extends Component {
17157
+ constructor() {
17158
+ super(...arguments,);
17159
+ this.state = {
17160
+ error: void 0,
17161
+ };
17162
+ this.message = 'Made UI non-interactive due to the error above. We\'ve logged it, but also please report this to the Framer team.';
17163
+ }
17164
+ static getDerivedStateFromError(error,) {
17165
+ return {
17166
+ error,
17167
+ };
17168
+ }
17169
+ componentDidCatch(error,) {
17170
+ var _a;
17171
+ if ('cause' in error) {
17172
+ error = error.cause;
17173
+ }
17174
+ console.error(this.message,);
17175
+ if (Math.random() > 0.01) return;
17176
+ const stack = error instanceof Error && typeof error.stack === 'string' ? error.stack : null;
17177
+ (_a = window.__framer_events) === null || _a === void 0 ? void 0 : _a.push(['published_site_load_error', {
17178
+ message: String(error,),
17179
+ stack,
17180
+ },],);
17181
+ }
17182
+ render() {
17183
+ var _a;
17184
+ const error = this.state.error;
17185
+ if (!error) return this.props.children;
17186
+ if (!isBot(navigator.userAgent,)) {
17187
+ const fatalError = new ErrorBoundaryCaughtError();
17188
+ fatalError.cause = 'cause' in error ? error.cause : error;
17189
+ console.error(this.message, fatalError.cause,);
17190
+ throw fatalError;
17191
+ }
17192
+ return (
17193
+ // This has the caveat that we will slightly modify the DOM, but it appears to be fine in this case.
17194
+ // The alternative would be to queue a new task that runs after and then set the innerHTML (= avoids the dummy-div), but that means we'll have DOM -> no DOM -> DOM transitions. With the div, we have DOM -> DOM and remove possible race-conditions.
17195
+ jsx('div', {
17196
+ style: {
17197
+ display: 'contents',
17198
+ },
17199
+ suppressHydrationWarning: true,
17200
+ // biome-ignore lint/security/noDangerouslySetInnerHtml: React would unmount the root on errors, but we must ensure that bots can still read the SSR'd content.
17201
+ dangerouslySetInnerHTML: {
17202
+ __html: '<!-- DOM replaced by GracefullyDegradingErrorBoundary -->' +
17203
+ (((_a = document.getElementById('main',)) === null || _a === void 0 ? void 0 : _a.innerHTML) || ''),
17204
+ },
17205
+ },)
17206
+ );
17207
+ }
17208
+ };
17058
17209
  var pathVariablesRegExpRaw = ':([a-z]\\w*)';
17059
17210
  var pathVariablesRegExp = /* @__PURE__ */ new RegExp(pathVariablesRegExpRaw, 'gi',);
17060
17211
  function fillPathVariables(path, variables,) {
@@ -17212,98 +17363,6 @@ function forwardQueryParams(queryParamsString, href,) {
17212
17363
  }
17213
17364
  return hrefWithoutHash.substring(0, startOfSearch + 1,) + newSearchParams.toString() + hash2;
17214
17365
  }
17215
- function isObject(value,) {
17216
- return typeof value === 'object' && value !== null && !Array.isArray(value,);
17217
- }
17218
- function isString(value,) {
17219
- return typeof value === 'string';
17220
- }
17221
- var preloadKey = 'preload';
17222
- function isLazyComponentType(componentType,) {
17223
- return typeof componentType === 'object' && componentType !== null && !React4.isValidElement(componentType,) &&
17224
- preloadKey in componentType;
17225
- }
17226
- function lazy(factory,) {
17227
- const LazyComponent = React4.lazy(factory,);
17228
- let factoryPromise;
17229
- let LoadedComponent;
17230
- const Component16 = React4.forwardRef(function LazyWithPreload(props, ref,) {
17231
- return React4.createElement(
17232
- LoadedComponent !== null && LoadedComponent !== void 0 ? LoadedComponent : LazyComponent,
17233
- ref
17234
- ? {
17235
- ref,
17236
- ...props,
17237
- }
17238
- : props,
17239
- );
17240
- },);
17241
- Component16.preload = () => {
17242
- if (!factoryPromise) {
17243
- factoryPromise = factory().then((module) => {
17244
- LoadedComponent = module.default;
17245
- return LoadedComponent;
17246
- },);
17247
- }
17248
- return factoryPromise;
17249
- };
17250
- return Component16;
17251
- }
17252
- function getRouteElementId(route, hash2,) {
17253
- if (hash2 && route) {
17254
- if (route.elements && hash2 in route.elements) {
17255
- return route.elements[hash2];
17256
- } else {
17257
- return hash2;
17258
- }
17259
- }
17260
- return void 0;
17261
- }
17262
- function isBot(userAgent,) {
17263
- return /bot|-google|google-|yandex|ia_archiver/iu.test(userAgent,);
17264
- }
17265
- function yieldToMain(options,) {
17266
- if ('scheduler' in window) {
17267
- if ('yield' in scheduler) return scheduler.yield(options,);
17268
- if ('postTask' in scheduler) return scheduler.postTask(() => {}, options,);
17269
- }
17270
- if ((options === null || options === void 0 ? void 0 : options.priority) === 'user-blocking') {
17271
- return Promise.resolve();
17272
- }
17273
- return new Promise((resolve) => {
17274
- setTimeout(resolve,);
17275
- },);
17276
- }
17277
- async function yieldBefore(fn, options,) {
17278
- await yieldToMain(options,);
17279
- return fn();
17280
- }
17281
- function interactionResponse(options,) {
17282
- return new Promise((resolve) => {
17283
- setTimeout(resolve, 100,);
17284
- requestAnimationFrame(() => {
17285
- void yieldBefore(resolve, options,);
17286
- },);
17287
- },);
17288
- }
17289
- function useAfterPaintEffect(effectFn, deps, opts, useEffectFn = useLayoutEffect,) {
17290
- useEffectFn(() => {
17291
- const runAfterPaint = async (fn) => {
17292
- await interactionResponse(opts,);
17293
- return fn();
17294
- };
17295
- const runPromise = runAfterPaint(effectFn,);
17296
- return () => {
17297
- void (async () => {
17298
- const cleanup = await runPromise;
17299
- if (!cleanup) return;
17300
- void runAfterPaint(cleanup,);
17301
- })();
17302
- };
17303
- }, deps,);
17304
- }
17305
- var noop2 = () => {};
17306
- var EMPTY_ARRAY = [];
17307
17366
  async function replacePathVariables(path, currentLocale, nextLocale, defaultLocale, collectionId, pathVariables, collectionUtils,) {
17308
17367
  var _a, _b, _c;
17309
17368
  let resultPath = path;
@@ -18449,8 +18508,8 @@ var SuspenseErrorBoundary = class extends Component {
18449
18508
  };
18450
18509
  }
18451
18510
  static getDerivedStateFromError(error,) {
18452
- if (!(error instanceof ErrorBoundaryCaughtError)) {
18453
- console.error('Derived error in SuspenseErrorBoundary', error,);
18511
+ if (!(error instanceof NotFoundErrorBoundaryCaughtError)) {
18512
+ console.error('Derived error in SuspenseErrorBoundary:\n', error,);
18454
18513
  }
18455
18514
  return {
18456
18515
  error,
@@ -18458,25 +18517,24 @@ var SuspenseErrorBoundary = class extends Component {
18458
18517
  }
18459
18518
  componentDidCatch(error, errorInfo,) {
18460
18519
  var _a;
18461
- if (error instanceof ErrorBoundaryCaughtError) {
18520
+ if (error instanceof NotFoundErrorBoundaryCaughtError) {
18462
18521
  return;
18463
18522
  }
18464
18523
  const componentStack = errorInfo === null || errorInfo === void 0 ? void 0 : errorInfo.componentStack;
18465
- console.error('Caught error in SuspenseErrorBoundary', error, componentStack,);
18466
- if (typeof window !== 'undefined') {
18467
- const stack = error instanceof Error && typeof error.stack === 'string' ? error.stack : null;
18468
- (_a = window.__framer_events) === null || _a === void 0 ? void 0 : _a.push(['published_site_load_recoverable_error', {
18469
- message: String(error,),
18470
- stack,
18471
- // only log componentStack if we don't have a stack
18472
- componentStack: stack ? void 0 : componentStack,
18473
- },],);
18474
- }
18524
+ console.error('Caught error in SuspenseErrorBoundary:\n', error, componentStack,);
18525
+ const stack = error instanceof Error && typeof error.stack === 'string' ? error.stack : null;
18526
+ (_a = window.__framer_events) === null || _a === void 0 ? void 0 : _a.push(['published_site_load_recoverable_error', {
18527
+ message: String(error,),
18528
+ stack,
18529
+ // only log componentStack if we don't have a stack
18530
+ componentStack: stack ? void 0 : componentStack,
18531
+ },],);
18475
18532
  }
18476
18533
  render() {
18477
- if (this.state.error === void 0) return this.props.children;
18478
- if (this.state.error instanceof ErrorBoundaryCaughtError) {
18479
- throw this.state.error.cause;
18534
+ const error = this.state.error;
18535
+ if (error === void 0) return this.props.children;
18536
+ if (error instanceof NotFoundErrorBoundaryCaughtError) {
18537
+ throw error.cause;
18480
18538
  }
18481
18539
  window.__framer_STPD_OPT_OUT__ = true;
18482
18540
  return jsx(Suspense2, {
@@ -18829,42 +18887,44 @@ function Router({
18829
18887
  ? fillPathVariables(current.path, currentPathVariables,)
18830
18888
  : current.path;
18831
18889
  const remountKey = String(currentLocaleId,) + pathWithFilledVariables;
18832
- return jsx(RouterAPIProvider, {
18833
- api,
18834
- children: jsx(LocaleInfoContext.Provider, {
18835
- value: localeInfo,
18836
- children: jsxs(SuspenseThatPreservesDom, {
18837
- children: [
18838
- jsx(ErrorBoundary, {
18839
- notFoundPage,
18840
- defaultPageStyle,
18841
- forceUpdateKey: dep,
18842
- children: jsx(WithLayoutTemplate, {
18843
- LayoutTemplate,
18844
- routeId: currentRouteId,
18845
- children: jsxs(Fragment, {
18846
- children: [
18847
- jsx(MarkSuspenseEffects.Start, {},),
18848
- pageExistsInCurrentLocale
18849
- ? renderPage(
18850
- current.page,
18851
- LayoutTemplate
18852
- ? {
18853
- ...defaultPageStyle,
18854
- display: 'content',
18855
- }
18856
- : defaultPageStyle,
18857
- )
18858
- : // LAYOUT_TEMPLATE @TODO: display: content for not found page?
18859
- notFoundPage && renderPage(notFoundPage, defaultPageStyle,),
18860
- ],
18861
- }, remountKey,),
18890
+ return jsx(GracefullyDegradingErrorBoundary, {
18891
+ children: jsx(RouterAPIProvider, {
18892
+ api,
18893
+ children: jsx(LocaleInfoContext.Provider, {
18894
+ value: localeInfo,
18895
+ children: jsxs(SuspenseThatPreservesDom, {
18896
+ children: [
18897
+ jsx(NotFoundErrorBoundary, {
18898
+ notFoundPage,
18899
+ defaultPageStyle,
18900
+ forceUpdateKey: dep,
18901
+ children: jsx(WithLayoutTemplate, {
18902
+ LayoutTemplate,
18903
+ routeId: currentRouteId,
18904
+ children: jsxs(Fragment, {
18905
+ children: [
18906
+ jsx(MarkSuspenseEffects.Start, {},),
18907
+ pageExistsInCurrentLocale
18908
+ ? renderPage(
18909
+ current.page,
18910
+ LayoutTemplate
18911
+ ? {
18912
+ ...defaultPageStyle,
18913
+ display: 'content',
18914
+ }
18915
+ : defaultPageStyle,
18916
+ )
18917
+ : // LAYOUT_TEMPLATE @TODO: display: content for not found page?
18918
+ notFoundPage && renderPage(notFoundPage, defaultPageStyle,),
18919
+ ],
18920
+ }, remountKey,),
18921
+ },),
18862
18922
  },),
18863
- },),
18864
- jsx(TurnOnReactEventHandling, {},),
18865
- jsx(MarkSuspenseEffects.End, {},),
18866
- editorBar,
18867
- ],
18923
+ jsx(TurnOnReactEventHandling, {},),
18924
+ jsx(MarkSuspenseEffects.End, {},),
18925
+ editorBar,
18926
+ ],
18927
+ },),
18868
18928
  },),
18869
18929
  },),
18870
18930
  },);
@@ -21320,6 +21380,7 @@ var mockWindow = {
21320
21380
  scrollY: 0,
21321
21381
  location: {
21322
21382
  href: '',
21383
+ pathname: '',
21323
21384
  },
21324
21385
  document: {
21325
21386
  cookie: '',
@@ -21348,6 +21409,7 @@ var mockWindow = {
21348
21409
  innerWidth: 0,
21349
21410
  SVGSVGElement: {},
21350
21411
  open: function (_url, _target, _features,) {},
21412
+ __framer_events: [],
21351
21413
  };
21352
21414
  var safeWindow = typeof window === 'undefined' ? mockWindow : window;
21353
21415
  var _raf = (f) => {
@@ -22303,7 +22365,7 @@ function getColorsFromTheme(theme, type,) {
22303
22365
  screenColor: isDarkTheme ? '#333' : '#eee',
22304
22366
  };
22305
22367
  }
22306
- var ErrorBoundary2 = class extends Component {
22368
+ var ErrorBoundary = class extends Component {
22307
22369
  constructor() {
22308
22370
  super(...arguments,);
22309
22371
  __publicField(this, 'state', {},);
@@ -22462,7 +22524,7 @@ function Device({
22462
22524
  ref: screenRef,
22463
22525
  children: /* @__PURE__ */ jsx(MotionConfig, {
22464
22526
  transformPagePoint: invertScale2,
22465
- children: /* @__PURE__ */ jsx(ErrorBoundary2, {
22527
+ children: /* @__PURE__ */ jsx(ErrorBoundary, {
22466
22528
  children,
22467
22529
  },),
22468
22530
  },),
@@ -27212,7 +27274,7 @@ function useMeasuredSize(ref,) {
27212
27274
  return size.current;
27213
27275
  }
27214
27276
  var SIZE_COMPATIBILITY_WRAPPER_ATTRIBUTE = 'data-framer-size-compatibility-wrapper';
27215
- var withMeasuredSize = (Component16) => (props) => {
27277
+ var withMeasuredSize = (Component18) => (props) => {
27216
27278
  const ref = React4.useRef(null,);
27217
27279
  const size = useMeasuredSize(ref,);
27218
27280
  const dataProps = {
@@ -27229,7 +27291,7 @@ var withMeasuredSize = (Component16) => (props) => {
27229
27291
  },
27230
27292
  ref,
27231
27293
  ...dataProps,
27232
- children: shouldRender && /* @__PURE__ */ jsx(Component16, {
27294
+ children: shouldRender && /* @__PURE__ */ jsx(Component18, {
27233
27295
  ...props,
27234
27296
  width: (size == null ? void 0 : size.width) ?? fallbackWidth,
27235
27297
  height: (size == null ? void 0 : size.height) ?? fallbackHeight,
@@ -28729,7 +28791,7 @@ var clamp2 = (value, a, b,) => {
28729
28791
  var DraggingContext = /* @__PURE__ */ React4.createContext({
28730
28792
  dragging: false,
28731
28793
  },);
28732
- function WithDragging(Component16,) {
28794
+ function WithDragging(Component18,) {
28733
28795
  const _WithDraggingHOC = class extends React4.Component {
28734
28796
  constructor(props, defaultProps,) {
28735
28797
  super(props, defaultProps,);
@@ -29357,7 +29419,7 @@ function WithDragging(Component16,) {
29357
29419
  value: {
29358
29420
  dragging: this.state.isDragging,
29359
29421
  },
29360
- children: /* @__PURE__ */ jsx(Component16, {
29422
+ children: /* @__PURE__ */ jsx(Component18, {
29361
29423
  ...originalProps,
29362
29424
  },),
29363
29425
  },);
@@ -29395,9 +29457,9 @@ function WithDragging(Component16,) {
29395
29457
  constraints: {},
29396
29458
  mouseWheel: false,
29397
29459
  },);
29398
- __publicField(WithDraggingHOC, 'defaultProps', Object.assign({}, Component16.defaultProps, _WithDraggingHOC.draggingDefaultProps,),);
29460
+ __publicField(WithDraggingHOC, 'defaultProps', Object.assign({}, Component18.defaultProps, _WithDraggingHOC.draggingDefaultProps,),);
29399
29461
  const withDragging = WithDraggingHOC;
29400
- (0, import_hoist_non_react_statics.default)(withDragging, Component16,);
29462
+ (0, import_hoist_non_react_statics.default)(withDragging, Component18,);
29401
29463
  return withDragging;
29402
29464
  }
29403
29465
  var hoverProps = {
@@ -32201,7 +32263,7 @@ function useInfiniteScroll({
32201
32263
  };
32202
32264
  }, [elementRef, callback, rootMargin, threshold, paginationInfo.currentPage,],);
32203
32265
  }
32204
- function withInfiniteScroll(Component16,) {
32266
+ function withInfiniteScroll(Component18,) {
32205
32267
  return React4.forwardRef(({
32206
32268
  __paginationInfo,
32207
32269
  __loadMore,
@@ -32215,7 +32277,7 @@ function withInfiniteScroll(Component16,) {
32215
32277
  ref: infiniteScrollRef,
32216
32278
  paginationInfo: __paginationInfo,
32217
32279
  },);
32218
- return /* @__PURE__ */ jsx(Component16, {
32280
+ return /* @__PURE__ */ jsx(Component18, {
32219
32281
  ...props,
32220
32282
  ref: infiniteScrollRef,
32221
32283
  },);
@@ -35156,7 +35218,7 @@ function convertColorProps(props,) {
35156
35218
  }
35157
35219
  return props;
35158
35220
  }
35159
- function WithOverride(Component16, override,) {
35221
+ function WithOverride(Component18, override,) {
35160
35222
  const useOverride = typeof override === 'function' ? (props) => override(convertColorProps(props,),) : () => convertColorProps(override,);
35161
35223
  const ComponentWithOverride = function (props,) {
35162
35224
  useContext(DataObserverContext,);
@@ -35165,14 +35227,14 @@ function WithOverride(Component16, override,) {
35165
35227
  style,
35166
35228
  ...rest
35167
35229
  } = props;
35168
- return /* @__PURE__ */ jsx(Component16, {
35230
+ return /* @__PURE__ */ jsx(Component18, {
35169
35231
  ...rest,
35170
35232
  ...overrideProps,
35171
35233
  _initialStyle: style,
35172
35234
  },);
35173
35235
  };
35174
- (0, import_hoist_non_react_statics4.default)(ComponentWithOverride, Component16,);
35175
- ComponentWithOverride['displayName'] = `WithOverride(${Component16.displayName || Component16.name})`;
35236
+ (0, import_hoist_non_react_statics4.default)(ComponentWithOverride, Component18,);
35237
+ ComponentWithOverride['displayName'] = `WithOverride(${Component18.displayName || Component18.name})`;
35176
35238
  return ComponentWithOverride;
35177
35239
  }
35178
35240
  var prefix = '__framer__';
@@ -36014,11 +36076,11 @@ function addMotionValueStyle(style, values,) {
36014
36076
  function isVariantOrVariantList(value,) {
36015
36077
  return isString2(value,) || Array.isArray(value,);
36016
36078
  }
36017
- var withFX = (Component16) =>
36079
+ var withFX = (Component18) =>
36018
36080
  React4.forwardRef((props, forwardedRef,) => {
36019
36081
  var _a;
36020
36082
  if (props.__withFX) {
36021
- return /* @__PURE__ */ jsx(Component16, {
36083
+ return /* @__PURE__ */ jsx(Component18, {
36022
36084
  ...props,
36023
36085
  animate: void 0,
36024
36086
  initial: void 0,
@@ -36029,7 +36091,7 @@ var withFX = (Component16) =>
36029
36091
  if (RenderTarget.current() === RenderTarget.canvas) {
36030
36092
  const animate4 = isVariantOrVariantList(props.animate,) ? props.animate : void 0;
36031
36093
  const initial2 = isVariantOrVariantList(props.initial,) ? props.initial : void 0;
36032
- return /* @__PURE__ */ jsx(Component16, {
36094
+ return /* @__PURE__ */ jsx(Component18, {
36033
36095
  ...props,
36034
36096
  animate: animate4,
36035
36097
  initial: initial2,
@@ -36133,7 +36195,7 @@ var withFX = (Component16) =>
36133
36195
  exit,
36134
36196
  }
36135
36197
  : {};
36136
- return /* @__PURE__ */ jsx(Component16, {
36198
+ return /* @__PURE__ */ jsx(Component18, {
36137
36199
  ...forwardedProps,
36138
36200
  ...motionGestures,
36139
36201
  __withFX: true,
@@ -36263,13 +36325,13 @@ var ComponentViewportContext = /* @__PURE__ */ React4.createContext({},);
36263
36325
  function useComponentViewport() {
36264
36326
  return React4.useContext(ComponentViewportContext,);
36265
36327
  }
36266
- var ComponentViewportProvider = /* @__PURE__ */ React4.forwardRef(({
36328
+ var ComponentViewportProvider = /* @__PURE__ */ React4.forwardRef(function ComponentViewportProvider2({
36267
36329
  width,
36268
36330
  height,
36269
36331
  y,
36270
36332
  children,
36271
36333
  ...rest
36272
- }, ref,) => {
36334
+ }, ref,) {
36273
36335
  const componentViewport = React4.useMemo(() => {
36274
36336
  return {
36275
36337
  width,
@@ -36283,10 +36345,10 @@ var ComponentViewportProvider = /* @__PURE__ */ React4.forwardRef(({
36283
36345
  children: cloneWithPropsAndRef(children, rest,),
36284
36346
  },);
36285
36347
  },);
36286
- var withGeneratedLayoutId = (Component16) =>
36348
+ var withGeneratedLayoutId = (Component18) =>
36287
36349
  React4.forwardRef((props, ref,) => {
36288
36350
  const layoutId = useLayoutId2(props,);
36289
- return /* @__PURE__ */ jsx(Component16, {
36351
+ return /* @__PURE__ */ jsx(Component18, {
36290
36352
  layoutId,
36291
36353
  ...props,
36292
36354
  layoutIdKey: void 0,
@@ -36294,7 +36356,93 @@ var withGeneratedLayoutId = (Component16) =>
36294
36356
  ref,
36295
36357
  },);
36296
36358
  },);
36297
- var ContainerErrorBoundary = class extends Component {
36359
+ function collectErrorToAnalytics(error, errorInfo,) {
36360
+ var _a;
36361
+ if (typeof window === 'undefined') return;
36362
+ if (Math.random() > 0.01) return;
36363
+ const stack = error instanceof Error && typeof error.stack === 'string' ? error.stack : null;
36364
+ const componentStack = errorInfo == null ? void 0 : errorInfo.componentStack;
36365
+ (_a = safeWindow.__framer_events) == null ? void 0 : _a.push(['published_site_load_recoverable_error', {
36366
+ message: String(error,),
36367
+ stack,
36368
+ // only log componentStack if we don't have a stack
36369
+ componentStack: stack ? void 0 : componentStack,
36370
+ },],);
36371
+ }
36372
+ function logError(...args) {
36373
+ if (false) return;
36374
+ console.error(...args,);
36375
+ }
36376
+ function shouldEnableCodeBoundaries() {
36377
+ return RenderTarget.current() !== RenderTarget.canvas;
36378
+ }
36379
+ function CodeComponentBoundary({
36380
+ errorMessage,
36381
+ fallback,
36382
+ children,
36383
+ },) {
36384
+ if (!shouldEnableCodeBoundaries()) {
36385
+ return children;
36386
+ }
36387
+ return /* @__PURE__ */ jsx(ClientSideErrorBoundary, {
36388
+ fallback,
36389
+ errorMessage,
36390
+ children: /* @__PURE__ */ jsx(ServerSideErrorBoundary, {
36391
+ fallback,
36392
+ children,
36393
+ },),
36394
+ },);
36395
+ }
36396
+ var ClientSideErrorBoundary = class extends Component {
36397
+ constructor() {
36398
+ super(...arguments,);
36399
+ __publicField(this, 'state', {
36400
+ hasError: false,
36401
+ },);
36402
+ }
36403
+ static getDerivedStateFromError() {
36404
+ return {
36405
+ hasError: true,
36406
+ };
36407
+ }
36408
+ componentDidCatch(error, errorInfo,) {
36409
+ logError(this.props.errorMessage, errorInfo == null ? void 0 : errorInfo.componentStack,);
36410
+ collectErrorToAnalytics(error, errorInfo,);
36411
+ }
36412
+ render() {
36413
+ const {
36414
+ children,
36415
+ fallback = null,
36416
+ } = this.props;
36417
+ const {
36418
+ hasError,
36419
+ } = this.state;
36420
+ return hasError ? fallback : children;
36421
+ }
36422
+ };
36423
+ function ServerSideErrorBoundary({
36424
+ children,
36425
+ fallback = null,
36426
+ },) {
36427
+ return typeof window === 'undefined'
36428
+ ? // On the server, Suspense fallback is activated by errors. So we use the actual Suspense,
36429
+ // and render the actual error fallback if Suspense activates.
36430
+ /* @__PURE__ */
36431
+ jsx(Suspense2, {
36432
+ fallback,
36433
+ children,
36434
+ },)
36435
+ : // On the client, Suspense fallback is activated by data fetching. So we use SuspenseThatPreservesDom,
36436
+ // because we don’t want to render a fallback if the boundary gets inadvertently activated.
36437
+ //
36438
+ // “Why won’t you just render plain children without Suspense?” Because that would cause a hydration mismatch
36439
+ // (the server has Suspense, the client doesn’t).
36440
+ /* @__PURE__ */
36441
+ jsx(SuspenseThatPreservesDom, {
36442
+ children,
36443
+ },);
36444
+ }
36445
+ var DeprecatedContainerErrorBoundary = class extends Component {
36298
36446
  constructor() {
36299
36447
  super(...arguments,);
36300
36448
  __publicField(this, 'state', {
@@ -36304,7 +36452,6 @@ var ContainerErrorBoundary = class extends Component {
36304
36452
  // We use `componentDidCatch` instead of `static getDerivedStateFromError()` because the latter could also catch hydration errors.
36305
36453
  // Hydration errors are recoverable by React, so we don't want to hide the coponent in that case (since the tree will not unmount).
36306
36454
  componentDidCatch(error, errorInfo,) {
36307
- var _a;
36308
36455
  const componentStack = errorInfo == null ? void 0 : errorInfo.componentStack;
36309
36456
  console.error(
36310
36457
  'Error in component (see previous log). This component has been hidden. Please check any custom code or code overrides to fix.',
@@ -36313,15 +36460,7 @@ var ContainerErrorBoundary = class extends Component {
36313
36460
  this.setState({
36314
36461
  hasError: true,
36315
36462
  },);
36316
- if (typeof window !== 'undefined' && Math.random() <= 0.01) {
36317
- const stack = error instanceof Error && typeof error.stack === 'string' ? error.stack : null;
36318
- (_a = window.__framer_events) == null ? void 0 : _a.push(['published_site_load_recoverable_error', {
36319
- message: String(error,),
36320
- stack,
36321
- // only log componentStack if we don't have a stack
36322
- componentStack: stack ? void 0 : componentStack,
36323
- },],);
36324
- }
36463
+ collectErrorToAnalytics(error, errorInfo,);
36325
36464
  }
36326
36465
  render() {
36327
36466
  const {
@@ -36333,14 +36472,84 @@ var ContainerErrorBoundary = class extends Component {
36333
36472
  return hasError ? null : children;
36334
36473
  }
36335
36474
  };
36336
- var Providers = /* @__PURE__ */ React4.forwardRef(({
36475
+ var CRASH_ERROR_MESSAGE_PREFIX = 'code-crash:';
36476
+ function formatCodeCrashLocationFromSourceNode(scopeId, nodeId,) {
36477
+ return `${CRASH_ERROR_MESSAGE_PREFIX}${scopeId}:${nodeId}`;
36478
+ }
36479
+ function getErrorMessageForComponent(scopeId, nodeId,) {
36480
+ return getErrorMessageFor('component', scopeId, nodeId,);
36481
+ }
36482
+ function getErrorMessageForOverride(scopeId, nodeId,) {
36483
+ return getErrorMessageFor('override', scopeId, nodeId,);
36484
+ }
36485
+ function getErrorMessageFor(element, scopeId, nodeId,) {
36486
+ return `A code ${element} crashed while rendering due to the error above. To find and fix it, open the project in the editor \u2192 open Quick Actions (press Cmd+K or Ctrl+K) \u2192 paste this: ${
36487
+ formatCodeCrashLocationFromSourceNode(scopeId, nodeId,)
36488
+ } \u2192 click \u201CShow Layer\u201D.`;
36489
+ }
36490
+ var IsInExternalComponentContext = /* @__PURE__ */ (() => React4.createContext(0,))();
36491
+ function useExternalComponentNestingLevel() {
36492
+ return React4.useContext(IsInExternalComponentContext,);
36493
+ }
36494
+ function IsExternalComponent({
36495
+ children,
36496
+ },) {
36497
+ const count = React4.useContext(IsInExternalComponentContext,);
36498
+ return /* @__PURE__ */ jsx(IsInExternalComponentContext.Provider, {
36499
+ value: count + 1,
36500
+ children,
36501
+ },);
36502
+ }
36503
+ function shouldWrapComponentWithBoundary(externalModuleNestingLevel, isAuthoredByUser, isExternalComponent, inComponentSlot,) {
36504
+ const isLocalComponentInstance =
36505
+ // We know a component instance is local when it’s not nested inside any external component...
36506
+ externalModuleNestingLevel === 0 ||
36507
+ // ...or – “Ticker edge case” – when it’s nested inside an external component during React rendering,
36508
+ // but is actually defined in a slot that’s passed into the component. (This is the “Ticker edge case”:
36509
+ // if a site has a Ticker (or any other component with slots), and something in a Ticker’s slot crashes,
36510
+ // we want to disable that something, not the whole ticker.)
36511
+ externalModuleNestingLevel === 1 && inComponentSlot;
36512
+ return (isAuthoredByUser || isExternalComponent) && isLocalComponentInstance;
36513
+ }
36514
+ function shouldWrapOverrideWithBoundary(externalModuleNestingLevel, inComponentSlot,) {
36515
+ const isWrappingFrameLocalToProject =
36516
+ // We know a frame is local when it’s not nested inside any external component...
36517
+ externalModuleNestingLevel === 0 ||
36518
+ // ...or – “Ticker edge case” – when it’s nested inside an external component during React rendering,
36519
+ // but is actually defined in a slot that’s passed into the component. (This is the “Ticker edge case”:
36520
+ // if a site has a Ticker (or any other component with slots), and an override in a Ticker’s slot crashes,
36521
+ // we want to disable that override, not the whole ticker.)
36522
+ externalModuleNestingLevel === 1 && inComponentSlot;
36523
+ return isWrappingFrameLocalToProject;
36524
+ }
36525
+ var ContainerInner = /* @__PURE__ */ React4.forwardRef(({
36337
36526
  children,
36338
36527
  layoutId,
36339
36528
  as,
36529
+ scopeId,
36530
+ nodeId,
36531
+ isAuthoredByUser,
36532
+ isModuleExternal,
36533
+ inComponentSlot,
36340
36534
  ...props
36341
36535
  }, ref,) => {
36342
36536
  const outerLayoutId = useConstant2(() => layoutId ? `${layoutId}-container` : void 0);
36343
36537
  const MotionComponent = htmlElementAsMotionComponent(as,);
36538
+ const clonedChildren = React4.Children.map(children, (child) => {
36539
+ return React4.isValidElement(child,)
36540
+ ? React4.cloneElement(child, {
36541
+ layoutId,
36542
+ },)
36543
+ : child;
36544
+ },);
36545
+ const childrenWithCodeBoundary = useWrapWithCodeBoundary(
36546
+ clonedChildren,
36547
+ scopeId,
36548
+ nodeId,
36549
+ isAuthoredByUser,
36550
+ isModuleExternal,
36551
+ inComponentSlot,
36552
+ );
36344
36553
  return /* @__PURE__ */ jsx(MotionComponent, {
36345
36554
  layoutId: outerLayoutId,
36346
36555
  ...props,
@@ -36352,21 +36561,79 @@ var Providers = /* @__PURE__ */ React4.forwardRef(({
36352
36561
  children: /* @__PURE__ */ jsx(LayoutGroup, {
36353
36562
  id: layoutId ?? '',
36354
36563
  inherit: 'id',
36355
- children: /* @__PURE__ */ jsx(ContainerErrorBoundary, {
36356
- children: React4.Children.map(children, (child) => {
36357
- return React4.isValidElement(child,)
36358
- ? React4.cloneElement(child, {
36359
- layoutId,
36360
- },)
36361
- : child;
36362
- },),
36363
- },),
36564
+ children: childrenWithCodeBoundary,
36364
36565
  },),
36365
36566
  },),
36366
36567
  },),
36367
36568
  },);
36368
36569
  },);
36369
- var Container = /* @__PURE__ */ withGeneratedLayoutId(Providers,);
36570
+ var Container = /* @__PURE__ */ withGeneratedLayoutId(ContainerInner,);
36571
+ var SmartComponentScopedContainer = /* @__PURE__ */ React4.forwardRef((props, ref,) => {
36572
+ const {
36573
+ as,
36574
+ layoutId,
36575
+ scopeId,
36576
+ nodeId,
36577
+ isAuthoredByUser,
36578
+ rendersWithMotion,
36579
+ isModuleExternal,
36580
+ inComponentSlot,
36581
+ style,
36582
+ children,
36583
+ ...renderableProps
36584
+ } = props;
36585
+ const childrenWithCodeBoundary = useWrapWithCodeBoundary(children, scopeId, nodeId, isAuthoredByUser, isModuleExternal, inComponentSlot,);
36586
+ const tagName = props.as ?? 'div';
36587
+ if (props.rendersWithMotion) {
36588
+ const Component18 = htmlElementAsMotionComponent(tagName,);
36589
+ return /* @__PURE__ */ jsx(Component18, {
36590
+ ref,
36591
+ style: props.style,
36592
+ ...renderableProps,
36593
+ children: childrenWithCodeBoundary,
36594
+ },);
36595
+ } else {
36596
+ const Component18 = tagName;
36597
+ return /* @__PURE__ */ jsx(Component18, {
36598
+ ref,
36599
+ style: props.style,
36600
+ ...renderableProps,
36601
+ children: childrenWithCodeBoundary,
36602
+ },);
36603
+ }
36604
+ },);
36605
+ function useWrapWithCodeBoundary(children, scopeId, nodeId, isAuthoredByUser, isExternalComponent, inComponentSlot,) {
36606
+ const externalModuleNestingLevel = useExternalComponentNestingLevel();
36607
+ if (
36608
+ // Those props will either be all undefined, which means the Container wasn’t codegenned yet,
36609
+ // and we should use the old ContainerErrorBoundary –
36610
+ // or all defined, which means we have enough information to use the new boundary.
36611
+ isUndefined(scopeId,) || isUndefined(nodeId,)
36612
+ ) {
36613
+ return /* @__PURE__ */ jsx(DeprecatedContainerErrorBoundary, {
36614
+ children,
36615
+ },);
36616
+ }
36617
+ const shouldWrapWithBoundary = shouldWrapComponentWithBoundary(
36618
+ externalModuleNestingLevel,
36619
+ isAuthoredByUser ?? false,
36620
+ isExternalComponent ?? false,
36621
+ inComponentSlot ?? false,
36622
+ );
36623
+ if (shouldWrapWithBoundary) {
36624
+ children = /* @__PURE__ */ jsx(CodeComponentBoundary, {
36625
+ errorMessage: getErrorMessageForComponent(scopeId, nodeId,),
36626
+ fallback: null,
36627
+ children,
36628
+ },);
36629
+ }
36630
+ if (isExternalComponent) {
36631
+ children = /* @__PURE__ */ jsx(IsExternalComponent, {
36632
+ children,
36633
+ },);
36634
+ }
36635
+ return children;
36636
+ }
36370
36637
  var StyleSheetContext = /* @__PURE__ */ React4.createContext(void 0,);
36371
36638
  var framerPostSSRCSSSelector = 'style[data-framer-css-ssr-minified]';
36372
36639
  var componentsWithServerRenderedStyles = /* @__PURE__ */ (() => {
@@ -36379,7 +36646,7 @@ var componentsWithServerRenderedStyles = /* @__PURE__ */ (() => {
36379
36646
  return new Set(componentsWithSSRStylesAttr.split(' ',),);
36380
36647
  })();
36381
36648
  var framerCSSMarker = 'data-framer-css-ssr';
36382
- var withCSS = (Component16, escapedCSS, componentSerializationId,) =>
36649
+ var withCSS = (Component18, escapedCSS, componentSerializationId,) =>
36383
36650
  React4.forwardRef((props, ref,) => {
36384
36651
  const {
36385
36652
  sheet,
@@ -36399,7 +36666,7 @@ var withCSS = (Component16, escapedCSS, componentSerializationId,) =>
36399
36666
  __html: concatenatedCSS,
36400
36667
  },
36401
36668
  },),
36402
- /* @__PURE__ */ jsx(Component16, {
36669
+ /* @__PURE__ */ jsx(Component18, {
36403
36670
  ...props,
36404
36671
  ref,
36405
36672
  },),
@@ -36415,7 +36682,7 @@ var withCSS = (Component16, escapedCSS, componentSerializationId,) =>
36415
36682
  : escapedCSS.split('\n',);
36416
36683
  css2.forEach((rule) => rule && injectCSSRule(rule, sheet, cache2,));
36417
36684
  }, [],);
36418
- return /* @__PURE__ */ jsx(Component16, {
36685
+ return /* @__PURE__ */ jsx(Component18, {
36419
36686
  ...props,
36420
36687
  ref,
36421
36688
  },);
@@ -37402,10 +37669,10 @@ function ChildrenCanSuspend({
37402
37669
  children,
37403
37670
  },);
37404
37671
  }
37405
- function withChildrenCanSuspend(Component16,) {
37672
+ function withChildrenCanSuspend(Component18,) {
37406
37673
  return forwardRef(function withChildrenCanSuspendInner(props, ref,) {
37407
37674
  return /* @__PURE__ */ jsx(ChildrenCanSuspend, {
37408
- children: /* @__PURE__ */ jsx(Component16, {
37675
+ children: /* @__PURE__ */ jsx(Component18, {
37409
37676
  ...props,
37410
37677
  ref,
37411
37678
  },),
@@ -37956,14 +38223,14 @@ function getRouteFromPageLink(pageLink, router, currentRoute,) {
37956
38223
  } = pageLink;
37957
38224
  return (_a = router.getRoute) == null ? void 0 : _a.call(router, webPageId,);
37958
38225
  }
37959
- var Link = /* @__PURE__ */ withChildrenCanSuspend(/* @__PURE__ */ forwardRef(({
38226
+ var Link = /* @__PURE__ */ withChildrenCanSuspend(/* @__PURE__ */ forwardRef(function Link2({
37960
38227
  children,
37961
38228
  href,
37962
38229
  openInNewTab,
37963
38230
  smoothScroll,
37964
38231
  nodeId,
37965
38232
  ...restProps
37966
- }, forwardedRef,) => {
38233
+ }, forwardedRef,) {
37967
38234
  const router = useRouter();
37968
38235
  const currentRoute = useCurrentRoute();
37969
38236
  const implicitPathVariables = useImplicitPathVariables();
@@ -39012,12 +39279,8 @@ function PageRoot({
39012
39279
  },
39013
39280
  preserveQueryParams,
39014
39281
  enableAsyncURLUpdates,
39015
- editorBar: EditorBar && framerSiteId && /* @__PURE__ */ jsx(IgnoreErrors, {
39016
- children: /* @__PURE__ */ jsx(Suspense2, {
39017
- children: /* @__PURE__ */ jsx(EditorBar, {
39018
- framerSiteId,
39019
- },),
39020
- },),
39282
+ editorBar: /* @__PURE__ */ jsx(EditorBarLauncher, {
39283
+ EditorBar,
39021
39284
  },),
39022
39285
  },),
39023
39286
  },),
@@ -39043,6 +39306,25 @@ function PageRoot({
39043
39306
  },);
39044
39307
  }
39045
39308
  }
39309
+ function EditorBarLauncher({
39310
+ EditorBar,
39311
+ },) {
39312
+ const [mounted, setMounted,] = useState(false,);
39313
+ const framerSiteId = useContext(FormContext,);
39314
+ useEffect(() => {
39315
+ startTransition2(() => {
39316
+ setMounted(true,);
39317
+ },);
39318
+ }, [],);
39319
+ if (!EditorBar || !framerSiteId || !mounted) return null;
39320
+ return /* @__PURE__ */ jsx(IgnoreErrors, {
39321
+ children: /* @__PURE__ */ jsx(Suspense2, {
39322
+ children: /* @__PURE__ */ jsx(EditorBar, {
39323
+ framerSiteId,
39324
+ },),
39325
+ },),
39326
+ },);
39327
+ }
39046
39328
  function cloneChildrenWithProps(children, props, asNode,) {
39047
39329
  const cloned = React2.Children.map(children, (child) => {
39048
39330
  if (React2.isValidElement(child,)) {
@@ -39685,60 +39967,60 @@ var DatabaseValue = {
39685
39967
  * Checks if the left value is equal to the right value. Returns false if
39686
39968
  * the values are not of the same type.
39687
39969
  */
39688
- equal(left, right, collation10,) {
39970
+ equal(left, right, collation11,) {
39689
39971
  if ((left == null ? void 0 : left.type) !== (right == null ? void 0 : right.type)) {
39690
39972
  return false;
39691
39973
  }
39692
- return compare(left, right, collation10,) === 0;
39974
+ return compare(left, right, collation11,) === 0;
39693
39975
  },
39694
39976
  /**
39695
39977
  * Checks if the left value is less than the right value. Returns false if
39696
39978
  * the values are not of the same type.
39697
39979
  */
39698
- lessThan(left, right, collation10,) {
39980
+ lessThan(left, right, collation11,) {
39699
39981
  if ((left == null ? void 0 : left.type) !== (right == null ? void 0 : right.type)) {
39700
39982
  return false;
39701
39983
  }
39702
- return compare(left, right, collation10,) < 0;
39984
+ return compare(left, right, collation11,) < 0;
39703
39985
  },
39704
39986
  /**
39705
39987
  * Checks if the left value is less than or equal to the right value.
39706
39988
  * Returns false if the values are not of the same type.
39707
39989
  */
39708
- lessThanOrEqual(left, right, collation10,) {
39990
+ lessThanOrEqual(left, right, collation11,) {
39709
39991
  if ((left == null ? void 0 : left.type) !== (right == null ? void 0 : right.type)) {
39710
39992
  return false;
39711
39993
  }
39712
- return compare(left, right, collation10,) <= 0;
39994
+ return compare(left, right, collation11,) <= 0;
39713
39995
  },
39714
39996
  /**
39715
39997
  * Checks if the left value is greater than the right value. Returns false
39716
39998
  * if the values are not of the same type.
39717
39999
  */
39718
- greaterThan(left, right, collation10,) {
40000
+ greaterThan(left, right, collation11,) {
39719
40001
  if ((left == null ? void 0 : left.type) !== (right == null ? void 0 : right.type)) {
39720
40002
  return false;
39721
40003
  }
39722
- return compare(left, right, collation10,) > 0;
40004
+ return compare(left, right, collation11,) > 0;
39723
40005
  },
39724
40006
  /**
39725
40007
  * Checks if the left value is greater than or equal to the right value.
39726
40008
  * Returns false if the values are not of the same type.
39727
40009
  */
39728
- greaterThanOrEqual(left, right, collation10,) {
40010
+ greaterThanOrEqual(left, right, collation11,) {
39729
40011
  if ((left == null ? void 0 : left.type) !== (right == null ? void 0 : right.type)) {
39730
40012
  return false;
39731
40013
  }
39732
- return compare(left, right, collation10,) >= 0;
40014
+ return compare(left, right, collation11,) >= 0;
39733
40015
  },
39734
40016
  /**
39735
40017
  * Checks if the left value is in the right value. Returns false if the
39736
40018
  * right value is not an array.
39737
40019
  */
39738
- in(left, right, collation10,) {
40020
+ in(left, right, collation11,) {
39739
40021
  if ((right == null ? void 0 : right.type) !== 'array') return false;
39740
40022
  return right.value.some((item) => {
39741
- return DatabaseValue.equal(item, left, collation10,);
40023
+ return DatabaseValue.equal(item, left, collation11,);
39742
40024
  },);
39743
40025
  },
39744
40026
  /**
@@ -39746,40 +40028,40 @@ var DatabaseValue = {
39746
40028
  *
39747
40029
  * If source has duplicates, the index of the first occurrence is always returned.
39748
40030
  */
39749
- indexOf(source, target, collation10,) {
40031
+ indexOf(source, target, collation11,) {
39750
40032
  if ((source == null ? void 0 : source.type) !== 'array') return -1;
39751
40033
  return source.value.findIndex((item) => {
39752
- return DatabaseValue.equal(item, target, collation10,);
40034
+ return DatabaseValue.equal(item, target, collation11,);
39753
40035
  },);
39754
40036
  },
39755
- contains(source, target, collation10,) {
40037
+ contains(source, target, collation11,) {
39756
40038
  let sourceValue = toString(source,);
39757
40039
  let targetValue = toString(target,);
39758
40040
  if (isNull(sourceValue,)) return false;
39759
40041
  if (isNull(targetValue,)) return false;
39760
- if (collation10.type === 0) {
40042
+ if (collation11.type === 0) {
39761
40043
  sourceValue = sourceValue.toLowerCase();
39762
40044
  targetValue = targetValue.toLowerCase();
39763
40045
  }
39764
40046
  return sourceValue.includes(targetValue,);
39765
40047
  },
39766
- startsWith(source, target, collation10,) {
40048
+ startsWith(source, target, collation11,) {
39767
40049
  let sourceValue = toString(source,);
39768
40050
  let targetValue = toString(target,);
39769
40051
  if (isNull(sourceValue,)) return false;
39770
40052
  if (isNull(targetValue,)) return false;
39771
- if (collation10.type === 0) {
40053
+ if (collation11.type === 0) {
39772
40054
  sourceValue = sourceValue.toLowerCase();
39773
40055
  targetValue = targetValue.toLowerCase();
39774
40056
  }
39775
40057
  return sourceValue.startsWith(targetValue,);
39776
40058
  },
39777
- endsWith(source, target, collation10,) {
40059
+ endsWith(source, target, collation11,) {
39778
40060
  let sourceValue = toString(source,);
39779
40061
  let targetValue = toString(target,);
39780
40062
  if (isNull(sourceValue,)) return false;
39781
40063
  if (isNull(targetValue,)) return false;
39782
- if (collation10.type === 0) {
40064
+ if (collation11.type === 0) {
39783
40065
  sourceValue = sourceValue.toLowerCase();
39784
40066
  targetValue = targetValue.toLowerCase();
39785
40067
  }
@@ -39825,7 +40107,7 @@ var DatabaseValue = {
39825
40107
  }
39826
40108
  },
39827
40109
  };
39828
- function compare(left, right, collation10,) {
40110
+ function compare(left, right, collation11,) {
39829
40111
  if (isNull(left,) || isNull(right,)) {
39830
40112
  assert(left === right,);
39831
40113
  return 0;
@@ -39842,7 +40124,7 @@ function compare(left, right, collation10,) {
39842
40124
  const rightItem = right.value[i];
39843
40125
  assert(!isUndefined(leftItem,), 'Left item must exist',);
39844
40126
  assert(!isUndefined(rightItem,), 'Right item must exist',);
39845
- const result = compare(leftItem, rightItem, collation10,);
40127
+ const result = compare(leftItem, rightItem, collation11,);
39846
40128
  if (result !== 0) return result;
39847
40129
  }
39848
40130
  return 0;
@@ -39910,7 +40192,7 @@ function compare(left, right, collation10,) {
39910
40192
  const rightValue = right.value[rightKey];
39911
40193
  assert(!isUndefined(leftValue,), 'Left value must exist',);
39912
40194
  assert(!isUndefined(rightValue,), 'Right value must exist',);
39913
- const result = compare(leftValue, rightValue, collation10,);
40195
+ const result = compare(leftValue, rightValue, collation11,);
39914
40196
  if (result !== 0) return result;
39915
40197
  }
39916
40198
  return 0;
@@ -39935,7 +40217,7 @@ function compare(left, right, collation10,) {
39935
40217
  assert(left.type === right.type,);
39936
40218
  let leftValue = left.value;
39937
40219
  let rightValue = right.value;
39938
- if (collation10.type === 0) {
40220
+ if (collation11.type === 0) {
39939
40221
  leftValue = left.value.toLowerCase();
39940
40222
  rightValue = right.value.toLowerCase();
39941
40223
  }
@@ -39952,6 +40234,205 @@ var unknownDefinition = {
39952
40234
  type: 'unknown',
39953
40235
  isNullable: true,
39954
40236
  };
40237
+ function getNetworkLatency() {
40238
+ return 25;
40239
+ }
40240
+ function getNetworkSpeed() {
40241
+ return 100 * 125;
40242
+ }
40243
+ var KB = 1e3;
40244
+ var Cost = class {
40245
+ constructor(network,) {
40246
+ this.network = network;
40247
+ }
40248
+ static estimate(totalRequests, transferredBytes,) {
40249
+ const latency = getNetworkLatency();
40250
+ const speed = getNetworkSpeed();
40251
+ const network = totalRequests * latency + transferredBytes / speed;
40252
+ return new Cost(network,);
40253
+ }
40254
+ static max(left, right,) {
40255
+ const network = Math.max(left.network, right.network,);
40256
+ return new Cost(network,);
40257
+ }
40258
+ static compare(left, right,) {
40259
+ if (left.network < right.network) return -1;
40260
+ if (left.network > right.network) return 1;
40261
+ return 0;
40262
+ }
40263
+ add(cost,) {
40264
+ this.network += cost.network;
40265
+ return this;
40266
+ }
40267
+ toString() {
40268
+ return `${this.network}ms`;
40269
+ }
40270
+ };
40271
+ function GroupId(id3,) {
40272
+ return id3;
40273
+ }
40274
+ var Group = class {
40275
+ constructor(id3, relational,) {
40276
+ this.id = id3;
40277
+ this.relational = relational;
40278
+ __publicField(this, 'nodes', [],);
40279
+ __publicField(this, 'winners', /* @__PURE__ */ new Map(),);
40280
+ }
40281
+ /**
40282
+ * Adds a node to the group. Throws an error if the node is already in a
40283
+ * group.
40284
+ */
40285
+ addNode(node,) {
40286
+ this.nodes.push(node,);
40287
+ node.setGroup(this,);
40288
+ }
40289
+ /**
40290
+ * Returns the winner for the given required physical props. The winner
40291
+ * stores the best node and its cost. This is used to find the best node in
40292
+ * the group.
40293
+ */
40294
+ getWinner(required,) {
40295
+ const hash2 = required.getHash();
40296
+ const existing = this.winners.get(hash2,);
40297
+ if (existing) return existing;
40298
+ const winner = new Winner();
40299
+ this.winners.set(hash2, winner,);
40300
+ return winner;
40301
+ }
40302
+ /**
40303
+ * Returns the optimized version of the node. The optimized version is the
40304
+ * node with the lowest cost with all children replaced with their optimized
40305
+ * versions. This is used to create the final optimized query plan.
40306
+ */
40307
+ getOptimized(required,) {
40308
+ const winner = this.getWinner(required,);
40309
+ assert(winner.node, 'Group not optimized',);
40310
+ const optimizer = winner.node.getOptimized(required,);
40311
+ optimizer.setGroup(this,);
40312
+ return optimizer;
40313
+ }
40314
+ };
40315
+ var Winner = class {
40316
+ constructor() {
40317
+ __publicField(this, 'node',);
40318
+ __publicField(this, 'cost', new Cost(Infinity,),);
40319
+ __publicField(this, 'nodes', [],);
40320
+ }
40321
+ update(node, cost,) {
40322
+ this.nodes.push(node,);
40323
+ if (Cost.compare(cost, this.cost,) < 0) {
40324
+ this.node = node;
40325
+ this.cost = cost;
40326
+ }
40327
+ }
40328
+ };
40329
+ function evaluateSync(generator,) {
40330
+ const state2 = generator.next();
40331
+ assert(state2.done, 'Generator must not yield',);
40332
+ return state2.value;
40333
+ }
40334
+ async function evaluateAsync(generator, state2 = generator.next(),) {
40335
+ while (!state2.done) {
40336
+ const value = await state2.value;
40337
+ state2 = generator.next(value,);
40338
+ }
40339
+ return state2.value;
40340
+ }
40341
+ function* evaluateObject(values,) {
40342
+ const result = {};
40343
+ const keys3 = Object.keys(values,);
40344
+ const promises = [];
40345
+ for (const key7 of keys3) {
40346
+ const generator = values[key7];
40347
+ if (isGenerator2(generator,)) {
40348
+ const state2 = generator.next();
40349
+ if (state2.done) {
40350
+ result[key7] = state2.value;
40351
+ } else {
40352
+ promises.push(
40353
+ evaluateAsync(generator, state2,).then((value) => {
40354
+ result[key7] = value;
40355
+ },),
40356
+ );
40357
+ }
40358
+ } else {
40359
+ result[key7] = generator;
40360
+ }
40361
+ }
40362
+ if (promises.length > 0) {
40363
+ yield Promise.all(promises,);
40364
+ }
40365
+ return result;
40366
+ }
40367
+ function* evaluateArray(values,) {
40368
+ const result = [];
40369
+ const keys3 = values.keys();
40370
+ const promises = [];
40371
+ for (const key7 of keys3) {
40372
+ const generator = values[key7];
40373
+ if (isGenerator2(generator,)) {
40374
+ const state2 = generator.next();
40375
+ if (state2.done) {
40376
+ result[key7] = state2.value;
40377
+ } else {
40378
+ promises.push(
40379
+ evaluateAsync(generator, state2,).then((value) => {
40380
+ result[key7] = value;
40381
+ },),
40382
+ );
40383
+ }
40384
+ } else {
40385
+ result[key7] = generator;
40386
+ }
40387
+ }
40388
+ if (promises.length > 0) {
40389
+ yield Promise.all(promises,);
40390
+ }
40391
+ return result;
40392
+ }
40393
+ var AbstractNode = class {
40394
+ constructor(isSynchronous,) {
40395
+ this.isSynchronous = isSynchronous;
40396
+ }
40397
+ };
40398
+ var RelationalNode = class extends AbstractNode {
40399
+ constructor() {
40400
+ super(...arguments,);
40401
+ __publicField(this, 'group',);
40402
+ }
40403
+ /**
40404
+ * Returns the group that the node belongs to. Throws an error if the node
40405
+ * is not in a group. This should only happen in the constructor because
40406
+ * every node is added to a group right after creation.
40407
+ */
40408
+ getGroup() {
40409
+ assert(this.group, 'Node must be in a group',);
40410
+ return this.group;
40411
+ }
40412
+ /**
40413
+ * Adds the node to the given group. Throws an error if the node is already
40414
+ * in a group.
40415
+ */
40416
+ setGroup(group,) {
40417
+ assert(!this.group, 'Node is already in a group',);
40418
+ this.group = group;
40419
+ }
40420
+ /**
40421
+ * Evaluates the node and all children synchronously. Throws an error if the
40422
+ * node is not synchronous.
40423
+ */
40424
+ evaluateSync() {
40425
+ const generator = this.evaluate(void 0,);
40426
+ return evaluateSync(generator,);
40427
+ }
40428
+ /**
40429
+ * Evaluates the node and all children asynchronously.
40430
+ */
40431
+ evaluateAsync() {
40432
+ const generator = this.evaluate(void 0,);
40433
+ return evaluateAsync(generator,);
40434
+ }
40435
+ };
39955
40436
  function Hash(value,) {
39956
40437
  return value;
39957
40438
  }
@@ -39960,6 +40441,16 @@ function isHashable(value,) {
39960
40441
  }
39961
40442
  function calculateHash(name, ...values) {
39962
40443
  const hashes = values.map((value) => {
40444
+ const isCollectionMetadata = value instanceof CollectionMetadata;
40445
+ assert(!isCollectionMetadata, 'Pass CollectionMetadata.id instead',);
40446
+ const isFieldMetadata = value instanceof FieldMetadata;
40447
+ assert(!isFieldMetadata, 'Pass FieldMetadata.id instead',);
40448
+ const isIndexMetadata = value instanceof IndexMetadata;
40449
+ assert(!isIndexMetadata, 'Pass IndexMetadata.id instead',);
40450
+ const isRelationalNode = value instanceof RelationalNode;
40451
+ assert(!isRelationalNode, 'Pass RelationalNode.group.id instead',);
40452
+ const isGroup = value instanceof Group;
40453
+ assert(!isGroup, 'Pass Group.id instead',);
39963
40454
  if (isHashable(value,)) {
39964
40455
  return value.getHash();
39965
40456
  }
@@ -40078,104 +40569,6 @@ var Fields = class extends Metadata {
40078
40569
  __publicField(this, 'name', 'Fields',);
40079
40570
  }
40080
40571
  };
40081
- function getNetworkLatency() {
40082
- return 25;
40083
- }
40084
- function getNetworkSpeed() {
40085
- return 100 * 125;
40086
- }
40087
- var KB = 1e3;
40088
- var Cost = class {
40089
- constructor(network,) {
40090
- this.network = network;
40091
- }
40092
- static estimate(totalRequests, transferredBytes,) {
40093
- const latency = getNetworkLatency();
40094
- const speed = getNetworkSpeed();
40095
- const network = totalRequests * latency + transferredBytes / speed;
40096
- return new Cost(network,);
40097
- }
40098
- static max(left, right,) {
40099
- const network = Math.max(left.network, right.network,);
40100
- return new Cost(network,);
40101
- }
40102
- static compare(left, right,) {
40103
- if (left.network < right.network) return -1;
40104
- if (left.network > right.network) return 1;
40105
- return 0;
40106
- }
40107
- add(cost,) {
40108
- this.network += cost.network;
40109
- return this;
40110
- }
40111
- toString() {
40112
- return `${this.network}ms`;
40113
- }
40114
- };
40115
- function evaluateSync(generator,) {
40116
- const state2 = generator.next();
40117
- assert(state2.done, 'Generator must not yield',);
40118
- return state2.value;
40119
- }
40120
- async function evaluateAsync(generator, state2 = generator.next(),) {
40121
- while (!state2.done) {
40122
- const value = await state2.value;
40123
- state2 = generator.next(value,);
40124
- }
40125
- return state2.value;
40126
- }
40127
- function* evaluateObject(values,) {
40128
- const result = {};
40129
- const keys3 = Object.keys(values,);
40130
- const promises = [];
40131
- for (const key7 of keys3) {
40132
- const generator = values[key7];
40133
- if (isGenerator2(generator,)) {
40134
- const state2 = generator.next();
40135
- if (state2.done) {
40136
- result[key7] = state2.value;
40137
- } else {
40138
- promises.push(
40139
- evaluateAsync(generator, state2,).then((value) => {
40140
- result[key7] = value;
40141
- },),
40142
- );
40143
- }
40144
- } else {
40145
- result[key7] = generator;
40146
- }
40147
- }
40148
- if (promises.length > 0) {
40149
- yield Promise.all(promises,);
40150
- }
40151
- return result;
40152
- }
40153
- function* evaluateArray(values,) {
40154
- const result = [];
40155
- const keys3 = values.keys();
40156
- const promises = [];
40157
- for (const key7 of keys3) {
40158
- const generator = values[key7];
40159
- if (isGenerator2(generator,)) {
40160
- const state2 = generator.next();
40161
- if (state2.done) {
40162
- result[key7] = state2.value;
40163
- } else {
40164
- promises.push(
40165
- evaluateAsync(generator, state2,).then((value) => {
40166
- result[key7] = value;
40167
- },),
40168
- );
40169
- }
40170
- } else {
40171
- result[key7] = generator;
40172
- }
40173
- }
40174
- if (promises.length > 0) {
40175
- yield Promise.all(promises,);
40176
- }
40177
- return result;
40178
- }
40179
40572
  var RequiredProps = class {
40180
40573
  constructor(ordering, resolvedFields,) {
40181
40574
  this.ordering = ordering;
@@ -40226,8 +40619,11 @@ var Tuple = class {
40226
40619
  __publicField(this, 'values', /* @__PURE__ */ new Map(),);
40227
40620
  }
40228
40621
  getKey() {
40229
- const pointers = this.pointers.values();
40230
- return Array.from(pointers,).join('-',);
40622
+ const result = [];
40623
+ for (const [collection, pointer,] of this.pointers) {
40624
+ result.push(`${collection.id}-${pointer}`,);
40625
+ }
40626
+ return result.sort().join('-',);
40231
40627
  }
40232
40628
  addValue(field, value,) {
40233
40629
  this.values.set(field, value,);
@@ -40322,49 +40718,6 @@ var Relation = class {
40322
40718
  return result;
40323
40719
  }
40324
40720
  };
40325
- var AbstractNode = class {
40326
- constructor(isSynchronous,) {
40327
- this.isSynchronous = isSynchronous;
40328
- }
40329
- };
40330
- var RelationalNode = class extends AbstractNode {
40331
- constructor() {
40332
- super(...arguments,);
40333
- __publicField(this, 'group',);
40334
- }
40335
- /**
40336
- * Returns the group that the node belongs to. Throws an error if the node
40337
- * is not in a group. This should only happen in the constructor because
40338
- * every node is added to a group right after creation.
40339
- */
40340
- getGroup() {
40341
- assert(this.group, 'Node must be in a group',);
40342
- return this.group;
40343
- }
40344
- /**
40345
- * Adds the node to the given group. Throws an error if the node is already
40346
- * in a group.
40347
- */
40348
- setGroup(group,) {
40349
- assert(!this.group, 'Node is already in a group',);
40350
- this.group = group;
40351
- }
40352
- /**
40353
- * Evaluates the node and all children synchronously. Throws an error if the
40354
- * node is not synchronous.
40355
- */
40356
- evaluateSync() {
40357
- const generator = this.evaluate(void 0,);
40358
- return evaluateSync(generator,);
40359
- }
40360
- /**
40361
- * Evaluates the node and all children asynchronously.
40362
- */
40363
- evaluateAsync() {
40364
- const generator = this.evaluate(void 0,);
40365
- return evaluateAsync(generator,);
40366
- }
40367
- };
40368
40721
  var ProjectionField = class {
40369
40722
  constructor(input, field,) {
40370
40723
  this.input = input;
@@ -40397,7 +40750,20 @@ var RelationalProject = class extends RelationalNode {
40397
40750
  }
40398
40751
  return fields;
40399
40752
  }
40400
- canProvideOrdering() {
40753
+ canProvideOrdering(ordering,) {
40754
+ const projectionFields = new Fields();
40755
+ for (const projection of this.projections) {
40756
+ projectionFields.add(projection.field,);
40757
+ }
40758
+ for (
40759
+ const {
40760
+ field,
40761
+ } of ordering.fields
40762
+ ) {
40763
+ if (projectionFields.has(field,)) {
40764
+ return false;
40765
+ }
40766
+ }
40401
40767
  return true;
40402
40768
  }
40403
40769
  canProvideResolvedFields() {
@@ -41491,24 +41857,19 @@ var RelationalLeftJoin = class extends RelationalNode {
41491
41857
  return new RelationalLeftJoin(left, right, constraint,);
41492
41858
  }
41493
41859
  /** Optimized path for equality constraints that runs in O(n + m) time. */
41494
- *evaluateScalarEquals(result, constraint, context,) {
41495
- const {
41496
- left,
41497
- right,
41498
- } = yield* evaluateObject({
41499
- left: this.left.evaluate(context,),
41500
- right: this.right.evaluate(context,),
41501
- },);
41860
+ *evaluateScalarEquals(left, right, leftConstraint, rightConstraint, context,) {
41502
41861
  const joinKeyMap = /* @__PURE__ */ new Map();
41503
41862
  for (const rightTuple of right.tuples) {
41504
- const rightValue = yield* constraint.right.evaluate(context, rightTuple,);
41863
+ const rightValue = yield* rightConstraint.evaluate(context, rightTuple,);
41505
41864
  const key7 = JSON.stringify((rightValue == null ? void 0 : rightValue.value) ?? null,);
41506
41865
  const tuplesForKey = joinKeyMap.get(key7,) ?? [];
41507
41866
  tuplesForKey.push(rightTuple,);
41508
41867
  joinKeyMap.set(key7, tuplesForKey,);
41509
41868
  }
41869
+ const outputFields = this.getOutputFields();
41870
+ const result = new Relation(outputFields,);
41510
41871
  for (const leftTuple of left.tuples) {
41511
- const leftValue = yield* constraint.left.evaluate(context, leftTuple,);
41872
+ const leftValue = yield* leftConstraint.evaluate(context, leftTuple,);
41512
41873
  const key7 = JSON.stringify((leftValue == null ? void 0 : leftValue.value) ?? null,);
41513
41874
  const matches = joinKeyMap.get(key7,) ?? [];
41514
41875
  if (matches.length === 0) {
@@ -41525,12 +41886,6 @@ var RelationalLeftJoin = class extends RelationalNode {
41525
41886
  return result;
41526
41887
  }
41527
41888
  *evaluate(context,) {
41528
- const outputFields = this.getOutputFields();
41529
- const result = new Relation(outputFields,);
41530
- if (this.constraint instanceof ScalarEquals) {
41531
- yield* this.evaluateScalarEquals(result.tuples, this.constraint, context,);
41532
- return result;
41533
- }
41534
41889
  const {
41535
41890
  left,
41536
41891
  right,
@@ -41538,6 +41893,22 @@ var RelationalLeftJoin = class extends RelationalNode {
41538
41893
  left: this.left.evaluate(context,),
41539
41894
  right: this.right.evaluate(context,),
41540
41895
  },);
41896
+ if (this.constraint instanceof ScalarEquals) {
41897
+ if (
41898
+ this.constraint.left.referencedFields.subsetOf(this.leftGroup.relational.outputFields,) &&
41899
+ this.constraint.right.referencedFields.subsetOf(this.rightGroup.relational.outputFields,)
41900
+ ) {
41901
+ return yield* this.evaluateScalarEquals(left, right, this.constraint.left, this.constraint.right, context,);
41902
+ }
41903
+ if (
41904
+ this.constraint.right.referencedFields.subsetOf(this.leftGroup.relational.outputFields,) &&
41905
+ this.constraint.left.referencedFields.subsetOf(this.rightGroup.relational.outputFields,)
41906
+ ) {
41907
+ return yield* this.evaluateScalarEquals(left, right, this.constraint.right, this.constraint.left, context,);
41908
+ }
41909
+ }
41910
+ const outputFields = this.getOutputFields();
41911
+ const result = new Relation(outputFields,);
41541
41912
  for (const leftTuple of left.tuples) {
41542
41913
  let hasMatch = false;
41543
41914
  for (const rightTuple of right.tuples) {
@@ -41614,24 +41985,19 @@ var RelationalRightJoin = class extends RelationalNode {
41614
41985
  return new RelationalRightJoin(left, right, constraint,);
41615
41986
  }
41616
41987
  /** Optimized path for equality constraints that runs in O(n + m) time. */
41617
- *evaluateScalarEquals(result, constraint, context,) {
41618
- const {
41619
- left,
41620
- right,
41621
- } = yield* evaluateObject({
41622
- left: this.left.evaluate(context,),
41623
- right: this.right.evaluate(context,),
41624
- },);
41988
+ *evaluateScalarEquals(left, right, leftConstraint, rightConstraint, context,) {
41625
41989
  const joinKeyMap = /* @__PURE__ */ new Map();
41626
41990
  for (const leftTuple of left.tuples) {
41627
- const leftValue = yield* constraint.left.evaluate(context, leftTuple,);
41991
+ const leftValue = yield* leftConstraint.evaluate(context, leftTuple,);
41628
41992
  const key7 = JSON.stringify((leftValue == null ? void 0 : leftValue.value) ?? null,);
41629
41993
  const tuplesForKey = joinKeyMap.get(key7,) ?? [];
41630
41994
  tuplesForKey.push(leftTuple,);
41631
41995
  joinKeyMap.set(key7, tuplesForKey,);
41632
41996
  }
41997
+ const outputFields = this.getOutputFields();
41998
+ const result = new Relation(outputFields,);
41633
41999
  for (const rightTuple of right.tuples) {
41634
- const rightValue = yield* constraint.right.evaluate(context, rightTuple,);
42000
+ const rightValue = yield* rightConstraint.evaluate(context, rightTuple,);
41635
42001
  const key7 = JSON.stringify((rightValue == null ? void 0 : rightValue.value) ?? null,);
41636
42002
  const matches = joinKeyMap.get(key7,) ?? [];
41637
42003
  if (matches.length === 0) {
@@ -41648,12 +42014,6 @@ var RelationalRightJoin = class extends RelationalNode {
41648
42014
  return result;
41649
42015
  }
41650
42016
  *evaluate(context,) {
41651
- const outputFields = this.getOutputFields();
41652
- const result = new Relation(outputFields,);
41653
- if (this.constraint instanceof ScalarEquals) {
41654
- yield* this.evaluateScalarEquals(result.tuples, this.constraint, context,);
41655
- return result;
41656
- }
41657
42017
  const {
41658
42018
  left,
41659
42019
  right,
@@ -41661,6 +42021,22 @@ var RelationalRightJoin = class extends RelationalNode {
41661
42021
  left: this.left.evaluate(context,),
41662
42022
  right: this.right.evaluate(context,),
41663
42023
  },);
42024
+ if (this.constraint instanceof ScalarEquals) {
42025
+ if (
42026
+ this.constraint.left.referencedFields.subsetOf(this.leftGroup.relational.outputFields,) &&
42027
+ this.constraint.right.referencedFields.subsetOf(this.rightGroup.relational.outputFields,)
42028
+ ) {
42029
+ return yield* this.evaluateScalarEquals(left, right, this.constraint.left, this.constraint.right, context,);
42030
+ }
42031
+ if (
42032
+ this.constraint.right.referencedFields.subsetOf(this.leftGroup.relational.outputFields,) &&
42033
+ this.constraint.left.referencedFields.subsetOf(this.rightGroup.relational.outputFields,)
42034
+ ) {
42035
+ return yield* this.evaluateScalarEquals(left, right, this.constraint.right, this.constraint.left, context,);
42036
+ }
42037
+ }
42038
+ const outputFields = this.getOutputFields();
42039
+ const result = new Relation(outputFields,);
41664
42040
  for (const rightTuple of right.tuples) {
41665
42041
  let hasMatch = false;
41666
42042
  for (const leftTuple of left.tuples) {
@@ -42291,7 +42667,7 @@ var Explorer = class {
42291
42667
  explore(before,) {
42292
42668
  const group = before.getGroup();
42293
42669
  if (before instanceof RelationalLeftJoin) {
42294
- const after = new RelationalRightJoin(before.left, before.right, before.constraint,);
42670
+ const after = new RelationalRightJoin(before.right, before.left, before.constraint,);
42295
42671
  this.memo.addRelational(after, group,);
42296
42672
  }
42297
42673
  if (before instanceof RelationalFilter) {
@@ -42454,62 +42830,6 @@ function createIndexQueryAll(length,) {
42454
42830
  };
42455
42831
  return new Array(length,).fill(lookup,);
42456
42832
  }
42457
- function GroupId(id3,) {
42458
- return id3;
42459
- }
42460
- var Group = class {
42461
- constructor(id3, relational,) {
42462
- this.id = id3;
42463
- this.relational = relational;
42464
- __publicField(this, 'nodes', [],);
42465
- __publicField(this, 'winners', /* @__PURE__ */ new Map(),);
42466
- }
42467
- /**
42468
- * Adds a node to the group. Throws an error if the node is already in a
42469
- * group.
42470
- */
42471
- addNode(node,) {
42472
- this.nodes.push(node,);
42473
- node.setGroup(this,);
42474
- }
42475
- /**
42476
- * Returns the winner for the given required physical props. The winner
42477
- * stores the best node and its cost. This is used to find the best node in
42478
- * the group.
42479
- */
42480
- getWinner(required,) {
42481
- const hash2 = required.getHash();
42482
- const existing = this.winners.get(hash2,);
42483
- if (existing) return existing;
42484
- const winner = new Winner();
42485
- this.winners.set(hash2, winner,);
42486
- return winner;
42487
- }
42488
- /**
42489
- * Returns the optimized version of the node. The optimized version is the
42490
- * node with the lowest cost with all children replaced with their optimized
42491
- * versions. This is used to create the final optimized query plan.
42492
- */
42493
- getOptimized(required,) {
42494
- const winner = this.getWinner(required,);
42495
- assert(winner.node, 'Group not optimized',);
42496
- const optimizer = winner.node.getOptimized(required,);
42497
- optimizer.setGroup(this,);
42498
- return optimizer;
42499
- }
42500
- };
42501
- var Winner = class {
42502
- constructor() {
42503
- __publicField(this, 'node',);
42504
- __publicField(this, 'cost', new Cost(Infinity,),);
42505
- }
42506
- update(node, cost,) {
42507
- if (Cost.compare(cost, this.cost,) < 0) {
42508
- this.node = node;
42509
- this.cost = cost;
42510
- }
42511
- }
42512
- };
42513
42833
  var RelationalProps = class {
42514
42834
  constructor(outputFields,) {
42515
42835
  this.outputFields = outputFields;
@@ -42676,9 +42996,9 @@ var EnforcerSort = class extends EnforcerNode {
42676
42996
  field,
42677
42997
  } of this.ordering.fields
42678
42998
  ) {
42679
- if (field.name !== VIRTUAL_INDEX_FIELD) {
42680
- resolvedFields.add(field,);
42681
- }
42999
+ if (field.name === VIRTUAL_INDEX_FIELD) continue;
43000
+ if (isUndefined(field.collection,)) continue;
43001
+ resolvedFields.add(field,);
42682
43002
  }
42683
43003
  const ordering = new Ordering();
42684
43004
  return new RequiredProps(ordering, resolvedFields,);
@@ -42885,6 +43205,7 @@ var ScalarArray = class extends ScalarNode {
42885
43205
  const resolvedFields = new Fields();
42886
43206
  const fields = Object.values(this.namedFields,);
42887
43207
  for (const field of fields) {
43208
+ if (isUndefined(field.collection,)) continue;
42888
43209
  resolvedFields.add(field,);
42889
43210
  }
42890
43211
  return new RequiredProps(this.ordering, resolvedFields,);
@@ -42976,7 +43297,9 @@ var ScalarFlatArray = class extends ScalarNode {
42976
43297
  }
42977
43298
  getInputRequiredProps() {
42978
43299
  const resolvedFields = new Fields();
42979
- resolvedFields.add(this.field,);
43300
+ if (!isUndefined(this.field.collection,)) {
43301
+ resolvedFields.add(this.field,);
43302
+ }
42980
43303
  return new RequiredProps(this.ordering, resolvedFields,);
42981
43304
  }
42982
43305
  optimize(optimizer,) {
@@ -43002,7 +43325,7 @@ var ScalarFlatArray = class extends ScalarNode {
43002
43325
  };
43003
43326
  }
43004
43327
  };
43005
- var collation7 = {
43328
+ var collation8 = {
43006
43329
  type: 0,
43007
43330
  /* CaseInsensitive */
43008
43331
  };
@@ -43049,11 +43372,11 @@ var ScalarIn = class extends ScalarNode {
43049
43372
  },);
43050
43373
  return {
43051
43374
  type: 'boolean',
43052
- value: DatabaseValue.in(left, right, collation7,),
43375
+ value: DatabaseValue.in(left, right, collation8,),
43053
43376
  };
43054
43377
  }
43055
43378
  };
43056
- var collation8 = {
43379
+ var collation9 = {
43057
43380
  type: 1,
43058
43381
  /* CaseSensitive */
43059
43382
  };
@@ -43100,7 +43423,7 @@ var ScalarIndexOf = class extends ScalarNode {
43100
43423
  },);
43101
43424
  return {
43102
43425
  type: 'number',
43103
- value: DatabaseValue.indexOf(source, target, collation8,),
43426
+ value: DatabaseValue.indexOf(source, target, collation9,),
43104
43427
  };
43105
43428
  }
43106
43429
  };
@@ -43164,7 +43487,7 @@ var ScalarNot = class extends ScalarNode {
43164
43487
  };
43165
43488
  }
43166
43489
  };
43167
- var collation9 = {
43490
+ var collation10 = {
43168
43491
  type: 0,
43169
43492
  /* CaseInsensitive */
43170
43493
  };
@@ -43211,7 +43534,7 @@ var ScalarNotIn = class extends ScalarNode {
43211
43534
  },);
43212
43535
  return {
43213
43536
  type: 'boolean',
43214
- value: !DatabaseValue.in(left, right, collation9,),
43537
+ value: !DatabaseValue.in(left, right, collation10,),
43215
43538
  };
43216
43539
  }
43217
43540
  };
@@ -43596,6 +43919,11 @@ var Optimizer = class {
43596
43919
  this.explorer.explore(node,);
43597
43920
  }
43598
43921
  }
43922
+ if (false) {
43923
+ assert(winner.node, 'Group not optimized',);
43924
+ const cache2 = /* @__PURE__ */ new Map();
43925
+ winner.node = new RelationalAssert(winner.node, required, cache2,);
43926
+ }
43599
43927
  return winner.cost;
43600
43928
  }
43601
43929
  createEnforcer(winner, node, required,) {
@@ -43868,7 +44196,7 @@ var AnimationCollector = class {
43868
44196
  };
43869
44197
  _variantHashes = /* @__PURE__ */ new WeakMap();
43870
44198
  var framerAppearEffects = /* @__PURE__ */ new AnimationCollector();
43871
- function withOptimizedAppearEffect(Component16,) {
44199
+ function withOptimizedAppearEffect(Component18,) {
43872
44200
  return React4.forwardRef(({
43873
44201
  optimized,
43874
44202
  ...props
@@ -43889,7 +44217,7 @@ function withOptimizedAppearEffect(Component16,) {
43889
44217
  generatedComponentContext,
43890
44218
  );
43891
44219
  }
43892
- return /* @__PURE__ */ jsx(Component16, {
44220
+ return /* @__PURE__ */ jsx(Component18, {
43893
44221
  ref,
43894
44222
  ...props,
43895
44223
  },);
@@ -44431,12 +44759,12 @@ function usePrototypeNavigate({
44431
44759
  navigation.goBack();
44432
44760
  return false;
44433
44761
  }
44434
- const Component16 = typeof target === 'string'
44762
+ const Component18 = typeof target === 'string'
44435
44763
  ? await componentForRoute(getRoute == null ? void 0 : getRoute(target,),).catch(() => {},)
44436
44764
  : React4.isValidElement(target,)
44437
44765
  ? target
44438
44766
  : null;
44439
- if (!Component16) return;
44767
+ if (!Component18) return;
44440
44768
  const {
44441
44769
  appearsFrom,
44442
44770
  backdropColor,
@@ -44445,38 +44773,38 @@ function usePrototypeNavigate({
44445
44773
  const transitionType = options.transition || 'instant';
44446
44774
  switch (transitionType) {
44447
44775
  case 'instant':
44448
- navigation.instant(Component16,);
44776
+ navigation.instant(Component18,);
44449
44777
  break;
44450
44778
  case 'fade':
44451
- navigation.fade(Component16, {
44779
+ navigation.fade(Component18, {
44452
44780
  animation,
44453
44781
  },);
44454
44782
  break;
44455
44783
  case 'push':
44456
- navigation.push(Component16, {
44784
+ navigation.push(Component18, {
44457
44785
  appearsFrom,
44458
44786
  animation,
44459
44787
  },);
44460
44788
  break;
44461
44789
  case 'flip':
44462
- navigation.flip(Component16, {
44790
+ navigation.flip(Component18, {
44463
44791
  appearsFrom,
44464
44792
  animation,
44465
44793
  },);
44466
44794
  break;
44467
44795
  case 'magicMotion':
44468
- navigation.magicMotion(Component16, {
44796
+ navigation.magicMotion(Component18, {
44469
44797
  animation,
44470
44798
  },);
44471
44799
  break;
44472
44800
  case 'modal':
44473
- navigation.modal(Component16, {
44801
+ navigation.modal(Component18, {
44474
44802
  backdropColor,
44475
44803
  animation,
44476
44804
  },);
44477
44805
  break;
44478
44806
  case 'overlay':
44479
- navigation.overlay(Component16, {
44807
+ navigation.overlay(Component18, {
44480
44808
  appearsFrom,
44481
44809
  backdropColor,
44482
44810
  animation,
@@ -44888,6 +45216,72 @@ function useVariantState({
44888
45216
  variantClassNames,
44889
45217
  ],);
44890
45218
  }
45219
+ function withCodeBoundaryForOverrides(Component18, {
45220
+ scopeId,
45221
+ nodeId,
45222
+ override,
45223
+ inComponentSlot,
45224
+ },) {
45225
+ if (!shouldEnableCodeBoundaries()) {
45226
+ return override(Component18,);
45227
+ }
45228
+ const appliedOverride = tryToApplyOverride(Component18, override,);
45229
+ let hasErrorBeenLogged = false;
45230
+ function CodeBoundaryForOverrides(props, ref,) {
45231
+ const externalComponentNestingLevel = useExternalComponentNestingLevel();
45232
+ const shouldWrapWithBoundary = shouldWrapOverrideWithBoundary(externalComponentNestingLevel, inComponentSlot ?? false,);
45233
+ if (shouldWrapWithBoundary) {
45234
+ if (appliedOverride.status === 'success') {
45235
+ return /* @__PURE__ */ jsx(CodeComponentBoundary, {
45236
+ errorMessage: getErrorMessageForOverride(scopeId, nodeId,),
45237
+ fallback: /* @__PURE__ */ jsx(Component18, {
45238
+ ...props,
45239
+ ref,
45240
+ },),
45241
+ children: /* @__PURE__ */ jsx(appliedOverride.Component, {
45242
+ ...props,
45243
+ ref,
45244
+ },),
45245
+ },);
45246
+ } else {
45247
+ if (!hasErrorBeenLogged) {
45248
+ logError(appliedOverride.error,);
45249
+ logError(getErrorMessageForOverride(scopeId, nodeId,),);
45250
+ collectErrorToAnalytics(appliedOverride.error,);
45251
+ hasErrorBeenLogged = true;
45252
+ }
45253
+ return /* @__PURE__ */ jsx(Component18, {
45254
+ ...props,
45255
+ ref,
45256
+ },);
45257
+ }
45258
+ } else {
45259
+ if (appliedOverride.status === 'success') {
45260
+ return /* @__PURE__ */ jsx(appliedOverride.Component, {
45261
+ ...props,
45262
+ ref,
45263
+ },);
45264
+ } else {
45265
+ throw appliedOverride.error;
45266
+ }
45267
+ }
45268
+ }
45269
+ return React4.forwardRef(CodeBoundaryForOverrides,);
45270
+ }
45271
+ function tryToApplyOverride(Component18, override,) {
45272
+ try {
45273
+ const ComponentWithOverrides = override(Component18,);
45274
+ return {
45275
+ status: 'success',
45276
+ Component: ComponentWithOverrides,
45277
+ };
45278
+ } catch (error) {
45279
+ return {
45280
+ status: 'error',
45281
+ error,
45282
+ };
45283
+ }
45284
+ }
44891
45285
  function extractMappingFromInfo(info,) {
44892
45286
  var _a;
44893
45287
  const json = (_a = info.__FramerMetadata__.exports.default.annotations) == null ? void 0 : _a.framerVariables;
@@ -44898,14 +45292,14 @@ function extractMappingFromInfo(info,) {
44898
45292
  return void 0;
44899
45293
  }
44900
45294
  }
44901
- function withMappedReactProps(Component16, info,) {
45295
+ function withMappedReactProps(Component18, info,) {
44902
45296
  return (rawProps) => {
44903
45297
  const props = {};
44904
45298
  const mapping = extractMappingFromInfo(info,);
44905
45299
  for (const key7 in rawProps) {
44906
45300
  asRecord(props,)[(mapping == null ? void 0 : mapping[key7]) ?? key7] = rawProps[key7];
44907
45301
  }
44908
- return /* @__PURE__ */ jsx(Component16, {
45302
+ return /* @__PURE__ */ jsx(Component18, {
44909
45303
  ...props,
44910
45304
  },);
44911
45305
  };
@@ -44946,10 +45340,10 @@ function createInputOutputRanges2(transformTargets, threshold, exitTarget,) {
44946
45340
  outputRange: [-1, -1, ...outputRange,],
44947
45341
  };
44948
45342
  }
44949
- var withVariantAppearEffect = (Component16) =>
45343
+ var withVariantAppearEffect = (Component18) =>
44950
45344
  React4.forwardRef((props, forwardedRef,) => {
44951
45345
  if (RenderTarget.current() === RenderTarget.canvas) {
44952
- return /* @__PURE__ */ jsx(Component16, {
45346
+ return /* @__PURE__ */ jsx(Component18, {
44953
45347
  ...props,
44954
45348
  ref: forwardedRef,
44955
45349
  },);
@@ -45036,18 +45430,18 @@ var withVariantAppearEffect = (Component16) =>
45036
45430
  repeat: !animateOnce,
45037
45431
  },);
45038
45432
  if (!('variantAppearEffectEnabled' in options) || variantAppearEffectEnabled === true) {
45039
- return /* @__PURE__ */ jsx(Component16, {
45433
+ return /* @__PURE__ */ jsx(Component18, {
45040
45434
  ...rest,
45041
45435
  variant: activeVariant ?? props.variant,
45042
45436
  ref: observerRef,
45043
45437
  },);
45044
45438
  } else {
45045
- return /* @__PURE__ */ jsx(Component16, {
45439
+ return /* @__PURE__ */ jsx(Component18, {
45046
45440
  ...rest,
45047
45441
  },);
45048
45442
  }
45049
45443
  },);
45050
- var withVariantFX = (Component16) =>
45444
+ var withVariantFX = (Component18) =>
45051
45445
  React4.forwardRef(({
45052
45446
  initial,
45053
45447
  animate: animate3,
@@ -45064,7 +45458,7 @@ var withVariantFX = (Component16) =>
45064
45458
  observerRef,
45065
45459
  true,
45066
45460
  );
45067
- return /* @__PURE__ */ jsx(Component16, {
45461
+ return /* @__PURE__ */ jsx(Component18, {
45068
45462
  ...props,
45069
45463
  style: {
45070
45464
  ...(props == null ? void 0 : props.style),
@@ -48751,10 +49145,10 @@ var RichTextContainer = /* @__PURE__ */ forwardRef((props, ref,) => {
48751
49145
  if (layoutId) {
48752
49146
  rest.layout = 'preserve-aspect';
48753
49147
  }
48754
- const Component16 = htmlElementAsMotionComponent(props.as,);
49148
+ const Component18 = htmlElementAsMotionComponent(props.as,);
48755
49149
  if (isString2(props.viewBox,)) {
48756
49150
  if (props.as !== void 0) {
48757
- return /* @__PURE__ */ jsx(Component16, {
49151
+ return /* @__PURE__ */ jsx(Component18, {
48758
49152
  ...rest,
48759
49153
  ref: containerRef,
48760
49154
  style: containerStyle,
@@ -48787,7 +49181,7 @@ var RichTextContainer = /* @__PURE__ */ forwardRef((props, ref,) => {
48787
49181
  },);
48788
49182
  }
48789
49183
  }
48790
- return /* @__PURE__ */ jsx(Component16, {
49184
+ return /* @__PURE__ */ jsx(Component18, {
48791
49185
  ...rest,
48792
49186
  ref: containerRef,
48793
49187
  style: containerStyle,
@@ -51623,6 +52017,7 @@ export {
51623
52017
  sharedSVGManager,
51624
52018
  shouldOpenLinkInNewTab,
51625
52019
  Size,
52020
+ SmartComponentScopedContainer,
51626
52021
  spring,
51627
52022
  SpringAnimator,
51628
52023
  SSRVariants,
@@ -51734,6 +52129,7 @@ export {
51734
52129
  visualElementStore,
51735
52130
  warning,
51736
52131
  WindowContext,
52132
+ withCodeBoundaryForOverrides,
51737
52133
  withCSS,
51738
52134
  withFX,
51739
52135
  withGeneratedLayoutId,
@@ -51800,4 +52196,5 @@ if (typeof document !== 'undefined') {
51800
52196
  document.head.appendChild(fragment);
51801
52197
  }
51802
52198
 
51803
- export { Router, FetchClientProvider, FormContext }
52199
+ export { Link as FramerLink }
52200
+ export { Router, FetchClientProvider, FormContext, LocaleInfoContext }