unframer 2.7.7 → 2.7.9

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 (48) hide show
  1. package/README.md +5 -1
  2. package/dist/babel-plugin-imports.d.ts +21 -0
  3. package/dist/babel-plugin-imports.d.ts.map +1 -0
  4. package/dist/babel-plugin-imports.js +375 -0
  5. package/dist/babel-plugin-imports.js.map +1 -0
  6. package/dist/cli.d.ts.map +1 -1
  7. package/dist/cli.js +2 -11
  8. package/dist/cli.js.map +1 -1
  9. package/dist/css.d.ts.map +1 -1
  10. package/dist/css.js +4 -3
  11. package/dist/css.js.map +1 -1
  12. package/dist/exporter.d.ts.map +1 -1
  13. package/dist/exporter.js +57 -30
  14. package/dist/exporter.js.map +1 -1
  15. package/dist/framer.d.ts.map +1 -1
  16. package/dist/framer.js +56 -1850
  17. package/dist/framer.js.map +1 -1
  18. package/dist/renamer.d.ts +12 -0
  19. package/dist/renamer.d.ts.map +1 -0
  20. package/dist/renamer.js +169 -0
  21. package/dist/renamer.js.map +1 -0
  22. package/esm/babel-plugin-imports.d.ts +21 -0
  23. package/esm/babel-plugin-imports.d.ts.map +1 -0
  24. package/esm/babel-plugin-imports.js +344 -0
  25. package/esm/babel-plugin-imports.js.map +1 -0
  26. package/esm/cli.d.ts.map +1 -1
  27. package/esm/cli.js +2 -11
  28. package/esm/cli.js.map +1 -1
  29. package/esm/css.d.ts.map +1 -1
  30. package/esm/css.js +3 -2
  31. package/esm/css.js.map +1 -1
  32. package/esm/exporter.d.ts.map +1 -1
  33. package/esm/exporter.js +55 -28
  34. package/esm/exporter.js.map +1 -1
  35. package/esm/framer.d.ts.map +1 -1
  36. package/esm/framer.js +57 -1850
  37. package/esm/framer.js.map +1 -1
  38. package/esm/renamer.d.ts +12 -0
  39. package/esm/renamer.d.ts.map +1 -0
  40. package/esm/renamer.js +140 -0
  41. package/esm/renamer.js.map +1 -0
  42. package/package.json +5 -4
  43. package/src/babel-plugin-imports.ts +441 -0
  44. package/src/cli.tsx +2 -12
  45. package/src/css.ts +3 -2
  46. package/src/exporter.ts +64 -29
  47. package/src/framer.js +61 -1896
  48. package/src/renamer.ts +184 -0
package/esm/framer.js CHANGED
@@ -5441,9 +5441,9 @@ function velocityPerSecond(velocity, frameDuration) {
5441
5441
  return frameDuration ? velocity * (1e3 / frameDuration) : 0;
5442
5442
  }
5443
5443
  var velocitySampleDuration = 5;
5444
- function calcGeneratorVelocity(resolveValue2, t, current) {
5444
+ function calcGeneratorVelocity(resolveValue, t, current) {
5445
5445
  const prevT = Math.max(t - velocitySampleDuration, 0);
5446
- return velocityPerSecond(current - resolveValue2(prevT), t - prevT);
5446
+ return velocityPerSecond(current - resolveValue(prevT), t - prevT);
5447
5447
  }
5448
5448
  var durationKeys = ['duration', 'bounce',];
5449
5449
  var physicsKeys = ['stiffness', 'damping', 'mass',];
@@ -14325,7 +14325,7 @@ function steps(numSteps, direction = 'end') {
14325
14325
  return clamp(0, 1, rounded / numSteps);
14326
14326
  };
14327
14327
  }
14328
- // https :https://app.framerstatic.com/framer.7SGKTLCE.mjs
14328
+ // https :https://app.framerstatic.com/framer.ZONHQAMM.mjs
14329
14329
  init_chunk_QLPHEVXG();
14330
14330
  import React4 from 'react';
14331
14331
  import { startTransition as startTransition2, } from 'react';
@@ -15801,41 +15801,6 @@ var require_hoist_non_react_statics_cjs = __commonJS({
15801
15801
  module.exports = hoistNonReactStatics;
15802
15802
  },
15803
15803
  });
