unframer 3.0.2 → 3.0.5

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 (112) hide show
  1. package/dist/cli.js +1 -0
  2. package/dist/cli.js.map +1 -1
  3. package/dist/cli.test.js +14 -6
  4. package/dist/cli.test.js.map +1 -1
  5. package/dist/example-code.test.js +1 -1
  6. package/dist/exporter.d.ts +0 -14
  7. package/dist/exporter.d.ts.map +1 -1
  8. package/dist/exporter.js +14 -187
  9. package/dist/exporter.js.map +1 -1
  10. package/dist/framer-chunks/fontshare-4J2ZFRBB-H5VQLZTM.d.ts +115 -0
  11. package/dist/framer-chunks/fontshare-4J2ZFRBB-H5VQLZTM.d.ts.map +1 -0
  12. package/dist/framer-chunks/fontshare-4J2ZFRBB-H5VQLZTM.js +8 -0
  13. package/dist/framer-chunks/fontshare-4J2ZFRBB-H5VQLZTM.js.map +1 -0
  14. package/dist/framer-chunks/fontshare-622CVMZZ-HFPH543A.d.ts +781 -0
  15. package/dist/framer-chunks/fontshare-622CVMZZ-HFPH543A.d.ts.map +1 -0
  16. package/dist/framer-chunks/fontshare-622CVMZZ-HFPH543A.js +8 -0
  17. package/dist/framer-chunks/fontshare-622CVMZZ-HFPH543A.js.map +1 -0
  18. package/dist/framer-chunks/fontshare-JGEKH7YN-QOX3MC3K.d.ts +634 -0
  19. package/dist/framer-chunks/fontshare-JGEKH7YN-QOX3MC3K.d.ts.map +1 -0
  20. package/dist/framer-chunks/fontshare-JGEKH7YN-QOX3MC3K.js +8 -0
  21. package/dist/framer-chunks/fontshare-JGEKH7YN-QOX3MC3K.js.map +1 -0
  22. package/dist/framer-chunks/google-3ASCFEEO-3R47BR2A.d.ts +1561 -0
  23. package/dist/framer-chunks/google-3ASCFEEO-3R47BR2A.d.ts.map +1 -0
  24. package/dist/framer-chunks/google-3ASCFEEO-3R47BR2A.js +8 -0
  25. package/dist/framer-chunks/google-3ASCFEEO-3R47BR2A.js.map +1 -0
  26. package/dist/framer-chunks/google-C62SNV32-LCI4F7VO.d.ts +3546 -0
  27. package/dist/framer-chunks/google-C62SNV32-LCI4F7VO.d.ts.map +1 -0
  28. package/dist/framer-chunks/google-C62SNV32-LCI4F7VO.js +8 -0
  29. package/dist/framer-chunks/google-C62SNV32-LCI4F7VO.js.map +1 -0
  30. package/dist/framer-chunks/google-FDB6LUFQ-PFSUZGKF.d.ts +10258 -0
  31. package/dist/framer-chunks/google-FDB6LUFQ-PFSUZGKF.d.ts.map +1 -0
  32. package/dist/framer-chunks/google-FDB6LUFQ-PFSUZGKF.js +8 -0
  33. package/dist/framer-chunks/google-FDB6LUFQ-PFSUZGKF.js.map +1 -0
  34. package/dist/framer.js +1230 -223
  35. package/dist/generated/api-client.js.map +1 -1
  36. package/dist/typescript.d.ts +20 -0
  37. package/dist/typescript.d.ts.map +1 -0
  38. package/dist/typescript.js +169 -0
  39. package/dist/typescript.js.map +1 -0
  40. package/dist/version.d.ts +1 -1
  41. package/dist/version.js +1 -1
  42. package/esm/cli.js +1 -0
  43. package/esm/cli.js.map +1 -1
  44. package/esm/cli.test.js +9 -1
  45. package/esm/cli.test.js.map +1 -1
  46. package/esm/example-code.test.js +1 -1
  47. package/esm/exporter.d.ts +0 -14
  48. package/esm/exporter.d.ts.map +1 -1
  49. package/esm/exporter.js +11 -182
  50. package/esm/exporter.js.map +1 -1
  51. package/esm/framer-chunks/fontshare-4J2ZFRBB-H5VQLZTM.d.ts +115 -0
  52. package/esm/framer-chunks/fontshare-4J2ZFRBB-H5VQLZTM.d.ts.map +1 -0
  53. package/esm/framer-chunks/fontshare-4J2ZFRBB-H5VQLZTM.js +5 -0
  54. package/esm/framer-chunks/fontshare-4J2ZFRBB-H5VQLZTM.js.map +1 -0
  55. package/esm/framer-chunks/fontshare-622CVMZZ-HFPH543A.d.ts +781 -0
  56. package/esm/framer-chunks/fontshare-622CVMZZ-HFPH543A.d.ts.map +1 -0
  57. package/esm/framer-chunks/fontshare-622CVMZZ-HFPH543A.js +5 -0
  58. package/esm/framer-chunks/fontshare-622CVMZZ-HFPH543A.js.map +1 -0
  59. package/esm/framer-chunks/fontshare-JGEKH7YN-QOX3MC3K.d.ts +634 -0
  60. package/esm/framer-chunks/fontshare-JGEKH7YN-QOX3MC3K.d.ts.map +1 -0
  61. package/esm/framer-chunks/fontshare-JGEKH7YN-QOX3MC3K.js +5 -0
  62. package/esm/framer-chunks/fontshare-JGEKH7YN-QOX3MC3K.js.map +1 -0
  63. package/esm/framer-chunks/google-3ASCFEEO-3R47BR2A.d.ts +1561 -0
  64. package/esm/framer-chunks/google-3ASCFEEO-3R47BR2A.d.ts.map +1 -0
  65. package/esm/framer-chunks/google-3ASCFEEO-3R47BR2A.js +5 -0
  66. package/esm/framer-chunks/google-3ASCFEEO-3R47BR2A.js.map +1 -0
  67. package/esm/framer-chunks/google-C62SNV32-LCI4F7VO.d.ts +3546 -0
  68. package/esm/framer-chunks/google-C62SNV32-LCI4F7VO.d.ts.map +1 -0
  69. package/esm/framer-chunks/google-C62SNV32-LCI4F7VO.js +5 -0
  70. package/esm/framer-chunks/google-C62SNV32-LCI4F7VO.js.map +1 -0
  71. package/esm/framer-chunks/google-FDB6LUFQ-PFSUZGKF.d.ts +10258 -0
  72. package/esm/framer-chunks/google-FDB6LUFQ-PFSUZGKF.d.ts.map +1 -0
  73. package/esm/framer-chunks/google-FDB6LUFQ-PFSUZGKF.js +5 -0
  74. package/esm/framer-chunks/google-FDB6LUFQ-PFSUZGKF.js.map +1 -0
  75. package/esm/framer.js +1230 -224
  76. package/esm/generated/api-client.js.map +1 -1
  77. package/esm/typescript.d.ts +20 -0
  78. package/esm/typescript.d.ts.map +1 -0
  79. package/esm/typescript.js +165 -0
  80. package/esm/typescript.js.map +1 -0
  81. package/esm/version.d.ts +1 -1
  82. package/esm/version.js +1 -1
  83. package/package.json +6 -3
  84. package/src/cli.test.ts +8 -1
  85. package/src/cli.ts +1 -1
  86. package/src/example-code.test.ts +1 -1
  87. package/src/exporter.ts +13 -203
  88. package/src/framer-chunks/fontshare-4J2ZFRBB-H5VQLZTM.js +7 -0
  89. package/src/framer-chunks/fontshare-622CVMZZ-HFPH543A.js +7 -0
  90. package/src/framer-chunks/fontshare-JGEKH7YN-QOX3MC3K.js +7 -0
  91. package/src/framer-chunks/google-3ASCFEEO-3R47BR2A.js +7 -0
  92. package/src/framer-chunks/google-C62SNV32-LCI4F7VO.js +7 -0
  93. package/src/framer-chunks/google-FDB6LUFQ-PFSUZGKF.js +7 -0
  94. package/src/framer.js +1170 -215
  95. package/src/generated/api-client.d.ts +790 -1042
  96. package/src/generated/api-client.js +5 -5
  97. package/src/styles/framer.css +1963 -0
  98. package/src/styles/reset.css +37 -0
  99. package/src/typescript.ts +196 -0
  100. package/src/version.ts +1 -1
  101. package/dist/generated/api-client.test.d.ts +0 -2
  102. package/dist/generated/api-client.test.d.ts.map +0 -1
  103. package/dist/generated/api-client.test.js +0 -3
  104. package/dist/generated/api-client.test.js.map +0 -1
  105. package/esm/generated/api-client.test.d.ts +0 -1
  106. package/esm/generated/api-client.test.d.ts.map +0 -1
  107. package/esm/generated/api-client.test.js +0 -2
  108. package/esm/generated/api-client.test.js.map +0 -1
  109. package/src/generated/api-client.d.ts.map +0 -1
  110. package/src/generated/api-client.js.map +0 -1
  111. package/src/generated/api-client.test.d.ts +0 -1
  112. package/src/generated/api-client.test.js +0 -1
package/src/framer.js CHANGED
@@ -11214,7 +11214,7 @@ function stagger(duration = 0.1, {
11214
11214
  };
11215
11215
  }
11216
11216
 
11217
- // /:https://app.framerstatic.com/framer.6HDYDFRL.mjs
11217
+ // /:https://app.framerstatic.com/framer.Q6KVMOJP.mjs
11218
11218
  import { lazy as ReactLazy, } from 'react';
11219
11219
  import React4 from 'react';
11220
11220
  import { startTransition as startTransition2, } from 'react';
@@ -13667,7 +13667,7 @@ function usePopStateHandler(currentRouteId, setCurrentRouteId,) {
13667
13667
  updateCanonicalURL(window.location.href,);
13668
13668
  }, [currentRouteId, monitorNextPaintAfterRender, setCurrentRouteId, startViewTransition2,],);