15804
- var require_archy = __commonJS({
15805
- '../../../node_modules/archy/index.js'(exports, module) {
15806
- module.exports = function archy2(obj, prefix2, opts) {
15807
- if (prefix2 === void 0)
15808
- prefix2 = '';
15809
- if (!opts)
15810
- opts = {};
15811
- var chr = function (s) {
15812
- var chars = {
15813
- '\u2502': '|',
15814
- '\u2514': '`',
15815
- '\u251C': '+',
15816
- '\u2500': '-',
15817
- '\u252C': '-',
15818
- };
15819
- return opts.unicode === false ? chars[s] : s;
15820
- };
15821
- if (typeof obj === 'string') {
15822
- obj = {
15823
- label: obj,
15824
- };
15825
- }
15826
- var nodes = obj.nodes || [];
15827
- var lines = (obj.label || '').split('\n');
15828
- var splitter = '\n' + prefix2 + (nodes.length ? chr('\u2502') : ' ') + ' ';
15829
- return prefix2 + lines.join(splitter) + '\n' + nodes.map(function (node, ix) {
15830
- var last = ix === nodes.length - 1;
15831
- var more = node.nodes && node.nodes.length;
15832
- var prefix_ = prefix2 + (last ? ' ' : chr('\u2502')) + ' ';
15833
- return prefix2 + (last ? chr('\u2514') : chr('\u251C')) + chr('\u2500') + (more ? chr('\u252C') : chr('\u2500')) + ' ' +
15834
- archy2(node, prefix_, opts).slice(prefix2.length + 2);
15835
- }).join('');
15836
- };
15837
- },
15838
- });
15839
15804
  var require_fontfaceobserver_standalone = __commonJS({
15840
15805
  '../../../node_modules/fontfaceobserver/fontfaceobserver.standalone.js'(exports, module) {
15841
15806
  (function () {
@@ -17165,6 +17130,7 @@ function useMarkRouterEffects() {
17165
17130
  var hydrationInsertionEffectStartHasRun = false;
17166
17131
  var hydrationLayoutEffectStartHasRun = false;
17167
17132
  var hydrationEffectStartHasRun = false;
17133
+ var wasInBackground = false;
17168
17134
  function useMarkSuspenseEffectsStart() {
17169
17135
  const hydrationMarkPrefix = 'framer-hydration-';
17170
17136
  const hydrationLayoutEffectsEnd = `${hydrationMarkPrefix}layout-effects-end`;
@@ -17184,6 +17150,10 @@ function useMarkSuspenseEffectsStart() {
17184
17150
  return;
17185
17151
  hydrationLayoutEffectStartHasRun = true;
17186
17152
  performance.mark(`${hydrationMarkPrefix}layout-effects-start`);
17153
+ if (document.visibilityState !== 'visible') {
17154
+ wasInBackground = true;
17155
+ return;
17156
+ }
17187
17157
  requestAnimationFrame(() => {
17188
17158
  var _a, _b, _c;
17189
17159
  performance.mark(hydrationBrowserRenderStart);
@@ -17215,7 +17185,6 @@ function useMarkSuspenseEffectsStart() {
17215
17185
  var hydrationInsertionEffectHasRun = false;
17216
17186
  var hydrationLayoutEffectHasRun = false;
17217
17187
  var hydrationEffectHasRun = false;
17218
- var hydrationPaintEffectHasRun = false;
17219
17188
  function useMarkSuspenseEffectEnd() {
17220
17189
  const hydrationMarkPrefix = 'framer-hydration-';
17221
17190
  const hydrationLayoutEffectsEnd = `${hydrationMarkPrefix}layout-effects-end`;
@@ -17238,9 +17207,16 @@ function useMarkSuspenseEffectEnd() {
17238
17207
  hydrationLayoutEffectHasRun = true;
17239
17208
  performance.mark(hydrationLayoutEffectsEnd);
17240
17209
  measureSafe(`${hydrationMarkPrefix}layout-effects`, `${hydrationMarkPrefix}layout-effects-start`, hydrationLayoutEffectsEnd);
17210
+ if (wasInBackground || document.visibilityState !== 'visible')
17211
+ return;
17241
17212
  requestAnimationFrame(() => {
17242
17213
  performance.mark(hydrationAnimationFrameEnd);
17243
17214
  measureSafe(`${hydrationMarkPrefix}raf`, hydrationBrowserRenderStart, hydrationAnimationFrameEnd);
17215
+ void yieldBefore(() => {
17216
+ performance.mark(hydrationFP);
17217
+ measureSafe(`${hydrationMarkPrefix}time-to-first-paint`, hydrationStart, hydrationFP);
17218
+ measureSafe(`${hydrationMarkPrefix}browser-render`, hydrationAnimationFrameEnd, hydrationFP);
17219
+ });
17244
17220
  });
17245
17221
  }, []);
17246
17222
  useEffect(() => {
@@ -17255,20 +17231,6 @@ function useMarkSuspenseEffectEnd() {
17255
17231
  ? void 0
17256
17232
  : _c.name, hydrationEffectsEnd);
17257
17233
  }, []);
17258
- useAfterPaintEffect(() => {
17259
- if (hydrationPaintEffectHasRun || !shouldMark)
17260
- return;
17261
- hydrationPaintEffectHasRun = true;
17262
- performance.mark(hydrationFP);
17263
- measureSafe(`${hydrationMarkPrefix}time-to-first-paint`, hydrationStart, hydrationFP);
17264
- queueMicrotask(() => {
17265
- measureSafe(`${hydrationMarkPrefix}browser-render`, hydrationAnimationFrameEnd, hydrationFP);
17266
- });
17267
- }, [],
17268
- // user-blocking ensures we get the correct timings here. Other priorites might delay this effect a little bit.
17269
- {
17270
- priority: 'user-blocking',
17271
- });
17272
17234
  return null;
17273
17235
  }
17274
17236
  function MarkSuspenseEffectsStart() {
@@ -22302,7 +22264,9 @@ function getConstraintValue(constraint, value, parentSize, viewport) {
22302
22264
  break;
22303
22265
  }
22304
22266
  }
22305
- if (value.endsWith('vh') && viewport) {
22267
+ if (value.endsWith('vh')) {
22268
+ if (!viewport)
22269
+ return constraintValueForUncalculatedViewport(constraint);
22306
22270
  switch (constraint) {
22307
22271
  case 'maxWidth':
22308
22272
  case 'minWidth':
@@ -22318,6 +22282,18 @@ function getConstraintValue(constraint, value, parentSize, viewport) {
22318
22282
  }
22319
22283
  return value;
22320
22284
  }
22285
+ function constraintValueForUncalculatedViewport(constraint) {
22286
+ switch (constraint) {
22287
+ case 'minWidth':
22288
+ case 'minHeight':
22289
+ return Number.NEGATIVE_INFINITY;
22290
+ case 'maxWidth':
22291
+ case 'maxHeight':
22292
+ return Number.POSITIVE_INFINITY;
22293
+ default:
22294
+ assertNever(constraint, 'unknown constraint key');
22295
+ }
22296
+ }
22321
22297
  function constrainHeight(height, values, parentSize, viewport) {
22322
22298
  if (values.minHeight) {
22323
22299
  height = Math.max(getConstraintValue('minHeight', values.minHeight, parentSize, viewport), height);
@@ -22363,16 +22339,6 @@ function pinnedOffset(start, end) {
22363
22339
  return null;
22364
22340
  return start + end;
22365
22341
  }
22366
- function getMergedConstraintsProps(props, constraints) {
22367
- const result = {};
22368
- if (props.constraints) {
22369
- result.constraints = Object.assign(Object.assign({}, props.constraints), constraints);
22370
- }
22371
- else {
22372
- Object.assign(result, constraints);
22373
- }
22374
- return result;
22375
- }
22376
22342
  function containsInvalidStringValues(props) {
22377
22343
  if (typeof props.right === 'string')
22378
22344
  return true;
@@ -22735,8 +22701,8 @@ var richTextLinkHoverStylesRule = `
22735
22701
  }
22736
22702
  `;
22737
22703
  var richTextLinkCurrentStylesRule = `
22738
- a[data-framer-page-link-current],
22739
- a[data-framer-page-link-current] span:not([data-text-fill]):not([data-nested-link]) {
22704
+ [data-framer-component-type="DeprecatedRichText"] a[data-framer-page-link-current],
22705
+ [data-framer-component-type="DeprecatedRichText"] a[data-framer-page-link-current] span:not([data-text-fill]):not([data-nested-link]) {
22740
22706
  font-family: var(--framer-link-current-font-family, var(--framer-link-font-family, var(--framer-font-family, Inter, Inter Placeholder, sans-serif)));
22741
22707
  font-style: var(--framer-link-current-font-style, var(--framer-link-font-style, var(--framer-font-style, normal)));
22742
22708
  font-weight: var(--framer-link-current-font-weight, var(--framer-link-font-weight, var(--framer-font-weight, 400)));
@@ -22747,8 +22713,8 @@ a[data-framer-page-link-current] span:not([data-text-fill]):not([data-nested-lin
22747
22713
  }
22748
22714
  `;
22749
22715
  var richTextLinkCurrentHoverStylesRule = `
22750
- a[data-framer-page-link-current]:hover,
22751
- a[data-framer-page-link-current]:hover span:not([data-text-fill]):not([data-nested-link]) {
22716
+ [data-framer-component-type="DeprecatedRichText"] a[data-framer-page-link-current]:hover,
22717
+ [data-framer-component-type="DeprecatedRichText"] a[data-framer-page-link-current]:hover span:not([data-text-fill]):not([data-nested-link]) {
22752
22718
  font-family: var(--framer-link-hover-font-family, var(--framer-link-current-font-family, var(--framer-link-font-family, var(--framer-font-family, Inter, Inter Placeholder, sans-serif))));
22753
22719
  font-style: var(--framer-link-hover-font-style, var(--framer-link-current-font-style, var(--framer-link-font-style, var(--framer-font-style, normal))));
22754
22720
  font-weight: var(--framer-link-hover-font-weight, var(--framer-link-current-font-weight, var(--framer-link-font-weight, var(--framer-font-weight, 400))));
@@ -35334,20 +35300,17 @@ var NestedLinksCollector = class {
35334
35300
  this.links.clear();
35335
35301
  }
35336
35302
  getLinks() {
35337
- return [...this.links.values(),];
35303
+ return this.links;
35338
35304
  }
35339
- addLink(parentLink, linkData) {
35340
- if (typeof window !== 'undefined' && true || !parentLink || !linkData) {
35305
+ addLink(parentLinkNodeId, linkNodeId) {
35306
+ if (typeof window !== 'undefined' && true || !parentLinkNodeId || !linkNodeId) {
35341
35307
  return;
35342
35308
  }
35343
- if (!this.links.has(parentLink.nodeId)) {
35344
- this.links.set(parentLink.nodeId, {
35345
- parent: parentLink,
35346
- links: [],
35347
- });
35309
+ if (!this.links.has(parentLinkNodeId)) {
35310
+ this.links.set(parentLinkNodeId, /* @__PURE__ */ new Set());
35348
35311
  }
35349
- const entry = this.links.get(parentLink.nodeId);
35350
- entry.links.push(linkData);
35312
+ const entry = this.links.get(parentLinkNodeId);
35313
+ entry.add(linkNodeId);
35351
35314
  }
35352
35315
  };
35353
35316
  var nestedLinksCollector = /* @__PURE__ */ new NestedLinksCollector();
@@ -35838,13 +35801,11 @@ var Link = /* @__PURE__ */ withChildrenCanSuspend(/* @__PURE__ */ forwardRef((_j
35838
35801
  return;
35839
35802
  return observerCallback(node);
35840
35803
  }, [observerCallback,]);
35841
- const el = useMemo(() => {
35842
- const { navigate: _ } = props, linkProps = __rest(props, ["navigate"]);
35843
- return clone.cloneAsArray(children, Object.assign(Object.assign(Object.assign({}, restProps), linkProps), { ref: observerRef }));
35844
- }, [props, clone, children, restProps, observerRef,]);
35804
+ const { navigate: _ } = props, linkProps = __rest(props, ["navigate"]);
35805
+ const el = clone.cloneAsArray(children, Object.assign(Object.assign(Object.assign({}, restProps), linkProps), { ref: observerRef }));
35845
35806
  return getChildren(el);
35846
35807
  }));
35847
- var ParentLinkContext = /* @__PURE__ */ createContext(null);
35808
+ var ParentLinkContext = /* @__PURE__ */ createContext(void 0);
35848
35809
  function useReplaceNestedLinks(nodeId, href, propsAddedByLink) {
35849
35810
  const parentLink = useContext(ParentLinkContext);
35850
35811
  const isOnFramerCanvas = useIsOnFramerCanvas();
@@ -35857,32 +35818,6 @@ function useReplaceNestedLinks(nodeId, href, propsAddedByLink) {
35857
35818
  return;
35858
35819
  return getRouteFromPageLink(pageLink, router, currentRoute);
35859
35820
  }, [currentRoute, href, router,]);
35860
- const linkData = useMemo(() => {
35861
- var _j;
35862
- if (!nodeId || !href)
35863
- return null;
35864
- if (isLinkToWebPage(href)) {
35865
- return {
35866
- nodeId,
35867
- targetNodeId: href.webPageId,
35868
- href: propsAddedByLink.href,
35869
- };
35870
- }
35871
- if (route && href.startsWith('#')) {
35872
- const routeNodeId = Object.keys((_j = route.elements) !== null && _j !== void 0 ? _j : {})[0];
35873
- if (routeNodeId) {
35874
- return {
35875
- nodeId,
35876
- targetNodeId: routeNodeId,
35877
- href,
35878
- };
35879
- }
35880
- }
35881
- return {
35882
- nodeId,
35883
- href,
35884
- };
35885
- }, [href, nodeId, propsAddedByLink, route,]);
35886
35821
  const isValidLink = Object.keys(propsAddedByLink).length > 0;
35887
35822
  const shouldReplaceLink = Boolean(replaceNestedLinks && !isOnFramerCanvas && (parentLink || !isValidLink));
35888
35823
  const onClick = useCallback((event) => {
@@ -35938,7 +35873,7 @@ function useReplaceNestedLinks(nodeId, href, propsAddedByLink) {
35938
35873
  const replacedChildren = !shouldReplaceLink ? children : Children.map(children, (child) => {
35939
35874
  if (!isChildReplaceable(child))
35940
35875
  return child;
35941
- nestedLinksCollector.addLink(parentLink, linkData);
35876
+ nestedLinksCollector.addLink(parentLink, nodeId);
35942
35877
  const tag = maybeReplaceAnchorWithSpan(child.type);
35943
35878
  const _j = child.props, { children: childChildren } = _j, childProps = __rest(_j, ["children"]);
35944
35879
  const props = isValidLink
@@ -35947,10 +35882,10 @@ function useReplaceNestedLinks(nodeId, href, propsAddedByLink) {
35947
35882
  return createElement(tag, Object.assign(Object.assign({}, props), { ref }), childChildren);
35948
35883
  });
35949
35884
  return /* @__PURE__ */ jsx(ParentLinkContext.Provider, {
35950
- value: linkData,
35885
+ value: nodeId,
35951
35886
  children: replacedChildren,
35952
35887
  });
35953
- }, [isValidLink, linkData, onAuxClick, onClick, onKeyDown, shouldReplaceLink, parentLink,]);
35888
+ }, [isValidLink, nodeId, onAuxClick, onClick, onKeyDown, shouldReplaceLink, parentLink,]);
35954
35889
  const refCallback = useCallback((node) => {
35955
35890
  if (isOnFramerCanvas || !shouldReplaceLink || !isValidLink)
35956
35891
  return;
@@ -37042,7 +36977,6 @@ var Fetcher = /* @__PURE__ */ React2.forwardRef(function Fetcher2(_j, ref) {
37042
36977
  return cloneWithPropsAndRef(childrenWithValues, rest);
37043
36978
  });
37044
36979
  var callEach = (...fns) => fns.forEach((fn) => fn && fn());
37045
- var import_archy = __toESM(require_archy(), 1);
37046
36980
  function getLogger(name) {
37047
36981
  return {
37048
36982
  trace(...args) {
@@ -37241,11 +37175,6 @@ function castDate(value) {
37241
37175
  }
37242
37176
  return null;
37243
37177
  }
37244
- function toDate(value) {
37245
- var _j;
37246
- const cast = castDate(value);
37247
- return (_j = (cast == null ? void 0 : cast.value)) !== null && _j !== void 0 ? _j : null;
37248
- }
37249
37178
  function castEnum(value) {
37250
37179
  switch (value == null ? void 0 : value.type) {
37251
37180
  case 'enum': {
@@ -37740,1431 +37669,6 @@ function compare(left, right, collation10) {
37740
37669
  }
37741
37670
  }
37742
37671
  }
37743
- var INDEX_IDENTIFIER = 'index';
37744
- var ScalarExpression = class {
37745
- static from(expression, schema) {
37746
- return convertExpression(expression, schema, void 0);
37747
- }
37748
- };
37749
- var ScalarIdentifier = class extends ScalarExpression {
37750
- constructor(schema, name, collection) {
37751
- var _j;
37752
- super();
37753
- this.schema = schema;
37754
- this.name = name;
37755
- this.collection = collection;
37756
- __publicField(this, 'definition');
37757
- if (name === INDEX_IDENTIFIER) {
37758
- this.definition = {
37759
- type: 'number',
37760
- isNullable: false,
37761
- };
37762
- }
37763
- else {
37764
- this.definition = (_j = schema[name]) !== null && _j !== void 0 ? _j : null;
37765
- }
37766
- }
37767
- stringify() {
37768
- return this.name;
37769
- }
37770
- equals(other) {
37771
- return other instanceof ScalarIdentifier && isEqual(this.definition, other.definition) && isEqual(other.name, this.name) &&
37772
- isEqual(other.collection, this.collection);
37773
- }
37774
- evaluate(item) {
37775
- var _j, _k, _l;
37776
- const name = this.name;
37777
- if (isUndefined(item) || name === INDEX_IDENTIFIER) {
37778
- throw new Error(`Can't evaluate identifier: ${name}`);
37779
- }
37780
- if (this.collection) {
37781
- const scopedName = `${this.collection}_${name}`;
37782
- return (_k = (_j = item.data[scopedName]) !== null && _j !== void 0 ? _j : item.data[name]) !== null && _k !== void 0 ? _k : null;
37783
- }
37784
- return (_l = item.data[name]) !== null && _l !== void 0 ? _l : null;
37785
- }
37786
- canEvaluate() {
37787
- return false;
37788
- }
37789
- };
37790
- var ScalarLiteralValue = class extends ScalarExpression {
37791
- constructor(definition, value) {
37792
- super();
37793
- this.definition = definition;
37794
- this.value = value;
37795
- }
37796
- stringify() {
37797
- return DatabaseValue.stringify(this.value);
37798
- }
37799
- static fromNull() {
37800
- return new ScalarLiteralValue(null, null);
37801
- }
37802
- static fromBoolean(value) {
37803
- return new ScalarLiteralValue({
37804
- type: 'boolean',
37805
- isNullable: isNull(value),
37806
- }, isNull(value) ? null : {
37807
- type: 'boolean',
37808
- value,
37809
- });
37810
- }
37811
- static fromDate(value) {
37812
- return new ScalarLiteralValue({
37813
- type: 'date',
37814
- isNullable: isNull(value),
37815
- }, isNull(value) ? null : {
37816
- type: 'date',
37817
- value,
37818
- });
37819
- }
37820
- static fromEnum(value) {
37821
- return new ScalarLiteralValue({
37822
- type: 'enum',
37823
- isNullable: isNull(value),
37824
- }, isNull(value) ? null : {
37825
- type: 'enum',
37826
- value,
37827
- });
37828
- }
37829
- static fromNumber(value) {
37830
- return new ScalarLiteralValue({
37831
- type: 'number',
37832
- isNullable: isNull(value),
37833
- }, isNull(value) ? null : {
37834
- type: 'number',
37835
- value,
37836
- });
37837
- }
37838
- static fromString(value) {
37839
- return new ScalarLiteralValue({
37840
- type: 'string',
37841
- isNullable: isNull(value),
37842
- }, isNull(value) ? null : {
37843
- type: 'string',
37844
- value,
37845
- });
37846
- }
37847
- equals(other) {
37848
- return other instanceof ScalarLiteralValue && isEqual(this.definition, other.definition) && isEqual(other.value, this.value);
37849
- }
37850
- evaluate() {
37851
- return this.value;
37852
- }
37853
- canEvaluate() {
37854
- return true;
37855
- }
37856
- };
37857
- var ScalarFunctionCall = class extends ScalarExpression {
37858
- constructor(argumentExpressions) {
37859
- super();
37860
- this.argumentExpressions = argumentExpressions;
37861
- __publicField(this, 'collation', {
37862
- type: 0,
37863
- /* CaseInsensitive */
37864
- });
37865
- }
37866
- getArgumentExpression(index) {
37867
- const argument = this.argumentExpressions[index];
37868
- if (isUndefined(argument)) {
37869
- throw new Error('Missing argument in function call');
37870
- }
37871
- return argument;
37872
- }
37873
- equals(other) {
37874
- return other instanceof ScalarFunctionCall && isEqual(this.constructor, other.constructor) &&
37875
- isEqual(this.argumentExpressions, other.argumentExpressions);
37876
- }
37877
- canEvaluate() {
37878
- return this.argumentExpressions.every((expression) => {
37879
- return expression.canEvaluate();
37880
- });
37881
- }
37882
- };
37883
- var ScalarFunctionCallContains = class extends ScalarFunctionCall {
37884
- constructor() {
37885
- super(...arguments);
37886
- __publicField(this, 'definition', ScalarFunctionCallContains.getDefinition());
37887
- __publicField(this, 'sourceExpression', this.getArgumentExpression(0));
37888
- __publicField(this, 'targetExpression', this.getArgumentExpression(1));
37889
- }
37890
- static getDefinition() {
37891
- return {
37892
- type: 'boolean',
37893
- isNullable: false,
37894
- };
37895
- }
37896
- stringify() {
37897
- return `CONTAINS(${this.sourceExpression.stringify()}, ${this.targetExpression.stringify()})`;
37898
- }
37899
- getValue(source, target) {
37900
- if (isNull(source) || source.type !== 'string')
37901
- return false;
37902
- if (isNull(target) || target.type !== 'string')
37903
- return false;
37904
- let sourceValue = source.value;
37905
- let targetValue = target.value;
37906
- if (this.collation.type === 0) {
37907
- sourceValue = sourceValue.toLowerCase();
37908
- targetValue = targetValue.toLowerCase();
37909
- }
37910
- return sourceValue.includes(targetValue);
37911
- }
37912
- evaluate(item) {
37913
- const source = this.sourceExpression.evaluate(item);
37914
- const target = this.targetExpression.evaluate(item);
37915
- return {
37916
- type: 'boolean',
37917
- value: this.getValue(source, target),
37918
- };
37919
- }
37920
- };
37921
- var ScalarFunctionCallStartsWith = class extends ScalarFunctionCall {
37922
- constructor() {
37923
- super(...arguments);
37924
- __publicField(this, 'definition', ScalarFunctionCallStartsWith.getDefinition());
37925
- __publicField(this, 'sourceExpression', this.getArgumentExpression(0));
37926
- __publicField(this, 'targetExpression', this.getArgumentExpression(1));
37927
- }
37928
- static getDefinition() {
37929
- return {
37930
- type: 'boolean',
37931
- isNullable: false,
37932
- };
37933
- }
37934
- stringify() {
37935
- return `STARTS_WITH(${this.sourceExpression.stringify()}, ${this.targetExpression.stringify()})`;
37936
- }
37937
- getValue(source, target) {
37938
- if (isNull(source) || source.type !== 'string')
37939
- return false;
37940
- if (isNull(target) || target.type !== 'string')
37941
- return false;
37942
- let sourceValue = source.value;
37943
- let targetValue = target.value;
37944
- if (this.collation.type === 0) {
37945
- sourceValue = sourceValue.toLowerCase();
37946
- targetValue = targetValue.toLowerCase();
37947
- }
37948
- return sourceValue.startsWith(targetValue);
37949
- }
37950
- evaluate(item) {
37951
- const source = this.sourceExpression.evaluate(item);
37952
- const target = this.targetExpression.evaluate(item);
37953
- return {
37954
- type: 'boolean',
37955
- value: this.getValue(source, target),
37956
- };
37957
- }
37958
- };
37959
- var ScalarFunctionCallEndsWith = class extends ScalarFunctionCall {
37960
- constructor() {
37961
- super(...arguments);
37962
- __publicField(this, 'definition', ScalarFunctionCallEndsWith.getDefinition());
37963
- __publicField(this, 'sourceExpression', this.getArgumentExpression(0));
37964
- __publicField(this, 'targetExpression', this.getArgumentExpression(1));
37965
- }
37966
- static getDefinition() {
37967
- return {
37968
- type: 'boolean',
37969
- isNullable: false,
37970
- };
37971
- }
37972
- stringify() {
37973
- return `ENDS_WITH(${this.sourceExpression.stringify()}, ${this.targetExpression.stringify()})`;
37974
- }
37975
- getValue(source, target) {
37976
- if (isNull(source) || source.type !== 'string')
37977
- return false;
37978
- if (isNull(target) || target.type !== 'string')
37979
- return false;
37980
- let sourceValue = source.value;
37981
- let targetValue = target.value;
37982
- if (this.collation.type === 0) {
37983
- sourceValue = sourceValue.toLowerCase();
37984
- targetValue = targetValue.toLowerCase();
37985
- }
37986
- return sourceValue.endsWith(targetValue);
37987
- }
37988
- evaluate(item) {
37989
- const source = this.sourceExpression.evaluate(item);
37990
- const target = this.targetExpression.evaluate(item);
37991
- return {
37992
- type: 'boolean',
37993
- value: this.getValue(source, target),
37994
- };
37995
- }
37996
- };
37997
- var ScalarCase = class extends ScalarExpression {
37998
- constructor(valueExpression, conditions, elseExpression) {
37999
- super();
38000
- this.valueExpression = valueExpression;
38001
- this.conditions = conditions;
38002
- this.elseExpression = elseExpression;
38003
- __publicField(this, 'definition');
38004
- __publicField(this, 'collation', {
38005
- type: 0,
38006
- /* CaseInsensitive */
38007
- });
38008
- const definitions = [];
38009
- for (const { thenExpression, } of conditions) {
38010
- definitions.push(thenExpression.definition);
38011
- }
38012
- if (elseExpression) {
38013
- definitions.push(elseExpression.definition);
38014
- }
38015
- this.definition = ScalarCase.getDefinition(definitions);
38016
- }
38017
- static getDefinition(definitions) {
38018
- var _j;
38019
- let result = null;
38020
- let isNullable = false;
38021
- for (const definition of definitions) {
38022
- result !== null && result !== void 0 ? result : (result = definition);
38023
- if (result && definition && result.type !== definition.type) {
38024
- throw new Error('Incompatible types in CASE expression');
38025
- }
38026
- isNullable || (isNullable = (_j = (definition == null ? void 0 : definition.isNullable)) !== null && _j !== void 0 ? _j : true);
38027
- }
38028
- return result
38029
- ? Object.assign(Object.assign({}, result), { isNullable }) : null;
38030
- }
38031
- stringify() {
38032
- let result = 'CASE';
38033
- if (this.valueExpression) {
38034
- result += ` ${this.valueExpression.stringify()}`;
38035
- }
38036
- for (const { whenExpression, thenExpression, } of this.conditions) {
38037
- result += ` WHEN ${whenExpression.stringify()} THEN ${thenExpression.stringify()}`;
38038
- }
38039
- if (this.elseExpression) {
38040
- result += ` ELSE ${this.elseExpression.stringify()}`;
38041
- }
38042
- result += ' END';
38043
- return result;
38044
- }
38045
- equals(other) {
38046
- return other instanceof ScalarCase && isEqual(this.valueExpression, other.valueExpression) &&
38047
- isEqual(this.conditions, other.conditions) && isEqual(this.elseExpression, other.elseExpression);
38048
- }
38049
- evaluate(item) {
38050
- var _j, _k;
38051
- var _a, _b;
38052
- const value = (_j = ((_a = this.valueExpression) == null ? void 0 : _a.evaluate(item))) !== null && _j !== void 0 ? _j : null;
38053
- for (const { whenExpression, thenExpression, } of this.conditions) {
38054
- const when = whenExpression.evaluate(item);
38055
- const isMatching = this.valueExpression ? DatabaseValue.equal(when, value, this.collation) : toBoolean(when);
38056
- if (isMatching)
38057
- return thenExpression.evaluate(item);
38058
- }
38059
- return (_k = ((_b = this.elseExpression) == null ? void 0 : _b.evaluate(item))) !== null && _k !== void 0 ? _k : null;
38060
- }
38061
- canEvaluate() {
38062
- const expressions = [];
38063
- if (this.valueExpression) {
38064
- expressions.push(this.valueExpression);
38065
- }
38066
- for (const condition of this.conditions) {
38067
- expressions.push(condition.whenExpression);
38068
- expressions.push(condition.thenExpression);
38069
- }
38070
- if (this.elseExpression) {
38071
- expressions.push(this.elseExpression);
38072
- }
38073
- return expressions.every((expression) => {
38074
- return expression.canEvaluate();
38075
- });
38076
- }
38077
- };
38078
- var ScalarCaseCondition = class {
38079
- constructor(whenExpression, thenExpression) {
38080
- this.whenExpression = whenExpression;
38081
- this.thenExpression = thenExpression;
38082
- }
38083
- };
38084
- var ScalarUnaryOperation = class extends ScalarExpression {
38085
- constructor(valueExpression) {
38086
- super();
38087
- this.valueExpression = valueExpression;
38088
- }
38089
- equals(other) {
38090
- return other instanceof ScalarUnaryOperation && isEqual(this.constructor, other.constructor) &&
38091
- isEqual(this.valueExpression, other.valueExpression);
38092
- }
38093
- canEvaluate() {
38094
- return this.valueExpression.canEvaluate();
38095
- }
38096
- };
38097
- var ScalarUnaryOperationNot = class extends ScalarUnaryOperation {
38098
- constructor() {
38099
- super(...arguments);
38100
- __publicField(this, 'definition', ScalarUnaryOperationNot.getDefinition());
38101
- }
38102
- static getDefinition() {
38103
- return {
38104
- type: 'boolean',
38105
- isNullable: false,
38106
- };
38107
- }
38108
- stringify() {
38109
- return `NOT ${this.valueExpression.stringify()}`;
38110
- }
38111
- evaluate(item) {
38112
- const value = this.valueExpression.evaluate(item);
38113
- return {
38114
- type: 'boolean',
38115
- value: !toBoolean(value),
38116
- };
38117
- }
38118
- };
38119
- var ScalarLogicalOperation = class extends ScalarExpression {
38120
- constructor(operandExpressions) {
38121
- super();
38122
- this.operandExpressions = operandExpressions;
38123
- __publicField(this, 'definition', ScalarLogicalOperation.getDefinition());
38124
- }
38125
- static getDefinition() {
38126
- return {
38127
- type: 'boolean',
38128
- isNullable: false,
38129
- };
38130
- }
38131
- stringify() {
38132
- return this.operandExpressions.map((expression) => expression.stringify()).join(' AND ');
38133
- }
38134
- equals(other) {
38135
- return other instanceof ScalarLogicalOperation && isEqual(this.constructor, other.constructor) &&
38136
- isEqual(this.operandExpressions, other.operandExpressions);
38137
- }
38138
- canEvaluate() {
38139
- return this.operandExpressions.every((expression) => {
38140
- return expression.canEvaluate();
38141
- });
38142
- }
38143
- };
38144
- var ScalarLogicalOperationAnd = class extends ScalarLogicalOperation {
38145
- constructor() {
38146
- super(...arguments);
38147
- __publicField(this, 'operator', 'AND');
38148
- }
38149
- evaluate(item) {
38150
- const result = this.operandExpressions.every((expression) => {
38151
- const value = expression.evaluate(item);
38152
- return toBoolean(value);
38153
- });
38154
- return {
38155
- type: 'boolean',
38156
- value: result,
38157
- };
38158
- }
38159
- };
38160
- var ScalarLogicalOperationOr = class extends ScalarLogicalOperation {
38161
- constructor() {
38162
- super(...arguments);
38163
- __publicField(this, 'operator', 'OR');
38164
- }
38165
- evaluate(item) {
38166
- const result = this.operandExpressions.some((expression) => {
38167
- const value = expression.evaluate(item);
38168
- return toBoolean(value);
38169
- });
38170
- return {
38171
- type: 'boolean',
38172
- value: result,
38173
- };
38174
- }
38175
- };
38176
- var ScalarComparison = class extends ScalarExpression {
38177
- constructor(leftExpression, rightExpression) {
38178
- super();
38179
- this.leftExpression = leftExpression;
38180
- this.rightExpression = rightExpression;
38181
- __publicField(this, 'definition', ScalarComparison.getDefinition());
38182
- __publicField(this, 'collation', {
38183
- type: 0,
38184
- /* CaseInsensitive */
38185
- });
38186
- }
38187
- static getDefinition() {
38188
- return {
38189
- type: 'boolean',
38190
- isNullable: false,
38191
- };
38192
- }
38193
- stringify() {
38194
- return `${this.leftExpression.stringify()} ${this.operator} ${this.rightExpression.stringify()}`;
38195
- }
38196
- equals(other) {
38197
- return other instanceof ScalarComparison && isEqual(this.constructor, other.constructor) &&
38198
- isEqual(this.leftExpression, other.leftExpression) && isEqual(this.rightExpression, other.rightExpression);
38199
- }
38200
- canEvaluate() {
38201
- return this.leftExpression.canEvaluate() && this.rightExpression.canEvaluate();
38202
- }
38203
- };
38204
- var ScalarComparisonEquals = class extends ScalarComparison {
38205
- constructor() {
38206
- super(...arguments);
38207
- __publicField(this, 'operator', '=');
38208
- }
38209
- evaluate(item) {
38210
- const leftValue = this.leftExpression.evaluate(item);
38211
- const rightValue = this.rightExpression.evaluate(item);
38212
- return {
38213
- type: 'boolean',
38214
- value: DatabaseValue.equal(leftValue, rightValue, this.collation),
38215
- };
38216
- }
38217
- };
38218
- var ScalarComparisonNotEquals = class extends ScalarComparison {
38219
- constructor() {
38220
- super(...arguments);
38221
- __publicField(this, 'operator', '!=');
38222
- }
38223
- evaluate(item) {
38224
- const leftValue = this.leftExpression.evaluate(item);
38225
- const rightValue = this.rightExpression.evaluate(item);
38226
- return {
38227
- type: 'boolean',
38228
- value: !DatabaseValue.equal(leftValue, rightValue, this.collation),
38229
- };
38230
- }
38231
- };
38232
- var ScalarComparisonLessThan = class extends ScalarComparison {
38233
- constructor() {
38234
- super(...arguments);
38235
- __publicField(this, 'operator', '<');
38236
- }
38237
- evaluate(item) {
38238
- const leftValue = this.leftExpression.evaluate(item);
38239
- const rightValue = this.rightExpression.evaluate(item);
38240
- return {
38241
- type: 'boolean',
38242
- value: DatabaseValue.lessThan(leftValue, rightValue, this.collation),
38243
- };
38244
- }
38245
- };
38246
- var ScalarComparisonLessThanOrEqual = class extends ScalarComparison {
38247
- constructor() {
38248
- super(...arguments);
38249
- __publicField(this, 'operator', '<=');
38250
- }
38251
- evaluate(item) {
38252
- const leftValue = this.leftExpression.evaluate(item);
38253
- const rightValue = this.rightExpression.evaluate(item);
38254
- return {
38255
- type: 'boolean',
38256
- value: DatabaseValue.lessThanOrEqual(leftValue, rightValue, this.collation),
38257
- };
38258
- }
38259
- };
38260
- var ScalarComparisonGreaterThan = class extends ScalarComparison {
38261
- constructor() {
38262
- super(...arguments);
38263
- __publicField(this, 'operator', '>');
38264
- }
38265
- evaluate(item) {
38266
- const leftValue = this.leftExpression.evaluate(item);
38267
- const rightValue = this.rightExpression.evaluate(item);
38268
- return {
38269
- type: 'boolean',
38270
- value: DatabaseValue.greaterThan(leftValue, rightValue, this.collation),
38271
- };
38272
- }
38273
- };
38274
- var ScalarComparisonGreaterThanOrEqual = class extends ScalarComparison {
38275
- constructor() {
38276
- super(...arguments);
38277
- __publicField(this, 'operator', '>=');
38278
- }
38279
- evaluate(item) {
38280
- const leftValue = this.leftExpression.evaluate(item);
38281
- const rightValue = this.rightExpression.evaluate(item);
38282
- return {
38283
- type: 'boolean',
38284
- value: DatabaseValue.greaterThanOrEqual(leftValue, rightValue, this.collation),
38285
- };
38286
- }
38287
- };
38288
- var ScalarTypeCast = class extends ScalarExpression {
38289
- constructor(valueExpression) {
38290
- super();
38291
- this.valueExpression = valueExpression;
38292
- }
38293
- stringify() {
38294
- return `CAST(${this.valueExpression.stringify()} AS ${this.dataType})`;
38295
- }
38296
- equals(other) {
38297
- return other instanceof ScalarTypeCast && isEqual(this.constructor, other.constructor) &&
38298
- isEqual(this.valueExpression, other.valueExpression);
38299
- }
38300
- canEvaluate() {
38301
- return this.valueExpression.canEvaluate();
38302
- }
38303
- };
38304
- var ScalarTypeCastBoolean = class extends ScalarTypeCast {
38305
- constructor() {
38306
- super(...arguments);
38307
- __publicField(this, 'dataType', 'BOOLEAN');
38308
- __publicField(this, 'definition', ScalarTypeCastBoolean.getDefinition());
38309
- }
38310
- static getDefinition() {
38311
- return {
38312
- type: 'boolean',
38313
- isNullable: true,
38314
- };
38315
- }
38316
- evaluate(item) {
38317
- const value = this.valueExpression.evaluate(item);
38318
- return DatabaseValue.cast(value, this.definition);
38319
- }
38320
- };
38321
- var ScalarTypeCastDate = class extends ScalarTypeCast {
38322
- constructor() {
38323
- super(...arguments);
38324
- __publicField(this, 'dataType', 'DATE');
38325
- __publicField(this, 'definition', ScalarTypeCastDate.getDefinition());
38326
- }
38327
- static getDefinition() {
38328
- return {
38329
- type: 'date',
38330
- isNullable: true,
38331
- };
38332
- }
38333
- evaluate(item) {
38334
- const value = this.valueExpression.evaluate(item);
38335
- return DatabaseValue.cast(value, this.definition);
38336
- }
38337
- };
38338
- var ScalarTypeCastNumber = class extends ScalarTypeCast {
38339
- constructor() {
38340
- super(...arguments);
38341
- __publicField(this, 'dataType', 'NUMBER');
38342
- __publicField(this, 'definition', ScalarTypeCastNumber.getDefinition());
38343
- }
38344
- static getDefinition() {
38345
- return {
38346
- type: 'number',
38347
- isNullable: true,
38348
- };
38349
- }
38350
- evaluate(item) {
38351
- const value = this.valueExpression.evaluate(item);
38352
- return DatabaseValue.cast(value, this.definition);
38353
- }
38354
- };
38355
- var ScalarTypeCastString = class extends ScalarTypeCast {
38356
- constructor() {
38357
- super(...arguments);
38358
- __publicField(this, 'dataType', 'STRING');
38359
- __publicField(this, 'definition', ScalarTypeCastString.getDefinition());
38360
- }
38361
- static getDefinition() {
38362
- return {
38363
- type: 'string',
38364
- isNullable: true,
38365
- };
38366
- }
38367
- evaluate(item) {
38368
- const value = this.valueExpression.evaluate(item);
38369
- return DatabaseValue.cast(value, this.definition);
38370
- }
38371
- };
38372
- function convertExpression(expression, schema, typeAffinity) {
38373
- const scalarExpression = getScalarExpression(expression, schema, typeAffinity);
38374
- const isLiteralValue = scalarExpression instanceof ScalarLiteralValue;
38375
- if (scalarExpression.canEvaluate() && !isLiteralValue) {
38376
- const value = scalarExpression.evaluate();
38377
- return new ScalarLiteralValue(scalarExpression.definition, value);
38378
- }
38379
- return scalarExpression;
38380
- }
38381
- function getScalarExpression(expression, schema, typeAffinity) {
38382
- switch (expression.type) {
38383
- case 'Identifier':
38384
- return convertIdentifier(expression, schema);
38385
- case 'LiteralValue':
38386
- return convertLiteralValue(expression, typeAffinity);
38387
- case 'FunctionCall':
38388
- return convertFunctionCall(expression, schema);
38389
- case 'Case':
38390
- return convertCase(expression, schema, typeAffinity);
38391
- case 'UnaryOperation':
38392
- return convertUnaryOperation(expression, schema);
38393
- case 'BinaryOperation':
38394
- return convertBinaryOperation(expression, schema);
38395
- case 'TypeCast':
38396
- return convertTypeCast(expression, schema);
38397
- default:
38398
- throw new Error(`Unsupported expression: ${JSON.stringify(expression)}`);
38399
- }
38400
- }
38401
- function convertIdentifier(expression, schema) {
38402
- return new ScalarIdentifier(schema, expression.name, expression.collection);
38403
- }
38404
- function convertLiteralValue(expression, typeAffinity) {
38405
- var _a;
38406
- const scalarExpression = getScalarLiteralValue(expression.value);
38407
- switch (typeAffinity == null ? void 0 : typeAffinity.type) {
38408
- case 'boolean': {
38409
- const value = toBoolean(scalarExpression.value);
38410
- return ScalarLiteralValue.fromBoolean(value);
38411
- }
38412
- case 'date': {
38413
- const value = toDate(scalarExpression.value);
38414
- return ScalarLiteralValue.fromDate(value);
38415
- }
38416
- case 'enum': {
38417
- if (((_a = scalarExpression.value) == null ? void 0 : _a.type) === 'string') {
38418
- return ScalarLiteralValue.fromEnum(scalarExpression.value.value);
38419
- }
38420
- return scalarExpression;
38421
- }
38422
- case 'number': {
38423
- const value = toNumber2(scalarExpression.value);
38424
- return ScalarLiteralValue.fromNumber(value);
38425
- }
38426
- case 'string': {
38427
- const value = toString(scalarExpression.value);
38428
- return ScalarLiteralValue.fromString(value);
38429
- }
38430
- }
38431
- return scalarExpression;
38432
- }
38433
- function getScalarLiteralValue(value) {
38434
- if (isBoolean(value)) {
38435
- return ScalarLiteralValue.fromBoolean(value);
38436
- }
38437
- if (isValidDate(value)) {
38438
- const string = value.toISOString();
38439
- return ScalarLiteralValue.fromDate(string);
38440
- }
38441
- if (isNumber2(value)) {
38442
- return ScalarLiteralValue.fromNumber(value);
38443
- }
38444
- if (isString2(value)) {
38445
- return ScalarLiteralValue.fromString(value);
38446
- }
38447
- return ScalarLiteralValue.fromNull();
38448
- }
38449
- function convertFunctionCall(expression, schema) {
38450
- const argumentExpressions = expression.arguments.map((argument) => {
38451
- return convertExpression(argument, schema, void 0);
38452
- });
38453
- switch (expression.functionName) {
38454
- case 'CONTAINS':
38455
- return new ScalarFunctionCallContains(argumentExpressions);
38456
- case 'STARTS_WITH':
38457
- return new ScalarFunctionCallStartsWith(argumentExpressions);
38458
- case 'ENDS_WITH':
38459
- return new ScalarFunctionCallEndsWith(argumentExpressions);
38460
- default:
38461
- throw new Error(`Unsupported function name: ${expression.functionName}`);
38462
- }
38463
- }
38464
- function convertCase(expression, schema, typeAffinity) {
38465
- const valueExpression = expression.value && convertExpression(expression.value, schema, void 0);
38466
- const valueTypeAffinity = expression.value && getExpressionType(expression.value, schema);
38467
- const conditions = expression.conditions.map((condition) => {
38468
- const whenExpression = convertExpression(condition.when, schema, valueTypeAffinity);
38469
- const thenExpression = convertExpression(condition.then, schema, typeAffinity);
38470
- return new ScalarCaseCondition(whenExpression, thenExpression);
38471
- });
38472
- const elseExpression = expression.else && convertExpression(expression.else, schema, typeAffinity);
38473
- return new ScalarCase(valueExpression, conditions, elseExpression);
38474
- }
38475
- function convertUnaryOperation(expression, schema) {
38476
- const valueExpression = convertExpression(expression.value, schema, void 0);
38477
- switch (expression.operator) {
38478
- case 'not':
38479
- return getScalarUnaryOperationNot(valueExpression);
38480
- default:
38481
- throw new Error(`Unsupported unary operator: ${expression.operator}`);
38482
- }
38483
- }
38484
- function getScalarUnaryOperationNot(valueExpression) {
38485
- var _a;
38486
- if (valueExpression instanceof ScalarUnaryOperationNot) {
38487
- const innerExpression = valueExpression.valueExpression;
38488
- if (((_a = innerExpression.definition) == null ? void 0 : _a.type) === 'boolean') {
38489
- return innerExpression;
38490
- }
38491
- return new ScalarTypeCastBoolean(innerExpression);
38492
- }
38493
- if (valueExpression instanceof ScalarComparisonEquals) {
38494
- const { leftExpression, rightExpression, } = valueExpression;
38495
- return new ScalarComparisonNotEquals(leftExpression, rightExpression);
38496
- }
38497
- if (valueExpression instanceof ScalarComparisonNotEquals) {
38498
- const { leftExpression, rightExpression, } = valueExpression;
38499
- return new ScalarComparisonEquals(leftExpression, rightExpression);
38500
- }
38501
- if (valueExpression instanceof ScalarComparisonLessThan) {
38502
- const { leftExpression, rightExpression, } = valueExpression;
38503
- return new ScalarComparisonGreaterThanOrEqual(leftExpression, rightExpression);
38504
- }
38505
- if (valueExpression instanceof ScalarComparisonLessThanOrEqual) {
38506
- const { leftExpression, rightExpression, } = valueExpression;
38507
- return new ScalarComparisonGreaterThan(leftExpression, rightExpression);
38508
- }
38509
- if (valueExpression instanceof ScalarComparisonGreaterThan) {
38510
- const { leftExpression, rightExpression, } = valueExpression;
38511
- return new ScalarComparisonLessThanOrEqual(leftExpression, rightExpression);
38512
- }
38513
- if (valueExpression instanceof ScalarComparisonGreaterThanOrEqual) {
38514
- const { leftExpression, rightExpression, } = valueExpression;
38515
- return new ScalarComparisonLessThan(leftExpression, rightExpression);
38516
- }
38517
- if (valueExpression instanceof ScalarLogicalOperationAnd) {
38518
- const { operandExpressions, } = valueExpression;
38519
- const notExpressions = operandExpressions.map(getScalarUnaryOperationNot);
38520
- return new ScalarLogicalOperationOr(notExpressions);
38521
- }
38522
- if (valueExpression instanceof ScalarLogicalOperationAnd) {
38523
- const { operandExpressions, } = valueExpression;
38524
- const notExpressions = operandExpressions.map(getScalarUnaryOperationNot);
38525
- return new ScalarLogicalOperationAnd(notExpressions);
38526
- }
38527
- return new ScalarUnaryOperationNot(valueExpression);
38528
- }
38529
- function getTypeAffinityForBinaryOperation(expression, schema) {
38530
- if (expression.operator !== 'and' && expression.operator !== 'or') {
38531
- return getExpressionType(expression.left, schema) || getExpressionType(expression.right, schema);
38532
- }
38533
- }
38534
- function convertBinaryOperation(expression, schema) {
38535
- const typeAffinity = getTypeAffinityForBinaryOperation(expression, schema);
38536
- const leftExpression = convertExpression(expression.left, schema, typeAffinity);
38537
- const rightExpression = convertExpression(expression.right, schema, typeAffinity);
38538
- switch (expression.operator) {
38539
- case 'and':
38540
- return getScalarLogicalOperationAnd(leftExpression, rightExpression);
38541
- case 'or':
38542
- return getScalarLogicalOperationOr(leftExpression, rightExpression);
38543
- case '==':
38544
- return getScalarComparisonEquals(leftExpression, rightExpression);
38545
- case '!=':
38546
- return getScalarComparisonNotEquals(leftExpression, rightExpression);
38547
- case '<':
38548
- return getScalarComparisonLessThan(leftExpression, rightExpression);
38549
- case '<=':
38550
- return getScalarComparisonLessThanOrEqual(leftExpression, rightExpression);
38551
- case '>':
38552
- return getScalarComparisonGreaterThan(leftExpression, rightExpression);
38553
- case '>=':
38554
- return getScalarComparisonGreaterThanOrEqual(leftExpression, rightExpression);
38555
- default:
38556
- throw new Error(`Unsupported binary operator: ${expression.operator}`);
38557
- }
38558
- }
38559
- function getScalarLogicalOperationAnd(leftExpression, rightExpression) {
38560
- const operandExpressions = [];
38561
- if (leftExpression instanceof ScalarLogicalOperationAnd) {
38562
- operandExpressions.push(...leftExpression.operandExpressions);
38563
- }
38564
- else {
38565
- operandExpressions.push(leftExpression);
38566
- }
38567
- if (rightExpression instanceof ScalarLogicalOperationAnd) {
38568
- operandExpressions.push(...rightExpression.operandExpressions);
38569
- }
38570
- else {
38571
- operandExpressions.push(rightExpression);
38572
- }
38573
- return new ScalarLogicalOperationAnd(operandExpressions);
38574
- }
38575
- function getScalarLogicalOperationOr(leftExpression, rightExpression) {
38576
- const operandExpressions = [];
38577
- if (leftExpression instanceof ScalarLogicalOperationOr) {
38578
- operandExpressions.push(...leftExpression.operandExpressions);
38579
- }
38580
- else {
38581
- operandExpressions.push(leftExpression);
38582
- }
38583
- if (rightExpression instanceof ScalarLogicalOperationOr) {
38584
- operandExpressions.push(...rightExpression.operandExpressions);
38585
- }
38586
- else {
38587
- operandExpressions.push(rightExpression);
38588
- }
38589
- return new ScalarLogicalOperationOr(operandExpressions);
38590
- }
38591
- function getScalarComparisonEquals(leftExpression, rightExpression) {
38592
- const isLeftIdentifier = leftExpression instanceof ScalarIdentifier;
38593
- const isRightIdentifier = rightExpression instanceof ScalarIdentifier;
38594
- if (isRightIdentifier && !isLeftIdentifier) {
38595
- return new ScalarComparisonEquals(rightExpression, leftExpression);
38596
- }
38597
- return new ScalarComparisonEquals(leftExpression, rightExpression);
38598
- }
38599
- function getScalarComparisonNotEquals(leftExpression, rightExpression) {
38600
- const isLeftIdentifier = leftExpression instanceof ScalarIdentifier;
38601
- const isRightIdentifier = rightExpression instanceof ScalarIdentifier;
38602
- if (isRightIdentifier && !isLeftIdentifier) {
38603
- return new ScalarComparisonNotEquals(rightExpression, leftExpression);
38604
- }
38605
- return new ScalarComparisonNotEquals(leftExpression, rightExpression);
38606
- }
38607
- function getScalarComparisonLessThan(leftExpression, rightExpression) {
38608
- const isLeftIdentifier = leftExpression instanceof ScalarIdentifier;
38609
- const isRightIdentifier = rightExpression instanceof ScalarIdentifier;
38610
- if (isRightIdentifier && !isLeftIdentifier) {
38611
- return new ScalarComparisonGreaterThan(rightExpression, leftExpression);
38612
- }
38613
- return new ScalarComparisonLessThan(leftExpression, rightExpression);
38614
- }
38615
- function getScalarComparisonLessThanOrEqual(leftExpression, rightExpression) {
38616
- const isLeftIdentifier = leftExpression instanceof ScalarIdentifier;
38617
- const isRightIdentifier = rightExpression instanceof ScalarIdentifier;
38618
- if (isRightIdentifier && !isLeftIdentifier) {
38619
- return new ScalarComparisonGreaterThanOrEqual(rightExpression, leftExpression);
38620
- }
38621
- return new ScalarComparisonLessThanOrEqual(leftExpression, rightExpression);
38622
- }
38623
- function getScalarComparisonGreaterThan(leftExpression, rightExpression) {
38624
- const isLeftIdentifier = leftExpression instanceof ScalarIdentifier;
38625
- const isRightIdentifier = rightExpression instanceof ScalarIdentifier;
38626
- if (isRightIdentifier && !isLeftIdentifier) {
38627
- return new ScalarComparisonLessThan(rightExpression, leftExpression);
38628
- }
38629
- return new ScalarComparisonGreaterThan(leftExpression, rightExpression);
38630
- }
38631
- function getScalarComparisonGreaterThanOrEqual(leftExpression, rightExpression) {
38632
- const isLeftIdentifier = leftExpression instanceof ScalarIdentifier;
38633
- const isRightIdentifier = rightExpression instanceof ScalarIdentifier;
38634
- if (isRightIdentifier && !isLeftIdentifier) {
38635
- return new ScalarComparisonLessThanOrEqual(rightExpression, leftExpression);
38636
- }
38637
- return new ScalarComparisonGreaterThanOrEqual(leftExpression, rightExpression);
38638
- }
38639
- function convertTypeCast(expression, schema) {
38640
- const valueExpression = convertExpression(expression.value, schema, void 0);
38641
- switch (expression.dataType) {
38642
- case 'BOOLEAN':
38643
- return getScalarTypeCastBoolean(valueExpression);
38644
- case 'DATE':
38645
- return getScalarTypeCastDate(valueExpression);
38646
- case 'NUMBER':
38647
- return getScalarTypeCastNumber(valueExpression);
38648
- case 'STRING':
38649
- return getScalarTypeCastString(valueExpression);
38650
- default:
38651
- throw new Error(`Unsupported data type: ${expression.dataType}`);
38652
- }
38653
- }
38654
- function getScalarTypeCastBoolean(valueExpression) {
38655
- var _a;
38656
- if (((_a = valueExpression.definition) == null ? void 0 : _a.type) === 'boolean') {
38657
- return valueExpression;
38658
- }
38659
- return new ScalarTypeCastBoolean(valueExpression);
38660
- }
38661
- function getScalarTypeCastDate(valueExpression) {
38662
- var _a;
38663
- if (((_a = valueExpression.definition) == null ? void 0 : _a.type) === 'date') {
38664
- return valueExpression;
38665
- }
38666
- return new ScalarTypeCastDate(valueExpression);
38667
- }
38668
- function getScalarTypeCastNumber(valueExpression) {
38669
- var _a;
38670
- if (((_a = valueExpression.definition) == null ? void 0 : _a.type) === 'number') {
38671
- return valueExpression;
38672
- }
38673
- return new ScalarTypeCastNumber(valueExpression);
38674
- }
38675
- function getScalarTypeCastString(valueExpression) {
38676
- var _a;
38677
- if (((_a = valueExpression.definition) == null ? void 0 : _a.type) === 'string') {
38678
- return valueExpression;
38679
- }
38680
- return new ScalarTypeCastString(valueExpression);
38681
- }
38682
- function getExpressionType(expression, schema) {
38683
- switch (expression.type) {
38684
- case 'Identifier':
38685
- return getIdentifierType(expression, schema);
38686
- case 'LiteralValue':
38687
- return void 0;
38688
- case 'FunctionCall':
38689
- return getFunctionCallType(expression);
38690
- case 'Case':
38691
- return getCaseType(expression, schema);
38692
- case 'UnaryOperation':
38693
- return getUnaryOperationType(expression);
38694
- case 'BinaryOperation':
38695
- return getBinaryOperationType(expression);
38696
- case 'TypeCast':
38697
- return getTypeCastType(expression);
38698
- default:
38699
- throw new Error(`Unsupported expression: ${JSON.stringify(expression)}`);
38700
- }
38701
- }
38702
- function getIdentifierType(expression, schema) {
38703
- return schema[expression.name];
38704
- }
38705
- function getFunctionCallType(expression) {
38706
- switch (expression.functionName) {
38707
- case 'CONTAINS':
38708
- return ScalarFunctionCallContains.getDefinition();
38709
- case 'STARTS_WITH':
38710
- return ScalarFunctionCallStartsWith.getDefinition();
38711
- case 'ENDS_WITH':
38712
- return ScalarFunctionCallEndsWith.getDefinition();
38713
- default:
38714
- throw new Error(`Unsupported function name: ${expression.functionName}`);
38715
- }
38716
- }
38717
- function getCaseType(expression, schema) {
38718
- var _j;
38719
- const definitions = [];
38720
- for (const condition of expression.conditions) {
38721
- const type = getExpressionType(condition.then, schema);
38722
- if (!isUndefined(type))
38723
- definitions.push(type);
38724
- }
38725
- if (expression.else) {
38726
- const type = getExpressionType(expression.else, schema);
38727
- if (!isUndefined(type))
38728
- definitions.push(type);
38729
- }
38730
- return (_j = ScalarCase.getDefinition(definitions)) !== null && _j !== void 0 ? _j : void 0;
38731
- }
38732
- function getUnaryOperationType(expression) {
38733
- switch (expression.operator) {
38734
- case 'not':
38735
- return ScalarUnaryOperationNot.getDefinition();
38736
- default:
38737
- throw new Error(`Unsupported unary operator: ${expression.operator}`);
38738
- }
38739
- }
38740
- function getBinaryOperationType(expression) {
38741
- switch (expression.operator) {
38742
- case 'and':
38743
- case 'or':
38744
- return ScalarLogicalOperation.getDefinition();
38745
- case '==':
38746
- case '!=':
38747
- case '<':
38748
- case '<=':
38749
- case '>':
38750
- case '>=':
38751
- return ScalarComparison.getDefinition();
38752
- default:
38753
- throw new Error(`Unsupported binary operator: ${expression.operator}`);
38754
- }
38755
- }
38756
- function getTypeCastType(expression) {
38757
- switch (expression.dataType) {
38758
- case 'BOOLEAN':
38759
- return ScalarTypeCastBoolean.getDefinition();
38760
- case 'DATE':
38761
- return ScalarTypeCastDate.getDefinition();
38762
- case 'NUMBER':
38763
- return ScalarTypeCastNumber.getDefinition();
38764
- case 'STRING':
38765
- return ScalarTypeCastString.getDefinition();
38766
- default:
38767
- throw new Error(`Unsupported data type: ${expression.dataType}`);
38768
- }
38769
- }
38770
- function stringifyExecutionTime(self2, total) {
38771
- return `(self: ${self2}ms${total ? `, total: ${total}ms` : ''})`;
38772
- }
38773
- function stringifyItems(items) {
38774
- return `(items: ${items})`;
38775
- }
38776
- var QueryPlan = class {
38777
- constructor() {
38778
- __publicField(this, 'executionTime', 0);
38779
- __publicField(this, 'itemCount', 0);
38780
- }
38781
- execute() {
38782
- return __awaiter(this, void 0, void 0, function* () {
38783
- const start = performance.now();
38784
- const result = yield this._execute();
38785
- this.executionTime = performance.now() - start;
38786
- this.itemCount = result.length;
38787
- return result;
38788
- });
38789
- }
38790
- };
38791
- var ScanCollectionPlan = class extends QueryPlan {
38792
- constructor(collection, alias) {
38793
- super();
38794
- this.collection = collection;
38795
- this.alias = alias;
38796
- }
38797
- inspect() {
38798
- return {
38799
- label: `ScanCollectionPlan ${stringifyExecutionTime(this.executionTime)} ${stringifyItems(this.itemCount)}`,
38800
- };
38801
- }
38802
- _execute() {
38803
- return __awaiter(this, void 0, void 0, function* () {
38804
- const items = yield this.collection.scanItems();
38805
- if (isUndefined(this.alias))
38806
- return items;
38807
- return items.map((item) => {
38808
- const data2 = Object.assign({}, item.data);
38809
- const dataEntries = Object.entries(data2);
38810
- for (const [key7, value,] of dataEntries) {
38811
- data2[`${this.alias}_${key7}`] = value;
38812
- }
38813
- return {
38814
- pointer: item.pointer,
38815
- data: data2,
38816
- };
38817
- });
38818
- });
38819
- }
38820
- };
38821
- var LeftJoinPlan = class extends QueryPlan {
38822
- constructor(leftPlan, rightPlan, constraint) {
38823
- super();
38824
- this.leftPlan = leftPlan;
38825
- this.rightPlan = rightPlan;
38826
- this.constraint = constraint;
38827
- }
38828
- inspect() {
38829
- var _j, _k;
38830
- const childPlansTime = Math.max((_j = this.leftPlan.executionTime) !== null && _j !== void 0 ? _j : 0, (_k = this.rightPlan.executionTime) !== null && _k !== void 0 ? _k : 0);
38831
- return {
38832
- label: `LeftJoinPlan ${stringifyExecutionTime(this.executionTime - childPlansTime, this.executionTime)} ${stringifyItems(this.itemCount)}`,
38833
- nodes: [this.leftPlan.inspect(), this.rightPlan.inspect(),],
38834
- };
38835
- }
38836
- _execute() {
38837
- return __awaiter(this, void 0, void 0, function* () {
38838
- var _a;
38839
- const leftItems = yield this.leftPlan.execute();
38840
- const rightItems = yield this.rightPlan.execute();
38841
- const result = [];
38842
- for (const leftItem of leftItems) {
38843
- let hasMatch = false;
38844
- for (const rightItem of rightItems) {
38845
- const combinedItem = {
38846
- pointer: leftItem.pointer,
38847
- data: Object.assign(Object.assign({}, leftItem.data), rightItem.data),
38848
- };
38849
- if ((_a = this.constraint.evaluate(combinedItem)) == null ? void 0 : _a.value) {
38850
- result.push(combinedItem);
38851
- hasMatch = true;
38852
- }
38853
- }
38854
- if (!hasMatch) {
38855
- result.push(leftItem);
38856
- }
38857
- }
38858
- return result;
38859
- });
38860
- }
38861
- };
38862
- var LookupIndexPlan = class extends QueryPlan {
38863
- constructor(index, query) {
38864
- super();
38865
- this.index = index;
38866
- this.query = query;
38867
- }
38868
- inspect() {
38869
- const queries = [];
38870
- const stringifyDatabaseLookupType = (indexLookup) => {
38871
- switch (indexLookup.type) {
38872
- case 'All':
38873
- return indexLookup.type;
38874
- case 'Equals':
38875
- case 'NotEquals':
38876
- case 'LessThan':
38877
- case 'GreaterThan':
38878
- case 'Contains':
38879
- case 'StartsWith':
38880
- case 'EndsWith':
38881
- return `${indexLookup.type} ${DatabaseValue.stringify(indexLookup.value)}`;
38882
- default: {
38883
- assertNever(indexLookup);
38884
- }
38885
- }
38886
- };
38887
- for (let i = 0; i < this.index.fields.length; i++) {
38888
- const field = this.index.fields[i];
38889
- const query = this.query[i];
38890
- if (!field || field.type !== 'Identifier')
38891
- continue;
38892
- if (!query || query.type === 'All')
38893
- continue;
38894
- queries.push(`${field.name} ${stringifyDatabaseLookupType(query)}`);
38895
- }
38896
- return {
38897
- label: `LookupIndexPlan(${queries.join(', ')}) ${stringifyExecutionTime(this.executionTime)} ${stringifyItems(this.itemCount)}`,
38898
- };
38899
- }
38900
- _execute() {
38901
- return __awaiter(this, void 0, void 0, function* () {
38902
- return this.index.lookupItems(this.query);
38903
- });
38904
- }
38905
- };
38906
- var UnionPlan = class extends QueryPlan {
38907
- constructor(childPlans) {
38908
- super();
38909
- this.childPlans = childPlans;
38910
- }
38911
- inspect() {
38912
- const childPlansTime = Math.max(...this.childPlans.map((childPlan) => { var _j; return (_j = childPlan.executionTime) !== null && _j !== void 0 ? _j : 0; }));
38913
- return {
38914
- label: `UnionPlan ${stringifyExecutionTime(this.executionTime - childPlansTime, this.executionTime)} ${stringifyItems(this.itemCount)}`,
38915
- nodes: this.childPlans.map((childPlan) => childPlan.inspect()),
38916
- };
38917
- }
38918
- _execute() {
38919
- return __awaiter(this, void 0, void 0, function* () {
38920
- var _j;
38921
- const childItemMaps = yield Promise.all(this.childPlans.map((childPlan) => __awaiter(this, void 0, void 0, function* () {
38922
- const items = yield childPlan.execute();
38923
- return new DatabaseItemMap(items);
38924
- })));
38925
- let result;
38926
- for (const itemMap of childItemMaps) {
38927
- if (result) {
38928
- result = result.union(itemMap);
38929
- }
38930
- else {
38931
- result = itemMap;
38932
- }
38933
- }
38934
- return (_j = (result == null ? void 0 : result.items())) !== null && _j !== void 0 ? _j : [];
38935
- });
38936
- }
38937
- };
38938
- var IntersectionPlan = class extends QueryPlan {
38939
- constructor(childPlans) {
38940
- super();
38941
- this.childPlans = childPlans;
38942
- }
38943
- inspect() {
38944
- const childPlansTime = Math.max(...this.childPlans.map((childPlan) => { var _j; return (_j = childPlan.executionTime) !== null && _j !== void 0 ? _j : 0; }));
38945
- return {
38946
- label: `IntersectionPlan ${stringifyExecutionTime(this.executionTime - childPlansTime, this.executionTime)} ${stringifyItems(this.itemCount)} ${stringifyItems(this.itemCount)}`,
38947
- nodes: this.childPlans.map((childPlan) => childPlan.inspect()),
38948
- };
38949
- }
38950
- _execute() {
38951
- return __awaiter(this, void 0, void 0, function* () {
38952
- var _j;
38953
- const childItemMaps = yield Promise.all(this.childPlans.map((childPlan) => __awaiter(this, void 0, void 0, function* () {
38954
- const items = yield childPlan.execute();
38955
- return new DatabaseItemMap(items);
38956
- })));
38957
- let result;
38958
- for (const itemMap of childItemMaps) {
38959
- if (result) {
38960
- result = result.intersection(itemMap);
38961
- }
38962
- else {
38963
- result = itemMap;
38964
- }
38965
- }
38966
- return (_j = (result == null ? void 0 : result.items())) !== null && _j !== void 0 ? _j : [];
38967
- });
38968
- }
38969
- };
38970
- var ResolveItemsPlan = class extends QueryPlan {
38971
- constructor(childPlan, collection, richTextResolver, select) {
38972
- super();
38973
- this.childPlan = childPlan;
38974
- this.collection = collection;
38975
- this.richTextResolver = richTextResolver;
38976
- this.select = select;
38977
- }
38978
- inspect() {
38979
- return {
38980
- label: `ResolveItemsPlan ${stringifyExecutionTime(this.executionTime - this.childPlan.executionTime, this.executionTime)} ${stringifyItems(this.itemCount)}`,
38981
- nodes: [this.childPlan.inspect(),],
38982
- };
38983
- }
38984
- _execute() {
38985
- return __awaiter(this, void 0, void 0, function* () {
38986
- const childItems = yield this.childPlan.execute();
38987
- const childPointers = childItems.map((item) => item.pointer);
38988
- for (const item of childItems) {
38989
- for (const expression of this.select) {
38990
- if (expression.type !== 'Identifier')
38991
- continue;
38992
- const value = item.data[expression.name];
38993
- if ((value == null ? void 0 : value.type) !== 'richtext')
38994
- continue;
38995
- void this.richTextResolver.resolve(expression.name, value.value);
38996
- }
38997
- }
38998
- return this.collection.resolveItems(childPointers);
38999
- });
39000
- }
39001
- };
39002
- var FilterItemsPlan = class extends QueryPlan {
39003
- constructor(childPlan, filterExpression) {
39004
- super();
39005
- this.childPlan = childPlan;
39006
- this.filterExpression = filterExpression;
39007
- }
39008
- inspect() {
39009
- return {
39010
- label: `FilterItemsPlan(${this.filterExpression.stringify()}) ${stringifyExecutionTime(this.executionTime - this.childPlan.executionTime, this.executionTime)} ${stringifyItems(this.itemCount)} ${stringifyItems(this.itemCount)}`,
39011
- nodes: [this.childPlan.inspect(),],
39012
- };
39013
- }
39014
- _execute() {
39015
- return __awaiter(this, void 0, void 0, function* () {
39016
- const childItems = yield this.childPlan.execute();
39017
- return childItems.filter((item) => {
39018
- const result = this.filterExpression.evaluate(item);
39019
- return toBoolean(result);
39020
- });
39021
- });
39022
- }
39023
- };
39024
- var SortItemsPlan = class extends QueryPlan {
39025
- constructor(childPlan, orderExpressions, collection) {
39026
- super();
39027
- this.childPlan = childPlan;
39028
- this.orderExpressions = orderExpressions;
39029
- this.collection = collection;
39030
- }
39031
- inspect() {
39032
- const order = this.orderExpressions.map((expression) => `${expression.expression.stringify()} ${expression.direction.toUpperCase()}`)
39033
- .join(', ');
39034
- return {
39035
- label: `SortItemsPlan(${order}) ${stringifyExecutionTime(this.executionTime - this.childPlan.executionTime, this.executionTime)} ${stringifyItems(this.itemCount)}`,
39036
- nodes: [this.childPlan.inspect(),],
39037
- };
39038
- }
39039
- _execute() {
39040
- return __awaiter(this, void 0, void 0, function* () {
39041
- const childItems = yield this.childPlan.execute();
39042
- return childItems.sort((leftItem, rightItem) => {
39043
- const leftSortItem = Object.assign(Object.assign({}, leftItem), { data: {} });
39044
- const rightSortItem = Object.assign(Object.assign({}, rightItem), { data: {} });
39045
- for (const { expression, direction, collation: collation10, } of this.orderExpressions) {
39046
- const isAscending = direction === 'asc';
39047
- if (expression instanceof ScalarIdentifier && expression.name === INDEX_IDENTIFIER) {
39048
- const order = this.collection.compareItems(leftSortItem, rightSortItem);
39049
- return isAscending ? order : -order;
39050
- }
39051
- const left = expression.evaluate(leftItem);
39052
- const right = expression.evaluate(rightItem);
39053
- if (DatabaseValue.equal(left, right, collation10)) {
39054
- continue;
39055
- }
39056
- if (DatabaseValue.lessThan(left, right, collation10) || isNullish2(left)) {
39057
- return isAscending ? -1 : 1;
39058
- }
39059
- if (DatabaseValue.greaterThan(left, right, collation10) || isNullish2(right)) {
39060
- return isAscending ? 1 : -1;
39061
- }
39062
- throw new Error('Invalid comparison result.');
39063
- }
39064
- return this.collection.compareItems(leftSortItem, rightSortItem);
39065
- });
39066
- });
39067
- }
39068
- };
39069
- var ScalarOrderExpression = class {
39070
- constructor(expression, direction, collation10) {
39071
- this.expression = expression;
39072
- this.direction = direction;
39073
- this.collation = collation10;
39074
- }
39075
- };
39076
- var SliceItemsPlan = class extends QueryPlan {
39077
- constructor(childPlan, offsetExpression, limitExpression) {
39078
- super();
39079
- this.childPlan = childPlan;
39080
- this.offsetExpression = offsetExpression;
39081
- this.limitExpression = limitExpression;
39082
- }
39083
- inspect() {
39084
- var _j, _k;
39085
- var _a, _b;
39086
- return {
39087
- label: `SliceItemsPlan(LIMIT ${(_j = ((_a = this.limitExpression) == null ? void 0 : _a.stringify())) !== null && _j !== void 0 ? _j : 'Infinity'}, OFFSET ${(_k = ((_b = this.offsetExpression) == null ? void 0 : _b.stringify())) !== null && _k !== void 0 ? _k : '0'}) ${stringifyExecutionTime(this.executionTime - this.childPlan.executionTime, this.executionTime)} ${stringifyItems(this.itemCount)}`,
39088
- nodes: [this.childPlan.inspect(),],
39089
- };
39090
- }
39091
- getOffset() {
39092
- var _a;
39093
- const value = (_a = this.offsetExpression) == null ? void 0 : _a.evaluate();
39094
- if (isNullish2(value) || value.type !== 'number')
39095
- return;
39096
- return value.value;
39097
- }
39098
- getLimit() {
39099
- var _a;
39100
- const value = (_a = this.limitExpression) == null ? void 0 : _a.evaluate();
39101
- if (isNullish2(value) || value.type !== 'number')
39102
- return;
39103
- return value.value;
39104
- }
39105
- _execute() {
39106
- return __awaiter(this, void 0, void 0, function* () {
39107
- var _j, _k;
39108
- const childItems = yield this.childPlan.execute();
39109
- const offset = (_j = this.getOffset()) !== null && _j !== void 0 ? _j : 0;
39110
- const limit = (_k = this.getLimit()) !== null && _k !== void 0 ? _k : Infinity;
39111
- return childItems.slice(offset, offset + limit);
39112
- });
39113
- }
39114
- };
39115
- var DatabaseItemMap = class extends Map {
39116
- constructor(items = []) {
39117
- super();
39118
- for (const item of items) {
39119
- this.set(item.pointer, item);
39120
- }
39121
- }
39122
- union(other) {
39123
- const result = new DatabaseItemMap();
39124
- for (const [pointer, item,] of this) {
39125
- result.set(pointer, item);
39126
- }
39127
- for (const [pointer, item,] of other) {
39128
- result.set(pointer, item);
39129
- }
39130
- return result;
39131
- }
39132
- intersection(other) {
39133
- const result = new DatabaseItemMap();
39134
- for (const [pointer, item,] of this) {
39135
- if (other.has(pointer)) {
39136
- result.set(pointer, item);
39137
- }
39138
- }
39139
- return result;
39140
- }
39141
- items() {
39142
- const values = this.values();
39143
- return [...values,];
39144
- }
39145
- };
39146
- var RichTextResolver = class {
39147
- constructor(collections) {
39148
- this.collections = collections;
39149
- __publicField(this, 'cache', /* @__PURE__ */ new Map());
39150
- }
39151
- resolve(key7, pointer) {
39152
- var _j;
39153
- const scopedCache = (_j = this.cache.get(key7)) !== null && _j !== void 0 ? _j : new Map();
39154
- this.cache.set(key7, scopedCache);
39155
- const cachedPromise = scopedCache.get(pointer);
39156
- if (cachedPromise)
39157
- return cachedPromise;
39158
- for (const collection of this.collections) {
39159
- if (key7 in collection.schema) {
39160
- const promise = collection.resolveRichText(pointer);
39161
- scopedCache.set(pointer, promise);
39162
- return promise;
39163
- }
39164
- }
39165
- throw new Error(`Rich text field not found: ${key7}`);
39166
- }
39167
- };
39168
37672
  var unknownDefinition = {
39169
37673
  type: 'unknown',
39170
37674
  isNullable: true,
@@ -39726,7 +38230,7 @@ var CaseCondition = class {
39726
38230
  return calculateHash('CaseCondition', this.when, this.then);
39727
38231
  }
39728
38232
  };
39729
- var ScalarCase2 = class extends ScalarNode {
38233
+ var ScalarCase = class extends ScalarNode {
39730
38234
  constructor(input, conditions, otherwise) {
39731
38235
  const referencedFields = new Fields();
39732
38236
  const referencedOuterFields = new Fields();
@@ -39793,7 +38297,7 @@ var ScalarCase2 = class extends ScalarNode {
39793
38297
  return new CaseCondition(when, then);
39794
38298
  });
39795
38299
  const otherwise = (_b = this.otherwise) == null ? void 0 : _b.getOptimized();
39796
- return new ScalarCase2(input, conditions, otherwise);
38300
+ return new ScalarCase(input, conditions, otherwise);
39797
38301
  }
39798
38302
  *evaluate(context, tuple) {
39799
38303
  var _j, _k;
@@ -40037,6 +38541,7 @@ var Builder = class {
40037
38541
  fromScope.setNode(node);
40038
38542
  }
40039
38543
  const orderProjections = [];
38544
+ const orderFields = new Fields();
40040
38545
  let ordering;
40041
38546
  if (select.orderBy) {
40042
38547
  ordering = new Ordering();
@@ -40045,6 +38550,7 @@ var Builder = class {
40045
38550
  const scopeField = fromScope.resolveField(order.name, order.collection);
40046
38551
  if (isUndefined(scopeField))
40047
38552
  continue;
38553
+ orderFields.add(scopeField.field);
40048
38554
  const orderingField = new OrderingField(scopeField.field, order.direction);
40049
38555
  ordering.push(orderingField);
40050
38556
  }
@@ -40063,7 +38569,7 @@ var Builder = class {
40063
38569
  else {
40064
38570
  ordering = defaultOrdering;
40065
38571
  }
40066
- const projectionScope = this.buildSelectList(fromScope, select.select, orderProjections);
38572
+ const projectionScope = this.buildSelectList(fromScope, select.select, orderFields, orderProjections);
40067
38573
  projectionScope.setOrdering(ordering);
40068
38574
  if (select.offset) {
40069
38575
  const input = projectionScope.takeNode();
@@ -40079,10 +38585,10 @@ var Builder = class {
40079
38585
  }
40080
38586
  return projectionScope;
40081
38587
  }
40082
- buildSelectList(inScope, selects, orderProjections) {
38588
+ buildSelectList(inScope, selects, orderFields, orderProjections) {
40083
38589
  var _j;
40084
38590
  const outScope = inScope.push();
40085
- const passthrough = new Fields();
38591
+ const passthrough = new Fields(orderFields);
40086
38592
  const projections = [...orderProjections,];
40087
38593
  for (const select of selects) {
40088
38594
  if (select.type === 'Identifier') {
@@ -42609,7 +41115,7 @@ var Normalizer = class {
42609
41115
  }
42610
41116
  conditions = castConditions;
42611
41117
  }
42612
- const node = new ScalarCase2(input, conditions, otherwise);
41118
+ const node = new ScalarCase(input, conditions, otherwise);
42613
41119
  return this.finishScalar(node);
42614
41120
  }
42615
41121
  newScalarContains(source, target) {
@@ -42838,37 +41344,8 @@ function stringifyQuery(query) {
42838
41344
  return autoIndentSql(queryString);
42839
41345
  }
42840
41346
  var log = /* @__PURE__ */ getLogger('query-engine');
42841
- function getDatabaseCollection({ data: data2, }, locale) {
42842
- if (isAnyLegacyCollection(data2)) {
42843
- return new CompatibilityDatabaseCollection(data2, locale);
42844
- }
42845
- if (isDatabaseCollection(data2)) {
42846
- return data2;
42847
- }
42848
- if (isLocalizedDatabaseCollection(data2)) {
42849
- while (locale) {
42850
- const collection = data2.collectionByLocaleId[locale.id];
42851
- if (collection)
42852
- return collection;
42853
- locale = locale.fallback;
42854
- }
42855
- return data2.collectionByLocaleId.default;
42856
- }
42857
- assertNever(data2, 'Unsupported collection type');
42858
- }
42859
41347
  var QueryEngine = class {
42860
- constructor() {
42861
- __publicField(this, 'useNewOptimizer', false);
42862
- }
42863
41348
  query(query, locale) {
42864
- return __awaiter(this, void 0, void 0, function* () {
42865
- if (this.useNewOptimizer || needsNewQueryOptimizer(query)) {
42866
- return this.queryNew(query, locale);
42867
- }
42868
- return this.queryOld(query, locale);
42869
- });
42870
- }
42871
- queryNew(query, locale) {
42872
41349
  return __awaiter(this, void 0, void 0, function* () {
42873
41350
  log.debug(`Query:
42874
41351
  ${stringifyQuery(query)}`);
@@ -42910,277 +41387,7 @@ ${stringifyQuery(query)}`);
42910
41387
  return (_j = (value == null ? void 0 : value.value)) !== null && _j !== void 0 ? _j : null;
42911
41388
  });
42912
41389
  }
42913
- queryOld(query, locale) {
42914
- return __awaiter(this, void 0, void 0, function* () {
42915
- const [plan, schema, richTextResolver,] = this.createQueryPlan(query, locale);
42916
- const items = yield this.executeQueryPlan(schema, richTextResolver, query, plan);
42917
- log.debug(`Query:
42918
- ${stringifyQuery(query)}
42919
-
42920
- ${(0, import_archy.default)(plan.inspect())}`);
42921
- return items;
42922
- });
42923
- }
42924
- buildFrom(from, schema, collections, locale) {
42925
- switch (from.type) {
42926
- case 'Collection': {
42927
- const collection = getDatabaseCollection(from, locale);
42928
- collections.push(collection);
42929
- Object.assign(schema, collection.schema);
42930
- return new ScanCollectionPlan(collection, from.alias);
42931
- }
42932
- case 'LeftJoin': {
42933
- const left = this.buildFrom(from.left, schema, collections, locale);
42934
- const right = this.buildFrom(from.right, schema, collections, locale);
42935
- const constraint = ScalarExpression.from(from.constraint, schema);
42936
- return new LeftJoinPlan(left, right, constraint);
42937
- }
42938
- default:
42939
- assertNever(from, 'Unsupported data source');
42940
- }
42941
- }
42942
- createQueryPlan(query, locale) {
42943
- var _a;
42944
- const schema = {};
42945
- const collections = [];
42946
- let plan = this.buildFrom(query.from, schema, collections, locale);
42947
- const [firstCollection,] = collections;
42948
- assert(firstCollection, 'At least one collection must exist');
42949
- const richTextResolver = new RichTextResolver(collections);
42950
- if (query.where) {
42951
- const filterExpression = ScalarExpression.from(query.where, schema);
42952
- if (collections.length === 1) {
42953
- plan = createPlanForWhereClause(firstCollection, filterExpression);
42954
- }
42955
- else {
42956
- plan = new FilterItemsPlan(plan, filterExpression);
42957
- }
42958
- }
42959
- const sortExpressions = (_a = query.orderBy) == null
42960
- ? void 0
42961
- : _a.map((expression) => {
42962
- var _j;
42963
- return new ScalarOrderExpression(ScalarExpression.from(expression, schema), (_j = expression.direction) !== null && _j !== void 0 ? _j : 'asc', {
42964
- type: 0,
42965
- /* CaseInsensitive */
42966
- });
42967
- });
42968
- plan = new SortItemsPlan(plan, sortExpressions !== null && sortExpressions !== void 0 ? sortExpressions : [], firstCollection);
42969
- let offsetExpression;
42970
- if (query.offset) {
42971
- offsetExpression = ScalarExpression.from(query.offset, schema);
42972
- }
42973
- let limitExpression;
42974
- if (query.limit) {
42975
- limitExpression = ScalarExpression.from(query.limit, schema);
42976
- }
42977
- if (offsetExpression || limitExpression) {
42978
- plan = new SliceItemsPlan(plan, offsetExpression, limitExpression);
42979
- }
42980
- if (query.select.length > 0 && collections.length === 1) {
42981
- plan = new ResolveItemsPlan(plan, firstCollection, richTextResolver, query.select);
42982
- }
42983
- return [plan, schema, richTextResolver,];
42984
- }
42985
- executeQueryPlan(schema, richTextResolver, query, plan) {
42986
- return __awaiter(this, void 0, void 0, function* () {
42987
- const items = yield plan.execute();
42988
- return Promise.all(items.map((item) => __awaiter(this, void 0, void 0, function* () {
42989
- const data2 = {};
42990
- for (const expression of query.select) {
42991
- const scalarExpression = ScalarExpression.from(expression, schema);
42992
- const key7 = getSelectKey(expression);
42993
- const value = scalarExpression.evaluate(item);
42994
- data2[key7] = yield resolveValue(richTextResolver, expression.type === 'Identifier' ? expression.name : void 0, value);
42995
- }
42996
- return data2;
42997
- })));
42998
- });
42999
- }
43000
41390
  };
43001
- function getSelectKey(expression) {
43002
- if (expression.alias) {
43003
- return expression.alias;
43004
- }
43005
- if (expression.type === 'Identifier') {
43006
- return expression.name;
43007
- }
43008
- throw new Error('Can\'t serialize expression');
43009
- }
43010
- function resolveValue(richTextResolver, key7, value) {
43011
- return __awaiter(this, void 0, void 0, function* () {
43012
- if (isNullish2(value)) {
43013
- return null;
43014
- }
43015
- if (value.type === 'richtext') {
43016
- assert(isString2(key7), 'Rich text field must be a string');
43017
- return richTextResolver.resolve(key7, value.value);
43018
- }
43019
- return value.value;
43020
- });
43021
- }
43022
- function createPlanForWhereClause(collection, expression) {
43023
- var _j;
43024
- if (expression instanceof ScalarLogicalOperationAnd) {
43025
- const childPlans = expression.operandExpressions.map((expression2) => createPlanForWhereClause(collection, expression2));
43026
- return new IntersectionPlan(childPlans);
43027
- }
43028
- if (expression instanceof ScalarLogicalOperationOr) {
43029
- const childPlans = expression.operandExpressions.map((expression2) => createPlanForWhereClause(collection, expression2));
43030
- return new UnionPlan(childPlans);
43031
- }
43032
- return (_j = findLookupIndexPlan(collection, expression)) !== null && _j !== void 0 ? _j : createScanCollectionPlan(collection, expression);
43033
- }
43034
- function findLookupIndexPlan(collection, expression) {
43035
- var _a, _b;
43036
- if (expression instanceof ScalarComparison) {
43037
- return findLookupIndexPlanForComparison(collection, expression);
43038
- }
43039
- if (expression instanceof ScalarFunctionCall) {
43040
- return findLookupIndexPlanForFunctionCall(collection, expression);
43041
- }
43042
- if (expression instanceof ScalarIdentifier && ((_a = expression.definition) == null ? void 0 : _a.type) === 'boolean') {
43043
- const value = ScalarLiteralValue.fromBoolean(true);
43044
- const comparison = new ScalarComparisonEquals(expression, value);
43045
- return findLookupIndexPlanForComparison(collection, comparison);
43046
- }
43047
- if (expression instanceof ScalarUnaryOperationNot && expression.valueExpression instanceof ScalarIdentifier &&
43048
- ((_b = expression.valueExpression.definition) == null ? void 0 : _b.type) === 'boolean') {
43049
- const value = ScalarLiteralValue.fromBoolean(true);
43050
- const comparison = new ScalarComparisonNotEquals(expression.valueExpression, value);
43051
- return findLookupIndexPlanForComparison(collection, comparison);
43052
- }
43053
- }
43054
- function findLookupIndexPlanForComparison(collection, expression) {
43055
- const leftExpression = expression.leftExpression;
43056
- const rightExpression = expression.rightExpression;
43057
- if (!(rightExpression instanceof ScalarLiteralValue))
43058
- return;
43059
- for (const index of collection.indexes) {
43060
- const field = index.fields[0];
43061
- if (isUndefined(field))
43062
- continue;
43063
- const fieldExpression = ScalarExpression.from(field, collection.schema);
43064
- if (!leftExpression.equals(fieldExpression))
43065
- continue;
43066
- const fillerAllQueries = new Array(index.fields.length - 1).fill({
43067
- type: 'All',
43068
- /* All */
43069
- });
43070
- if (expression instanceof ScalarComparisonEquals && index.supportedLookupTypes.includes('Equals')) {
43071
- return new LookupIndexPlan(index, [{
43072
- type: 'Equals',
43073
- value: rightExpression.evaluate(),
43074
- }, ...fillerAllQueries,]);
43075
- }
43076
- if (expression instanceof ScalarComparisonNotEquals && index.supportedLookupTypes.includes('NotEquals')) {
43077
- return new LookupIndexPlan(index, [{
43078
- type: 'NotEquals',
43079
- value: rightExpression.evaluate(),
43080
- }, ...fillerAllQueries,]);
43081
- }
43082
- if (expression instanceof ScalarComparisonLessThan && index.supportedLookupTypes.includes('LessThan')) {
43083
- return new LookupIndexPlan(index, [{
43084
- type: 'LessThan',
43085
- value: rightExpression.evaluate(),
43086
- inclusive: false,
43087
- }, ...fillerAllQueries,]);
43088
- }
43089
- if (expression instanceof ScalarComparisonLessThanOrEqual && index.supportedLookupTypes.includes('LessThan')) {
43090
- return new LookupIndexPlan(index, [{
43091
- type: 'LessThan',
43092
- value: rightExpression.evaluate(),
43093
- inclusive: true,
43094
- }, ...fillerAllQueries,]);
43095
- }
43096
- if (expression instanceof ScalarComparisonGreaterThan && index.supportedLookupTypes.includes('GreaterThan')) {
43097
- return new LookupIndexPlan(index, [{
43098
- type: 'GreaterThan',
43099
- value: rightExpression.evaluate(),
43100
- inclusive: false,
43101
- }, ...fillerAllQueries,]);
43102
- }
43103
- if (expression instanceof ScalarComparisonGreaterThanOrEqual && index.supportedLookupTypes.includes('GreaterThan')) {
43104
- return new LookupIndexPlan(index, [{
43105
- type: 'GreaterThan',
43106
- value: rightExpression.evaluate(),
43107
- inclusive: true,
43108
- }, ...fillerAllQueries,]);
43109
- }
43110
- }
43111
- }
43112
- function findLookupIndexPlanForFunctionCall(collection, expression) {
43113
- if (expression.argumentExpressions.length !== 2)
43114
- return;
43115
- const sourceExpression = expression.argumentExpressions[0];
43116
- const targetExpression = expression.argumentExpressions[1];
43117
- if (isUndefined(sourceExpression))
43118
- return;
43119
- if (isUndefined(targetExpression))
43120
- return;
43121
- if (!(targetExpression instanceof ScalarLiteralValue))
43122
- return;
43123
- for (const index of collection.indexes) {
43124
- const field = index.fields[0];
43125
- if (isUndefined(field))
43126
- continue;
43127
- const fieldExpression = ScalarExpression.from(field, collection.schema);
43128
- if (!sourceExpression.equals(fieldExpression))
43129
- continue;
43130
- const fillerAllQueries = new Array(index.fields.length - 1).fill({
43131
- type: 'All',
43132
- /* All */
43133
- });
43134
- if (expression instanceof ScalarFunctionCallContains && index.supportedLookupTypes.includes('Contains')) {
43135
- return new LookupIndexPlan(index, [{
43136
- type: 'Contains',
43137
- value: targetExpression.evaluate(),
43138
- }, ...fillerAllQueries,]);
43139
- }
43140
- if (expression instanceof ScalarFunctionCallStartsWith && index.supportedLookupTypes.includes('StartsWith')) {
43141
- return new LookupIndexPlan(index, [{
43142
- type: 'StartsWith',
43143
- value: targetExpression.evaluate(),
43144
- }, ...fillerAllQueries,]);
43145
- }
43146
- if (expression instanceof ScalarFunctionCallEndsWith && index.supportedLookupTypes.includes('EndsWith')) {
43147
- return new LookupIndexPlan(index, [{
43148
- type: 'EndsWith',
43149
- value: targetExpression.evaluate(),
43150
- }, ...fillerAllQueries,]);
43151
- }
43152
- }
43153
- }
43154
- function createScanCollectionPlan(collection, expression) {
43155
- const plan = new ScanCollectionPlan(collection, void 0);
43156
- return new FilterItemsPlan(plan, expression);
43157
- }
43158
- function needsNewQueryOptimizer(query) {
43159
- if (query.from.type !== 'Collection')
43160
- return true;
43161
- for (const expression of query.select) {
43162
- if (expression.type === 'Identifier')
43163
- return true;
43164
- }
43165
- if (query.where)
43166
- return hasScalarIn(query.where);
43167
- return false;
43168
- }
43169
- function hasScalarIn(expression) {
43170
- switch (expression.type) {
43171
- case 'UnaryOperation': {
43172
- return hasScalarIn(expression.value);
43173
- }
43174
- case 'BinaryOperation': {
43175
- if (expression.operator === 'in') {
43176
- return true;
43177
- }
43178
- return hasScalarIn(expression.left) || hasScalarIn(expression.right);
43179
- }
43180
- default:
43181
- return false;
43182
- }
43183
- }
43184
41391
  var defaultVariantKey = 'default';
43185
41392
  var defaultVariants = /* @__PURE__ */ new Set([defaultVariantKey,]);
43186
41393
  var _variantHashes;
@@ -50033,9 +48240,9 @@ MotionValue.prototype.addChild = function ({ transformer = (v) => v, }) {
50033
48240
  return child;
50034
48241
  };
50035
48242
  if (false) {
50036
- MainLoop.start();
48243
+ MainLoop2.start();
50037
48244
  }
50038
- export { _injectRuntime, AcceleratedAnimation, addActionControls, addFonts, addPointerEvent, addPointerInfo, addPropertyControls, addScaleCorrector, AnchorLinkTarget, Animatable, animate2 as animate, animateMini, AnimatePresence, AnimateSharedLayout, animateValue, animateVisualElement, animationControls, animations, annotateTypeOnStringify, anticipate, AnyInterpolation, AutomaticLayoutIds, BackgroundImage, backgroundImageFromProps, backIn, backInOut, backOut, BezierAnimator, BoxShadow, buildTransform, calcLength, calculateRect, callEach, cancelFrame, cancelSync, ChildrenCanSuspend, circIn, circInOut, circOut, clamp, collectVisualStyleFromProps, Color, color, ColorFormat, ColorMixModelType, combinedCSSRulesForPreview, complex, ComponentContainerContext, ComponentPresetsConsumer, ComponentPresetsProvider, ComponentViewportProvider, ConstraintMask, constraintsEnabled, ConstraintValues, Container, ControlType, ConvertColor, convertPresentationTree, convertPropsToDeviceOptions, createBox, createData, createFramerPageLink, createRendererMotionComponent, createScopedAnimate, cssBackgroundSize, cubicBezier, CustomCursorHost, CustomProperties, cx, CycleVariantState, Data, DataContext, DataObserver, DataObserverContext, debounce, defaultDeviceProps, degreesToRadians, delay, DeprecatedComponentContainer, DeprecatedFrameWithEvents, DeprecatedLayoutGroupContext, DeprecatedLayoutGroupContext as LayoutGroupContext, Device, DeviceCodeComponent, devicePresets, DimensionType, disableInstantTransitions, dispatchKeyDownEvent, distance, distance2D, DOM, domAnimation, domMax, domMin, DragControls, Draggable, easeIn, easeInOut, easeOut, EmptyState, environment, ErrorPlaceholder, executeInRenderEnvironment, Fetcher, filterProps, findSpring, finiteNumber, FlatTree, Floating, FontSourceNames, fontStore, forceLayerBackingWithCSSProperties, FormBooleanInput, FormContainer, FormPlainTextInput2 as FormPlainTextInput, FormSelect, fraction, Frame, frame, frameData, frameFromElement, frameFromElements, FramerAnimation, framerAppearAnimationScriptKey, framerAppearEffects, framerAppearIdKey, framerAppearTransformTemplateToken, framerCSSMarker, FramerEvent, FramerEventListener, FramerEventSession, frameSteps, FrameWithMotion, GamepadContext, GeneratedComponentContext, getComponentSize, getDevicePreset, getFonts, getFontsFromComponentPreset, getFontsFromSharedStyle, getLoadingLazyAtYPosition, getMeasurableCodeComponentChildren, getMergedConstraintsProps, getPropertyControls, getWhereExpressionFromPathVariables, gradientForShape, Image2 as Image, imagePatternPropsForFill, imageUrlForAsset, inertia, inferInitialRouteFromPath, injectComponentCSSRules, installFlexboxGapWorkaroundIfNeeded, InternalID, interpolate, invariant, inView, isAnimatable2 as isAnimatable, isBrowser, isDesignDefinition, isDragActive, isEqual, isFiniteNumber, isFractionDimension, isFramerGamepadKeydownData, isFramerPageLink, isGapEnabled, isMotionComponent, isMotionValue2 as isMotionValue, isOfAnnotatedType, isOverride, isReactDefinition, isRelativeNumber, isShallowEqualArray, isStraightCurve, isValidMotionProp, keyframes, Layer, LayoutGroup, LayoutIdContext, lazy, LazyMotion, LazyValue, LibraryFeaturesProvider, Line, LinearGradient, Link, loadFont, loadJSON, localPackageFallbackIdentifier, localShadowFrame, m, MainLoop, makePaddingString, makeUseVisualState, markHydrationStart, memoize2 as memoize, mirrorEasing, mix, modulate, motion, MotionConfig, MotionConfigContext, MotionContext, MotionGlobalConfig, MotionSetup, MotionValue, motionValue, namespace_exports as Reorder, NavigateTo, NavigationCallbackProvider, NavigationConsumer, NavigationTransitionType, NavigationWrapper as Navigation, nestedLinksCollector, NotFoundError, ObservableObject, optimizeAppear, optimizeAppearTransformTemplate, optimizedAppearDataAttribute, paddingFromProps, Page3 as Page, PageEffectsProvider, PageRoot, ParentSizeState, parseFramerPageLink, pathDefaults, PathSegment, PathVariablesContext, pipe, Point, Polygon, preloadImage, PresenceContext, print, progress, PropertyOverrides2 as PropertyOverrides, PropertyStore, propsForLink, pushLoadMoreHistory, px, QueryEngine, RadialGradient, Rect, removeHiddenBreakpointLayers, removeHiddenBreakpointLayersV2, RenderTarget, resolveLink, ResolveLinks, resolveMotionValue, resolvePageScope, reverseEasing, RichText2 as RichText, roundedNumber, roundedNumberString, roundWithOffset, Scroll, scroll, scrollInfo, setGlobalRenderEnvironment, setInitialHydrationState, Shadow, sharedSVGManager, shouldOpenLinkInNewTab, Size, spring, SpringAnimator, SSRVariants, Stack, stagger, startAnimation, startOptimizedAppearAnimation, steps, StyleSheetContext, SVG, SwitchLayoutGroupContext, sync, systemFontFamilyName, Text2 as Text, throttle, toFlexDirection, toJustifyOrAlignment, toSVGPath, transform, transformString2 as transformString, transformTemplate, turnOffReactEventHandling, unwrapMotionComponent, useActiveTargetCallback, useActiveVariantCallback, useAddVariantProps, useAnimate, useAnimatedState, useAnimatedState as useDeprecatedAnimatedState, useAnimateMini, useAnimation, useAnimationControls, useAnimationFrame, useBreakpointVariants, useComponentViewport, useConstant2 as useConstant, useCurrentPathVariables, useCurrentRouteId, useCustomCursors, useCycle, useDataRecord, useDomEvent, useDragControls, useDynamicRefs, useElementScroll, useForceUpdate, useGamepad, useHotkey, useHydratedBreakpointVariants, useInitialRouteComponent, useInstantLayoutTransition, useInstantTransition, useInvertedScale, useInvertedScale as useDeprecatedInvertedScale, useInView, useIsInCurrentNavigationTarget, useIsomorphicLayoutEffect, useIsOnFramerCanvas, useIsPresent, useLoadMorePaginatedQuery, useLocale, useLocaleCode, useLocaleInfo, useLocalizationInfo, useMeasureLayout, useMotionTemplate, useMotionValue, useMotionValueEvent, useNavigate, useNavigation, useObserveData, useOnAppear, useOnCurrentTargetChange, useOnVariantChange, useOverlayState, usePageEffects, usePrefetch, usePreloadQuery, usePresence, usePrototypeNavigate, useProvidedWindow, useQueryData, useReducedMotion, useReducedMotionConfig, useRenderEnvironment, useResetProjection, useRoute, useRouteAnchor, useRouteElementId, useRouteHandler, useRouter, useScroll, useSpring, useTime, useTransform, useUnmountEffect, useVariantState, useVelocity, useViewportScroll, useWillChange, ValueInterpolation, valueToDimensionType, VariantSelector, Vector, VectorGroup, version, VisualElement, visualElementStore, warning, WindowContext, withCSS, withFX, withGeneratedLayoutId, withInfiniteScroll, withMappedReactProps, withMeasuredSize, WithNavigator, withOpacity, withOptimizedAppearEffect, WithOverride, withParallaxTransform, withPath, withPerformanceMarks, withShape, withStyleAppearEffect, withVariantAppearEffect, withVariantFX, wrap, };
48245
+ export { _injectRuntime, AcceleratedAnimation, addActionControls, addFonts, addPointerEvent, addPointerInfo, addPropertyControls, addScaleCorrector, AnchorLinkTarget, Animatable, animate2 as animate, animateMini, AnimatePresence, AnimateSharedLayout, animateValue, animateVisualElement, animationControls, animations, annotateTypeOnStringify, anticipate, AnyInterpolation, AutomaticLayoutIds, BackgroundImage, backgroundImageFromProps, backIn, backInOut, backOut, BezierAnimator, BoxShadow, buildTransform, calcLength, calculateRect, callEach, cancelFrame, cancelSync, ChildrenCanSuspend, circIn, circInOut, circOut, clamp, collectVisualStyleFromProps, Color, color, ColorFormat, ColorMixModelType, combinedCSSRulesForPreview, complex, ComponentContainerContext, ComponentPresetsConsumer, ComponentPresetsProvider, ComponentViewportProvider, ConstraintMask, constraintsEnabled, ConstraintValues, Container, ControlType, ConvertColor, convertPresentationTree, convertPropsToDeviceOptions, createBox, createData, createFramerPageLink, createRendererMotionComponent, createScopedAnimate, cssBackgroundSize, cubicBezier, CustomCursorHost, CustomProperties, cx, CycleVariantState, Data, DataContext, DataObserver, DataObserverContext, debounce, defaultDeviceProps, degreesToRadians, delay, DeprecatedComponentContainer, DeprecatedFrameWithEvents, DeprecatedLayoutGroupContext, DeprecatedLayoutGroupContext as LayoutGroupContext, Device, DeviceCodeComponent, devicePresets, DimensionType, disableInstantTransitions, dispatchKeyDownEvent, distance, distance2D, DOM, domAnimation, domMax, domMin, DragControls, Draggable, easeIn, easeInOut, easeOut, EmptyState, environment, ErrorPlaceholder, executeInRenderEnvironment, Fetcher, filterProps, findSpring, finiteNumber, FlatTree, Floating, FontSourceNames, fontStore, forceLayerBackingWithCSSProperties, FormBooleanInput, FormContainer, FormPlainTextInput2 as FormPlainTextInput, FormSelect, fraction, Frame, frame, frameData, frameFromElement, frameFromElements, FramerAnimation, framerAppearAnimationScriptKey, framerAppearEffects, framerAppearIdKey, framerAppearTransformTemplateToken, framerCSSMarker, FramerEvent, FramerEventListener, FramerEventSession, frameSteps, FrameWithMotion, GamepadContext, GeneratedComponentContext, getComponentSize, getDevicePreset, getFonts, getFontsFromComponentPreset, getFontsFromSharedStyle, getLoadingLazyAtYPosition, getMeasurableCodeComponentChildren, getPropertyControls, getWhereExpressionFromPathVariables, gradientForShape, Image2 as Image, imagePatternPropsForFill, imageUrlForAsset, inertia, inferInitialRouteFromPath, injectComponentCSSRules, installFlexboxGapWorkaroundIfNeeded, InternalID, interpolate, invariant, inView, isAnimatable2 as isAnimatable, isBrowser, isDesignDefinition, isDragActive, isEqual, isFiniteNumber, isFractionDimension, isFramerGamepadKeydownData, isFramerPageLink, isGapEnabled, isMotionComponent, isMotionValue2 as isMotionValue, isOfAnnotatedType, isOverride, isReactDefinition, isRelativeNumber, isShallowEqualArray, isStraightCurve, isValidMotionProp, keyframes, Layer, LayoutGroup, LayoutIdContext, lazy, LazyMotion, LazyValue, LibraryFeaturesProvider, Line, LinearGradient, Link, loadFont, loadJSON, localPackageFallbackIdentifier, localShadowFrame, m, MainLoop, makePaddingString, makeUseVisualState, markHydrationStart, memoize2 as memoize, mirrorEasing, mix, modulate, motion, MotionConfig, MotionConfigContext, MotionContext, MotionGlobalConfig, MotionSetup, MotionValue, motionValue, namespace_exports as Reorder, NavigateTo, NavigationCallbackProvider, NavigationConsumer, NavigationTransitionType, NavigationWrapper as Navigation, nestedLinksCollector, NotFoundError, ObservableObject, optimizeAppear, optimizeAppearTransformTemplate, optimizedAppearDataAttribute, paddingFromProps, Page3 as Page, PageEffectsProvider, PageRoot, ParentSizeState, parseFramerPageLink, pathDefaults, PathSegment, PathVariablesContext, pipe, Point, Polygon, preloadImage, PresenceContext, print, progress, PropertyOverrides2 as PropertyOverrides, PropertyStore, propsForLink, pushLoadMoreHistory, px, QueryEngine, RadialGradient, Rect, removeHiddenBreakpointLayers, removeHiddenBreakpointLayersV2, RenderTarget, resolveLink, ResolveLinks, resolveMotionValue, resolvePageScope, reverseEasing, RichText2 as RichText, roundedNumber, roundedNumberString, roundWithOffset, Scroll, scroll, scrollInfo, setGlobalRenderEnvironment, setInitialHydrationState, Shadow, sharedSVGManager, shouldOpenLinkInNewTab, Size, spring, SpringAnimator, SSRVariants, Stack, stagger, startAnimation, startOptimizedAppearAnimation, steps, StyleSheetContext, SVG, SwitchLayoutGroupContext, sync, systemFontFamilyName, Text2 as Text, throttle, toFlexDirection, toJustifyOrAlignment, toSVGPath, transform, transformString2 as transformString, transformTemplate, turnOffReactEventHandling, unwrapMotionComponent, useActiveTargetCallback, useActiveVariantCallback, useAddVariantProps, useAnimate, useAnimatedState, useAnimatedState as useDeprecatedAnimatedState, useAnimateMini, useAnimation, useAnimationControls, useAnimationFrame, useBreakpointVariants, useComponentViewport, useConstant2 as useConstant, useCurrentPathVariables, useCurrentRouteId, useCustomCursors, useCycle, useDataRecord, useDomEvent, useDragControls, useDynamicRefs, useElementScroll, useForceUpdate, useGamepad, useHotkey, useHydratedBreakpointVariants, useInitialRouteComponent, useInstantLayoutTransition, useInstantTransition, useInvertedScale, useInvertedScale as useDeprecatedInvertedScale, useInView, useIsInCurrentNavigationTarget, useIsomorphicLayoutEffect, useIsOnFramerCanvas, useIsPresent, useLoadMorePaginatedQuery, useLocale, useLocaleCode, useLocaleInfo, useLocalizationInfo, useMeasureLayout, useMotionTemplate, useMotionValue, useMotionValueEvent, useNavigate, useNavigation, useObserveData, useOnAppear, useOnCurrentTargetChange, useOnVariantChange, useOverlayState, usePageEffects, usePrefetch, usePreloadQuery, usePresence, usePrototypeNavigate, useProvidedWindow, useQueryData, useReducedMotion, useReducedMotionConfig, useRenderEnvironment, useResetProjection, useRoute, useRouteAnchor, useRouteElementId, useRouteHandler, useRouter, useScroll, useSpring, useTime, useTransform, useUnmountEffect, useVariantState, useVelocity, useViewportScroll, useWillChange, ValueInterpolation, valueToDimensionType, VariantSelector, Vector, VectorGroup, version, VisualElement, visualElementStore, warning, WindowContext, withCSS, withFX, withGeneratedLayoutId, withInfiniteScroll, withMappedReactProps, withMeasuredSize, WithNavigator, withOpacity, withOptimizedAppearEffect, WithOverride, withParallaxTransform, withPath, withPerformanceMarks, withShape, withStyleAppearEffect, withVariantAppearEffect, withVariantFX, wrap, };
50039
48246
  /**
50040
48247
  * @license Emotion v11.0.0
50041
48248
  * MIT License