13669
13669
  const traversalHandler = useCallback((event) => {
13670
- if (event.navigationType !== 'traverse') return;
13670
+ if (event.navigationType !== 'traverse' || !event.canIntercept) return;
13671
13671
  event.intercept({
13672
13672
  async handler() {
13673
13673
  await new Promise((resolve, reject,) => {
@@ -13792,7 +13792,7 @@ function useNativeLoadingSpinner() {
13792
13792
  const navigationPromise = useRef3(Promise.resolve(),);
13793
13793
  const navigationController = useRef3();
13794
13794
  const navigateListener = useCallback((navigateEvent) => {
13795
- if (navigateEvent.navigationType === 'traverse') return;
13795
+ if (navigateEvent.navigationType === 'traverse' || !navigateEvent.canIntercept) return;
13796
13796
  const controller = navigationController.current;
13797
13797
  controller == null ? void 0 : controller.signal.addEventListener('abort', () => {
13798
13798
  controller.abort('user aborted',);
@@ -13815,6 +13815,36 @@ function useNativeLoadingSpinner() {
13815
13815
  },);
13816
13816
  }, [navigateListener,],);
13817
13817
  }
13818
+ var nonSlugCharactersRegExp = /[^\p{Letter}\p{Number}()]+/gu;
13819
+ var trimSlugRegExp = /^-+|-+$/gu;
13820
+ function slugify(value,) {
13821
+ return value.toLowerCase().replace(nonSlugCharactersRegExp, '-',).replace(trimSlugRegExp, '',);
13822
+ }
13823
+ var NodeIdContext = /* @__PURE__ */ React4.createContext(null,);
13824
+ function useTracking() {
13825
+ const router = useRouter();
13826
+ const nodeId = useContext(NodeIdContext,);
13827
+ return useCallback((trackingId) => {
13828
+ var _a;
13829
+ if (!((_a = router.pageviewEventData) == null ? void 0 : _a.current)) return;
13830
+ if (slugify(trackingId,) !== trackingId) {
13831
+ throw new Error(`Invalid tracking ID: ${trackingId}`,);
13832
+ }
13833
+ if (router.pageviewEventData.current instanceof Promise) {
13834
+ void router.pageviewEventData.current.then((eventData) => sendCustomTrackingEvent(eventData, nodeId, trackingId,));
13835
+ } else {
13836
+ sendCustomTrackingEvent(router.pageviewEventData.current, nodeId, trackingId,);
13837
+ }
13838
+ }, [router, nodeId,],);
13839
+ }
13840
+ function sendCustomTrackingEvent(eventData, nodeId, trackingId,) {
13841
+ sendTrackingEvent('published_site_custom_event', {
13842
+ ...eventData,
13843
+ nodeId,
13844
+ // Don't attach a tracking ID if it's empty
13845
+ trackingId: trackingId || null,
13846
+ }, 'eager',);
13847
+ }
13818
13848
  function useRouteAnchor(routeId, {
13819
13849
  elementId,
13820
13850
  hash: linkHash,
@@ -22990,6 +23020,7 @@ var isPropValid = /* @__PURE__ */ memoize((prop) =>
22990
23020
  /* Z+1 */
22991
23021
  );
22992
23022
  var LibraryFeaturesContext = /* @__PURE__ */ React4.createContext(void 0,);
23023
+ LibraryFeaturesContext.displayName = 'LibraryFeaturesContext';
22993
23024
  var LibraryFeaturesProvider = /* @__PURE__ */ (() => LibraryFeaturesContext.Provider)();
22994
23025
  var useLibraryFeatures = () => {
22995
23026
  const context = React4.useContext(LibraryFeaturesContext,);
@@ -23004,16 +23035,22 @@ var mockWithoutWarning = () => {
23004
23035
  return () => {};
23005
23036
  };
23006
23037
  var implementation = {
23007
- // We need a default implementation for useImageSource and useImageElement as it is used for rendering image backgrounds which would break otherwise.
23008
- // The default value is used for HTML export and when using the library without Framer.
23038
+ // We need a default implementation for useImageSource and useImageElement as it is used for
23039
+ // rendering image backgrounds which would break otherwise. The default value is used for HTML
23040
+ // export and when using the library without Framer.
23041
+ imagePlaceholderSvg:
23042
+ `<svg xmlns="http://www.w3.org/2000/svg" width="126" height="126"><path id="a" d="M126 0v21.584L21.584 126H0v-17.585L108.415 0H126Zm0 108.414V126h-17.586L126 108.414Zm0-84v39.171L63.585 126H24.414L126 24.414Zm0 42v39.17L105.584 126h-39.17L126 66.414ZM105.586 0 0 105.586V66.415L66.415 0h39.171Zm-42 0L0 63.586V24.415L24.415 0h39.171Zm-42 0L0 21.586V0h21.586Z" fill="rgb(136, 136, 136, 0.2)" fill-rule="evenodd"/></svg>`,
23009
23043
  useImageSource(image,) {
23010
23044
  return image.src ?? '';
23011
23045
  },
23012
23046
  useImageElement(image, rect, nodeId,) {
23013
- const element = new Image();
23014
- element.src = runtime.useImageSource(image, rect, nodeId,);
23015
- if (image.srcSet) element.srcset = image.srcSet;
23016
- return element;
23047
+ const src = runtime.useImageSource(image, rect, nodeId,);
23048
+ return useMemo2(() => {
23049
+ const element = new Image();
23050
+ element.src = src;
23051
+ if (image.srcSet) element.srcset = image.srcSet;
23052
+ return element;
23053
+ }, [src, image.srcSet,],);
23017
23054
  },
23018
23055
  canRenderOptimizedCanvasImage() {
23019
23056
  return false;
@@ -23048,16 +23085,12 @@ var wrapperStyle = {
23048
23085
  left: 0,
23049
23086
  };
23050
23087
  function getPlaceholderStyle() {
23051
- const placeholderStyle = {
23088
+ return {
23052
23089
  backgroundRepeat: 'repeat',
23053
23090
  backgroundPosition: 'left top',
23054
- backgroundSize: '126px auto',
23055
- backgroundImage: encodeSVGForCSS(
23056
- `<svg xmlns="http://www.w3.org/2000/svg" width="126" height="126"><path id="a" d="M126 0v21.584L21.584 126H0v-17.585L108.415 0H126Zm0 108.414V126h-17.586L126 108.414Zm0-84v39.171L63.585 126H24.414L126 24.414Zm0 42v39.17L105.584 126h-39.17L126 66.414ZM105.586 0 0 105.586V66.415L66.415 0h39.171Zm-42 0L0 63.586V24.415L24.415 0h39.171Zm-42 0L0 21.586V0h21.586Z" fill="#888" fill-rule="evenodd"/></svg>`,
23057
- ),
23058
- opacity: 0.2,
23091
+ backgroundSize: '64px auto',
23092
+ backgroundImage: encodeSVGForCSS(runtime.imagePlaceholderSvg,),
23059
23093
  };
23060
- return placeholderStyle;
23061
23094
  }
23062
23095
  function cssObjectFit(imageFit,) {
23063
23096
  switch (imageFit) {
@@ -32092,7 +32125,7 @@ function useLoop({
32092
32125
  const shouldReduceMotion = useReducedMotionConfig();
32093
32126
  const values = useConstant2(makeFXValues,);
32094
32127
  const mirrorStateRef = useRef3(false,);
32095
- const delay2 = useDelay();
32128
+ const delay3 = useDelay();
32096
32129
  const animationPromiseRef = useRef3(null,);
32097
32130
  const animateValues = useCallback(async () => {
32098
32131
  if (!loop) return;
@@ -32122,9 +32155,9 @@ function useLoop({
32122
32155
  const animateLoop = useCallback(async () => {
32123
32156
  if (!loopEffectEnabled || !shouldRunRef.current) return;
32124
32157
  await animateValues();
32125
- await delay2(loopRepeatDelay ?? 0,);
32158
+ await delay3(loopRepeatDelay ?? 0,);
32126
32159
  void animateLoop();
32127
- }, [animateValues, delay2, loopEffectEnabled, loopRepeatDelay,],);
32160
+ }, [animateValues, delay3, loopEffectEnabled, loopRepeatDelay,],);
32128
32161
  const start2 = useCallback(() => {
32129
32162
  if (shouldRunRef.current) return;
32130
32163
  shouldRunRef.current = true;
@@ -33465,12 +33498,15 @@ var ContainerInner = /* @__PURE__ */ React4.forwardRef(({
33465
33498
  ref,
33466
33499
  children: /* @__PURE__ */ jsx3(ComponentContainerContext.Provider, {
33467
33500
  value: true,
33468
- children: /* @__PURE__ */ jsx3(AutomaticLayoutIds, {
33469
- enabled: false,
33470
- children: /* @__PURE__ */ jsx3(LayoutGroup, {
33471
- id: layoutId ?? '',
33472
- inherit: 'id',
33473
- children: childrenWithCodeBoundary,
33501
+ children: /* @__PURE__ */ jsx3(NodeIdContext.Provider, {
33502
+ value: nodeId ?? null,
33503
+ children: /* @__PURE__ */ jsx3(AutomaticLayoutIds, {
33504
+ enabled: false,
33505
+ children: /* @__PURE__ */ jsx3(LayoutGroup, {
33506
+ id: layoutId ?? '',
33507
+ inherit: 'id',
33508
+ children: childrenWithCodeBoundary,
33509
+ },),
33474
33510
  },),
33475
33511
  },),
33476
33512
  },),
@@ -33502,11 +33538,14 @@ var SmartComponentScopedContainer = /* @__PURE__ */ React4.forwardRef((props, re
33502
33538
  const tagName = props.as ?? 'div';
33503
33539
  if (props.rendersWithMotion) {
33504
33540
  const Component17 = htmlElementAsMotionComponent(tagName,);
33505
- return /* @__PURE__ */ jsx3(Component17, {
33506
- ...otherProps,
33507
- ref,
33508
- style: props.style,
33509
- children: childrenWithCodeBoundary,
33541
+ return /* @__PURE__ */ jsx3(NodeIdContext.Provider, {
33542
+ value: nodeId ?? null,
33543
+ children: /* @__PURE__ */ jsx3(Component17, {
33544
+ ...otherProps,
33545
+ ref,
33546
+ style: props.style,
33547
+ children: childrenWithCodeBoundary,
33548
+ },),
33510
33549
  },);
33511
33550
  } else {
33512
33551
  const Component17 = tagName;
@@ -33515,17 +33554,15 @@ var SmartComponentScopedContainer = /* @__PURE__ */ React4.forwardRef((props, re
33515
33554
  layoutDependency,
33516
33555
  ...plainHTMLRenderableProps
33517
33556
  } = otherProps;
33518
- return (
33519
- // Passing `props.style` explicitly to allow TypeScript to narrow the type of `props.style` according
33520
- // to the value of `props.rendersWithMotion`.
33521
- /* @__PURE__ */
33522
- jsx3(Component17, {
33557
+ return /* @__PURE__ */ jsx3(NodeIdContext.Provider, {
33558
+ value: nodeId ?? null,
33559
+ children: /* @__PURE__ */ jsx3(Component17, {
33523
33560
  ...plainHTMLRenderableProps,
33524
33561
  ref,
33525
33562
  style: props.style,
33526
33563
  children: childrenWithCodeBoundary,
33527
- },)
33528
- );
33564
+ },),
33565
+ },);
33529
33566
  }
33530
33567
  },);
33531
33568
  var CustomCursorContext = /* @__PURE__ */ createContext({
@@ -33786,18 +33823,20 @@ var CustomCursorComponent = /* @__PURE__ */ memo2(function CustomCursorComponent
33786
33823
  placement,
33787
33824
  ],);
33788
33825
  if (!hasHoverCapability || !cursor || !Cursor) return null;
33789
- return /* @__PURE__ */ jsx3(Cursor, {
33790
- transformTemplate: transformTemplate2,
33791
- style: {
33792
- ...staticCursorStyle,
33793
- x,
33794
- y,
33795
- opacity,
33796
- },
33797
- globalTapTarget: true,
33798
- variant: cursor == null ? void 0 : cursor.variant,
33799
- ref: cursorRef,
33800
- className: cursorComponentClassName,
33826
+ return /* @__PURE__ */ jsx3(Suspense2, {
33827
+ children: /* @__PURE__ */ jsx3(Cursor, {
33828
+ transformTemplate: transformTemplate2,
33829
+ style: {
33830
+ ...staticCursorStyle,
33831
+ x,
33832
+ y,
33833
+ opacity,
33834
+ },
33835
+ globalTapTarget: true,
33836
+ variant: cursor == null ? void 0 : cursor.variant,
33837
+ ref: cursorRef,
33838
+ className: cursorComponentClassName,
33839
+ },),
33801
33840
  },);
33802
33841
  },);
33803
33842
  function useCustomCursors(webPageCursors,) {
@@ -34561,6 +34600,10 @@ var LazyValue = class _LazyValue {
34561
34600
  static is(value,) {
34562
34601
  return value instanceof _LazyValue;
34563
34602
  }
34603
+ get state() {
34604
+ var _a;
34605
+ return ((_a = this.status) == null ? void 0 : _a.type) ?? 'pending';
34606
+ }
34564
34607
  /** Preload the value so it can be read() later. */
34565
34608
  preload() {
34566
34609
  if (this.status) {
@@ -35308,14 +35351,16 @@ function useTrackLinkClick({
35308
35351
  return useCallback(async (hrefAttribute) => {
35309
35352
  var _a, _b, _c, _d, _e;
35310
35353
  if (!((_a = router.pageviewEventData) == null ? void 0 : _a.current)) return;
35311
- const pageviewEventData = router.pageviewEventData.current;
35354
+ const pageviewEventData = router.pageviewEventData.current instanceof Promise
35355
+ ? await router.pageviewEventData.current
35356
+ : router.pageviewEventData.current;
35312
35357
  const pageLink = isLinkToWebPage(href,) ? href : linkFromFramerPageLink(href,);
35313
35358
  if (!isLinkToWebPage(pageLink,)) {
35314
35359
  return sendTrackingEvent('published_site_click', {
35315
35360
  ...pageviewEventData,
35316
35361
  href: hrefAttribute ? makeUrlAbsolute(hrefAttribute,) : null,
35317
35362
  nodeId: nodeId ?? null,
35318
- trackingId: clickTrackingId ?? null,
35363
+ trackingId: clickTrackingId || null,
35319
35364
  targetRoutePath: null,
35320
35365
  targetWebPageId: null,
35321
35366
  targetCollectionItemId: null,
@@ -35764,13 +35809,20 @@ function trackFormSubmit({
35764
35809
  },) {
35765
35810
  var _a;
35766
35811
  if (!((_a = router == null ? void 0 : router.pageviewEventData) == null ? void 0 : _a.current)) return;
35767
- const pageviewEventData = router.pageviewEventData.current;
35768
- const eventData = {
35812
+ if (router.pageviewEventData.current instanceof Promise) {
35813
+ void router.pageviewEventData.current.then((pageviewEventData) => {
35814
+ sendFormSubmitTrackingEvent(pageviewEventData, nodeId, submitTrackingId,);
35815
+ },);
35816
+ } else {
35817
+ sendFormSubmitTrackingEvent(router.pageviewEventData.current, nodeId, submitTrackingId,);
35818
+ }
35819
+ }
35820
+ function sendFormSubmitTrackingEvent(pageviewEventData, nodeId, trackingId,) {
35821
+ return sendTrackingEvent('published_site_form_submit', {
35769
35822
  ...pageviewEventData,
35770
35823
  nodeId: nodeId ?? null,
35771
- trackingId: submitTrackingId ?? null,
35772
- };
35773
- return sendTrackingEvent('published_site_form_submit', eventData, 'eager',);
35824
+ trackingId: trackingId || null,
35825
+ }, 'eager',);
35774
35826
  }
35775
35827
  var pendingState = {
35776
35828
  state: 'pending',
@@ -36055,17 +36107,23 @@ var useSendPageView = (currentRoute, currentRouteId, currentPathVariables, colle
36055
36107
  },);
36056
36108
  };
36057
36109
  void (async () => {
36058
- pageviewEventData.current = await getFullPageviewEventData();
36110
+ const pageviewEventDataPromise = getFullPageviewEventData();
36111
+ pageviewEventData.current = pageviewEventDataPromise;
36059
36112
  if (skipFirstPageView.current) {
36060
36113
  skipFirstPageView.current = false;
36061
36114
  return;
36062
36115
  }
36063
- sendTrackingEvent('published_site_pageview', pageviewEventData.current, 'eager',);
36116
+ const eventData = await pageviewEventDataPromise;
36117
+ pageviewEventData.current = eventData;
36118
+ sendTrackingEvent('published_site_pageview', eventData, 'eager',);
36064
36119
  })();
36065
36120
  const listener = async (event) => {
36066
36121
  if (event.persisted) {
36067
- pageviewEventData.current = await getFullPageviewEventData();
36068
- sendTrackingEvent('published_site_pageview', pageviewEventData.current, 'eager',);
36122
+ const pageviewEventDataPromise = getFullPageviewEventData();
36123
+ pageviewEventData.current = pageviewEventDataPromise;
36124
+ const eventData = await getFullPageviewEventData();
36125
+ pageviewEventData.current = eventData;
36126
+ sendTrackingEvent('published_site_pageview', eventData, 'eager',);
36069
36127
  }
36070
36128
  };
36071
36129
  window.addEventListener('pageshow', listener,);
@@ -36174,6 +36232,15 @@ function Router({
36174
36232
  const scheduleSideEffect = useScheduleRenderSideEffects(dep,);
36175
36233
  const startNavigation = useNavigationTransition();
36176
36234
  const monitorNextPaintAfterRender = useMonitorNextPaintAfterRender('framer-route-change',);
36235
+ const {
36236
+ synchronousNavigationOnDesktop,
36237
+ } = useLibraryFeatures();
36238
+ const transitionFn = useMemo2(() => {
36239
+ if (!synchronousNavigationOnDesktop || !isDesktop()) {
36240
+ return startTransition2;
36241
+ }
36242
+ return (fn) => fn();
36243
+ }, [synchronousNavigationOnDesktop,],);
36177
36244
  const isInitialNavigationRef = useRef3(true,);
36178
36245
  const currentRouteRef = useRef3(initialRoute,);
36179
36246
  const currentPathVariablesRef = useRef3(initialPathVariables,);
@@ -36247,7 +36314,7 @@ function Router({
36247
36314
  };
36248
36315
  void startNavigation(
36249
36316
  () => {
36250
- void startViewTransition2(currentRouteId2, currentRouteId2, () => startTransition2(forceUpdate,),// no signal here, because we update the refs above immediately
36317
+ void startViewTransition2(currentRouteId2, currentRouteId2, () => transitionFn(forceUpdate,),// no signal here, because we update the refs above immediately
36251
36318
  );
36252
36319
  },
36253
36320
  nextRender,
@@ -36267,6 +36334,7 @@ function Router({
36267
36334
  startNavigation,
36268
36335
  startViewTransition2,
36269
36336
  monitorNextPaintAfterRender,
36337
+ transitionFn,
36270
36338
  ],);
36271
36339
  const setCurrentRouteId = useCallback(
36272
36340
  (routeId, localeId, hash2, pathVariables, isHistoryTransition, nextRender, smoothScroll = false, updateURL,) => {
@@ -36279,19 +36347,19 @@ function Router({
36279
36347
  updateScrollPosition(hash2, smoothScroll, isHistoryTransition,);
36280
36348
  },);
36281
36349
  if (isHistoryTransition) {
36282
- startTransition2(forceUpdate,);
36350
+ transitionFn(forceUpdate,);
36283
36351
  return;
36284
36352
  }
36285
36353
  void startNavigation(
36286
36354
  (signal) => {
36287
- void startViewTransition2(currentRouteId2, routeId, () => startTransition2(forceUpdate,), signal,);
36355
+ void startViewTransition2(currentRouteId2, routeId, () => transitionFn(forceUpdate,), signal,);
36288
36356
  },
36289
36357
  nextRender,
36290
36358
  updateURL,
36291
36359
  true,
36292
36360
  );
36293
36361
  },
36294
- [forceUpdate, scheduleSideEffect, startNavigation, startViewTransition2,],
36362
+ [forceUpdate, scheduleSideEffect, startNavigation, startViewTransition2, transitionFn,],
36295
36363
  );
36296
36364
  usePopStateHandler(currentRouteRef, setCurrentRouteId,);
36297
36365
  const navigate = useCallback(async (routeId, hash2, pathVariables, smoothScroll, beforeUrlUpdate,) => {
@@ -41677,17 +41745,31 @@ ${stringifyQuery(query,)}`,);
41677
41745
  }
41678
41746
  };
41679
41747
  var QueryCache = class {
41680
- constructor(queryEngine2,) {
41748
+ constructor(queryEngine2, maxSize = Infinity,) {
41681
41749
  this.queryEngine = queryEngine2;
41750
+ this.maxSize = maxSize;
41682
41751
  __publicField(this, 'cache', /* @__PURE__ */ new Map(),);
41683
41752
  }
41753
+ prune() {
41754
+ if (this.cache.size <= this.maxSize) return;
41755
+ for (const [key7, value,] of this.cache) {
41756
+ if (this.cache.size <= this.maxSize) break;
41757
+ if (value.state === 'pending') continue;
41758
+ this.cache.delete(key7,);
41759
+ }
41760
+ }
41684
41761
  get(query, locale,) {
41685
41762
  const key7 = getCacheKey(query, locale,);
41686
41763
  const existing = this.cache.get(key7,);
41687
- if (existing) return existing;
41764
+ if (existing) {
41765
+ this.cache.delete(key7,);
41766
+ this.cache.set(key7, existing,);
41767
+ return existing;
41768
+ }
41688
41769
  const resolver = () => this.queryEngine.query(query, locale,);
41689
41770
  const value = new LazyValue(resolver,);
41690
41771
  this.cache.set(key7, value,);
41772
+ this.prune();
41691
41773
  return value;
41692
41774
  }
41693
41775
  };
@@ -42909,15 +42991,18 @@ function withCodeBoundaryForOverrides(Component17, {
42909
42991
  );
42910
42992
  if (shouldWrapWithBoundary) {
42911
42993
  if (appliedOverride.status === 'success') {
42912
- return /* @__PURE__ */ jsx3(CodeComponentBoundary, {
42913
- getErrorMessage: getErrorMessageForOverride.bind(null, scopeId, nodeId,),
42914
- fallback: /* @__PURE__ */ jsx3(Component17, {
42915
- ...props,
42916
- ref,
42917
- },),
42918
- children: /* @__PURE__ */ jsx3(appliedOverride.Component, {
42919
- ...props,
42920
- ref,
42994
+ return /* @__PURE__ */ jsx3(NodeIdContext.Provider, {
42995
+ value: nodeId,
42996
+ children: /* @__PURE__ */ jsx3(CodeComponentBoundary, {
42997
+ getErrorMessage: getErrorMessageForOverride.bind(null, scopeId, nodeId,),
42998
+ fallback: /* @__PURE__ */ jsx3(Component17, {
42999
+ ...props,
43000
+ ref,
43001
+ },),
43002
+ children: /* @__PURE__ */ jsx3(appliedOverride.Component, {
43003
+ ...props,
43004
+ ref,
43005
+ },),
42921
43006
  },),
42922
43007
  },);
42923
43008
  } else {
@@ -42934,9 +43019,12 @@ function withCodeBoundaryForOverrides(Component17, {
42934
43019
  }
42935
43020
  } else {
42936
43021
  if (appliedOverride.status === 'success') {
42937
- return /* @__PURE__ */ jsx3(appliedOverride.Component, {
42938
- ...props,
42939
- ref,
43022
+ return /* @__PURE__ */ jsx3(NodeIdContext.Provider, {
43023
+ value: nodeId,
43024
+ children: /* @__PURE__ */ jsx3(appliedOverride.Component, {
43025
+ ...props,
43026
+ ref,
43027
+ },),
42940
43028
  },);
42941
43029
  } else {
42942
43030
  throw appliedOverride.error;
@@ -43957,6 +44045,736 @@ function createFontFamilyName(font,) {
43957
44045
  function createVariableFontFamilyName(familyName,) {
43958
44046
  return `${familyName} Variable`;
43959
44047
  }
44048
+ function assert2(condition, ...msg) {
44049
+ var _a, _b;
44050
+ if (condition) return;
44051
+ const e = Error('Assertion Error' + (msg.length > 0 ? ': ' + msg.join(' ',) : ''),);
44052
+ if (e.stack) {
44053
+ try {
44054
+ const lines = e.stack.split('\n',);
44055
+ if ((_a = lines[1]) == null ? void 0 : _a.includes('assert',)) {
44056
+ lines.splice(1, 1,);
44057
+ e.stack = lines.join('\n',);
44058
+ } else if ((_b = lines[0]) == null ? void 0 : _b.includes('assert',)) {
44059
+ lines.splice(0, 1,);
44060
+ e.stack = lines.join('\n',);
44061
+ }
44062
+ } catch {}
44063
+ }
44064
+ throw e;
44065
+ }
44066
+ var missing = Symbol('missing',);
44067
+ var frozenEmptyArray = Object.freeze([],);
44068
+ var errorReporter;
44069
+ function reportError({
44070
+ error: maybeError,
44071
+ tags,
44072
+ extras,
44073
+ critical,
44074
+ caller,
44075
+ },) {
44076
+ assert2(errorReporter, 'Set up an error callback with setErrorReporter, or configure Sentry with initializeEnvironment',);
44077
+ const error = reportableError(maybeError, caller,);
44078
+ errorReporter({
44079
+ error,
44080
+ tags: {
44081
+ ...error.tags,
44082
+ ...tags,
44083
+ },
44084
+ extras: {
44085
+ ...error.extras,
44086
+ ...extras,
44087
+ },
44088
+ critical: !!critical,
44089
+ },);
44090
+ return error;
44091
+ }
44092
+ function reportableError(error, caller = reportableError,) {
44093
+ if (error instanceof Error) {
44094
+ return error;
44095
+ }
44096
+ return new UnhandledError(error, caller,);
44097
+ }
44098
+ var UnhandledError = class extends Error {
44099
+ constructor(error, caller,) {
44100
+ const message = error ? JSON.stringify(error,) : 'No error message provided';
44101
+ super(message,);
44102
+ this.message = message;
44103
+ if (caller && Error.captureStackTrace) {
44104
+ Error.captureStackTrace(this, caller,);
44105
+ } else {
44106
+ try {
44107
+ throw new Error();
44108
+ } catch (e) {
44109
+ this.stack = e.stack;
44110
+ }
44111
+ }
44112
+ }
44113
+ };
44114
+ var hostname = typeof window !== 'undefined' ? window.location.hostname : void 0;
44115
+ var isLocal = Boolean(hostname && ['web.framerlocal.com', 'localhost', '127.0.0.1', '[::1]',].includes(hostname,),);
44116
+ var hosts = (() => {
44117
+ if (!hostname) return;
44118
+ if (isLocal) {
44119
+ return {
44120
+ main: hostname,
44121
+ previewLink: void 0,
44122
+ };
44123
+ }
44124
+ const previewHostRegex = /^(([^.]+\.)?beta\.)?((?:development\.)?framer\.com)$/u;
44125
+ const match = hostname.match(previewHostRegex,);
44126
+ if (!match || !match[3]) return;
44127
+ return {
44128
+ previewLink: match[2] && match[0],
44129
+ main: match[3],
44130
+ };
44131
+ })();
44132
+ var hostInfo = {
44133
+ hosts,
44134
+ isDevelopment: (hosts == null ? void 0 : hosts.main) === 'development.framer.com',
44135
+ isProduction: (hosts == null ? void 0 : hosts.main) === 'framer.com',
44136
+ isLocal,
44137
+ };
44138
+ var cachedServiceMap;
44139
+ function getServiceMap() {
44140
+ if (typeof window === 'undefined') return {};
44141
+ if (cachedServiceMap) return cachedServiceMap;
44142
+ cachedServiceMap = extractServiceMap();
44143
+ return cachedServiceMap;
44144
+ }
44145
+ function extractServiceMap() {
44146
+ var _a, _b, _c;
44147
+ const location = window.location;
44148
+ let services = (_a = window == null ? void 0 : window.bootstrap) == null ? void 0 : _a.services;
44149
+ if (services) {
44150
+ return services;
44151
+ }
44152
+ let topOrigin;
44153
+ try {
44154
+ const topWindow = window.top;
44155
+ topOrigin = topWindow.location.origin;
44156
+ services = (_c = (_b = window.top) == null ? void 0 : _b.bootstrap) == null ? void 0 : _c.services;
44157
+ if (services) {
44158
+ return services;
44159
+ }
44160
+ } catch (e) {}
44161
+ if (topOrigin && topOrigin !== location.origin) {
44162
+ throw Error(`Unexpectedly embedded by ${topOrigin} (expected ${location.origin})`,);
44163
+ }
44164
+ if (location.origin.endsWith('framer.com',) || location.origin.endsWith('framer.dev',)) {
44165
+ throw Error('ServiceMap data was not provided in document',);
44166
+ }
44167
+ try {
44168
+ const servicesJSON = new URLSearchParams(location.search,).get('services',) ||
44169
+ new URLSearchParams(location.hash.substring(1,),).get('services',);
44170
+ if (servicesJSON) {
44171
+ services = JSON.parse(servicesJSON,);
44172
+ }
44173
+ } catch (e) {}
44174
+ if (services && typeof services === 'object' && services.api) {
44175
+ return services;
44176
+ }
44177
+ throw Error('ServiceMap requested but not available',);
44178
+ }
44179
+ function jsonSafeCopy(obj, depth = 0, seen = /* @__PURE__ */ new Set(),) {
44180
+ var _a;
44181
+ if (obj === null) return obj;
44182
+ if (typeof obj === 'function') return `[Function: ${obj.name ?? 'unknown'}]`;
44183
+ if (typeof obj !== 'object') return obj;
44184
+ if (obj instanceof Error) return `[${obj.toString()}]`;
44185
+ if (seen.has(obj,)) return '[Circular]';
44186
+ if (depth > 2) return '...';
44187
+ seen.add(obj,);
44188
+ try {
44189
+ if ('toJSON' in obj && typeof obj.toJSON === 'function') {
44190
+ return jsonSafeCopy(obj.toJSON(), depth + 1, seen,);
44191
+ } else if (Array.isArray(obj,)) {
44192
+ return obj.map((v) => jsonSafeCopy(v, depth + 1, seen,));
44193
+ } else if (Object.getPrototypeOf(obj,) !== Object.prototype) {
44194
+ return `[Object: ${'__class' in obj && obj.__class || ((_a = obj.constructor) == null ? void 0 : _a.name)}]`;
44195
+ } else {
44196
+ const result = {};
44197
+ for (const [key7, v,] of Object.entries(obj,)) {
44198
+ result[key7] = jsonSafeCopy(v, depth + 1, seen,);
44199
+ }
44200
+ return result;
44201
+ }
44202
+ } catch (e) {
44203
+ return `[Throws: ${e instanceof Error ? e.message : e}]`;
44204
+ } finally {
44205
+ seen.delete(obj,);
44206
+ }
44207
+ }
44208
+ var levelNames = ['trace', 'debug', 'info', 'warn', 'error',];
44209
+ var postfixNames = [':trace', ':debug', ':info', ':warn', ':error',];
44210
+ function applyLogLevelSpec(spec, all,) {
44211
+ const missingSpecs = [];
44212
+ for (const s of spec.split(/[ ,]/u,)) {
44213
+ let match = s.trim();
44214
+ if (match.length === 0) continue;
44215
+ let level = 1;
44216
+ let inverted = false;
44217
+ if (match.startsWith('-',)) {
44218
+ match = match.slice(1,);
44219
+ level = 3;
44220
+ inverted = true;
44221
+ }
44222
+ for (let i = 0; i <= 4; i++) {
44223
+ const postfix = postfixNames[i];
44224
+ if (!postfix) continue;
44225
+ if (match.endsWith(postfix,)) {
44226
+ level = i;
44227
+ if (inverted) {
44228
+ level += 1;
44229
+ }
44230
+ match = match.slice(0, match.length - postfix.length,);
44231
+ if (match.length === 0) {
44232
+ match = '*';
44233
+ }
44234
+ break;
44235
+ }
44236
+ }
44237
+ const regex2 = new RegExp('^' + escapeRegExp(match,).replace(/\\\*/gu, '.*',) + '$',);
44238
+ let loggersUpdated = 0;
44239
+ for (const logger of all) {
44240
+ if (logger.id.match(regex2,)) {
44241
+ logger.level = level;
44242
+ ++loggersUpdated;
44243
+ }
44244
+ }
44245
+ if (loggersUpdated === 0) {
44246
+ missingSpecs.push(s,);
44247
+ }
44248
+ }
44249
+ return missingSpecs;
44250
+ }
44251
+ var _LogEntry = class _LogEntry2 {
44252
+ constructor(logger, level, parts,) {
44253
+ this.logger = logger;
44254
+ this.level = level;
44255
+ this.parts = parts;
44256
+ __publicField(this, 'id',);
44257
+ __publicField(this, 'time',);
44258
+ __publicField(this, 'stringPrefix',);
44259
+ this.id = _LogEntry2.nextId++;
44260
+ this.time = Date.now();
44261
+ }
44262
+ toMessage() {
44263
+ if (this.stringPrefix) return this.parts;
44264
+ const r = [new Date(this.time,).toISOString().substr(-14, 14,), levelNames[this.level] + ': [' + this.logger.id + ']',];
44265
+ let i = 0;
44266
+ for (; i < this.parts.length; i++) {
44267
+ const part = this.parts[i];
44268
+ if (typeof part === 'string') {
44269
+ r.push(part,);
44270
+ continue;
44271
+ }
44272
+ break;
44273
+ }
44274
+ this.stringPrefix = r.join(' ',);
44275
+ this.parts.splice(0, i, this.stringPrefix,);
44276
+ return this.parts;
44277
+ }
44278
+ toString() {
44279
+ return this.toMessage().map((part) => {
44280
+ const type = typeof part;
44281
+ if (type === 'string') return part;
44282
+ if (type === 'function') return `[Function: ${part.name ?? 'unknown'}]`;
44283
+ if (part instanceof Error) return part.stack ?? part.toString();
44284
+ const json = JSON.stringify(jsonSafeCopy(part,),);
44285
+ if ((json == null ? void 0 : json.length) > 253) {
44286
+ return json.slice(0, 250,) + '...';
44287
+ }
44288
+ return json;
44289
+ },).join(' ',);
44290
+ }
44291
+ };
44292
+ __publicField(_LogEntry, 'nextId', 0,);
44293
+ var LogEntry = _LogEntry;
44294
+ var logLevelSpec = '*:app:info,app:info';
44295
+ var isNode = typeof process !== 'undefined' && !!process.kill;
44296
+ var isCI = isNode && false;
44297
+ if (isCI) {
44298
+ logLevelSpec = '-:warn';
44299
+ } else if (isNode) {
44300
+ logLevelSpec = '';
44301
+ }
44302
+ try {
44303
+ if (typeof window !== 'undefined' && window.localStorage) {
44304
+ logLevelSpec = window.localStorage.logLevel || logLevelSpec;
44305
+ }
44306
+ } catch {}
44307
+ try {
44308
+ if (typeof process !== 'undefined') {
44309
+ logLevelSpec = process.env.DEBUG || logLevelSpec;
44310
+ }
44311
+ } catch {}
44312
+ try {
44313
+ if (typeof window !== 'undefined') {
44314
+ Object.assign(window, {
44315
+ setLogLevel,
44316
+ },);
44317
+ }
44318
+ } catch {}
44319
+ try {
44320
+ if (typeof window !== 'undefined' && !!window.postMessage && window.top === window) {
44321
+ window.addEventListener('message', (msg) => {
44322
+ if (!msg.data || typeof msg.data !== 'object') return;
44323
+ const {
44324
+ loggerId,
44325
+ level,
44326
+ parts,
44327
+ printed,
44328
+ } = msg.data;
44329
+ if (typeof loggerId !== 'string') return;
44330
+ if (!Array.isArray(parts,) || parts.length < 1 || typeof level !== 'number') return;
44331
+ const logger = getLogger2(loggerId,);
44332
+ if (level < 0 || level > 5) return;
44333
+ parts[0] = parts[0].replace('[', '*[',);
44334
+ const entry = new LogEntry(logger, level, parts,);
44335
+ entry.stringPrefix = parts[0];
44336
+ replayBuffer.push(entry,);
44337
+ if (printed) return;
44338
+ if (logger.level > level) return;
44339
+ console == null ? void 0 : console.log(...entry.toMessage(),);
44340
+ },);
44341
+ }
44342
+ } catch {}
44343
+ var postLogEntry;
44344
+ try {
44345
+ if (typeof window !== 'undefined' && !!window.postMessage && window.top !== window) {
44346
+ postLogEntry = (entry) => {
44347
+ var _a;
44348
+ try {
44349
+ const parts = entry.toMessage().map((p) => jsonSafeCopy(p,));
44350
+ const logger = entry.logger;
44351
+ const level = entry.level;
44352
+ const printed = logger.level <= entry.level;
44353
+ const data2 = {
44354
+ loggerId: logger.id,
44355
+ level,
44356
+ parts,
44357
+ printed,
44358
+ };
44359
+ (_a = window.top) == null ? void 0 : _a.postMessage(data2, getServiceMap().app,);
44360
+ } catch {}
44361
+ };
44362
+ }
44363
+ } catch {}
44364
+ var loggers = {};
44365
+ var replayBuffer = [];
44366
+ var maxReplayBufferEntries = 1e3;
44367
+ function createLogEntry(logger, level, parts,) {
44368
+ const entry = new LogEntry(logger, level, parts,);
44369
+ replayBuffer.push(entry,);
44370
+ postLogEntry == null ? void 0 : postLogEntry(entry,);
44371
+ while (replayBuffer.length > maxReplayBufferEntries) {
44372
+ replayBuffer.shift();
44373
+ }
44374
+ return entry;
44375
+ }
44376
+ function getLogReplayBuffer(maxEntries,) {
44377
+ if (typeof maxEntries === 'number') {
44378
+ maxReplayBufferEntries = maxEntries;
44379
+ }
44380
+ return replayBuffer;
44381
+ }
44382
+ var pathRegex = /\/(?<filename>[^/.]+)(?=\.(?:debug\.)?html$)/u;
44383
+ var cachedFilename;
44384
+ function getFilenameFromWindowPathname() {
44385
+ var _a, _b;
44386
+ if (typeof window === 'undefined' || !window.location) return;
44387
+ cachedFilename ??= (_b = (_a = pathRegex.exec(window.location.pathname,)) == null ? void 0 : _a.groups) == null ? void 0 : _b.filename;
44388
+ return cachedFilename;
44389
+ }
44390
+ function getLogger2(id3,) {
44391
+ const path = getFilenameFromWindowPathname();
44392
+ id3 = (path ? path + ':' : '') + id3;
44393
+ const existing = loggers[id3];
44394
+ if (existing) return existing;
44395
+ const logger = new Logger(id3,);
44396
+ loggers[id3] = logger;
44397
+ applyLogLevelSpec(logLevelSpec, [logger,],);
44398
+ postLogEntry == null ? void 0 : postLogEntry(new LogEntry(logger, -1, [],),);
44399
+ return logger;
44400
+ }
44401
+ function setLogLevel(spec, replay = true,) {
44402
+ try {
44403
+ if (typeof window !== 'undefined' && window.localStorage) {
44404
+ window.localStorage.logLevel = spec;
44405
+ }
44406
+ } catch {}
44407
+ const previousSpec = logLevelSpec;
44408
+ logLevelSpec = spec;
44409
+ const all = Object.values(loggers,);
44410
+ for (const logger of all) {
44411
+ logger.level = 3;
44412
+ }
44413
+ const missingSpecs = applyLogLevelSpec(spec, all,);
44414
+ if (missingSpecs.length > 0) {
44415
+ console == null ? void 0 : console.warn('Some log level specs matched no loggers:', missingSpecs,);
44416
+ }
44417
+ if (replay && replayBuffer.length > 0) {
44418
+ console == null ? void 0 : console.log('--- LOG REPLAY ---',);
44419
+ for (const entry of replayBuffer) {
44420
+ if (entry.logger.level > entry.level) continue;
44421
+ if (entry.level >= 3) {
44422
+ console == null ? void 0 : console.warn(...entry.toMessage(),);
44423
+ } else {
44424
+ console == null ? void 0 : console.log(...entry.toMessage(),);
44425
+ }
44426
+ }
44427
+ console == null ? void 0 : console.log('--- END OF LOG REPLAY ---',);
44428
+ }
44429
+ return previousSpec;
44430
+ }
44431
+ var enrichWithLogs = (extras) => {
44432
+ const result = {
44433
+ ...extras,
44434
+ logs: getLogReplayBuffer().slice(-50,).map((entry) => entry.toString().slice(0, 600,)).join('\n',),
44435
+ };
44436
+ if (extras.logs) {
44437
+ console == null ? void 0 : console.warn('extras.logs is reserved for log replay buffer, use another key',);
44438
+ }
44439
+ return result;
44440
+ };
44441
+ var Logger = class {
44442
+ constructor(id3, errorIsCritical,) {
44443
+ this.id = id3;
44444
+ __publicField(this, 'level', 3,/* Warn */
44445
+ );
44446
+ __publicField(this, 'didLog', {},);
44447
+ __publicField(this, 'errorIsCritical',);
44448
+ __publicField(this, 'trace', (...parts) => {
44449
+ if (this.level > 0) return;
44450
+ const entry = createLogEntry(this, 0, parts,);
44451
+ console == null ? void 0 : console.log(...entry.toMessage(),);
44452
+ },);
44453
+ __publicField(this, 'debug', (...parts) => {
44454
+ const entry = createLogEntry(this, 1, parts,);
44455
+ if (this.level > 1) return;
44456
+ console == null ? void 0 : console.log(...entry.toMessage(),);
44457
+ },);
44458
+ __publicField(this, 'info', (...parts) => {
44459
+ const entry = createLogEntry(this, 2, parts,);
44460
+ if (this.level > 2) return;
44461
+ console == null ? void 0 : console.info(...entry.toMessage(),);
44462
+ },);
44463
+ __publicField(this, 'warn', (...parts) => {
44464
+ const entry = createLogEntry(this, 3, parts,);
44465
+ if (this.level > 3) return;
44466
+ console == null ? void 0 : console.warn(...entry.toMessage(),);
44467
+ },);
44468
+ __publicField(this, 'warnOncePerMinute', (firstPart, ...parts) => {
44469
+ const lastLoggedTime = this.didLog[firstPart];
44470
+ if (lastLoggedTime && lastLoggedTime > Date.now()) return;
44471
+ this.didLog[firstPart] = Date.now() + 1e3 * 60;
44472
+ parts.unshift(firstPart,);
44473
+ const entry = createLogEntry(this, 3, parts,);
44474
+ if (this.level > 3) return;
44475
+ console == null ? void 0 : console.warn(...entry.toMessage(),);
44476
+ },);
44477
+ __publicField(this, 'error', (...parts) => {
44478
+ const entry = createLogEntry(this, 4, parts,);
44479
+ if (this.level > 4) return;
44480
+ console == null ? void 0 : console.error(...entry.toMessage(),);
44481
+ },);
44482
+ __publicField(this, 'errorOncePerMinute', (firstPart, ...parts) => {
44483
+ const lastLoggedTime = this.didLog[firstPart];
44484
+ if (lastLoggedTime && lastLoggedTime > Date.now()) return;
44485
+ this.didLog[firstPart] = Date.now() + 1e3 * 60;
44486
+ parts.unshift(firstPart,);
44487
+ const entry = createLogEntry(this, 4, parts,);
44488
+ if (this.level > 4) return;
44489
+ console == null ? void 0 : console.error(...entry.toMessage(),);
44490
+ },);
44491
+ __publicField(this, 'reportError', (maybeError, extras, tags, critical,) => {
44492
+ extras = enrichWithLogs(extras ?? {},);
44493
+ const reportedError = reportError({
44494
+ caller: this.reportError,
44495
+ error: maybeError,
44496
+ tags: {
44497
+ ...tags,
44498
+ handler: 'logger',
44499
+ where: this.id,
44500
+ },
44501
+ extras,
44502
+ critical: critical ?? this.errorIsCritical,
44503
+ },);
44504
+ extras ? this.error(reportedError, extras,) : this.error(reportedError,);
44505
+ },);
44506
+ __publicField(this, 'reportErrorOncePerMinute', (error, extras,) => {
44507
+ if (!isErrorWithMessage(error,)) return;
44508
+ const lastLoggedTime = this.didLog[error.message];
44509
+ if (lastLoggedTime && lastLoggedTime > Date.now()) return;
44510
+ this.didLog[error.message] = Date.now() + 1e3 * 60;
44511
+ this.reportError(error, extras,);
44512
+ },);
44513
+ __publicField(this, 'reportCriticalError', (maybeError, extras, tags,) => this.reportError(maybeError, extras, tags, true,),);
44514
+ this.errorIsCritical = errorIsCritical ?? (id3 === 'fatal' || id3.endsWith(':fatal',));
44515
+ }
44516
+ extend(name,) {
44517
+ const id3 = this.id + ':' + name;
44518
+ return getLogger2(id3,);
44519
+ }
44520
+ /** Returns the messages this logger created that are still in the global replay buffer. */
44521
+ getBufferedMessages() {
44522
+ return replayBuffer.filter((entry) => entry.logger === this);
44523
+ }
44524
+ /** Set new level and return previous level. */
44525
+ setLevel(level,) {
44526
+ const previous = this.level;
44527
+ this.level = level;
44528
+ return previous;
44529
+ }
44530
+ /** Check if a trace messages will be output. */
44531
+ isLoggingTraceMessages() {
44532
+ return this.level >= 0;
44533
+ }
44534
+ };
44535
+ function isErrorWithMessage(maybeError,) {
44536
+ return Object.prototype.hasOwnProperty.call(maybeError, 'message',);
44537
+ }
44538
+ function escapeRegExp(string,) {
44539
+ return string.replace(/[/\-\\^$*+?.()|[\]{}]/gu, '\\$&',);
44540
+ }
44541
+ var Mixed = Symbol('Mixed',);
44542
+ var DEPENDENCIES_MODULE_NAME = 'dependencies';
44543
+ var DEPENDENCIES_MODULE_TYPE = 'config';
44544
+ var DEPENDENCIES_MODULE_TYPE_SLASH_NAME = `${DEPENDENCIES_MODULE_TYPE}/${DEPENDENCIES_MODULE_NAME}`;
44545
+ var IMPORT_MAP_FILE_ID = `${DEPENDENCIES_MODULE_TYPE_SLASH_NAME}/importMap.json`;
44546
+ var DEPENDENCIES_FILE_ID = `${DEPENDENCIES_MODULE_TYPE_SLASH_NAME}/dependencies.json`;
44547
+ var USE_FREEZE = false;
44548
+ var List;
44549
+ ((List2) => {
44550
+ function push(ls, ...elements) {
44551
+ return ls.concat(elements,);
44552
+ }
44553
+ List2.push = push;
44554
+ function pop(a,) {
44555
+ return a.slice(0, -1,);
44556
+ }
44557
+ List2.pop = pop;
44558
+ function unshift(ls, ...elements) {
44559
+ return elements.concat(ls,);
44560
+ }
44561
+ List2.unshift = unshift;
44562
+ function insert(a, index, ...elements) {
44563
+ const length = a.length;
44564
+ if (index < 0 || index > length) throw Error('index out of range: ' + index,);
44565
+ const copy = a.slice();
44566
+ copy.splice(index, 0, ...elements,);
44567
+ return copy;
44568
+ }
44569
+ List2.insert = insert;
44570
+ function replace(a, index, replacement,) {
44571
+ const length = a.length;
44572
+ if (index < 0 || index >= length) throw Error('index out of range: ' + index,);
44573
+ const itemsToAdd = Array.isArray(replacement,) ? replacement : [replacement,];
44574
+ const copy = a.slice();
44575
+ copy.splice(index, 1, ...itemsToAdd,);
44576
+ return copy;
44577
+ }
44578
+ List2.replace = replace;
44579
+ function remove2(a, index,) {
44580
+ const length = a.length;
44581
+ if (index < 0 || index >= length) throw Error('index out of range: ' + index,);
44582
+ const copy = a.slice();
44583
+ copy.splice(index, 1,);
44584
+ return copy;
44585
+ }
44586
+ List2.remove = remove2;
44587
+ function move(a, from, to,) {
44588
+ const length = a.length;
44589
+ if (from < 0 || from >= length) throw Error('from index out of range: ' + from,);
44590
+ if (to < 0 || to >= length) throw Error('to index out of range: ' + to,);
44591
+ const copy = a.slice();
44592
+ if (to === from) return copy;
44593
+ const element = copy[from];
44594
+ if (from < to) {
44595
+ copy.splice(to + 1, 0, element,);
44596
+ copy.splice(from, 1,);
44597
+ } else {
44598
+ copy.splice(from, 1,);
44599
+ copy.splice(to, 0, element,);
44600
+ }
44601
+ return copy;
44602
+ }
44603
+ List2.move = move;
44604
+ function zip(a, b,) {
44605
+ const res = [];
44606
+ const length = Math.min(a.length, b.length,);
44607
+ for (let i = 0; i < length; i++) {
44608
+ res.push([a[i], b[i],],);
44609
+ }
44610
+ return res;
44611
+ }
44612
+ List2.zip = zip;
44613
+ function update(a, index, body,) {
44614
+ const res = a.slice();
44615
+ const targetElement = res[index];
44616
+ if (targetElement === void 0) return res;
44617
+ res[index] = body(targetElement,);
44618
+ return res;
44619
+ }
44620
+ List2.update = update;
44621
+ function unique(a,) {
44622
+ return Array.from(new Set(a,),);
44623
+ }
44624
+ List2.unique = unique;
44625
+ function union(a, ...collections) {
44626
+ return Array.from(/* @__PURE__ */ new Set([...a, ...collections.flat(),],),);
44627
+ }
44628
+ List2.union = union;
44629
+ function filter2(a, predicate,) {
44630
+ return a.filter(predicate,);
44631
+ }
44632
+ List2.filter = filter2;
44633
+ })(List || (List = {}),);
44634
+ var objectHasOwnProperty = Object.prototype.hasOwnProperty;
44635
+ function hasOwnProperty2(object, property,) {
44636
+ return objectHasOwnProperty.call(object, property,);
44637
+ }
44638
+ var ValueObject;
44639
+ ((ValueObject2) => {
44640
+ function morphUsingTemplate(values, template,) {
44641
+ for (const field of Object.keys(values,)) {
44642
+ if (!hasOwnProperty2(template, field,)) {
44643
+ delete values[field];
44644
+ }
44645
+ }
44646
+ for (const field of Object.keys(template,)) {
44647
+ if (values[field] === void 0) {
44648
+ values[field] = template[field];
44649
+ }
44650
+ }
44651
+ Object.setPrototypeOf(values, Object.getPrototypeOf(template,),);
44652
+ if (USE_FREEZE) {
44653
+ Object.freeze(values,);
44654
+ }
44655
+ return values;
44656
+ }
44657
+ ValueObject2.morphUsingTemplate = morphUsingTemplate;
44658
+ function writeOnce(object, values,) {
44659
+ if (values) {
44660
+ Object.assign(object, values,);
44661
+ }
44662
+ if (USE_FREEZE) {
44663
+ Object.freeze(object,);
44664
+ }
44665
+ }
44666
+ ValueObject2.writeOnce = writeOnce;
44667
+ function update(object, values,) {
44668
+ const result = Object.assign(Object.create(Object.getPrototypeOf(object,),), object, values,);
44669
+ if (USE_FREEZE) {
44670
+ Object.freeze(result,);
44671
+ }
44672
+ return result;
44673
+ }
44674
+ ValueObject2.update = update;
44675
+ })(ValueObject || (ValueObject = {}),);
44676
+ var ReadonlySet;
44677
+ ((ReadonlySet2) => {
44678
+ function add3(set, ...items) {
44679
+ return /* @__PURE__ */ new Set([...set, ...items,],);
44680
+ }
44681
+ ReadonlySet2.add = add3;
44682
+ function remove2(set, ...items) {
44683
+ const result = new Set(set,);
44684
+ for (const item of items) {
44685
+ result.delete(item,);
44686
+ }
44687
+ return result;
44688
+ }
44689
+ ReadonlySet2.remove = remove2;
44690
+ function union(...sets) {
44691
+ const result = /* @__PURE__ */ new Set();
44692
+ for (const set of sets) {
44693
+ for (const item of set) {
44694
+ result.add(item,);
44695
+ }
44696
+ }
44697
+ return result;
44698
+ }
44699
+ ReadonlySet2.union = union;
44700
+ function toggle(set, item,) {
44701
+ if (set.has(item,)) {
44702
+ return ReadonlySet2.remove(set, item,);
44703
+ }
44704
+ return ReadonlySet2.add(set, item,);
44705
+ }
44706
+ ReadonlySet2.toggle = toggle;
44707
+ })(ReadonlySet || (ReadonlySet = {}),);
44708
+ var ReadonlyMap;
44709
+ ((ReadonlyMap2) => {
44710
+ function set(map2, key7, value,) {
44711
+ const result = new Map(map2,);
44712
+ result.set(key7, value,);
44713
+ return result;
44714
+ }
44715
+ ReadonlyMap2.set = set;
44716
+ function remove2(map2, key7,) {
44717
+ const result = new Map(map2,);
44718
+ result.delete(key7,);
44719
+ return result;
44720
+ }
44721
+ ReadonlyMap2.remove = remove2;
44722
+ })(ReadonlyMap || (ReadonlyMap = {}),);
44723
+ var ResolvablePromise = class extends Promise {
44724
+ constructor() {
44725
+ let res;
44726
+ let rej;
44727
+ super((resolve, reject,) => {
44728
+ res = resolve;
44729
+ rej = reject;
44730
+ },);
44731
+ __publicField(this, '_state', 'initial',);
44732
+ __publicField(this, 'resolve',);
44733
+ __publicField(this, 'reject',);
44734
+ this.resolve = (val) => {
44735
+ this._state = 'fulfilled';
44736
+ res(val,);
44737
+ };
44738
+ this.reject = (reason) => {
44739
+ this._state = 'rejected';
44740
+ rej(reason,);
44741
+ };
44742
+ }
44743
+ get state() {
44744
+ return this._state;
44745
+ }
44746
+ /**
44747
+ * A function that sets the state to "pending".
44748
+ * Useful for when you want to signal that the task started but is not yet completed.
44749
+ */
44750
+ pending() {
44751
+ this._state = 'pending';
44752
+ return this;
44753
+ }
44754
+ isResolved() {
44755
+ return this._state === 'fulfilled' || this._state === 'rejected';
44756
+ }
44757
+ };
44758
+ ResolvablePromise.prototype.constructor = Promise;
44759
+ var hasNativeYield = false;
44760
+ var hasNativePostTask = false;
44761
+ var hasIsInputPending = false;
44762
+ if (typeof window !== 'undefined' && window.scheduler) {
44763
+ hasNativeYield = 'yield' in window.scheduler;
44764
+ hasNativePostTask = 'postTask' in window.scheduler;
44765
+ hasIsInputPending = 'isInputPending' in window.scheduler;
44766
+ }
44767
+ var log2 = getLogger2('task-queue',);
44768
+ function getAssetFilename(asset,) {
44769
+ return asset.key + asset.extension;
44770
+ }
44771
+ function createAbsoluteAssetURL(filename,) {
44772
+ const serviceMap = getServiceMap();
44773
+ return `${serviceMap.userContent}/assets/${filename}`;
44774
+ }
44775
+ function createAbsoluteAssetURLFromAsset(asset,) {
44776
+ return createAbsoluteAssetURL(getAssetFilename(asset,),);
44777
+ }
43960
44778
  function supportsOpenType(openTypeData,) {
43961
44779
  return Boolean(openTypeData && Array.isArray(openTypeData,),);
43962
44780
  }
@@ -44014,17 +44832,18 @@ var BuiltInFontSource = class {
44014
44832
  const {
44015
44833
  properties,
44016
44834
  } = asset;
44017
- const fontName = properties.font.preferredFamily || properties.font.fontFamily;
44835
+ const fontName = properties.font.fontFamily;
44018
44836
  const fontFamily = this.createFontFamily(fontName, properties.font.foundryName, properties.font.fontVersion,);
44019
44837
  const openTypeData = properties.font.openTypeData;
44020
44838
  const variationAxesData = properties.font.variationAxes;
44021
44839
  const isVariableFont2 = Array.isArray(variationAxesData,);
44022
- const variant = isVariableFont2 ? 'variable' : properties.font.preferredSubFamily || properties.font.fontSubFamily || 'regular';
44840
+ const variant = isVariableFont2 ? 'variable' : properties.font.fontSubFamily || 'regular';
44841
+ const url = createAbsoluteAssetURLFromAsset(asset,);
44023
44842
  const font = {
44024
44843
  family: fontFamily,
44025
44844
  selector: this.createSelector(fontName, variant, properties.font.fontVersion,),
44026
44845
  variant,
44027
- file: asset.url,
44846
+ file: url,
44028
44847
  hasOpenTypeFeatures: supportsOpenType(openTypeData,),
44029
44848
  variationAxes: validateVariationAxes(variationAxesData,),
44030
44849
  category: properties.font.fontCategory,
@@ -44054,10 +44873,9 @@ var BuiltInFontSource = class {
44054
44873
  style: style2,
44055
44874
  };
44056
44875
  }
44057
- getFontBySelector(selector, createFont = true,) {
44876
+ getFontBySelector(selector,) {
44058
44877
  const locator = this.parseSelector(selector,);
44059
44878
  if (!locator) return;
44060
- if (!createFont && !this.byFamilyName.get(locator.name,)) return;
44061
44879
  const fontFamily = this.getFontFamilyByName(locator.name,);
44062
44880
  if (!fontFamily) return;
44063
44881
  return fontFamily.fonts.find((f) => f.selector === selector);
@@ -44205,20 +45023,145 @@ function getFontStyle(variant,) {
44205
45023
  if (variant.includes('italic',) || variant.includes('oblique',) || variant.includes('slanted',)) return 'italic';
44206
45024
  return 'normal';
44207
45025
  }
45026
+ function getRelatedFontVariants(currentVariant, availableVariants,) {
45027
+ return {
45028
+ ...pickBoldItalicVariants(currentVariant, availableVariants,),
45029
+ ...pickVariableVariants(currentVariant, availableVariants,),
45030
+ };
45031
+ }
45032
+ function pickBoldItalicVariants(currentVariant, availableVariants,) {
45033
+ if (availableVariants.length === 0) {
45034
+ return {
45035
+ variantBold: void 0,
45036
+ variantBoldItalic: void 0,
45037
+ variantItalic: void 0,
45038
+ };
45039
+ }
45040
+ const {
45041
+ weight: currentWeight,
45042
+ style: currentStyle,
45043
+ } = currentVariant;
45044
+ const variantByWeightAndStyle = /* @__PURE__ */ new Map();
45045
+ const boldVariantByStyle = /* @__PURE__ */ new Map();
45046
+ for (const variant of availableVariants) {
45047
+ if (variant.isVariable !== currentVariant.isVariable) continue;
45048
+ variantByWeightAndStyle.set(`${variant.weight}-${variant.style}`, variant,);
45049
+ if (variant.weight <= currentWeight) continue;
45050
+ if (!boldVariantByStyle.has(variant.style,)) {
45051
+ boldVariantByStyle.set(variant.style, variant,);
45052
+ }
45053
+ }
45054
+ let variantBold = boldVariantByStyle.get(currentStyle,);
45055
+ let variantBoldItalic = boldVariantByStyle.get('italic',);
45056
+ const currentVariantWeight = currentVariant.weight;
45057
+ if (currentVariantWeight <= 300) {
45058
+ variantBold = variantByWeightAndStyle.get(`400-${currentStyle}`,) ?? variantBold;
45059
+ variantBoldItalic = variantByWeightAndStyle.get('400-italic',) ?? variantBoldItalic;
45060
+ } else if (currentVariantWeight <= 500) {
45061
+ variantBold = variantByWeightAndStyle.get(`700-${currentStyle}`,) ?? variantBold;
45062
+ variantBoldItalic = variantByWeightAndStyle.get('700-italic',) ?? variantBoldItalic;
45063
+ } else {
45064
+ variantBold = variantByWeightAndStyle.get(`900-${currentStyle}`,) ?? variantBold;
45065
+ variantBoldItalic = variantByWeightAndStyle.get('900-italic',) ?? variantBoldItalic;
45066
+ }
45067
+ const variantItalic = variantByWeightAndStyle.get(`${currentWeight}-italic`,);
45068
+ return {
45069
+ variantBold,
45070
+ variantItalic,
45071
+ variantBoldItalic,
45072
+ };
45073
+ }
45074
+ function pickVariableVariants(currentVariant, availableVariants,) {
45075
+ if (availableVariants.length === 0) {
45076
+ return {
45077
+ variantVariable: void 0,
45078
+ variantVariableItalic: void 0,
45079
+ };
45080
+ }
45081
+ const variantByWeightAndStyle = /* @__PURE__ */ new Map();
45082
+ let variantVariable;
45083
+ let variantVariableItalic;
45084
+ let fallbackVariant;
45085
+ let fallbackItalicVariant;
45086
+ for (const variant of availableVariants) {
45087
+ if (!variant.isVariable) continue;
45088
+ const isSameWeight = variant.weight === currentVariant.weight;
45089
+ const isDefaultWeight = variant.weight === 400;
45090
+ if (variant.style === 'normal') {
45091
+ if (isSameWeight) {
45092
+ variantVariable = variant;
45093
+ } else if (isDefaultWeight) {
45094
+ fallbackVariant = variant;
45095
+ } else if (!fallbackVariant) {
45096
+ fallbackVariant = variant;
45097
+ }
45098
+ } else if (variant.style === 'italic') {
45099
+ if (isSameWeight) {
45100
+ variantVariableItalic = variant;
45101
+ } else if (isDefaultWeight) {
45102
+ fallbackItalicVariant = variant;
45103
+ } else if (!fallbackItalicVariant) {
45104
+ fallbackItalicVariant = variant;
45105
+ }
45106
+ }
45107
+ }
45108
+ return {
45109
+ variantVariable: variantVariable ?? fallbackVariant,
45110
+ variantVariableItalic: variantVariableItalic ?? fallbackItalicVariant,
45111
+ };
45112
+ }
44208
45113
  var customFontSelectorPrefix = 'CUSTOM;';
45114
+ var log3 = getLogger('custom-font-source',);
45115
+ function findDuplicateFont(existingFonts, newFont,) {
45116
+ for (let i = 0; i < existingFonts.length; i++) {
45117
+ const existingFont = existingFonts[i];
45118
+ if (
45119
+ existingFont && existingFont.selector === newFont.selector && existingFont.weight === newFont.weight &&
45120
+ existingFont.style === newFont.style
45121
+ ) {
45122
+ return {
45123
+ existingFont,
45124
+ index: i,
45125
+ };
45126
+ }
45127
+ }
45128
+ return void 0;
45129
+ }
44209
45130
  function getCustomFontName(fileName, properties,) {
44210
45131
  if (!properties) return fileName.substring(0, fileName.lastIndexOf('.',),);
44211
45132
  const {
44212
45133
  font,
44213
45134
  } = properties;
44214
- const fontFamily = font.preferredFamily || font.fontFamily;
45135
+ const fontFamily = font.fontFamily;
44215
45136
  const isAssetVariableFont = Array.isArray(font.variationAxes,);
44216
45137
  if (isAssetVariableFont && fontFamily.toLowerCase().includes('variable',)) return fontFamily;
44217
- const variant = isAssetVariableFont ? 'Variable' : (font.preferredSubFamily || font.fontSubFamily).trim();
45138
+ const variant = isAssetVariableFont ? 'Variable' : font.fontSubFamily.trim();
44218
45139
  if (variant === '') return fontFamily;
44219
45140
  return `${fontFamily} ${variant}`;
44220
45141
  }
44221
- var CustomFontSource = class {
45142
+ function getCustomFontInfo({
45143
+ fontFamily,
45144
+ fontSubFamily,
45145
+ variationAxes,
45146
+ faceDescriptors,
45147
+ },) {
45148
+ const rawVariant = fontSubFamily.trim() || 'Regular';
45149
+ const containsVariant = rawVariant.toLocaleLowerCase().includes('variable',);
45150
+ const variant = validateVariationAxes(variationAxes,) && !containsVariant ? `Variable ${rawVariant}` : rawVariant;
45151
+ let style2 = 'normal';
45152
+ let weight = 400;
45153
+ if (faceDescriptors) {
45154
+ weight = faceDescriptors.weight;
45155
+ style2 = faceDescriptors.italic || faceDescriptors.oblique ? 'italic' : 'normal';
45156
+ }
45157
+ return {
45158
+ family: fontFamily,
45159
+ variant,
45160
+ weight,
45161
+ style: style2,
45162
+ };
45163
+ }
45164
+ var CustomFontSource = class _CustomFontSource {
44222
45165
  constructor() {
44223
45166
  __publicField(this, 'name', 'custom',/* Custom */
44224
45167
  );
@@ -44226,8 +45169,8 @@ var CustomFontSource = class {
44226
45169
  __publicField(this, 'byFamilyName', /* @__PURE__ */ new Map(),);
44227
45170
  __publicField(this, 'assetsByFamily', /* @__PURE__ */ new Map(),);
44228
45171
  }
44229
- importFonts(assets,) {
44230
- var _a, _b, _c;
45172
+ deprecatedImportFonts(assets,) {
45173
+ var _a, _b;
44231
45174
  this.fontFamilies.length = 0;
44232
45175
  this.byFamilyName.clear();
44233
45176
  this.assetsByFamily.clear();
@@ -44242,12 +45185,12 @@ var CustomFontSource = class {
44242
45185
  const fontFamily = this.createFontFamily(fontName,);
44243
45186
  const openTypeData = (_b = asset.properties) == null ? void 0 : _b.font.openTypeData;
44244
45187
  const variant = isVariableFont2 ? 'variable' : this.inferVariantName(fontName,);
45188
+ const url = createAbsoluteAssetURLFromAsset(asset,);
44245
45189
  const font = {
44246
45190
  family: fontFamily,
44247
45191
  selector: `${customFontSelectorPrefix}${fontName}`,
44248
45192
  variant,
44249
- postscriptName: (_c = asset.properties) == null ? void 0 : _c.font.postscriptName,
44250
- file: asset.url,
45193
+ file: url,
44251
45194
  hasOpenTypeFeatures: supportsOpenType(openTypeData,),
44252
45195
  variationAxes: validateVariationAxes(variationAxesData,),
44253
45196
  };
@@ -44258,6 +45201,65 @@ var CustomFontSource = class {
44258
45201
  }
44259
45202
  return fonts;
44260
45203
  }
45204
+ importFonts(assets, enableFontImprovements,) {
45205
+ var _a, _b, _c, _d;
45206
+ if (!enableFontImprovements) {
45207
+ return this.deprecatedImportFonts(assets,);
45208
+ }
45209
+ this.fontFamilies.length = 0;
45210
+ this.byFamilyName.clear();
45211
+ this.assetsByFamily.clear();
45212
+ const fonts = {};
45213
+ for (const asset of assets) {
45214
+ if (!this.isValidCustomFontAsset(asset,)) {
45215
+ continue;
45216
+ }
45217
+ const {
45218
+ family,
45219
+ variant,
45220
+ weight,
45221
+ style: style2,
45222
+ } = getCustomFontInfo(asset.properties.font,);
45223
+ const fontFamily = this.createFontFamily(family,);
45224
+ const openTypeData = (_a = asset.properties) == null ? void 0 : _a.font.openTypeData;
45225
+ const url = createAbsoluteAssetURLFromAsset(asset,);
45226
+ const font = {
45227
+ family: fontFamily,
45228
+ selector: _CustomFontSource.createSelector(fontFamily.name, variant,),
45229
+ variant,
45230
+ weight,
45231
+ style: style2,
45232
+ file: url,
45233
+ hasOpenTypeFeatures: supportsOpenType(openTypeData,),
45234
+ variationAxes: validateVariationAxes((_b = asset.properties) == null ? void 0 : _b.font.variationAxes,),
45235
+ };
45236
+ const duplicateInfo = findDuplicateFont(fontFamily.fonts, font,);
45237
+ if (duplicateInfo) {
45238
+ log3.warn('Duplicate font found for:', font, 'with existing font:', duplicateInfo.existingFont,);
45239
+ const existingFont = duplicateInfo.existingFont;
45240
+ const newIsWoff2 = ((_c = font.file) == null ? void 0 : _c.endsWith('.woff2',)) ?? false;
45241
+ const existingIsWoff2 = ((_d = existingFont.file) == null ? void 0 : _d.endsWith('.woff2',)) ?? false;
45242
+ if (newIsWoff2 && !existingIsWoff2) {
45243
+ fontFamily.fonts[duplicateInfo.index] = font;
45244
+ fonts[font.selector] = font;
45245
+ }
45246
+ } else {
45247
+ fontFamily.fonts.push(font,);
45248
+ fonts[font.selector] = font;
45249
+ }
45250
+ fontFamily.owner = asset.ownerType === 'team' ? 'team' : 'project';
45251
+ this.assetsByFamily.set(family, asset,);
45252
+ }
45253
+ for (const fontFamily of this.fontFamilies) {
45254
+ if (fontFamily.fonts.length > 0) {
45255
+ updateFontRelationships(fontFamily,);
45256
+ }
45257
+ }
45258
+ return Object.values(fonts,);
45259
+ }
45260
+ static createSelector(family, variant,) {
45261
+ return `${customFontSelectorPrefix}${family}${variant ? ` ${variant}` : ''}`;
45262
+ }
44261
45263
  isValidCustomFontAsset(asset,) {
44262
45264
  var _a;
44263
45265
  if (!asset.mimeType.startsWith('font/',)) return false;
@@ -44304,118 +45306,66 @@ var CustomFontSource = class {
44304
45306
  this.fontFamilies.push(fontFamily,);
44305
45307
  this.byFamilyName.set(fontFamily.name, fontFamily,);
44306
45308
  }
44307
- parseSelector(selector,) {
44308
- if (!selector.startsWith(customFontSelectorPrefix,)) return null;
44309
- const tokens = selector.split(customFontSelectorPrefix,);
44310
- if (tokens[1] === void 0) return null;
44311
- const locator = {
44312
- source: 'custom',
44313
- name: tokens[1],
44314
- };
44315
- return locator;
44316
- }
44317
- getFontBySelector(selector, createFont = true,) {
44318
- const locator = this.parseSelector(selector,);
44319
- if (!locator) return;
44320
- if (!createFont && !this.byFamilyName.get(locator.name,)) return;
44321
- const fonts = this.getFontFamilyByName(locator.name,).fonts;
44322
- const woff2Font = fonts.find((font) => {
44323
- var _a;
44324
- return (_a = font.file) == null ? void 0 : _a.endsWith('.woff2',);
44325
- },);
44326
- return woff2Font || fonts[0];
45309
+ getFontBySelector(selector,) {
45310
+ if (!selector.startsWith(customFontSelectorPrefix,)) return void 0;
45311
+ const remainingSelector = selector.slice(customFontSelectorPrefix.length,);
45312
+ if (!remainingSelector) return void 0;
45313
+ const matchingFonts = [];
45314
+ for (const [familyName, fontFamily,] of this.byFamilyName) {
45315
+ if (remainingSelector.startsWith(familyName,)) {
45316
+ const exactMatches = fontFamily.fonts.filter((font) => font.selector === selector);
45317
+ matchingFonts.push(...exactMatches,);
45318
+ }
45319
+ }
45320
+ if (matchingFonts.length > 0) {
45321
+ if (matchingFonts.length > 1) {
45322
+ const woff2Font = matchingFonts.find((font) => {
45323
+ var _a;
45324
+ return (_a = font.file) == null ? void 0 : _a.endsWith('.woff2',);
45325
+ },);
45326
+ if (woff2Font) return woff2Font;
45327
+ }
45328
+ return matchingFonts[0];
45329
+ }
45330
+ return void 0;
44327
45331
  }
44328
45332
  getFontFamilyByName(family,) {
44329
45333
  const foundFontFamily = this.byFamilyName.get(family,);
44330
- if (foundFontFamily) return foundFontFamily;
44331
- const fontFamily = {
44332
- source: 'custom',
44333
- name: family,
44334
- fonts: [],
44335
- };
44336
- fontFamily.fonts.push({
44337
- selector: `${customFontSelectorPrefix}${family}`,
44338
- variant: this.inferVariantName(family,),
44339
- family: fontFamily,
44340
- },);
44341
- return fontFamily;
45334
+ if (!foundFontFamily) return null;
45335
+ return foundFontFamily;
44342
45336
  }
44343
45337
  };
44344
- function getRelatedFontVariants(currentVariant, availableVariants,) {
44345
- return {
44346
- ...pickBoldItalicVariants(currentVariant, availableVariants,),
44347
- ...pickVariableVariants(currentVariant, availableVariants,),
44348
- };
44349
- }
44350
- function pickBoldItalicVariants(currentVariant, availableVariants,) {
44351
- if (availableVariants.length === 0) {
44352
- return {
44353
- variantBold: void 0,
44354
- variantBoldItalic: void 0,
44355
- variantItalic: void 0,
44356
- };
44357
- }
44358
- const {
44359
- weight: currentWeight,
44360
- style: currentStyle,
44361
- } = currentVariant;
44362
- const variantByWeightAndStyle = /* @__PURE__ */ new Map();
44363
- const boldVariantByStyle = /* @__PURE__ */ new Map();
44364
- for (const variant of availableVariants) {
44365
- if (variant.isVariable !== currentVariant.isVariable) continue;
44366
- variantByWeightAndStyle.set(`${variant.weight}-${variant.style}`, variant,);
44367
- if (variant.weight <= currentWeight) continue;
44368
- if (!boldVariantByStyle.has(variant.style,)) {
44369
- boldVariantByStyle.set(variant.style, variant,);
44370
- }
44371
- }
44372
- let variantBold = boldVariantByStyle.get(currentStyle,);
44373
- let variantBoldItalic = boldVariantByStyle.get('italic',);
44374
- const currentVariantWeight = currentVariant.weight;
44375
- if (currentVariantWeight <= 300) {
44376
- variantBold = variantByWeightAndStyle.get(`400-${currentStyle}`,) ?? variantBold;
44377
- variantBoldItalic = variantByWeightAndStyle.get('400-italic',) ?? variantBoldItalic;
44378
- } else if (currentVariantWeight <= 500) {
44379
- variantBold = variantByWeightAndStyle.get(`700-${currentStyle}`,) ?? variantBold;
44380
- variantBoldItalic = variantByWeightAndStyle.get('700-italic',) ?? variantBoldItalic;
44381
- } else {
44382
- variantBold = variantByWeightAndStyle.get(`900-${currentStyle}`,) ?? variantBold;
44383
- variantBoldItalic = variantByWeightAndStyle.get('900-italic',) ?? variantBoldItalic;
44384
- }
44385
- const variantItalic = variantByWeightAndStyle.get(`${currentWeight}-italic`,);
45338
+ function fontToVariantWithMetadata(font,) {
45339
+ if (!font.weight || !font.style) return void 0;
44386
45340
  return {
44387
- variantBold,
44388
- variantItalic,
44389
- variantBoldItalic,
44390
- };
44391
- }
44392
- function pickVariableVariants(currentVariant, availableVariants,) {
44393
- if (availableVariants.length === 0) {
44394
- return {
44395
- variantVariable: void 0,
44396
- variantVariableItalic: void 0,
44397
- };
45341
+ weight: font.weight,
45342
+ style: font.style,
45343
+ isVariable: isVariableFont(font,),
45344
+ selector: font.selector,
45345
+ };
45346
+ }
45347
+ function updateFontRelationships(fontFamily,) {
45348
+ var _a, _b, _c, _d, _e;
45349
+ const availableVariants = fontFamily.fonts.map((font) => fontToVariantWithMetadata(font,)).filter((font) => font !== void 0);
45350
+ for (const font of fontFamily.fonts) {
45351
+ const variant = fontToVariantWithMetadata(font,);
45352
+ if (!variant) continue;
45353
+ const relatedVariants = getRelatedFontVariants(variant, availableVariants,);
45354
+ font.selectorVariable = (_a = relatedVariants.variantVariable) == null ? void 0 : _a.selector;
45355
+ font.selectorVariableItalic = (_b = relatedVariants.variantVariableItalic) == null ? void 0 : _b.selector;
45356
+ font.selectorBold = (_c = relatedVariants.variantBold) == null ? void 0 : _c.selector;
45357
+ font.selectorBoldItalic = (_d = relatedVariants.variantBoldItalic) == null ? void 0 : _d.selector;
45358
+ font.selectorItalic = (_e = relatedVariants.variantItalic) == null ? void 0 : _e.selector;
44398
45359
  }
44399
- const variantByWeightAndStyle = /* @__PURE__ */ new Map();
44400
- for (const variant of availableVariants) {
44401
- if (!variant.isVariable) continue;
44402
- variantByWeightAndStyle.set(`${variant.weight}-${variant.style}`, variant,);
44403
- }
44404
- return {
44405
- variantVariable: variantByWeightAndStyle.get(`${currentVariant.weight}-normal`,) ?? variantByWeightAndStyle.get(`400-normal`,) ??
44406
- void 0,
44407
- variantVariableItalic: variantByWeightAndStyle.get(`${currentVariant.weight}-italic`,) ?? variantByWeightAndStyle.get(`400-italic`,) ??
44408
- void 0,
44409
- };
44410
45360
  }
44411
45361
  async function loadFontsWithOpenType(source,) {
44412
45362
  switch (source) {
44413
45363
  case 'google': {
44414
- const supportedFonts = await import('./framer-chunks/google-LHIHIYDX-NVWWNJLR.js');
45364
+ const supportedFonts = await import('./framer-chunks/google-3ASCFEEO-3R47BR2A.js');
44415
45365
  return supportedFonts == null ? void 0 : supportedFonts.default;
44416
45366
  }
44417
45367
  case 'fontshare': {
44418
- const supportedFonts = await import('./framer-chunks/fontshare-GSJIWLGZ-3DSFZVD7.js');
45368
+ const supportedFonts = await import('./framer-chunks/fontshare-4J2ZFRBB-H5VQLZTM.js');
44419
45369
  return supportedFonts == null ? void 0 : supportedFonts.default;
44420
45370
  }
44421
45371
  default:
@@ -44425,11 +45375,11 @@ async function loadFontsWithOpenType(source,) {
44425
45375
  async function loadFontToOpenTypeFeatures(source,) {
44426
45376
  switch (source) {
44427
45377
  case 'google': {
44428
- const features = await import('./framer-chunks/google-3GQMHAEU-WSITVUPV.js');
45378
+ const features = await import('./framer-chunks/google-FDB6LUFQ-PFSUZGKF.js');
44429
45379
  return features == null ? void 0 : features.default;
44430
45380
  }
44431
45381
  case 'fontshare': {
44432
- const features = await import('./framer-chunks/fontshare-SSHBFVID-JIQZ2OLR.js');
45382
+ const features = await import('./framer-chunks/fontshare-622CVMZZ-HFPH543A.js');
44433
45383
  return features == null ? void 0 : features.default;
44434
45384
  }
44435
45385
  case 'framer': {
@@ -44977,10 +45927,10 @@ function loadVariationAxes(source,) {
44977
45927
  const axes = (async () => {
44978
45928
  switch (source) {
44979
45929
  case 'google': {
44980
- return (await import('./framer-chunks/google-42BCYVR5-QT55MZO3.js')).default;
45930
+ return (await import('./framer-chunks/google-C62SNV32-LCI4F7VO.js')).default;
44981
45931
  }
44982
45932
  case 'fontshare': {
44983
- return (await import('./framer-chunks/fontshare-X6MCIXW5-UOB5XTBQ.js')).default;
45933
+ return (await import('./framer-chunks/fontshare-JGEKH7YN-QOX3MC3K.js')).default;
44984
45934
  }
44985
45935
  default:
44986
45936
  assertNever(source,);
@@ -45094,13 +46044,13 @@ var FontStore = class {
45094
46044
  this.addFont(font,);
45095
46045
  },);
45096
46046
  }
45097
- importCustomFonts(assets,) {
46047
+ importCustomFonts(assets, enableFontImprovements,) {
45098
46048
  this.bySelector.forEach((_, key7,) => {
45099
46049
  if (key7.startsWith(customFontSelectorPrefix,)) {
45100
46050
  this.bySelector.delete(key7,);
45101
46051
  }
45102
46052
  },);
45103
- const importedFonts = this.custom.importFonts(assets,);
46053
+ const importedFonts = this.custom.importFonts(assets, enableFontImprovements,);
45104
46054
  for (const font of importedFonts) {
45105
46055
  this.addFont(font,);
45106
46056
  }
@@ -45108,14 +46058,21 @@ var FontStore = class {
45108
46058
  this.resolveCustomFontsImportPromise();
45109
46059
  }
45110
46060
  }
46061
+ /**
46062
+ * Returns a promise that resolves when custom fonts have been imported
46063
+ * @internal
46064
+ */
46065
+ getCustomFontsImportPromise() {
46066
+ return this.customFontsImportPromise;
46067
+ }
45111
46068
  getFontFamily(info,) {
45112
46069
  const fontFamily = this[info.source].getFontFamilyByName(info.name,);
45113
46070
  return fontFamily;
45114
46071
  }
45115
- getFontBySelector(selector, createFont = true,) {
46072
+ getFontBySelector(selector,) {
45116
46073
  if (!selector) return void 0;
45117
46074
  if (selector.startsWith(customFontSelectorPrefix,)) {
45118
- return this.custom.getFontBySelector(selector, createFont,);
46075
+ return this.custom.getFontBySelector(selector,);
45119
46076
  }
45120
46077
  return this.bySelector.get(selector,);
45121
46078
  }
@@ -46090,11 +47047,6 @@ var Image2 = /* @__PURE__ */ React4.forwardRef(function Image3(props, ref,) {
46090
47047
  ],
46091
47048
  },);
46092
47049
  },);
46093
- var nonSlugCharactersRegExp = /[^\p{Letter}\p{Number}()]+/gu;
46094
- var trimSlugRegExp = /^-+|-+$/gu;
46095
- function slugify(value,) {
46096
- return value.toLowerCase().replace(nonSlugCharactersRegExp, '-',).replace(trimSlugRegExp, '',);
46097
- }
46098
47050
  var frameFromElement = (element) => {
46099
47051
  const frame2 = Rect.fromRect(element.getBoundingClientRect(),);
46100
47052
  frame2.x = frame2.x + safeWindow.scrollX;
@@ -47326,11 +48278,11 @@ function imagePatternPropsForFill(fill, frame2, id3, includeTransform,) {
47326
48278
  };
47327
48279
  }
47328
48280
  var mediaType2 = 'framer/asset-reference,';
47329
- function isAssetReference(value,) {
48281
+ function isAssetReference2(value,) {
47330
48282
  return value.startsWith(`data:${mediaType2}`,);
47331
48283
  }
47332
48284
  function imageUrlForAsset(asset, pixelSize,) {
47333
- if (/^\w+:/u.test(asset,) && !isAssetReference(asset,)) return asset;
48285
+ if (/^\w+:/u.test(asset,) && !isAssetReference2(asset,)) return asset;
47334
48286
  if (typeof pixelSize !== 'number') pixelSize = void 0;
47335
48287
  else if (pixelSize <= 512) pixelSize = 512;
47336
48288
  else if (pixelSize <= 1024) pixelSize = 1024;
@@ -49549,12 +50501,12 @@ var package_default = {
49549
50501
  author: 'Framer',
49550
50502
  license: 'MIT',
49551
50503
  scripts: {
49552
- coverage: 'yarn :jest --coverage',
49553
- lint: 'yarn :eslint ./src --ext .ts,.tsx --format codeframe --quiet --cache',
50504
+ coverage: 'jest --coverage',
50505
+ lint: 'eslint ./src --ext .ts,.tsx --format gha-codeframe --quiet --cache',
49554
50506
  'lint:ci': 'yarn lint --cache-strategy content --cache-location $HOME/.cache/eslint/framer-library',
49555
50507
  'lint:fix': 'yarn lint --fix',
49556
- test: 'yarn :jest',
49557
- watch: 'yarn :jest --watch',
50508
+ test: 'jest',
50509
+ watch: 'jest --watch',
49558
50510
  postinstall: 'node postinstall.cjs',
49559
50511
  },
49560
50512
  dependencies: {
@@ -49571,17 +50523,19 @@ var package_default = {
49571
50523
  '@testing-library/react': '^13.4.0',
49572
50524
  '@testing-library/user-event': '^14.4.3',
49573
50525
  '@types/dom-navigation': '^1.0.5',
49574
- '@types/google.fonts': '^1.0.5',
49575
- '@types/node': '^20.16.5',
49576
- '@types/react': '^18.2.67',
49577
- '@types/react-dom': '^18.2.22',
50526
+ '@types/fontfaceobserver': '2.1',
50527
+ '@types/google.fonts': '1.0',
50528
+ '@types/node': '22.16',
50529
+ '@types/react': '18.2',
50530
+ '@types/react-dom': '18.2',
49578
50531
  '@types/yargs': '^17.0.33',
49579
- '@typescript-eslint/eslint-plugin': '^8.35.0',
49580
- '@typescript-eslint/parser': '^8.35.0',
50532
+ '@typescript-eslint/eslint-plugin': '^8.36.0',
50533
+ '@typescript-eslint/parser': '^8.36.0',
49581
50534
  chalk: '^4.1.2',
49582
50535
  eslint: '^8.57.1',
49583
50536
  'eslint-plugin-framer-studio': 'workspace:*',
49584
50537
  immutable: '^3.8.2',
50538
+ jest: '29.4.1',
49585
50539
  'jest-diff': '^29.3.1',
49586
50540
  'jest-environment-jsdom': '^29.3.1',
49587
50541
  'jest-environment-jsdom-global': '^4.0.0',
@@ -49589,11 +50543,11 @@ var package_default = {
49589
50543
  react: '^18.2.0',
49590
50544
  'react-dom': '^18.2.0',
49591
50545
  semver: '^7.7.1',
49592
- typescript: '^5.7.3',
50546
+ typescript: '^5.8.3',
49593
50547
  yargs: '^17.7.2',
49594
50548
  },
49595
50549
  peerDependencies: {
49596
- 'framer-motion': '12.14.0',
50550
+ 'framer-motion': '>=12.14.0',
49597
50551
  react: '^18.2.0',
49598
50552
  'react-dom': '^18.2.0',
49599
50553
  },
@@ -50110,6 +51064,7 @@ export {
50110
51064
  useSpring,
50111
51065
  useSVGTemplate,
50112
51066
  useTime,
51067
+ useTracking,
50113
51068
  useTransform,
50114
51069
  useUnmountEffect,
50115
51070
  useVariantState,